[charts] Support array on highlightedItem prop for dataIndex #15903
Labels
component: charts
This is the name of the generic UI component, not the React module!
new feature
New feature or request
Summary
The current chart components from MUI does not allow users to highlight multiple slices at the same time. This is an issue when visualizing data with multiple similar items (e.g., clusters or categories) where more than one slice needs to be highlighted simultaneously.
highlightedItem
prop should accept an array ofdataIndex
.The current documentation (https://mui.com/x/api/charts/pie-chart/) shows:
highlightedItem -> { dataIndex?: number, seriesId?: number | string }
I propose:
highlightedItem -> { dataIndex?: [number], seriesId?: number | string }
Examples
Motivation
Consider a scenario where we are displaying a pie chart that visualizes products, and some products share similar attributes. For example:
If we want to highlight all the products that are "Electronics," ideally, the slices for Product A and Product B should both be highlighted at the same time. However, the current implementation only supports highlighting a single slice, so it's not possible to highlight multiple slices that share the same attribute.
It would be more suitable for use cases where slices share similar attributes and need to be highlighted together. It's common in data visualizations to have groups of slices that represent similar traits.
Search keywords: highlightedItem charts
The text was updated successfully, but these errors were encountered: