Repository navigation
feat(charts): add a trendLine utility mark - #14196
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| charts/Chart | 269.9 kB (+12 B) · 529 B CSS (0) | — |
| charts/ChartTooltip | 245.8 kB (+3 B) · 451 B CSS (0) | — |
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 failure; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision for the new trendLine() mark, and on one small record fix.
No current spec covers the mark yet, so an engineering owner (the author may post it as one) approves or amends the draft module:Chart/trendLine record (DEC-1, FR1–FR6) and the reworded spec:AST-115 FR2 by commenting /approve-spec <full head SHA> on this pull request. The decision covers the one-value-per-row input, keeping the mark out of the tooltip, legend, palette, hidden table and accessible name, the dashed secondary-text default, and the widened y domain.
- The writing-rubric result R7 in the description is false, because
docs/specs/components/Chart/modules/trendLine.spec.md:47still says "DEC-1 (pending owner approval)": drop that parenthetical.
Reproduced locally: the charts tests, both typechecks and ESLint pass, the mark stays off every data-series surface, the existing line and reference-line stories render pixel-identical, and the README's mark list could also name trendLine.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the mark adds no tooltip row, row label, hover dot, legend item, palette slot, table column, accessible-name entry or pointer point. Verified: every series consumer in the charts package filters it, the six surface tests pass, and the story probe agrees.
- Claim: points are placed and joined as
line()does them, on numeric and categorical x, with a gap at a missing value and rows in data order. Verified: shared helper and tests. - Claim: the default is a dashed 1.5 px secondary-text stroke, and an optional badge sits at the last point inside the plot. Verified: code, tests and a browser probe.
- Claim: the values widen the y axis, and an explicit
yDomainclips the line. Verified: layout code, a test and the clipped series group. - Claim:
line()andreferenceLine()output is unchanged. Verified: the code moved verbatim, and four sampled stories render pixel-identical. - Claim: the option names reuse existing vocabulary, and the mark takes no format option. Verified: option interfaces read, and the type assertion compiles.
- Claim: Charts is private and canary-only, so no changeset is needed. Verified: package manifest.
- Claim: the import-boundaries size rule governs Core and Lab only. Verified: the record's scope.
- Claim: the stroke meets 3:1 and the label meets 4.5:1 in light and dark, and the reference-line default color does not meet 3:1. Verified: browser probe, at 9.29:1 and 5.65:1 for the stroke, 9.29:1 and 6.29:1 for the label, and 1.48:1 and 1.94:1 for the default.
- Claim: 17 new tests, and the 298-test charts suite passes. Verified: run locally.
- Claim: there are 56 existing chart stories. Verified: count. That all of them render identical markup is reported (four sampled were identical).
- Claim: bundle sizes, red-first mutation runs and other repository checks. Reported.
- Claim: the utility-mark spec rewording changes no rule. Verified in part: the no-format rule is unchanged, and its set gains the trend line, which is part of the spec decision.
- Claim: another utility-mark draft exists only on open pull requests. Unverified; context only.
- Claim: writing rubric R1–R6. Verified. R7: false (record line 47).
- Files:
trendLine.tsx,linePath.ts,annotationLabel.tsx,line.tsx,referenceLine.tsx,types.ts,index.ts,marks/index.ts,trendLine.test.tsx,Annotations.stories.tsxandChart.spec.md: clear. - Files:
trendLine.spec.md: finding at line 47, and it needs the spec decision.AST-115 spec.md: needs the spec decision.
255be16 to
300aec8
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision for the new trendLine() mark, and on one record fix.
An engineering owner (the author may post it as one) approves or amends the draft module:Chart/trendLine record (DEC-1, FR1–FR6, AR1, DD1, with OQ1 on missing values still open) and the reworded spec:AST-115 FR2 by commenting /approve-spec <full head SHA> on this pull request.
- FR5 and the description misstate when the label badge is dropped:
trendLine.tsx:128also drops it when the plot is less than 4 px wider than the badge (with the label "Trend", plots of 45–48 px draw none though the 44.5 px badge fits), so state the 2 px inset in FR5 and the description and pin the bound you keep with a test.
Reproduced locally: the charts tests, both typechecks, ESLint and Prettier pass, the mark stays off every data-series surface, nine existing line and reference-line stories render pixel-identical, and the earlier status note in the record's at-a-glance table is fixed. Optional: FR2's "such as" list reads as examples of compared values, and the README's mark list could name trendLine.
Claims and files checked
Review mode: full; reason: history
- Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, accessible-name entry or pointer point. Verified: every series consumer in the charts package filters it, the seven surface tests pass, and the story probe agrees.
- Claim: drawn with
line(), such a line adds a legend item, a labelled tooltip row, a hover dot, a palette colour and a table column. Verified: code and a side-by-side probe. - Claim: rows are projected and joined as
line()does, on numeric and categorical x and every curve, in data order, with a gap at a missing value today. Verified: shared helper and tests. - Claim: the defaults are a dashed 1.5 px secondary-text stroke with no format option. Verified: code, tests and the type assertion.
- Claim: the badge sits at the last in-plot point that joins a drawn neighbour. Verified: code and tests.
- Claim: the badge is left out only when no such point exists, the stroke width is 0, or the plot is smaller than the badge. False: it is also left out when the plot is less than 4 px wider than the badge (run locally).
- Claim: the values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, and an exact domain clips the line. Verified: layout code and a test.
- Claim:
line()andreferenceLine()output is unchanged. Verified: the code moved verbatim, and nine stories render pixel-identical. - Claim: the option names reuse existing vocabulary and each option has one job. Verified: option interfaces; the authority rule waits on the owner decision above.
- Claim: the spec FR2 rewording keeps the no-format rule. Verified: the rule is unchanged; its list of utility marks becomes open-ended, which the owner decides.
- Claim: the utility-marks module record exists only on open drafts. Verified: not on the main branch; two open drafts carry it.
- Claim: the subtitle is the chart description and the mark adds no table column. Verified: tests and probe.
- Claim: the stroke meets 3:1 and the label 4.5:1 in light and dark, and the reference-line default colour does not meet 3:1. Confirmed locally: 9.29:1 and 5.65:1 for the stroke, 9.29:1 and 6.32:1 for the label, 1.48:1 and 1.94:1 for the default.
- Claim: 22 new tests, and Prettier, ESLint, both typechecks, the charts tests and the knowledge check pass. Verified: run locally (303 tests).
- Claim: Charts is private and canary-only, so no changeset is needed. Verified: package manifest.
- Claim: the import-boundaries size rule does not govern Charts. Verified: the record's scope.
- Claim: the writing-rubric results R1 to R7. Verified: the record has no change references or project status beyond the disclosed pending-Design marker.
- Reported: identical markup for all 56 existing chart stories (the count is verified), bundle sizes, mutation runs, and the other repository checks.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdoptional wording;Chart.spec.mdclear;modules/trendLine.spec.mdFR5 bound;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxbadge bound at line 128;types.tsclear.
c3b800d to
2fbccfa
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision for the new trendLine() mark, and on one wording fix after that.
The draft module:Chart/trendLine record (DEC-1, DEC-2, FR1–FR6, AR1) and the reworded spec:AST-115 FR2 have no approval yet: an engineering owner (the author may post it as one) approves or amends them by commenting /approve-spec <full head SHA> on this pull request. What has to be settled is the mark itself, including joining across rows with no value, its defaults and its exclusion from the data surfaces, and whether trendLine joins FR2's utility marks.
- FR5, the description and the
labelJSDoc say the badge is left out when the plot is too short for it and its inset, buttrendLine.tsx:127and:148keep no vertical inset, so plots 14–17 px tall draw the badge flush with the plot's top edge (reproduced locally); state that the inset is horizontal only, or apply it vertically, and pin the bound with a test.
Reproduced locally: the charts tests (24 new ones included), the charts typecheck, ESLint, Prettier and the knowledge check pass, five existing line and reference-line stories render pixel-identical, and the earlier width-bound and FR2 wording points are fixed.
Claims and files checked
Review mode: full; reason: history
- Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, accessible-name entry or pointer point. Verified: every series consumer in the charts package filters it, the seven surface tests pass, and a browser probe agrees.
- Claim: drawn with
line(), such a line adds a legend item, a labelled tooltip row, a hover dot, a palette colour and, unless another series reads its key, a table column, andline()has no dash option. Verified: code and a side-by-side browser capture. - Claim:
referenceLine()draws only constant x or y positions. Verified: its options. - Claim: rows are projected as
line()projects them, on numeric and categorical x with the same curves, and drawn in data order. Verified: shared helper and tests. - Claim: unlike
line(), the path joins across a row with no value. Verified: code, test and browser capture. - Claim: the defaults are a dashed
6 3, 1.5 px secondary-text stroke, with no format option. Verified: code, tests and the type check. - Claim: the badge anchors to the last in-plot point of a line with two or more finite points, ideally right-aligned above it, clamped into the plot. Verified: code and tests.
- Claim: the badge is left out when no such point exists, the stroke width is 0, or the plot is too narrow or too short for the badge and a small inset. False: no vertical inset is kept, so 14–17 px plots draw it (reproduced locally).
- Claim: the badge width is estimated from the character count. Verified: shared badge code.
- Claim: the values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, and an exact domain is kept with the plot clipping the line. Verified: layout code and a test.
- Claim: values are caller data and the mark adds no x values. Verified: the x domain reads only the x key.
- Claim:
line()andreferenceLine()output is unchanged. Verified: the code moved verbatim, the charts tests pass, and five stories render pixel-identical. - Claim: the FR2 rewording keeps the no-format rule and leaves FR14 and DEC-7 untouched. Verified; whether
trendLinejoins the utility-mark set is the owner decision above. - Claim: the option names reuse existing vocabulary and each option has one job. Verified: sibling mark options.
- Claim: the utility-marks module record exists only on open drafts, scoped to the band colour and error-bar position links. Verified: not on the main branch; two open drafts carry it.
- Claim: the subtitle is the chart description, and the mark exposes no values to assistive technology and adds no table column. Verified: chart markup, tests and probe.
- Claim: 24 new tests. Verified: run locally.
- Claim: Prettier, ESLint, the charts typecheck, the charts tests and the knowledge check pass. Verified: run locally. The Storybook typecheck, spec routing, pre-review and changeset checks are reported.
- Claim: Charts is private and canary-only, so there is no changeset. Verified: package manifest.
- Claim: the import-boundaries size rule governs Core and Lab, not Charts. Verified: the record's scope.
- Claim: the writing-rubric results R1 to R7. Verified: the record carries no change references or project status beyond the disclosed unsettled design intent.
- Reported: real-Chrome checks at desktop and phone widths, the contrast figures, identical markup for all 56 existing chart stories (the count is verified), bundle sizes and mutation runs.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdclear;Chart.spec.mdclear;modules/trendLine.spec.mdFR5 vertical bound;charts/README.mdclear;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxvertical bound at lines 127 and 148;types.tsclear.
2fbccfa to
ada0910
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision for the new trendLine() mark; no other change is needed.
The draft module:Chart/trendLine record (DEC-1, DEC-2, FR1–FR6, AR1) and the reworded spec:AST-115 FR2 need an engineering owner to approve or amend them by commenting /approve-spec <full head SHA> on this pull request, and the author may post it as one. That decision covers the mark itself (one caller-computed value per row, joining across rows with no value, the dashed defaults and badge rules, and staying off the tooltip, legend, palette, hidden table, accessible name and pointer) and FR2's move from a fixed list of utility marks to marks defined by their role. The earlier badge-bound wording point is fixed, and reproduced locally the charts tests, typecheck, ESLint, Prettier and knowledge check pass, with four existing line and reference-line stories rendering pixel-identical.
Claims and files checked
Review mode: full; reason: history
- Claim: drawn with
line(), a computed trend adds a legend item, a labelled tooltip row, a hover dot, a palette colour that can shift other series and, unless another series reads its key, a table column;line()has no dash option. Verified: code and a side-by-side browser capture. - Claim:
referenceLine()draws only constant x or y positions. Verified: its options. - Claim: rows are projected as
line()projects them, on numeric and categorical x with the same curves, and drawn in data order. Verified: shared helper and tests. - Claim: unlike
line(), the path joins across a row with no value. Verified: code, test and browser capture. - Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, accessible-name entry or pointer point. Verified: every series consumer in the charts package, the seven surface tests, and browser and accessibility-tree probes.
- Claim:
line()andreferenceLine()share private helpers with the mark and their output is unchanged. Verified: the code moved verbatim, the charts tests pass, and four stories render pixel-identical. - Claim: the FR2 rewording keeps the no-format rule and leaves FR14 and DEC-7 untouched. Verified; whether
trendLineand role-defined marks join the set is the owner decision above. - Claim: the builder and its options pass the API admission rules, each option has one job, and the names reuse sibling marks' vocabulary. Verified against the options of
line()andreferenceLine(); the current-authority requirement is the owner decision above. - Claim: the utility-marks module record exists only on open drafts, scoped to the band colour and error-bar position links. Verified: absent from the main branch; two open drafts carry it.
- Claim: the defaults are a dashed
6 3, 1.5 px secondary-text stroke with no label, and there is no format option. Verified: code, tests and the type check. - Claim: values are caller data and the mark adds no x values. Verified: the x domain reads only the x key.
- Claim: finite values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, and an exact domain is kept with the plot clipping the line, smoothed overshoot included. Verified: layout code, the clip path and a test.
- Claim: the badge anchors to the last finite in-plot point of a line with two or more finite points, ideally right-aligned above it, clamped into the plot. Verified: code and tests.
- Claim: the badge is left out when no such point exists, the stroke width is 0, or the plot is too narrow for it plus a 2 px inset on each side, or shorter than it, with both bounds pinned by tests. Verified: code and the two bound tests, run locally.
- Claim: the badge width is estimated from the character count. Verified: shared badge code.
- Claim: the subtitle is the chart description, and the mark exposes no values to assistive technology and adds no table column. Verified: chart markup, tests and an accessibility-tree probe.
- Claim: Charts is private and canary-only, so no changeset is needed. Verified: package manifest and the changeset check's private-package rule.
- Claim: the import-boundaries size rule governs Core and Lab, not Charts. Verified: the record's scope.
- Claim: 25 new tests with hand-computed pixel positions. Verified: run locally.
- Claim: Prettier, ESLint, the charts typecheck, the charts tests and the knowledge check pass. Verified: run locally. The Storybook typecheck, spec routing, pre-review and changeset checks are reported.
- Claim: the writing-rubric results R1 to R7. Verified: the record carries no approval status, change references, research or open questions beyond the disclosed unsettled design intent.
- Reported: real-Chrome checks at desktop and phone widths, the contrast figures, identical markup for all 56 existing chart stories (the count is verified), bundle sizes and mutation runs.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdclear;Chart.spec.mdclear;modules/trendLine.spec.mdclear;charts/README.mdclear;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxclear;types.tsclear.
|
/approve-spec ada0910 |
There was a problem hiding this comment.
Changes requested: the engineering owner's approval settles the trendLine() design, and two record and description fixes remain; no code change is needed.
- The approved contract is still recorded as a draft:
module:Chart/trendLinekeepsauthority: draftandapproved_by: null, butspec:AST-002DEC-5 says an approval does not replace recording the accepted contract as current, so setauthority: current,approved_by: marie-lucasandapproved_at, changereferencesfromspec:AST-115/FR2tospec:AST-115(the knowledge check rejects that form in a current record), post a fresh/approve-specfor the new head, and update the description passages that call the record a draft. - Regression: The record-placement note calls both utility-marks pull requests drafts, but #14152 has been ready for review since December 3, so it should say the record exists only on open pull requests (#14151 and #14152 on top of it), not on
main.
Reproduced locally, the charts tests, the knowledge check and Prettier pass, and six existing line and reference-line stories render pixel-identical; CI's typecheck and lint pass on this head, and the heavy suites run once review passes.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
- Claim: drawn with
line(), a computed trend adds a legend item, a labelled tooltip row, a hover dot, a palette colour that can shift the real series and, unless another series reads its key, a table column;line()has no dash option. Verified: code and side-by-side captures. - Claim:
referenceLine()draws only constant x or y positions. Verified: its options. - Claim: the mark projects rows as
line()does on numeric and categorical x with the same curves and draws through the finite points in data order, dashed by default. Verified: shared helper and tests. - Claim: unlike
line(), the path joins across a row with no value. Verified: code, test and capture. - Claim: an optional badge sits at the last finite in-plot point of a line with two or more finite points, right-aligned above it when room permits, clamped into the plot. Verified: code and tests.
- Claim: the badge is left out when no such point exists, the stroke width is 0, or the plot is narrower than the badge plus 2 px on each side, or shorter than it, with both bounds pinned by tests. Verified: code and the two bound tests, run locally.
- Claim: the badge width is estimated from the character count. Verified: shared badge code.
- Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, default accessible-name entry or pointer point. Verified: every series consumer in the charts package, seven tests and browser probes.
- Claim:
line()andtrendLine()share one private point-and-path helper, andline()output is unchanged. Verified: code moved verbatim, charts tests and two line stories pixel-identical. - Claim:
referenceLine()'s badge moves to a shared helper with output and appearance unchanged. Verified: code moved verbatim and three reference-line stories pixel-identical. - Claim: a new draft record contracts the mark, the Chart record lists it, and the value-format FR2 now defines utility marks by role with
trendLineas an example. Verified. - Claim: the record decides DEC-1 and DEC-2 as summarised. Verified.
- Claim: the FR2 rewording keeps the no-format rule, leaves FR14 and DEC-7 untouched and is owner-gated. Verified; an engineering owner approved this head.
- Claim: the builder and its options pass the API admission rules, each option has one job and the names reuse sibling marks' vocabulary. False until the record is current (first finding); options and names verified.
- Claim: the utility-marks module record exists only on open draft pull requests and scopes itself to the band colour and error-bar position links. False for #14152 (second finding); the scope is verified.
- Claim: new exports
trendLineandTrendLineOptionswith the stated defaults and no format option. Verified: code, tests and CI typecheck. - Claim: values are caller data and the mark adds no x values. Verified: the x domain reads only the x key.
- Claim: finite values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, an exact domain is kept and the plot clips overshoot. Verified: layout code, clip path and test.
- Claim: the subtitle is the chart's description in the DOM, and the mark exposes no values to assistive technology and adds no table column. Verified: markup, test and browser probes.
- Claim: additive, with no existing mark or chart changed. Verified: no other series type uses the name, and six existing stories render pixel-identical.
- Claim: Charts is private and canary-only, so no changeset. Verified: manifest and the changeset check's private-package rule.
- Claim: the import-boundaries size rule governs Core and Lab, not Charts. Verified: the record's scope.
- Claim: 25 new tests with hand-computed positions covering the listed path, style, badge, domain, description and surface cases. Verified: run locally.
- Claim: Prettier, ESLint, the typechecks, the charts tests and the knowledge check pass. Verified: run locally or in CI; the Storybook typecheck, spec routing, pre-review and changeset checks are reported.
- Claim: the scope checklist and the writing-rubric results R1 to R7. Verified at this head.
- Reported: real-Chrome checks at desktop and phone widths, the contrast figures, identical markup for all existing chart stories, bundle sizes and mutation runs.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdclear;Chart.spec.mdclear;modules/trendLine.spec.mdfirst finding;charts/README.mdclear;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxclear;types.tsclear.
trendLine(dataKey, options) draws an annotation through one value per data row: a fitted trend, a moving average, a forecast or a target path that the caller computes. It projects rows as line() does, on numeric and categorical x, and draws a dashed path through the finite projected points in data order. Unlike line(), it joins across a row with no value, because on an annotation a missing row states no value; it keeps line()'s curves. An optional label badge sits at the line's last visible point and is left out when the line has fewer than two finite points, no point is visible, the stroke width is 0, or the plot is less than 4px wider than the badge. It is a utility mark: it adds no tooltip row, row label or hover dot, no derived legend item, no palette slot, no data-table column, no name in the default accessible name and no pointer point. Its finite values take part in the automatic y domain like a series' values; an exact yDomain keeps the data's own scale. The stroke and label default to the secondary text color, proposed pending Design review. line() and trendLine() share one private point and path helper, and referenceLine() and trendLine() share one private label badge; line() and referenceLine() render the same output as before. The new module:Chart/trendLine draft record contracts the mark (DEC-1) and its missing-value, curve and y-domain behavior (DEC-2). The draft component:Chart record lists it, and spec:AST-115 FR2 now describes utility marks by their role, with trendLine among its examples. An Annotations story shows a scatter with a trend line, and the charts README lists the mark.
ada0910 to
c39aeda
Compare
|
/approve-spec c39aeda |
There was a problem hiding this comment.
Approval waits on an engineering owner re-approving the trendLine() spec content at this head; no code change is needed.
The earlier /approve-spec named the previous head, and this push changed the approved content of module:Chart/trendLine (its references entry, the review-state column and FR5's state), so the spec gate no longer counts it. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
- The description says the record was approved at this head: the Current specification section ("approved it with
/approve-specat this pull request's head") and the Supporting bullet ("current after the engineering owner's approval") are not true until that re-approval lands, which makes them true with no edit.
Both findings from the last review are fixed; reproduced locally, the charts tests and the knowledge check pass and six existing line and reference-line stories render pixel-identical, and CI's typecheck and lint pass on this head.
Claims and files checked
Review mode: full; reason: history
- Claim: drawn with
line(), a computed trend adds a legend item, a labelled tooltip row, a hover dot, a palette colour that can shift the real series and, unless another series reads its key, a table column;line()has no dash option. Verified: code and side-by-side captures. - Claim:
referenceLine()draws only constant x or y positions. Verified: its options. - Claim: the mark projects rows as
line()does on numeric and categorical x with the same curves and draws a dashed path through the finite points in data order. Verified: shared helper, tests and captures. - Claim: unlike
line(), the path joins across a row with no value. Verified: code, test and capture. - Claim: an optional badge sits at the last finite in-plot point of a line with two or more finite points, right-aligned above it when room permits and clamped into the plot. Verified: code and tests.
- Claim: the badge is left out when no such point exists, the stroke width is 0, or the plot is narrower than the badge plus 2 px on each side, or shorter than it, with both bounds pinned by tests. Verified: code and the two bound tests, run locally.
- Claim: the badge width is estimated from the character count. Verified: shared badge code.
- Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, default accessible-name entry or pointer point. Verified: every utility-mark filter in the charts package, seven tests, browser probes and the accessibility tree.
- Claim:
line()andtrendLine()share one private point-and-path helper, andline()output is unchanged. Verified: code moved verbatim, charts tests and two line stories pixel-identical. - Claim:
referenceLine()'s badge moves to a shared helper with output and appearance unchanged. Verified: code moved verbatim and four stories that draw reference lines pixel-identical. - Claim: the new record is current after the engineering owner's approval. False at this head (the finding).
- Claim: the Chart record lists the module, and the value-format FR2 now defines utility marks by role with
trendLineas an example. Verified. - Claim: the record is current, approved by the author, and was approved with
/approve-specat this head. False at this head (the finding); the frontmatter is as stated. - Claim: the record decides DEC-1 and DEC-2 as summarised. Verified.
- Claim: the FR2 rewording keeps the no-format rule, leaves FR14 and DEC-7 untouched and is owner-gated. Verified; the gate is waiting for the re-approval.
- Claim: the builder and its options pass the API admission rules, each option has one job and the names reuse sibling marks' vocabulary. Options and names verified; the recorded-authority rule is met once the re-approval lands.
- Claim: the utility-marks module record exists only on the two open stacked pull requests, not on
main, and scopes itself to the band colour and error-bar position links. Verified. - Claim: new exports
trendLineandTrendLineOptionswith the stated defaults and no format option. Verified: code, tests and CI typecheck. - Claim: values are caller data and the mark adds no x values. Verified: the x scale reads only the x key.
- Claim: finite values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, an exact domain is kept and the plot clips overshoot. Verified: layout code, clip path and test.
- Claim: rows draw in data order. Verified.
- Claim: the subtitle is the chart's description, and the mark exposes no values to assistive technology and adds no table column. Verified: markup, test and accessibility tree.
- Claim: additive, with no existing mark or chart changed. Verified: six existing stories render pixel-identical.
- Claim: Charts is private and canary-only, so no changeset. Verified: manifest and the changeset check's private-package rule.
- Claim:
referenceLine()'s default colour is the emphasized border colour. Verified. - Claim: the import-boundaries size rule governs Core and Lab, not Charts. Verified: the record's scope.
- Claim: 25 new tests with hand-computed positions covering the listed path, style, badge, domain, description and surface cases. Verified: run locally.
- Claim: Prettier, ESLint, the typechecks, the charts tests and the knowledge check pass. Verified: charts tests and knowledge check run locally, lint and typecheck in CI; the Storybook typecheck, spec routing, pre-review and changeset checks are reported.
- Claim: the scope checklist and the writing-rubric results R1 to R7. Verified at this head.
- Reported: real-Chrome checks at desktop and phone widths, the contrast figures, identical markup for all existing chart stories, bundle sizes and mutation runs.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdclear;Chart.spec.mdclear;modules/trendLine.spec.mdthe finding's anchor;charts/README.mdclear;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxclear;types.tsclear.
There was a problem hiding this comment.
Approved pending CI: the heavy CI suites have not run on this head yet; they start once this review passes, and merging needs them green.
The engineering owner's /approve-spec for this head settles the trendLine() contract and the reworded value-format rule, so the description's approval sentences now hold and no change is needed. Reproduced locally, the charts tests and the knowledge check pass and existing line and reference-line stories render pixel-identical; CI's typecheck and lint pass on this head.
Claims and files checked
Review mode: same-head; reason: none
- Claim: drawn with
line(), a computed trend adds a legend item, a labelled tooltip row, a hover dot, a palette colour that can shift the real series and, unless another series reads its key, a table column;line()has no dash option. Verified: code and side-by-side captures. - Claim:
referenceLine()draws only constant x or y positions. Verified: its options. - Claim: the mark projects rows as
line()does on numeric and categorical x with the same curves and draws a dashed path through the finite points in data order. Verified: shared helper, tests and captures. - Claim: unlike
line(), the path joins across a row with no value. Verified: code, test and capture. - Claim: an optional badge sits at the last finite in-plot point of a line with two or more finite points, right-aligned above it when room permits and clamped into the plot. Verified: code and tests.
- Claim: the badge is left out when no such point exists, the stroke width is 0, or the plot is narrower than the badge plus 2 px on each side, or shorter than it, with both bounds pinned by tests. Verified: code and the two bound tests, run locally.
- Claim: the badge width is estimated from the character count. Verified: shared badge code.
- Claim: the mark adds no tooltip row, row label, hover dot, derived legend item, palette slot, table column, default accessible-name entry or pointer point. Verified: every utility-mark filter in the charts package, the pointer path, seven tests and browser probes.
- Claim:
line()andtrendLine()share one private point-and-path helper, andline()output is unchanged. Verified: code moved verbatim, charts tests and two line stories pixel-identical. - Claim:
referenceLine()'s badge moves to a shared helper with output and appearance unchanged. Verified: code moved verbatim and two stories that draw reference lines pixel-identical. - Claim: the new record is current after the engineering owner's approval, which was given with
/approve-specat this head. Verified: the record's front matter and the owner's comment naming this head. - Claim: the Chart record lists the module, and the value-format FR2 now defines utility marks by role with
trendLineas an example. Verified. - Claim: the record decides DEC-1 and DEC-2 as summarised. Verified.
- Claim: the FR2 rewording keeps the no-format rule, leaves FR14 and DEC-7 untouched and is owner-gated. Verified.
- Claim: the builder and its options pass the API admission rules, each option has one job and the names reuse sibling marks' vocabulary. Verified: options, names and the recorded contract.
- Claim: the utility-marks module record exists only on the two open stacked pull requests, not on
main, and scopes itself to the band colour and error-bar position links. Verified. - Claim: new exports
trendLineandTrendLineOptionswith the stated defaults and no format option. Verified: code, tests and CI typecheck. - Claim: values are caller data and the mark adds no x values. Verified: the x scale reads only the x key.
- Claim: finite values join the automatic y domain, a shared key counts once, a stacked key counts through its stack, an exact domain is kept and the plot clips overshoot. Verified: layout code, clip path and test.
- Claim: rows draw in data order. Verified.
- Claim: the subtitle is the chart's description, and the mark exposes no values to assistive technology and adds no table column. Verified: markup, test and accessibility tree.
- Claim: additive, with no existing mark or chart changed. Verified: four existing stories render pixel-identical.
- Claim: Charts is private and canary-only, so no changeset. Verified: package manifest.
- Claim:
referenceLine()'s default colour is the emphasized border colour. Verified. - Claim: the import-boundaries size rule governs Core and Lab, not Charts. Verified: the record's scope.
- Claim: 25 new tests with hand-computed positions covering the listed path, style, badge, domain, description and surface cases. Verified: run locally.
- Claim: Prettier, ESLint, the typechecks, the charts tests and the knowledge check pass. Verified: charts tests and knowledge check run locally, lint and typecheck in CI; the Storybook typecheck, spec routing, pre-review and changeset checks are reported.
- Claim: the scope checklist and the writing-rubric results R1 to R7. Verified.
- Reported: real-Chrome checks at desktop and phone widths, the contrast figures, identical markup for all existing chart stories, bundle sizes and mutation runs.
- Files:
Annotations.stories.tsxclear;AST-115-chart-value-format/spec.mdclear;Chart.spec.mdclear;modules/trendLine.spec.mdclear;charts/README.mdclear;charts/src/index.tsclear;marks/annotationLabel.tsxclear;marks/index.tsclear;marks/line.tsxclear;marks/linePath.tsclear;marks/referenceLine.tsxclear;marks/trendLine.test.tsxclear;marks/trendLine.tsxclear;types.tsclear.
User need
A chart often carries a line that annotates the data instead of plotting values a reader compares: a fitted trend through a scatter, a moving average, a forecast, or a target path. Today the only way to draw one is
line().referenceLine()draws only constant x or y values, so a sloped or curved line has to be aline()series.line()has no dash option, so it draws like data.Problem and solution fit
trendLine(dataKey, options?).line()does (numeric and categorical x, the samecurvevalues) and draws a dashed path through the finite projected points in data order. Unlikeline(), it joins across a row with no value.line()andtrendLine()share one private point and path helper (marks/linePath.ts), so the two cannot drift.line()output is unchanged.referenceLine()'s private label badge moves tomarks/annotationLabel.tsxsotrendLine()reuses it.referenceLine()'s output and appearance are unchanged.module:Chart/trendLinerecord, current after the engineering owner's approval, contracts the mark.component:Chartrecord lists the module.spec:AST-115FR2 now describes utility marks by their role, with examples that includetrendLine.trendLinein the charts README's list of marks.Current specification
module:Chart/trendLine(new,authority: current,approved_by: marie-lucas, Decidermarie-lucas) decides the mark with FR1–FR6. The engineering owner approved it with/approve-specat this pull request's head:line()'s curves, and counts its finite values toward the automatic y domain.spec:AST-115FR2 (current): utility marks take no format, because neither the tooltip nor the data table shows them.band,errorBar,referenceLine, andtrendLine, annotate the data rather than plot values a reader compares") and changes no rule.spec:AST-002(current): the new builder and its options pass its admission rules. Each option keeps one responsibility, and the names reuse existing vocabulary (color,curveandstrokeWidthas online();strokeDasharrayandlabelas onreferenceLine()).Record placement:
module:Chart/utilityMarksexists only on open pull requests (#14151, and #14152 on top of it), not onmain, and it scopes itself to the band color link and the error-bar position link. The trend line contract does not overlap those links, so it lives in its own module record undercomponent:Chart, which can merge into a utility-marks record later.Public delta and caller burden
New exports from
@astryxdesign/charts:trendLineandTrendLineOptions.colorvar(--color-text-secondary)curve'linear'line()strokeWidth1.5strokeDasharray'6 3'labelBehavior the caller needs to know:
curvecan still overshoot the domain; the plot clips the mark to the plot rectangle.yDomainkeeps the data's own scale; the plot then clips the line.line(), the path joins its finite points across a row with no value: on an annotation, a missing row states no value. So with the default linear curve, values on two distant rows draw one straight segment, and a moving average or a forecast with missing rows is drawn across them. Where a visible gap matters, draw two marks.line(), so scatter rows sort by x first.strokeWidthis 0, or when the plot is too narrow for the badge and a small horizontal inset (today 2px on each side), or shorter than the badge. Both bounds are pinned by tests.subtitle, which the chart associates with the chart image as its description in the DOM, or in visible text beside the chart.formatValue: utility marks take no format (spec:AST-115FR2).Compatibility: additive. No existing mark or chart changes. Charts is private and canary-only, so there is no Changeset.
Design and alternatives
line()'s gaps (DEC-2): a forecast or target path often states values on only some rows, and a gap at each missing row would draw nothing between them.line()option:line({annotation: true})would make one input switch the legend, tooltip, palette and table behavior together.referenceLine()shape:referenceLinetakes constant positions, not a data key, so a data-key input would change what its options mean.trendLinenames the common job. A moving average and a forecast are trends, and a target path is a planned one. Broader names either overlapreferenceLine(annotationLine) or add vocabulary (overlayLine). The owner can rename it before release.subtitle, and a second source on the same image would need its own ordering and wording rules.--color-border-emphasized,referenceLine()'s default, is under 3:1 against the plot in both modes, so the mark does not reuse it.referenceLine()'s own look is unchanged.Out of scope: computing a fit (a later value source for this mark), confidence bands, equation or R² labels, and any change to
referenceLine(),band(),errorBar()or existing tooltip behavior.Evidence
Verified in real Chrome at desktop 1280 and phone 390, light and dark; screenshots not attached.
Charts/*stories at desktop light, including everyline()andreferenceLine()story. Per-render ids are normalized.Bundle size, re-measured at this head with esbuild 0.28.2: a minified ESM production bundle of the built package, React, Core and StyleX external,
gzip -9 -n. Each page importsChartplus the marks named.line(): +307 B over Chart + line; not a marginal costline()also uses). DEC-2 records this as an accepted cost of keeping curves. The mark's own modules add 1,798 minified bytes before compression (trendLine 856, the shared badge 523, the shared path helper 419).architecture:component-import-boundariesINV10 governs Core and Lab, not Charts, so its 0.3 KB bar is a comparison only.Scope
Components: Chart (marks: trendLine, line, referenceLine)
Testing
New
marks/trendLine.test.tsx, 25 tests. Expected pixel positions come from scale math done by hand:x / 10 × 528and244 − y / 10 × 244on an exact domain, and band centers99, 264, 429for three categories with padding 0.2. They never come from the mark.color,strokeWidth,strokeDasharrayandcurve; noformatValueoption (type assertion).Red arms. Each mutation of the mark, or of the code that implements the rule, fails its target tests; each was restored afterwards:
colorfails the options test.formatValueto the options fails the charts type check.Checks: Prettier, ESLint (
--max-warnings=0), the charts and Storybook typechecks, the charts Vitest suite,pnpm check:knowledge,pnpm specs:for --diff origin/main,pnpm review:preandpnpm check:changesetspass.Writing rubric results
Records changed:
module:Chart/trendLine(new, current),component:Chart(draft;modules:lists the new module) andspec:AST-115(FR2's utility-mark sentence). The charts README liststrendLineamong the marks.line()takes a palette color or a table column instead of claiming it always does.approved_byandapproved_at, and the dashed default appears only as unsettled design intent, with no design-decision row.