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.

App.js
  • import React from 'react';
  • import PieChart from 'devextreme-react/pie-chart';
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <PieChart ...
  • type="doughnut"> {/* or "donut" */}
  • </PieChart>
  • );
  • }
  • }

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:

App.js
  • import React from 'react';
  • import PieChart, {
  • CommonSeriesSettings
  • Series
  • } from 'devextreme-react/pie-chart';
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <PieChart ... >
  • <CommonSeriesSettings argumentField="year" />
  • <Series valueField="men" />
  • <Series valueField="women" />
  • </PieChart>
  • );
  • }
  • }

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.

App.js
  • import React from 'react';
  • import PieChart, {
  • Series
  • } from 'devextreme-react/pie-chart';
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <PieChart ...
  • customizePoint={customizePoint}>
  • <Series color="blue" />
  • </PieChart>
  • );
  • }
  • }
  •  
  • // All series points with the value more than 100 turn red
  • // Other series points remain blue
  • function customizePoint(pointInfo) {
  • return pointInfo.value > 100 ? { color: 'red' } : { };
  • }

Refer to other topics in this section for details on main series features.

See Also