☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Hover tool takes long time to render

Community Support
Martin_Guthrie
Martin_Guthrie

Upgrading from Bokeh 2.3.0 to 2.4.0, for the same data set, the hover tool is taking longer time to render.

I did many experiments and found that I could improve (fix) the long render by commenting out some arguments,

ht = HoverTool(
    tooltips=[("i", "@i{0.00} uA"), ("t", "@t{0.000} ms"), ("y", "@y uA"), ],
    #mode='vline',
    #show_arrow=True,
    #renderers=[line],
)

Turning on any of mode, show_arrow, renders, causes the hover tool render time to increase. I have proven this out in this minimum example.

from bokeh.layouts import layout
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Range1d, LinearScale, LinearAxis, HoverTool

NUM_DATA_POINTS = 48000

source = ColumnDataSource(data={
    "t": [i for i in range(1, NUM_DATA_POINTS)],
    "i": [i for i in range(1, NUM_DATA_POINTS)],
    "y": [i * 2 for i in range(1, NUM_DATA_POINTS)],
})

plot = figure(toolbar_location="above",
              y_range=(0.1, NUM_DATA_POINTS*4),
              x_range=(0, NUM_DATA_POINTS),
              y_axis_type="linear")

line = plot.line(x="t", y="i", line_width=2, source=source, color="green", legend_label="i")
plot.line(x="t", y="y", line_width=4, alpha=0.4, source=source, color="red", legend_label="y")

ht = HoverTool(
    tooltips=[("i", "@i{0.00}"), ("y", "@y{0}"), ("t", "@t{0.000} ms")],
    # >>> Uncomment to make hover tool really slow
    #mode='vline',
    #show_arrow=True,
    #renderers=[line],
)
plot.tools = [ht]
doc_layout = layout()
doc_layout.children.append(plot)
show(doc_layout)

I have also taken this example, modified to run in bokeh server, and the result is the same.

Now the hard part to explain, and my question…

I use flask and bokeh components interface, and the above example is a port of what I am doing in flask. With the above example, the workaround to fix the slow hover render is to not set those hover tool options, which is acceptable to me. However, my flask implementation, the fix above does not work, the hover tool rendering is still slow. Is it possible there is a difference between the components resultant code, versus the minimal example above. As noted I checked the bokeh server, in case that would duplicate the issue I see in flask, but bokeh server is fine with the work around.

I further notice, that even with the work around, that you you slide the mouse across the green line, the hover tool renders fast, but when one deviates from the line, and then comes back to the green line, there is a noticeable lag. Not all the time, but some of the time.

⌁   Link to post
Martin_Guthrie
Martin_Guthrie
⌁   Link to post

End of archived discussion · Replies are disabled