jahnvi25
Posts: 286
Joined: Thu Oct 04, 2012 12:16 pm

zoom in and out only yAxis

so we are trying to implement some feature which is similar to tradingview with highchart..
basically you hold down the mouse and move up and down on yAxis to set the zoom in and out..

below is the example
https://jsfiddle.net/kr2mwfob/2/

but i am able to do this when i do over entire chart container..? but what we want is only on yAxis.. how can i write same events but only on yAxis ??
Note : above example also works with mouse wheel...

Thanks
jahnvi25
Posts: 286
Joined: Thu Oct 04, 2012 12:16 pm

Re: zoom in and out only yAxis

to give you more details.. i have requirement indicating.. if user moves mouse outside of chart container.. (only towards yAxis labels) do zoom in and out on yAxis based on mouse up/down movement.. above example works with charts.. like screenshot attached shows, Yaxis zoom should happen only in highlighted area...
highchart_question.png
highchart_question.png (75.72 KiB) Viewed 1186 times
pawelys
Site Moderator
Posts: 1019
Joined: Wed Sep 02, 2020 10:37 am

Re: zoom in and out only yAxis

Hey jahnvi25!
Let me just copy paste the answer from the other post on forum :D (viewtopic.php?p=194395#p194395)

As it stands, the standard Highcharts package doesn't include a functionality that lets you zoom in and out on the y-axis while panning around, akin to what you might witness on TradingView. That said, there is a possibility to create a custom solution from your end can make this possible.

You are welcome to review this demo which presents how such a feature could be realized: https://jsfiddle.net/BlackLabel/h3w81eoa/
Remember, this is a custom feature that falls to you to maintain, as including it as part of Highcharts' main library isn't on our current development roadmap.

Let me know, if you have any further questions!

We appreciate your understanding and are here to assist with any questions you may have.

Kind Regards,
Paweł Lysy
Highcharts Developer
pawelys
Site Moderator
Posts: 1019
Joined: Wed Sep 02, 2020 10:37 am

Re: zoom in and out only yAxis

PS: If you'd like to see this feature implemented in Highcharts, feel free to leave a like under a feature request: https://github.com/highcharts/highcharts/issues/21335
Paweł Lysy
Highcharts Developer

Return to “Highcharts Stock”