
Basically I’m trying to link the crosshair of multiple plots. This only possible with a custom span (see docs: tools — Bokeh 3.6.2 Documentation).
This works in principle however the performance is utterly terrible once you go to >50k data points. According to the docs a span will created in both cases thus I’m wondering why the performance suffers for a custom span?
import numpy as np
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource, CustomJS, HoverTool, Div, Spacer, CrosshairTool, Span
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import row, column
n_samples = 100_000
x = np.linspace(0, 1000, n_samples)
y = np.random.rand(n_samples)
source = ColumnDataSource({"x": x, "y": y})
vline_span = Span(dimension="height", line_dash="solid", line_width=1)
tools = [CrosshairTool(overlay=vline_span)] # allows linkage but has bad performance
#tools = [CrosshairTool(dimensions="height")] # no linkage but good performance
p1 = figure(width=800, height=400, tools=tools)
p1.line("x", "y", source=source, color='olive')
p2 = figure(width=800, height=400, tools=tools)
p2.line("x", "y", source=source)
curdoc().add_root(column(p1, p2))





