PieChart component displays data as slices of a circular chart. It’s ideal for showing proportions and percentages of a whole.
Basic pie chart
Donut chart
Set
innerRadius to create a donut chart. The larger the inner radius, the thinner the donut.Custom colors with Cell
Pie with labels
Center label (donut)
Multiple pies
Active shape
Pie with padding angle
Custom start and end angle
Common pitfalls
- Missing dataKey: Always specify
dataKeyto tell Recharts which field contains the slice values. - Colors: If you don’t use
<Cell>components orfillproperty on data items, all slices will use the default color. - Tooltip event type: PieChart only supports
'item'tooltip event type. - Center positioning: Use
cxandcyas percentages (e.g.,"50%") for responsive centering. - Label overlap: When using labels on small slices, consider using
labelLine={false}or custom label rendering.