Python Bokeh TapTool跳转到相应的DataTable行
免责声明:我是Bokeh绘图新手,一般来说可能不擅长编程(我只是喜欢编写代码和编写方便的脚本,以便在工作中使用) 如果我将下面的代码示例作为bokeh服务器应用程序运行,选择数据表上的一行将在绘图上突出显示相应的标志符号;但是,使用TapTool在绘图上选择图示符不会高亮显示数据表上的相应行,有没有办法做到这一点Python Bokeh TapTool跳转到相应的DataTable行,python,bokeh,Python,Bokeh,免责声明:我是Bokeh绘图新手,一般来说可能不擅长编程(我只是喜欢编写代码和编写方便的脚本,以便在工作中使用) 如果我将下面的代码示例作为bokeh服务器应用程序运行,选择数据表上的一行将在绘图上突出显示相应的标志符号;但是,使用TapTool在绘图上选择图示符不会高亮显示数据表上的相应行,有没有办法做到这一点 from bokeh.plotting import figure, curdoc, ColumnDataSource from bokeh.models import HoverTo
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()]
columns = [TableColumn(field='a', title='A'),
TableColumn(field='b', title='B')]
p1 = figure(plot_width=400,
plot_height=400,
title='Example',
x_axis_label='Example X',
y_axis_label='Example Y',
tools=tools)
p1.circle_cross(x='a',
y='b',
source=source)
t1 = DataTable(columns=columns,
editable=False,
height=200,
width=400,
fit_columns=True,
source=source)
layout = gridplot([[p1],[t1]])
curdoc().add_root(layout)
尝试将
滚动到\u selection=True,selective=True
属性添加到数据表中
t1 = DataTable(columns=columns,
editable=False,
height=200,
width=400,
fit_columns=True,
source=source,
scroll_to_selection= True, selectable = True)