chartjs-plugin-zoom
chartjs-plugin-zoom copied to clipboard
Zoom plugin will not work when using an object as data that sets labels automatically without setting labels beforehand.
See https://stackoverflow.com/questions/75382787/chart-js-zoom-instantly-zooms-in-fully-on-first-point-no-matter-what-type-of-zoo/75387958#75387958 for more information
@youriyep Thank you for posting a temporary workaround. I ran into the same issue and having been banging my head for 2 hours trying to get this to work.
This needs to be fixed.
I am not 100% sure but I think this is the same root cause why the zoom plugin does not work for us as well. We use data that looks like this:
labels=[]
datasets= [{
data: [{x:1, y:2}, {x:2, y:3}, {x:5, y:6}, {x:10, y:7}]
}
By looking at the plugin sources, I can see that is uses the labels array for some calculations regarding min/max on scales. I guess this is why it's not working.
For us, however, I think the work-around does not work as we have multiple datasets with gaps, so we cannot pre-populate the labels with our x values.
If someone has an idea, it would be greatly appreciated as i don't want build my own plugin. ^^