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

easy way of tying minallowed/maxallowed to the computed range #6779

Closed
archmoj opened this issue Nov 8, 2023 · 7 comments
Closed

easy way of tying minallowed/maxallowed to the computed range #6779

archmoj opened this issue Nov 8, 2023 · 7 comments

Comments

@archmoj
Copy link
Contributor

archmoj commented Nov 8, 2023

Out of curiosity: is there an easy way of tying minallowed/maxallowed to the computed range? Basically to let Plotly.js compute the autorange and set min/max allowed to that automatically, thereby implementing "zoom in but not out" without having to separately compute ranges outside of Plotly.js?

Originally posted by @nicolaskruchten in #887 (comment)

@archmoj archmoj changed the title easy way of tying minallowed/maxallowed to the computed range? Basically to let Plotly.js compute the autorange and set min/max allowed to that automatically, thereby implementing "zoom in but not out" without having to separately compute ranges outside of Plotly.js easy way of tying minallowed/maxallowed to the computed range Nov 8, 2023
@sirpeas
Copy link

sirpeas commented Jan 4, 2024

What is the status of this one? I am able to limit zoom/pan only by minallowed, maxallowed is not working.

@alexcjohnson
Copy link
Collaborator

“maxallowed is not working” would be a separate bug, are you able to reproduce this in a codepen? Thanks!

@sirpeas
Copy link

sirpeas commented Jan 4, 2024

@alexcjohnson actually it's not working in the official example
https://plotly.com/python/axes/#setting-a-maximum-and-minimum-allowed-axis-value, change mode to pan and move to the right. I will try to create codepen later

@alexcjohnson
Copy link
Collaborator

@sirpeas that example looks to me like it's behaving correctly: there's only a minallowed on the x axis (so you can pan as far to the right as you want, but you're limited on the left) and only a maxallowed on the y axis (so you can pan as far down as you want but not up).

@sirpeas
Copy link

sirpeas commented Jan 4, 2024

Ok I figured it out https://codesandbox.io/p/sandbox/plotly-forked-d7my6

For others who will have the same issue, for category charts maxallowed and mixallowed are related to index from the feed array.

@gvwilson
Copy link
Contributor

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

@louise-davies
Copy link

This would be a really useful feature to enforce a "you can't zoom/pan outside of the plot range" feature. Currently, to implement this, we have to manually calculate minallowed/maxallowed to be the min/max value across all traces for an axis, whereas having a string option like "auto" would be useful to restrict the minallowed/maxallowed to the values used by autorange.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants