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 valuesfrom- Start value from the index key (inclusive), defaults to first data pointto- 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
| Prop | Type | Default | Description |
|---|---|---|---|
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. |
colors | Color[] | ["brand"] | Array of colors for each category. |
showGridLines | boolean | false | Whether to show grid lines. |
startEndOnly | boolean | false | Only show start and end labels on x-axis. |
showAnimation | boolean | false | Whether to animate the chart on render. |
showXAxis | boolean | false | Whether to show the x-axis. |
showYAxis | boolean | false | Whether to show the y-axis. |
allowDecimals | boolean | true | Allow decimal values on y-axis. Set to false for integer-only values. |
yAxisMax | number | - | Maximum value for y-axis. When set, the y-axis will use [0, yAxisMax] as the domain. |
showLegend | boolean | false | Whether to show the legend. |
interpolate | boolean | { 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. |
className | string | - | Additional CSS classes to apply. |