Description
Description
In stacked bar charts, when options.stroke.width
is non-null, bars that are associated with a value of zero appear on the chart, with a non-zero height.
Steps to Reproduce
{
"chart": {
"type": "bar",
"stacked": true
},
"stroke": {
"width": 5,
},
"series": [
{
"name": "S1",
"data": [
{
"x": "A",
"y": 100
},
{
"x": "B",
"y": 0
},
{
"x": "C",
"y": 1
}
]
},
{
"name": "S2",
"data": [
{
"x": "A",
"y": 0
},
{
"x": "B",
"y": 1
},
{
"x": "C",
"y": 0
}
]
}
]
}
Expected Behavior
A bar's total height should always be proportional to the value it represents. In particular, a bar associated with a value of zero should not be visible at all on the chart.
The specified stroke width should be en inner stroke, that does not affect the total size of the element on which it is drawn. Otherwise, the value being displayed is incorrect.
Actual Behavior
All bars (including zero-valued ones) are rendered as svg paths, each with a stroke-width
attribute matching the specified options.stroke.width
. Since svg strokes are centered on the path they apply to, the final rectangle being displayed is always options.stroke.width
pixels too large. This is particularly visible for zero-valued bars, which become visible to the user.
Screenshots
Reproduction Link
https://codepen.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-/pen/gbpbxod?editors=0010