[Chart] New stateful API

Sacha Sokoloski sacha404 at gmail.com
Fri Aug 29 10:21:56 BST 2014


Hi Tim,

I never like the Simple interface before and barely used it, but this 
new interface looks quite nice. It definitely has a proper 'haskell 
flavour' unlike the Simple interface which seemed very hacky. Hopefully 
it will be useful to people new to chart.

Another idea that popped into my head wrt improving the user 
friendliness of Chart would be something like a Chart-contrib package. 
The way I use it, Chart provides a very general interface for 
constructing plots, and so if there are specific kinds of plots that I 
generate over and over again (e.g. graph of a function, histograms, etc) 
I tend to write more specific functions which generate more special 
purpose plots.

Histograms in particular I found took a lot of tweaking to get looking 
nice, and I can imagine it to be a barrier for a lot of people that they 
would just want to be able to punch in 'histogram' with a list of data 
points and get something on the screen. If there are other users here 
who also have a bunch of homebrew plots and layouts with nice 
interfaces, maybe it would be nice to gather them together so that new 
users can get pretty things on the screen faster.

Anyway, it's just a thought. Chart generally does exactly what I want. 
I'm excited about these new vector field plots!

  - Sacha

P.S.: I sent off a merge request for my contour plot code. Hopefully 
it's up to standard. If there's interest I can also try to gather up my 
code for generating animations in a gtk window which is designed to work 
with chart.

P.P.S: Any progress on improving the Grid interface?

On 25/08/14 01:00 PM, chart-request at projects.haskell.org wrote:
> Hi,
>
> I?ve never liked the Simple API very much, and last week I played with a stateful API for constructing charts. I think it turned out reasonably well: it?s as flexible as constructing the layout records explicitly,  but is more concise. Producing a basic chart is a one liner.
>
> Some examples of it?s use are here:
>
> https://github.com/timbod7/haskell-chart/wiki/Monadic-API
>
> The code to implement it is here:
>
> https://github.com/timbod7/haskell-chart/blob/master/chart/Graphics/Rendering/Chart/State.hs
>
> Any comments or feedback? I?d like to replace Simple with this. I don?t think the Simple API has m(any?) users in any case.
>
> Tim




More information about the Chart mailing list