echarts
echarts copied to clipboard
[Bug] Stacked bar graph with overlapping bar breaks when having only 2 data points
Version
5.5.0
Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?c=bar-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5JALZW0A0JAvm-uTvkaqTKUasWgDcAhgBsArsw5dYeKgCcIVQrADaJdAMGxoEpkQBEABlOLBAIwkqA4hJBmAtAEZz5gKRXdpOxUAdQgAEzAACzMATgBWX2tSUIkwCSItLXcWWHcAXWytACZswtz8_3QKajpA2n9Of31BIxNYU3c_AyVUgGMAazMwYFSpToNAkPCots8fMcFk1PTM7LyC4thS8q6qkVpa-sSm0haRU0L50jxegbahkcv0CbDIs1mEithFtO0VnPztBstolKsIavY6oIGuhcih2ABuIA
Steps to Reproduce
Clicking the link is sufficient to reproduce the issue.
Current Behavior
The graph breaks and shows no bars or legends.
The problem exists only when each of the series have two datapoints. When there are more datapoints, the bars are displayed (see MWE).
Expected Behavior
The expected behaviour is that there are two stacked bars (with two series in each bar). And behind the stacked bars, there is one unstacked bar.
Environment
- OS: Manjaro Linux, Windows 11
- Browser: Brave 1.65.114, Firefox 124.1.0
- Framework: -
Any additional comments?
No response
removing barGap maybe ?
removing barGap maybe ?
I need the gap since I'm trying to have the bars on series 1 be like a total that sometimes won't match the stacked children thus the bar will appear from behind like in the docs
- Changing the value of barWidth to anything more than 100
- Changing the value of barGap to anything less than 100
Will fix this problem which is how I fixed it for now, I made all the series bars a bit smaller to have a barGap that works, but the main reason I wanted to report this is that adding a third bar on any of the 3 series fixes the problem too
See this example
There seem to be multiple problems with bar series.
The issue in the given example seems to be axis type: 'time'
together with barWidth: '100%'
but only at exactly 2 datapoints: Demo
Another issue seems to be that axis type: 'value'
does not work at all with stack. The documentation is somewaht confusing on which axis types should work: Demo
For axis type: 'time'
without the use of barWidth: '100%'
its working fine: Demo
Axis type: 'category
is working as intended. Note, that the order of the series matters: Demo
More on that the BarWidth seems to have some "reversed" behavior when there are only 2 values on a series 90% width on 2 values 90% width on 3 values