fix(charts): round y ticks, calendar x ticks and labels beside the plot

The value chart's axes and labels, as drawn on a 90-day blood pressure
view on a tablet:

- Y ticks were whatever Recharts split the padded domain into, so the
  labels read 57, 83, 109. The domain is now widened to a 1/2/5 step
  and every tick is handed to the axis, evenly spaced and all drawn.
- X ticks were every n-th point, so their dates drifted with the data.
  They now fall on a calendar grid (days, Mondays, two weeks, months,
  quarters, years), each on the point nearest the grid line, and the
  step is the smallest whose labels fit the measured plot width.
- The "your average" label sat inside the plot over the readings, and a
  target zone's label was clipped to its first letter. Both now sit
  beside the plot, in a right margin sized to the longest label.

A browser test draws the axes with Recharts and pins the tick values,
the Monday grid, and both labels outside the plot clear of every dot.
This commit is contained in:
Marc-André Bombeck committed 2026-10-23 19:53:28 +02:00
1 parent d5ca594bd7
commit fd34ee13b9
13 files changed
+778 -159

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
"count": 2898,
"total": 9297,
"total": 9296,
"entries": {
"__tests__/account-payload-consumer-guard.test.ts": 2,
"__tests__/acting-account-boundary-guard.test.ts": 7,
@@ -1904,7 +1904,7 @@
"lib/charts/comparison-shift.ts": 1,
"lib/charts/data-ready-latch.ts": 1,
"lib/charts/window-stats.ts": 1,
"lib/charts/x-axis-density.ts": 6,
"lib/charts/x-axis-density.ts": 5,
"lib/clinician-share/__tests__/passphrase.test.ts": 1,
"lib/clinician-share/__tests__/resolve-share-gate-state.test.ts": 1,
"lib/clinician-share/__tests__/resolve-share-token.test.ts": 1,