Brad_Kim
Posts: 3
Joined: Tue Apr 13, 2021 5:29 am

How to zoom between two of ticks cliecked

Hi,
I want to zoom between between two of clicked ticks . but i couldn't find to answer. pls help me .
thx a lot
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: How to zoom between two of ticks cliecked

Hello Brad_Kim!

Welcome to our forum and thanks for contacting us with your question!

To zoom between two ticks you can set chart.zoomType to x/y/xy and then mark the area you would like to zoom. You can also do this programmatically by using axis.setExtremes method which will zoom to the area with your selected min and max values.

API references:
https://api.highcharts.com/highcharts/chart.zoomType
https://api.highcharts.com/class-refere ... etExtremes

Best regards!
Dominik Chudy
Highcharts Developer
Brad_Kim
Posts: 3
Joined: Tue Apr 13, 2021 5:29 am

Re: How to zoom between two of ticks cliecked

thanks for your help. unfortunately i still don't know how to make click event. i mean , i wanna to make zoom from first clicked tick to second clicked tick not dragging . pls help me thx.
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: How to zoom between two of ticks cliecked

Hi again!

There are no API options that could do that, but we can create our own simple solution to your issue. We can count how many times we've clicked the chart and with each click save the coordinates we've clicked. When there will be two values saved we can use setExtremes method to zoom to this area. I hope that this solution will meet your expectations. :)

API references:
https://api.highcharts.com/highcharts/c ... ents.click
https://api.highcharts.com/class-refere ... is#toValue

Demo:
https://jsfiddle.net/BlackLabel/18uj3pbf/

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”