#15278·bokeh

Stabilize localized WebGL multiline rendering

Author: bryevdvCreated Jul 29, 2026Updated Sep 18, 2026
Labelstype: bugtag: component: bokehjstag: webgl

WebGL MultiLine rendering accumulates each line across the full plot frame, derives point offsets from the current draw subset, and does not consistently handle scalar, updated, or fractional dash patterns.

Impact

Plots with many localized paths do unnecessary framebuffer work and can render selected or empty lines with unstable geometry or dash state. Fractional Canvas-style dash patterns are also mishandled by the integer-oriented dash cache.

Desired behavior

Each line should draw and accumulate only within its screen-space bounds, point offsets should remain stable for any draw subset—including empty paths and non-contiguous selections—and dash textures should correctly support scalar/vector fields, post-render updates, and finite non-negative fractional lengths.

Minimal reproducer

Click the button after the first render. The WebGL lines should switch from the short dash pattern to the longer one without retaining stale dash textures.

python
from bokeh.layouts import column
from bokeh.models import Button, ColumnDataSource, CustomJS
from bokeh.plotting import figure, show

source = ColumnDataSource(data={
    "xs": [[0, 1, 2, 3], [0, 1, 2, 3]],
    "ys": [[0, 1, 0, 1], [2, 3, 2, 3]],
    "dash": [[4, 4], [4, 4]],
})

p = figure(width=700, height=350, output_backend="webgl")
p.multi_line("xs", "ys", line_dash="dash", line_width=6, source=source)

button = Button(label="Change dash pattern")
button.js_on_click(CustomJS(args=dict(source=source), code="""
    source.data = {...source.data, dash: [[30, 12], [30, 12]]}
"""))

show(column(button, p))