New to KendoReactStart a free 30-day trial

Exploding Pie/Donut Chart Series On Click

Environment

Product Version9.0.0
ProductProgress® KendoReact Chart

Description

How can I make the Pie or Donut Chart series explode when clicking them?

Solution

To achieve click-to-expand functionality in a React pie chart you should:

  1. Handle the seriesClick event:
html
<Chart onSeriesClick="{onSeriesClick}"> </Chart>
  1. Within the event handler function, toggle the explodeField property and update the Chart data by reference to re-render the Chart.
jsx
const onSeriesClick = (event) => {
    const newData = data.map((item) => {
        item.exploded = item === event.dataItem ? !item.exploded : false;
        return item;
    });

    setData(newData);
};

The following example demonstrates the full implementation of the suggested approach.

Change Theme
Theme
Loading ...

See Also

In this article
EnvironmentDescriptionSolutionSee Also
Not finding the help you need?
Contact Support