Line chart preview

Line chart

Smooth lines with a soft area fill, a shared crosshair and a tooltip; arrow keys step through the points.

  • Group
    Charts
  • Origin
    Inspired · Original (this library)
  • License
    MIT
  • Added
    Oct 22
npx shadcn@latest add @deank/line-chart

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { LineChart } from "@/registry/components/line-chart/line-chart";

<LineChart data={[/* … */]} x={/* … */} series={[/* … */]} label="…" />

Props

PropTypeDefaultDescription
dataT[]
xkeyof T & stringField used for the x axis labels
seriesLineSeries[]
labelstringAccessible summary, e.g. "Weekly signups, Jan to Jun"
height?number260
formatValue?(v: number) => string(v) => v.toLocaleString()
area?booleantrueFill under the first series
curved?booleantrueDraw a smooth curve instead of straight segments

When to use

One to four series over time or another ordered axis, in dashboards and reports, up to a few hundred points.

When not to use

Categories without an order (use bar-chart); one value against a range (use gauge); dense scientific plots or zooming (use a chart library).

Related

Bar chart · Gauge · Data grid