Saltar al contenido principal

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​

Abrir Simple en Storybook

With Axes​

Abrir With Axes en Storybook

Negative Coordinates​

Abrir Negative Coordinates en Storybook

Large Dataset​

Abrir Large Dataset en Storybook

See Also​