Repository navigation
fix(plugin-charts): a report or dashboard chart's value axis prints a whole-scale percent and a currency measure in the measure's units - #37194
Conversation
… and currency units WIP: carrier, formatter, producers. Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…cases Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
… two carrier copies in step Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for L1 (fix round 1) · area a4-U · 2026-11-25T04:50Z
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
…art-axis-measure-format Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…ngs, and pins for the producers' transposed and comparison branches Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for the delta read (fix round 2) · area a4-U · 2026-11-25T05:49Z
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Landing · area a4-U · 2026-11-25T05:51Z · head
State change: ready for review + auto-merge armed; the queue lands it. On MERGED the card #37053 closes through |
Fixes #37053
Clause-②: yes
Metadata-protocol: none
维护者速读
What changes
Route B of the card, as the seat chose it: an internal value-format carrier beside the internal series props. No spec change. The report and dashboard producers fill the carrier; it is not meant to be authored, and #37214 refuses it on static chart nodes.
series[].measureFormatcarries the measure's{ format, currency, percentScale }. It sits on the chart renderer's internal series props, besideseries[].aggregate, and follows that key's precedent: the report and dashboard producers fill it from the dataset answer, and it is not meant to be authored (@object-ui/types: the static chart node's loose ChartDataSeriesSchema accepts the renderer-internal series[].measureFormat carrier instead of refusing it by name like aggregate #37214 refuses it on static chart nodes). Three places hold it:MeasureValueFormatandNormalizedSeries.measureFormatinnormalizeChartSchema.ts;normalizeSeries, which keeps the carrier's three keys and nothing else;dataKeyarm ofChartRendererProps.schema.series.valueAxisTickFormatterinAdvancedChartImpl.tsx). The order is a declared axisformatfirst (formatterFor, unchanged), then the measure's units, then the compact default. An axis uses a carrier only when every series bound to it carries the same one and that carrier names a unit, either a currency or a%pattern (sharedMeasureFormat). This is the same all-or-nothing ruleplotsWholeNumbersapplies toaggregate. Data labels print with their axis' formatter (objectstack#27372), so they carry the units too.formatMeasurefrom@object-ui/core, the function the table uses, at the column's ownpercentScale. The pattern's places are the minimum and grow to the step's place (theformatterForrule), so two ticks never share a label. Awholerate of 33.3 now reads0.0%…36.0%.CN¥3K…CN¥12Kinen,¥30万inzh-CN).compactTickFormattergains an optionalcurrencyargument. IfIntlrefuses the code, the tick falls back to the plain compact number.DatasetReportRenderer.tsx(measureFormatCarrier) gives every drawn series the measure's facts. That covers aseriesBysplit and the earlier-window series too.DatasetWidget.tsxgives each series the facts of the measure it plots. A pivot uses its one measure; any other series uses its own measure or that measure's earlier window. The dimensionless (transposed) series carries a carrier only when every measure formats alike.measureCellCurrency(field)with no row. That is the currency the table prints a cell with when the cell has no row of its own.currencyFieldhas no single axis currency.measureCellCurrencyreturns none for it, so its carrier holds no currency and its axis keeps the plain-number default. The pin for this is the control in each test file.yAxis[0].formatfor a fraction-scale percent, and a declared axis format outranks the carrier. ThepercentAxisFormatdocblock now points to the carrier.Responsibility: whose code is it? The platform's own
@object-ui/plugin-chartsvalue axis, whoseformatkey carries only a d3 pattern. Is there an existing platform path? None: the table'sformatMeasurepath never reaches the chart axis. Who reaches it? Every report or dashboard chart over a whole-scale percent or currency measure.Tests
The pins live in the shared harness of each mechanism, as AGENTS.md's ruling record 6583487846 asks: each is a new top-level
describefor objectstack#37053 in the file that already holds the neighbouring pin. Each SUBJECT is red with this card's source files at theirmainblobs and green after (see Verification).ui/packages/plugin-charts/src/AdvancedChartImpl.axisLabels.test.tsx, the axis-tick harness that holds the objectstack#36988 pin. It builds a real chart throughnormalizeChartSchema, with the series carrier as a producer hands it.['0.0%', '9.0%', '18.0%', '27.0%', '36.0%']. Each tick equalsformatMeasure(tick, '0.0%', undefined, 'whole', 'en'), and the table's33.3%is the same function's output.CNYmeasure's ticks are['CN¥0', 'CN¥3K', 'CN¥6K', 'CN¥9K', 'CN¥12K'], aUSDmeasure's are['$0', '$3K', '$6K', '$9K', '$12K'], and aCNYmeasure in azh-CNsession reads['¥0', '¥30万', '¥60万', '¥90万', '¥120万'].['0', '3K', '6K', '9K', '12K'].formatwins over the carrier:yAxis: [{ format: '0,0' }]over aCNYmeasure reads0…12,000with noCN¥. This pin goes red when the order invalueAxisTickFormatteris swapped (see Verification);yAxis[0].formatpath still reads0.0%…34.0%beside its carrier (PR fix(plugin-report): a report chart's value axis reads a percent measure in percent, and two value-axis ticks never share a label #37051);'0%'pattern on a 0.85-point step reads0.00%…3.40%;33.3%;ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.chartChrome.test.tsx, the report chart-schema harness that holds the objectstack#36988 pin. It checks the schema the registered chart receives:33.3%beside it and still noyAxis;CNYmeasure;seriesByseries carrying the carrier;yAxis[0].format;plugin-reportdoes not depend onplugin-charts, so this pin stops at the schema. The chart harness above draws it, the same split the objectstack#36988 pin uses.ui/packages/plugin-dashboard/src/__tests__/DatasetWidget.integerMeasureTicks-11681.test.tsx, the widget value-axis harness that holds theaggregatecarrier's pins. It renders the real chain (DatasetWidget→SchemaRenderer→chart→AdvancedChartImpl, no stub) and pins:0.0%…36.0%, equal toformatMeasure);CNYwidget (CN¥0…CN¥12K);0…12K);0.0%…36.0%, and its control, a percent beside a currency, keeps plain numbers;compareColumn) carries its measure's format, so the axis keeps0.0%…36.0%with both windows drawn.ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.comparePrevious-36645.test.tsx, the report compare harness: with 「Compare with previous period」 on, both the current and theamount__compareseries carry theCNYcarrier, and a measure with no format facts gives neither series one (the control).ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.measureFormatCarrierParity-37053.test.tskeeps the two copies ofmeasureFormatCarrierin step. A shared copy would belong in@object-ui/core, which is outside this card's surface, so this pin holds them together instead. The pin has two halves:No harness exists for a cross-producer pin, so this one has its own file.
Acceptance notes
formatMeasure" wording for this one unit, ruled A by the maintainer: 7153146695).formatMeasurehas no compact notation. Its amount is the width of a cell (CN¥12,000.00inen,CN¥1,200,000.00for a pipeline total), and every vertical value axis is drawn 48 px wide (VALUE_AXIS_WIDTH_PX). The leading symbol is the part that would be cut off. Widening the axis band was not taken because the 48 px figure feeds the plot-width fit (categoryLabelsFitBand) and theX_AXIS_ALL_LABELS_MAX_BUCKETSderivation. The compact reading with the symbol is the convention the axis already uses for every amount. The maintainer ruled this compact form, with the symbol from the sameIntlsource the table uses (7153146695). The pins are the fixed-ISO currency cases above (CN¥0…CN¥12K). Routing currency ticks throughformatMeasurewith anotationoption on@object-ui/coreis a follow-up card (@object-ui/core: a compact notation option on formatMeasure, so chart axes and tables share one source for compact currency amounts #37224).%pattern and a single currency. A measure with a plain numeral pattern (no%, no currency, e.g.'0,0.00') keeps the compact default (1.2M), as before; its carrier names no unit the axis prints, sosharedMeasureFormatpasses it by.formatMeasureprints a pattern's places as a fixed width. So a percent axis whose step needs more places than the pattern prints trailing zeros (0.00%…3.40%), whereformatterForwould print0%…3.4%. The labels stay distinct and each one is the table's reading of that number.series[].measureFormatin@object-ui/typesis not in this PR; it is @object-ui/types: the static chart node's loose ChartDataSeriesSchema accepts the renderer-internal series[].measureFormat carrier instead of refusing it by name like aggregate #37214. Refusing a key that the published looseChartDataSeriesSchemaaccepts narrows what an author can write. That isClause-②: yes (narrowing)withMetadata-protocol: narrowed, and under ADR-0087 it owes a semantic ledger entry underpackages/spec/src/migrations/entries/semantic/. Seat repo:objectstack#4 ruled to keep this PR non-breaking (widening only), with no spec change. The refusal, its pin and the drafted ledger entry go to @object-ui/types: the static chart node's loose ChartDataSeriesSchema accepts the renderer-internal series[].measureFormat carrier instead of refusing it by name like aggregate #37214, which carries its own L2 and dogfood run. Until @object-ui/types: the static chart node's loose ChartDataSeriesSchema accepts the renderer-internal series[].measureFormat carrier instead of refusing it by name like aggregate #37214 lands, the carrier is author-writable on a static SDUI chart node: a hand-writtenmeasureFormatthere is honoured. The spec's strictChartSeriesSchemaalready refuses the key.measureFormatCarrieris written twice, once in each producer. Its shared home (@object-ui/core, besidebuildChartSeries'aggregateOf) is outside this card's file surface, so the two copies are exported from their modules (not from either package's entry), cross-referenced in their docblocks, and held identical by the parity pin above.NormalizedSeriesand its readernormalizeSeriesinnormalizeChartSchema.ts, and thedataKeyarm inChartRenderer.tsx. Those are whereseries[].aggregate, the named precedent, lives. The pure formatter helpers (sharedMeasureFormat,measureTickFormatter, and thecurrencyargument ofcompactTickFormatter) sit in the same file, besideformatterForandcompactTickFormatter.ObjectChartoveraggregate) fill no carrier;Verification
Two-minute check:
cd ui && pnpm --filter @object-ui/plugin-charts exec vitest run --root ../.. --maxWorkers=2 packages/plugin-charts/src/AdvancedChartImpl.axisLabels.test.tsx packages/plugin-report/src/__tests__/DatasetReportRenderer.chartChrome.test.tsx packages/plugin-report/src/__tests__/DatasetReportRenderer.comparePrevious-36645.test.tsx packages/plugin-report/src/__tests__/DatasetReportRenderer.measureFormatCarrierParity-37053.test.ts packages/plugin-dashboard/src/__tests__/DatasetWidget.integerMeasureTicks-11681.test.tsx. Expect 5 files and 85 tests to pass, among them the objectstack#37053 describes reading0.0%…36.0%,CN¥0…CN¥12K,$12Kand¥30万.Read first, in order of risk:
ui/packages/plugin-charts/src/normalizeChartSchema.ts:measureTickFormatter(the places rule at the displayed scale) andsharedMeasureFormat(when an axis takes a carrier).ui/packages/plugin-dashboard/src/DatasetWidget.tsx:seriesMeasureFormat(which measure a series plots, including the transposed and comparison series).ui/packages/plugin-charts/src/AdvancedChartImpl.tsx: the precedence invalueAxisTickFormatter.Package suites and type-check at 8816da6 (after merging origin/main)
pnpm --filter @object-ui/plugin-charts exec vitest run --root ../.. --maxWorkers=2 packages/plugin-charts/ packages/plugin-report/ packages/plugin-dashboard/ packages/types/: Test Files 749 passed (749), Tests 14386 passed, 22 skipped. Exit 0, run under the verify lock.pnpm --filter @object-ui/types --filter @object-ui/plugin-charts --filter @object-ui/plugin-report --filter @object-ui/plugin-dashboard run type-check(all four script names echoed): exit 0.Ablations and red on main
Both ablation legs ran under the verify lock at HEAD 8816da6, over the five harness files in the two-minute check (85 tests). Each leg was restored to blob 4811aff6 == HEAD, with
git diff HEADempty.scripts/ablation-replace.mjsdeleted?? measureTickFormatter(sharedMeasureFormat(plotted), displayLocale, exponent)fromAdvancedChartImpl.tsx(anchor 1 → 0, blob 4811aff6 → 4faad709). Result: 11 failed, 74 passed.CNY,USD,zh-CN, fraction through the carrier, the coarse pattern and data labels.CNY, the transposed series and the comparison overlay.0,0axis and the fractionyAxis[0].formatpath. The report schema pins, the compare pins and the parity pin stayed green too, as producer pins should.valueAxisTickFormatterread the carrier before a declared axisformat(anchor 1 → 0, blob 4811aff6 → c948f168). Result: 1 failed, 84 passed. The one failure is "a declared axisformatwins over the carrier", the pin S1 asked for.main(95734fe) blobs, with hashes checked on disk. Result: 12 failed, 5 passed. Each file was restored to its HEAD blob, and bothgit diff HEADand the porcelain were empty. The round-2 producer pins were not run on main. On main no series carriesmeasureFormat, so their carrier expectations fail by construction.Derived gate families (dispatch-gates --commands, 40 families, tree 8816da6)
All 40 exited 0 when re-run on this head, with the exit code captured before any pipe.
pnpm --dir ui exec vitest run --maxWorkers=2 scripts/(under the lock) reported Test Files 172 passed, 2 skipped, and Tests 5130 passed.dispatch-gates --ran: 40 derived, 40 run, 0 NOT-MEASURED, 0 UNRUN. The CI-owned families are read from this PR's check-runs.Generated by Claude Code