Module chart
Expand description
Time-series charts — Chart (a full line/area plot with grid lines,
axis ticks and a legend) and Sparkline (a compact, chromeless
variant for inline trend cells).
Both render one or more Series of f32 samples. A series is mapped
to pixels with the standard time-series projection: the samples are
evenly spaced across the plot width and scaled against a shared max
so multiple series share a vertical axis. The top edge of each series
is a stroked polyline; with Chart::with_area an optional translucent
area fill is dropped from the line down to the baseline.
Colours come entirely from the Theme: grid lines from the standard
border colour, axis tick labels from the dim text colour, and each
series carries its own Series::color (callers typically pull these
from the theme accent / semantic ramps). Nothing is hard-coded.
Structs§
- Chart
- Full time-series line/area chart with grid, axis ticks and a legend.
- Chart
Labels - The text a
Chartpaints around its plot. Any of them may be empty. - Chart
Style - Grid, header and series styling for a
Chart. - Rolling
Series - A fixed-capacity rolling window of samples — the store behind a live,
streaming chart or sparkline. Once full, every
pushdrops the oldest sample, soas_slicealways reads oldest → newest and can be handed straight toSeriesorSparkline::paint. - Series
- One labelled data series.
datais sampled left-to-right across the plot;coloris the line/area tint;legendis the label shown in the chart’s legend strip (empty string = omit from the legend). - Sparkline
- Compact, chromeless trend line — no axis, grid, title or legend. Just the area fill + line, sized to fill its rect. Drop one into a table cell or a stat card to show a recent trend.
- Trend
Range - The value interval a trend maps onto its plot’s height:
lolands on the baseline,hion the top edge, and values outside clamp to the plot. - Trend
Style - Paint options for a trend line — the one line/area renderer behind
Sparklineand every series of aChart.
Enums§
- Trend
Curve - How consecutive samples are joined.
- Trend
Fill - How the area under a trend line is filled.