Skip to content

Commit ff41aba

Browse files
committed
update to demo panel
1 parent 0f7b731 commit ff41aba

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

examples/serve/panels-demo/my_viewer_ext/my_panel_3.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def render_panel(
8181
},
8282
)
8383

84-
time = Component(id="time", children=[time_label]) # [None])
84+
time = Component(id="time", children=[time_label])
8585

8686
return Box(
8787
children=[place_text, plot, controls, time],
@@ -136,7 +136,7 @@ def get_wavelength(
136136
.to_dict()["data_vars"]
137137
)
138138

139-
variables = list(selected_values.keys()) # List of variable names
139+
variables = list(selected_values.keys())
140140
values = [selected_values[var]["data"] for var in variables]
141141
wavelengths = [
142142
dataset_place[var].attrs.get("wavelength", None) for var in variables
@@ -157,7 +157,6 @@ def get_wavelength(
157157

158158

159159
# TODO - add selectedDatasetName to Available State Properties
160-
# TODO - this has to trigger a plot update if sth. changes
161160
@panel.callback(
162161
State("@app", "selectedDatasetId"),
163162
State("@app", "selectedTimeLabel"),
@@ -231,8 +230,8 @@ def update_plot(
231230
return None
232231

233232
chart = (
234-
alt.Chart(source).mark_line(point=True)
235-
# .mark_line()
233+
alt.Chart(source)
234+
.mark_line(point=True)
236235
.encode(
237236
x="wavelength:Q",
238237
y="reflectance:Q",
@@ -278,7 +277,6 @@ def update_theme(
278277
State("select_variables", "value"),
279278
State("time", "children"),
280279
Input("@app", "selectedTimeLabel"),
281-
# Output("text", "children"),
282280
Output("plot", "chart"),
283281
)
284282
def update_timestep(
@@ -289,14 +287,11 @@ def update_timestep(
289287
place: list,
290288
variables: str,
291289
time: list,
292-
_new_time_label: bool | None = None, # trigger, will always be True
293-
) -> alt.Chart | None: # tuple[list, alt.Chart] | None:
294-
295-
# text = f"{dataset_id} " f"/ {time_label[0:-1]}"
290+
_new_time_label: bool | None = None,
291+
) -> alt.Chart | None:
296292

297293
if time[0] != time_label:
298294
chart = update_plot(ctx, dataset_id, time_label, placegroup, place, variables)
299-
# update_last_timelabel(time_label)
300295
return chart
301296

302297

@@ -314,7 +309,7 @@ def update_places(
314309
return [feature["properties"]["label"] for feature in place_group[0]["features"]]
315310

316311

317-
# TODO implement this more efficient
312+
# TODO implement this more efficiently
318313
@panel.callback(
319314
Output("time", "children"),
320315
)

0 commit comments

Comments
 (0)