Scatter Chart
scatter-chartTwo measures against each other, one dot per observation, on TanStack Charts. Groups take their own colour and legend entry, an optional dashed trend line fits each group, and focus finds the nearest point by pointer or arrow keys.
import { ScatterChart } from "@/components/forme/scatter-chart/scatter-chart";
// Accounts by seats and monthly spend, split by plan.
const accounts = [
{ seats: 4, spend: 180, plan: "Team" },
{ seats: 7, spend: 260, plan: "Team" },
{ seats: 9, spend: 410, plan: "Team" },
{ seats: 12, spend: 390, plan: "Team" },
{ seats: 15, spend: 560, plan: "Team" },
{ seats: 18, spend: 610, plan: "Team" },
{ seats: 22, spend: 720, plan: "Team" },
{ seats: 20, spend: 1180, plan: "Business" },
{ seats: 28, spend: 1420, plan: "Business" },
{ seats: 34, spend: 1610, plan: "Business" },
{ seats: 41, spend: 2050, plan: "Business" },
{ seats: 47, spend: 2210, plan: "Business" },
{ seats: 55, spend: 2690, plan: "Business" },
{ seats: 62, spend: 2840, plan: "Business" },
];
const dollars = (value: number) => `$${value.toLocaleString("en-US")}`;
export function ScatterChartDemo() {
return (
<div className="w-full rounded-xl border border-border bg-card p-5 lit edge">
<p className="text-caption-1-medium text-muted-foreground">Spend by seats</p>
<p className="mt-1 text-body-regular text-foreground">
Business accounts spend more per seat at every size.
</p>
<ScatterChart
className="mt-5"
label="Monthly spend against seats for Team and Business accounts"
data={accounts}
x="seats"
y="spend"
series="plan"
xLabel="Seats"
yLabel="Monthly spend"
formatY={dollars}
trend
/>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
ScatterChart
Two measures against each other, one dot per observation.
| Prop | Type | Default | Description |
|---|---|---|---|
data* | readonly Row[] | — | |
x* | NumericKey<Row> | — | The measure on the horizontal axis. |
y* | NumericKey<Row> | — | The measure on the vertical axis. |
label* | string | — | Accessible name. Say what is compared with what. |
series | TextKey<Row> | — | A field that splits the points into groups, each its own colour and legend entry. |
xLabel | string | — | |
yLabel | string | — | |
trend | boolean | false | A dashed least-squares line through each group, with its 95% band. |
formatX | (value: number) => string | plain | |
formatY | (value: number) => string | plain | |
height | number | 280 | |
className | string | — |
Related


Chart
The tooltip and legend every Forme chart shares: a floating panel with a colour, a name and a right-aligned value per series, and a row of swatches. Installed with any chart; use them directly to give a chart of your own the same finish.
data display

Composed Chart
Columns and a line on one axis, on TanStack Charts: volume against its target, actuals against the plan. Rounded columns side by side, the line drawn over them, and a band cursor that lists every series in the column.
data display

Heatmap Chart
A grid of cells whose colour carries a quantity, on TanStack Charts: activity by weekday and hour, scores by team and quarter. Six steps of one hue from the sunken surface to the chart accent, optional values in the cells, and a tooltip on every cell.
data display