Black Lives Matter. Please consider donating to Black Girls Code today.

Any way to add click events to annotaions themselves?

I’d like to apply a click event to my annotations, but can’t figure out how. Attached is an example to see why. Is this possible? I’ve tried to apply a click event to the “annotaiton” class, but I think the chart interactions take precedence.
I think it would be odd to have the user click on the little blue line, since its time based, and a full horizontal clickable area makes more sense in our case.

Here’s how: https://codepen.io/etpinard/pen/wrXEXQ?editors=0011

1 Like

Awesome! Thanks @etienne!
For others reading this, make sure “captureevents: true” for your annotation.

@etienne Is there a way to change the cursor, to show that it is clickable? I didn’t see any documentation for "plotly_hoverannotation’ or anything similar.

Disregard, you can do it with plain css. Sorry for the multiple posts…