Skip to content

Commit c279def

Browse files
committed
changes
1 parent fc02fa6 commit c279def

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

trackio/frontend/src/components/LinePlot.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@
517517
aria-label="Reset horizontal zoom: show the full range on the x-axis"
518518
>
519519
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">
520-
<path d="M4 12h16M4 12l3-3M4 12l3 3M20 12l-3-3M20 12l-3 3"/>
520+
<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/>
521521
</svg>
522522
</button>
523523
{/if}
@@ -596,7 +596,7 @@
596596
aria-label="Reset horizontal zoom: show the full range on the x-axis"
597597
>
598598
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">
599-
<path d="M4 12h16M4 12l3-3M4 12l3 3M20 12l-3-3M20 12l-3 3"/>
599+
<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/>
600600
</svg>
601601
</button>
602602
{/if}

trackio/frontend/src/lib/dataProcessing.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,24 @@ export function computeMetricPlotData(masterData, xColumn, metric, xLim) {
121121
(r) => r[metric] != null && r[metric] !== undefined,
122122
);
123123
if (xLim) {
124-
const sorted = relevant.sort((a, b) => a[xColumn] - b[xColumn]);
125-
let lo = 0;
126-
let hi = sorted.length - 1;
127-
while (lo < sorted.length && sorted[lo][xColumn] < xLim[0]) lo++;
128-
while (hi >= 0 && sorted[hi][xColumn] > xLim[1]) hi--;
129-
lo = Math.max(0, lo - 1);
130-
hi = Math.min(sorted.length - 1, hi + 1);
131-
relevant = sorted.slice(lo, hi + 1);
124+
const groups = new Map();
125+
for (const r of relevant) {
126+
const key = `${r.run || ""}\0${r.data_type || "original"}`;
127+
if (!groups.has(key)) groups.set(key, []);
128+
groups.get(key).push(r);
129+
}
130+
const filtered = [];
131+
for (const [, rows] of groups) {
132+
rows.sort((a, b) => a[xColumn] - b[xColumn]);
133+
let lo = 0;
134+
let hi = rows.length - 1;
135+
while (lo < rows.length && rows[lo][xColumn] < xLim[0]) lo++;
136+
while (hi >= 0 && rows[hi][xColumn] > xLim[1]) hi--;
137+
lo = Math.max(0, lo - 1);
138+
hi = Math.min(rows.length - 1, hi + 1);
139+
filtered.push(...rows.slice(lo, hi + 1));
140+
}
141+
relevant = filtered;
132142
}
133143
const originals = relevant.filter(
134144
(r) => r.data_type === "original" || !r.data_type,

trackio/frontend/src/pages/Metrics.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@
140140
const countPerRunMetric = new Map();
141141
for (const r of originals) {
142142
const run = r.run;
143-
for (const col of metricColumns) {
143+
for (const col of cols) {
144144
if (r[col] == null) continue;
145145
const key = `${col}\0${run}`;
146146
countPerRunMetric.set(key, (countPerRunMetric.get(key) || 0) + 1);
147147
}
148148
}
149-
const sp = new Set(metricColumns);
149+
const sp = new Set(cols);
150150
for (const [key, count] of countPerRunMetric) {
151151
if (count > 1) {
152152
sp.delete(key.split("\0")[0]);

0 commit comments

Comments
 (0)