Charts
ScatterChart
Plot paired numeric observations, compare series, and inspect individual points with the keyboard or a data table.
import '@reactloom/charts/styles.css';
import { ScatterChart } from '@reactloom/charts';Examples
Request rate and latency
Use the arrow keys to move between data points, Home and End to jump to the first and last.
import { ScatterChart } from '@reactloom/charts';
const data = [{ rate: 100, latency: 82 }, { rate: 190, latency: 110 }, { rate: 220, latency: 130 }, { rate: 320, latency: 205 }];
export default function Example() {
return <ScatterChart title="Latency under load" xLabel="Requests per second" yLabel="Latency (ms)"
data={data} x="rate" series={[{ key: 'latency', label: 'Latency (ms)' }]} />;
}Resolution by team size
- Support
- Onboarding
Use the arrow keys to move between data points, Home and End to jump to the first and last.
import { ScatterChart } from '@reactloom/charts';
const data = [{ teamSize: 3, support: 9, onboarding: 13 }, { teamSize: 5, support: 8, onboarding: 11 }, { teamSize: 8, support: 6, onboarding: 7 }];
export default function Example() {
return <ScatterChart title="Resolution time by team size" xLabel="Team members" yLabel="Hours"
data={data} x="teamSize" series={[{ key: 'support', label: 'Support' }, { key: 'onboarding', label: 'Onboarding' }]} />;
}API reference
| Prop | Type | Default |
|---|---|---|
titleNames the figure. | string | — |
dataObservations in keyboard navigation order. | readonly Row[] | — |
xNumeric x coordinate. Non-finite x coordinates are omitted. | Accessor<Row, number> | — |
seriesEach series supplies a y value. Missing y values are shown as gaps. | readonly ChartSeries<Row>[] | — |
xLabel · yLabelNames and units for both axes. | string | — |
tableChoose how the data table is displayed. | 'toggle' | 'visible' | 'none' | — |
Keyboard interaction
| Key | Action |
|---|---|
| Arrow keys | Move through observations in source order |
| Home / End | Jump to the first or last observation |
| Escape | Dismiss the active readout |
Usage guidelines
Do
- Name both axes and give their units. Explain the relationship you want the reader to examine.
Don’t
- Avoid inferring causation from a visible relationship alone.