@@ -303,8 +303,8 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
303
303
} ;
304
304
305
305
exports . drawFramework = function ( gd ) {
306
- var fullLayout = gd . _fullLayout ,
307
- subplotData = makeSubplotData ( gd ) ;
306
+ var fullLayout = gd . _fullLayout ;
307
+ var subplotData = makeSubplotData ( gd ) ;
308
308
309
309
var subplotLayers = fullLayout . _cartesianlayer . selectAll ( '.subplot' )
310
310
. data ( subplotData , Lib . identity ) ;
@@ -327,6 +327,7 @@ exports.drawFramework = function(gd) {
327
327
plotinfo . overlays = [ ] ;
328
328
329
329
makeSubplotLayer ( plotinfo ) ;
330
+
330
331
// fill in list of overlay subplots
331
332
if ( plotinfo . mainplot ) {
332
333
var mainplot = fullLayout . _plots [ plotinfo . mainplot ] ;
@@ -506,12 +507,11 @@ function removeSubplotExtras(subplotId, fullLayout) {
506
507
}
507
508
508
509
function joinLayer ( parent , nodeType , className , dataVal ) {
509
- var layer = parent . selectAll ( '.' + className )
510
- . data ( [ dataVal || 0 ] ) ;
511
-
512
- layer . enter ( ) . append ( nodeType )
513
- . classed ( className , true ) ;
514
-
510
+ var sel = parent . select ( '.' + className ) ;
511
+ var layer = sel . size ( ) ?
512
+ sel :
513
+ parent . append ( nodeType ) . classed ( className , true ) ;
514
+ if ( dataVal ) layer . datum ( dataVal ) ;
515
515
return layer ;
516
516
}
517
517
0 commit comments