Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Pro (paid add-on)

Charts

Pro

Bar, line, area, pie, scatter, heatmap, gauge and sparkline charts everyone can read: keyboard and screen reader access to every point, a data table, colors checked for color blindness, and High Contrast support.

Part of Pro

This page documents part of @vjdesigns-pro/ui, the paid add-on package. Using it needs a Pro license and @vjdesigns/vjdesigns-ui 3.8.0 or later. Like the free package, it works in both modes, every brand, all 32 languages and right to left. Install it as described in Account forms.

Example

Every chart takes plain rows of data and a title. LineChart and AreaChart take the same props as BarChart, for change over time. A null value leaves a gap instead of drawing a false line.

tsx
import { BarChart } from "@vjdesigns-pro/ui";

<BarChart
  title="Box score by game"
  description="Rebounding held steady while scoring climbed."
  data={games}
  x="opponent"
  xLabel="Opponent"
  series={[
    { key: "points", label: "Points" },
    { key: "rebounds", label: "Rebounds" },
  ]}
/>;

Chart types

  • BarChart: comparing values across categories. Grouped side by side, or stacked (the tooltip, labels and table add a total).
  • LineChart: change over time. Up to four series are labeled at their ends.
  • AreaChart: one series over time, or stacked parts of a total.
  • PieChart and DonutChart: one whole split into a few parts, read at a glance. Past maxSlices (6) the smallest parts fold into "Other". For close values or ranking, use a BarChart.
  • ScatterChart: how two measures relate. Up to three colored groups; hover snaps to the nearest dot.
  • Heatmap: patterns across two categories, on one blue ramp with a scale. showValues prints the numbers in ink checked for contrast.
  • Gauge: one value in a known range. A role="meter" with the number in the middle and an optional target.
  • Sparkline: a word-sized trend in a stat tile or table row, named by a summary ("Points: from 58 to 72, low 55, high 80").

More chart types

tsx
<PieChart title="Points by shot type" data={shots} label="type" value="points"
  labelHeader="Shot type" valueHeader="Points" />
<ScatterChart title="Minutes and points" data={players} x="minutes" y="points"
  xLabel="Minutes" yLabel="Points" name="player" nameLabel="Player"
  group="position" groupLabel="Position" />
<Heatmap title="Points by quarter" data={cells} x="quarter" y="player" value="points"
  yLabel="Player" valueLabel="Points" />
<Gauge label="Free throw percentage" value={76} target={80} formatValue={(v) => `${v}%`} />
<Sparkline label="Points" data={[58, 64, 61, 72]} />

Patterns for color-blind viewers

About 1 in 12 men and 1 in 200 women have some form of color blindness, so every series can be drawn with a pattern as well as a color: hatched, dotted and crosshatched fills for bars, areas and slices, dashed and dotted lines, and circles, squares, triangles and other shapes for scatter points. Legends show the same patterns. Every chart with two or more series has a Patterns toggle button next to "Show data table" (aria-pressed), so viewers can switch them on themselves.

  • defaultPatterns turns them on from the start, or control them with patterns and onPatternsChange.
  • Choose a series' pattern with dash (lines) or fill (bars and areas). Series without a choice take the next pattern no other series uses, so two series never look alike.
  • showPatternToggle={false} hides the button, for example if you offer a site-wide setting instead.
  • In Windows High Contrast mode, patterns are always on and the button is hidden, since system colors replace the palette there.
tsx
<LineChart
  defaultPatterns // or `patterns` + `onPatternsChange` to control it
  title="Shooting percentage by month"
  data={months}
  x="month"
  xLabel="Month"
  series={[
    { key: "fg", label: "FG%" },
    { key: "three", label: "3P%", dash: "dot" }, // `fill` for bars and areas
  ]}
/>

Zoom

Add zoomable to a BarChart, LineChart or AreaChart. Drag across the plot to zoom into those categories, move either end with the range slider under the plot, or press + and - on a focused point. "Reset zoom" shows everything again. The value axis rescales to what's in view, and the data table always lists every row.

Accessible by default

  • Each chart is a <figure> named by its title.
  • The plot is one Tab stop. The arrow keys, Home and End move between points (slices, dots, cells), and each one is read out with all its values ("Ridge: Points 71, Rebounds 35").
  • Hover and focus show the same values in a tooltip.
  • "Show data table" reveals the numbers as a real table.
  • In Windows High Contrast mode, up to eight series are told apart by patterns, not color.

