Chart

A library for generating 2D Charts and Plots A library for generating 2D Charts and Plots, with backends provided by Cairo (http://hackage.haskell.org/package/Chart-cairo) and Diagrams (http://hackage.haskell.org/package/Chart-diagrams). Documentation: https://github.com/timbod7/haskell-chart/wiki.
A framework for creating 2D charts in Haskell. For the simplest API, see the Graphics.Rendering.Chart.Easy module. When more control is required, understanding the various data types is necessary. The basic model is that you define a value representing a chart to be displayed (eg. a Layout), and then convert it to a Renderable by applying toRenderable. This Renderable is then actually output by calling a function in an appropriate graphics backend, eg renderableToFile. Currently, there are three types of charts:
  • Layout is a standard XY chart
  • LayoutLR is an XY chart with independent left and right axes
  • PieLayout is a pie chart
Layout and LayoutLR charts can be stacked vertically using the StackedLayouts type. Renderables can be composed in arbitrary ways using the Graphics.Rendering.Chart.Grid module. Many of the record structure involved in the API have a large number of fields. Lenses are provided to access each field. Also, for each record type, there is generally a default value, which can be accessed through the def value of the Default typeclass.
Specific Chart TODO: area3DChart, line3DChart, stockChart, radarChart, pie3DChart, doughnutChart, bar3DChart, ofPieChart, surfaceChart, surface3DChart, bubbleChart
A haskell Charting library targetting SVG.
A product type consisting of a Style, which is the stylistic manifestation of chart data, and ChartData representing where data is located on the chart canvas (an xy-plane). A simple example is:
>>> Chart defaultRectStyle (RectData [one])
Chart {chartStyle = Style {size = 6.0e-2, borderSize = 1.0e-2, color = Colour 0.02 0.73 0.80 0.10, borderColor = Colour 0.02 0.29 0.48 1.00, scaleP = NoScaleP, textAnchor = AnchorMiddle, rotation = Nothing, translate = Nothing, escapeText = EscapeText, frame = Nothing, lineCap = Nothing, lineJoin = Nothing, dasharray = Nothing, dashoffset = Nothing, hsize = 0.6, vsize = 1.1, vshift = -0.25, glyphShape = SquareGlyph}, chartData = RectData [Rect (-0.5) 0.5 (-0.5) 0.5]}
Using the defaults, this chart is rendered as:
writeChartOptions "other/unit.hs" $ mempty & #hudOptions .~ defaultHudOptions & #chartTree .~ unnamed [r]
Module for accessing minified chart code (http://www.chartjs.org/). As an example:
import qualified Language.Javascript.Chart as Chart

main = do
putStrLn $ "Chart version " ++ show Chart.version ++ " source:"
putStrLn =<< readFile =<< Chart.file Chart.Chart
This package installs data files containing the chart.js sources, which must be available at runtime. If you want to produce an executable with no dependency on associated data files, you can use the file-embed library (https://hackage.haskell.org/package/file-embed):
{-# LANGUAGE TemplateHaskell #-}

import Data.FileEmbed
import qualified Data.ByteString as BS
import qualified Language.Javascript.Chart as Chart
import Language.Haskell.TH.Syntax

main = print chartContents

chartContents :: BS.ByteString
chartContents = $(embedFile =<< runIO (Chart.file Chart.Chart))
The Chart code to obtain.
The base chart.js system.
Convert a character to its Unicode code point (cf. ord)
'C', @since 4.16.0.0
The abstract drawing operation generated when using the the chart drawing API. See the documentation of the different function for the correct semantics of each instruction:
Cairo backend for Charts. Cairo backend for Charts.