From 34e15c107830a097da155630ea0f585eb2f9fd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sgeir=20Thor=20Johnson?= Date: Thu, 18 Jun 2026 23:14:11 +0000 Subject: [PATCH] Spread multi-day star gaps across days so no false single-day spike Render-time fix: build daily points by spreading any >1-day gap between snapshots evenly, so a tracker outage (or the one-time backfill seam) never renders the accumulated gain as a single giant bar. --- .github/scripts/accumulate-traffic.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/scripts/accumulate-traffic.py b/.github/scripts/accumulate-traffic.py index 3a26785..70350f8 100644 --- a/.github/scripts/accumulate-traffic.py +++ b/.github/scripts/accumulate-traffic.py @@ -303,8 +303,22 @@ new ApexCharts(document.getElementById('viewsChart'), { }).render(); if (starSeries.length) { - const cumData = starSeries.map(p=>[new Date(p.date).getTime(), p.stars]); - const deltaData = starSeries.map((p,i)=>[new Date(p.date).getTime(), i===0?p.stars:Math.max(0,p.stars-starSeries[i-1].stars)]); + // Build daily points. If two snapshots are >1 day apart (e.g. the tracker + // missed a few days), spread the gain evenly across the missing days so a + // multi-day delta never renders as one false single-day spike. + const cumData = [], deltaData = []; + starSeries.forEach((p,i)=>{ + const t = new Date(p.date).getTime(); + if (i===0) { cumData.push([t,p.stars]); deltaData.push([t,p.stars]); return; } + const prev = starSeries[i-1], pt = new Date(prev.date).getTime(); + const days = Math.max(1, Math.round((t-pt)/86400000)); + const per = (p.stars - prev.stars) / days; + for (let k=1;k<=days;k++) { + const tk = pt + k*86400000; + cumData.push([tk, k===days ? p.stars : Math.round(prev.stars + per*k)]); + deltaData.push([tk, Math.round(per)]); + } + }); new ApexCharts(document.getElementById('starsChart'), { ...baseOpts, chart:{...baseOpts.chart, type:'line', height:320, id:'stars', zoom:{enabled:true,type:'x',autoScaleYaxis:true}},