ChartDataLabelProps
Configuration options for customizing data labels in chart series.
Props
The following table outlines the props for the ChartDataLabelProps:
| Name | Type | Default | Description |
|---|---|---|---|
| border | { color: '', width: 1 } | Customizes the border appearance of the data label, including width and color. | |
| borderRadius | { x: 5, y: 5 } | Specifies the horizontal ( | |
| enableRotation | boolean | false | Specifies whether the data label should be rotated based on the provided angle.
When set to |
| fill | string | 'transparent' | Specifies the background color of the data label. Use any valid CSS color values such as hex codes or RGBA. |
| font | { color: '', fontFamily: '', fontSize: '12px', fontStyle: 'Normal', fontWeight: 'Normal', opacity: 1 } | Customizes the font used in the data label, including size, color, style, weight, and family. | |
| format | string | null | null | Used to format the data label. This property accepts global string formats such as |
| formatter | (index: number, text: string) => string | boolean | null | Optional function to customize the content of the data label. If provided, this callback will be invoked for each data label during rendering. It receives the following arguments:
|
| intersectMode | 'Hide' | Specifies how overlapping data labels are handled. Available options:
| |
| labelField | string | null | null | Maps a specific field from the data source to use as the data label content. The mapped field's value is displayed as the label for each data point. |
| margin | { left: 5, right: 5, top: 5, bottom: 5 } | Sets the margin around the data label with top, right, bottom, and left values. | |
| opacity | number | 1 | Specifies opacity level of the data label background. Accepts values from 0 (transparent) to 1 (opaque). |
| position | 'Auto' | Sets the position of the data label relative to the data point. Available options:
| |
| rotationAngle | number | 0 | Specifies the rotation angle (in degrees) for the data label.
A positive value rotates the label clockwise, while a negative value rotates it counterclockwise.
This property is only effective when |
| showZero | boolean | true | Sets whether to display data labels for zero values in the series.
When |
| template | ((data: ChartDataLabelTemplateProps) => JSX.Element | null) | null | Custom template function for rendering the data label content. This function receives the data point properties and returns a JSX element to access the data point values. |
| textAlign | 'Center' | Sets the alignment of the data label relative to the data point. Available options:
| |
| visible | boolean | false | Controls the visibility of data labels in the series. Set to |