Anchor phase charts' Y axis at 0 via symlog#7
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
PhaseBarscomponent, so a single edit covers them: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 theYAxisgetsscale="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 passednpx tsc --noEmit+npm run lint— cleanNote
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