Commit Graph

19 Commits

Author SHA1 Message Date
Davide Scaini 40aa51be4d fix: flip slope tooltip below dot when near chart top edge 2026-05-23 22:06:02 +02:00
Davide Scaini bbfab72138 ActivityCharts: switch slope tab to distance-weighted smoothing
Replace time-based rolling mean with a 400 m distance-weighted sliding-
window average (O(n), two advancing pointers) matching the spec in
SLOPE_COLORING.md. Slope values are now spatially consistent regardless
of riding speed. Smoothing buttons are hidden when the slope tab is
active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 19:03:56 +02:00
Davide Scaini 6faf63c2cd ActivityCharts: add slope coloring tab to elevation profile
New "Slope" tab colours the filled area and stroke line with an SVG
linearGradient driven by per-point slope data (green→yellow→orange→red→
purple scale). Slope is computed from smoothed elevation + cumulative
distance, reusing the existing raw/10s/20s smoothing controls. The
hover tooltip shows slope % (in slope colour) and elevation. Tab is
enabled only when both elevation and distance data are present; the
X-mode and histogram toggles are hidden for this tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:57:55 +02:00
Davide Scaini f1fec6d825 ActivityCharts: smoothing toggle (Raw/10s/20s) for all line chart metrics 2026-05-12 23:37:41 +02:00
Davide Scaini a5db6142b3 ActivityCharts: 10s rolling mean on cadence and power line charts (display only) 2026-05-12 23:32:33 +02:00
Davide Scaini 1298586a74 ActivityCharts: extend reference lines to HR; use high-contrast label styling 2026-05-12 23:29:09 +02:00
Davide Scaini 3231fdb4b7 ActivityCharts: add avg/P20/P80 reference lines to speed, cadence, and power line charts 2026-05-12 23:24:33 +02:00
Davide Scaini 104328bc50 fix: stable y-axis range and sane dist_km in activity charts
Three bugs in the time↔distance x-axis toggle:

1. GPS speed glitches (e.g. a 1-second spike at 222 km/h) were accumulated
   into dist_km, pushing all subsequent points ~60 m too far right on the
   distance axis and compressing the rest of the chart.  Cap speed at 150 km/h
   during dist_km integration; values above that are treated as 0 movement.

2. Observable Plot auto-infers the y domain from plottable points only.
   When x-mode changes, which points are "plottable" changes too, so the
   y axis range silently shifted between time and distance views.  Fix by
   computing lineDomainMin/Max once from the full dataset and passing an
   explicit domain to Plot.

3. monotone-x curve requires strictly increasing x.  In distance mode,
   stopped segments produce consecutive points with identical dist_km,
   causing NaN Bézier control points and visual artifacts.  Use linear
   curve for distance mode (data is dense enough that it looks smooth).
2026-04-20 17:06:56 +02:00
Davide Scaini 5205a41224 fix: theme-aware chart colors — readable axes and tooltips in light mode 2026-04-15 22:18:06 +02:00
Davide Scaini c99b755382 The culprit is in renderChart(): it calls chart?.remove() which empties the
container div, causing the layout to collapse to zero height for a moment.
  The browser then scrolls to keep the viewport anchored, but since the page
  got shorter it jumps to the top. When the new SVG is appended, the page is
  taller again but the scroll position was already reset.

  Fix: give the chart container a min-height matching the chart height (220px)
  so it never collapses.
2026-04-10 22:58:34 +02:00
Davide Scaini bd5831c2fd second pass. low 2026-04-01 19:00:28 +02:00
Davide Scaini 2a1493a3e5 bright/dark themes 2026-03-30 09:04:57 +02:00
Davide Scaini 1c49d3a769 zone alignment 2026-03-29 22:31:03 +02:00
Davide Scaini 9bd065f354 fixed some warnings 2026-03-29 22:17:01 +02:00
Davide Scaini 4537273de9 get default hr and power zones from config file 2026-03-29 22:06:22 +02:00
Davide Scaini 3fcc8bc089 added power 2026-03-29 21:55:35 +02:00
Davide Scaini 018958f0e9 histograms with ranges 2026-03-29 21:53:00 +02:00
Davide Scaini 643d092acd fix activities' types 2026-03-29 10:37:08 +02:00
Davide Scaini 3441079913 map now working 2026-03-28 19:34:22 +01:00