☰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

CDSView and Out of bounds error

Community Support
Maxxner
Maxxner

I’m using an IndexFilter for which the underlying source changes sometimes. This can cause the indices of the filter to be out of bounds in respect to the data source. Currently this will trigger a JS out of bounds error.
I’m wondering if managing this is in general supposed to be a user responsibility?

from bokeh.io import curdoc
from bokeh.models import ColumnDataSource, CustomJS, HoverTool, Div, Spacer, CDSView, IndexFilter, Button
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import row, column

data_1 = {"x": [2, 3, 5, 6, 8, 7], "y": [6, 4, 3, 8, 7, 5]}
data_2 = {"x": [2, 3, 5, 6, 8], "y": [6, 4, 3, 8, 7]}


view = CDSView(filter=IndexFilter([0,1,2,3,4,5]))

p = figure(width=400, height=400, tools="", toolbar_location=None, title='Hover over points')

source = ColumnDataSource(data_1)
p.scatter("x", "y", source=source, view=view, color='olive', hover_color='olive', hover_alpha=1.0)

def update_source():
    source.data = data_2

button = Button(label="Change Source")
button.on_click(update_source)

curdoc().add_root(column(p, button))
⌁   Link to post
Bryan
Bryan

I’m wondering if managing this is in general supposed to be a user responsibility?

Yes, out of bounds is out of bounds. Bokeh is conservative here and assumes it is an error since most of the time it probably is an error.

⌁   Link to post

End of archived discussion · Replies are disabled