Skip to content

Commit 381cfbc

Browse files
committed
fix issue 5058 - compute distinct positions using all traces
1 parent 29b456e commit 381cfbc

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/traces/bar/cross_trace_calc.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ function crossTraceCalc(gd, plotinfo) {
5959
}
6060

6161
var opts = {
62+
xCat: xa.type === 'category' || xa.type === 'multicategory',
63+
yCat: ya.type === 'category' || ya.type === 'multicategory',
64+
6265
mode: fullLayout.barmode,
6366
norm: fullLayout.barnorm,
6467
gap: fullLayout.bargap,
@@ -172,14 +175,20 @@ function initBase(sa, calcTraces) {
172175
}
173176

174177
function setGroupPositionsInOverlayMode(pa, sa, calcTraces, opts) {
178+
var sieve;
179+
var sieveOpts = {
180+
sepNegVal: false,
181+
overlapNoMerge: !opts.norm
182+
};
183+
184+
var categoryOverlay = opts.xCat || opts.yCat;
185+
if(categoryOverlay) {
186+
sieve = new Sieve(calcTraces, sieveOpts);
187+
}
188+
175189
// update position axis and set bar offsets and widths
176190
for(var i = 0; i < calcTraces.length; i++) {
177-
var calcTrace = calcTraces[i];
178-
179-
var sieve = new Sieve([calcTrace], {
180-
sepNegVal: false,
181-
overlapNoMerge: !opts.norm
182-
});
191+
if(!categoryOverlay) sieve = new Sieve([calcTraces[i]], sieveOpts);
183192

184193
// set bar offsets and widths, and update position axis
185194
setOffsetAndWidth(pa, sieve, opts);

0 commit comments

Comments
 (0)