React Migration in Pie Chart
This section explains how to migrate the PieChart component from EJ2 React to React. It highlights the API differences where property names or usage patterns changed and shows how to enable those APIs in JSX.
Pie Chart Properties
| EJ2 React | React | Description |
|---|---|---|
Props: | Props: | When set to true, labels for the points will be placed smartly to avoid overlapping. |
Props: | Props: | Specifies the visual outline style applied when the chart container receives focus. |
Prop: | Prop: | Configuration options for enhancing the accessibility of chart elements. |
Title and Subtitle
| EJ2 React | React | Description |
|---|---|---|
Prop: | Component: | Specifies the main title text of the chart. This text provides context or a label for the chart's data. |
Prop: | props: | Determines the alignment of the title within its container. |
Prop: | Component: | Specifies the sub title text of the chart. This text provides context or a label for the chart's data. |
Series
| EJ2 React | React | Description |
|---|---|---|
Props: | Props: | The field name in the data source that contains the x-value. |
Props: | Props: | The field name in the data source that contains the y-value. |
Prop: | Prop: | The field name in the data source that maps color values to individual points. |
Prop: | Prop: | The field name in the data source that provides values for tooltips. |
Prop: | Prop: | Shows the border for pie chart segments when the mouse hovers over a data point. |
Data Label
| EJ2 React | React | Description |
|---|---|---|
Prop: | Component: | When set to true, data labels for the series are rendered. |
Props: | Props: | Specifies the rotation angle of the data label in degrees. |
Prop: | Prop: | 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:
|
Prop: | Prop: | Limits the maximum width of individual legend item labels in pixels. Prevents long text from extending beyond the desired width. |
Legend
| EJ2 React | React | Description |
|---|---|---|
Prop: | Prop: | Specifies the alignment of the legend within its container. For horizontal positions ( |
Prop: | Prop: | Determines the alignment of the legend title. Options: |
Prop: | Prop: | Limits the legend title width in pixels; excess text wraps based on wrapping behavior. Default: |
Prop: | Prop: | Limits the maximum width of individual legend item labels (pixels). Prevents long text from overflowing. Default: |
Prop: | Prop: | Reverses the order within legend items (text before symbol). Default: |
Prop: | Prop: | Specifies the image URL for the legend icon. Requires the legend icon |
Prop: | Prop: | Specifies the shape of the legend icon for each data point. |
Tooltip
| EJ2 React | React | Description |
|---|---|---|
Prop: | Prop: | Shows or hides the tooltip. EJ2 uses |
Prop: | Prop: | Displays colored markers inside the tooltip to indicate the corresponding series for each data point. |
Prop: | Prop: | A callback function that allows for custom rendering of chart tooltips.
This function is invoked for each tooltip and receives its properties as an argument.
Available arguments:
|
Center Label
| EJ2 React | React | Description |
|---|---|---|
Prop: | Component: | Represents the configuration options for the center label displayed in Pie charts. Specifies the collection of label configurations to be displayed at the center of the pie chart. |
Events
| EJ2 React | React | Description |
|---|---|---|
Event: | Event: | Triggered after a legend item is clicked. Provides details about the clicked legend item, including its associated series and data points. |
Event: | Event: | Triggered after the chart is resized. Provides details about the chart's size before and after the resize. |
Event: | Event: | Triggered when a data point in the chart is clicked. Provides details about the clicked point, including its position, series index, and mouse coordinates. |
Event: | Event: | Triggered when the chart is clicked. Provides information about the mouse event, including the target element and pointer coordinates. |
Event: | Event: | Triggered when the mouse moves over the chart. Provides information about the mouse event, including the target element and pointer coordinates relative to the chart. |
Event: | Event: | Triggered when the mouse leaves the chart. Provides information about the mouse event, including the target element and pointer coordinates relative to the chart. |