chart-svg-0.6.0.0: Charting library targetting SVGs.
Safe HaskellSafe-Inferred
LanguageGHC2021

Chart.Examples

Description

Examples of chart construction.

Synopsis

Unit & Hud

Iconic primitives.

pathExample :: ChartOptions Source #

Compound path example.

Compounds

barExample :: ChartOptions Source #

Bar chart example.

barDataExample :: BarData Source #

Example data for Bar chart

sbarExample :: ChartOptions Source #

Stacked bar chart example.

surfaceExample :: ChartOptions 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 -> ChartOptions Source #

ellipse example

Under scaling, angles are not invariant, and this effects the glyphShape 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.

arrowExample :: ChartOptions Source #

arrow example

Which happens to be the gradient of the surface example.

dateExample :: ChartOptions Source #

date example

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

Colour

gradientExample :: ChartOptions Source #

gradient example

Mixing Colours using the oklch color model.

wheelExample :: ChartOptions Source #

Color wheel displaying palette choices

Debugging

debugExample :: ChartOptions -> ChartOptions Source #

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

Compound Charts

compoundExample :: ChartOptions Source #

A merge of two rect charts with different data ranges.

stackExample :: ChartOptions Source #

Usage of stack.

Priority

priorityv1Example :: ChartOptions Source #

priority Version 1 example

priorityv2Example :: ChartOptions Source #

priority Version 2 example

Writing to file

pathChartOptions :: [(FilePath, ChartOptions)] Source #

All the examples and the associated filepaths

writeAllExamples :: IO () Source #

Run this to refresh example SVG's.

writeAllExamplesDark :: IO () Source #

Version of charts with a dark-friendly hud