DoumiLo
Posts: 35
Joined: Wed Jan 20, 2021 2:09 pm

Detect when visitor is using zoom handles

Hi,

I need to detect when a visitor is using the zoom handles to set a dropdown outside of highcharts to a default option. The default option should appear as soon as the user moves one of the handles.

I tried with the afterSetExtremes event but it also detects when the user is clicking a rangeSelector button or using the date field...

Code: Select all

xAxis: {
 events: {
   afterSetExtremes: function(){
     // detect only use of handles?
   }
 },
 }

How can I detect only when the user is pressing on one of the handles? Something like "onMouseUp"?

Thank you in advance for your help!
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Detect when visitor is using zoom handles

Hi DoumiLo,
Thanks for your message,
In my opinion, it's only possible from editing the core code responsible for dragging handles.

If you need help with finding I can provide you where there is.

Let me know what do you think about this.
Best regards.
Sebastian Hajdus
Highcharts Developer
DoumiLo
Posts: 35
Joined: Wed Jan 20, 2021 2:09 pm

Re: Detect when visitor is using zoom handles

Hello Sebastian, thanks for your response!

I would prefer not to change the core code , I'm not sure if we won't change version in th near future...

But I have found this simple solution using jQuery:

Code: Select all

jQuery( '.highcharts-navigator, .highcharts-input-group' )
          .click(function() {
            deselectVague(selectID);
        });
It's not perfect beacause it will detect the clicks on the navigator (not the drag) but it's an okay compromise...
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Detect when visitor is using zoom handles

Hi,
Good for you, I understand.

if you would like to use a wrapper with code from core then let me know I will help you.
Modifying core gives you more options and it should not change much in the future to stop working.

Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Stock”