I have a dropdown, a chart and a table interlinked. All works fine, except when I make a new selection from the dropdown, the brush selection doesn’t reset itself and I have to click refresh on the chart to see new values corresponding to the newly selected value from the dropdown.
How do I change it so when I select a new value from the dropdown (new island), the chart resets automatically and all the previous linked selections or filters get reset without me needing to click ‘refresh’ manually? Thanks
Here is the self-contained example and attached gif
import panel as pn
import holoviews as hv
pn.extension('tabulator', template='material', sizing_mode='stretch_width')
import hvplot.pandas # noqa
pd.options.display.float_format = '{:.0f}'.format
island_dropdown = pn.widgets.Select(name='Island',
options=penguins_df.Island.unique().tolist(),
value=penguins_df.Island.unique().tolist()[0])
penguins_dfi = penguins_df.interactive(sizing_mode='stretch_width')
penguins_dfi = penguins_dfi[(penguins_dfi['Island'] == island_dropdown)]
# # points plot
points_plot = penguins_dfi.hvplot(x='Species',
y='Body Mass (g)',
kind='points',
height=350,
width=900,
persist=True,
hover_cols=['Body Mass (g)','Beak Length (mm)', 'Flipper Length (mm)'],
yformatter='%d')
ls_common = hv.link_selections.instance(unselected_alpha=0.08)
# # Table is not yet dynamically linked to the linked selection
table = penguins_dfi[['Island', 'Species', 'Sex', 'Body Mass (g)','Beak Length (mm)', 'Flipper Length (mm)']].pipe(ls_common.filter, selection_expr=ls_common.param.selection_expr).pipe(
pn.widgets.Tabulator, pagination='remote', page_size=10)
column = pn.Column(penguins_dfi.widgets(),ls_common(points_plot.holoviews()), ls_common(table.panel()))
column