Scatter chart

Shows the relationship between two measures. Marks sit on a 1px grid in ink or one spot color.

Density

Module

Density
LabelModuleDensity
Alkmaar1218
Haarlem2816
Rotterdam4822
Groningen6826
Amsterdam8044

Mark

Press check

Module against density. Marks, not bubbles. One ink on the field.

Density

Module

Density
LabelModuleDensityGroup
Alkmaar1218Press
Delft2028Press
Haarlem2816Press
Utrecht3634Press
Rotterdam4822Proof
Eindhoven5640Proof
Groningen6826Proof
Amsterdam8044Proof

Use it for

  • Two numeric variables per point; group on a point to split series.
  • xDomain and yDomain to pin the axes.

Not for

  • Ordered categories; use BarChart.
  • Thousands of points; aggregate first.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { ScatterChart } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/scatter-chart.

2. Vendor the source

npx @noorddev/vlak-cli add scatter-chart

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/scatter-chart.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { ScatterChart } from "@noorddev/vlak-react";

<ScatterChart
  height={204}
  points={[{ x: 12, y: 40 }, { x: 40, y: 22, label: "Press" }, { x: 60, y: 30 }]}
  xLabel="Module"
  yLabel="Density"
  annotations={[{ at: 40, label: "204" }]}
/>

ScatterChart

PropTypeDefaultDescription
pointsrequiredChartPoint[]
heightnumber204
unitstring
xLabelstring
yLabelstring
xDomain[number, number]
yDomain[number, number]
gridbooleantrue
ticksnumber4
annotationsChartAnnotation[][]
valueFormat(n: number) => string
spotstring | boolean
localestringBCP 47 tag for number formatting; undefined is the reader's own.

Also accepts HTMLAttributes<HTMLDivElement>.

KeysDoes
TabFocuses the plot
Arrow right, Arrow leftMoves the cursor across the points; a status tooltip reads x and y
Home, EndFirst or last point
EscapeClears the cursor
<div class="rs-chart"><svg viewBox="0 0 240 64" width="240" height="64"><line class="rs-chart-grid" x1="0" x2="240" y1="56" y2="56"/><circle class="rs-chart-mark" cx="36" cy="40" r="2"/><circle class="rs-chart-mark" cx="88" cy="22" r="2"/><circle class="rs-chart-mark" cx="140" cy="30" r="2"/><circle class="rs-chart-mark" cx="196" cy="14" r="2"/></svg></div>
.rs-chart-mark