[5968] fix(frontend): unclip wide y-axis labels on usage charts - #6057
[5968] fix(frontend): unclip wide y-axis labels on usage charts#6057Kirtofu wants to merge 1 commit into
Conversation
CustomAreaChart used a negative left margin (-20) that shifts the whole plot area, Y axis included, 20px past the left edge of the SVG. Wide tick labels (e.g. "20Kms" on the Latency chart) then start at negative x and lose their leading digit, so the scale reads 0Kms/5Kms/0Kms. The margin is a leftover visual nudge from when the component was introduced (60c2b4c); setting it to 0 keeps all labels fully visible while leaving the layout otherwise unchanged. Verified with a minimal recharts reproduction of this component: before the change wide tick labels render with their left edge at -3px (outside the clipping boundary); after the change every label starts at +17px or more. Screenshots: see PR description.
|
@Kirtofu is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe area chart left margin changes from ChangesChart layout
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized UI fix removes the chart offset that clips wide y-axis labels; no actionable merge-blocking risk remains after normal lint and layout checks. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a UI rendering issue in the Observability dashboard Usage charts where wide Y-axis tick labels were being clipped due to a negative left chart margin in the shared CustomAreaChart component.
Changes:
- Removes the negative left margin on the Recharts
AreaChartto keep the Y-axis ticks inside the SVG drawable area.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Closes #5968
Summary
The Usage card's Latency and Cost charts clip the leading digit of wide y-axis labels (
20Kmsrenders as0Kms,15Kmsas5Kms), becauseCustomAreaChartoffsets the entire plot area — Y axis included — 20px past the left edge of the SVG with a negative margin.Root cause
web/oss/src/components/pages/observability/dashboard/CustomAreaChart.tsx:Recharts lays the Y axis inside the plot area, so
left: -20shifts it left of the SVG origin. Labels wider than ~4 characters then start at negative x and get clipped by the card's overflow boundary — exactly the negative x coordinates measured in the issue report (10Kms−5,15Kms−5,20Kms−8). The-20is a leftover visual nudge from the commit that introduced the component (60c2b4c4) with no comment explaining it.Fix
One line:
left: -20→left: 0. The chart keeps its layout otherwise unchanged; the widest label measured in the issue sits at x=−8, so removing the offset recovers all 20px with slack to spare.Verification
I reproduced this component in a minimal React + recharts (2.15.4) harness — the same
margin,tickCount, andvalueFormatter(${formatCompactNumber(value)}ms) as the app — and measured each y-axis tick label's left edge relative to the chart container in a headless browser:left: -20(before)left: 0(after)Negative = outside the clipping boundary → leading digit cut off. After the fix every label is fully visible.
Demo
Before (labels clipped):
After (labels legible):
Testing
pnpm lint-fixlocally (no full monorepo checkout available in this environment) — CI lint should be unaffected, but flagging it per the contributor guide.20Kms/15Kms/10Kmsrender in full.Checklist
[issue-id] fix(frontend): ...convention