BSD-3-Clause licensed by Tony Day
Maintained by [email protected]
This version can be pinned in stack with:chart-svg-0.5.2.0@sha256:23f7a9b160f654903cdaac60d27a7c121fc1fea30efcb37898bf431b0d8cbb2a,4439
#+TITLE: chart-svg

[[https://hackage.haskell.org/package/chart-svg][file:https://img.shields.io/hackage/v/chart-svg.svg]] [[https://github.com/tonyday567/chart-svg/actions?query=workflow%3Ahaskell-ci][file:https://github.com/tonyday567/chart-svg/workflows/haskell-ci/badge.svg]]

[[file:other/banner.svg]]

A charting library targetting SVG.

* Usage

#+begin_src haskell :file other/usage.svg :results output graphics file :exports both
:set -XOverloadedLabels
:set -XOverloadedStrings
import Chart
import Optics.Core
lines = [[Point 0.0 1.0, Point 1.0 1.0, Point 2.0 5.0],[Point 0.0 0.0, Point 2.8 3.0],[Point 0.5 4.0, Point 0.5 0]]
styles = (\c -> defaultLineStyle & #color .~ palette1 c & #size .~ 0.015) <$> [0..2]
cs = zipWith (\s x -> LineChart s [x]) styles lines
lineExample = mempty & #charts .~ named "line" cs & #hudOptions .~ defaultHudOptions :: ChartOptions
writeChartOptions "other/usage.svg" lineExample
#+end_src

#+RESULTS:
[[file:other/usage.svg]]

See the haddock documentation for a detailed overview.

* Related projects

Downstream projects, where usage of chart-svg in various states of development can be found, include:

[[https://github.com/tonyday567/color-adjust][color-adjust]] - experimenting with the [[https://bottosson.github.io/posts/oklab/][oklab]] colour space. Some of this has been incorporated in to chart-svg.

[[https://github.com/tonyday567/dotparse][dotparse]] - a chart-svg <-> graphviz bridge

[[https://github.com/tonyday567/prettychart][prettychart]] - a chart-svg <-> ghci bridge

[[https://github.com/tonyday567/markup-parse][markup-parse]] - parse and prints markup (eg SVG)

Changes

0.5.0

  • Library split into markup-parse and chart-svg.
  • test removed

0.4.1

  • Changes due to numhask-0.11 upgrade
  • remove broken surface legend

0.4

  • Markup type introduced, representing an abstract markup DSL that could be described as simplified but non-compliant XML
    • Chart.Svg replaced by Chart.Markup & Chart.Markup.Parser
    • ChartSvg replaced by ChartOptions
    • functionality includes both printing and parsing.
    • the rendering pipeline is now ChartOptions => Markup => ByteString
  • lucid removed as a dependency.
  • tree-diff introduced in the test routines.
  • flatparse replaces attoparsec
  • string-interpolate replaces neat-interpolation

0.3

  • Chart type rewritten
    • Chart data is no longer a separate element
    • charts are monomorphic (underlying data is Double)
  • Aligned with prefer-color-scheme usage
  • oklab usage as per emerging CSS standards
  • chart-reanimate is a separate library
  • formatn is a seprate library
  • introduced a ChartTree type as a tree of named charts to facilitate downstream usage of classes.

0.2.2

  • Changed api for palette

0.2.1

  • Changed api for reanimate hooks.
  • Rationalised default options.

0.2.0

  • Reanimate support. See app/reanimate-example.hs
  • Data.Path added: support for Path style charts.
  • Chart.Examples expanded
  • Improvements to documentation.
  • web-rep support removed.

0.1.2

  • basic charts