From a44bcbd6b03737aedfad81183c4e7080eda6090c Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 11 Sep 2026 16:07:06 +0700 Subject: [PATCH] feat(site): rank every series on chart hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hovering a date now lists all plotted repos ordered by stars at that point, with exact counts, so the chart answers "who was ahead when" instead of only showing one value at a time. The series under the cursor is bold in the list, stays solid and thickens, and every other line goes thin and dashed — readable with forty lines on screen. Chart.js paints its tooltip on the canvas and cannot weight one row differently, so the readout is an HTML card positioned beside the caret (flipped and clamped to stay inside the chart) and the built-in tooltip is off. Forty rows fit as three columns; names truncate on a shared grid so the counts align. Hidden series are excluded, so the ranking always matches what is drawn. --- site/index.html | 115 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 5 deletions(-) diff --git a/site/index.html b/site/index.html index e247c51..18a2fba 100644 --- a/site/index.html +++ b/site/index.html @@ -160,6 +160,35 @@ .charthead { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; } .chartwrap { position: relative; height: 460px; } .chartmsg { color: var(--muted); text-align: center; padding-top: 4rem; } + /* Hover readout. Chart.js paints its tooltip on the canvas, which cannot + bold one row, so the ranking is HTML and the built-in tooltip stays off. */ + #hovercard { + position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; opacity: 0; + background: var(--surface); border: 1px solid var(--border); border-radius: 8px; + box-shadow: 0 4px 16px rgb(0 0 0 / 18%); padding: .5rem .6rem; max-width: 100%; + transition: opacity .12s ease; + } + #hovercard .hdate { + font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; + color: var(--muted); font-weight: 600; margin-bottom: .35rem; + } + #hovercard .cols { display: flex; gap: .85rem; align-items: flex-start; } + #hovercard ul { list-style: none; margin: 0; padding: 0; } + /* Grid, not flex: every row in a column shares the template, so names + truncate at one width and the star counts line up. */ + #hovercard li { + display: grid; grid-template-columns: .5rem 1.15rem minmax(0, 9.5rem) auto; + align-items: center; gap: .35rem; font-size: .72rem; line-height: 1.6; + color: var(--muted); + } + #hovercard li.on { color: var(--fg); font-weight: 700; } + #hovercard .sw { width: .5rem; height: .5rem; border-radius: 2px; opacity: .75; } + #hovercard li.on .sw { opacity: 1; } + #hovercard .rk { text-align: right; font-variant-numeric: tabular-nums; opacity: .75; } + #hovercard .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + #hovercard .val { text-align: right; font-variant-numeric: tabular-nums; padding-left: .5rem; } + /* Touch devices have no hover, so the card would only ever be in the way. */ + @media (hover: none) { #hovercard { display: none; } } .hint { color: var(--muted); font-size: .85rem; margin: .75rem 0 0; } #err { color: var(--neg); } footer { color: var(--muted); font-size: .85rem; margin: 1.5rem 0 .5rem; display: flex; gap: .5rem; flex-wrap: wrap; } @@ -172,6 +201,7 @@ } @media (max-width: 480px) { body { padding: 1rem; } .stats { grid-template-columns: 1fr 1fr; } } @media (prefers-reduced-motion: reduce) { + #hovercard { transition: none; } *, *::before, *::after { transition: none !important; animation: none !important; } } @@ -236,8 +266,9 @@
-

Every tracked repo is plotted — click legend entries to hide series. The tag filters and search above also filter the chart.

+ aria-label="Line chart of GitHub star history over time for the repositories listed in the table above."> +

Every tracked repo is plotted — hover a date for the full ranking at that point, click legend entries to hide series. The tag filters and search above also filter the chart.