fix(chart): weekly chart shows duplicate line due to repeated weekday labels#242
Merged
fix(chart): weekly chart shows duplicate line due to repeated weekday labels#242
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #241
Summary
yyyy-MM-ddas x-axis key inChartViewinstead of formatted weekday names — prevents Swift Charts from creating a duplicate series when 8 data points map to 7 uniqueEEElabels[DailySummary].fillingMissingDays(from:to:)extension andDailySummary.zero(for:)factory to pad missing days with zero valuesfillMissingDaysfrom both viewmodels, replaced with the shared extensionTest plan
🤖 Generated with Claude Code