ValyroUI Русская версия

Donut Chart

Donut charts. Free, MIT · Charts and analytics › Shares and composition

Installation

npx valyro-cli@latest add donut-chart
npx shadcn@latest add https://valyro.xyz/r/donut-chart.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { DonutChart } from 'valyro-ui';

Props

PropTypeDefault
data *DonutSegment[]Segments in drawing order, clockwise from the top; zero, negative and non-finite values take no space.
sizenumber200Diameter in px (shrinks to fit narrow containers). Default 200.
thicknessnumberRing thickness in px. Default 12% of the size.
gapnumberGap between segments in px. Default: the theme's --ui-donut-chart-gap.
labelstringCaption under the total in the center, e.g. "Visitors".
valueFormatterValueFormatterFormats the center total, legend values, data table and announcements.
localestringBCP 47 locale for the default number formatting. Default: the ThemeProvider locale, then the browser's.
labelsPartial<DonutChartLabels>Overrides for the built-in strings.
showLegendbooleantrueLegend with values and percentages next to (or under) the ring. Default true.
ariaLabel *stringAccessible name of the chart (also the caption of its sr-only data table).

Related components

Previous: Candlestick Chart · Next: Treemap · All Charts and analytics