☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Unpack HoverTool tooltips tuple

Community Supporthover
nick
nick

I have a multi-indexed data source, and I would like to get the index value for each part on hover.

def _create_hover_tools():
    hover = HoverTool(
            tooltips=[
                ('index','@y')
            ]
    )
    return hover

On hover, this returns something like this:
index: (index_a_value,really_long_b_value_that_should_have_own_line,index_c_value)

I would like to be able to index the values of y, and put them on their own line, similar to this idea that doesn’t work:

tooltips=[
    ('index_a','@y[0]'),
    ('index_b','@y[1]'),
    ('index_c','@y[2]'),
]

Thank you for your time.

⌁   Link to post
Bryan
Bryan

The built in hover tool formatter does not function in this way, it only show the full column value, as-is. You will have to use a CustomJSHover which will allow you to supply a snippet of JavaScript to pick out sub-parts and format them how you like.

There is also a full example in the repo:

⌁   Link to post

End of archived discussion · Replies are disabled