LabelList
相关链接
父组件
LabelList consumes context provided by these components:
anglenumberoptional
Text rotation angle in degrees. Positive values rotate clockwise, negative values rotate counterclockwise.
默认值:
0backgroundTextBackgroundProps | false | trueoptional
Draws a rectangle behind each label, for example to keep labels readable on top of filled shapes.
truedraws the background with the styles from the theme'sgraphicalItems[n].label.background. If neither sets afill, the fill is thepageBackgroundcolor from the theme, or white when no theme is set.- An object accepts SVG
<rect>attributes such asfill,strokeandrx, and apadding. It is merged over the theme styles key by key. falsedraws no background, even if the theme turns backgrounds on.undefineduses the theme'sgraphicalItems[n].label.background, and draws no background without a theme.
Each background is sized from its rendered label and follows curved label paths. It is not drawn for custom
content.Recharts 自 3.11
格式:
<LabelList position="inside" background /> <LabelList position="inside" background={{ fill: '#fff', rx: 2, padding: 4 }} />clockWisebooleanoptional
The parameter to calculate the view box of label in radial charts.
contentFunction | ReactNodeoptional
If set a React element, the option is the customized React element of rendering each label. Use an SVG element or component, such as
<text>or<g>. HTML elements such as<div>are not valid inside the chart SVG and may trigger React DOM warnings. If set to a function, the function is called once for each item格式:
<LabelList content={CustomizedLabel} />dataKeyFunction | number | stringoptional
Decides how to extract the value of each label 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 of each label.
If set, then valueAccessor will be ignored.
Scatter requires this prop to be set. Other graphical components will show the same value as the dataKey of the component by default.
formatterFunctionoptional
Function to customize how content is serialized before rendering.
This should return a renderable text - something that the Text component can render. Typically, a string or number. Custom components are not supported here - use the
contentprop instead.idstringoptional
Unique identifier of this component. Used as an HTML attribute
id.offsetnumber | stringoptional
The offset to the specified "position". Direction of the offset depends on the position.
默认值:
5position"bottom" | "center" | "centerBottom" | "centerTop" | "end" | "inside" | "insideBottom" | "insideBottomLeft" | "insideBottomRight" | "insideEnd" | "insideLeft" | "insideRight" | "insideStart" | "insideTop" | "insideTopLeft" | "insideTopRight" | "left" | "middle" | "outside" | "right" | "top" | { x?: string | number | undefined; y?: string | number | undefined; }optional
The position of label relative to the view box.
默认值:
"middle"textBreakAllbooleanoptional
默认值:
falsevalueAccessorFunctionoptional
The accessor function to get the value of each label. Is ignored if dataKey is specified.
zIndexnumberoptional
Z-Index of this component and its children. The higher the value, the more on top it will be rendered. Components with higher zIndex will appear in front of components with lower zIndex. If undefined or 0, the content is rendered in the default layer without portals.
Recharts 自 3.4
默认值:
2000