fix(echarts): stop labeling zero-value segments in stacked bar charts - #43178
fix(echarts): stop labeling zero-value segments in stacked bar charts#43178bikash-barnwal wants to merge 1 commit into
Conversation
A stacked segment whose value is exactly 0 has no height, so its value label is anchored to the same pixel as the label of the segment below it and the two render on top of each other as unreadable doubled text. The percentage-threshold guard does not catch this: with the field's default of 0 the per-row threshold is 0, which falls back to Number.MIN_SAFE_INTEGER, so every value including 0 clears it. There is nothing visible to label for a zero-height segment, so suppress the label regardless of the threshold setting instead of making users configure a positive percentage threshold as a workaround. Fixes apache#42702 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code Review Agent Run #4e1103Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43178 +/- ##
=======================================
Coverage 66.70% 66.70%
=======================================
Files 2872 2872
Lines 163447 163449 +2
Branches 37727 37728 +1
=======================================
+ Hits 109024 109026 +2
Misses 52293 52293
Partials 2130 2130
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
In a stacked Timeseries Bar chart with Values labels on, a series whose value is exactly
0still rendered a label. A zero-value segment has no height, so its label is anchored to the same pixel as the neighboring segment's label and the two render on top of each other.The mechanism is the threshold guard in
transformSeries:With
percentage_thresholdat its default of0,extractDataTotalValuespushes a per-row threshold of0— which is falsy, so the guard degrades tonumericValue >= Number.MIN_SAFE_INTEGERand admits everything, zeros included.The fix returns an empty label for
numericValue === 0in that branch. It deliberately does not use> 0: negative stacked values render visible segments and are legitimately labeled today, so only the zero case — the one with nothing to anchor to — is suppressed. The guard sits after the!stackearly return, so unstacked charts still label zeros as before.MixedTimeseriesshares this code path and is fixed along with it.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: the zero series'
0label sits on top of the adjacent segment's label.After: no label is drawn for the zero-height segment; every other label is unchanged.
TESTING INSTRUCTIONS
(295 tests across 17 suites pass, including the new case.)
Manually:
0.ADDITIONAL INFORMATION
🤖 Generated with Claude Code