Skip to content

fix(templates): dashboard chart labels show whole instead of clipped by the chart edge - #12432

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl36-chart-labels-whole
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl36-chart-labels-whole

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Anyone who starts from the dashboard-progress template sees only a sliver of the "Today" label above the dashed today line in the milestone timeline, at every width (375, 390 and 1280 px, light and dark), in the app and in a rendered page. The same class of clip cuts off Y-axis tick labels in dashboard-comparison ("1200K"), and, under the larger touch text of the neutral theme on a phone, in dashboard ("100", "120") and the dashboard-progress burndown ("320 pts").

Problem and solution fit

  1. Why is the label cut? Recharts puts a reference-line label with position: 'top' above the plot area, and an outer <svg> clips what it draws outside its box. The chart had a 4 px top margin, so the 11 px label sat 13 px above the SVG's top edge.
  2. Why are the ticks cut? Those Y axes had a fixed width (30 or 40 px) that is narrower than their widest tick label, so the label runs past the SVG's left edge.
  3. Why does it matter? The label is how a reader knows what the dashed line means; a cut tick reads as a wrong number. Pages copied from a template keep the clip.

The fix reserves room where the label is placed instead of moving it: the timeline's top margin is the label's size plus its gap, and each clipped Y axis gets a width that holds its widest tick label at the touch type size. The width is fixed rather than Recharts' width="auto", because "auto" measures layout, and a page painted without a layout pass (a script-less render) would then put every tick past the chart edge.

Expected behavior and authority

Templates are starting points that must show their content whole on a phone and on desktop (the existing phone-fit browser check). @astryxdesign/charts' own referenceLine already clamps its label inside the plot; these templates call Recharts directly, so the fix belongs in the templates.

Smallest restoration

  • dashboard-progress: top margin = label size + label gap (both named constants, the label uses them too); burndown Y axis 40 -> 64 px.
  • dashboard-comparison: Y axis 40 -> 56 px. dashboard: Y axis 30 -> 40 px.
  • No layout, color or data change beyond the space the labels need.

Evidence

  • Reproduction before the change: in Chromium the "Today" text box starts 12–13 px above its SVG at 375/390/1280 px, light and dark, in the dev app and in the rendered file; "1200K" starts 3 px left of its SVG.
  • Result after the change: every label sits inside its SVG at all of those sizes and schemes, and in rendered files with and without script at 390 and 1280 px.
  • Representative unchanged path: the other 54 ready page templates have no clipped chart text before or after.
  • Regression test: template-phone-fit.browser.test.mjs gains "shows every chart label whole, inside its chart". It failed on the timeline/comparison-only version of this change (it found the touch-text clips in dashboard and the burndown) and passes with the full change.

Scope

Components: page templates (dashboard, dashboard-comparison, dashboard-progress), template phone-fit browser check

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • ASTRYX_TEMPLATE_PHONE_FIT_BROWSER=1 vitest run .github/scripts/template-phone-fit.browser.test.mjs (both tests pass).
  • vitest run packages/cli/api/template packages/cli/foundation/discovery/template- packages/cli/api/render/render.templates internal/eslint-plugin-astryx/no-raw-color.test.mjs --project node: 83 files, 547 tests pass.
  • Real browser (Chromium 155): app build and rendered page at 375, 390 and 1280 px, light and dark, before and after.

…by the chart edge

The progress timeline put its "Today" label above the plot with a 4 px top
margin, so the chart cut off all but its last pixels at every width. The
chart now reserves the label line plus its gap. Y axes whose ticks outgrew a
fixed width (comparison trend, overview trend and burndown under touch text)
size themselves to their widest tick. The phone-fit browser check now fails
on any chart label its chart clips.
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 12:31am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 12:55 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8e9d1d3

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision, and two points need fixing first.

