From 2de4717230e869d3349d2b03f2453d1b0761e38a Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 24 Aug 2026 17:03:49 +0000 Subject: [PATCH] Fix week overlay alignment, in-plot ISO week legend, shorter charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - weeklySeries shifts overlaid weeks onto the current week's time axis so they overlay inside the plot instead of overflowing left; oldest weeks paint first, current week on top - Legend moved inside the visits chart's top right: current ISO week in accent, past weeks as a single muted "Week M" / "Week M–N" specimen - Past week curves use the muted color instead of faded accent - Chart height reduced ~30% (180 -> 126) --- docs/analytics.md | 8 ++++-- frontend/src/VisitorCharts.vue | 48 +++++++++++++++++++++------------ frontend/src/analytics/chart.js | 2 +- frontend/src/analytics/time.js | 18 ++++++++++--- 4 files changed, 53 insertions(+), 23 deletions(-) diff --git a/docs/analytics.md b/docs/analytics.md index 48bf793..4576941 100644 --- a/docs/analytics.md +++ b/docs/analytics.md @@ -231,9 +231,13 @@ labeled intervals, minor lines at fifths when integral; the minimum y-axis range is 10 so tiny values such as a single visit are not stretched to a fractional scale). The week range is aligned to Monday 00:00 UTC and overlays up to 8 previous -weeks in the same accent color at decreasing opacity (the current week is +weeks in the muted color at decreasing opacity (the current week keeps the +accent color and is truncated at the current bucket, never drawing fake zeroes for the future); -its x labels are weekday names centered at midday UTC, without vertical grid +a compact legend inside the top right of the visits chart marks the current +ISO week in accent and the overlaid past weeks as "Week M" or "Week M–N" on +a muted specimen. Its x labels are weekday names centered at midday UTC, without +vertical grid lines (day boundaries would be misleading in the viewer's timezone). The month view labels days the same lineless way — day numbers at noon UTC, with the month name substituted for the 1st. Month, year and all are diff --git a/frontend/src/VisitorCharts.vue b/frontend/src/VisitorCharts.vue index 8fa29a4..7d0084f 100644 --- a/frontend/src/VisitorCharts.vue +++ b/frontend/src/VisitorCharts.vue @@ -37,6 +37,12 @@ function freqLabel(unit) { return unit === '5min' ? '5 min' : unit === 'hour' ? 'hourly' : 'daily' } +/** Legend label for the overlaid past weeks: "Week M" or "Week M–N". */ +function pastLabel(series) { + const oldest = series.at(-1).label.slice(5) // strip "Week " + return series.length > 2 ? `Week ${oldest}–${series[1].label.slice(5)}` : `Week ${oldest}` +} + const now = ref(Date.now()) let refreshInterval = null onMounted(() => { @@ -52,8 +58,8 @@ const viewChart = computed(() => buildChart(viewSeries.value, now.value))