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)
Recent News
29 Apr 2013
After many years as a satisfied user of darcs, I've decided it's time to migrate the project to github. Sometimes mainstream acceptance is more important than personal preference. The official source repository for chart is now at https://github.com/timbod7/haskell-chart.
15 Dec 2011
Due to problems with google groups, the mailing list has a new home at http://projects.haskell.org/cgi-bin/mailman/listinfo/chart.
27 Oct 2010
Quite a few patches from others, and several of my own, make up the new v0.14. See /ReleaseNotes014 for the release announcement.
27 May 1010
I just uploaded v0.13.1 to hackage. This is a minor update, with some changes to suit the new gtk2hs release. Finally gtk2hs is cabalised - congratulations to the gtk2hs team for this significant step forward. Now installing gtk2hs+chart should be as simple as:
cabal update
cabal install gtk2hs-buildtools
cabal install gtk
cabal install chart
18 April 2010
Edward Z. Yang has written a blog post about the data accessor library, used by chart to make haskell records a little more user friendly. This might be useful background for new users who haven't seen this package before.
31 Mar 2010
V0.13 has been set loose. This time around, new stuff includes:
- A collection of changes that generalise Axis handling
- Area spots - a new type of plot
- Plot Annotations - the ability to place text arbitrarily.
- Control over how layouts are shown when they contain many items.
- Assorted bug fixes and drawing improvements to bar charts.
- Refactored test cases into separate files, making them better examples.
Examples
Simple API
The "simple" API is straightforward to use directly from the ghci REPL. For example:
$ ghci -package Chart-gtk ... Prelude> :m Graphics.Rendering.Chart.Gtk.Simple Prelude Graphics.Rendering.Chart.Gtk.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 its haskell source)
Documentation
The documentation automatically generated by haddock is available from hackage.
To-Do
- Change text rendering code to use pango for unicode support
- Add support for legends that overlay the chart, rather than sitting below/beside it
- More plot types!
Dependents
There's some nice software that makes use of this library. Follow the links to some applications:
criterion - a benchmarking library for haskell
Timeplot - a program for visualizing data from log files
Dependencies
1) Cairo interface for haskell. This is presently only available within the gtk2hs library. Now that gtk2hs is built using cabal, this is much easier than it was. However, some tweaks may still be required for your platform. See the gtk2hs home page for details.
2) All of the other dependencies cabal can sort out for you. They currently are:
time, mtl, array, data-accessor == 0.2.*, data-accessor-template >= 0.2.1.1 && < 0.3, colour >= 2.2.1
Download
via git, with the command: git clone https://github.com/timbod7/haskell-chart or get the stable version from hackage.
To build
Get gtk2hs up and running for you platform first. Then it should be as simple as:
cabal update cabal install chart-gtk
This installs the library. The test cases are in the downloaded package, but not installed or built by the above command. So if you want check they work and look at them as examples, you'll need to do this manually:
tar -xzf ~/.cabal/packages/hackage.haskell.org/Chart/0.13/Chart-0.13.1.tar.gz cd Chart-0.13.1/tests runghc all_tests.hs
Credits
Thanks to following for contributing patches:
- David Roundy
- Francisco Jerez
- Russell O'Connor
- Eugene Kirpichov
- Malcolm Wallace
- Bradford Larsen
- John Lato
- Khudyakov Alexey
- Dimitris Karangelos
Contact
Mailing List : http://projects.haskell.org/cgi-bin/mailman/listinfo/chart
or Tim Docker:
Patches welcome!










