[Haskell-cafe] Re: library for drawing charts

Neal Alexander wqeqweuqy at hotmail.com
Wed Jun 4 09:40:55 EDT 2008


Tim Docker wrote:
> Peter wrote:
>> Has anyone got some code for drawing charts? I don't mean
>> graphs of functions, ala
>>
>> http://dockerz.net/twd/HaskellCharts
>> ...
>> I would like something that can generate PNGs in memory, i.e. not
>> directly to a file.
> 
> The library at the above URL supports a range of backends through the
> (nice to use) cairo graphics API. In memory images are supported. Also,
> it's by no means just graphs of functions - that just happens to be
> several of the demos.
> 
>> I'd like 2D pie charts, bar charts and something like a google-o-meter.
> 
> An the moment it does line charts and a few variants of these. I'll add
> pie and bar charts when I need them - patches in the meantime gratefully
> accepted.
> 
> Tim

I was using the HaskellCharts library and needed the same two things; so 
i rolled a quick and dirty pie chart generator (Barchart is on the TODO 
list).


http://72.167.145.184:8000/Screenshot.png
http://72.167.145.184:8000/PieChart.hs

----

x <- widgetGetDrawWindow canvas
y <- widgetGetSize canvas

renderWithDrawable x (f y)

where f = PieChart.graph "title" 0x548B54 [(50.0,"A"), (50.0,"B")]



More information about the Haskell-Cafe mailing list