Skip to content

fix(charts): line, area and band default to straight segments - #12453

Closed
josephfarina wants to merge 3 commits into
mainfrom
rl16-charts-linear-v2
Closed

josephfarina wants to merge 3 commits into
mainfrom
rl16-charts-linear-v2

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

line() and area() draw every series as a smooth monotone curve unless the page passes curve, and band() always smooths. This changes the default look to straight segments (curve: 'linear'), so a chart reads point to point, as hand-made dashboards usually do; smooth curves read as auto-generated. A band's bounds are straight too, so a band matches the line it surrounds. A line or area that wants the smooth look passes curve: 'monotone', which renders exactly as before.

This is a look change only: monotone never overshoots the two points it joins, so no chart shows wrong values today.

Visual authority

  • Correction already settled by current family, design, theme, or objective accessibility authority.

No current record sets the default curve (checked the records pnpm specs:for lists for the three mark files). Owner decision: straight by default.

Before and after

Real Chromium, one sweep page per theme: Core defaults and every first-party theme (butter, chocolate, gothic, matcha, neutral, stone, y2k), light and dark, 390 and 1280 px, in a Vite app and in a single-file astryx experimental render output (128 views).

Chart on the sweep page Cubic (C) paths before after
Bars only (ChartShowcase block) 0 0, pixel-identical in 32/32 views
Bar + line (ChartTrendComparison block) 1 0
Two lines with dots 2 0
Stacked area 4 0
Band around a line 2 0
A line that sets curve: 'monotone' 1 1, pixel-identical in 32/32 views

Shipped page templates draw their charts with Recharts, so this default does not reach them; the two chart blocks above are the only shipped items that use these marks.

State matrix

Core defaults + 7 first-party themes × light/dark × 390/1280, dev app and rendered file.

Scope

Components: charts line, area, band

  • Appearance is the primary intent.
  • Behavior, API, interaction model, and unrelated layout changes were removed or split.
  • The evidence shows the changed pixels actively running, not only source or computed styles.
  • Public text and artifacts contain no internal Meta context.

Known limit: band() has no curve option, so a band around a line that opts into monotone stays straight. Adding the option is a separate API change.

Docs

Chart.doc.mjs gains one best-practice "Don't" (what astryx component Chart prints in a project with the charts package): "Pass curve: 'monotone' to line() or area() for measured data. Keep the default straight segments, so each value reads as a point joined to the next one; a smoothed curve reads as decoration."

Testing

  • New marks.test.tsx cases: a default line(), area() and band() draw paths with no cubic segments; a line with curve: 'monotone' still draws them.
  • CI=1 charts suite: 12 files, 128 tests pass.

@astryxdesign/charts is private, so there is no changeset.

Writing rubric results

Record touched: component:Chart (FR9 added, the mark-geometry non-goal names FR9, marks.test.tsx added to verified_by).

R1 narration: none; FR9 states what the marks do, in the present tense.
R2 research: none in the record; the theme sweep and judge results live in this description.
R3 evidence: FR9 basis is "owner decision (straight by default); marks tests", no pull request or commit.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.

@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 1:09am 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, 1:24 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1dfd325

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): Charts' line() and area() join points with straight segments unless the series passes curve; curve: 'monotone' opts into a smooth curve. band() joins its bounds with straight segments. The Chart record (FR9) states this, and the marks tests cover it; bar charts and series that set monotone render as before.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1d27f80

@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 CI workflow has not finished on this head yet.

line() and area() now default to straight segments and band() draws straight bounds, as the owner-approved Chart record (FR9) states; the new tests fail against the old default and the charts suite passes.

One non-blocking suggestion:

  • The Chart record still says its decision log is empty and that defaults are unchanged (Chart.spec.md lines 42 and 198), and its verification map has no FR9 row; adding that row and rewording those two lines keeps the record consistent with FR9.
