One hover tool for multiple lines, but one box

Hi,

I create a hover tool like so:

hover = HoverTool(names=[‘a’,‘b’,‘c’])

hover.mode=‘vline’

hover.tooltips = [

(“date”, ‘@date’)

(“a”,"@a")

(“b”,"@b")

(“c”,"@c")

]

Now what I would like is to have one and only one box show up at a time. I can restrict names to contain only line ‘a’, but then if I hide line ‘a’ by clicking on the legend, none of the tooltips will show up. So I was thinking of some workarounds:

  1. a simple callback to manipulate the HoverTool.names attribute and ensure that it contains a line that is currently visible. To do this I think that I’d need to have a callback on the legend click event. How do I achieve this? legend.js_on_event(name,callback)? what would be name? and more generally where are all event names documented?

  2. perhaps a custom callback for the hovertool itself. Visually what I’d want from the callback is a horizontal line (span) depicting the current time and a box that shows up containing the data that I’d like displayed at that time. I’d then like this not to be attached to a specific line so that it’d always show up. Any quick advice would be appreciated on this topic.

Thanks,

Justin