feat(reports): add money-flow sankey chart, unify monthly report date selector - #579
Merged
Conversation
Adds a sankey diagram report visualizing income categories flowing through the Income node into expense categories, with the unspent remainder shown as Saved. Built on chartjs-chart-sankey to stay on the existing chart.js/ng2-charts stack. Reuses the category-expenses report endpoint, so no backend changes.
Replaces the year prev/next navigation with the period selector and
date-range display used by the other reports. Bar labels are now built
from each balance's balanceAt ('MMM', or 'MMM yyyy' when the range
spans years or is open-ended), so arbitrary ranges render correctly.
Default period is 'this year', preserving the previous default view.
Adds a disabledPeriods input to the shared period selector and disables Lifetime and Custom for the monthly income & expense report, where open-ended or arbitrary ranges do not make sense for a monthly series.
Nebular's nbButtonToggle does not reliably suppress the group valueChange for disabled buttons, so guard onPeriodChange itself.
- Renames the hub node to 'Budget' (net change as its sum), income categories on the left, expense categories and the Saved remainder on the right - Node labels now include the short-number sum, e.g. 'Rent (700.00)' - Label color is read from the host element's computed style and re-resolved on Nebular theme changes, so labels stay readable in both light and dark themes
Forces the Saved node one column past the expense categories via the sankey column option, so the unspent remainder reads as its own branch instead of blending into the expense list.
Default modeX 'edge' relocates every sink node (all expense categories) to the last column, which nullified the forced Saved column. 'even' keeps sinks in their BFS column so Saved stays a separate branch.
… expense" This reverts commit 6028d26, restoring the year prev/next navigation.
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.
Summary
balanceAt, so arbitrary ranges render correctly. Default stays "this year".Implementation
chartjs-chart-sankey— a chart.js controller plugin, staying on the existing chart.js 4 + ng2-charts stack. No second chart engine, no wrapper.SankeyExpensesComponentextendsAbstractReportComponentlike the other reports — reuses the existingcategoryExpensesquery, period selector, and date-range UI. No backend changes.buildSankeyFlows()function with unit tests.Verification
tsc --noEmitclean,eslintcleannpm test: 92/92 pass (4 new specs)npm run build(production) succeeds