This is a pretty simple thing to do I imagine, but I'm not sure how to do it. I have a data table with three columns. Two are numerical values that are plotted, and one is strings. I want the user to be able to input into a field, and the corresponding row in the DataTable and the point on the plot to be selected/highlighted.
I think I need to use source.selected.indices, or possibly a CustomJS callback.
Can anyone help?
from random import randint from bokeh.io import output_file, show from bokeh.layouts import gridplot, row from bokeh.models import ColumnDataSource from bokeh.models.widgets import DataTable, TableColumn, TextInput search_words = TextInput(title="Search for country") data = dict( x=[randint(0, 100) for i in range(10)], y=[randint(0, 100) for i in range(10)], countries = ["France","Spain","Germany","Italy","Portugal","Poland","Russia","Bulgaria","Sweden","Belgium"] ) source = ColumnDataSource(data) columns = [ TableColumn(field="x", title="x"), TableColumn(field="y", title="y"), TableColumn(field="countries", title="Countries"), ] TOOLS = "pan,wheel_zoom,box_select,reset" fig = figure(plot_width=400, plot_height=400, tools=TOOLS) fig.circle('x', 'y', source=source,size=10,selection_color="red", hover_color="green") data_table = DataTable(source=source, columns=columns, width=400, height=280) p = gridplot([fig],[data_table], toolbar_location = "above") show(row(p, search_words)) 