React PieChart - Overview
A series is a collection of related data points. The most important characteristic of a series is its type. The PieChart provides Pie and Doughnut series types; the only difference between them is the Doughnut has a blank center.
The Pie series type is used by default, but you can change it to Doughnut using the type property.
- import React from 'react';
- import PieChart from 'devextreme-react/pie-chart';
- const App = () => {
- return (
- <PieChart ...
- type="doughnut"> {/* or "donut" */}
- </PieChart>
- );
- };
- export default App;
Use the series property to configure a series. Pass an object to this property if you have only one series, or an array of objects when you have multiple series. In the latter case, you can also specify settings common for all series in the commonSeriesSettings object, for example:
- import React from 'react';
- import PieChart, {
- CommonSeriesSettings,
- Series
- } from 'devextreme-react/pie-chart';
- const App = () => {
- return (
- <PieChart ... >
- <CommonSeriesSettings
- argumentField="year"
- />
- <Series valueField="men" />
- <Series valueField="women" />
- </PieChart>
- );
- };
- export default App;
Settings specified for a series apply to all its points. If you need to customize an individual point, assign a function to the customizePoint property. This function must return an object with properties for the point that you want to customize.
- import React from 'react';
- import PieChart, {
- Series
- } from 'devextreme-react/pie-chart';
- // All series points with the value more than 100 turn red
- // Other series points remain blue
- const customizePoint = (pointInfo) => {
- return pointInfo.value > 100 ? { color: 'red' } : { };
- };
- const App = () => {
- return (
- <PieChart ...
- customizePoint={customizePoint}>
- <Series color="blue" />
- </PieChart>
- );
- };
- export default App;
Refer to other topics in this section for details on main series features.
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.