Skip to content

v3: Pie chart no longer supports Slices #6052

Description

@piotrczyszczon

Do you want to request a feature or report a bug?

Feature request (possibly a regression from v2)

What is the current behavior?

In Recharts v3, the activeIndex prop on is not available anymore while - together with activeShape - it was powerful and simple way to implement Pie Slices.

Previously, in Recharts v2, We could use activeIndex together with activeShape to highlight only selected Slices of a Pie (user could click and select multiple of them).

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

Simple demo where I'm displaying different pie slices with different styling. Imagine that user can click on a slice and we build the activeIndex array dynamically.
https://stackblitz.com/edit/react-lnlglkfj?file=src%2FExample.jsx

What is the expected behavior?

I would like to achieve something similar where we can print different slices of a Pie chart with different activeShape components based on user selection.

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

Recharts v3.x (broken)
Recharts v2.x (worked perfectly with activeIndex)
All browsers and OS

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement to a current APIfeature requestIssues that are feature requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions