Replies: 1 comment 4 replies
-
You can just look up the original values in your source data, if the min/max values are out of the range that is shown the chart is panned/zoomed. Only works if you dont hardcap the scale limits |
Beta Was this translation helpful? Give feedback.
4 replies
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 some charts where I want it to be possible to zoom and pan, and have a button available for resetting that zoom. Specifically, I want that button to only be visible if the chart is currently zoomed or panned — i.e. only if a reset is possible.
I can use
chart.getZoomLevel()
for zoom, but I have not found a good way to determine if the pan has changed. I have found thechart.scales[...].start
andchart.scales[...].end
attributes, which always show the current pan, but I don't know where to find the initial pan values.Do you have any suggestions for how I could determine if the chart is currently zoomed or panned inside the
onZoom
/onPan
callbacks? Thanks!Beta Was this translation helpful? Give feedback.
All reactions