fix(charts): format byte-united charts in binary multiples, not decimal magnitudes

The Memory by container chart's y-axis read "1.0B" for a gigabyte — B for
"billion" — sitting directly above a table that renders the same value as
"1 GiB". Both come from the same query; only the formatter differed. The widget
had declared its unit as bytes all along, but unitValueExprJS only special-cased
duration units and sent everything else through formatNumber, whose K/M/B
suffixes are decimal magnitudes.

Byte units now get their own formatter, mirroring Pages.Containers.formatBytes
so a chart and the table under it agree. It reaches the yAxis axisLabel and the
tooltip together, since both already share unitValueExprJS, and the same global
is registered for the terminal renderer so CLI charts match the web ones.

This also corrects the stat tile: formatStatValue rendered 2048 bytes as
"2.0K bytes", which reads as 2000 bytes for a value that is 2 KiB. The existing
test pinned that string, so it is updated with a note — it was encoding the bug.
This commit is contained in:
Anthony Alaribe 2026-09-01 02:00:24 +02:00
commit c2c2db0538
5 changed files with 82 additions and 9 deletions