mega-plant/app
David 681225e51d Charts: a profit line that changes colour, and a Series toggle
Profit was a single always-teal line, so a month that lost money looked
like a month that made a little. It is now drawn per sign: one <Line> per
same-sign run, plus a gradient <Line> across each crossing. Recharts draws
a Line as one <Curve> path, so <Cell> cannot recolour a segment — separate
series are the only way. Every variant is a key on the ONE shared dataset
rather than a sliced `data` prop, because Recharts builds a categorical axis
by concatenating every series' data and a short slice re-adds the month
labels ("Jan … Aug, Jan … Aug"). The tooltip needs a custom `content`
component to fold those per-run keys back into a single profit row.

Two honesty rules: profit stays null in a month with no income figure
(treating it as 0 drew a green dot for a month that was never billed), and
a month with no running-cost row gets a hollow dot, because its profit is
optimistic.

The toolbar's Series button toggles which lines a card draws, remembered in
localStorage. A hidden series takes its legend entry and its Y axis with it,
so there is never an axis for a line that is not drawn, and the last visible
series cannot be switched off.

Palette: Running moves off red to the project's existing brand purple,
because red is now reserved for a loss and a red Running line next to a red
loss segment was unreadable. `--color-chart-loss` and `--color-chart-profit`
are separate tokens on purpose — loss used to read the Running token, so
recolouring Running silently dragged the red with it.

/charts alone now reads profit including running cost, so the card badge,
the profit line and the Profit bars view cannot disagree. Scoped to the
page: lib/profit.ts keeps its workbook default for every other surface.
2026-10-03 09:20:16 +02:00
..
api Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
charts Charts: a profit line that changes colour, and a Series toggle 2026-10-03 09:20:16 +02:00
expenses Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
income Invoices: Add Invoice becomes a real dialog; quieten the invoice table 2026-10-02 14:35:27 +02:00
overheads Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00
plant Sites: auto-allocate container lines to the container the site hires 2026-10-02 18:32:12 +02:00
running Round 4: regressions fixed + mobile standard 2026-09-12 12:05:43 +02:00
sites Invoices: keep the PDF on the invoice, and search the invoice's own words 2026-10-02 19:09:16 +02:00
globals.css Charts: a profit line that changes colour, and a Series toggle 2026-10-03 09:20:16 +02:00
layout.tsx Sites: auto-allocate container lines to the container the site hires 2026-10-02 18:32:12 +02:00
page.tsx Fix: the mobile table was mislabelled and clipping its own totals 2026-10-02 15:34:19 +02:00