Pie
Related Links
animationBeginnumberoptional
Specifies when the animation should begin, the unit of this option is ms.
DEFAULT:
400animationDurationnumberoptional
Specifies the duration of animation, the unit of this option is ms.
DEFAULT:
1500animationEasing"ease" | "ease-in" | "ease-in-out" | "ease-out" | "linear" | "spring" | EasingFunction | `cubic-bezier(${number},${number},${number},${number})`optional
The type of easing function.
DEFAULT:
"ease"animationInterpolateFnAnimationInterpolateFn<PieSectorDataItem, PolarLayout>optional
Custom animation function for interpolating data items. When provided, this replaces the default animation interpolation.
Available since Recharts 3.9
Examples:
animationMatchBy"append" | "index" | AnimationMatchBy<PieSectorDataItem>optional
Strategy for matching previous items to next items during animation. Determines how Recharts pairs old data points with new data points to create smooth transitions.
matchAppend(default): match sequentially by index and treat newly appended items as newmatchByIndex: match by array position with proportional stretchingmatchByDataKey('someKey'): match by a data key from the payload- Custom function
(item, index) => key: match by the returned key
Available since Recharts 3.9
DEFAULT:
"append"Examples:
childrenReactNodeoptional
classNamestringoptional
cornerRadiusnumber | stringoptional
Examples:
cxnumber | stringoptional
The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width.
DEFAULT:
"50%"cynumber | stringoptional
The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height.
DEFAULT:
"50%"dangerouslySetInnerHTMLObjectoptional
dataReadonlyArray<DataPointType>optional
The source data. Each element should be an object. The properties of each object represent the values of different data dimensions.
Use the
dataKeyprop to specify which properties to use.FORMAT:
data={[{ name: 'a', value: 12 }]} data={[{ label: 'foo', measurements: [5, 12] }]}dataKeyTypedDataKey<DataPointType, DataValueType>optional
The data that you provide via the
dataprop is an array of objects. Each object can have multiple properties, each representing a different data dimension. Use thedataKeyprop to specify which property (or dimension) to use for this component.Typically, you will want to have one dataKey on the X axis, and different dataKey on the Y axis, where they extract different values from the same data objects.
Decides how to extract the value from the data:
string: the name of the field in the data object;number: the index of the field in the data;function: a function that receives the data object and returns the value.
DEFAULT:
"value"endAnglenumberoptional
Angle, in degrees, at which the chart should end.
DEFAULT:
360formatterFormatteroptional
Formats the value displayed in the tooltip for this Pie. When set, takes precedence over the
formatterprop on the Tooltip component.hidebooleanoptional
Hides the whole graphical element when true.
Hiding an element is different from removing it from the chart: Hidden graphical elements are still visible in Legend, and can be included in axis domain calculations, depending on
includeHiddenprops of your XAxis/YAxis.DEFAULT:
falseidstringoptional
innerRadiusnumber | stringoptional
The inner radius of the sectors. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy.
DEFAULT:
0isAnimationActive"auto" | false | trueoptional
If set false, animation will be disabled. If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility.
DEFAULT:
"auto"label(union of 6 variants)optional
Renders one label for each pie sector. Options:
true: renders default labels;false: no labels are rendered;objectthat haspositionprop: the props of LabelList component;objectthat does not havepositionprop: the props of a custom Pie label (similar to Label with position "outside"); this variant supportslabelLineReactElement: a custom SVG label element, such as<text>or<g>. HTML elements such as<div>are not valid inside the chart SVG and may trigger React DOM warnings.function: a render function of custom label.
Also see the
labelLineprop that draws a line connecting each label to the corresponding sector.DEFAULT:
falseFORMAT:
<Pie label={<CustomizedLabel />} /> https://recharts.github.io/examples/PieChartWithCustomizedLabellabelLine(union of 5 variants)optional
If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally. If object set, label lines will be drawn which have the props merged by the internal calculated props and the option. If ReactElement set, the option can be the custom label line element. If set a function, the function will be called to render customized label line.
DEFAULT:
trueFORMAT:
<Pie labelLine={<CustomizedLabelLine />} /> https://recharts.github.io/examples/PieChartWithCustomizedLabelExamples:
legendType"circle" | "cross" | "diamond" | "line" | "none" | "plainline" | "rect" | "square" | "star" | "triangle" | "wye"optional
The type of icon in legend. If set to 'none', no legend item will be rendered.
DEFAULT:
"rect"maxRadiusnumberoptional
the max radius of pie
minAnglenumberoptional
The minimum angle of each unzero data.
DEFAULT:
0nameKeyTypedDataKey<DataPointType, DataValueType>optional
Name represents each sector in the tooltip, and legend. This allows you to extract the name from the data:
string: the name of the field in the data object;number: the index of the field in the data;function: a function that receives the data object and returns the name.
DEFAULT:
"name"Examples:
outerRadiusFunction | number | stringoptional
The outer radius of the sectors. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Function should return a string percentage or number.
DEFAULT:
"80%"paddingAnglenumberoptional
The angle between two sectors.
DEFAULT:
0FORMAT:
<Pie paddingAngle={5} /> https://recharts.github.io/examples/PieChartWithPaddingAngleExamples:
rootTabIndexnumberoptional
The tabindex of wrapper surrounding the cells.
DEFAULT:
0shape(union of 5 variants)optional
The custom shape of a Pie Sector. Can also be used to render active sector by checking isActive. During animations, the function shape also receives
animationElapsedTime,isAnimating, andisEntrance. If undefined, renders Sector shape.startAnglenumberoptional
Angle in degrees from which the chart should start.
DEFAULT:
0tooltipType"none"optional
zIndexnumberoptional
DEFAULT:
100