Fix chart legend order and tooltip stacking on wage graphs

Legend was sorted to mirror bar stack order, making it hard to tell
segments apart at a glance; reverse it. Tooltip also rendered behind
the legend div when they overlapped — raise its z-index above it.
This commit is contained in:
jtricerolph 2026-07-24 15:45:00 +00:00
parent 158d8f1676
commit 2114e60fce
4 changed files with 20 additions and 3 deletions

View file

@ -151,7 +151,7 @@ export default function Rolling12Months() {
<XAxis dataKey="label" tick={{ fontSize: 10 }} />
<YAxis tickFormatter={v => `£${Math.round(v / 1000)}k`} tick={{ fontSize: 11 }} width={55} />
<Tooltip formatter={(v: unknown) => fmtMoney(Number(v))} />
<Legend />
<Legend itemSorter={item => -deptCols.findIndex(dep => dep.name === item.dataKey)} />
{deptCols.map(dep => (
<Bar key={dep.id} dataKey={dep.name} stackId="a" fill={dep.color} />
))}