Claims and files checked

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

  • Claim: line and area smoothed with monotone by default and band always smoothed: verified in the base mark sources.
  • Claim: the default is now straight segments (curve: 'linear'): verified, line.tsx:47, area.tsx:56.
  • Claim: band bounds are straight: verified, band.tsx:76.
  • Claim: curve: 'monotone' renders exactly as before: verified, the map entry is unchanged and the Line Curves story is pixel-identical.
  • Claim: monotone never overshoots the two points it joins, so no chart shows wrong values today: verified, d3's monotone curve uses Steffen's method, which is monotone between each pair of points.
  • Claim: no current record sets the default curve: verified, no current record governs chart curve geometry.
  • Claim: bar-only charts are unchanged and smoothed charts lose every cubic segment: consistent with this review's capture (Bar story identical; Line, Area, Band and Composite stories go to zero cubic segments).
  • Claim: page templates chart with Recharts, and the two chart blocks are the only shipped items using these marks: verified (nine page templates import Recharts; ChartShowcase uses bars only, ChartTrendComparison adds one line); docs examples that call line() also straighten.
  • Claim: band has no curve option: verified, band.tsx:18-23.
  • Claim: new tests cover default line, area and band plus a monotone line: verified, marks.test.tsx:175-207; three fail on the old code.
  • Claim: the charts suite passes, 12 files and 128 tests: verified.
  • Claim: the charts package is private, so no changeset: verified, package.json has private: true.
  • Claim: the record adds FR9, names it in the non-goal and adds the marks tests to verified_by: verified, Chart.spec.md:16, :58, :90.
  • Claim: writing rubric results (no narration, no change references, no project status): verified for the added lines; see the non-blocking note on the record's older sentences.
  • File docs/specs/components/Chart/Chart.spec.md: non-blocking note above.
  • File packages/charts/docs/CHARTV2_VERIFICATION_CHECKLIST.md: clear.
  • File packages/charts/src/marks/area.tsx: clear.
  • File packages/charts/src/marks/band.tsx: clear.
  • File packages/charts/src/marks/line.tsx: clear.
  • File packages/charts/src/marks/marks.test.tsx: clear.

Automated review (maintainer link)

| FR6 | `legend=true` MUST derive items from primary series; legend and tooltip config objects MUST enable their surfaces while overriding supported options. | current implementation and focused tests | verify |
| FR7 | The chart MUST expose a named `role="img"`; a supplied subtitle MUST be its description; datasets up to 100 row×series cells MUST also be mirrored in a visually hidden table. | current implementation, WCAG 1.1.1, and accessibility tests | verify |
| FR8 | Root DOM props and `ref` MUST reach the root container while Chart's own SVG name and description remain authoritative. | shared BaseProps convention and focused regression test | verify |
| FR9 | `line()` and `area()` MUST join points with straight segments unless the series passes `curve`; `curve: 'monotone'` opts it into a smooth curve. `band()` MUST join its bounds with straight segments. | owner decision (straight by default); marks tests | decided |

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.

Non-blocking: FR9 records an owner decision, but the record's Verification map has no FR9 row, the Decision log still reads "None. This draft records observed behavior and open gaps only.", and the compatibility line still says defaults stay unchanged. A row such as FR9 | marks.test.tsx default-curve cases | default and monotone line, area, band | a cubic segment in a default path plus a reword of those two sentences keeps the record consistent. The template's review-state words are settled, verify or human decision.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1dfd325

@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 CI workflow has not run on this head, because CI admission turned it away for lack of capacity, so it needs a re-run; Lint passed.

line() and area() now default to straight segments and band() draws straight bounds, as the owner-approved Chart record (FR9) states; the new tests fail against the old default, the charts suite passes, and astryx component Chart prints the new best-practice line.

