I use Haskell-Chart according to the example eample-1. Haskell-Chart generates content to file
toFile def "example1_big.png" $ do
...
Is it possible generate content of chart to ByteString instead file? I can not find a solution in the documentation.
Unfortunately this is not possible is a direct manner.
toFile
calls upon functions in thecairo
library likewithPDFSurface
,withSVGSurface
which themselves call into the cairo C-library and only take file names.You can always write to a temporary file and read the contents back in like this: