Skip to content

Anchor phase charts' Y axis at 0 via symlog#7

Merged
bvdmitri merged 1 commit into
mainfrom
phase-charts-yaxis-zero
Jun 8, 2026
Merged

Anchor phase charts' Y axis at 0 via symlog#7
bvdmitri merged 1 commit into
mainfrom
phase-charts-yaxis-zero

Conversation

@bvdmitri

@bvdmitri bvdmitri commented Jun 8, 2026

Copy link
Copy Markdown
Member

What

The Time phases and Time phases across scenarios charts defaulted to a log scale whose Y axis floated (domain={["auto", "auto"]}) and did not start at 0. This anchors the Y axis at 0 in every mode.

A true log axis can't include 0 (log(0) is undefined), so the log-like view now uses symlog (symmetric / pseudo-log): log-like spacing for large values, linear near the origin, and it includes 0. Recharts v3 supports "symlog" natively as a string scale type, so no new dependency was added.

Change

Both charts render through the shared PhaseBars component, so a single edit covers them:

// before
scale={effectiveLog ? "log" : "linear"}
domain={effectiveLog ? ["auto", "auto"] : [0, "auto"]}
// after
scale={effectiveLog ? "symlog" : "linear"}
domain={[0, "auto"]}

The domain is now unconditionally [0, "auto"], so the axis starts at 0 in the log-like, linear, and stacked modes.

Tests

Adds a direct PhaseBars.test.tsx (the component had none) that mocks the Recharts primitives and asserts the YAxis gets scale="symlog" with a domain anchored at 0 by default, and stays anchored at 0 in linear and stacked modes. Written test-first per the repo's TDD rule.

  • npm test — 161 passed
  • npx tsc --noEmit + npm run lint — clean

Note

The toggle/caption still read "log scale" — symlog reads as a log-like scale to users. Happy to relabel to "symlog"/"pseudo-log" if preferred.

🤖 Generated with Claude Code

The "Time phases" and "Time phases across scenarios" charts defaulted to a
log scale whose Y axis floated (domain ["auto", "auto"]) and did not start
at 0. A true log axis can't include 0, so switch the log-like view to symlog
(symmetric/pseudo-log) — log-like spacing that includes 0 — and anchor the
domain at [0, "auto"] in every mode. Recharts v3 supports "symlog" natively,
so no new dependency is needed.

Both charts render through the shared PhaseBars component, so a single edit
covers them. Adds a direct PhaseBars test asserting the YAxis scale/domain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bvdmitri
bvdmitri merged commit 42b4048 into main Jun 8, 2026
20 checks passed
@bvdmitri
bvdmitri deleted the phase-charts-yaxis-zero branch June 16, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant