Line Chart

A line chart is a visual representation that shows quantitative data as a series of points connected by straight line segments.

Props

LineChart

PropTypeDefaultDescription
datarequiredRecord<string, string | number>[]The data to be displayed in the chart.
allowDecimalsbooleanShow decimals on the y-axis.
animationDurationnumberAnimation duration in milliseconds.
categoriesstring[]The data keys to be displayed in the chart.
childrenstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>Children to render.
colorsstring[]The colors to use for each category.
connectNullsbooleanWhether to connect null values.
curveTypeCurveTypeThe curve type of the line.
heightResponsiveValue<number | "px" | (string & {}) | "max" | "min" | "auto" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "-moz-max-content" | "-moz-min-content" | ... 56 more ... | "container.2xl">The height of the chart.
indexstring'date'The y-axis data key to use.
intervalTypetype ONLY_FOR_FORMAT = | number | "preserveStartEnd" | "equidistantPreserveStart" | "preserveStart" | "preserveEnd"If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically.
legendHeightnumberHeight of the legend.
maxValuenumber | "auto"'auto'The upper bound of the y-axis.
minValuenumber | "auto"0The lower bound of the y-axis.
showAnimationbooleanWether to show the animation or not.
showGridbooleanWether to show the grid or not.
showLegendbooleanWether to show the legend or not.
showTooltipbooleanWether to show the tooltip or not.
showXAxisbooleanWether to show the x-axis or not.
showYAxisbooleanWether to show the y-axis or not.
startEndOnlybooleanOnly show the start and end ticks on the x-axis.
strokeWidthstring | numberThe width of the line.
tooltipContent(props: TooltipProps<any, any>) => ReactNodeRender custom tooltip content.
valueFormatter(value: number) => stringFormat the value of the x-axis.
yAxisWidthnumberWidth of the y-axis labels.

Was this helpful?