Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inactiveShape prop to Pie component #2900

Merged
merged 3 commits into from Sep 1, 2022
Merged

Conversation

rockcs1992
Copy link
Contributor

@rockcs1992 rockcs1992 commented Jul 12, 2022

Hi,

Our team has the need to change the appearance of a piechart when one of the sectors is hovered/selected. For the hovered sectors we could achieve that with the existing api activeShape. However (correct me if I'm wrong) the existing api doesn't provide the ability to customize the look of other sectors. Thus I'm proposing to add an API for that.

I'm calling the new API inactiveShape, similar to activeShape. The API, if provided, allows the users to customize how inactive sectors look like, when a valid activeIndex prop is provided.

Please let me know how you think of this. Also raised a PR to update the docs.
recharts/recharts.org#196
I'll also update the demo and add a codesandbox link once ethis PR is merged.

Thanks

@@ -87,6 +87,7 @@ interface PieProps extends PieDef {
data?: any[];
sectors?: PieSectorDataItem[];
activeShape?: PieActiveShape;
inactiveShape?: PieActiveShape;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitty: Should we consider renaming the interface PieActiveShape to PieShape? Disregard if this would cause a breaking change though.

@cscrosati
Copy link

@arcthur and @xile611 , this PR proposal is a contribution that isn't accessibility driven directly, but allows to developer to interact and redraw the non active shapes of a pie, such that their accessibility characteristics are improved in relation to the active one.

Let us know if you have concerns with the naming of the API, or any other topics.

@cscrosati
Copy link

Note: this PR provides is supporting #2801

@rockcs1992
Copy link
Contributor Author

@arcthur @xile611 Please let us know if you have any opinions/ideas/concerns about this PR. Thanks

@arcthur arcthur merged commit deee55f into recharts:master Sep 1, 2022
arcthur added a commit that referenced this pull request Sep 6, 2022
* 'master' of https://github.com/recharts/recharts:
  Add inactiveShape prop to Pie component (#2900)
  Revert "chore: move type deps into devDependencies (#2843)" (#2942)
  Fix typing of default tooltip formatter (#2924)
  done (#2936)
  Take letter-spacing and font-size into consideration while rendering ticks (#2898)
  Add formatter function type to tooltip props (#2916)
  doc: Update CHANGELOG.md about d3 7.x (#2919)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants