Skip to content

Commit 0cfc5aa

Browse files
code cleanup
1 parent 253048f commit 0cfc5aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/traces/bar/set_positions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ module.exports = function setPositions(gd, plotinfo) {
144144
for(j = 0; j < ti.length; j++) {
145145
sv = Math.round(ti[j].p / sumround);
146146
// store the negative sum value for p at the same key, with sign flipped
147-
if (relative && ti[j].s < 0) sv = -Math.round(ti[j].p / sumround);
147+
if (relative && ti[j].s < 0) sv = -sv;
148148
var previousSum = sums[sv] || 0;
149149
if(stack || relative) ti[j].b = previousSum;
150150
barEnd = ti[j].b + ti[j].s;
@@ -172,8 +172,8 @@ module.exports = function setPositions(gd, plotinfo) {
172172
ti = gd.calcdata[bl[i]];
173173
for(j = 0; j < ti.length; j++) {
174174
relAndNegative = relative && ti[j].s < 0;
175-
sv = Math.round(ti[j].p/sumround);
176-
if (relAndNegative) sv = -Math.round(ti[j].p/sumround); // locate negative sum amount for this p val
175+
sv = Math.round(ti[j].p / sumround);
176+
if (relAndNegative) sv = -sv; // locate negative sum amount for this p val
177177
scale = top / sums[sv];
178178
if (relAndNegative) scale *= -1; // preserve sign if negative
179179
ti[j].b *= scale;

0 commit comments

Comments
 (0)