chart-svg-0.3.1: Charting library targetting SVGs.
Safe HaskellNone
LanguageHaskell2010

Chart.Examples

Description

Examples of chart construction.

Synopsis

Unit & Hud

unitExample :: ChartSvg Source #

unit example

Iconic primitives.

lineExample :: ChartSvg Source #

line example

rectExample :: ChartSvg Source #

rect example

textExample :: ChartSvg Source #

text example

glyphsExample :: ChartSvg Source #

glyphs example

pathExample :: ChartSvg Source #

Compound path example.

Compounds

barExample :: ChartSvg Source #

Bar chart example.

sbarExample :: ChartSvg Source #

Stacked bar chart example.

waveExample :: ChartSvg Source #

wave example

surfaceExample :: ChartSvg Source #

The common way to create a surface chart (or contour chart or heat map) is usually a grid over a function, a process reified in surfacef.

This is also an example of mix and mixes. In this example, colors with the same lightness have been chosen in the gradient and the result should appear a fairly uniform lightness across the surface.

rosenbrock :: Double -> Double -> Point Double -> (Double, Point Double) Source #

function for testing

f(x,y) = (a-x)^2 + b * (y - x^2)^2
       = a^2 - 2ax + x^2 + b * y^2 - b * 2 * y * x^2 + b * x ^ 4
f'x = -2a + 2 * x - b * 4 * y * x + 4 * b * x ^ 3
f'y = 2 * b * y - 2 * b * x^2
f a b (Point x y) = (a^2 - 2ax + x^2 + b * y^2 - b * 2 * y * x^2 + b * x^4, Point (-2a + 2 * x - b * 4 * y * x + 4 * b * x ^ 3), 2 * b * y - 2 * b * x^2)

ellipseExample :: ChartAspect -> ChartSvg Source #

ellipse example

Under scaling, angles are not invariant, and this effects the shape of ellipses and thus SVG arc paths. Compare the effect of aspect changes to the axes of this ellipse:

Below is the same ellipse with FixedAspect 2. Points scale exactly, but the original points that represent the end points of the axes are no longer on the new axes of the ellipse.

quadExample :: ChartSvg Source #

quad example

cubicExample :: ChartSvg Source #

cubic example

vennExample :: ChartSvg Source #

venn diagram

arrowExample :: ChartSvg Source #

arrow example

Which happens to be the gradient of the surface example.

dateExample :: ChartSvg Source #

date example

A hud that has date as the x-axis, and time as the y-axis. See placedTimeLabelContinuous.

Colour

gradientExample :: ChartSvg Source #

gradient example

Mixing Colours using the oklch color model.

wheelExample :: ChartSvg Source #

Color wheel displaying palette1 choices

  • -

Debugging

debugExample :: ChartSvg -> ChartSvg Source #

Adding reference points and bounding boxes to visualize chart alignment for use in debugging charts.

  • -

writeAllExamples :: IO () Source #

Run this to refresh example SVG's.

writeAllExamplesDark :: IO () Source #

Version of charts with a dark-friendly hud