Skip to content

Commit 724c83f

Browse files
committed
Don't use poffset for sieve.put, use trace._offsetIndex instead.
poffset is not only different for different offsetgroups but also when the trace has a different width.
1 parent c91f06c commit 724c83f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/traces/bar/cross_trace_calc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ function setOffsetAndWidth(gd, pa, sieve, opts) {
352352

353353
var t = calcTrace[0].t;
354354
t.barwidth = barWidth;
355+
t.offsetindex = trace._offsetIndex;
355356
t.poffset = offsetFromCenter;
356357
t.bargroupwidth = barGroupWidth;
357358
t.bardelta = minDiff;
@@ -569,18 +570,20 @@ function stackBars(sa, sieve, opts) {
569570
var isFunnel;
570571
var i, j;
571572
var bar;
573+
var offsetIndex;
572574

573575
for(i = 0; i < calcTraces.length; i++) {
574576
calcTrace = calcTraces[i];
575577
fullTrace = calcTrace[0].trace;
576578

577579
if(fullTrace.type === 'funnel') {
580+
offsetIndex = calcTrace[0].t.offsetindex;
578581
for(j = 0; j < calcTrace.length; j++) {
579582
bar = calcTrace[j];
580583

581584
if(bar.s !== BADNUM) {
582585
// create base of funnels
583-
sieve.put(bar.p, -0.5 * bar.s);
586+
sieve.put(bar.p + offsetIndex, -0.5 * bar.s);
584587
}
585588
}
586589
}
@@ -592,7 +595,7 @@ function stackBars(sa, sieve, opts) {
592595

593596
isFunnel = (fullTrace.type === 'funnel');
594597

595-
var offset = fullTrace.type === 'barpolar' ? 0 : calcTrace[0].t.poffset;
598+
offsetIndex = fullTrace.type === 'barpolar' ? 0 : calcTrace[0].t.offsetindex;
596599

597600
var pts = [];
598601

@@ -608,7 +611,7 @@ function stackBars(sa, sieve, opts) {
608611
value = bar.s + bar.b;
609612
}
610613

611-
var base = sieve.put(bar.p + offset, value);
614+
var base = sieve.put(bar.p + offsetIndex, value);
612615
var top = base + value;
613616

614617
// store the bar base and top in each calcdata item

0 commit comments

Comments
 (0)