fix(bar): draw bars stacked over out-of-log-domain values from the axis start#21702
Open
rusackas wants to merge 1 commit into
Open
fix(bar): draw bars stacked over out-of-log-domain values from the axis start#21702rusackas wants to merge 1 commit into
rusackas wants to merge 1 commit into
Conversation
…is start When a bar is stacked over a value that is out of the log domain (e.g., stacked over a null value, making the stack base 0, and log(0) being -Infinity), its base coordinate is non-finite and the bar is silently not rendered. Draw such bars from the value axis start instead, as if they were the first bar in their stack. close apache#19517 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for your contribution! The pull request is marked to be |
2 tasks
villebro
approved these changes
Jul 21, 2026
villebro
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for the fix! Tagging PMCs for final review/merge.
Member
Author
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.
Brief Information
This pull request is in the type of:
What does this PR do?
Draws a bar that is stacked over an out-of-log-domain value (e.g. stacked over a null value) from the value axis start, instead of silently not rendering it.
Fixed issues
Details
Before: What was the problem?
When bars are stacked on a log axis and a lower series has a null (
'-') value, the upper bar's stack base is0. Sincelog(0)is-Infinity, that bar's base coordinate is non-finite and the rect is never drawn, even though the value still shows up in the tooltip. Minimal repro is in #19517 (live example).Per the analysis in #19517 this seems to have regressed in 5.3.0 with the bar layout changes; earlier versions rendered this case fine.
The second series' bar (2500 in
First, stacked over the null) is simply missing:After: How does it behave after the fixing?
In the progressive bar layout, a non-finite stacked base coordinate is clamped back to the value axis start, in both orientations. A bar stacked over a null value is drawn from the axis start, using the same baseline as the first bar in a stack. Bars in fully-populated stacks are unaffected.
Same option with this fix, all three bars drawn:
Added unit tests in
test/ut/spec/series/barStackLog.test.ts(vertical, horizontal, and a guard asserting fully-populated stacked layouts are unchanged). The first two fail without the fix. Also added a manual case totest/bar-log.html.Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/bar-log.html, second chart.Merging options
Other information
I'm aware of the conclusion in #19234 that stacked bars on a log axis can be misleading, and this PR doesn't take a position on that. The proportions concern is about how visible bars are read. This is a different problem: a value that exists in the data and the tooltip silently doesn't render at all, which reads as data loss rather than distortion. The drawn bar's top edge is still truthful against the axis.
#19518 attempted a fix for the same issue but hardcoded the stack base to
1, which would be wrong whenever the axis min isn't 1. This version clamps the computed pixel coordinate instead, so no data values are changed.For what it's worth, we hit this downstream in Apache Superset (apache/superset#25829), where stacked bar charts on a log axis drop bars whenever a series has gaps in it.