Skip to main content

ScatterPlot

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

A scatter plot with optional X/Y axes and labels. Points are rendered as filled circles, each axis spanning its points from the lowest value to the highest. A visible axis is ticked at round values that fit its length, so every label sits at the value it names. The plot stretches to fill its box while the dots and labels keep their size.

Import​

import { ScatterPlot } from "~lib/charts/scatter-plot";

Props​

NameTypeRequiredDefaultDescription
data{ x: number; y: number }[]YesN/AData points
axis{ x?: { name?: string; visible?: boolean }; y?: { name?: string; visible?: boolean } }NoN/AAxis configuration (labels and visibility)
widthnumber | stringNo300Chart width
heightnumber | stringNo300Chart height

Examples​

Simple​

Open Simple in Storybook

With Axes​

Open With Axes in Storybook

Negative Coordinates​

Open Negative Coordinates in Storybook

Large Dataset​

Open Large Dataset in Storybook

See Also​