Chart
Area, line, bar and sparkline charts drawn in plain SVG. Curves draw in, bars grow, data changes morph, and the tooltip follows your cursor.
Data Display
Visitors
113,325
Playground
Tweak the props, the preview and the code follow.
Props
<AreaChart
data={data}
index="month"
series={[
{ key: "signups", label: "Signups" },
{ key: "trials", label: "Trials" },
]}
/>Installation
npx @plumsydev/plum-ui add chartUsage
import { AreaChart, BarChart, LineChart, Sparkline } from "@/components/ui/chart"<AreaChart
data={data}
index="month"
series={[
{ key: "desktop", label: "Desktop" },
{ key: "mobile", label: "Mobile" },
]}
/>Examples
Bar chart
Grouped or stacked. The legend toggles series.
Revenue by source
Click the legend to hide a series
Live data
Feed new points and the line glides instead of jumping.
Response time
api.acme.com · last 30 seconds
Sparklines
Tiny trend lines for KPI cards.
Click a card to refresh the data.
API Reference
AreaChart / LineChart / BarChart
| Prop | Type | Default |
|---|---|---|
data*One object per x value. | Record<string, string | number>[] | — |
index*Key used for the x axis. | string | — |
series*Values to plot. Colors default to the theme palette. | { key: string; label?: string; color?: string }[] | — |
heightHeight in px. Width follows the container. | number | 260 |
stackedStack series on top of each other. | boolean | false |
grid / xAxis / yAxis / legend / tooltipToggle chart furniture. | boolean | true |
valueFormatterFormats ticks and tooltip values. | (value: number) => string | — |
curveArea and line only. | "smooth" | "linear" | "smooth" |
dotsArea and line only. Show a dot on each point. | boolean | false |
Sparkline
| Prop | Type | Default |
|---|---|---|
data*The values. | number[] | — |
colorStroke color. | string | "var(--brand)" |
fillGradient under the line. | boolean | true |
Notes
- Define
--chart-1to--chart-5in your theme to change the default palette. - Smooth curves use monotone interpolation, so they never overshoot your data.