Skip to main content
The LineChart component visualizes data as a series of points connected by line segments. It’s ideal for showing trends over time or continuous data.

Basic line chart

Line types

Different line interpolation types for varied visual styles.

Customized dots and labels

Dashed line

Connect nulls

Control how null values are handled in the line.

Multiple lines with legend

With animations

The default tooltip event type for LineChart is 'axis', which displays all data points at the current x-axis position.

Common pitfalls

  • Missing dataKey: Always specify dataKey on both the Line component and the XAxis to ensure proper rendering.
  • Null handling: Use connectNulls={true} if you want to bridge gaps in your data, otherwise gaps will appear.
  • Performance: For datasets with thousands of points, consider using isAnimationActive={false} to improve rendering performance.
  • Responsive sizing: Use ResponsiveContainer to make charts adapt to parent container size instead of fixed width/height.