Using CDSView GroupFilter to select some or All of a DataFrame column

I am trying to use CustomJS and CDSView with GroupFilter to be able to select which data is shown on a scatterplot.

I got it to work for selecting different values in a DataFrame column, but I would also like the option to show all the values in the column - is there a good way to do that? (in other words, switch back and forth from displaying a subset of the data to displaying all the data)

(I am a novice at Bokeh and JS so any help would be appreciated)

source = ColumnDataSource(data=df)
group_filter = GroupFilter(column_name='player_name', group='Foo')
view = CDSView(source=source, filters=[group_filter])

p = figure(plot_width=800, plot_height=400)
p.scatter('x', 'y', size=10, source=source, color='colors', view=view)

callback = CustomJS(args=dict(view=view), code="""
    if (cb_obj.value=='Bar'){
        view.filters[0].group = 'Bar'
    }
    else {
        view.filters[0].group = # here is where I would like to set the filter to show all the data
    }
    view.source.change.emit()
    """);

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.