Jonna Marie Matthiesen Copilot commited on
Commit
19914a8
Β·
1 Parent(s): 79e2f2a

Split accuracy table into fixed model column and scrollable metrics

Browse files

The model column sits outside the scrollable area so it remains visible
without needing a background color that clashes with the page gradient.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Files changed (2) hide show
  1. app.js +16 -10
  2. style.css +19 -6
app.js CHANGED
@@ -760,11 +760,6 @@ async function buildAccuracyTable() {
760
  const card = document.createElement("div");
761
  card.className = "table-card";
762
 
763
- let html = `<h3>Accuracy</h3><div class="table-scroll"><table><thead><tr>`;
764
- html += `<th>MODEL</th>`;
765
- html += metricCols.map(h => `<th class="metric-cell">${h}</th>`).join("");
766
- html += `</tr></thead><tbody>`;
767
-
768
  // Find best value per column (higher is better for accuracy)
769
  const best = {};
770
  metricCols.forEach(col => {
@@ -772,21 +767,32 @@ async function buildAccuracyTable() {
772
  if (vals.length) best[col] = Math.max(...vals);
773
  });
774
 
 
 
775
  rows.forEach(r => {
776
  const model = r[modelCol];
777
  const modelColor = MODEL_COLORS[model]?.border || '#888';
778
- html += `<tr><td class="model-cell"><span class="model-dot" style="background:${modelColor}"></span><a href="${LINK_PREFIX}${model}" target="_blank" rel="noopener" style="color:${modelColor}">${model}</a></td>`;
 
 
 
 
 
 
 
 
 
779
  metricCols.forEach(col => {
780
  const val = parseFloat(r[col]);
781
  const isBest = !isNaN(val) && val === best[col];
782
  const display = isNaN(val) ? (r[col] || "β€”") : val.toFixed(2);
783
- html += `<td class="metric-cell">${isBest ? '<strong style="color: white; opacity: 0.7">' + display + '</strong>' : display}</td>`;
784
  });
785
- html += `</tr>`;
786
  });
 
787
 
788
- html += `</tbody></table></div>`;
789
- card.innerHTML = html;
790
  section.appendChild(card);
791
  }
792
 
 
760
  const card = document.createElement("div");
761
  card.className = "table-card";
762
 
 
 
 
 
 
763
  // Find best value per column (higher is better for accuracy)
764
  const best = {};
765
  metricCols.forEach(col => {
 
767
  if (vals.length) best[col] = Math.max(...vals);
768
  });
769
 
770
+ // Fixed model column
771
+ let fixedHtml = `<table><thead><tr><th>MODEL</th></tr></thead><tbody>`;
772
  rows.forEach(r => {
773
  const model = r[modelCol];
774
  const modelColor = MODEL_COLORS[model]?.border || '#888';
775
+ fixedHtml += `<tr><td class="model-cell"><span class="model-dot" style="background:${modelColor}"></span><a href="${LINK_PREFIX}${model}" target="_blank" rel="noopener" style="color:${modelColor}">${model}</a></td></tr>`;
776
+ });
777
+ fixedHtml += `</tbody></table>`;
778
+
779
+ // Scrollable metric columns
780
+ let scrollHtml = `<table><thead><tr>`;
781
+ scrollHtml += metricCols.map(h => `<th class="metric-cell">${h}</th>`).join("");
782
+ scrollHtml += `</tr></thead><tbody>`;
783
+ rows.forEach(r => {
784
+ scrollHtml += `<tr>`;
785
  metricCols.forEach(col => {
786
  const val = parseFloat(r[col]);
787
  const isBest = !isNaN(val) && val === best[col];
788
  const display = isNaN(val) ? (r[col] || "β€”") : val.toFixed(2);
789
+ scrollHtml += `<td class="metric-cell">${isBest ? '<strong style="color: white; opacity: 0.7">' + display + '</strong>' : display}</td>`;
790
  });
791
+ scrollHtml += `</tr>`;
792
  });
793
+ scrollHtml += `</tbody></table>`;
794
 
795
+ card.innerHTML = `<h3>Accuracy</h3><div class="table-split"><div class="table-split-fixed">${fixedHtml}</div><div class="table-split-scroll">${scrollHtml}</div></div>`;
 
796
  section.appendChild(card);
797
  }
798
 
style.css CHANGED
@@ -385,12 +385,25 @@ tbody tr.row-group-break td {
385
  }
386
 
387
  /* ── Sticky first column in scrollable tables ─────────── */
388
- .table-scroll th:first-child,
389
- .table-scroll td:first-child {
390
- position: sticky;
391
- left: 0;
392
- z-index: 1;
393
- background: var(--bg);
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  }
395
  .legend-section {
396
  margin: 2rem 0;
 
385
  }
386
 
387
  /* ── Sticky first column in scrollable tables ─────────── */
388
+ .table-split {
389
+ display: flex;
390
+ }
391
+
392
+ .table-split-fixed table,
393
+ .table-split-scroll table {
394
+ width: 100%;
395
+ }
396
+
397
+ .table-split-fixed {
398
+ flex-shrink: 0;
399
+ }
400
+
401
+ .table-split-scroll {
402
+ overflow-x: auto;
403
+ flex: 1;
404
+ min-width: 0;
405
+ scrollbar-color: var(--text-dim) var(--border);
406
+ scrollbar-width: thin;
407
  }
408
  .legend-section {
409
  margin: 2rem 0;