Dynamically change annotation's position

Hello,

So… this is the (simplified) code I’m working on: https://codepen.io/anon/pen/eRKjjY
Currently you can place annotation in specified position (by mouse click). To use it click the point you’d like to annotate and then click on a spot where annotation should show up (somewhere on graph area).
Now… I’d like to relocate the annotation using drag and drop feature. I cannot figure out how to access the annotation element and/or detect user clicked it (and wants to change it’s position). Is it possible? If it’s not - are there any workarounds to get it done?

Regards,
MP

Try setting the editable config option to true as in Configuration options in JavaScript

@etienne, cool! I was digging documentation for some time and could’t find the solution. I must share a secret here - I find it hard to read through Plotly’s docs because they are heavy, complicated and hard to follow. Thank you for your help!

Secondly, is there any way to make annotation “editable” but to keep other graph elements ‘read-only’?

Regards,
MP

Not at the moment, but we’re planning on adding that feature soon - maybe in the next release. Stay tuned.

2 Likes

Hi @etienne, is there any updates on this?

What I want to do is click a point and the annotation shows up. Then the annotation can be dragged to anywhere. If click the annotation again, the annotation can be removed. It seems that the plotly_clickannotation cannot be triggered if the editable is true.