Zum Hauptinhalt springen

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​

Simple in Storybook öffnen

With Axes​

With Axes in Storybook öffnen

Negative Coordinates​

Negative Coordinates in Storybook öffnen

Large Dataset​

Large Dataset in Storybook öffnen

See Also​