/

Line Chart

Plot continuous data as connected points. Ideal for time series, trends, and comparisons across a continuous axis.

Usage

example.tsx
import { LineChart } from "@chartts/react"

<LineChart
  data={salesData}
  x="month"
  y="revenue"
  curve="monotone"
  area
  className="h-64"
/>

Props

PropTypeDescription
dataT[]Array of data objects
xkeyof TKey for the x-axis values
ykeyof T | (keyof T)[]Key(s) for y-axis values. Pass an array for multi-line.
curve'linear' | 'monotone' | 'step' | 'natural'Interpolation method between points. Default: 'monotone'
areabooleanFill area under the line. Default: false
dotsbooleanShow data point markers. Default: true
animatebooleanEnable line draw animation. Default: true

Features

  • Multiple lines with automatic legend
  • Area fill with gradient support
  • Configurable curve interpolation
  • Animated line drawing on mount
  • Interactive tooltips with crosshair
  • Zoom and pan support

Other Charts