hunar_214
Posts: 34
Joined: Thu Nov 23, 2023 9:07 am

Re: Zooming and panning in highcharts

it meant the setExtremes function isnt even getting triggered, I tried putting a console log inside it as well but even that isnt getting printed on the console
jakub.j
Posts: 1086
Joined: Tue Jan 24, 2023 11:14 am

Re: Zooming and panning in highcharts

Hey!

If you are zooming, the setExtremes event has to be triggered on one of the axis, maybe you are trying to zoom on yAxis, than you need to set yAxis.events.setExtremes, see demo:

Demo: https://jsfiddle.net/BlackLabel/xk7defyw/

You should also check, if you haven't configured xAxis or yAxis in multiple places in your chart config, if you do, it will overwrite the previously configured axis.

Let me know if that helped!
Best regards
Jakub
Jakub
Highcharts Developer
hunar_214
Posts: 34
Joined: Thu Nov 23, 2023 9:07 am

Re: Zooming and panning in highcharts

it meant that the setExtremes function is not even getting triggered on zooming.I double checked by putting a console.log as well inside it.Still nothin is getting printed in console.
jakub.j
Posts: 1086
Joined: Tue Jan 24, 2023 11:14 am

Re: Zooming and panning in highcharts

I'm not sure how does your setExtremes method not get called, could you reproduce this problem an online editor that I could work on?

You can also try adding the message on chart.events.selection, see:
Demo: https://jsfiddle.net/BlackLabel/evjLrbt5/

I hope you find it useful!
Best regards
Jakub
Jakub
Highcharts Developer
hunar_214
Posts: 34
Joined: Thu Nov 23, 2023 9:07 am

Re: Zooming and panning in highcharts

isn't there a way in highcharts t pan across the zoomed in charts using the mouse itself? In plotly I'm able to do it using the mouse but in highcharts I'm unable to find an option to do so
jakub.j
Posts: 1086
Joined: Tue Jan 24, 2023 11:14 am

Re: Zooming and panning in highcharts

Hey!

Panning on a zoomed chart is possible when you set chart.panKey, now if you hold the shift key, you can pan instead of zooming using the mouse see demo:

Demo: https://jsfiddle.net/BlackLabel/rjkpw2gb/

Feel free to ask any further questions!
Kind regards
Jakub
Jakub
Highcharts Developer
hunar_214
Posts: 34
Joined: Thu Nov 23, 2023 9:07 am

Re: Zooming and panning in highcharts

No, i don't want to use any key for panning, instead i want to use mouse....is it possible?
jakub.j
Posts: 1086
Joined: Tue Jan 24, 2023 11:14 am

Re: Zooming and panning in highcharts

Hey!

I'm not sure how do you want to use mouse for both zooming and panning, unfortunately, it's not possible.

However, You might have meant mouseWheel zooming, than if you only configure only that, you can zoom using scroll and pan using mousemove, see:

Demo: https://jsfiddle.net/BlackLabel/pLegza1b/

If that's now what you mean, please describe it precisely how to you want the zooming & panning to work.

Best regards
Jakub
Jakub
Highcharts Developer
hunar_214
Posts: 34
Joined: Thu Nov 23, 2023 9:07 am

Re: Zooming and panning in highcharts

is it possible to zoom in by selecting an area in the chart and pan across using mousewheel?
jakub.j
Posts: 1086
Joined: Tue Jan 24, 2023 11:14 am

Re: Zooming and panning in highcharts

Hey!

Unfortunately, there is no possibility to pan using mouse wheel in Highcharts.
If you want our developers to add that functionality to the library, you can submit a feature request on our Github

GH: https://github.com/highcharts/highcharts/issues

Do not hesitate to contact us in the future
Best regards
Jakub
Jakub
Highcharts Developer

Return to “Highcharts Usage”