No current spec governs how these dashboard templates lay out their charts, so an engineering owner needs to accept what this pull request ships (a taller timeline top margin so "Today" shows, and Y axes as wide as their widest tick) by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.

  • width="auto" on the three Y axes (dashboard/page.tsx:528, dashboard-comparison/page.tsx:551, dashboard-progress/page.tsx:900) pushes every Y-axis tick number past the chart's left edge, where it disappears, in astryx experimental render files read without scripts (17 ticks that main shows), because the render measures no layout and the axis shrinks to 8 px; a numeric width that fits the widest tick at the touch text size (about 32, 49 and 56 px) works in both, or the render's chart document could measure tick text.
  • The description says "the other 55 ready page templates", but 57 page templates are ready, so there are 54 others; please change the number.

In the running app the fix works: the new browser check fails on main with exactly the seven clipped labels and passes here.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the timeline's "Today" label shows only a sliver at every width, in the app and in a rendered page. Verified at 390 and 1280 px: it starts 12 to 13 px above the chart's top edge.
  • Claim: 1200K in the comparison trend, and under touch text 100/120 in the overview and 320 pts in the burndown, are clipped. Verified: the new check lists exactly these on main.
  • Claim: a position: 'top' reference-line label sits above the plot, and the 4 px top margin left it outside the chart. Verified: its baseline sits 5 px above the plot.
  • Claim: those Y axes had fixed 30 or 40 px widths narrower than their widest tick. Verified: less the 8 px tick allowance, each left less room than its widest tick at the touch text size.
  • Claim: the timeline's top margin is the label's size plus its gap, from named constants the label also uses. Verified (dashboard-progress/page.tsx, lines 190-191, 690-695 and 722-727).
  • Claim: the clipped axes use width="auto". Verified at all three axes.
  • Claim: the charts package's reference line already keeps its label inside the plot, and these templates call Recharts directly. Verified.
  • Claim: no layout, color or data change beyond the room the labels need. True in the running app; false in rendered files without scripts, where the axes collapse (first blocking point).
  • Claim: after the change every label sits inside its chart at those sizes, in the app and in the rendered file. True in the app and in the rendered file with its script; false without scripts.
  • Claim: the other 55 ready page templates have no clipped chart text. No clipped text, verified; the count is 54 (second blocking point).
  • Claim: the new check failed on an earlier, narrower version of the change. Not checkable: that version is not in the history; the check fails on main and passes here.
  • Claim: one defect, with no new public API, default or interaction model, and no internal context in public text. Verified.
  • Claim: both phone-fit browser cases pass. Verified.
  • Claim: the listed Node tests pass (83 files). Verified: 83 files, 551 tests at this head.
  • Claim: before and after checked in a real browser at 375, 390 and 1280 px, light and dark. Rechecked at 390 and 1280 px in light.
  • Release note: a patch for the CLI package. Verified: the templates ship in it.
  • Release note: the timeline's "Today" label gets room above the plot. Verified.
  • Release note: axes sized to their widest tick no longer clip it. True in the app; false in rendered files without scripts.
  • File .changeset/template-chart-labels-whole.md: overstated for rendered files (first blocking point).
  • File .github/scripts/template-phone-fit.browser.test.mjs: clear.
  • File .github/workflows/ci.yml: clear.
  • File dashboard/page.tsx: blocking (Y-axis width).
  • File dashboard-comparison/page.tsx: blocking (Y-axis width).
  • File dashboard-progress/page.tsx: blocking (burndown Y-axis width); the timeline margin is clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): in the dashboard page templates, the timeline chart has a taller top margin so its "Today" label shows whole, and each Y axis is as wide as its widest tick label, so no tick number is clipped, including in pages rendered without scripts.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 72c5f20

width="auto" sizes the axis from a measured layout, so a page painted
without one (a script-less render) put every tick past the chart edge. Each
axis now has a width that holds its widest tick label at the touch type size.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec faf5c49

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small fix is needed before this can merge; the chart-label fix itself works and has an engineering owner's approval for this head.

  • Miss: .changeset/template-chart-labels-whole.md has no contributor credit line, so check:changesets fails the Lint job at this head; add @josephfarina on its own line after the description.

