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 — the same downward-fading gradient ILineChart uses, so the two read as one family. 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" />Animation
A sparkline can reveal itself like ILineChart does — the line and its wash uncovered together, left to right — but it is off by default here. A sparkline usually sits in a stat tile or a table row, and twenty of them animating at once is a distraction rather than an arrival.
animate takes true for the default reveal, or an object to tune it: duration in milliseconds and easing, one of ease-out (the default), ease-in, ease-in-out or linear.
It plays once per instance, and a reader who has asked for reduced motion gets the finished sparkline with no animation at all.
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 |
animate | boolean or { duration, easing } | false | Draw the line on; off by default here |
unstyled | boolean | — | Drop built-in classes |
class | string | — | Merged with the built-in classes |
ui | { root?, plot?, line?, area?, dot?, ring? } | — | Per-element class overrides |
For an axis, a tooltip and more than one series, use ILineChart.