【发布时间】:2020-05-11 04:26:27
【问题描述】:
我有一个使用多线字形创建的散景图。我可以使用点击工具选择单行或使用 TapTool+Shift 选择多行。有没有办法用 BoxSelectTool 选择几行(如图所示)?沿每条线的点的密度非常高,因此如果仅当一条线的 1+ 个点位于框选择区域内时,选择才有效。 我正在寻找一个没有 Python 服务器的独立解决方案。编写一些 CustomJS 代码就可以了。
from bokeh.models import ColumnDataSource
from bokeh.layouts import column
import numpy as np
output_file('tst.html', mode="inline")
n = 8
t = np.linspace(0., 10., 80)
data = ColumnDataSource(dict(xx=[t for cnt in range(n)],
yy=[(10 + cnt/2*(-1)**cnt)*np.sin(t + cnt/3) for cnt in range(n)],
zz=[(10 - cnt/2*(-1)**cnt)*np.cos(t) for cnt in range(n)]))
f1 = figure(plot_width=800, plot_height=300, tools='tap,box_select,reset')
f2 = figure(plot_width=800, plot_height=300)
f1.multi_line(xs='xx', ys='yy', source=data)
f2.multi_line(xs='xx', ys='zz', source=data)
save(column(f1, f2))
Plot sample with the box selection
谢谢。
【问题讨论】: