Skip to content

feat(stress): Y-axis + tap/scrub interaction on Today's Timeline chart#1

Closed
ujix wants to merge 1 commit into
mainfrom
android/stress-timeline-interactive
Closed

feat(stress): Y-axis + tap/scrub interaction on Today's Timeline chart#1
ujix wants to merge 1 commit into
mainfrom
android/stress-timeline-interactive

Conversation

@ujix

@ujix ujix commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a Y-axis to the intraday stress line chart (labels 0–3 matching the stress scale) with a reserved 32dp left gutter so the axis never overlaps the line
  • Tap anywhere on the chart to place a vertical crosshair and a floating pill tooltip showing stress level + hour (e.g. 1.7 @ 14:00)
  • Drag / swipe left-right to scrub across the timeline; crosshair and tooltip track the finger in real time
  • Crosshair dismisses on finger lift — no persistent state left in the UI
  • Chart height increased from 72dp → 100dp to accommodate axis labels and give the line more breathing room
  • X-axis ruler padded to align with the chart area (excludes the Y-axis gutter)

Implementation notes

  • Touch handling uses awaitEachGesture + awaitFirstDown inside a pointerInput modifier — no external dependencies
  • Tooltip value computed with integer-tenths arithmetic (avoids String.format)
  • All drawing (Y-axis, line, crosshair, pill) is on a single Canvas — no extra composable layers

Test plan

  • Open Stress screen on a day with HR/RR strap data → Today's Timeline should show Y-axis labels (0 / 1 / 2 / 3)
  • Tap the chart → crosshair and tooltip appear at the tapped hour
  • Drag left/right → crosshair tracks smoothly
  • Lift finger → crosshair disappears
  • Verify no regression on days with no daytime data (section remains hidden)

DaytimeStressLine previously had no Y-axis scale and was static — the user
could see the shape of the curve but not read off stress values.

Changes:
- Taller canvas (72 → 100 dp) to give the Y-axis room to breathe
- Y-axis: hairline grid lines at 0 / 1 / 2 / 3 with right-aligned labels
- Chart area offset right by 32 dp (stressYAxisWidth) to make room for labels
- X-axis hour ruler shifted by the same offset so it aligns with the chart
- Touch/drag scrubbing: tap or slide a finger to show a dashed crosshair +
  ring dot at the selected hour + a tinted pill tooltip ("9 am · 1.4");
  crosshair clears automatically when the finger lifts
@ujix ujix closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant