Skip to content

fix(Sensitivity): modernize tornado chart and prevent label collisions - #28

Merged
tdody merged 1 commit into
mainfrom
thibaultdody/fix-tornado-chart-design
Apr 19, 2026
Merged

fix(Sensitivity): modernize tornado chart and prevent label collisions#28
tdody merged 1 commit into
mainfrom
thibaultdody/fix-tornado-chart-design

Conversation

@tdody

@tdody tdody commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Problem

Screenshot feedback showed two issues on the Sensitivity tab's tornado chart:

  1. Worst-case value annotations collided with the row labels when a bar extended far to the left (e.g. "Nightly Rate -$2,387" overlapping the "Nightly Rate" row label).
  2. Raw red / green / slate colors + pill metric selector were out of sync with the rest of the app.

Changes

Collision fix

  • If a downside or upside bar is ≥ 64 px wide, the value text is rendered centered INSIDE the bar with var(--canvas) fill for contrast.
  • Narrow bars still render the value outside (end-anchored left of downside, start-anchored right of upside) — but because the bar is close to the baseline in that case, the outside label never reaches into the row-label column.

Design-system integration

  • Bar fills use var(--negative) / var(--accent); baseline + baseline-input dashed lines use var(--rule-strong); row labels var(--ink-2); axis labels var(--ink-3).
  • Typography: serif 22px chart title, caps "Baseline" label + mono value, mono tabular-nums for every numeric annotation, sans for row labels.
  • Container: border border-rule-strong rounded p-6 (dropped the old bg-white / shadow / rounded-xl look).
  • Metric selector: replaced the slate pill row with <Segmented> (ink-bg active state, same pattern as the rest of the app).
  • Legend: token-colored swatches + caps labels.
  • DrillDownChart modernized alongside — accent stroke / points with canvas-ring on the baseline dot, rule-strong dashed zero + baseline-input lines, mono axis labels, border card shell.

Preserved behavior

No data or API changes — getTornado / getLTRTornado calls, the TornadoData / TornadoBar types, and the click-to-drill-down interaction are all unchanged.

Verification

  • npm run lint — clean
  • npm run build — passes

🤖 Generated with Claude Code

Screenshot feedback showed two issues on the Sensitivity tab's tornado
chart:
- Worst-case value annotations collided with the row labels when a bar
  extended far to the left (e.g. "Nightly Rate -$2,387" overlapping the
  "Nightly Rate" row label).
- Raw red / green / slate colors instead of the design-system tokens.

Changes
- Value placement: when a downside or upside bar is >= 64px wide, the
  value text is rendered centered INSIDE the bar in var(--canvas) for
  contrast. Narrow bars still render the value outside (end-anchored
  left of a downside bar, start-anchored right of an upside bar) but
  never reach past the label column because the bar itself is close to
  the baseline.
- Tokens throughout: bar fills var(--negative) / var(--accent), baseline
  line + dashed baseline-input line var(--rule-strong), row labels
  var(--ink-2), axis labels var(--ink-3).
- Typography: serif 22px chart title, caps "Baseline" label + mono value,
  mono (tabular-nums) for every numeric annotation, sans for row labels.
- Container: border border-rule-strong rounded p-6 (dropped the
  bg-white / shadow / rounded-xl look).
- Metric selector: replaced the slate pill row with a <Segmented>
  (ink-bg active state, matches the rest of the app).
- Legend: token-colored swatches + caps labels; help copy styled caps.
- DrillDownChart modernized alongside — accent stroke/points with canvas
  ring on the baseline dot, rule-strong dashed zero + baseline-input
  lines, mono axis labels, border card shell.

No data / API changes — getTornado / getLTRTornado and TornadoData /
TornadoBar types are untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tdody
tdody merged commit 217e692 into main Apr 19, 2026
2 checks passed
tdody added a commit that referenced this pull request Apr 20, 2026
Phase 2 PRs 1–7 all shipped under THI-45 through THI-54 before this
tracker was committed. Audit on 2026-04-19 confirmed `frontend/src/index.css`
tokens match `README.md` spec exactly (no drift, light + dark). Phase 2
PR 8 (polish pass) is in-progress with #26/#27/#28 landed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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