Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 156f127

Browse files
committed
move up linkSubplots before cleanPlot
- so that we can lookup subplots in newFullLayout._plots instead of indexOf into (something looong) subplots lists.
1 parent 31e5b12 commit 156f127

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/plots/cartesian/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
304304
else if(oldSubplotList.cartesian) {
305305
for(i = 0; i < oldSubplotList.cartesian.length; i++) {
306306
var oldSubplotId = oldSubplotList.cartesian[i];
307-
if(newSubplotList.cartesian.indexOf(oldSubplotId) === -1) {
307+
if(!newPlots[oldSubplotId]) {
308308
var selector = '.' + oldSubplotId + ',.' + oldSubplotId + '-x,.' + oldSubplotId + '-y';
309309
oldFullLayout._cartesianlayer.selectAll(selector).remove();
310310
removeSubplotExtras(oldSubplotId, oldFullLayout);

src/plots/plots.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ plots.supplyDefaults = function(gd) {
438438
newFullLayout._hasTernary = newFullLayout._has('ternary');
439439
newFullLayout._hasPie = newFullLayout._has('pie');
440440

441-
// clean subplots and other artifacts from previous plot calls
442-
plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout, oldCalcdata);
443-
444441
// relink / initialize subplot axis objects
445442
plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout);
446443

444+
// clean subplots and other artifacts from previous plot calls
445+
plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout, oldCalcdata);
446+
447447
// relink functions and _ attributes to promote consistency between plots
448448
relinkPrivateKeys(newFullLayout, oldFullLayout);
449449

0 commit comments

Comments
 (0)