Custom HoverTool - show only non-hidden and non-muted data

I have a line chart with multiple trends in it.
Each trend has corresponding point too.

I am aiming to get a hover tool like this:

I have achieved it using this code:

def add_tags_hover_tool(fig: figure, tags: List):
    tags_data = []
    for var in tags:
        if should_not_show(var):
            continue
        tags_data.append((var, '@{' + var + "}{0,0.000}"))
    hover = HoverTool(tooltips=[('date', '@timestamp{%Y-%m-%d %H:%M}')] + tags_data,
                      formatters={'@timestamp': 'datetime'},
                      mode='mouse')
    fig.add_tools(hover)

I want the hovertool to show non-hidden glyphs;

@Itamar

The HoverTool accepts a renderers argument, which is a list of the glyph renderers that you want to have hover-tool support.

When you create lines, scatters, or whatever, assign the output to a variable to access its glyph renderer, e.g.

r = p.line( ... )

You can then add logic to your function that builds up the tools to consistently specify which renderers you want to have hover support.

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