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

Annotation double click event

is there such a thing ? we have requirement that when user double click on a particular* annotation we have to delete that..

how can i add double click on annotation.. ?
jakub.j
Posts: 1080
Joined: Tue Jan 24, 2023 11:14 am

Re: Annotation double click event

We appreciate you reaching out to us!

You can use js dblclick event on the annotation finding it by previously added className. Simply remove the annotation using chart.removeAnnotation with the annotation id as a parameter, see demo:

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

Feel free to ask any further questions!
Best regards
Jakub
Jakub
Highcharts Developer
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: Annotation double click event

Thanks for reply, is there a way we can use 'Delete' Key on selected annotation to delete it ? this is because we are using stock tools. and when user clicks for the first time it selects the annotation.. double click would select once also.. so thinking of keyboard shortcut might be better..
jakub.j
Posts: 1080
Joined: Tue Jan 24, 2023 11:14 am

Re: Annotation double click event

Hey, sure thing!

I prepared a logic for you, where I remove the active annotation using chart.removeAnnotation when delete key (keyCode: 46) is pressed,

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

Let me know if that was what you were looking for!
Best regards
Jakub
Jakub
Highcharts Developer
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: Annotation double click event

this is working as expected.. thanks again for help

Return to “Highcharts Stock”