Line Chart

A line chart component.

Usage

Detailed

Interpolation

The interpolate prop controls how missing data points (null or undefined) are filled. Interpolated segments are displayed with a dashed line. Tooltips on interpolated points show "No data" instead of the interpolated value.

  • true - Interpolate across the entire dataset
  • { from, to } - Interpolate within a specific range using index key values
    • from - Start value from the index key (inclusive), defaults to first data point
    • to - End value from the index key (inclusive), defaults to last data point

Full range

Interpolate across the entire dataset by passing interpolate={true}.

Specific range

Only interpolate missing values between specific index key values.

From value to end

Interpolate from a specific index key value to the end of the data.

All values undefined

When all data values are undefined within the interpolation range, a flat dashed line at 0 is displayed.

Props

PropTypeDefaultDescription
data*any[]-Array of data points for the chart.
categories*string[]-Array of category names to display.
index*string-Key in data objects to use as the x-axis index.
colorsColor[]["brand"]Array of colors for each category.
showGridLinesbooleanfalseWhether to show grid lines.
startEndOnlybooleanfalseOnly show start and end labels on x-axis.
showAnimationbooleanfalseWhether to animate the chart on render.
showXAxisbooleanfalseWhether to show the x-axis.
showYAxisbooleanfalseWhether to show the y-axis.
allowDecimalsbooleantrueAllow decimal values on y-axis. Set to false for integer-only values.
yAxisMaxnumber-Maximum value for y-axis. When set, the y-axis will use [0, yAxisMax] as the domain.
showLegendbooleanfalseWhether to show the legend.
interpolateboolean | { from?: string; to?: string }-Interpolation for missing values. Pass true to interpolate everything, or an object with 'from'/'to' index key values to interpolate a specific range. Interpolated segments are displayed with dashed lines.
valueFormatter(value: number) => string-Custom formatter for tooltip values.
classNamestring-Additional CSS classes to apply.