Selective HoverTips

Is it possible to:

  1. Disable the HoverToolTip for certain glyphs? For example, hovering above a ‘line’ will not trigger any tool-tips, but hovering above a ‘circle’ should trigger the tool-tip.

  2. Having different layout and labels in a tool-tip box, based on what we are hovering on? For example, for a hover event above a line, we get a tool-tip displaying ‘foo: 1234’ but on a hover above a circle we get a ‘bar: ABCD’

I suspect this is possible with a CustomJS hover tool, but wasn’t exactly sure about the js syntax that needs to go in there. Probably some if-else logic based on the glyph property passed through the args?

There is a good example about that, where the hover event triggers some lines, but not sure how to access the structure of the hover-tool-tip table.

Having renderer variables, helps me with the assignment of different tool-tips and hovers to different glyphs. From one of the examples:

cty = p.circle(x="index", y="cty", fill_color="#396285", size=8, alpha=0.5, source=source)
hwy = p.circle(x="index", y="hwy", fill_color="#CE603D", size=8, alpha=0.5, source=source)

tooltips = [
    ("Manufacturer", "@manufacturer"),
    ("Model", "@model"),
    ("Displacement", "@displ"),
    ("Year", "@year"),
    ("Cylinders", "@cyl"),
    ("Transmission", "@trans"),
    ("Drive", "@drv"),
    ("Class", "@class"),
]
cty_hover_tool = HoverTool(renderers=[cty], tooltips=[*tooltips, ("City MPG", "@cty")])
hwy_hover_tool = HoverTool(renderers=[hwy], tooltips=[*tooltips, ("Highway MPG", "@hwy")])