bokeh: Changing CDSView filters' attributes does not trigger rendering

Bokeh 0.12.11

from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import CDSView, IndexFilter, ColumnDataSource, Button
from bokeh.plotting import figure

ds = ColumnDataSource(dict(x=[1, 2, 3], y=[1, 2, 3]))
f = IndexFilter(indices=list(range(len(ds.data['x']))))
v = CDSView(source=ds, filters=[f])

fig = figure()
fig.x(x='x', y='y', source=ds, view=v)

b = Button(label='Change indices')


def change_indices():
    if f.indices:
        f.indices = f.indices[:-1]


b.on_click(change_indices)

curdoc().add_root(column(fig, b))

Clicking on the button results in ModelChanged messages being sent out, but the plot itself does not change. The root cause is that all filter models do not connect any signals - effectively, they’re just passive containers.

As of now, a workaround would be to re-set filters property of the CDSView instance.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 16 (15 by maintainers)

Most upvoted comments

I just ran into this too when trying to update an IndexFilter. Was extremely confusing.

agree this is an issue of missing plumbing, which might be simple to add

cc @clairetang6