Skip to content
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] Axis min/max does not allow dynamic rescaling of the other Axis when that axis has no min/max set #12083

Closed
synman opened this issue Feb 15, 2024 · 6 comments · Fixed by #14121
Assignees
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature plan: Pro Impact at least one Pro user

Comments

@synman
Copy link

synman commented Feb 15, 2024

Steps to reproduce

Link to live example: https://next.mui.com/x/react-charts/axis/#axis-sub-domain

Use the min/max example and move the slider in either direction

Current behavior

Using the MUI X scatterplot example you can see that the Y axis scaling does not dynamically change when the visible sample of X axis data is changed by using the xAxis min/max attributes.

Expected behavior

If no min/max values are set for an axis, it should scale that axis to the min/max values available within the visible dataset.

Context

Using the following chart as an example:
Screenshot 2024-02-15 at 4 49 31 PM

When you change the X axis min value value (decreasing the timeslice) to display specific just the more recent data, I'd like the chart to dynamically define the Y axis scale for the visible data rather than relying on the scale established for the entire dataset. This is what happens today:
Screenshot 2024-02-15 at 4 55 15 PM

Your environment

npx @mui/envinfo System: OS: macOS 14.2.1 Binaries: Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm pnpm: 8.15.3 - ~/.nvm/versions/node/v20.11.0/bin/pnpm Browsers: Chrome: 121.0.6167.160 Edge: Not Found Safari: 17.2.1 npmPackages: @emotion/react: latest => 11.11.3 @emotion/styled: latest => 11.11.0 @mui/base: 5.0.0-beta.36 @mui/core-downloads-tracker: 5.15.10 @mui/icons-material: ^5.15.9 => 5.15.10 @mui/lab: ^5.0.0-alpha.165 => 5.0.0-alpha.165 @mui/material: ^5.15.9 => 5.15.10 @mui/private-theming: 5.15.9 @mui/styled-engine: 5.15.9 @mui/system: ^5.15.9 => 5.15.9 @mui/types: 7.2.13 @mui/utils: 5.15.9 @mui/x-charts: next => 7.0.0-beta.2 @mui/x-tree-view: latest => 6.17.0 @types/react: 18.2.48 react: latest => 18.2.0 react-dom: latest => 18.2.0 typescript: latest => 4.9.5

I'm using Chrome: 121.0.6167.160

Search keywords: min max chart

@synman synman added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 15, 2024
@synman
Copy link
Author

synman commented Feb 15, 2024

perhaps this short video will help.... The series data points are floats (0.1 scale)

Screen.Recording.2024-02-15.at.5.03.28.PM.mov

So I can handle this myself if necessary by removing the older datapoints from the dataset I provide the chart, but this shifts a bit of heavy lifting to the consumer for what should be a pretty cool built-in feature.

@oliviertassinari oliviertassinari added the component: charts This is the name of the generic UI component, not the React module! label Feb 15, 2024
@oliviertassinari oliviertassinari changed the title [Charts] Axis min/max does not allow dynamic rescaling of the other Axis when that axis has no min/max set [charts] Axis min/max does not allow dynamic rescaling of the other Axis when that axis has no min/max set Feb 15, 2024
@synman
Copy link
Author

synman commented Feb 16, 2024

one last example before I turn it over to y'all to classify / prioritize / dismiss / etc. This is the expected behavior:

Screen.Recording.2024-02-16.at.2.06.00.PM.mov

Here's that heavy lifting I was referring to:

  • Build logic in backend service to limit sample size based on time offset
  • Account for latency / lag introduced due to network time, processing, and rebinding
  • Introduce a progress indeterminate or similar to block UI action while waiting (TO DO)

I suppose I could also build a client side loop into the dataset, taking account of the time offset (zoom level) and setting the yAxis min/max based on the min/max observed samples within that zoom level. This will definitely speed things up and in hindsight should've been the path I took to work-around this.

@alexfauquette alexfauquette added the enhancement This is not a bug, nor a new feature label Feb 18, 2024
@alexfauquette
Copy link
Member

Thanks for the feedback

Effectively, the min/max are for now a just a basic way to override the displayed range of element, and the easiest solution might be to compute y min/max client side according to the data and the x range.

This feature might be supported when adding the "Zoom on mouse" in the pro package

@alexfauquette alexfauquette added the plan: Pro Impact at least one Pro user label Feb 18, 2024
@michelengelen
Copy link
Member

@alexfauquette should we just move this to the board then? 🤷🏼

@alexfauquette alexfauquette removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 19, 2024
@nihauc12
Copy link

would love to see the "zoom on mouse" feature, would allow me to switch from the currennt lib i use to muix one.

Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@synman: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants