fix/bill-parity
safeviewing older commit4e342d3 · incrementalpre-PRreviewed 2026-07-31 22:43 UTC0H · 0M · 0L · 1IThe branch
- Purpose
- Bill PDF parity with legacy Smarter/THOR simulated bill (BAT-283, BAT-284)
- Goal
- Full visual parity across both PDBT (flat tariff) and GDMTH (demand tariff) PDF renders
- Sub-goals
- SG-1: Legacy header + chart-format parity for the render worker (commit 2b602ef4)
- SG-2: Add Y-axis to the PDBT monthly BarChart (this commit)
The changes (whole branch)
- What
- Wrapped the PDBT daily consumption BarChart in a chartFrame row with a YAxis on the left, and split XLabels into a matching chartFrame row with a 22pt spacer for alignment.
- Why
- The PDBT branch was missing the Y-axis that the TOU (GDMTH) chart already had, causing visual asymmetry vs the legacy bill layout.
- Areas
- packages/bill-pdf+28−11domains/cross-domain+29−5
- Blast
- 3 files, +57/−16 across bill-pdf and cross-domain; PDF-render only, no data pipeline impact.
➖CI· No PR open; CI not checked➖CodeRabbit· No .coderabbit.yaml
Findings · 1
improvement1
info
Duplicate max computation between YAxis and BarChart (pre-existing pattern)
packages/bill-pdf/src/bill-document.tsx:289
YAxis receives Math.max(...daily.map((d) => d.kwh), 1) while BarChart internally recomputes the same value. They are guaranteed identical here (same input array, same floor), so no mismatch risk. The same pattern exists for AreaLine+YAxis (hourly profile) and StackedDemandChart+YAxis (TOU chart). With ≤31 items this is trivial. Could be addressed globally by extracting max once and passing it as a prop to both components — deferred to a cleanup pass.