Charts guide
PieChart
Pie and donut slices from a numeric dataKey.
Install
npx shadcn@latest add @foldcn/pie-chartPieChart parameters
| Parameter | Type / props | Behavior |
|---|---|---|
data | ReadonlyArray<Datum> | Rows read by each polar series, unless the series supplies data. |
children | PolarChild[] | Pie, Radar, or RadialBar plus polar grid/axis descriptors. |
width / height | number | Defaults to 500 × 500 for Pie/Radar or 700 × 433 for RadialBar. |
cx / cy / innerRadius / outerRadius / startAngle / endAngle / barSize | number | percentage string | Polar position, radial extent, angles, and radial bar thickness. |
responsive | boolean | Fits the SVG to the available width. |
margin | Margin | Insets the PieChart plot and its radius. |
activeIndex / onActiveIndexChange | number | null / callback | Caller-owned active pie sector for hover shapes. |
title / className | string | Accessible SVG label and wrapper class. |
Child components
| Parameter | Type / props | Behavior |
|---|---|---|
Pie / Radar / RadialBar | dataKey, nameKey, cx, cy, innerRadius, outerRadius, startAngle, endAngle, paddingAngle, cornerRadius, fill, stroke, fillOpacity, label, background, data, colors, gradientColors, activeShape | Numeric series descriptor. Rendering support varies by chart; see the scope note below. |
PolarGrid | none | Concentric polygons and radial spokes in RadarChart. |
PolarAngleAxis | dataKey | Category labels in RadarChart. |
PolarRadiusAxis | domain, angle, ticks | Sets the radial domain and tick positions in RadarChart. |
Supports slice angles, inner/outer radii, padding, rounded corners, percent labels, and caller-owned active sectors. Arbitrary custom shapes and controlled tooltips remain open.
Examples
The first example is open. Expand Source inside an example to view its code. Other examples load when opened.