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 IN
to 50 years-> clicking - would
ZOOM OUT
to 250 yearsI can programatically zoom in using the
zoom
function, but I am struggling to find a correlation between thex
passed into thezoom
function and the finalzoomLevel
How exactly should the
x
value 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