Skip to main content

Module plot

Module plot 

Source
Expand description

Unstyled plotting: scales, shapes, axes, grids, labels, and the element and hover tracking behind every Plot.

Colors are always handed in by the caller. A styled layer supplies chart defaults, the tooltip overlay, and hover timing through PlotMotion.

Re-exports§

pub use label::PlotLabel;
pub use scale::PlotValue;

Modules§

label
scale
shape

Structs§

AxisText
A tick label on a PlotAxis: its text, where along the axis it sits and how it is drawn. font_size defaults to TEXT_SIZE.
Grid
Axis-aligned grid lines across a plot, at the given x and y positions.
PathCache
A tessellated path reused across frames while its shape is unchanged.
PathCaches
The PathCaches of a plot that is rebuilt on every render, kept in the window’s element state so they outlive the plot value.
PlotAxis
Axis lines and their tick labels.
PlotElement
Paints a Plot filling its container, with hover tracking and the plot’s tooltip overlay when the plot has an Plot::id.
PlotHover
The datum a plot has under the pointer this frame, handed to Plot::hover.
PlotMotion
The timing of a plot’s hover: how its progress fades in and out, and the spring a pointer follows the hovered datum with.
ShapeKey
A shape key from its projected points (origin-relative) and whatever else shapes the tessellation (stroke width, curve style, dash pattern).
TooltipState
The datum the cursor resolved to, returned from Plot::tooltip_state.

Enums§

AxisLabelPlacement
Where a chart draws the tick labels of its value axis.
AxisLabelSide
Which side of an axis line the tick labels render on.
Curve
How a Line or Area connects its points, like d3’s curve factories.

Constants§

AXIS_GAPDeprecated
The x-axis gutter for labels at the default TEXT_SIZE.

Traits§

Plot

Functions§

axis_gutter
The space below (or above) an x-axis line that tick labels of font_size need: the gap PlotAxis leaves between the line and the labels, the labels themselves, and a trailing gap.
hover_progress
How far the enclosing plot’s hover has faded in this frame, from 0 to 1; see PlotHover::progress.
is_hover_entering
Whether this frame is the first the enclosing plot’s cursor is on a datum; see PlotHover::is_entering.
origin_point
pointer_spring
The spring a hover pointer — the crosshair, highlight band or hover dot — follows the hovered datum with: the active PlotMotion’s pointer, which snaps unless a styled layer projects one.
polygon