From 13b2c13caf25d34db25872839bff7f036257d8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 16 May 2026 17:13:21 +0200 Subject: [PATCH] fix(charts): drop duplicate y-axis ticks on narrow weight domains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the visible Y-domain spans less than ~6 units the chart's integer tick formatter rounded two adjacent gridlines to the same label — '83 kg' appeared twice on /insights/gewicht when the domain ran from 82.3 to 85.1. Promote the formatter to a one- decimal projection when the domain is narrow so each tick reads distinct without inflating the BP / glucose / steps axes where integers are correct. Per .planning/round-v1433-audit-runtime.md F10. --- src/components/charts/health-chart.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/charts/health-chart.tsx b/src/components/charts/health-chart.tsx index a48baa39b..9e37348b2 100644 --- a/src/components/charts/health-chart.tsx +++ b/src/components/charts/health-chart.tsx @@ -961,7 +961,16 @@ export function HealthChart({ return zones; }, [showBands, targetZones, yDomain]); - const formatAxisValue = (value: number) => fmt.integer(value); + // v1.4.33 F10 — preserve one decimal when the visible Y-domain span is + // narrow enough that two distinct gridlines would otherwise round to + // the same integer (e.g. weight at 82.8 vs 83.5 both rendering as + // "83 kg"). The threshold matches the body-composition cluster: any + // domain spanning < 6 units gets `0.1`-precision ticks; wider domains + // keep the integer formatter so BP / glucose / steps stay clean. + const yDomainSpan = yDomain ? yDomain[1] - yDomain[0] : null; + const useDecimalAxis = yDomainSpan !== null && yDomainSpan < 6; + const formatAxisValue = (value: number) => + useDecimalAxis ? fmt.number(value, 1) : fmt.integer(value); const formatTooltipValue = (value: number) => fmt.number(value, 1); @@ -1313,7 +1322,7 @@ export function HealthChart({ domain={yDomain} tickFormatter={(value) => typeof value === "number" - ? formatAxisValue(Math.round(value)) + ? formatAxisValue(useDecimalAxis ? value : Math.round(value)) : String(value) } unit={