Skip to content

Commit 241d9a8

Browse files
committed
pushUnique setPositions
1 parent e81fcb6 commit 241d9a8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/plot_api/plot_api.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,18 @@ Plotly.plot = function(gd, data, layout, config) {
240240
var subplots = Plots.getSubplotIds(fullLayout, 'cartesian');
241241
var modules = fullLayout._modules;
242242
var setPositionsArray = [];
243-
var hasSetPositions = false;
244243

245244
// position and range calculations for traces that
246245
// depend on each other ie bars (stacked or grouped)
247246
// and boxes (grouped) push each other out of the way
248247

249-
var subplotInfo, setPositionsFunc, i, j;
248+
var subplotInfo, i, j;
250249

251250
for(j = 0; j < modules.length; j++) {
252-
setPositionsFunc = modules[j].setPositions;
253-
if(setPositionsFunc && setPositionsArray.indexOf(setPositionsFunc) === -1) {
254-
setPositionsArray.push(setPositionsFunc);
255-
hasSetPositions = true;
256-
}
251+
Lib.pushUnique(setPositionsArray, modules[j].setPositions);
257252
}
258253

259-
if(hasSetPositions) {
254+
if(setPositionsArray.length) {
260255
for(i = 0; i < subplots.length; i++) {
261256
subplotInfo = fullLayout._plots[subplots[i]];
262257

0 commit comments

Comments
 (0)