Black Lives Matter. Please consider donating to Black Girls Code today.

When I am ploting a stacked bar chart with both +ve & -ve values using ployly.js. the value in stacked bar is coming as the substraction of -ve value from +ve value.But It should come on both side of x-axis wrt y-axix +ve & -ve value.Plz suggest

var trace1 = {
x: [‘giraffes’, ‘orangutans’, ‘monkeys’],
y: [20, 14, -23],
name: ‘SF Zoo’,
type: ‘bar’

var trace2 = {
x: [‘giraffes’, ‘orangutans’, ‘monkeys’],
y: [12, -18, 29],
name: ‘LA Zoo’,
type: ‘bar’

var data = [trace1, trace2];

var layout = {barmode: ‘stack’};

Plotly.newPlot(‘myDiv’, data, layout);

duplicate of Stacked bar with positive and negative values

tl;dr this is known limitation of our current set of barmode settings.

Please subscribe to for the latest development info.