Skip to content

Commit 3a2d11d

Browse files
Saba9gradio-pr-bot
andauthored
preserve x-axis step when toggling run checkboxes (#441)
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent 18e9650 commit 3a2d11d

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.changeset/khaki-feet-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trackio": patch
3+
---
4+
5+
fix:preserve x-axis step when toggling run checkboxes

trackio/ui/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,15 @@ def generate_embed(project: str, metrics: str, selection: RunSelection) -> str:
245245
return utils.generate_embed_code(project, metrics, selection.selected)
246246

247247

248-
def update_x_axis_choices(project, selection):
248+
def update_x_axis_choices(project, selection, current_x_axis="step"):
249249
"""Update x-axis dropdown choices based on available metrics."""
250250
runs = selection.selected
251251
available_metrics = get_available_metrics(project, runs)
252+
value = current_x_axis if current_x_axis in available_metrics else "step"
252253
return gr.Dropdown(
253254
label="X-axis",
254255
choices=available_metrics,
255-
value="step",
256+
value=value,
256257
)
257258

258259

@@ -858,7 +859,7 @@ def configure(request: gr.Request):
858859
gr.on(
859860
[run_cb.input],
860861
fn=update_x_axis_choices,
861-
inputs=[project_dd, run_selection_state],
862+
inputs=[project_dd, run_selection_state, x_axis_dd],
862863
outputs=x_axis_dd,
863864
show_progress="hidden",
864865
queue=False,

0 commit comments

Comments
 (0)