ScatterChart
Complexity vs accessibility issues
Scatter chart, 5 points. 8 to 45. Values from 1 to 12.
| Label | Page complexity | Issues found |
|---|---|---|
| Homepage | 12 | 3 |
| Dashboard | 28 | 7 |
| Settings | 45 | 12 |
| About | 8 | 1 |
| Reports | 35 | 9 |
import { ScatterChart } from '@eekodigital/raster';
<ScatterChart
data={[
{ x: 12, y: 3, label: 'Homepage' },
{ x: 28, y: 7, label: 'Dashboard' },
]}
xLabel="Page complexity"
yLabel="Issues found"
title="Complexity vs issues"
/>Multi-series
Section titled “Multi-series”Audit comparison
Scatter chart, 2 series, 6 points. 10 to 50. Values from 2 to 10.
Audit 1Audit 2
| Series | Elements | Violations |
|---|---|---|
| Audit 1 | 10 | 2 |
| Audit 1 | 25 | 5 |
| Audit 1 | 40 | 8 |
| Audit 2 | 15 | 4 |
| Audit 2 | 30 | 3 |
| Audit 2 | 50 | 10 |
<ScatterChart
series={[
{ name: 'Audit 1', data: [...], color: 'var(--demo-accent)' },
{ name: 'Audit 2', data: [...], color: 'var(--demo-good)' },
]}
xLabel="Elements"
yLabel="Violations"
title="Audit comparison"
/>Accessibility
Section titled “Accessibility”- A
role="figure"named by the visibletitleand described by a generated summary (chart type, series and point counts, range). - The SVG is a
role="group"witharia-roledescription="chart"; nographics-*roles. - Named series are
role="group"s. Each point is labelled{series}, {x}: {y}, 3 of 12(with itslabelwhen given). WithonSelect,selectedIndexor a click handler, marks arerole="button"witharia-pressed; otherwise they’re staticrole="img". - Points use a different marker shape per series.
- Arrow keys move in x order, so left and right match the drawing.
- A visible Show data table button (
aria-expanded) reveals a real table captionedData for {title}, withth scopeheaders and values run throughformatValue. - Escape (inside the chart only) clears the selection and announces it in a polite live region; it doesn’t close a surrounding dialog.
- Animations stop under
prefers-reduced-motion. In forced-colours mode marks use system colours, told apart by dash pattern and marker shape.
| Key | Action |
|---|---|
| ← / → | Previous / next mark |
| Home / End | First / last mark |
| PageUp / PageDown | Back / forward 10 marks |
| ↑ / ↓ | Previous / next series |
| Tab | Leave the chart (one tab stop) |
| Enter / Space | Toggle selection (interactive marks) |
| Escape | Hide the tooltip and clear selection |
See the Accessibility guide for the shared structure, the labels prop and screen-reader testing.
| Prop | Type | Default | Description |
|---|---|---|---|
data | ScatterPoint[] | — | Single series: |
series | ScatterSeries[] | — | Named series: |
xLabel | string | — | X-axis title. |
yLabel | string | — | Y-axis title. |
grid | “horizontal” | “vertical” | “both” | “none” | “both” | Grid lines. |
formatValue | (value: number) => string | Intl.NumberFormat | Formats values in ticks, marks and the table. Defaults to
|
height | number | 240 | Plot height in px. |
aspectRatio | number | — | Width ÷ height, instead of |
onPointClick | (point, seriesIndex, pointIndex) => void | — | Makes points buttons. |
selectedIndex | { series, point } | null | — | Controlled selection. |
onSelect | (index | null) => void | — | Makes points buttons. |
title | string | — | Required. Visible title: names the figure and captions the data table. |
hideTitle | boolean | false | Hide the title visually. It still names the chart for assistive technology. |
labels | Partial<ChartLabels> | English | Generated strings and the number locale. See Accessibility. |
dataTable | “disclosure” | “visually-hidden” | “disclosure” | How the data table is offered. |
exportRef | Ref<ChartExportHandle> | — | SVG/PNG export. See Exporting charts. |
className | string | — | Class on the figure. |