Skip to content

Commit 9160b78

Browse files
Refactor plot title to display only the metric name without the path (#462)
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent 47aeda0 commit 9160b78

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.changeset/stale-groups-hug.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+
feat:Refactor plot title to display only the metric name without the path

trackio/frontend/src/pages/Metrics.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,13 @@
287287
{#each orderedDirect as metric, i}
288288
{@const plotData = getPlotData(metric)}
289289
{@const useBar = singlePointMetrics.has(metric)}
290+
{@const directTitle = showHeaders ? metric.split("/").slice(1).join("/") || metric : metric}
290291
{#if plotData.length > 0}
291292
{#if useBar}
292293
<BarPlot
293294
data={plotData}
294295
y={metric}
295-
title={metric}
296+
title={directTitle}
296297
{colorMap}
297298
draggable={true}
298299
ondragstart={(e) => handleDragStart(directKey, i, e)}
@@ -304,7 +305,7 @@
304305
data={plotData}
305306
x={xColumn}
306307
y={metric}
307-
title={metric}
308+
title={directTitle}
308309
{colorMap}
309310
{xLim}
310311
onSelect={handlePlotSelect}
@@ -332,12 +333,13 @@
332333
{#each orderedSub as metric, i}
333334
{@const plotData = getPlotData(metric)}
334335
{@const useBar = singlePointMetrics.has(metric)}
336+
{@const subTitle = showHeaders ? metric.split("/").slice(2).join("/") || metric : metric}
335337
{#if plotData.length > 0}
336338
{#if useBar}
337339
<BarPlot
338340
data={plotData}
339341
y={metric}
340-
title={metric}
342+
title={subTitle}
341343
{colorMap}
342344
draggable={true}
343345
ondragstart={(e) => handleDragStart(subKey, i, e)}
@@ -349,7 +351,7 @@
349351
data={plotData}
350352
x={xColumn}
351353
y={metric}
352-
title={metric}
354+
title={subTitle}
353355
{colorMap}
354356
{xLim}
355357
onSelect={handlePlotSelect}

0 commit comments

Comments
 (0)