DonutChart

One slice per row of a data array, labelField naming the slice and valueField sizing it. The chart fetches nothing, so pass rows you already have, and a row whose valueField is not a number above zero is a gap: it draws no slice. It is an add-on: import it from @chelone/react/charts or @chelone/vue/charts, and install recharts for React or @unovis/vue and @unovis/ts for Vue.

Installation

pnpm dlx shadcn@latest add @chelone/donut-chart
Loading preview…

One slice per row of a data array, labelField naming the slice and valueField sizing it. The chart fetches nothing, so pass rows you already have, and a row whose valueField is not a number above zero is a gap: it draws no slice. It is an add-on: import it from @chelone/react/charts or @chelone/vue/charts, and install recharts for React or @unovis/vue and @unovis/ts for Vue.

Props

PropTypeDefaultDescription
bareboolean—Leaves out the card and the title.
classNamestring—
colorsreadonly string[]—Any CSS colors, cycled over the slices. Defaults to the theme's chart colors.
datareadonly TRow[]—
heightnumber—In pixels. Defaults to 200.
labelFieldkeyof TRow & string—
loadingboolean—
titlestring—
valueFieldkeyof TRow & string—A row whose value is not a number above zero draws no slice.