GuillaumeA GuillaumeA - 1 month ago 24
Python Question

Hovertool callback source selection for multi-plot graph

I currently use bokeh version 0.12.2. I am plotting a graph with two series of circles.

graph1 = figure(plot_width=800, plot_height=800)
graph1.circle('fpr1', 'tpr1', color='red', source=source)
graph1.circle('fpr2', 'tpr2', color='blue', source=source)


Now, I would like to add a HoverTool which is done with :

code = "source.set('selected', cb_data['index']);"
callback = CustomJS(args={'source': source}, code=code)
hover1 = HoverTool(
tooltips=[
....
],
callback=callback,
)
graph1.add_tools(hover1)


The behavior of this code is that when I put mouse cursor hover a red circle, the callback is called and the tooltip is displayed. However, when I hover a blue circle, the tooltip is displayed but the callback is not called. How to fix that ?

Answer

I'm afraid this is a known bug. There is a "WIP" PR to fix it but it will not go in this weeks 0.12.3 release. It should be in 0.12.4, though.

Comments