Haskell Charts
A library for rendering 2D charts from haskell.
Features
- Line, Point, Bar and Fill plots, along with combinations.
- Basic Pie Charts
- Automatic layout adjustment
- Auto-scaling of axis values
- Linear, Log, and Time axes
- 2 APIs: one simpler, one more flexible
- Extensible to support new plot types and new layouts
- Rendering to PNG, PS, SVG and PDF files as well as GTK windows (and potentially other cairo backends)
News
28 May 2009
v0.11 of the library has been uploaded to hackage. New features:
- The library now uses Russell O'Connor colour package, and hence supports transparency
- marker lines that span the width/height of a chart
25 March 2009
Don Stewart has put together a short movie showing the library in action.
22 February 2009
V0.10 has been pushed to hackage. Main changes include:
- Support for bar charts
- Compatible with gtk2hs 0.10
- Tested with ghc 6.10
28 October 2008
V0.9 has been pushed to hackage. There's quite a lot of changes here. They include:
- Improved type safety in plots. A layout is now parametrised by the types of its axes. In addition to potentially reducing bugs, this also means that the style of axis (eg normal v. log v. time) is chosen automatically, depending on the data plotted.
- Use of Data.Accessor to make all those record types in the API easier to user
- A flag to reverse the direction an axis is drawn
- Preliminary support for "picking", ie the ability to make coordinates in the resulting chart back to meaningful application values. The API is finished, but the internals are not yet complete.
These changes result in changes to the API. Feedback on these changes are welcome.
Also, I've set up a mailing list for announcements and discussions: http://groups.google.com/group/haskell-charts
11 August 2008
Haddock lives! I've updated the public API documentation to match v 0.8.
6 July 2008
New features in the just released v 0.8 include:
- Better control over lines styles and fonts
- Cairo SVG output support
- Simple Pie Charts (thanks to sample code originally posted by Neal Alexander)
Apologies that the API docs on this ste are still a bit out of date. Having upgraded to ghc 6.8.3, it seems there's no haddock yet to support it.
8 May 2008
Another version, tagged "CHART_0_7", and uploaded to hackage. New we have:
- Automatic scaling of time axes
- Error bars
- An extensible monad for rendering
- Slightly improved image quality for bitmap outputs
Note that the haddock API documentation linked to below is a little out of date. This new version makes user of the newtype deriving ghc extension, which isn't parsed by my ailing haddock 0.8. Time to upgrade it...
10 Mar 2008
I've tagged the current version "CHART_0_6", and uploaded the package to hackage. New features include:
- The new Simple API
- Axis titles
- Significant improvments to the layout code that should make it easy to make layout changes (or create new layouts) going forward.
25 Feb 2008
I've pushed David Roundy's patches implementing the "simple" interface. This makes usage from within ghci feasible. A tag and release to hackage will follow. See the comments at the the start of Simple.hs for information and examples.
Examples
Simple API
The "simple" API is straightforward to use directly from the ghci REPL. For example:
$ ghci -package Chart ... Prelude> :m Graphics.Rendering.Chart.Simple Prelude Graphics.Rendering.Chart.Simple> plotWindow [0,0.1..2.9] sin
will produce a chart in a window:
Standard API
(Click on the example to enlarge and view it's haskell source)
Documentation
The documentation automatically generated by haddock is available here. This corresponds to the repo state tagged CHART_0_6'
To-Do
(too long to list!)
Dependencies
- Cairo interface for haskell. This is presently only available within the gt2hs library.
Cabal >= 1.2. This comes with ghc-6.8, but needs to be installed in 6.6
- data-accessor
- colour
Download
via darcs, with the command: darcs get http://www.dockerz.net/repos/chart or get a (maybe more) stable version from hackage.
To build
Follow the usual cabal routine. If you fetched from darcs:
cd chart runghc Setup.hs configure runghc Setup.hs build sudo runghc Setup.hs install
or from hackage:
tar -xzf Chart-0.9.tar.gz cd Chart-0.9 runghc Setup.hs configure runghc Setup.hs build sudo runghc Setup.hs install
(Cabal note: the sudo is required to install into a system wide ghc package database. If you want to install only for the current user, then add something like "--user --prefix ~/ghc_local" to the configure line, and drop the sudo)
Finally, to build the set of test charts into a single executable:
cd tests; ghc --make test.hs ./test
Credits
Thanks to David Roundy, Francisco Jerez, and Russell O'Connor for contributing patches.
Contact
Mailing List : http://groups.google.com/group/haskell-charts
or Tim Docker:
Patches welcome!







