This module contains higher-level SVG plotting elements.
A dot without visual representation.
Make a shape with a white core.
someDot : Svg msg
someDot =
empty radius width circle "blue" plane x yMake a shape with a white border.
someDot : Svg msg
someDot =
disconnected radius width circle "blue" plane x yMake a shape with a little translucent border.
someDot : Svg msg
someDot =
aura radius width opacity circle "blue" plane x yMake a regular shape.
someDot : Svg msg
someDot =
full radius circle "blue" plane x ySeries with no interpolation.
someScatter : Svg msg
someScatter =
scatter plane .x .y (full 6 circle "blue") pointsSeries with linear interpolation.
Area series with linear interpolation.
Series with monotone interpolation.
Area series with monotone interpolation.
You can draw a bar chart like this:
main : Svg msg
main =
svg
[ width (String.fromFloat plane.x.length)
, height (String.fromFloat plane.y.length)
]
[ bars plane 0.8
[ bar [ fill "red" ] << Tuple.first
, bar [ fill "blue" ] << Tuple.second
]
[ ( 2, 3 ), ( 5, 1 ), ( 1, 5 ) ]
]Note on width: The width takes catersian units, however, should you have
a width in SVG units, you can use Svg.Coordinates.scaleCartesian to
translate it into cartesian units.
Make a histogram.
main : Svg msg
main =
svg
[ width (String.fromFloat plane.x.length)
, height (String.fromFloat plane.y.length)
]
[ histogram plane 1 1 (bar [ stroke blueStroke, fill blueFill ]) [ 1, 2, 3, 6, 8, 9, 6, 4, 2, 1 ] ]Renders a line.
myLine : Svg msg
myLine =
horizontal plane [ stroke "pink" ] x0 y0 x1 y1Renders a horizontal line with the full length of the range.
myXAxisOrGridLine : Svg msg
myXAxisOrGridLine =
fullHorizontal plane [] yPositionRenders a vertical line with the full length of the domain.
myYAxisOrGridLine : Svg msg
myYAxisOrGridLine =
fullVertical plane [] xPositionRenders a horizontal line.
myLine : Svg msg
myLine =
horizontal plane [ stroke "pink" ] y x0 x1Renders a vertical line.
myLine : Svg msg
myLine =
vertical plane [ stroke "pink" ] x y0 y1ProTip: Passing a negative value as the height/width of a tick renders it mirrored on the other side of the axis!
Renders a single tick for the horizontal axis.
Renders ticks for the horizontal axis.
horizontalTicks : Svg msg
horizontalTicks =
xTicks plane height [ stroke "pink" ] axisYCoordinate tickPositionsRenders a single tick for the vertical axis.
Renders ticks for the vertical axis.
verticalTicks : Svg msg
verticalTicks =
yTicks plane width [ stroke "pink" ] axisXCoordinate tickPositionsRenders a label for the horizontal axis.
horizontalLabel : Svg msg
horizontalLabel =
xLabel "blue" String.fromFloat plane y xRenders labels for the horizontal axis.
horizontalLabels : Svg msg
horizontalLabels =
xLabels plane (xLabel "blue" String.fromFloat) axisYCoordinate tickPositionsRenders a label for the vertical axis.
verticalLabel : Svg msg
verticalLabel =
yLabel "blue" String.fromFloat plane x yRenders labels for the vertical axis.
verticalLabels : Svg msg
verticalLabels =
yLabels plane (yLabel "blue" String.fromFloat) axisXCoordinate tickPositions