Skip to content

ChartLine

The ChartLine component displays data as a line chart with customizable styling, tooltips, and legends. Built with ApexCharts.

import { ChartLine } from '@fintech-sandpit/ui/react';
const data = [
{ name: 'Jan', revenue: 4000, expenses: 2400 },
{ name: 'Feb', revenue: 3000, expenses: 1398 },
{ name: 'Mar', revenue: 2000, expenses: 9800 },
];
const series = [
{ name: 'Revenue', dataKey: 'revenue' },
{ name: 'Expenses', dataKey: 'expenses' },
];
return (
<ChartLine
data={data}
series={series}
height="400px"
showTooltip={true}
showLegend={true}
/>
);
NameTypeDefaultDescription
dataChartLineDataItem[]Array of data objects where each object represents a data point with name and multiple value properties
seriesArray<{ name: string; dataKey: string }>Array of series objects defining which data keys to display as lines
widthCssUnit'100%'Width of the chart container (CSS unit string like ‘100%’, ‘400px’, ‘50rem’)
heightCssUnit'400px'Height of the chart container (CSS unit string like ‘400px’, ‘50vh’)
legendPositionLegendPosition'bottom'Position of the legend
showTooltipbooleantrueWhether to display tooltips on hover
showLegendbooleantrueWhether to display the legend
colorsstring[]Array of colors for the chart lines
type CssUnit = `${number}${'px' | 'em' | 'rem' | 'vw' | 'vh' | 'vmin' | 'vmax' | '%'}`
type LegendPosition = 'top' | 'bottom' | 'left' | 'right'
type ChartLineDataItem = {
name: string;
[key: string]: string | number;
}