Money was its own tab with its own renderers (renderMoney, renderMoneyCumulative,
renderMoneyDaily, renderMoneyLegend), its own period and spend-mode toggles, and
its own titles. It is now a metric of Trends like the others: the definitions come
from CoOpChart.CHART_METRICS, the chart is drawn by the shared renderChart(), and
the Money tab is a shortcut into Trends with that metric selected.
Removed: TREND_CONF, trendVal, trendLabel, the four money renderers, the
period/spend-mode toggles (the single Period row governs every metric now) — 5.1k
chars of duplicate chart code. Added: METRIC_SOURCE (which fetch each metric
needs), buildMetricButtons() (buttons rendered from the shared list, so the panel
and dashboard describe the same charts in the same order), and the metric-aware
renderTrends() that delegates.
The daily token-spend view is now the shared "spend" metric — the same numbers the
metrics endpoint already served, so nothing is lost by dropping the second source.
No caption under the money chart, as before.
Harness rewritten for the new path (it drove renderMoney): invariants preserved —
2 cumulative polylines + single-point balance marker, shared tooltip host, legend
that IS the definition's series list, 5 ascending ticks with the top clearing the
max, 30-day slice. New: every shared metric has a button, and a metric with no
source says so instead of drawing another chart. Tests green (page JS, pins,
guest guard).
The operator removed all caveats from the finance chart. Gone: the
money-caption element, the caveat/stale/errors caption rendering, the
.legend 'history begins' suffix and the orphaned CSS. Chart, legend keys,
series and toggles untouched; balance_history_start stays in the payload.
Harness now asserts no caveat text renders in any mode.
New Money tab beside Trends, fed by the portal's /admin/money-series
(hourly-cached server-side). One fetch at full range; period (30/90/all)
and spend-mode (cumulative/daily) toggles re-render client-side.
- Cumulative mode: three lines — Revenue (OC contributions, green),
Token spend (blue), OC balance (amber). NULL balance days render as a
gap (the OC API exposes only the CURRENT balance; history accrues from
daily snapshots from the deploy date onward — stated in the caption
and in the balance legend key).
- Daily mode: token spend per day as bars (spend-only; the other series
are cumulative and would need a second axis).
- Money ticks use the 1/2/5 x 10^k rule; tooltips reuse the shared
chart-tip helper (all three series listed per day).
- The caption is a deliberate exception to the no-caption chart rule:
the operator asked for the honest data-history limits in the UI.
- Harness: tests/money-chart-harness.js (axis invariants, gap handling,
daily bars, period slice, single-point balance).