Hi,
I’m trying to use a CustomJS callback with a TapTool to get the selected indices on a circle plot but it’s not working. Minimum example code below:
from bokeh.models.tools import TapTool
from bokeh.models.callbacks import CustomJS
from bokeh.plotting import Figure, show
cjs = """
console.log('Tap');
console.log(cb_obj.selected.indices);
"""
cb = CustomJS(code=cjs)
ttool = TapTool(callback=cb)
fig = Figure(x_range=[0, 1], y_range=[0, 1])
fig.tools.append(ttool)
fig.circle([0.25, 0.75], [0.25, 0.75], size=20)
show(fig)
When running this and tapping on either circle the following appears in the Browser console:
Tap
TypeError: cb_obj.selected is undefined
I must be getting something simple wrong but can’t work out what it is, any advice welcome!
Thanks,
Marcus.