From aca9f79b461765245a9c0b7ed297727946026c83 Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Sat, 23 May 2026 22:24:55 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20slope=20tooltip=20clipping=20=E2=80=94?= =?UTF-8?q?=20use=20clip:false=20+=20marginTop=20instead=20of=20dy=20funct?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/src/components/ActivityCharts.svelte | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/site/src/components/ActivityCharts.svelte b/site/src/components/ActivityCharts.svelte index 7e82b63..a24aa1c 100644 --- a/site/src/components/ActivityCharts.svelte +++ b/site/src/components/ActivityCharts.svelte @@ -355,15 +355,11 @@ ); if (isSlope) { - const nearTop = (d: any) => { - const range = lineDomainMax - lineDomainMin; - return range > 0 && (d[yKey] - lineDomainMin) / range > 0.85; - }; marks.push( Plot.text(lineData, Plot.pointerX({ x, y: yKey, text: (d: any) => d.slope != null ? `${d.slope > 0.05 ? '+' : ''}${(+d.slope).toFixed(1)}%` : '', - dy: (d: any) => nearTop(d) ? 22 : -22, + dy: -22, clip: false, fill: (d: any) => slopeColor(d.slope ?? 0), stroke: tc.tooltipBg, strokeWidth: 3, fontSize: 11, fontWeight: '700', @@ -371,7 +367,7 @@ Plot.text(lineData, Plot.pointerX({ x, y: yKey, text: (d: any) => d[yKey] != null ? `${Math.round(d[yKey])}m` : '', - dy: (d: any) => nearTop(d) ? 10 : -10, + dy: -10, clip: false, fill: tc.axis, stroke: tc.tooltipBg, strokeWidth: 3, fontSize: 10, })), @@ -397,7 +393,7 @@ }; const svg = Plot.plot({ - width: w, height: h, marginLeft: 48, marginBottom: 32, + width: w, height: h, marginLeft: 48, marginBottom: 32, marginTop: isSlope ? 36 : 20, style: { background: 'transparent', color: tc.axis, fontSize: '11px' }, x: { label: null, tickFormat: xTickFormat, grid: false, ticks: 6 }, y: { label: yLabel, grid: true, tickCount: 4, domain: [lineDomainMin, lineDomainMax] },