Skip to main content

Overview

Active Users
Last 7 days
Line Chart visualizes continuous data trends over time. It supports multiple lines, area fills, reference lines, and dot markers — ideal for metrics, analytics dashboards, and time-series data.

Installation


Usage


Variants

Simple Line

Area Fill

Multiple Lines

With Reference Line


API Reference

Record<string, any>[]
required
Array of data objects. Each object represents one point on the x-axis.
string
required
The key used as the x-axis category (e.g. "date", "month").
LineConfig[]
required
Array of line configurations: { key, label, color, fill?, strokeDasharray? }.
number
default:"300"
Chart height in pixels.
ReferenceLineConfig[]
Horizontal reference lines: { y, label, color, strokeDasharray? }.
boolean
default:"true"
Show dots at data points.
boolean
default:"true"
Show background grid lines.
boolean
default:"true"
Show color legend.
boolean
default:"true"
Show interactive hover tooltips.
string
default:"monotone"
Line curve interpolation. Values: linear · monotone · step

Accessibility

  • SVG chart includes <title> and <desc> elements for screen readers
  • Provide a data table fallback for critical data — charts are visual only
  • Tooltip values are announced via aria-live="polite" region
  • Use distinct colors AND line styles (solid, dashed, dotted) for multi-line charts

Do’s & Don’ts

Do

  • Use Line Chart for time-series and trend data (daily, weekly, monthly)
  • Use fill: true (area fill) for single-metric dashboards — it’s easier to read
  • Add reference lines for targets or thresholds
  • Limit to 4–5 lines maximum before using small multiples

Don't

  • Don’t use Line Chart for categorical comparisons — use Bar Chart
  • Don’t connect dots when data has gaps — use connectNulls={false}
  • Don’t plot more than 5 lines on one chart — it becomes unreadable
  • Don’t omit axis labels — always show the unit (USD, %, users)