Toggle Sidebar B
header.lightDarkMode D

Chart Pie

Pie and donut charts built on unovis-vue. One ChartPie renders a full pie, a donut, a donut with a centre total, or nested rings.

Pie

A full pie (arc-width 0). Each row maps to a config entry for its color.

Donut

Set arc-width to leave a hole in the centre.

Donut with text

Show a total (or any label) in the centre.

Stacked

Concentric rings via the layers prop.

Center total

Per-segment gradients, rounded segments, a drop shadow, and a center total.

Center stats

A center percentage with a legend below.

Pattern segments

Mix solid and SVG-pattern segments in a single pie.

Active segment

Expand one segment outward with activeIndex.

API Reference

Props, events, and slots for each sub-component.

ChartPie

Props

PropTypeDefaultDescription
dataRecord<string, any>[][]Segment rows.
configChartConfigMap of segment name → { label, color }, plus a value-key meta entry for the tooltip label.
valueKeystring"value"Row key for the segment value.
nameKeystring"name"Row key matched against config for the color.
arcWidthnumber00 = full pie; a positive value = donut ring width.
centerLabelstringnullExplicit centre label.
centerSubLabelstringnullCentre sub-label; auto-sums the value when no centerLabel/total is given.
totalnumber | stringnullCentre total override.
layers{ data, valueKey, arcWidth, radius }[]nullConcentric rings for a nested/stacked pie.
legendbooleanfalseRender a legend below the chart.
radiusnumbernullExplicit outer radius in px.
cornerRadiusnumber0Rounded segment ends.
padAnglenumber0Gap between segments, in radians.
svgDefsstringnullRaw SVG <defs> string (gradients/patterns/filters).
segmentFill(d) => stringnullPer-segment fill accessor; defaults to the row's fill then config color.
segmentStrokeColorstringnullStroke drawn in the gap between segments (e.g. var(--background)).
segmentStrokeWidthnumber4Segment gap stroke width.
donutFilterstringnullSVG filter url applied to the donut group (e.g. a drop shadow).
activeIndexnumbernullIndex of the segment rendered expanded.
activeOuterRadiusnumber110Outer radius of the expanded active segment.