import { ScatterChart } from "@senvenli/react/charts";
const PRODUCTS = [
{ sku: "Desk mat", price: 29, units: 940 },
{ sku: "Cable tray", price: 38, units: 720 },
{ sku: "Footrest", price: 54, units: 610 },
{ sku: "Desk lamp", price: 79, units: 480 },
{ sku: "Monitor arm", price: 129, units: 390 },
{ sku: "Ergonomic chair", price: 349, units: 210 },
{ sku: "Standing desk", price: 589, units: 96 },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
export default function Example() {
return (
<ScatterChart
title="Price and units sold"
period="Q1 2026"
data={PRODUCTS}
name="sku"
x="price"
y="units"
xLabel="Price (USD)"
yLabel="Units sold"
valueFormatters={{ x: usd.format }}
/>
);
}import { ScatterChart } from "@senvenli/react/charts";Examples
A second category and a size
The second group differs by shape as well as color; a third measure sets the point's size.import { ScatterChart } from "@senvenli/react/charts";
const CUSTOMERS = [
{ name: "Acme Corp", orders: 42, average: 310, revenue: 13020, plan: "enterprise" },
{ name: "Globex", orders: 18, average: 640, revenue: 11520, plan: "enterprise" },
{ name: "Initech", orders: 64, average: 95, revenue: 6080, plan: "team" },
{ name: "Umbrella", orders: 27, average: 180, revenue: 4860, plan: "team" },
{ name: "Hooli", orders: 9, average: 420, revenue: 3780, plan: "enterprise" },
{ name: "Stark Industries", orders: 51, average: 60, revenue: 3060, plan: "team" },
{ name: "Wayne Enterprises", orders: 33, average: 75, revenue: 2475, plan: "team" },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
export default function Example() {
return (
<ScatterChart
title="Customers by order pattern"
period="2026"
data={CUSTOMERS}
name="name"
x="orders"
y="average"
size="revenue"
category={{ key: "plan", value: "enterprise", label: "Enterprise", otherLabel: "Team" }}
xLabel="Orders"
yLabel="Order value (USD)"
valueFormatters={{ y: usd.format }}
/>
);
}With a trend line
A least-squares line shows the direction of the relation.import { ScatterChart } from "@senvenli/react/charts";
const CAMPAIGNS = [
{ campaign: "Spring sale", spend: 1200, revenue: 5400 },
{ campaign: "Newsletter", spend: 300, revenue: 2100 },
{ campaign: "Search ads", spend: 2600, revenue: 9800 },
{ campaign: "Social video", spend: 1800, revenue: 5900 },
{ campaign: "Partner webinar", spend: 900, revenue: 4700 },
{ campaign: "Retargeting", spend: 2100, revenue: 8900 },
{ campaign: "Podcast", spend: 3400, revenue: 10200 },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", notation: "compact" });
export default function Example() {
return (
<ScatterChart
title="Ad spend and revenue"
period="Q1 2026 campaigns"
data={CAMPAIGNS}
name="campaign"
x="spend"
y="revenue"
xLabel="Spend (USD)"
yLabel="Revenue (USD)"
valueFormatters={{ x: usd.format, y: usd.format }}
trendLine
/>
);
}Guidelines
When to use it
- How two measures of the same items relate.
Use something else when
- One axis is time. Line chart
- One axis is a category. Bar chart
Accessibility
Keyboard
| Keys | What happens |
|---|---|
| Arrow keys | Move between points. |
Built in
- A "Show as table" button shows the same data as a table, which screen readers get by default.
You provide
- A title that says what the figure is.
API reference
ScatterChart
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | – | What the chart shows, over it; leave it out when a card or a heading already says so. |
aria-label | string | – | Names the chart when it has no visible |
period | string | – | |
isLoading | boolean | – | |
emptyState | React.ReactNode | – | Shown instead of the plot when there is no data: an |
height | number | – | |
dataRequired | readonly T[] | – | |
nameRequired | keyof T & string | – | The key naming each point (a product's SKU); shown on hover and as the table's row header. |
xRequired | keyof T & string | – | |
yRequired | keyof T & string | – | |
size | keyof T & string | – | A third measure as point size. |
category | { key: keyof T & string; value: unknown; label: string; otherLabel: string; } | – | A second category: |
xLabelRequired | string | – | Axis names with their units ("Daily price (€)"). |
yLabelRequired | string | – | |
valueFormatters | { x?: ChartValueFormatter | undefined; y?: ChartValueFormatter | undefined; } | – | |
trendLine | boolean | – | A least-squares trend line, dashed in |
onPointPress | (row: T) => void | – | Opens the item: the row under the pointer. |
titlestringWhat the chart shows, over it; leave it out when a card or a heading already says so.
aria-labelstringNames the chart when it has no visible
title(a card's heading already says what it shows).periodstringisLoadingbooleanemptyStateReact.ReactNodeShown instead of the plot when there is no data: an
EmptyState size="small"or text; "No data" by default.heightnumberdataRequiredreadonly T[]nameRequiredkeyof T & stringThe key naming each point (a product's SKU); shown on hover and as the table's row header.
xRequiredkeyof T & stringyRequiredkeyof T & stringsizekeyof T & stringA third measure as point size.
category{ key: keyof T & string; value: unknown; label: string; otherLabel: string; }A second category:
ds-chart-2and a diamond, so it differs by shape as well as hue.xLabelRequiredstringAxis names with their units ("Daily price (€)").
yLabelRequiredstringvalueFormatters{ x?: ChartValueFormatter | undefined; y?: ChartValueFormatter | undefined; }trendLinebooleanA least-squares trend line, dashed in
ds-chart-neutral.onPointPress(row: T) => voidOpens the item: the row under the pointer.