money: room under the €0 baseline so it sits clear of the chart edge and small dips below zero show
All checks were successful
Deploy production / deploy (push) Successful in 1m10s

This commit is contained in:
2026-10-25 16:11:09 +00:00
parent 772e699655
commit 0b7509bbbc

View File

@@ -27,7 +27,9 @@
let values = $derived(series.flatMap((item) => item.points.map((point) => point.value)));
let times = $derived(series.flatMap((item) => item.points.map((point) => time(point.date))));
let scale = $derived(niceScale(Math.min(0, ...values), Math.max(0, ...values)));
let min = $derived(scale.min);
// Money charts keep a little room under €0 so the baseline sits clear of the bottom edge and
// small dips below zero stay visible.
let min = $derived(showZero && scale.min === 0 && scale.max > 0 ? -scale.max * 0.06 : scale.min);
let max = $derived(scale.max);
let span = $derived(max - min || 1);
let from = $derived(Math.min(...times));