Skip to content

Add a Trends line/bar chart toggle in Settings - #134

Merged
ryanbr merged 2 commits into
mainfrom
feat/trend-chart-bar-style
Jul 9, 2026
Merged

ryanbr merged 2 commits into
mainfrom
feat/trend-chart-bar-style

Conversation

@ryanbr

@ryanbr ryanbr commented Jul 9, 2026

Copy link
Copy Markdown
Owner

What

Adds a Settings → Appearance → "Trend charts" toggle (Line / Bar) that switches every card on the Trends tab between the classic gradient line + area and value-ramp bars.

It's a purely cosmetic, display-only preference — the plotted data is identical on both settings, only the mark geometry changes, and nothing in storage is touched. Default is Line (the long-standing look), so existing users see no change until they flip it.

How

iOS

  • TrendChart (StrandDesign) gains a showsBars: Bool flag: a BarMark per sample replaces the line/area/point marks. The "now" end-cap halo is a line idiom, so it's gated off in bar mode.
  • Hover-to-read stays on in bar mode — TrendChart always min/max-buckets in init, so even the multi-year window is ~400 marks.
  • Wired through TrendsView.glowChart from a new @AppStorage(UnitPrefs.trendChartStyleKey).

Android

  • ChartWithAxes (the single chart choke point every trend card routes through) picks BarChart vs LineChart from the pref.
  • Bars run with selectionEnabled = false so BarChart mean-bins a dense (multi-year "ALL") window down to the pixel width — a clean silhouette instead of a 1000-bar sub-pixel smear. The max/avg/min axis column + footer carry the numbers. The GlowEndCap ("now" halo) is line-only.

Both

  • New pref trend.chart.style (default line), added next to the Effort-scale toggle and mirrored across UnitPrefs (Swift) / UnitPrefs (Kotlin). A distinct type (TrendChartStyle) so it never collides with the existing ChartStyle ("Chart colours").

Verification

  • Android :app:compileFullDebugKotlin passes locally.
  • iOS reviewed by hand (Charts/Compression can't build on the WSL box): all existing TrendChart( callers use labelled args and are untouched by the defaulted showsBars; BarMark is within the package's iOS 16 / macOS 13 floor.

ryanbr added 2 commits July 9, 2026 18:03
Settings > Appearance gains a "Trend charts" control (Line / Bar) that
switches every card on the Trends tab between the gradient line+area and
value-ramp bars. Display-only: the plotted data is identical either way,
only the mark geometry changes, and nothing in storage is touched.

iOS: TrendChart gains a showsBars flag (BarMark in place of the
line/area/point marks); the "now" end-cap is a line idiom so it is gated
off for bars. Hover/read stays on -- TrendChart always min/max-buckets in
init, so even the multi-year window is ~400 marks.

Android: ChartWithAxes picks BarChart vs LineChart from the pref at the
single chart choke point. Bars run with selection off so BarChart mean-
bins a dense (multi-year "ALL") window down to the pixel width -- a clean
silhouette rather than a 1000-bar smear; the axis column + footer carry
the numbers. The GlowEndCap ("now" halo) is line-only.

New pref UnitPrefs.trendChartStyleKey / NoopPrefs("trend.chart.style"),
default line, mirrored on both platforms next to the Effort-scale toggle.
Re-review fix. The small-multiple metric cards (HRV, RHR, Effort) pass a
data-fitted, non-zero value range (e.g. RHR ~48-61) so the LINE shows
variation. In bar mode a BarMark anchors at 0, so reusing that fitted
domain floated every bar near full height with the real differences
squashed into the top -- bar length stopped being proportional to value.
Drop the domain floor to 0 in bar mode (matching Android's zero-based
BarChart); the line's fitted domain is untouched.
@ryanbr
ryanbr merged commit 224b9cd into main Jul 9, 2026
@ryanbr
ryanbr deleted the feat/trend-chart-bar-style branch July 14, 2026 10:49
DX23876 pushed a commit to DX23876/noop that referenced this pull request Jul 22, 2026
Add a Trends line/bar chart toggle in Settings
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