Repository navigation
fix(plugin-charts): data labels print in their value axis's units and the tallest mark keeps its label on the chart - #27407
Merged
Conversation
… keep headroom above the tallest mark Claude-Session: https://claude.ai/code/session_01JQwxbY75sPQWcfUg8cZQhg Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbY75sPQWcfUg8cZQhg Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbY75sPQWcfUg8cZQhg Co-authored-by: Claude <noreply@anthropic.com>
… axis formatter Claude-Session: https://claude.ai/code/session_01JQwxbY75sPQWcfUg8cZQhg Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#5 · os-warren · session_01JQwxbXGpVJHZTXXerMoY4C 席位核对ACCEPT · seat 席位意见:图表的数据标签现在用所在数值轴自己的刻度格式化器,没有作者格式时和轴一样显示紧凑单位(
Generated by Claude Code |
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Warren · project thread
Fixes #27372
Clause-②: no
Metadata-protocol: none
维护者速读
174K),并在开启数据标签时给竖向图表加顶部留白,最高柱的标签不再画到图外。174000而轴印400K;最高柱的值标签整段被裁掉。表格末列与全零图两行实测后不改,理由见下。@object-ui/plugin-charts的AdvancedChartImpl.tsx;关闭数据标签的图表与横向柱图布局字节不变。回滚 = revert 本 PR。AdvancedChartImpl.tsx的DATA_LABEL_CHART_MARGIN与dataLabel/valueTickFormatterOf;再看新测试AdvancedChartImpl.dataLabels-27372.test.tsx。pnpm --dir ui exec vitest run packages/plugin-charts/src/AdvancedChartImpl.dataLabels-27372.test.tsx,预期 11 passed。What changes
ui/packages/plugin-charts/src/AdvancedChartImpl.tsxonly:dataLabelnow takes the tick formatter of the value axis the series is drawn against:yTickFormatteron a single-axis chart,leftYTickFormatter/rightYTickFormatterby the series'yAxison a dual-axis chart (valueTickFormatterOf), and by the series' axis id on a combo. Each of those is alreadyformatterFor(axis.format) ?? formatYTick, so an authoredyAxis[].formatstill wins and an axis without one gives its labels the compact default. Before, the label calledformatterFor(axis.format)with no fallback and printed the raw number. Dashboard charts are the common case:chartConfigcarries no axis format at all.showDataLabelson, a vertical bar, line, area or combo chart takesDATA_LABEL_CHART_MARGIN: a top margin of recharts' 5px plus the label's offset (5px) and font (11px). A margin rather than a domain pad, so an authoredyAxis.maxkeeps pinning the domain. Charts without data labels and horizontal bars keep recharts' default margin. The label's font size and offset are now named constants (DATA_LABEL_FONT_PX,DATA_LABEL_OFFSET_PX); their values are unchanged.axisOfSerieshelper is replaced byvalueTickFormatterOf.Serial constraint with #27361: this diff does not touch
DatasetWidget.tsxorutils.tsand does not regenerate the sdui manifest, so it does not wait on #27361.Why
Rows 2–4 of #27355 (HotCRM's 18.2.0 browser pass), carded as #27372. Each row was measured in real Chromium (
/opt/pw-browsers/chromium) on a fixture dashboard rendered by the realDashboardRenderer, with dataset-bound bar, line, table and all-zero widgets and an object-provider table, at 1280px (tables also at 768px and 390px). HotCRM's metadata was not used.c4c515ad)174000beside y ticks0 / 100K / … / 400K174K, ticks unchanged400000box top at −11px from the svg top: outside the svg400Kbox top at +5px: inside the svgoverflow-x: auto,scrollWidth910 vsclientWidth566, inside the card. Object-provider table: 971 vs 564, inside the card0 1 2 3 4, 5 grid/axis lines, the line drawn on 0Acceptance notes
table(DatasetWidget's flat table) and theprovider: 'object'table (ObjectDataTable →data-table) each keep their ownoverflow-autoscroller inside the card, and the last column scrolls into view at 1280, 768 and 390px. What reads as a clip is the scroll edge with no visible scrollbar: headless Chromium hides scrollbars by default, macOS shows them only while scrolling, anddata-tableshows its scrollbar on hover only. A visible overflow cue (an edge fade, say) would be polish, not a reachability defect, so no table widget is changed. If HotCRM's screen shows a column that cannot be scrolled to, the reading needed is the widget type and the scroller'sscrollWidth/clientWidththere.AdvancedChartImpl.tsx(the "all-zero BAR drew 5,128 ink pixels of axes and ticks" paragraph) stands: zero is a value, the measured chart draws a usable zero baseline and ticks, and a "no data" state over real zeros would be false.currency/percentformat reaches neither the axis ticks nor the labels on a dashboard chart (both read onlyyAxis[].format, whichchartConfigdoes not carry). Not widened here: the labels now match the axis, which is the card's ask.Verification
Head
27cff9de.New pin:
AdvancedChartImpl.dataLabels-27372.test.tsx(11 cases)['174K', '400K', '251K', '92.5K'], the axis itself asserted to read400K).$0,0format wins ($174,000…).174K …left,12.0 …right with a right-axis0.0format).pnpm --dir ui exec vitest run packages/plugin-charts/src/AdvancedChartImpl.dataLabels-27372.test.tsx→ 11 passed.Ablations (each fix reverted through
scripts/ablation-replace.mjs, restored blob = HEAD)LabelList(raw labels): 10 of 11 red (expected [ '174000', … ] to deeply equal [ '174K', … ]); only the labels-off margin case stays green."400K" is drawn above the chart surface: expected -11 to be greater than or equal to 0), the 7 others green.Package and gates
pnpm --filter @object-ui/plugin-charts type-checkandpnpm --dir ui exec vitest run packages/plugin-charts/→ exit 0; Test Files 100 passed (100), Tests 1292 passed | 9 skipped (1301), on 27cff9d.eslinton both touched files: 0 errors; warning count equal toc4c515ad(41).pnpm --dir ui run check:new-line-citations→ 0 new citations.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 35 derived, 35 run on 27cff9d; 34 exit 0 first pass.pnpm --dir ui exec vitest run scripts/exit 1 on one 15 s timeout incheck-vi-mock-inherit.test.ts(tree-sweep population test, a load timeout on a shared box; this diff touches noui/scriptsinput); that file re-run alone under the lock: 83/83 passed, exit 0.--ranreconciliation: 35 accounted, 0 NOT-MEASURED, 0 UNRUN.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses (touched files linted; repo-wide lint is CI's).main, one pull request.@object-ui/plugin-chartspatch).packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbY75sPQWcfUg8cZQhg
Generated by Claude Code