Skip to content

[charts] Refactor legend getters to use utility functions#21628

Draft
sai6855 wants to merge 13 commits intomui:masterfrom
sai6855:de-duplicate-legend-getter
Draft

[charts] Refactor legend getters to use utility functions#21628
sai6855 wants to merge 13 commits intomui:masterfrom
sai6855:de-duplicate-legend-getter

Conversation

@sai6855
Copy link
Member

@sai6855 sai6855 commented Mar 5, 2026

This PR refactors legend item generation by extracting the shared logic into a new getSeriesLegendItems utility in legendUtils.ts.

BarChart, RangeBar, RadarChart, and ScatterChart now use this utility instead of duplicating the same logic, making the code cleaner and easier to maintain.

The new legendUtils module is also exported through the internal index for use across the codebase.

@sai6855 sai6855 added performance plan: Pro Impact at least one Pro user. plan: Premium Impact at least one Premium user. scope: charts Changes related to the charts. labels Mar 5, 2026
@mui-bot
Copy link

mui-bot commented Mar 5, 2026

Deploy preview: https://deploy-preview-21628--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts ▼-345B(-0.09%) ▼-7B(-0.01%)
@mui/x-charts-pro ▼-345B(-0.07%) ▼-25B(-0.02%)
@mui/x-charts-premium ▼-534B(-0.11%) ▼-27B(-0.02%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 8db789a

@sai6855 sai6855 added the type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. label Mar 5, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 5, 2026

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing sai6855:de-duplicate-legend-getter (8db789a) with master (209c3f4)

Open in CodSpeed

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance plan: Premium Impact at least one Premium user. plan: Pro Impact at least one Pro user. scope: charts Changes related to the charts. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants