This module contains low-level SVG plotting elements.
Set the dimensions of your chart, but let it respond to size changes in parent.
Create an id to use in a clip path to prevent elements from going into your margins.
svg []
[ frame "some-id" plane
, g [ clipPath "url(#some-id)" ] [ stuffThatShouldntGoIntoTheMargin ]
]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.
Renders a line.
myLine : Svg msg
myLine =
line plane [ stroke "pink" ] x0 y0 x1 y1Renders a horizontal line with the full length of the range.
myXAxisOrGridLine : Svg msg
myXAxisOrGridLine =
xAxis plane [] yPositionRenders a vertical line with the full length of the domain.
myYAxisOrGridLine : Svg msg
myYAxisOrGridLine =
yAxis plane [] xPositionPlace an arrow pointing to the right somewhere.
xArrow plane color x y xOff yOffPlace an arrow pointing up somewhere.
yArrow plane color x y xOff yOffRenders a horizontal line with the full length of the range.
Renders a horizontal line with the full length of the domain.
Renders 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" .timestamp format plane y datumRenders labels for the horizontal axis.
horizontalLabels : Svg msg
horizontalLabels =
xLabels plane (xLabel "blue" .timestamp format) axisYCoordinate dataRenders a label for the vertical axis.
verticalLabel : Svg msg
verticalLabel =
yLabel "blue" .age format plane x yRenders labels for the vertical axis.
verticalLabels : Svg msg
verticalLabels =
yLabels plane (yLabel "blue" .age format) axisXCoordinate dataPlace some SVG on specific coordinates.
Place some Html on specific coordinates. You must wrap your chart
in container for it to work! Remember also to put your html elements outside
your svg element, otherwise they won't work!
positionHtml plane x y xOff yOff
[ style "font-size" "14px" ]
[ text "Hello!" ]Container for your chart, in case you use the eventCatcher.
Without this, your coordinates from the events will be wrong!
Decode position of mouse when tracking events. The Plane may
change due to size changes of the viewport, so make sure to use the
one given in the second argument. Also, make sure to wrap your chart
in container otherwise your read coordinates maybe wrong!
Get the data coordinates nearest to the event.
Returns Nothing if you have no data showing.
Get the data coordinates horizontally nearest to the event.
Get the data coordinates nearest of the event within the radius
you provide in the first argument. Returns Nothing if you have no data showing.
Finds the data coordinates horizontally nearest to the event, within the distance you provide in the first argument.
A basic tooltip.
tooltip plane x y
[ style "font-size" "14px" ]
[ Html.text "I'm a tooltip!" ]Is x past the middle of the chart?
Get the midmost y coordinate.
Get the midmost x coordinate.
Set the size of your chart.