Hello all looking for a little guidance on how to get the taptool to make a selection on a datatable. Below is the minimum code necessary to re-create the “problem”. As a disclaimer, I am an amateur scripter at best so it is very likely I am making a mistake.
When I execute the following code, selecting a row on the DataTable will select the corresponding glyph on the plot, is there a way to get the inverse of this behavior, i.e. when I select a glyph on the plot it bring where that point on the datatable into view and highlight it?
Any guidance someone can provide would be much appreciated.
from bokeh.plotting import figure, curdoc, ColumnDataSource
from bokeh.models import HoverTool, ResetTool, TapTool
from bokeh.models.widgets import DataTable, TableColumn
from bokeh.layouts import gridplot
data = {‘a’: [1,2,3,4,5,6,7,8,9,10], ‘b’: [11,12,13,14,15,16,17,18,19,20]}
source = ColumnDataSource(data)
tools=[HoverTool(), TapTool(), ResetTool()]
p1 = figure(plot_width=400,
plot_height=400,
title=‘Example’,
x_axis_label=‘Example X’,
y_axis_label=‘Example Y’,
tools=tools)
#y_axis_type=‘log’)
p1.circle_cross(x=‘a’,
y=‘b’,
source=source)
columns = [TableColumn(field=‘a’, title=‘A’),
TableColumn(field=‘b’, title=‘B’)]
t1 = DataTable(columns=columns,
editable=False,
height=400,
width=400,
fit_columns=True,
source=source)
layout = gridplot([[p1],[t1]])
curdoc().add_root(layout)
``
Thanks,
Chase