Charts
Scatter, Radar and Heatmap
How two measures relate, several measures at once, and intensity in a grid.
Ant Design: Scatter, Radar, Heatmap (Ant Charts)
import { ScatterChart, RadarChart, Heatmap } from '@alea/ui';
Examples
Scatter and bubbles
Point size can carry a third measure.
- Desktop
- Mobile
Radar
Several measures at once: two profiles compared.
- Ana
- Bruno
Heatmap
Activity by day and hour; arrows read each cell.
8101214161820MonTueWedThuFriSatSun
Props
ScatterChart props
How two measures relate; sizes make it a bubble chart (MUI ScatterChart, Mantine BubbleChart).
| Prop | Type | Default | Description |
|---|---|---|---|
seriesrequired | { label: string; color?: string | undefined; points: { x: number; y: number; label?: string | undefined; size?: number | undefined; }[]; }[] | - | Groups of points: label, color and the points with x, y (and an optional label and size). |
description | ReactNode | - | One sentence on what the chart shows; read before it. |
height | number | 280 | Plot height in px. Default 280. |
showTable | boolean | true | Shows the "view as table" toggle. Default true. |
title | ReactNode | - | The title shown above it and read by screen readers. |
xFormat | ((v: number) => string) | - | Formats x values. |
xLabel | string | 'x' | Name of the x measure (axis, tooltip, table). |
yFormat | ((v: number) => string) | - | Formats y values. |
yLabel | string | 'y' | Name of the y measure. |
RadarChart props
Several measures at once, one shape per series: skills, scores, profiles (Mantine RadarChart).
| Prop | Type | Default | Description |
|---|---|---|---|
axisrequired | string | - | The key in each row that names the axis ("skill"). |
datarequired | ChartRow[] | - | One row per axis: the axis name in `axis`, a value per series key. |
seriesrequired | Series[] | - | The series to draw: key in each row, label for the legend, optional color. |
description | ReactNode | - | One sentence on what the chart shows; read before it. |
max | number | - | The top of the scale. Default the largest value. |
showTable | boolean | true | Shows the "view as table" toggle. Default true. |
size | number | 280 | Width and height in px. Default 280. |
title | ReactNode | - | The title shown above it and read by screen readers. |
Heatmap props
Intensity in a grid: activity by day and hour, contributions, correlations (Mantine Heatmap, MUI X heatmap).
| Prop | Type | Default | Description |
|---|---|---|---|
columnsrequired | string[] | - | Column labels. |
rowsrequired | { label: string; values: number[]; }[] | - | Rows of cells: [row label, ...values]. |
description | ReactNode | - | One sentence on what the chart shows; read before it. |
showTable | boolean | true | Shows the "view as table" toggle. Default true. |
title | ReactNode | - | The title shown above it and read by screen readers. |
valueFormat | ((v: number) => string) | - | Formats values in the axis, tooltip and table, e.g. v => `${v}k`. |
Accessibility
- Scatter and heatmap read each point or cell with the arrow keys.
Keyboard
| Key | Does |
|---|---|
| Tab | Focuses the chart |
| Arrow keys | Read each point or cell |
| Escape | Hides the tooltip |
Do and don't
Do
- Use scatter for correlation, radar for profiles, heatmap for patterns over time.
- Write the takeaway in description.
Don't
- Don't use radar charts with more than eight axes.
- Don't use a heatmap without the table view for exact numbers.