From 541a4c381d94d268bf0839820da519cb7e416185 Mon Sep 17 00:00:00 2001 From: Fanboynz Date: Thu, 27 Aug 2026 10:47:32 +1200 Subject: [PATCH 001/333] charts: make every scrubbable graph read like the screen around it (#1664) Tapping a graph printed a different number from the metric written beside it: a rounded headline over a one-decimal chart. Reported by @bartmuskala against #1662. This is the unfinished half of #463. `formatValue` exists BECAUSE of that report -- Trends' Effort chart tapped to the stored 0-100 figure beside a 0-21 axis -- but only that one call site was wired up. Three of twelve passed a formatter; the rest kept lineChartSelectionLabel's fallback, which collapses near-integers and otherwise prints one decimal. Seven call sites now pass the formatter their own screen already uses for the read-out beside the chart: Vital Signs detail, Explore, Stress, the Sleep metric sheet, two Sleep hours cards and Sleep debt. BarChart had no formatValue parameter at all -- it hardcoded null -- so its three scrubbable callers could not be fixed from outside; added, with LineChart's default and fallback. Explore was worse than a decimal. Its values are the RAW stored numbers and MetricSpec.format is what rescales Effort to the WHOOP 0-21 axis. The Y labels and the hero went through it; the scrub read-out did not, so the axis said 12.4 and tapping the same point said 59. Consequence worth naming: a rounded metric now READS rounded on tap. HRV scrubs as "62 ms" where it said "62.4". That is the alignment asked for, but a visible loss of detail rather than a pure tidy-up. The shared default is unchanged: a genuinely fractional metric still wants its decimal, and after this no scrubbable chart reaches the fallback -- verified by walking all twelve call sites. iOS needed nothing, and not for the reason I first assumed. Its default is a rounded int, but it never reaches it: 7 of 7 TrendChart and 2 of 2 OverviewHRChart production sites already pass valueFormat. Apple finished the wiring this fix completes on Android. Its Stress chart already uses the exact "%.1f" formatter chosen here. Verified: 4516 Android tests, CI green on the merged head. --- .../app/src/main/java/com/noop/ui/Charts.kt | 7 +- .../src/main/java/com/noop/ui/HealthScreen.kt | 5 ++ .../java/com/noop/ui/SleepMetricCardsUi.kt | 8 ++ .../com/noop/ui/SleepMetricDetailSheet.kt | 3 + .../src/main/java/com/noop/ui/StressScreen.kt | 4 + .../java/com/noop/ui/TrendsExploreScreen.kt | 7 ++ .../noop/ui/ChartScrubFormatterParityTest.kt | 87 +++++++++++++++++++ 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 android/app/src/test/java/com/noop/ui/ChartScrubFormatterParityTest.kt diff --git a/android/app/src/main/java/com/noop/ui/Charts.kt b/android/app/src/main/java/com/noop/ui/Charts.kt index a1484c2b17..a2473aa5a0 100644 --- a/android/app/src/main/java/com/noop/ui/Charts.kt +++ b/android/app/src/main/java/com/noop/ui/Charts.kt @@ -548,6 +548,11 @@ fun BarChart( // Optional per-point display labels index-aligned with [values]; when supplied, a tap shows // "