Charts: consistent number format
Deploy / deploy (push) Successful in 7m26s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
This commit is contained in:
2026-10-23 05:48:25 +00:00
parent be57821457
commit a0e401a3d0
+2 -1
View File
@@ -53,7 +53,8 @@ function BarChart({ d }: { d: Extract<Block, { type: 'chart' }>['data'] }) {
const H = top + d.labels.length * (rowH + 8) + 4;
const max = Math.max(...d.series.flatMap((s) => s.values), 0) || 1;
const X = (v: number) => (v / max) * (W - L - R);
const fmt = (v: number) => (Number.isInteger(v) ? String(v) : v.toFixed(1)) + (d.unit ?? '');
const allInt = d.series.every((s) => s.values.every(Number.isInteger));
const fmt = (v: number) => (allInt ? String(v) : v.toFixed(1)) + (d.unit ?? '');
return (
<figure className="chart-fig">
<figcaption className="chart-title">{d.title}</figcaption>