Skip to content

fix(chart): weekly chart shows duplicate line due to repeated weekday labels#242

Merged
owieth merged 4 commits intomainfrom
fix/241-weekly-chart-duplicate-line
Mar 30, 2026
Merged

fix(chart): weekly chart shows duplicate line due to repeated weekday labels#242
owieth merged 4 commits intomainfrom
fix/241-weekly-chart-duplicate-line

Conversation

@owieth
Copy link
Copy Markdown
Owner

@owieth owieth commented Mar 30, 2026

Closes #241

Summary

  • Use yyyy-MM-dd as x-axis key in ChartView instead of formatted weekday names — prevents Swift Charts from creating a duplicate series when 8 data points map to 7 unique EEE labels
  • Add [DailySummary].fillingMissingDays(from:to:) extension and DailySummary.zero(for:) factory to pad missing days with zero values
  • Remove duplicated fillMissingDays from both viewmodels, replaced with the shared extension

Test plan

  • Weekly chart shows a single line with area fill, no second phantom line
  • All 7 days appear on the weekly x-axis, including days with no recorded data (shown as 0)
  • Month and Year views unaffected
  • Keyboard stats chart behaves the same as mouse stats chart

🤖 Generated with Claude Code

owieth added 3 commits March 30, 2026 15:39
Adds `DailySummary.zero(for:)` factory and `[DailySummary].fillingMissingDays(from:to:)`
extension to pad date ranges with zero-value entries for missing days.

Closes #241
Replaces duplicated private fillMissingDays implementations with a call
to the shared [DailySummary].fillingMissingDays extension for both
MouseStatsViewModel and KeyboardStatsViewModel.
Using formatted weekday names (EEE) as x keys caused Swift Charts to
create a second series when 8 data points mapped to only 7 unique
labels. Switching to yyyy-MM-dd as the data key guarantees uniqueness;
a chartXAxis modifier handles display formatting.
@owieth owieth self-assigned this Mar 30, 2026
@owieth owieth added the bug Something isn't working label Mar 30, 2026
@owieth owieth merged commit c6e34af into main Mar 30, 2026
2 checks passed
@owieth owieth deleted the fix/241-weekly-chart-duplicate-line branch March 30, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(chart): weekly chart shows duplicate line due to repeated weekday labels

1 participant