-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[charts] Add initial Zoom&Pan
to the Pro charts
#13405
Conversation
Deploy preview: https://deploy-preview-13405--material-ui-x.netlify.app/ Updated pages: |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats, the strategy looks good 👍
packages/x-charts/src/context/CartesianProvider/CartesianProvider.tsx
Outdated
Show resolved
Hide resolved
packages/x-charts/src/context/CartesianProvider/CartesianProviderPro.tsx
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Zoom&Pan
to the Pro charts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I added some fixes for the components that overflow. I left a few comments about topics I considered when reading it to open discussions
zoomRange: [0, 100], | ||
setZoomRange: () => {}, | ||
isInteracting: false, | ||
setIsInteracting: () => {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it will be easily extendable to a model that could support a zoomRange
per axis (x/y) and axis id (having different ranges if we have 2 y axes for example)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope :)
I was going for making sure the functionality works first, then I could shape the API, but I thought we agreed on improving that on a future PR. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making sure the functionality works first, then I could shape the API
Yes for the coding part, but it would be great to have at least an idea about how you would like to do it. Just to be sure we have a path to it and don't end up with something that can only support one zoom in one direction
packages/x-charts/src/context/CartesianProvider/computeValue.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Jose C Quintas Jr <[email protected]> Co-authored-by: alexandre <[email protected]> Co-authored-by: Alexandre Fauquette <[email protected]> Co-authored-by: Flavien DELANGLE <[email protected]>
Signed-off-by: Jose C Quintas Jr <[email protected]> Co-authored-by: alexandre <[email protected]> Co-authored-by: Alexandre Fauquette <[email protected]> Co-authored-by: Flavien DELANGLE <[email protected]>
Concept
Zoom controller
Have a
ZoomProvider
withzoomRange:[number, number]:[0,100]
where we can change the range to show in percent. Eg:zoomRange:[10,90]
should show the range between 10% and 90%. A ~20% zoom (90-10=80).This is then used to calculate the zoomed in range, which should work for all types of scales we currently support. (Thanks @alexfauquette for the math crunching and suggestion to apply changes on range)
Done
Future MR
Reviewing
You can check it working on the zoom and pan page:
https://deploy-preview-13405--material-ui-x.netlify.app/x/react-charts/zoom-and-pan/