Skip to content

[charts-pro] Auto-select range button matching current zoom#22137

Draft
JCQuintas wants to merge 5 commits intomui:masterfrom
JCQuintas:intial-range-button-selected
Draft

[charts-pro] Auto-select range button matching current zoom#22137
JCQuintas wants to merge 5 commits intomui:masterfrom
JCQuintas:intial-range-button-selected

Conversation

@JCQuintas
Copy link
Copy Markdown
Member

Summary

  • Range buttons in ChartsToolbarPro now mark themselves as selected whenever the current zoom matches their computed range, so initialZoom (or controlled zoomData) landing on a button's range highlights it on first render without user interaction.
  • Since selection is now derived purely from the live zoom range, the internal activeRangeButtonKey state, setActiveRangeButtonKey instance method, and selectorChartActiveRangeButtonKey selector have been removed. This also drops the manual resets previously needed on every pan/wheel/zoom.
  • Minor docs demo fix: added <span> wrappers around the zoom-in / zoom-out triggers in ChartsToolbarCustomToolbar so Tooltip no longer receives a disabled <button> as a direct child (was producing a console warning).
  • New docs demo ChartsToolbarRangeButtonsInitialSelection illustrates the behavior.

@JCQuintas JCQuintas self-assigned this Apr 21, 2026
@JCQuintas JCQuintas added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: charts Changes related to the charts. plan: Pro Impact at least one Pro user. labels Apr 21, 2026
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented Apr 21, 2026

Bundle size

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 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro ▼-66B(-0.01%) 🔺+18B(+0.01%)
@mui/x-charts-premium ▼-66B(-0.01%) 🔺+14B(+0.01%)
@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

Deploy preview


Check out the code infra dashboard for more information about this PR.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 21, 2026

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing JCQuintas:intial-range-button-selected (b463566) with master (3bac9bb)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (7ffafb3) during the generation of this report, so 3bac9bb was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant