Skip to content

Commit d855f17

Browse files
committed
Revert "Track alignmentgroups in fullLayout._alignmentOpts by trace type"
This reverts commit e8bd5db.
1 parent f08f925 commit d855f17

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

src/traces/bar/cross_trace_calc.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,8 @@ function setOffsetAndWidth(gd, pa, sieve, opts) {
334334
barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0));
335335
offsetFromCenter = -barWidth / 2;
336336
} else { // collect groups and calculate values in loop below
337-
var firstTrace = calcTraces[0][0].trace;
338-
var groupId = getAxisGroup(fullLayout, pa._id) + firstTrace.orientation;
339-
alignmentGroups = fullLayout._alignmentOpts[firstTrace.type][groupId] || {};
337+
var groupId = getAxisGroup(fullLayout, pa._id) + calcTraces[0][0].trace.orientation;
338+
alignmentGroups = fullLayout._alignmentOpts[groupId] || {};
340339
}
341340

342341
for(var i = 0; i < nTraces; i++) {

src/traces/box/cross_trace_calc.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,11 @@ function setPositionOffset(traceType, gd, boxList, posAxis) {
100100
} else {
101101
dPos = dPos0;
102102

103-
var groupId = getAxisGroup(fullLayout, posAxis._id) + trace.orientation;
104-
if(fullLayout._alignmentOpts[traceType] === undefined) {
105-
fullLayout._alignmentOpts[traceType] = {};
106-
}
107-
var alignmentGroups = fullLayout._alignmentOpts[traceType][groupId] || {};
108-
var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {};
109-
var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length;
110103
if(group) {
104+
var groupId = getAxisGroup(fullLayout, posAxis._id) + trace.orientation;
105+
var alignmentGroups = fullLayout._alignmentOpts[groupId] || {};
106+
var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {};
107+
var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length;
111108
var num = nOffsetGroups || numTotal;
112109
var shift = nOffsetGroups ? trace._offsetIndex : t.num;
113110

src/traces/histogram/cross_trace_defaults.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) {
116116
}
117117
}
118118
}
119-
var alignmentOpts = {};
120-
if(fullLayout._alignmentOpts.histogram !== undefined) {
121-
alignmentOpts = fullLayout._alignmentOpts.histogram || {};
122-
}
119+
120+
var alignmentOpts = fullLayout._alignmentOpts || {};
123121

124122
// Look for traces that "have to match", that is:
125123
// - 1d histogram traces on the same subplot with same orientation under barmode:stack,
@@ -138,7 +136,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) {
138136
if(fullLayout.barmode === 'group' && traceOut.alignmentgroup) {
139137
var pa = traceOut[binDir + 'axis'];
140138
var aGroupId = getAxisGroup(fullLayout, pa) + traceOut.orientation;
141-
if((alignmentOpts.histogram[aGroupId] || {})[traceOut.alignmentgroup]) {
139+
if((alignmentOpts[aGroupId] || {})[traceOut.alignmentgroup]) {
142140
groupName = aGroupId;
143141
}
144142
}

src/traces/scatter/grouping_defaults.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ module.exports = function handleGroupingDefaults(traceIn, traceOut, fullLayout,
88
var posAxId = traceOut[{v: 'x', h: 'y'}[orientation] + 'axis'];
99
var groupId = getAxisGroup(fullLayout, posAxId) + orientation;
1010

11-
var allAlignmentOpts = fullLayout._alignmentOpts || {};
12-
if(allAlignmentOpts[traceOut.type] === undefined) {
13-
allAlignmentOpts[traceOut.type] = {};
14-
}
15-
var alignmentOpts = allAlignmentOpts[traceOut.type];
16-
11+
var alignmentOpts = fullLayout._alignmentOpts || {};
1712
var alignmentgroup = coerce('alignmentgroup');
1813

1914
var alignmentGroups = alignmentOpts[groupId];

0 commit comments

Comments
 (0)