diff --git a/static/calendar.js b/static/calendar.js index 07bcfa3..ca46bc2 100644 --- a/static/calendar.js +++ b/static/calendar.js @@ -543,9 +543,12 @@ function renderTotals(visible) { const classes = days.map((r) => r.precip && r.precip.c).filter(Boolean); // Dry days scale independently of the rain-intensity buckets (wet) so a big dry // count doesn't crush the rain bars — and vice versa. + // Index 4 carries the rain-tier key (e.g. "wet-5") so a single crowded label — + // "Moderate", wedged between the two-line "Light–Mod"/"Mod–Heavy" — can be nudged + // in CSS without brittle text matching. buckets = [["Dry", drynessColor(7), classes.filter((c) => c === "dry").length, "dry"]] .concat(SCALE_RAIN.map((t) => - [t.label, PRECIP_COLORS[t.c], classes.filter((c) => c === t.c).length, "wet"])); + [t.label, PRECIP_COLORS[t.c], classes.filter((c) => c === t.c).length, "wet", t.c])); title = "rain intensity"; } else { const classes = days @@ -600,12 +603,12 @@ function renderTotals(visible) { const maxByGroup = {}; for (const b of buckets) maxByGroup[b[3]] = Math.max(maxByGroup[b[3]] || 1, b[2]); const LINE_MAX = 30; // px — height of the tallest category in its group - const cols = buckets.map(([label, color, n, group]) => { + const cols = buckets.map(([label, color, n, group, cls]) => { const h = !n ? 0 : Math.max(2, Math.round(LINE_MAX * n / maxByGroup[group])); const line = h ? `` : ""; // Caption stacks the category name over its value; the name reserves two lines // so the value figures stay aligned across columns whether a name wraps or not. - return `