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

Annotation double click event

Thu Jun 29, 2023 3:43 pm

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: 870
Joined: Tue Jan 24, 2023 11:14 am

Re: Annotation double click event

Fri Jun 30, 2023 7:02 am

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: 281
Joined: Thu Oct 04, 2012 12:16 pm

Re: Annotation double click event

Wed Jul 05, 2023 2:04 pm

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: 870
Joined: Tue Jan 24, 2023 11:14 am

Re: Annotation double click event

Thu Jul 06, 2023 8:17 am

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: 281
Joined: Thu Oct 04, 2012 12:16 pm

Re: Annotation double click event

Fri Jul 07, 2023 6:38 pm

this is working as expected.. thanks again for help

Return to “Highcharts Stock”