Pie
相关链接
animationBeginnumberoptional
Specifies when the animation should begin, the unit of this option is ms.
默认值:
400animationDurationnumberoptional
Specifies the duration of animation, the unit of this option is ms.
默认值:
1500animationEasing"ease" | "ease-in" | "ease-in-out" | "ease-out" | "linear" | "spring" | EasingFunction | `cubic-bezier(${number},${number},${number},${number})`optional
The type of easing function.
默认值:
"ease"animationInterpolateFnAnimationInterpolateFn<PieSectorDataItem, PolarLayout>optional
Custom animation function for interpolating data items. When provided, this replaces the default animation interpolation.
Recharts 自 3.9
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
Recharts 自 3.9
默认值:
"append"childrenReactNodeoptional
classNamestringoptional
cornerRadiusnumber | stringoptional
cxnumber | stringoptional
The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width.
默认值:
"50%"cynumber | stringoptional
The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height.
默认值:
"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.格式:
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.
默认值:
"value"endAnglenumberoptional
Angle, in degrees, at which the chart should end.
默认值:
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.默认值:
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.
默认值:
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.
默认值:
"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.默认值:
false格式:
<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.
默认值:
true格式:
<Pie labelLine={<CustomizedLabelLine />} /> https://recharts.github.io/examples/PieChartWithCustomizedLabellegendType"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.
默认值:
"rect"maxRadiusnumberoptional
the max radius of pie
minAnglenumberoptional
The minimum angle of each unzero data.
默认值:
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.
默认值:
"name"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.
默认值:
"80%"paddingAnglenumberoptional
The angle between two sectors.
默认值:
0格式:
<Pie paddingAngle={5} /> https://recharts.github.io/examples/PieChartWithPaddingAnglerootTabIndexnumberoptional
The tabindex of wrapper surrounding the cells.
默认值:
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.
默认值:
0tooltipType"none"optional
zIndexnumberoptional
默认值:
100