SimpleGraph is a bare-bones package for rendering data as line and bar charts, both as HTML and as SVG.
For examples, see the REAdME. For a demo, see https://jxxcarlson.github.io/app/gamblers_ruin.html
lineChart : GraphAttributes -> List Point -> Html msg
Render a list of points (pairs of floats) to Html as a line chart. using the parameters of GraphAttributes. GraphAttributes controls the appearance of the graph -- width, height, color, tick marks on the axes. The x-coordinates of the data are assumed to be in increasing order.
lineChartWithDataWindow : DataWindow -> GraphAttributes -> List Point -> Html msg
This function is like lineChart, but with the additional DataWindow parameter. A DataWindow defines the range of x and y coordinates that are displayed. In lineChart, the DataWindow is deduced from the data presented.
barChart : GraphAttributes -> List Basics.Float -> Html msg
Render a list of numbers to Html as a bar chart using the parameters of GraphAttributes.
scatterPlot : GraphAttributes -> List Point -> Html msg
Make a scatter plot of a list points, render as Html
( Basics.Float, Basics.Float )
The data to be graphed by SimpleGraph.asHtml is a List Point.
{ xMax : Basics.Float
, xMin : Basics.Float
, yMax : Basics.Float
, yMin : Basics.Float
}
A DataWindow is a rectangle which determines the x and y ranges of the data to be displayed..
{ graphHeight : Basics.Float
, graphWidth : Basics.Float
, options : List Option
}
A GraphAttributes value defines the size on the screen occupied by the graph and the color of the line.
Use the options field to customize the line chart. Examples: (1) [Color "blue"] makes the charted line blue (2) [Color "blue", XTickmarks 10, YTickmarks 5] places 10 tick marks along the x-axis and 5 tick marks along the y-axis, (3) options = [ ] produces a bare-bones graph.
The DeltaX option is used to specify the distnce from the leading edge of one bar to the next in bar graph.
The Scale option rescales the graph along both the
x and y axes. Negative parameters flip the graph.
Thus Scale 1.0 -1.0
flips the graph in the y direction.
An important use of the Scale option is to correct the misbehavor of Safari, which presents the graphs upside down (!!)
lineChartAsSVG : GraphAttributes -> List Point -> Svg msg
Render a list of points to SVG as a line chart using the parameters of GraphAttributes.
lineChartAsSVGWithDataWindow : DataWindow -> GraphAttributes -> List Point -> Svg msg
Render a list of points to Svg as a line chart using the parameters of GraphAttributes and DataWindow.
barChartAsSVG : GraphAttributes -> List Basics.Float -> Svg msg
Render a list of numbers to Svg as a bar chart using the parameters of GraphAttributes.
scatterPlotAsSVG : GraphAttributes -> List Point -> Svg msg
Make a scatter plot of a list points, render as SVG