Skip to content

ChartPie

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

import { ChartPie } from '@fintech-sandpit/ui/react';
const data = [
{ name: 'Windows', value: 186 },
{ name: 'Mac', value: 80 },
{ name: 'Linux', value: 120 },
];
return (
<ChartPie
data={data}
height="400px"
showTooltip={true}
showLegend={true}
/>
);
NameTypeDefaultDescription
dataChartPieDataItem[]Array of data objects where each object represents a data point with name and value
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 segments
type CssUnit = `${number}${'px' | 'em' | 'rem' | 'vw' | 'vh' | 'vmin' | 'vmax' | '%'}`
type LegendPosition = 'top' | 'bottom' | 'left' | 'right'
type ChartPieDataItem = {
name: string;
value: number;
}