ActivityCharts: extend reference lines to HR; use high-contrast label styling
This commit is contained in:
@@ -147,9 +147,9 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Reference lines (avg, P20, P80) — speed, cadence, and power ────────
|
// ── Reference lines (avg, P20, P80) — speed, cadence, power, hr ────────
|
||||||
function refStats(tab: Tab, vals: number[]) {
|
function refStats(tab: Tab, vals: number[]) {
|
||||||
if (tab !== 'speed' && tab !== 'cadence' && tab !== 'power') return null;
|
if (tab !== 'speed' && tab !== 'cadence' && tab !== 'power' && tab !== 'hr') return null;
|
||||||
const moving = vals.filter(v => v > 0);
|
const moving = vals.filter(v => v > 0);
|
||||||
if (moving.length < 5) return null;
|
if (moving.length < 5) return null;
|
||||||
const avg = moving.reduce((a, b) => a + b, 0) / moving.length;
|
const avg = moving.reduce((a, b) => a + b, 0) / moving.length;
|
||||||
@@ -236,7 +236,8 @@
|
|||||||
{ xv: xEnd, yv: ref.p20, label: `P20 ${Math.round(ref.p20)}` },
|
{ xv: xEnd, yv: ref.p20, label: `P20 ${Math.round(ref.p20)}` },
|
||||||
{ xv: xEnd, yv: ref.p80, label: `P80 ${Math.round(ref.p80)}` },
|
{ xv: xEnd, yv: ref.p80, label: `P80 ${Math.round(ref.p80)}` },
|
||||||
],
|
],
|
||||||
{ x: 'xv', y: 'yv', text: 'label', textAnchor: 'end', dx: -4, dy: -6, fill: tc.axis, fontSize: 10 },
|
{ x: 'xv', y: 'yv', text: 'label', textAnchor: 'end', dx: -4, dy: -6,
|
||||||
|
fill: tc.tooltipFg, stroke: tc.tooltipBg, strokeWidth: 3, fontSize: 11 },
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user