Skip to content

Disabling default hover and click effects on Pie Chart

When you hover over a slice on a Pie Chart it slightly grows. When you click it, it pulls out a bit out of place. This tutorial will show how you can disable this default behavior.

It is controlled by states. When you hover something, a “hover” state is applied to the element. When you click a togglable element, “active” state is applied to it.

When PieSeries is creating its slices, it automatically creates both “hover” and “active” states, that are responsible for the two default effects.

The “hover” state modifies slice’s scale property, which makes it grow when hovered.

The “active” state modifies slice’s shiftRadius property, that makes the slice pull out when clicked.

To disable this behavior, all we need to do is to modify the properties of the respective states.

We do that by modifying states on the series’ slice template:

let slice = pieSeries.slices.template;slice.states.getKey("hover").properties.scale = 1;slice.states.getKey("active").properties.shiftRadius = 0;

The following live chart has both hover and pullout effects disabled.

Open in CodePen