Charts
ISparkline
A trend line small enough to sit inside a sentence or a stat tile, in plain SVG with no charting dependency.
The width always fills the container; height (32px by default) is the only dimension you set. Values are oldest first — there is no x axis, so the order in the array is the time axis.
Area and the end dot
area adds a wash beneath the line, which holds up better on a busy surface. endDot marks the most recent point.
baseline decides where the wash stops: min (the default) fills from the lowest point and shows the shape; zero fills from nothing and shows the magnitude.
Gaps
null is a missing reading rather than a zero, and the line breaks rather than bridging it.
One scale across several
Each sparkline scales to its own data. Pin min and max on both to put two of them on one scale.
Revenue
Churn
Muted
muted draws in de-emphasised ink, for a trend that supports a number rather than competing with it — the case inside an IStat tile.
Revenue
€48,200
Height
Accessibility
Without a label the sparkline is decorative and hidden from assistive technology, which is right beside a value that already states the number. Give it a label when the trend is the only place the information lives.
<ISparkline :data="revenue" label="Revenue over the last twelve months, rising from 18 to 48" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | (number | null | undefined)[] | [] | Values, oldest first. null is a gap |
variant | 'line' | 'area' | 'line' | area adds a wash beneath the line |
endDot | boolean | — | Mark the most recent point |
baseline | 'min' | 'zero' | 'min' | Lower edge of the area wash |
min | number | — | Pin the bottom of the domain |
max | number | — | Pin the top of the domain |
muted | boolean | — | Draw in de-emphasised ink |
label | string | — | Accessible description; without one it is decorative |
height | number | 32 | Rendered height in px; width fills the container |
unstyled | boolean | — | Drop built-in classes |
class | string | — | Merged with the built-in classes |
ui | { root?, plot?, line?, area?, dot?, ring? } | — | Per-slot class overrides |
For an axis, a tooltip and more than one series, use ILineChart.