Controls

Scatter Chart

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Scatter Chart
  • Desktop
  • Mobile

Load time against conversion
PointSeriesLoad time (s)Conversion
1Desktop0.4s75%
2Mobile0.4s91%
3Desktop0.55s92%
4Mobile0.55s64%
5Desktop0.69s65%
6Mobile0.69s80%
7Desktop0.84s80%
8Mobile0.84s72%
9Desktop0.98s63%
10Mobile0.98s56%
11Desktop1.13s71%
12Mobile1.13s76%
13Desktop1.27s75%
14Mobile1.27s51%
15Desktop1.42s53%
16Mobile1.42s69%
17Desktop1.56s74%
18Mobile1.56s48%
19Desktop1.71s57%
20Mobile1.71s47%
21Desktop1.85s53%
22Mobile1.85s58%
23Desktop2s56%
24Mobile2s31%
25Desktop2.15s45%
26Mobile2.15s49%
27Desktop2.29s64%
28Mobile2.29s38%
29Desktop2.44s38%
30Mobile2.44s40%
31Desktop2.58s50%
32Mobile2.58s35%
33Desktop2.73s50%
34Mobile2.73s17%
35Desktop2.87s30%
36Mobile2.87s38%
37Desktop3.02s49%
38Mobile3.02s14%
39Desktop3.16s24%
40Mobile3.16s17%
41Desktop3.31s45%
42Mobile3.31s25%
43Desktop3.45s31%
44Mobile3.45s8%

Scatter Chart

A dot plot that shows how two measures relate across many items.

Installation

npx shadcn@latest add ikislay/pixel-ui/scatter-chart

How to use

import { ScatterChart } from "@/components/ui/scatter-chart"
const series = [
{
label: "Pages",
points: [
{ x: 1.2, y: 64, label: "Home" },
{ x: 2.8, y: 41, label: "Pricing" },
{ x: 0.6, y: 82, label: "Docs" },
],
},
]
export function Demo() {
return <ScatterChart label="Load time against conversion" series={series} xLabel="Load (s)" yLabel="Conversion" />

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
series*
{ label: string; color?: string; points: { x: number; y: number; label?: string }[] }[]

Groups of points. Colors follow the chart palette in order unless you set one.

label*
string

Names the chart for screen readers and captions its data table.

xLabel
string

Names the horizontal measure under the axis and in the tooltip.

yLabel
string

Names the vertical measure in the tooltip.

height
number

Height in pixels. The width fills the parent.

format
(value: number) => string

Formats values wherever the chart shows them. Defaults to short numbers like 12.4K.

formatX
(value: number) => string

Formats horizontal values, like format does for vertical ones.

className
string

Merged onto the root element.