Skip to content
GitHub (opens in a new tab)

Scatter

One dot per item, placed by two numeric measures, like accounts by monthly revenue and support tickets. Optional groups by colour and dot size by a third value.

stableOrganismcontracts/scatterchart.json

Preview

ScatterChart

One dot per item, placed by two numeric measures, to show how they relate and which items break the pattern. Optional groups by colour, and dot size by a third value.

Master

Accounts by monthly revenue and support tickets, one group.

Accounts by revenue and tickets

Last 30 days

Usage

Tickets mostly rise with revenue; the dots off that line are the accounts to look at. Hover or Tab into the chart and use the arrow keys to move from dot to dot, left to right. Change over time stays LineChart; comparing categories stays BarChart.

Do's

  • The relationship between two numeric measures across many items, like revenue against tickets per account
  • Spotting clusters, outliers and items that break the pattern
  • Comparing groups of items on the same two measures, like plans or regions

Don'ts

  • Change over time — use LineChart
  • Comparing amounts across categories — use BarChart
  • A short ranking by one measure — use BarList
  • Part of a whole — use PieChart
<ScatterChart
  title="Accounts by revenue and tickets"
  description="Last 30 days"
  xLabel="Monthly revenue"
  yLabel="Support tickets"
  valueFormatter={{ x: euro }}
  data={[
    { id: "acme", label: "Acme", x: 12400, y: 18 },
    { id: "globex", label: "Globex", x: 31800, y: 41 },
    { id: "hooli", label: "Hooli", x: 9800, y: 46 },
  ]}
/>

When to use

  • The relationship between two numeric measures across many items, like revenue against tickets per account
  • Spotting clusters, outliers and items that break the pattern
  • Comparing groups of items on the same two measures, like plans or regions

When not to use

  • Change over time — use LineChart
  • Comparing amounts across categories — use BarChart
  • A short ranking by one measure — use BarList
  • Part of a whole — use PieChart

What an agent reads

import { Scatter } from "agentic-ds-kit";
must
  • Title on the figure when provided, and the plot is a role=group named by it
  • The dots are one Tab stop; arrow keys move between them in x order (then y), Home and End go to the first and last
  • Each dot names its label, both measures, the size when set and the group
  • The tooltip shows on focus as well as on hover, and the focused dot gets a visible ring
  • Colour is never the only cue for a group: the legend, tooltip and table name it
  • The Table toggle swaps the chart for a plain table with every value
defaults
  • size fixed
  • sizeLabel Size
  • height 280
  • isLoading false
stops if
  • Do not use it for change over time — use LineChart
  • Do not use it to compare categories — use BarChart
  • Do not join the dots with lines; order along x is not a sequence
  • Do not use status colours for groups; a group that means good or bad says so in its name
  • Do not use more than six groups; the chart palette has six colours
  • Do not use raw hex or primitive --color-* ramps
  • Do not wrap a chart in a Card only to get a header button — pass actions

From contracts/scatterchart.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
dataarrayYes—One row per item. Rows without a finite x and y are left out.
xLabelstringYes—Names the horizontal measure, like Monthly revenue. Shown under the x axis, in the tooltip and the table.
yLabelstringYes—Names the vertical measure, like Support tickets. Shown above the y axis, in the tooltip and the table.
sizefixed | valueNofixedfixed draws every dot the same size. value sizes each dot by its size field, by area (square root), so a dot with four times the value has twice the width.
sizeLabelstringNoSizeNames the size value in the tooltip and the table, like Seats. Only used with size value.
valueFormatterobjectNo—Each defaults to the chart format: 1,240, 12.4k, 1.2M on axes, the full value in the tooltip and table.
titlestringNo—Chart heading on the frame, like the other charts. Also names the plot for screen readers.
descriptionstringNo——
heightnumberNo280—
isLoadingbooleanNofalseThe chart frame shows its loading skeleton in place of the plot. Same as LineChart.
errorstringNo—When set, the plot is replaced by the kit's "Couldn't load" row (role=alert) with this message. Same as LineChart.
onRetryfunctionNo—Shows an outline Retry Button on the error row.
actionsslotNo—Kit Buttons in the chart header, before the Table toggle, like an icon-only Ask. ghost sm reads quietest. Setting it draws the frame even with no title.
  • Component
    →

    Line

    Change and progress over ordered samples as a line or area chart.

  • Component
    →

    Bar

    Compare magnitudes across categories with vertical or horizontal bars.

  • Component
    →

    BarList

    A ranked list: each row shows a label and its value, with a quiet horizontal bar behind the label sized against the largest value or the total.

  • Component
    →

    Pie

    Part-to-whole share for a handful of segments, as a donut or solid pie.