Skip to content

ChartDonut

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

import { ChartDonut } from '@fintech-sandpit/ui/react';
const data = [
{ name: 'Windows', value: 186 },
{ name: 'Mac', value: 80 },
{ name: 'Linux', value: 120 },
];
return (
<ChartDonut
data={data}
height="400px"
showTooltip={true}
showLegend={true}
/>
);
NameTypeDefaultDescription
dataChartDonutDataItem[]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’)
innerRadiusCssUnit'70%'Size of the inner hole (donut hole) as a percentage. Higher values create a thinner ring (e.g., ‘70%’ means the hole is 70% of the diameter, leaving 30% for the ring)
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 ChartDonutDataItem = {
name: string;
value: number;
}