Files
sure/app/controllers/reports_controller.rb
kianrafiee 40b18e8484 feat(reports): add net worth chart with breakdown tooltip (#2716)
* Add monthly net worth chart with group breakdown to Reports

Adds a net worth trend chart to the Reports > Net Worth section,
rendered in the same design scheme as the dashboard chart. The chart
shows one data point per month across the period selected at the top
of the Reports page, and its hover tooltip breaks the hovered month
down into per-account-group balances (Cash, Investments, Credit
Cards, Loans, etc.) under Assets and Liabilities headings with
section totals.

- BalanceSheet::NetWorthBreakdownSeriesBuilder builds the monthly
  series by running Balance::ChartSeriesBuilder per account group
  (grouped by accountable type), with liabilities reported as
  positive magnitudes and all-zero groups omitted; cached with the
  same invalidation pattern as the existing net worth series
- net_worth_chart Stimulus controller extends the existing
  time_series_chart controller, overriding only data normalization
  and the tooltip template
- Reports controller passes the series through the existing
  net_worth_metrics hash; tooltip headings reuse existing locale keys

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Address review: month-over-month tooltip deltas, Stimulus value labels

- Recompute each chart point's trend from the previous monthly point
  instead of inheriting the raw series trend, which at a monthly
  interval compared the underlying balance row's own start/end and so
  reflected only the last balance update before the sample date
  (chatgpt-codex-connector). The first point has no prior month and
  renders the standard flat state.
- Pass tooltip section labels to the Stimulus controller as declared
  values (data-*-value attributes) per coding guidelines (coderabbit)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 05:59:32 +02:00

44 KiB