Both earlier points are fixed: the Y axes now keep every tick visible in rendered files without scripts, and the description's template count is right. Two non-blocking notes stand, both unchanged from main: dashboard-comparison and dashboard-progress grade C on the template rubric, and dashboard-progress/page.tsx is over 1,000 lines. The main CI workflow at this head was cancelled because CI was full, so it needs a re-run (or the next push) before merge.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: the timeline's "Today" label shows only a sliver, in the app and in a rendered page. Verified at 390 and 1280 px: on main it starts 12 px above the chart's top edge.
  • Claim: 1200K in the comparison trend, and under touch text 100/120 in the overview and 320 pts in the burndown, are cut off. Verified for 1200K and 100/120; the new check fails on main for the burndown too, where its ticks also wrap onto two lines.
  • Claim: a top-positioned reference-line label sits above the plot, and the 4 px top margin left it outside the chart. Verified.
  • Claim: those Y axes had fixed 30 or 40 px widths narrower than their widest tick. Verified at the touch text size.
  • Claim: the timeline's top margin is the label's size plus its gap, from named constants the label also uses. Verified (dashboard-progress/page.tsx, lines 190-191, 690-695 and 722-728).
  • Claim: each clipped axis gets a fixed width that holds its widest tick at the touch text size. Verified: 40, 56 and 64 px against about 32, 49 and 56 px needed.
  • Claim: a fixed width is used because an auto width needs a layout pass, which a script-less render does not run. Verified: the earlier auto widths hid every tick in rendered files.
  • Claim: the charts package's own reference line keeps its label inside the plot, and these templates call Recharts directly. Verified.
  • Claim: the smallest restoration is the margin plus axis widths 40 to 64, 40 to 56 and 30 to 40 px. Verified.
  • Claim: no layout, colour or data change beyond the room the labels need. Verified; each axis keeps 7 to 8 px of spare room at the touch text size.
  • Claim: after the change every label sits inside its chart, in the app and in rendered files. Verified at 390 and 1280 px in the app and in rendered files without scripts; the rendered file with its script was not rechecked.
  • Claim: the other 54 ready page templates have no clipped chart text. Verified: the new check passes for every ready template.
  • Claim: the new check failed on an earlier, narrower version of the change. Not checkable: that version is not in the history; it fails on main and passes here.
  • Claim: one defect, with no new public API, default or interaction model, and no internal context in public text. Verified.
  • Claim: both phone-fit browser cases pass. Verified.
  • Claim: the listed Node tests pass (83 files, 547 tests). Verified: 83 files and 551 tests pass at this head.
  • Claim: checked in a real browser at 375, 390 and 1280 px, light and dark. Rechecked at 390 and 1280 px in light.
  • Release note: a patch for the CLI package. Verified: the templates ship in it.
  • Release note: the timeline's "Today" label gets room above the plot. Verified.
  • Release note: Y axes wide enough for their widest tick no longer clip it. Verified.
  • Release note format: false, it has no contributor credit line (the blocking point).
  • File .changeset/template-chart-labels-whole.md: blocking (contributor credit).
  • File .github/scripts/template-phone-fit.browser.test.mjs: clear.
  • File .github/workflows/ci.yml: clear.
  • File dashboard/page.tsx: clear.
  • File dashboard-comparison/page.tsx: clear; the rubric note is unchanged from main.
  • File dashboard-progress/page.tsx: clear; the rubric and page-size notes are unchanged from main.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8e9d1d3

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the main CI run on this head was cancelled because CI was full, so it needs a re-run before merge. The chart-label fix does what the engineering owner approved for this head, and the changeset now carries its contributor credit, so check:changesets and the Lint job pass.

