Files
sure/app/javascript/controllers
f0a0013da9 fix(charts): round series values to the currency's display precision (#3091)
* fix(charts): round chart values to the currency's display precision

Charts are drawn from the serialized amounts, not from the formatted strings,
so a sub-unit residue plotted as a visible move between two points that both
read $0.00, and the trend between them reported a change. Round in
`Series#as_json` so the series values stay exact for insights, goals and the
assistant.

Also hide the percentage when the previous value is zero, since that makes it
infinite.

* fix(charts): round the two payloads that bypass Series#as_json

`NetWorthBreakdownSeriesBuilder` builds its payload by hand, so the reports
chart never went through the rounding added in `Series#as_json` and still
plotted raw amounts: adjacent points printing the same value rendered a
visible move, and the tooltip it inherits reported a change between them.

`Series#trend` had the same gap on the server side. It is rendered right above
the chart by `UI::Account::Chart` and by the reports summary, so an account
going from 0 to a sub-cent residue showed a coloured $0.00 change next to a
flat line.

Rounding the trend can make a previously finite percentage infinite, so guard
the three views that render `percent_formatted` without checking, as
`shared/_trend_change` already does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(charts): address net worth review comments

* fix(charts): tighten rounded trend handling

* fix(reports): restore positive sign in print trend

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: sure-admin <sure-admin@splashblot.com>
2026-08-22 04:30:23 +02:00
..
2025-01-16 14:36:37 -05:00