Stacked bar series with negative values are not drawn below 0 on the YAxis
See original GitHub issueStacked bar series with all positive values render as expected:
function Chart({data}) {
return <XYPlot width={300} height={300} stackBy="y">
<VerticalGridLines />
<HorizontalGridLines />
<XAxis />
<YAxis />
<VerticalBarSeries data={[{x: 1, y: 10}, {x: 2, y: 5}, {x: 3, y: 15}]} />
<VerticalBarSeries data={[{x: 1, y: 12}, {x: 2, y: 2}, {x: 3, y: 11}]} />
<VerticalBarSeries data={[{x: 1, y: 5}, {x: 2, y: 7}, {x: 3, y: 4}]} />
</XYPlot>
}
However, if y-axis values are less than zero my expectation is that the bars with negative values will stack below 0 on the Y axis. However, they appear to draw downward from the top of the previous bar.
function Chart({data}) {
return <XYPlot width={300} height={300} stackBy="y">
<VerticalGridLines />
<HorizontalGridLines />
<XAxis />
<YAxis />
<VerticalBarSeries data={[{x: 1, y: 10}, {x: 2, y: 5}, {x: 3, y: 15}]} />
<VerticalBarSeries data={[{x: 1, y: 12}, {x: 2, y: 2}, {x: 3, y: -5}]} />
<VerticalBarSeries data={[{x: 1, y: 5}, {x: 2, y: 7}, {x: 3, y: -5}]} />
</XYPlot>
}
Is there a way to configure the chart to stack all bars with negative values below 0 on the Y axis?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Highcharts - Keep Zero Centered on Y-Axis with Negative ...
I have an area chart with negative values.
Read more >StackedBar with Negative Values - changing center axis value
Currently, I have the value defaulting it to 0, but I would like to have that center stem have a value other than...
Read more >Include negative value in sum/total value in stacked bar chart
The main issue is that your keys are not ordered appropriately. You need to move stack negative=on previous after ybar stacked .
Read more >StackedArea Chart not showing series with negative values
The way it used to work was that a series with negative values would stack below the X Axis and positive value above....
Read more >A Complete Guide to Stacked Bar Charts | Tutorial by Chartio
A line is plotted on top of these bars in order to show the net totals. When the secondary values are consistently positive...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for that direction. I’ve been able to achieve the desired result using the RectSeries. Thanks!
@ABBVelocityDev would you be able to share an example?