whatif: live data refresh, inflation-adjusted spending, legend fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Three follow-ups to the actualbudget integration: **Always-fresh autofill.** Drop the one-shot `*AutoFilled` boolean gates; replace with `nwUserEdited` / `spendingUserEdited` flags. Until the user types into either field, every refetch (mount, window focus) updates the form value. Once they edit, we leave it alone. A small ↻ button next to each anchor input flips the edited flag back off so the user can re-snap to live data on demand. React Query configured with staleTime=0 + refetchOnMount='always' + refetchOnWindowFocus=true so the cache never serves stale numbers. NW provenance shows the snapshot date. **Inflation-adjusted spending.** Backend now revalues each trailing month's nominal pence forward to today's £ using monthly compounding of `inflation_pct` (default 0.03 ≈ UK CPI 2024-26). Headline `total_gbp` is the real-£ figure — matches the simulator's real-GBP convention. Response also includes `nominal_total_gbp` and `inflation_pct` for transparency. New /spending/annual?inflation_pct= override param. 10/10 actualbudget tests pass. **FanChart legend.** The bottom-anchored legend was overlapping the x-axis label. Moved to top: 8 with itemGap=18 + type=scroll for narrow viewports; bumped grid top→48 / bottom→56 + xAxis nameGap→28 so nothing collides. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
3bfa46ad4f
commit
e12e8f9290
8 changed files with 263 additions and 68 deletions
|
|
@ -135,7 +135,9 @@ function buildFan(yearly: ProjectionPoint[], showWithdrawal: boolean): EChartsOp
|
|||
}
|
||||
|
||||
return {
|
||||
grid: { left: 60, right: showWithdrawal ? 70 : 24, top: 30, bottom: 40 },
|
||||
// Grid: leave room above for the legend (top:48) and below for the
|
||||
// x-axis name label so neither collides with the chart area.
|
||||
grid: { left: 60, right: showWithdrawal ? 70 : 24, top: 48, bottom: 56 },
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: (params) => {
|
||||
|
|
@ -157,7 +159,16 @@ function buildFan(yearly: ProjectionPoint[], showWithdrawal: boolean): EChartsOp
|
|||
},
|
||||
},
|
||||
legend: {
|
||||
bottom: 0,
|
||||
// Above the chart, centred — out of the way of the x-axis label.
|
||||
// `type: 'scroll'` lets ECharts paginate items on narrow viewports
|
||||
// instead of wrapping them into the chart area.
|
||||
top: 8,
|
||||
left: 'center',
|
||||
type: 'scroll',
|
||||
itemGap: 18,
|
||||
itemWidth: 14,
|
||||
itemHeight: 10,
|
||||
textStyle: { fontSize: 11, color: '#475569' },
|
||||
data: [
|
||||
'median',
|
||||
'p10',
|
||||
|
|
@ -171,7 +182,8 @@ function buildFan(yearly: ProjectionPoint[], showWithdrawal: boolean): EChartsOp
|
|||
data: years,
|
||||
name: 'years from now',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 24,
|
||||
nameGap: 28,
|
||||
nameTextStyle: { color: '#64748b' },
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue