How can I force a zoom to a certain zoomLevel? #586
Unanswered
cintiapinto
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a bar graph in which the user zooms in and out using buttons (+/-) and I want each time they zoom to take them to the next "breakpoint".
For example, they're currently seeing a graph zoomed in to 100 years:
-> clicking + would
ZOOM INto 50 years-> clicking - would
ZOOM OUTto 250 yearsI can programatically zoom in using the
zoomfunction, but I am struggling to find a correlation between thexpassed into thezoomfunction and the finalzoomLevelHow exactly should the
xvalue be calculated?For the example I gave above, from trial and error, I worked out that:
->
chart.zoom({ x: 2 }, true, "zoom")zooms in to 50 years from 100->
chart.zoom({ x: -2 }, true, "zoom")zooms out to 250 years from 100Even though I found those numbers by chance, I still can't see how they correlate to the final value I want!
I would love some help on how to make a graph zoom in to a certain number of bars.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions