feat(weight): add time-range selector to body weight chart#1239
Open
bhavit04 wants to merge 1 commit into
Open
feat(weight): add time-range selector to body weight chart#1239bhavit04 wants to merge 1 commit into
bhavit04 wants to merge 1 commit into
Conversation
The body weight chart always plotted the entire history, which becomes hard to read for users with a lot of entries going back a long time. Add a segmented selector above the chart with "All" / "Last year" / "Last 3 months" options (the approach suggested in the issue) that restricts the plotted range. "All" is the default, so the existing behaviour is unchanged unless the user opts in. The range filtering is applied to the weight overview only; the shared getOverviewWidgetsSeries helper gains an optional mainChartTitle so the header reflects the selected range, leaving the measurements call site untouched. Closes wger-project#148 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Description
Closes #148
The body weight chart always plots the entire history. For users with a lot of entries going back a long time this gets cramped and hard to read, and there was no way to focus on a recent period.
This PR adds a segmented selector above the chart with three options — All / Last year / Last 3 months — exactly the approach suggested in the issue. Selecting a range restricts the plotted data (raw + 7-day average, and the per-plan/30-day sub-charts that derive from it).
Notes:
getOverviewWidgetsSerieshelper only gains an optionalmainChartTitleparameter so the header reflects the selected range; the measurements call site is untouched.app_en.arbonly (chartRange*labels andchartLastYearTitle/chartLast3MonthsTitle); other locales fall back to English until translated.Testing
test/weight/weight_screen_test.dart) that verifies the selector renders, that restricting to "Last 3 months" hides out-of-range data, and that switching back to "All" restores the chart.flutter analyzeclean; weight and measurement tests pass.🤖 Generated with Claude Code