Two non-blocking notes stand, both unchanged from main: dashboard-comparison and dashboard-progress grade C on the template rubric (raw gradient tags and custom StyleX), and dashboard-progress/page.tsx is over 1,000 lines.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: the timeline's "Today" label shows only a sliver, in the app and in a rendered page. Verified: on the base the new check reports it clipped with touch and with a mouse, 12 px above the chart's top edge.
  • Claim: 1200K in the comparison trend, and under touch text 100/120 in the overview and 320 pts in the burndown, are cut off. Verified: the new check on the base lists exactly those labels.
  • Claim: a top-positioned reference-line label sits above the plot, and the 4 px top margin left it outside the chart. Verified.
  • Claim: those Y axes had fixed 30 or 40 px widths narrower than their widest tick. Verified at the touch text size.
  • Claim: the timeline's top margin is the label's size plus its gap, from named constants the label also uses. Verified (dashboard-progress/page.tsx, lines 190-191, 690-695 and 722-728).
  • Claim: each clipped axis gets a fixed width that holds its widest tick at the touch text size. Verified: 40, 56 and 64 px against about 32, 49 and 56 px needed.
  • Claim: a fixed width is used because an auto width needs a layout pass, which a script-less render does not run. Verified: the earlier auto widths hid every tick in rendered files.
  • Claim: the charts package's own reference line keeps its label inside the plot, and these templates call Recharts directly. Verified.
  • Claim: the smallest restoration is the margin plus axis widths 40 to 64, 40 to 56 and 30 to 40 px. Verified.
  • Claim: no layout, colour or data change beyond the room the labels need. Verified; each axis keeps 7 to 8 px of spare room at the touch text size.
  • Claim: after the change every label sits inside its chart, in the app and in rendered files. Verified in the app at this head and in rendered files without scripts at the previous revision, whose template code is identical; the rendered file with its script was not rechecked.
  • Claim: the other 54 ready page templates have no clipped chart text before or after. Verified: on the base the new check flags only the three dashboard templates, and here none.
  • Claim: the new check failed on an earlier, narrower version of the change. Not checkable: that version is not in the history; it fails on the base and passes here.
  • Claim: one defect, with no new public API, default or interaction model, and no internal context in public text. Verified.
  • Claim: both phone-fit browser cases pass. Verified at this head.
  • Claim: the listed Node tests pass (83 files, 547 tests). Verified: 83 files and 551 tests pass at this head.
  • Claim: checked in a real browser at 375, 390 and 1280 px, light and dark. Rechecked at 390 and 1280 px in light.
  • Release note: a patch for the CLI package. Verified: the templates ship in it.
  • Release note: the timeline's "Today" label gets room above the plot. Verified.
  • Release note: Y axes wide enough for their widest tick no longer clip it. Verified at the default and touch text sizes.
  • Release note format: category tag and contributor credit present. Verified: check:changesets passes.
  • File .changeset/template-chart-labels-whole.md: clear.
  • File .github/scripts/template-phone-fit.browser.test.mjs: clear.
  • File .github/workflows/ci.yml: clear.
  • File dashboard/page.tsx: clear.
  • File dashboard-comparison/page.tsx: clear; the rubric note is unchanged from main.
  • File dashboard-progress/page.tsx: clear; the rubric and page-size notes are unchanged from main.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 18, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12252 docs(cli): agent docs name the prop names that differ from other libraries
  Author: Joey Farina <[email protected]>
- #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules
  Author: Joey <[email protected]>
- #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone
  Author: Joey Farina <[email protected]>
- #12316 fix(core): a shorthand never follows its own longhand in one style merge
  Author: josephfarina <[email protected]>
- #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent
  Author: Joey Farina <[email protected]>
- #12349 fix(core): end a mouse drag a sandboxed frame never saw released
  Author: josephfarina <[email protected]>
- #12425 fix(cli): use a stored doc parse only with the zod release that made it
  Author: Joey <[email protected]>
- #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs
  Author: Joey <[email protected]>
- #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label
  Author: Joey Farina <[email protected]>
- #12448 fix(cli): upgrade outside a project names the project, not --from
  Author: Joey Farina <[email protected]>
- #12459 fix(templates): the dashboard scorecard fits a phone screen
  Author: Joey Farina <[email protected]>
- #12428 fix(core): Field labels draw in a bolder face than their description
  Author: Joey Farina <[email protected]>
- #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral
  Author: Joey <[email protected]>
- #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge
  Author: Joey Farina <[email protected]>
- #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons
  Author: Joey Farina <[email protected]>
- #12472 fix(MetadataListItem): a value breaks only a word longer than its line
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12718.

@github-actions
github-actions Bot deleted the josephfarina/rl36-chart-labels-whole branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 8e9d1d3d Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant