Trigger javascript callback when clicking on HTMLLabel in figure

Hi,

I have added a models.HTMLLabel to my plot instance and I want to trigger a javascript callback whenever the user clicks on the label. The label position is (and must be) defined in screen coordinates. How can this be implemented?

What I tried to so far is register an events.Tap via plot.js_on_event(…) and then infer whether the cursor was over the label. Unfortunately, this is tricky, because for this I’d need to know the position of the axis area within the overall plot frame and this information seems not accessible via javascript. However, I suspect that there is an easier solution anyway.

Any help is much appreciated. I can provide a minimal example if desired, but perhaps the question is so simple that it is not necessary. I’m using the standalone variant, i.e. no Bokeh server.
Matthias

Labels do not currently support any hit-testing events, I’d suggest opening a GitHub Issue to request this feature. It’s possible someone will also be able to think of a workaround there as well. Please do provide a complete minimal code that you demonstrates what you would like to work. That helps focus discussion and avoid ambiguities.

Thanks a lot @Bryan. I followed your suggestion and submitted a feature request.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.