Skip to content

fix(emissionsRegion): move y-axis unit label out of bar area#72

Open
davidjablonski wants to merge 2 commits into
mainfrom
fix/emissions-region-yaxis-unit-label
Open

fix(emissionsRegion): move y-axis unit label out of bar area#72
davidjablonski wants to merge 2 commits into
mainfrom
fix/emissions-region-yaxis-unit-label

Conversation

@davidjablonski

@davidjablonski davidjablonski commented May 19, 2026

Copy link
Copy Markdown
Member

Summary

Two-commit fix for Y-axis unit labels overlapping chart bars (reported in Slack 2026-05-06):

Commit 1 — emissionsRegion custom SVG axis

  • Unit label ("Mt CO₂eq" etc.) was at , inside the bar area
  • Top gridline had a compensating 70px x-offset hack to avoid the label
  • Fix: move label to , , (left margin, above top tick); remove gridline hack

Commit 2 — AxisY primitive (affects all charts using it)

  • Unit label was at (right side of axis, inside chart area) at the same y as the top tick
  • Fix: move to , , (left margin, above top tick); update opaque background rect to match
  • Affects productionBasedEmissions (AT: Produktionsbasierte Emissionen) and all other charts using AxisY

Screenshot showing the bug in productionBasedEmissions ("10 Mio. t" overlapping bars, circled in red): reported by Adrian Hiss in #team_development

Test plan

  • Check emissionsRegion chart (DE and AT) — unit label should appear in left margin above top tick, not over bars
  • Check AT: Produktionsbasierte Emissionen — "Mio. t" should appear above top Y-axis tick in margin
  • Verify on mobile width (narrow layout)
  • Check dark mode — background rect should use dark background
  • Spot-check other charts using AxisY primitive (historicalEmissions, co2PriceHistory, etc.)

🤖 Generated with Claude Code

davidjablonski and others added 2 commits May 19, 2026 14:38
The unit label (e.g. "Mt CO₂eq") was rendered at x=margin.left+2,
which placed it inside the chart area and caused it to overlap tall
bars. The top gridline had a compensating 70px x-offset hack. Move
the label to the left margin (right-aligned, above the top tick) and
remove the gridline offset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The unit label (e.g. "Mio. t", "GW") was rendered at x=2 inside the
chart area at the top tick position, causing it to overlap tall bars.
Move it to x=-4 (right-aligned, matching tick labels) and 12px above
the top tick so it sits in the margin and never overlaps chart content.
Update the opaque background rect to match the new position.

Affects all charts using the AxisY primitive in 'all' or 'labels' mode,
including productionBasedEmissions (reported in Slack 2026-05-06).

Co-Authored-By: Claude Sonnet 4.6 <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