Skip to content

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

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-37053-chart-axis-measure-format
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-37053-chart-axis-measure-format

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37053
Clause-②: yes
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:报表和仪表盘里的图表,纵轴刻度现在带上指标自己的单位——按百分点存储的百分比指标从「0、9、18、27、36」变成「0.0%、9.0%、18.0%、27.0%、36.0%」,人民币金额指标从「3K、6K」变成「CN¥3K、CN¥6K」(中文界面写作「¥30万」这样的形式);仪表盘组件画按小数存储的百分比指标时,纵轴原来没有百分号(组件不传纵轴格式),现在读作「0.0%…34.0%」,与旁边表格的读法一致。
  • 为什么做:接续上一张修复报表图表百分比纵轴的卡,补齐它当时留下的另一半(按百分点存储的百分比和货币金额)。HotCRM「SLA 表现」报表的违约率是按小数存储的百分比,它的报表纵轴上一张卡已修好,本次不变;变化的只是画同一指标的仪表盘组件。
  • 出错会怎样:最坏是某张图表的纵轴单位或小数位显示得不如预期,数值和图形本身不变;每行币种不同的金额指标仍显示纯数字;撤回这次改动即可恢复原样。
  • 要你做什么:无。

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.

  1. The carrier. series[].measureFormat carries the measure's { format, currency, percentScale }. It sits on the chart renderer's internal series props, beside series[].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:
    • MeasureValueFormat and NormalizedSeries.measureFormat in normalizeChartSchema.ts;
    • normalizeSeries, which keeps the carrier's three keys and nothing else;
    • the internal dataKey arm of ChartRendererProps.schema.series.
  2. The value axis reads it at the tick-step place 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 introduced (valueAxisTickFormatter in AdvancedChartImpl.tsx). The order is a declared axis format first (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 rule plotsWholeNumbers applies to aggregate. Data labels print with their axis' formatter (objectstack#27372), so they carry the units too.
    • Percent: printed through formatMeasure from @object-ui/core, the function the table uses, at the column's own percentScale. The pattern's places are the minimum and grow to the step's place (the formatterFor rule), so two ticks never share a label. A whole rate of 33.3 now reads 0.0% … 36.0%.
    • Currency: printed as the compact default with the currency's symbol (CN¥3K … CN¥12K in en, ¥30万 in zh-CN). compactTickFormatter gains an optional currency argument. If Intl refuses the code, the tick falls back to the plain compact number.
  3. The producers fill it.
    • DatasetReportRenderer.tsx (measureFormatCarrier) gives every drawn series the measure's facts. That covers a seriesBy split and the earlier-window series too.
    • DatasetWidget.tsx gives 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.
    • Both producers take the currency from measureCellCurrency(field) with no row. That is the currency the table prints a cell with when the cell has no row of its own.
  4. The per-row currency carve-out. A measure with a per-row currencyField has no single axis currency. measureCellCurrency returns 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.
  5. The fraction-scale path from 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 is unchanged. The report still passes yAxis[0].format for a fraction-scale percent, and a declared axis format outranks the carrier. The percentAxisFormat docblock now points to the carrier.

Responsibility: whose code is it? The platform's own @object-ui/plugin-charts value axis, whose format key carries only a d3 pattern. Is there an existing platform path? None: the table's formatMeasure path 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 describe for objectstack#37053 in the file that already holds the neighbouring pin. Each SUBJECT is red with this card's source files at their main blobs 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 through normalizeChartSchema, with the series carrier as a producer hands it.

    • A whole-scale percent's ticks are ['0.0%', '9.0%', '18.0%', '27.0%', '36.0%']. Each tick equals formatMeasure(tick, '0.0%', undefined, 'whole', 'en'), and the table's 33.3% is the same function's output.
    • A CNY measure's ticks are ['CN¥0', 'CN¥3K', 'CN¥6K', 'CN¥9K', 'CN¥12K'], a USD measure's are ['$0', '$3K', '$6K', '$9K', '$12K'], and a CNY measure in a zh-CN session reads ['¥0', '¥30万', '¥60万', '¥90万', '¥120万'].
    • CONTROL: a per-row currency measure (pattern, no currency) keeps distinct plain ticks ['0', '3K', '6K', '9K', '12K'].
    • Also pinned:
  • 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:

    • the carrier for a whole-scale percent, with the table's 33.3% beside it and still no yAxis;
    • the carrier for a CNY measure;
    • the per-row currency control, whose carrier has no currency;
    • every seriesBy series carrying the carrier;
    • a fraction-scale percent keeping its yAxis[0].format;
    • no carrier for a measure that states no facts.

    plugin-report does not depend on plugin-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 the aggregate carrier's pins. It renders the real chain (DatasetWidget → SchemaRenderer → chart → AdvancedChartImpl, no stub) and pins:

    • the whole-scale percent widget (0.0% … 36.0%, equal to formatMeasure);
    • the CNY widget (CN¥0 … CN¥12K);
    • the per-row currency control (0 … 12K);
    • the transposed (dimensionless) series over two measures that format alike reads 0.0% … 36.0%, and its control, a percent beside a currency, keeps plain numbers;
    • the comparison overlay (compareColumn) carries its measure's format, so the axis keeps 0.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 the amount__compare series carry the CNY carrier, and a measure with no format facts gives neither series one (the control).

  • ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.measureFormatCarrierParity-37053.test.ts keeps the two copies of measureFormatCarrier in 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:

    • Text: the dashboard's copy is byte-identical to the report's, read from source. A floor stops a slice that caught nothing from passing.
    • Behaviour: the report's copy, over six field shapes plus no field, answers the carrier the chart reads. Because the text is identical, the same input field gives the same carrier in both producers.

    No harness exists for a cross-producer pin, so this one has its own file.

Acceptance notes

  • Currency ticks are compact, not the table's full amount (a deviation from route B's "through formatMeasure" wording for this one unit, ruled A by the maintainer: 7153146695). formatMeasure has no compact notation. Its amount is the width of a cell (CN¥12,000.00 in en, CN¥1,200,000.00 for 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 the X_AXIS_ALL_LABELS_MAX_BUCKETS derivation. 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 same Intl source the table uses (7153146695). The pins are the fixed-ISO currency cases above (CN¥0 … CN¥12K). Routing currency ticks through formatMeasure with a notation option on @object-ui/core is 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).
  • Only two units travel: a % 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, so sharedMeasureFormat passes it by.
  • formatMeasure prints 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%), where formatterFor would print 0% … 3.4%. The labels stay distinct and each one is the table's reading of that number.
  • The by-name refusal of series[].measureFormat in @object-ui/types is 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 loose ChartDataSeriesSchema accepts narrows what an author can write. That is Clause-②: yes (narrowing) with Metadata-protocol: narrowed, and under ADR-0087 it owes a semantic ledger entry under packages/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-written measureFormat there is honoured. The spec's strict ChartSeriesSchema already refuses the key.
  • measureFormatCarrier is written twice, once in each producer. Its shared home (@object-ui/core, beside buildChartSeries' 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.
  • The file surface as read. "The chart renderer's internal props type beside it" was read as the internal series types: NormalizedSeries and its reader normalizeSeries in normalizeChartSchema.ts, and the dataKey arm in ChartRenderer.tsx. Those are where series[].aggregate, the named precedent, lives. The pure formatter helpers (sharedMeasureFormat, measureTickFormatter, and the currency argument of compactTickFormatter) sit in the same file, beside formatterFor and compactTickFormatter.
  • Not in this card:
    • tooltips keep their own value text;
    • object-bound charts (ObjectChart over aggregate) fill no carrier;
    • a horizontal-bar chart's value axes (drawn across the plot) take the same formatter, but this card does not pin them.

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 reading 0.0% … 36.0%, CN¥0 … CN¥12K, $12K and ¥30万.

Read first, in order of risk:

  1. ui/packages/plugin-charts/src/normalizeChartSchema.ts: measureTickFormatter (the places rule at the displayed scale) and sharedMeasureFormat (when an axis takes a carrier).
  2. ui/packages/plugin-dashboard/src/DatasetWidget.tsx: seriesMeasureFormat (which measure a series plots, including the transposed and comparison series).
  3. ui/packages/plugin-charts/src/AdvancedChartImpl.tsx: the precedence in valueAxisTickFormatter.
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 HEAD empty.

  • Leg A, the carrier read: scripts/ablation-replace.mjs deleted ?? measureTickFormatter(sharedMeasureFormat(plotted), displayLocale, exponent) from AdvancedChartImpl.tsx (anchor 1 → 0, blob 4811aff6 → 4faad709). Result: 11 failed, 74 passed.
    • The 7 chart cases that need the carrier failed: whole-scale percent, CNY, USD, zh-CN, fraction through the carrier, the coarse pattern and data labels.
    • The 4 widget cases failed: percent, CNY, the transposed series and the comparison overlay.
    • The controls stayed green: per-row currency, the mixed series, the mixed transposed series, the declared 0,0 axis and the fraction yAxis[0].format path. The report schema pins, the compare pins and the parity pin stayed green too, as producer pins should.
  • Leg B, the precedence swapped (the seat's S1): the replacement made valueAxisTickFormatter read the carrier before a declared axis format (anchor 1 → 0, blob 4811aff6 → c948f168). Result: 1 failed, 84 passed. The one failure is "a declared axis format wins over the carrier", the pin S1 asked for.
  • Red on main, taken at c8a011b before the harness move, over the same assertions: the five edited source files were set to their main (95734fe) blobs, with hashes checked on disk. Result: 12 failed, 5 passed. Each file was restored to its HEAD blob, and both git diff HEAD and the porcelain were empty. The round-2 producer pins were not run on main. On main no series carries measureFormat, 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

… and currency units

WIP: carrier, formatter, producers.

Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
… two carrier copies in step

Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Final head for L1 (fix round 1) · area a4-U · 2026-11-25T04:50Z
Head-sha: 22053f07a55ca058d382b216ffbb05de87539a3d

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — REWORK · L1 · head 22053f07a55ca058d382b216ffbb05de87539a3d · 2026-11-25T04:57Z

…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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Final head for the delta read (fix round 2) · area a4-U · 2026-11-25T05:49Z
Head-sha: 8816da63b903bca7bf2095311752aed100e9b80d

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 8816da63b903bca7bf2095311752aed100e9b80d · 2026-11-25T05:50Z

Delta L1 over the REWORK 7153316167 at 22053f07, requested by zone a4-U in 7154178247.

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Landing · area a4-U · 2026-11-25T05:51Z · head 8816da63b903bca7bf2095311752aed100e9b80d

reading value
L1 delta ACCEPT 7154194178 (seat repo:objectstack#4) on this head, over the REWORK 7153316167; no spec change, so no L2 owed
maintainer ruling currency arm A, 7153146695; the body states the deviation from route B's wording
follow-ups #37214 (by-name refusal of the carrier in @object-ui/types, blocked on this PR) and #37224 (notation on formatMeasure, blocked on this PR)
check-governed-merges.mjs --pr 37194 NOT governed · 811 changed lines ≤ 3000
overlap-check.mjs clean against origin/main
check-runs at this head 42 success, 15 expected skip, 0 failed, 0 pending
K 6 (under 15), so no merge of main first

State change: ready for review + auto-merge armed; the queue lands it. On MERGED the card #37053 closes through Fixes #37053.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 05:52
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit a386a1d Nov 25, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37053-chart-axis-measure-format branch November 25, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report and dashboard chart value axis: show a whole-scale percent and a currency measure in the format the table gives them

2 participants