Donut Chart

NEW

A hand-written SVG donut and half-ring gauge with animated arcs, a live center readout, hover highlighting, and a legend that filters slices without collapsing the ring.

Spend by service

This billing period

Total spend

$0

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/donut-chart

API Reference

PropTypeDefaultDescription
dataDonutDatum[]—Slices with a label, numeric value, and optional color
variant"donut" | "semi""donut"Renders a full ring or a half-ring gauge
sizenumber240Largest diameter in pixels; the chart shrinks to fit narrow containers
thicknessnumber16Stroke width of the ring in pixels
centerLabelstring"Total"Caption shown above the total in the center
formatValue(n: number) => stringIntl.NumberFormatFormats center values, slice values, and tooltips
showLegendbooleantrueShows the interactive slice legend
animatedbooleantrueEnables intro and value animations (disabled for reduced motion)
ariaLabelstringauto-generatedAccessible description for the chart image role
classNamestring""Additional CSS classes for the chart wrapper