Skip to content

Commit b8c2d6b

Browse files
fix panel kmeans test (pyscript#1465)
1 parent b247864 commit b8c2d6b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/panel_kmeans.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
import altair as alt
138138
import panel as pn
139139
import pandas as pd
140+
import param
140141

141142
from sklearn.cluster import KMeans
142143
from pyodide.http import open_url
@@ -170,7 +171,7 @@
170171
y=alt.Y(y, scale=alt.Scale(zero=False)),
171172
shape='labels',
172173
color='species'
173-
).add_selection(brush).properties(width=800) +
174+
).add_params(brush).properties(width=800) +
174175
alt.Chart(centers)
175176
.mark_point(size=250, shape='cross', color='black')
176177
.encode(x=x+':Q', y=y+':Q')
@@ -197,8 +198,8 @@
197198
@pn.depends(x, y, n_clusters, watch=True)
198199
def update_chart(*events):
199200
chart.object = get_chart(x.value, y.value, table.value)
200-
chart.selection.param.watch(update_filters, 'brush')
201201

202+
@param.depends('brush', watch=True)
202203
def update_filters(event=None):
203204
filters = []
204205
for k, v in (getattr(event, 'new') or {}).items():

0 commit comments

Comments
 (0)