Repository navigation
Align Cash Balance Trend timeframes to the calendar - #184
Merged
Merged
Conversation
Label month, year and all-time views on calendar days, months, quarters or years that fit the chart width. Start month views on the 1st with the carried opening balance when earlier history covers it, and open year views on January 1 the same way. Add Compare previous year for the year view, reusing the monthly comparison builder with month/day-aligned slots. Give the comparison and privacy views the same readout, plot and legend rows as the trend chart and keep the toggle label fixed, so switching views never changes the card height or moves the toggle.
This was referenced Oct 28, 2026
Merged
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 #183
Summary
The Cash Balance Trend chart (Analytics page) now labels its x-axis on calendar boundaries, starts monthly views on the 1st, offers a previous-year comparison in 1Y, and keeps the card the same height when the comparison or privacy mode is toggled, so the toggle no longer moves under the pointer.
Changes
common/calendar-ticks.ts, opt-incalendarAxisonInteractiveAreaChart): picks the finest calendar unit whose labels fit the plot width. That gives days (1M), months (1Y), and quarters, half-years or years (All). Labels are placed by time, not by data index. Multi-year spans name January by its year (for example2025, Apr, Jul, Oct, 2026…). Other charts that useInteractiveAreaChartkeep their current labels.analytics-module/cash-balance-trend.ts): 1M opens on the 1st with the carried balance and fills quiet days through today, or through month end for past months. 1Y opens on Jan 1 the same way. A carried balance is used only when earlier history covers it; pre-ledger balances are never invented.unit(month|year) and aligns year slots by month and day. A Feb 29 slot with no match isnullon the other side. It uses the same availability rules (full previous-period history, current/past periods, Actual mode only) and the same masked tooltip. The result fields are renamedselectedStart/previousStartand gainunit.Compare previous month/year, shown as pressed when on), and Trend keeps its slot while comparing.Verification
npm test -w client: 60 files, all passed. New tests cover tick generation (month/year/multi-year at desktop and mobile widths), month-start padding and clipping, year comparison (alignment, Feb 29, coverage) and layout slots/privacy masking.npm run lint -w client -- --max-warnings=0: clean.VITE_API_AUTH_MODE=public VITE_API_DOMAIN=localhost:8787 npm run build: built.Oct 1, 4 … 25; 1YJan … Oct; All2025 Apr Jul Oct 2026 Apr Jul Oct.Oct 1, 8, 15, 22; 1YJan Mar May Jul Sep; All2025 Jul 2026 Jul. No horizontal page scroll.