BSD-3-Clause licensed by Tony Day
Maintained by [email protected]
This version can be pinned in stack with:chart-svg-0.6.1.0@sha256:c9cb5af7dab3e3b3f2627954f235c6415253c5d185d0db1dd5666b837e6e0981,3222
#+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
:r
:set prompt "> "
: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 .~ palette c & #size .~ 0.015) <$> [0..2]
cs = zipWith (\s x -> LineChart s [x]) styles lines
lineExample = mempty & #chartTree .~ 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.

* Examples

To redraw all the examples in Chart.Examples

#+begin_src haskell :results output
import Chart.Examples
writeAllExamples
#+end_src

#+RESULTS:
: ok




Changes

0.6.1

  • numhask upper bound bumped to 0.12
  • switch to doctest-parallel

0.6

0.6 is a major refactor.

  • Chart

    • refactored Chart from a sum type to a named Style, ChartData pair.
    • in Chart (..) + chartStyle - style
    • introduced ChartData
    • integrated the various *Style types to a single type.
    • introduced partial data lenses: *Data’
    • added chart patterns: *Chart
      • blankChart1
  • ScaleP

    • introduced the ScaleP type
    • added scaleP to Style
    • added the scaleP function
      • maybeProjectWith + projectChartDataWith
      • scaleStyle - overText + scaleChartData
      • scaleRatio
  • Chart.Style

    • integrated styles
      • colourChart + colourStyle
      • Style (..)
      • defaultStyle
      • scaleStyle
      • default*Style
      • gpalette -gpalette1
  • boxes

    • added safeBox’, safeStyleBox’
  • Chart.Compound

  • Factored State out of Hud

    • ChartHud lenses removed: canvasBox’, canvasStyleBox’, hudBox’, hudStyleBox’
    • Introduced HudChartSection type and hudChartBox’ which replaces ChartHud lenses.
    • removed runHud
    • removed hud effect functionality: closes, fromEffect, applyChartAspect, getHudBox
    • new hud manipulation tools: appendHud, makeHuds, projectChartTreeWith, addHud, finalCanvas
  • Chart.Hud API

      • axis + axisHud - title + titleHud - legend + legendHud
    • removed placeText
    • added flipPlace
      • TitleOptions - Title
      • TickStyle + Tick
      • axisHud + titleHud
      • legend - legendFrame
    • new tick lenses: + formatN’, numTicks’, tickExtend’
    • In LegendOptions: + scaleChartBy - overallScale + legendSize - size
    • In AxisOptions: + adjustments - adjust + axisBar - bar
  • refactored Priority to a named pair

  • Chart.Markup

    • added forgetHud
      • CssPreferColorScheme + PreferColorScheme
      • CssShapeRendering + ShapeRendering
      • defaultCssFontFamilies
  • Integrated chart styles to a single Style type

  • changed defaults

      • defaultXAxisOptions + defaultYAxisOptions - defaultAxisOptions
      • defaultGlyphTick + defaultGlyphTickStyleX + defaultGlyphTickStyleY
      • defaultTicks + defaultXTicks + defaultYTicks
      • defaultTick - defaultTickStyle
  • Chart.Bar

    • added barTextCharts
    • added textShiftVert to BarOptions
  • Data.Colour

      • palette - palette1
      • paletteO - palette1a
  • Chart.Surface

      • surfaceLegendChart
      • surfaceAxisOptions
      • surfaceLegendAxisOptions
      • gridReferenceChart
      • addSurfaceLegend
  • Chart.Data

      • singletonGuard + isSingleton

0.5.1.1

  • test suite removed

0.5.1.0

  • Bumped markup-parse lower bound to >=0.1
  • Renamed LegendOptions.content to LegendOptions.legendCharts
  • markup* functions now return Markup
  • renderStyle added as a MarkupOptions component

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