Color

Series use the --chart-1 to --chart-8 tokens, a categorical palette checked for color-blind separation in both modes. Colors follow the series order and never change when the data changes. Magnitude (heatmaps, the gauge) uses the one-hue --chart-seq-1 to --chart-seq-7 ramp, which flips in dark mode so low values recede.

Readable

  • Bars start at a true zero, so negative values grow downward.
  • Axis labels thin out instead of overlapping.
  • There's never a second y-axis. For two measures on different scales, use two charts side by side.
  • Numbers and dates follow the LocaleProvider locale, and the table button is translated.

Props

BarChart

Columns comparing values across categories: one series, grouped series side by side, or stacked series in one bar per category. Bars start at a true zero baseline, and stacked segments are separated by a thin gap.

Accessibility: a <figure> named by its title. The plot is one Tab stop; arrow keys (and Home / End) move between categories, and each one is announced with every value ("Nov 3: Points 72, Rebounds 30"). The same details show in a tooltip on hover and focus. A legend names every series, "Show data table" reveals the numbers as a real table. With patterns on (the patterns prop, or the viewer's "Patterns" button), bars are told apart by hatching and dots as well as color; patterns are always on in Windows High Contrast mode. Choose a series' pattern with its fill.

tsx
<BarChart
  title="Points per game"
  data={games}
  x="opponent"
  xLabel="Opponent"
  series={[{ key: "points", label: "Points" }]}
/>
BarChart props
PropTypeDefault
stacked

Stack the series in one bar per category instead of side by side. The tooltip, point labels, and table add a total. Positive values stack up from zero and negative values down.

booleanfalse
dataRequired

One row per category (a game, a month), in display order.

readonly T[]—
xRequired

The category of each row: a field name, or a function.

string | ((row: T) => string | number | Date)—
xLabelRequired

Name of the category, for the table's first column and point labels (e.g. "Game").

string—
formatX

Formats a category for axis labels, tooltips, and the table. Dates default to the locale's medium date.

(value: never) => string—
seriesRequired

The measures to plot, in legend order. Colors follow this order (up to 8 series).

readonly ChartSeries<T>[]—
formatValue

Formats values in tooltips, labels, and the table.

(value: number) => stringthe locale's number format
height

Plot height in px.

number280
zoomable

Let the user zoom into a range of categories: drag across the plot, use the range slider under it, or press + and − on a focused point. "Reset zoom" shows everything again. The value axis rescales to what's in view; the data table always lists every row.

booleanfalse
zoom

The zoomed range (controlled). null shows every category.

ChartZoom | null—
defaultZoom

Initial zoomed range when uncontrolled.

ChartZoom | null—
onZoomChange

Called with the new range after a zoom, or null after a reset.

(zoom: ChartZoom | null) => void—
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

LineChart

Lines showing change over an ordered category (usually time). A crosshair follows the pointer and the tooltip lists every series at that point. Up to four series are labeled at their line ends when the labels don't collide. Missing values (null) leave a gap rather than a false line.

Accessibility matches BarChart: one Tab stop, arrow keys between points with spoken values, a legend, a data table, and patterns: with patterns (or the "Patterns" button) each line gets its own dash, always in High Contrast mode. Choose a series' dash with its dash.

LineChart props
PropTypeDefault
dataRequired

One row per category (a game, a month), in display order.

readonly T[]—
xRequired

The category of each row: a field name, or a function.

string | ((row: T) => string | number | Date)—
xLabelRequired

Name of the category, for the table's first column and point labels (e.g. "Game").

string—
formatX

Formats a category for axis labels, tooltips, and the table. Dates default to the locale's medium date.

(value: never) => string—
seriesRequired

The measures to plot, in legend order. Colors follow this order (up to 8 series).

readonly ChartSeries<T>[]—
formatValue

Formats values in tooltips, labels, and the table.

(value: number) => stringthe locale's number format
height

Plot height in px.

number280
zoomable

Let the user zoom into a range of categories: drag across the plot, use the range slider under it, or press + and − on a focused point. "Reset zoom" shows everything again. The value axis rescales to what's in view; the data table always lists every row.

booleanfalse
zoom

The zoomed range (controlled). null shows every category.

ChartZoom | null—
defaultZoom

Initial zoomed range when uncontrolled.

ChartZoom | null—
onZoomChange

Called with the new range after a zoom, or null after a reset.

(zoom: ChartZoom | null) => void—
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

AreaChart

A line with a soft wash down to the baseline: best for one series over time, where the area shows volume. With several series, stacked shows how each adds up to the total (unstacked washes overlap, so prefer a LineChart to compare series). Missing values leave a gap.

Accessibility matches LineChart: one Tab stop, arrow keys between points with spoken values, a legend, a data table, and patterns: hatched fills and dashed lines with patterns or the "Patterns" button (always in High Contrast mode).

AreaChart props
PropTypeDefault
stacked

Stack the series, so the top line shows the total and each band one series.

booleanfalse
dataRequired

One row per category (a game, a month), in display order.

readonly T[]—
xRequired

The category of each row: a field name, or a function.

string | ((row: T) => string | number | Date)—
xLabelRequired

Name of the category, for the table's first column and point labels (e.g. "Game").

string—
formatX

Formats a category for axis labels, tooltips, and the table. Dates default to the locale's medium date.

(value: never) => string—
seriesRequired

The measures to plot, in legend order. Colors follow this order (up to 8 series).

readonly ChartSeries<T>[]—
formatValue

Formats values in tooltips, labels, and the table.

(value: number) => stringthe locale's number format
height

Plot height in px.

number280
zoomable

Let the user zoom into a range of categories: drag across the plot, use the range slider under it, or press + and − on a focused point. "Reset zoom" shows everything again. The value axis rescales to what's in view; the data table always lists every row.

booleanfalse
zoom

The zoomed range (controlled). null shows every category.

ChartZoom | null—
defaultZoom

Initial zoomed range when uncontrolled.

ChartZoom | null—
onZoomChange

Called with the new range after a zoom, or null after a reset.

(zoom: ChartZoom | null) => void—
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

PieChart

A whole split into parts, as slices of a circle. Read at a glance only: people compare angles poorly, so for close values or ranking use a BarChart instead. Keep it to a few parts; past maxSlices (6) the smallest fold into "Other".

Accessibility: a <figure> named by its title. The slices are one Tab stop; arrow keys move between them, and each is announced with its amount and share ("Threes: 24 (32%)"). The legend lists every part with its share, "Show data table" lists every amount (including the parts folded into "Other"). With patterns on (patterns, or the viewer's "Patterns" button), slices are hatched and dotted as well as colored; patterns are always on in High Contrast mode.

tsx
<PieChart
  title="Points by shot type"
  data={shots}
  label="type"
  value="points"
  labelHeader="Shot type"
  valueHeader="Points"
/>
PieChart props
PropTypeDefault
dataRequired

One row per part of the whole, in display order (clockwise from 12 o'clock).

readonly T[]—
labelRequired

Each part's name: a field name, or a function.

string | ((row: T) => string)—
valueRequired

Each part's amount: a field name, or a function. Zero and negative amounts are left out.

string | ((row: T) => number | null | undefined)—
labelHeaderRequired

Name of the parts, for the table's first column (e.g. "Shot type").

string—
valueHeaderRequired

Name of the amounts, for the table's second column (e.g. "Points").

string—
formatValue

Formats amounts in tooltips, the legend, and the table.

(value: number) => stringthe locale's number format
maxSlices

Most slices drawn. Past this, the smallest parts fold into one "Other" slice (kept last), since many thin slices can't be read. Up to 8.

number6
size

Diameter in px.

number240
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

DonutChart

A pie with a hole that shows the total, or the focused slice's amount and name. Everything else matches PieChart, including its advice: for comparing close values, use a BarChart.

DonutChart props
PropTypeDefault
dataRequired

One row per part of the whole, in display order (clockwise from 12 o'clock).

readonly T[]—
labelRequired

Each part's name: a field name, or a function.

string | ((row: T) => string)—
valueRequired

Each part's amount: a field name, or a function. Zero and negative amounts are left out.

string | ((row: T) => number | null | undefined)—
labelHeaderRequired

Name of the parts, for the table's first column (e.g. "Shot type").

string—
valueHeaderRequired

Name of the amounts, for the table's second column (e.g. "Points").

string—
formatValue

Formats amounts in tooltips, the legend, and the table.

(value: number) => stringthe locale's number format
maxSlices

Most slices drawn. Past this, the smallest parts fold into one "Other" slice (kept last), since many thin slices can't be read. Up to 8.

number6
size

Diameter in px.

number240
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

ScatterChart

Points on two numeric axes, to show how two measures relate (minutes and points, attempts and percentage). Optional group colors up to three series; the axes start at nice round numbers around the data, not at 0.

Accessibility: a <figure> named by its title. The points are one Tab stop; arrow keys move through them from left to right (Home / End jump to the ends), and each is announced with its name, group, and both values. Hover snaps to the nearest point, so small dots are easy to reach. A legend names the groups, and "Show data table" lists every point. With patterns on (patterns, or the viewer's "Patterns" button), each group's points take their own shape (circle, square, triangle, ...) as well as color, in the plot and the legend; always in High Contrast mode.

tsx
<ScatterChart
  title="Minutes and points"
  data={players}
  x="minutes"
  y="points"
  xLabel="Minutes"
  yLabel="Points"
  name="player"
  nameLabel="Player"
/>
ScatterChart props
PropTypeDefault
dataRequired

One row per point.

readonly T[]—
xRequired

Horizontal value: a field name, or a function. Rows without a number are left out.

string | ((row: T) => number | null | undefined)—
yRequired

Vertical value: a field name, or a function.

string | ((row: T) => number | null | undefined)—
xLabelRequired

Name of the horizontal measure, for its axis, point labels, and the table (e.g. "Minutes").

string—
yLabelRequired

Name of the vertical measure (e.g. "Points").

string—
group

Groups points into colored series (e.g. a position). Up to three groups get their own color, the most that stay distinct when any two points can sit side by side; more fold into "Other".

string | ((row: T) => string)—
groupLabel

Name of the groups, for the table (e.g. "Position"). Needed with group.

string—
name

Each point's name (e.g. a player), for point labels, tooltips, and the table.

string | ((row: T) => string)—
nameLabel

Name of the points, for the table's first column (e.g. "Player"). Needed with name.

string—
formatX

Formats horizontal values.

(value: number) => stringthe locale's number format
formatY

Formats vertical values.

(value: number) => stringthe locale's number format
height

Plot height in px.

number320
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—
patterns

Draw series with patterns as well as color: dashed lines, hatched or dotted bars, areas, and slices, and shaped scatter points. Helps anyone who can't tell the colors apart. Viewers can also switch patterns with the chart's "Patterns" button. They're always on in Windows High Contrast mode. Controlled.

boolean—
defaultPatterns

Initial pattern state when uncontrolled.

booleanfalse
onPatternsChange

Called when patterns are switched on or off (by the "Patterns" button).

(patterns: boolean) => void—
showPatternToggle

Show the "Patterns" toggle button next to "Show data table".

booleantrue

Heatmap

A grid of cells colored by magnitude (one blue ramp, light to dark; it flips in dark mode so low values recede into the surface). Good for patterns across two categories: minutes by player and quarter, shots by zone and game. The scale above the grid maps colors to values, and showValues prints each number in its cell, in ink chosen for that step.

Accessibility: a <figure> named by its title. The cells are one Tab stop; arrow keys move across and down (Home / End: the row's ends; Ctrl+Home / Ctrl+End: the first and last cells), and each cell is announced with its row, column, and value. "Show data table" shows the same grid as a real table, so color is never the only way in.

tsx
<Heatmap
  title="Points by quarter"
  data={rows}
  x="quarter"
  y="player"
  value="points"
  yLabel="Player"
  valueLabel="Points"
/>
Heatmap props
PropTypeDefault
dataRequired

One row per cell: its column, its row, and its value.

readonly T[]—
xRequired

The cell's column: a field name, or a function. Columns keep their first-seen order.

string | ((row: T) => string | number | Date)—
yRequired

The cell's row: a field name, or a function. Rows keep their first-seen order.

string | ((row: T) => string | number | Date)—
valueRequired

The cell's value: a field name, or a function. Missing cells are drawn empty.

string | ((row: T) => number | null | undefined)—
yLabelRequired

Name of the rows, for the table's first column (e.g. "Player").

string—
valueLabelRequired

Name of the values, for the scale and tooltips (e.g. "Points").

string—
formatX

Formats column names. Dates default to the locale's medium date.

(value: never) => string—
formatY

Formats row names.

(value: never) => string—
formatValue

Formats values.

(value: number) => stringthe locale's number format
showValues

Print each value in its cell, where it fits.

booleanfalse
min

Value at the light end of the scale.

numberthe smallest value
max

Value at the dark end of the scale.

numberthe largest value
cellHeight

Cell height in px.

number36
titleRequired

Title: names the figure, captions the table, and is shown above the chart.

string—
description

One-sentence takeaway shown under the title (and read with the figure).

ReactNode—
hideTitle

Hide the title visually (it still names the figure), when a heading nearby already says it.

booleanfalse
showTable

Show the data table (controlled).

boolean—
defaultShowTable

Show the data table initially when uncontrolled.

booleanfalse
onShowTableChange

Called when the table is shown or hidden.

(show: boolean) => void—
className

Class name for the <figure>.

string—
style

Style for the <figure>.

CSSProperties—

Gauge

A half-circle dial for one value within a known range (a percentage, a score against a cap). The filled arc grows from the start along a lighter track of the same blue ramp; the number itself is printed large in the middle, so the dial is never the only way to read it. An optional target adds a tick on the dial and a line of text. For a single ratio in a tight space, a Progress bar is simpler; for several values, use a BarChart.

Accessibility: role="meter" named by label, with aria-valuenow, aria-valuemin, aria-valuemax, and the formatted value as aria-valuetext. The drawing is hidden from assistive technology.

tsx
<Gauge label="Free throw percentage" value={76} target={80} formatValue={(v) => `${v}%`} />
Gauge props
PropTypeDefault
valueRequired

The current value. Clamped to min..max for drawing; the text shows it as given.

number—
min

Lowest value on the dial.

number0
max

Highest value on the dial.

number100
labelRequired

What it measures (e.g. "Free throw percentage"). Shown under the value and names the meter.

string—
target

A goal to mark on the dial, with its value under the label.

number—
formatValue

Formats the value, the ends, and the target.

(value: number) => stringthe locale's number format
size

Width in px; the height is a little over half.

number220

Also accepts native <div> attributes, plus className, style and ref.

Sparkline

A word-sized trend line for stat tiles, tables, and lists: no axes, the trend in a quiet ink, and the latest value marked in the accent series color. Pair it with the number it trends (a Stat), since a sparkline shows shape, not values.

Accessibility: one image whose name summarizes the series ("Points: from 58 to 72, low 55, high 80"), so it reads well inside a table cell or tile.

tsx
<Sparkline label="Points" data={[58, 64, 61, 72]} />
Sparkline props
PropTypeDefault
dataRequired

The values, oldest first. null leaves a gap.

readonly (number | null)[]—
labelRequired

What the values measure (e.g. "Points"). Starts the accessible name.

string—
variant

line, area (a line with a soft wash), or bar (one thin bar per value).

"line""area""bar""line"
width

Width in px.

number96
height

Height in px.

number24
formatValue

Formats values in the accessible name.

(value: number) => stringthe locale's number format
aria-label

Overrides the generated accessible name ("Points: from 58 to 72, low 55, high 80").

string—

Also accepts native <svg> attributes, plus className, style and ref.

ChartSeries

One plotted measure: a key into each row (or a value function) and its name.

ChartSeries props
PropTypeDefault
keyRequired

Unique key. Also the field read from each row when there is no value.

string—
labelRequired

Name shown in the legend, tooltip, table, and spoken point labels.

string—
value

Reads the value from a row. null leaves a gap.

(row: T) => number | null | undefined(row) => row[key]
dash

Line style while patterns are on (LineChart, AreaChart). Defaults to a distinct dash per series, in order: solid, dash, dot, dash-dot, and so on.

"solid""dash""dot""dash-dot""long-dash""dash-dot-dot""long-dash-dot""short-dash"—
fill

Fill while patterns are on (BarChart, AreaChart). Defaults to a distinct fill per series, in order: solid, diagonal, dots, crosshatch, and so on.

"solid""diagonal""dots""crosshatch""horizontal""reverse-diagonal""vertical""grid"—

ChartZoom

The categories in view after zooming: indexes into data, both inclusive.

ChartZoom props
PropTypeDefault
startRequirednumber—
endRequirednumber—