Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/traces/bar/set_positions.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module.exports = function setPositions(gd, plotinfo) {
for(j = 0; j < ti.length; j++) {
sv = Math.round(ti[j].p / sumround);
// store the negative sum value for p at the same key, with sign flipped
if(relative && ti[j].s < 0) sv = -sv;
if(relative && ti[j].s < 0) sv = '-' + sv; // use string to ensure -0 !== 0
var previousSum = sums[sv] || 0;
if(stack || relative) ti[j].b = previousSum;
barEnd = ti[j].b + ti[j].s;
Expand Down Expand Up @@ -173,7 +173,7 @@ module.exports = function setPositions(gd, plotinfo) {
for(j = 0; j < ti.length; j++) {
relAndNegative = relative && ti[j].s < 0;
sv = Math.round(ti[j].p / sumround);
if(relAndNegative) sv = -sv; // locate negative sum amount for this p val
if(relAndNegative) sv = '-' + sv; // locate negative sum amount for this p val
scale = top / sums[sv];
if(relAndNegative) scale *= -1; // preserve sign if negative
ti[j].b *= scale;
Expand Down