Charts guide

PieChart

Pie and donut slices from a numeric dataKey.

Install

npx shadcn@latest add @foldcn/pie-chart

PieChart parameters

ParameterType / propsBehavior
dataReadonlyArray<Datum>Rows read by each polar series, unless the series supplies data.
childrenPolarChild[]Pie, Radar, or RadialBar plus polar grid/axis descriptors.
width / heightnumberDefaults to 500 × 500 for Pie/Radar or 700 × 433 for RadialBar.
cx / cy / innerRadius / outerRadius / startAngle / endAngle / barSizenumber | percentage stringPolar position, radial extent, angles, and radial bar thickness.
responsivebooleanFits the SVG to the available width.
marginMarginInsets the PieChart plot and its radius.
activeIndex / onActiveIndexChangenumber | null / callbackCaller-owned active pie sector for hover shapes.
title / classNamestringAccessible SVG label and wrapper class.

Child components

ParameterType / propsBehavior
Pie / Radar / RadialBardataKey, nameKey, cx, cy, innerRadius, outerRadius, startAngle, endAngle, paddingAngle, cornerRadius, fill, stroke, fillOpacity, label, background, data, colors, gradientColors, activeShapeNumeric series descriptor. Rendering support varies by chart; see the scope note below.
PolarGridnoneConcentric polygons and radial spokes in RadarChart.
PolarAngleAxisdataKeyCategory labels in RadarChart.
PolarRadiusAxisdomain, angle, ticksSets 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.

1003001008040305010020015050
View the Recharts example