Skip to content
Chris Stryczynski edited this page Dec 27, 2018 · 45 revisions

A library for rendering 2D charts from Haskell.

Features

Plot Types

A variety of plot types are supported, including line, point, error bars and area fills. Drawing traditional bar charts and pie charts is also straightforward. By default, axis scaling and labelling is fully automatic, though can be manually overridden. Logarithmic axes are also supported.

Layouts can be stacked to display multiple charts in a single image.

New plot types can be easily defined, either directly in user code, or contributed as additions to the library.

Strongly Typed

A layout is parametrised in the API by the types of its axes. Numeric types are supported, of course, but also DateTime and indexed values. Lenses are used to simplify access to the data model.

Abstract Backend

Thanks to a successful Google Summer of Code project, rendering is now done through an abstracted backend API. Currently supported are Cairo and Diagrams, though implementing additional backends is straightforward. The cairo backend can render to PNG, PS, SVG and PDF files, as well as directly to GTK windows. The diagrams backend can render to SVG and PS files.

Picking Support

Although the library doesn't support interactivity directly, it produces "pick functions" which map from device coordinates back to model coordinates and chart elements. These functions can be used to create simple interactivity.

Gallery

Click on the example below to enlarge and view its Haskell source.

Example 1
Example 1

Example 2
Example 2

Example 3

Example 4

Example 5

Example 6

Example 7

Example 8

Example 9

Example 10

Example 11
Complete working project of this example: https://github.com/chrissound/HaskellChartBarGraphExample

Example 12

Example 13

Documentation

There are some basic instructions on getting up and running using the stack tool.

The haddock API documentation is available from Hackage:

A FAQ is under construction, and there is a page on configuring and using the various backend combinations.

Release Notes

Download and Installation

The stable version of the library is available from Hackage. To install the core library and the diagrams backend:

cabal update
cabal install chart-diagrams

For the cairo backend, it is recommended to install and test gtk2hs first. There are instructions on the Haskell wiki. Once that is done, installation of the chart library and cairo backend is also straightforward:

cabal update
cabal install chart-cairo

The development version of the library is available via git from the GitHub repository.

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
  • Jan Bracker
  • Ben Gamari
  • Douglas Burke
  • Anton Vorontsov

Contact

The Mailing List sees little traffic now. Most communications happens via the GitHub issue tracker. Feel free to use either.

Pull requests welcome!

Clone this wiki locally