Hi,
Is it possible to have rendered text objects selectable with the tap or box-selection tools?
In the sample below, rendered circles and quads can be selected but not the text objects.
import bokeh.plotting as BPlotting
import bokeh.models as BModels
def circle_CB(window=None):
selected_indices = cb_obj.selected[‘1d’].indices
console.log(“circle_CB: selected_indices”, selected_indices)
def text_CB(window=None):
selected_indices = cb_obj.selected[‘1d’].indices
console.log(“text_CB: selected_indices”, selected_indices)
def quad_CB(window=None):
selected_indices = cb_obj.selected[‘1d’].indices
console.log(“quad_CB: selected_indices”, selected_indices)
p = BPlotting.figure(tools=“tap,box_select”)
x = range(5)
y1 = x
source1 = BPlotting.ColumnDataSource( data=dict(x=x, y=y1) )
source1.callback = BModels.CustomJS.from_py_func(circle_CB)
p.circle(‘x’, ‘y’, source=source1)
y2 = [i+5 for i in x]
t2 = [str(i) for i in y2]
source2 = BPlotting.ColumnDataSource( data=dict(x=x, y=y2, text=t2) )
source2.callback = BModels.CustomJS.from_py_func(text_CB)
p.text(‘x’, ‘y’, source=source2, text=‘text’)
l = [1,2]
r = [2,3]
b = [3,4]
t = [4,5]
source3 = BPlotting.ColumnDataSource( data=dict(l=l, r=r, b=b, t=t) )
source3.callback = BModels.CustomJS.from_py_func(quad_CB)
p.quad(left=‘l’, right=‘r’, bottom=‘b’, top=‘t’, alpha=0.7, source=source3)
BPlotting.output_file(‘select_text.html’)
BPlotting.save(p)
``