One non-blocking suggestion, unchanged since the last review:

  • The Chart record still says its decision log is empty and that defaults are unchanged (Chart.spec.md lines 42 and 198), and its verification map has no FR9 row; adding that row and rewording those two lines keeps the record consistent with FR9.
Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none since the last review.
  • Claim: line and area smoothed with monotone by default and band always smoothed: verified in the base mark sources (line.tsx:46, area.tsx:55, band.tsx:76).
  • Claim: the default is now straight segments (curve: 'linear'): verified, line.tsx:47, area.tsx:56.
  • Claim: band bounds are straight: verified, band.tsx:76.
  • Claim: curve: 'monotone' renders exactly as before: verified, the map entry is unchanged (line.tsx:25, area.tsx:27), the monotone test passes on base and head, and the Line Curves story is pixel-identical.
  • Claim: monotone never overshoots the two points it joins, so no chart shows wrong values today: verified, d3's monotone curve limits each tangent so the curve stays between neighbouring points.
  • Claim: no current record sets the default curve: verified, no current record mentions a chart curve, including every record the spec lookup lists for the three marks.
  • Claim: owner decision, straight by default: verified, the owner's comment and an engineering owner's spec approval for this head.
  • Claim: bar-only charts are unchanged and default line, area and band charts lose every cubic segment: consistent with the marks tests and this review's own story captures (the Bar story is identical; the Line, Area and Band stories drop to zero cubic segments).
  • Claim: page templates chart with Recharts, and the two chart blocks are the only shipped items using these marks: verified (nine page templates import Recharts; ChartShowcase uses bars only, ChartTrendComparison adds one line).
  • Claim: band has no curve option: verified, band.tsx:18-23.
  • Claim: Chart.doc.mjs gains one best-practice "Don't" that astryx component Chart prints in a project with the charts package: verified, the command lists it under "Don't" with the quoted wording.
  • Claim: new tests cover default line, area and band plus a monotone line: verified, marks.test.tsx:175-207; the three default cases fail on the old code.
  • Claim: the charts suite passes, 12 files and 128 tests: verified.
  • Claim: the charts package is private, so no changeset: verified, package.json has private: true.
  • Claim: the record adds FR9, names it in the non-goal and adds the marks tests to verified_by: verified, Chart.spec.md:16, :58, :90.
  • Claim: writing rubric results (no narration, no change references, no project status, no open questions added): verified for the added lines; see the non-blocking note on the record's older sentences.
  • Claim: public text contains no internal context: verified over the title, description, branch, commit messages and every added line.
  • File docs/specs/components/Chart/Chart.spec.md: non-blocking note above.
  • File packages/charts/docs/CHARTV2_VERIFICATION_CHECKLIST.md: clear.
  • File packages/charts/src/Chart.doc.mjs: clear.
  • File packages/charts/src/marks/area.tsx: clear.
  • File packages/charts/src/marks/band.tsx: clear.
  • File packages/charts/src/marks/line.tsx: clear.
  • File packages/charts/src/marks/marks.test.tsx: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12680 perf(cli): a template's component line resolves its names in one pass, not one full lookup per name
  Author: Joey <[email protected]>
- #12180 fix(core): Calendar weekday names widen their column instead of overlapping
  Author: Joey <[email protected]>
- #12159 feat(cli): make an icon set inside your own app
  Author: Joey Farina <[email protected]>
- #12383 fix(Grid): a responsive column shrinks to a container narrower than minWidth
  Author: Joey Farina <[email protected]>
- #12374 [fix] Icon: a glyph given as name renders and warns, instead of crashing
  Author: Joey Farina <[email protected]>
- #12453 fix(charts): line, area and band default to straight segments
  Author: josephfarina <[email protected]>
- #12296 fix(core): a neutral Badge in a primary or destructive Button meets 4.5:1 on its fill
  Author: Joey Farina <[email protected]>
- #12395 fix(CodeBlock): without a code string, CodeBlock names the prop and the fix in development
  Author: Joey Farina <[email protected]>
- #12260 fix(cli): `astryx component Flex` names Stack first
  Author: Joey Farina <[email protected]>
- #12391 fix(core): a two-lane Toolbar wraps instead of squeezing its start lane
  Author: Joey Farina <[email protected]>
- #12427 fix(core): checkbox and radio marks keep their share of the box a theme sizes
  Author: josephfarina <[email protected]>
- #12725 [experimental] cli: with no icon set, experimental icon names the discover search where it lists packs
  Author: Joey Farina <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12738.

@github-actions
github-actions Bot deleted the rl16-charts-linear-v2 branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 1dfd325e 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