Renders pie chart sectors in a polar chart. The Pie component displays data as wedges of a circle, where each wedge’s arc length is proportional to the data value.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/recharts/recharts/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Props
Data and keys
The source data array. Each element in the data array represents one sector of the pie.
The key of a group of data which should be unique in a pie chart.Can be a string, number, function, or array path.
The key of the name property in the data. Used for tooltips and legends.Can be a string, number, function, or array path.
Position and dimensions
The x-coordinate of the pie center.If set as a percentage, the final value is obtained by multiplying the percentage with the container width.
The y-coordinate of the pie center.If set as a percentage, the final value is obtained by multiplying the percentage with the container height.
The inner radius of the sectors.If set as a percentage, the final value is obtained by multiplying the percentage with maxRadius.
Set to a positive value to create a donut chart.
The outer radius of the sectors.If set as a percentage, the final value is obtained by multiplying the percentage with maxRadius.
Can also be a function that receives a data point and returns a number or string.
The starting angle of the first sector, in degrees.
The ending angle of the last sector, in degrees.
The angle between two adjacent sectors, in degrees.
The radius of the rounded corners of each sector.
Appearance
The fill color of the sectors.
The stroke color of the sectors.
The stroke width of the sectors.
Behavior
The minimum angle of each non-zero data sector, in degrees.Useful for ensuring small values are still visible.
If true, the pie will not be rendered.Hidden elements are still visible in the legend and can be included in axis domain calculations.
Labels
Renders one label for each pie sector.Options:
true: renders default labelsfalse: no labels are renderedobjectwithpositionprop: props for LabelList componentobjectwithoutpositionprop: props for custom Pie label with optional labelLineReactElement: custom label elementfunction: render function for custom label
Controls the line connecting each label to its sector.Options:
false: no label linestrue: default label linesobject: props for the label line path elementReactElement: custom label line elementfunction: render function for custom label line
Custom shapes
Custom shape for rendering pie sectors.Can be a React element or a function that receives sector props and returns a React element.
The function receives
isActive prop to distinguish active sectors.Deprecated. Use the
shape prop instead. isActive designates the active shape.Custom shape rendered when a sector is activated (by mouse hover, keyboard, etc.).Deprecated. Use the
shape prop instead.Custom shape for inactive sectors.Animation
If false, animation will be disabled.If “auto”, animation is disabled in SSR and respects the user’s prefers-reduced-motion preference.
Specifies when the animation should begin, in milliseconds.
Specifies the duration of animation, in milliseconds.
The type of easing function.Options: ‘ease’, ‘ease-in’, ‘ease-out’, ‘ease-in-out’, ‘linear’
Callback fired when animation starts.
Callback fired when animation ends.
Display
The type of icon in the legend.Options: ‘line’, ‘plainline’, ‘square’, ‘rect’, ‘circle’, ‘cross’, ‘diamond’, ‘star’, ‘triangle’, ‘wye’, ‘none’
Valid tooltip types for this graphical item.
The z-index of the pie sectors.Higher values render on top of lower values.
Interaction
Event handler for click events on sectors.Signature:
(data: PieSectorDataItem, index: number, e: React.MouseEvent) => voidEvent handler for mouse enter events on sectors.
Event handler for mouse leave events on sectors.
Event handler for mouse move events on sectors.
Other
Unique identifier for this pie instance.
CSS class name for the pie element.
The tabindex attribute of the wrapper element surrounding the sectors.