Spaces:
Running
Running
thibaud frere commited on
Commit ·
03cd478
1
Parent(s): cb92d91
update
Browse filesFiles changed (4)
12345678910111213141516171816 unmodified lines3536373839404142434445<button id="theme-toggle" aria-label="Toggle color theme"><svg class="icon light" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="currentColor"><circle cx="12" cy="12" r="5"/><g stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="12" y1="1" x2="12" y2="4"/><line x1="12" y1="20" x2="12" y2="23"/><line x1="1" y1="12" x2="4" y2="12"/><line x1="20" y1="12" x2="23" y2="12"/><line x1="4.22" y1="4.22" x2="6.34" y2="6.34"/><line x1="17.66" y1="17.66" x2="19.78" y2="19.78"/><line x1="4.22" y1="19.78" x2="6.34" y2="17.66"/><line x1="17.66" y1="6.34" x2="19.78" y2="4.22"/></g></svg><svg class="icon dark" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="currentColor"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg><script>16 unmodified lineselse if (media.addListener) media.addListener(syncWithSystem);}btn.addEventListener('click', () => {const next = (document.documentElement.dataset.theme === 'dark') ? 'light' : 'dark';localStorage.setItem('theme', next);apply(next);});</script></button>1234567891011121314151616 unmodified lines33343536373839404142434445<button id="theme-toggle" aria-label="Toggle color theme"><svg class="icon light" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="4"></line><line x1="12" y1="20" x2="12" y2="23"></line><line x1="1" y1="12" x2="4" y2="12"></line><line x1="20" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="4.22" x2="6.34" y2="6.34"></line><line x1="17.66" y1="17.66" x2="19.78" y2="19.78"></line><line x1="4.22" y1="19.78" x2="6.34" y2="17.66"></line><line x1="17.66" y1="6.34" x2="19.78" y2="4.22"></line></svg><svg class="icon dark" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg><script>16 unmodified lineselse if (media.addListener) media.addListener(syncWithSystem);}if (btn) {btn.addEventListener('click', () => {const next = (document.documentElement.dataset.theme === 'dark') ? 'light' : 'dark';localStorage.setItem('theme', next);apply(next);});}</script></button>
123version https://git-lfs.github.com/spec/v1oid sha256:d5db6c112739ccf6b5f98dfdd480f9748c5b78c66452b02e0168eeed6acea875size 50100123version https://git-lfs.github.com/spec/v1oid sha256:85f900011d0ea9cd2e0326e2d5bf40b74e90e696901b8fd9283dd802aa0bdbe1size 37017
155 unmodified lines15615715815916016135 unmodified lines197198199200201202203204205206207119 unmodified lines32732832933033133233333433533633733833934034111 unmodified lines353354355356357358359155 unmodified linesconst gGrid = gRoot.append('g').attr('class', 'grid');const gAxes = gRoot.append('g').attr('class', 'axes');const gLines = gRoot.append('g').attr('class', 'lines');const gHover = gRoot.append('g').attr('class', 'hover');const gLegend = gRoot.append('foreignObject').attr('class', 'legend');35 unmodified lineslet xScale = d3.scaleLinear();let yScale = d3.scaleLinear();// Line generatorconst lineGen = d3.line().curve(d3.curveCatmullRom.alpha(0.05)).x((d) => xScale(d.step)).y((d) => yScale(d.value));// Hover elementsconst hoverLine = gHover.append('line').attr('stroke-width', 1);119 unmodified lines// Bind linesconst series = runs.map((r, i) => ({ run: r, color: pool[i % pool.length], values: (map[r]||[]).slice().sort((a,b)=>a.step-b.step) }));const paths = gLines.selectAll('path.run-line').data(series, d=>d.run);paths.enter().append('path').attr('class','run-line').attr('fill','none').attr('stroke-width',2).attr('stroke', d=>d.color).attr('opacity',0.9).attr('d', d=>lineGen(d.values)).merge(paths).transition().duration(200).attr('stroke', d=>d.color).attr('d', d=>lineGen(d.values));paths.exit().remove();// Inline legend content (row, right side) compactlegendInline.innerHTML = series.map(s => `<span style="display:inline-flex;align-items:center;gap:6px;white-space:nowrap;"><span style="width:18px;height:10px;background:${s.color};border-radius:3px;display:inline-block"></span><span>${s.run}</span></span>`).join('');11 unmodified linesseries.forEach(s=>{const m = new Map(s.values.map(v=>[v.step, v.value]));const val = m.has(nearest) ? m.get(nearest) : null;if (val != null) html += `<div><span style="display:inline-block;width:10px;height:10px;background:${s.color};border-radius:50%;margin-right:6px;"></span><strong>${s.run}</strong> ${(+val).toFixed(4)}</div>`;});tipInner.innerHTML = html;const offsetX = 12, offsetY = 12;155 unmodified lines15615715815916016116235 unmodified lines198199200201202203204205206207208209210211212119 unmodified lines33233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336411 unmodified lines376377378379380381382383384385155 unmodified linesconst gGrid = gRoot.append('g').attr('class', 'grid');const gAxes = gRoot.append('g').attr('class', 'axes');const gLines = gRoot.append('g').attr('class', 'lines');const gPoints = gRoot.append('g').attr('class', 'points');const gHover = gRoot.append('g').attr('class', 'hover');const gLegend = gRoot.append('foreignObject').attr('class', 'legend');35 unmodified lineslet xScale = d3.scaleLinear();let yScale = d3.scaleLinear();// Line generatorsconst lineGenSmooth = d3.line().curve(d3.curveCatmullRom.alpha(0.05)).x((d) => xScale(d.step)).y((d) => yScale(d.value));const lineGenStep = d3.line().curve(d3.curveStepAfter).x((d) => xScale(d.step)).y((d) => yScale(d.value));// Hover elementsconst hoverLine = gHover.append('line').attr('stroke-width', 1);119 unmodified lines// Bind linesconst series = runs.map((r, i) => ({ run: r, color: pool[i % pool.length], values: (map[r]||[]).slice().sort((a,b)=>a.step-b.step) }));const paths = gLines.selectAll('path.run-line').data(series, d=>d.run);const gen = isRank ? lineGenStep : lineGenSmooth;paths.enter().append('path').attr('class','run-line').attr('fill','none').attr('stroke-width',2).attr('stroke', d=>d.color).attr('opacity',0.9).attr('d', d=>gen(d.values)).merge(paths).transition().duration(200).attr('stroke', d=>d.color).attr('d', d=>gen(d.values));paths.exit().remove();// Points for rank metrics (discrete steps)if (isRank) {const pointData = series.flatMap(s => s.values.map(v => ({ run: s.run, color: s.color, step: v.step, value: v.value })));const circles = gPoints.selectAll('circle.point').data(pointData, d => d.run + '-' + d.step);circles.enter().append('circle').attr('class', 'point').attr('r', 2.5).attr('fill', d => d.color).attr('cx', d => xScale(d.step)).attr('cy', d => yScale(d.value)).merge(circles).attr('cx', d => xScale(d.step)).attr('cy', d => yScale(d.value));circles.exit().remove();} else {gPoints.selectAll('*').remove();}// Inline legend content (row, right side) compactlegendInline.innerHTML = series.map(s => `<span style="display:inline-flex;align-items:center;gap:6px;white-space:nowrap;"><span style="width:18px;height:10px;background:${s.color};border-radius:3px;display:inline-block"></span><span>${s.run}</span></span>`).join('');11 unmodified linesseries.forEach(s=>{const m = new Map(s.values.map(v=>[v.step, v.value]));const val = m.has(nearest) ? m.get(nearest) : null;if (val != null) {const formatVal = (vv) => (isRank ? d3.format('d')(vv) : (+vv).toFixed(4));html += `<div><span style=\"display:inline-block;width:10px;height:10px;background:${s.color};border-radius:50%;margin-right:6px;\"></span><strong>${s.run}</strong> ${formatVal(val)}</div>`;}});tipInner.innerHTML = html;const offsetX = 12, offsetY = 12;
5 unmodified lines67891011125 unmodified lines.d3-pie .legend .swatch { width:14px; height:14px; border-radius:3px; display:inline-block; border: 1px solid var(--border-color); }.d3-pie .caption { font-size: 14px; font-weight: 800; fill: var(--text-color); }.d3-pie .nodata { font-size: 12px; fill: var(--muted-color); }.d3-pie .slice-label { font-size: 11px; font-weight: 700; fill: var(--text-color); paint-order: stroke; stroke: rgba(255,255,255,0.6); stroke-width: 3px; }</style><script>(() => {5 unmodified lines67891011125 unmodified lines.d3-pie .legend .swatch { width:14px; height:14px; border-radius:3px; display:inline-block; border: 1px solid var(--border-color); }.d3-pie .caption { font-size: 14px; font-weight: 800; fill: var(--text-color); }.d3-pie .nodata { font-size: 12px; fill: var(--muted-color); }.d3-pie .slice-label { font-size: 11px; font-weight: 700; fill: var(--text-color); paint-order: stroke; stroke: rgba(255,255,255,0.2); stroke-width: 3px; }</style><script>(() => {
app/src/components/ThemeToggle.astro+18-18
app/src/content/assets/data/against_baselines.csv+2-2
app/src/content/embeds/d3-line.html+31-5
app/src/content/embeds/d3-pie.html+1-1