How to avoid plotting redundant tooltips when there are several glyphs on the same x value

Hi folks,

I created a candlestick chart and it works well. Basically I created a vbar glyph together with two segments on top and bottom.

Then I show the values on Hover, it also works well, including the datetime.

But the problem is that I use as “source” in all three glyphs the original dataframe because creating a ColumnDataSource is an extra step I don’t need.

What I don’t like is the fact that when I hover over a candlestick I get three repeated tooltips, in other words, three boxes with the same information. Obviously every box corresponds to a glyph but they are redundant.

I don’t know how to tell bokeh to just show one. I could create a CDS with different column names and use it as source for segments, using the dataframe as source for the vbar but that looks like unnecessary work and a dirty trick.

To be more specific, the values on the dataframe are “open”, “high”, “low”, “close”. I use the same values to compute the segments and the size of the body of the candlestick that is why the names are the same in all three glyphs. So when I tell tooltips (inside HoverTool) that it must show the “open”, that open has been used several times.

Any suggestions?

You can configure the HoverTool.renderers property to restrict which glyphs a hover tool applies to. There are several examples you can search for usage of this property under the examples directory.