I would like to restart a discussion about the possibility of making a sticky hover tool in Bokeh. After researching and reading through previous discussions in the forums, it seems that the implementation of the InfoPane object would have addressed this need (https://github.com/bokeh/bokeh/pull/10231), but unfortunately, it was never completed.
When multiple data points overlap and we use the tap tool to open a new window, only the window of the top data point opens. The rest of the data points are inaccessible. With a sticky hover tool, the user can click on a stack of data points, and the tooltip will remain visible. This enables the user to select which data point’s window to open.
I would appreciate any insights or suggestions on implementing a sticky hover tool in Bokeh.
Thanks!
The underlying technical work for a persistent tooltip has already been done, in this PR:
Which was added for 3.0 awhile back.
These Tooltip objects can be attached to just about anything, but the specific use-case of adding them to plots is not yet very well demonstrated. Additionally there are probably some conveniences that are missing to make this specific use-case simpler. [1] The motivation at the time was for adding them to widgets, etc, so that is where the examples and docs were focused. Improving things for this use-case and adding examples/docs to support it would be a welcome contribution. I’d encourage starting a GitHub development discussion about this, so it’s easier to loop in relevant core devs.
Right now I think you’d have to manually compute a data-screen coordinate transform in a tap tool callback (or whatever) in order to add the tooltip relative to a data coordinate, and if your plot can be pan/zoomed, you’d probably need to manually update that screen position in a range callback. ↩︎