ihaskell-charts 0.2.0.0 → 0.2.1.0
raw patch · 2 files changed
+25/−24 lines, 2 filesdep ~Chart-cairodep ~basedep ~classy-prelude
Dependency ranges changed: Chart-cairo, base, classy-prelude, ihaskell
Files
- IHaskell/Display/Charts.hs +20/−19
- ihaskell-charts.cabal +5/−5
IHaskell/Display/Charts.hs view
@@ -1,16 +1,17 @@ {-# LANGUAGE NoImplicitPrelude, CPP #-}+ module IHaskell.Display.Charts () where -import ClassyPrelude+import ClassyPrelude -import System.Directory-import Data.Default.Class-import Graphics.Rendering.Chart.Renderable-import Graphics.Rendering.Chart.Backend.Cairo+import System.Directory+import Data.Default.Class+import Graphics.Rendering.Chart.Renderable+import Graphics.Rendering.Chart.Backend.Cairo import qualified Data.ByteString.Char8 as Char-import System.IO.Unsafe+import System.IO.Unsafe -import IHaskell.Display+import IHaskell.Display width :: Width width = 450@@ -22,8 +23,8 @@ display renderable = do pngDisp <- chartData renderable PNG - -- We can add `svg svgDisplay` to the output of `display`,- -- but SVGs are not resizable in the IPython notebook.+ -- We can add `svg svgDisplay` to the output of `display`, but SVGs are not resizable in the IPython+ -- notebook. svgDisp <- chartData renderable SVG return $ Display [pngDisp, svgDisp]@@ -34,17 +35,17 @@ -- Write the PNG image. let filename = ".ihaskell-chart.png"- opts = def{_fo_format = format, _fo_size = (width, height)}- toFile = renderableToFile opts+ opts = def { _fo_format = format, _fo_size = (width, height) }+ mkFile opts filename renderable + -- Convert to base64.+ imgData <- readFile filename+ return $+ case format of+ PNG -> png width height $ base64 imgData+ SVG -> svg $ Char.unpack imgData #if MIN_VERSION_Chart_cairo(1,3,0)- toFile filename renderable+mkFile opts filename renderable = renderableToFile opts filename renderable #else- toFile renderable filename+mkFile opts filename renderable = renderableToFile opts renderable filename #endif-- -- Convert to base64.- imgData <- readFile $ fpFromString filename- return $ case format of- PNG -> png width height $ base64 imgData- SVG -> svg $ Char.unpack imgData
ihaskell-charts.cabal view
@@ -7,7 +7,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.0.0+version: 0.2.1.0 -- A short (one-line) description of the package. synopsis: IHaskell display instances for charts types@@ -58,14 +58,14 @@ OverloadedStrings -- Other library packages from which modules are imported.- build-depends: base ==4.6.* || ==4.7.*,- classy-prelude >=0.6,+ build-depends: base >=4.6 && <4.9,+ classy-prelude >=0.10.5, bytestring, data-default-class, directory, Chart,- Chart-cairo,- ihaskell >= 0.5+ Chart-cairo >=1.2,+ ihaskell >= 0.6.2 -- Directories containing source files. -- hs-source-dirs: