Skip to content

Commit fd54bee

Browse files
authored
Merge pull request #1944 from plotly/match-hist-bins
Match hist bins
2 parents a55cadd + 241d9a8 commit fd54bee

File tree

7 files changed

+355
-118
lines changed

7 files changed

+355
-118
lines changed

src/plot_api/plot_api.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,27 @@ Plotly.plot = function(gd, data, layout, config) {
238238
return;
239239
}
240240

241-
var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'),
242-
modules = fullLayout._modules;
241+
var subplots = Plots.getSubplotIds(fullLayout, 'cartesian');
242+
var modules = fullLayout._modules;
243+
var setPositionsArray = [];
243244

244245
// position and range calculations for traces that
245246
// depend on each other ie bars (stacked or grouped)
246247
// and boxes (grouped) push each other out of the way
247248

248-
var subplotInfo, _module;
249+
var subplotInfo, i, j;
249250

250-
for(var i = 0; i < subplots.length; i++) {
251-
subplotInfo = fullLayout._plots[subplots[i]];
251+
for(j = 0; j < modules.length; j++) {
252+
Lib.pushUnique(setPositionsArray, modules[j].setPositions);
253+
}
254+
255+
if(setPositionsArray.length) {
256+
for(i = 0; i < subplots.length; i++) {
257+
subplotInfo = fullLayout._plots[subplots[i]];
252258

253-
for(var j = 0; j < modules.length; j++) {
254-
_module = modules[j];
255-
if(_module.setPositions) _module.setPositions(gd, subplotInfo);
259+
for(j = 0; j < setPositionsArray.length; j++) {
260+
setPositionsArray[j](gd, subplotInfo);
261+
}
256262
}
257263
}
258264

0 commit comments

Comments
 (0)