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

custom annotation popup edit options

i am using following link to create my own popup for annotations
https://jsfiddle.net/BlackLabel/5ezk92sv/ (circle demo)

but i want to create one popup which will be shared with some annotations line line,arrow,parallel channels and fibonacci.. but there are certain controls which will only appear based on which annotation you have selected.. i am using showPopup event.. and looking at event Object i would think only lanKey is the only way to uniquely identity which annotation is selected ? or is there a better way to do this ?

Thanks
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: custom annotation popup edit options

Hello,

Thanks for contacting us with your question!

You can use event.annotation.basicType instead of event.options.langKey. This is a good way to identity selected annotation.

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: custom annotation popup edit options

Thanks for reply. but event.annotation.basicType does not exist.. and annotation.options.type is same for lines and arrows and rays.
see attached screenshot of annotation and event object.
sample1.png
sample1.png (176.66 KiB) Viewed 1176 times
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: custom annotation popup edit options

also on same note... one more question. after user closes the custom edit dialog. how can i un-select the selected indicator..

it works when i click anywhere on chart/plot area.. and it does unselect the annotation, but i want to do that when user presses the Save button and delete button as well

Thanks
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: custom annotation popup edit options

Hi,

The event.annotation.basicType exist to basicAnnotation types like circle or rectangle, for other you can use event.annotation.options.type (check console in the demo).

To un-select the selected indicator is a deselectAnnotation() method. For some reason it is not documented in the API but has already been requested to be added (also you can check this in demo in 27 line).

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

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
jahnvi25
Posts: 284
Joined: Thu Oct 04, 2012 12:16 pm

Re: custom annotation popup edit options

Thanks for reply... i just found about deselectAnnotation() after reading source code for stock-tools.src.. it would really help if all methods are documented.

and thanks again for basicType.. its working good..for now i can move forward with implementing functionality...
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: custom annotation popup edit options

You're welcome.

We try to update the API documentation on an ongoing basis to avoid situations like this.

Feel free to ask any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Stock”