Back to Charts

Cartesian

LineChart

Multi-series SVG line chart for time, numeric, or categorical x-values with smooth, linear, step, point, label, and area-fill variants.

Examples

Multiple series

Line Chart - Multiple Smooth multi-series trend lines. Desktop Mobile
Line Chart - MultipleSmooth multi-series trend lines.150200250300350Apr 1Apr 8Apr 15Apr 22Apr 29May 6
Line Chart - Multiple
dateDesktopMobile
Apr 1222150
Apr 8248178
Apr 15301212
Apr 22277236
Apr 29336264
May 6365311
<LineChart
  title="Line Chart - Multiple"
  xKey="date"
  data={traffic}
  showPoints
  series={[
    {key: 'desktop', label: 'Desktop'},
    {key: 'mobile', label: 'Mobile'}
  ]}
/>

Step

Line Chart - Step Discrete changes without interpolation. Mobile
Line Chart - StepDiscrete changes without interpolation.100150200JanFebMarAprMayJun
Line Chart - Step
monthMobile
Jan80
Feb200
Mar120
Apr190
May130
Jun140
<LineChart
  title="Line Chart - Step"
  xKey="month"
  data={areaMix}
  curve="step"
  series={[{key: 'mobile', label: 'Mobile', showPoints: true}]}
/>

Labels

Line Chart - Labels Point labels for small categorical series. Desktop
Line Chart - LabelsPoint labels for small categorical series.200250300JanFebMarAprMayJun186305237273209214
Line Chart - Labels
monthDesktop
Jan186
Feb305
Mar237
Apr273
May209
Jun214
<LineChart
  title="Line Chart - Labels"
  xKey="month"
  data={areaMix}
  showLabels
  showPoints
  series={[{key: 'desktop', label: 'Desktop'}]}
/>

Props

PropTypeDefaultDescription
dataChartDatum[]Rows to plot. Each row must include the xKey and every series key.
seriesChartSeries[]Line series config with key, label, color, icon, unit, and showPoints.
xKeystring'x'Field used for the x-axis value.
xType'point' | 'linear' | 'time'Override inferred x-axis scale kind.
curve'linear' | 'monotone' | 'step''monotone'D3 curve interpolation for the line.
showAreabooleanfalseRender a translucent area under each line.
showPointsbooleanfalseRender point markers for every datum.
showLabelsbooleanfalseRender value labels above points.

Install

CLI

npm install d3-array d3-scale d3-shape
npx @a3tai/mittsu add line-chart --registry ./packages/charts/registry.json