我写了一个代码,使用散景显示带有标记和标记之间箭头的谷歌地图。 选择/取消选择项目时 - 地图上的标记正在刷新(一些消失,其他重新出现)。 标记刷新代码:
photo_filter = BooleanFilter(booleans=[True] * len(df)) # Starts with all TRUE filter, i.e. all photos shown
checkboxes = CheckboxGroup(labels=unique_people, active=[idx for idx in range(len(unique_people))]) # Creates the Checkboxes for the people
checkboxes.js_on_change('active',
CustomJS(args=dict(source=source, f=photo_filter),
code="""\
const checked_boxes = cb_obj.active.map(idx => cb_obj.labels[idx]);
f.booleans = source.data.people.map(list => list.some(item => checked_boxes.includes(item)));
source.change.emit();
""")) # Responsible for refreshing and updating the page every time something is changed in Checkboxes
我找不到如何刷新箭头 - 以便它们将根据现在出现的标记重新显示。
我正在使用这段代码绘制箭头:
arrows = ColumnDataSource(data=dict(X_start=X_start, Y_start=Y_start, X_end=X_end, Y_end=Y_end))
map.add_layout(Arrow(end=OpenHead(line_color="blue", line_width=2, size=12),
x_start='X_start', y_start='Y_start', x_end='X_end', y_end='Y_end', source=arrows))
有人可以帮忙吗?