Tap tool doesn't seem to work with area plots. Is there an alternative? Sample code below Bokeh Version: '2.0.2'
from bokeh.plotting import figure, output_file, show
from bokeh.models import TapTool, CustomJS, VArea
p = figure(plot_width=400, plot_height=400)
p.grid.minor_grid_line_color = '#eeeeee'
area = p.varea(x=[1, 2, 3, 4, 5],
y1=[2, 6, 4, 3, 5],
y2=[1, 4, 2, 2, 3],name="temp")
p.add_tools(TapTool(callback=CustomJS(code="console.log('taptool')")))
show(p)
# Nothing comes up
# It works with other glyphs for instance a circle
area = p.circle(x=20,y=20,size=15,)
p.add_tools(TapTool(callback=CustomJS(code="console.log('taptool')")))
show(p) # works as expected
Yes, there is an alternative. You can use polygons instead of the Varea. With polygons you have to use another syntax but you can create the same figures and the TapTool is working.
from bokeh.plotting import figure show, output_notebook
from bokeh.models import TapTool, CustomJS
output_notebook()
p = figure(plot_width=400, plot_height=400)
#p.grid.minor_grid_line_color = '#eeeeee'
p.multi_polygons(xs=[[ [ [1, 2, 3, 4, 5, 5, 4, 3, 2, 1] ]]],
ys=[[ [ [1, 4, 2, 2, 3, 5, 3, 4, 6, 2] ]]])
p.circle(x=20,y=20,size=15,)
p.add_tools(TapTool(callback=CustomJS(code="console.log('taptool')")))
show(p)
I also tried a solutions with patches and areas and I don't know why it is not working. Did you think about opening an issue on github?