[charts-pro][ChartsToolbarRangeButtons] Add initialRangeKey support#22106
[charts-pro][ChartsToolbarRangeButtons] Add initialRangeKey support#22106mustafajw07 wants to merge 5 commits intomui:masterfrom
Conversation
Bundle size
Deploy previewhttps://deploy-preview-22106--material-ui-x.netlify.app/ Check out the code infra dashboard for more information about this PR. |
| optionsLookup, | ||
| ), | ||
| activeRangeButtonKey: null, | ||
| activeRangeButtonKey: initialRangeKey ?? null, |
There was a problem hiding this comment.
The initial range key should also impact the initial zoomData. For example if initialRangeKey is set to 3 months the initial zoom should correspond to 3 months.
By order of priority the zoom shoudl be se by
- controlled zoom
- initial zoom
- initial range button
- default value
|
@mustafajw07 thank you for this pull request! It looks like your changes impact the commercially licensed code. For any changes of this nature, we require contributors to sign the MUI’s Contributor License Agreement (CLA). |
I have signed the CLA. |
…zoom functionality
…RangeKey description for zoom functionality
|
@mustafajw07 can you please complete the last step? Thanks. |
Done |
|
@alexfauquette, CLA signed, thanks. |
|
@alexfauquette I don't like that this is a two way setter. Like, the Ideally we should have a single way of setting everything. IMO we should try to calculate the selected buttons based on the current resolved zoom instead of trying to have a "priority order over multiple options" Eg: We calculate if each button is selected by using the This way we can even get rid of |
I suggested the second way, not the first one. You want the initial zoom top be on the last 3 months. would you prefer to
IMO it's just a syntax sugar for the
I agree it would be more flexible, but we will need to deal with the notion of precision |
Wouldn't it be better to change |
|
An option would be something like this: #22137 It would hardly ever match when users manually zoom though |
That could be a nice option 👍 |
Thanks for the feedback, this makes sense. I see the concern about introducing multiple ways to control the same behavior and the current two-way relationship between initialZoom and initialRangeKey. Based on the discussion, should i refactor the approach to make Zoom the single source of truth:
Would like to know your thoughts @JCQuintas @alexfauquette? |
I think we can go into that direction. It would probably be better to divide it into multiple PRs though.
|
That direction sounds good. Do you want this to be split into separate tickets first, or should I directly break it down into multiple PRs? |
|
Here is the new issue for changing the |


Changelog
[charts-pro] Add
initialRangeKeyprop to range buttons to reflect the initial zoom selection in the toolbar.I have followed (at least) the PR section of the contributing guide.