@@ -1269,7 +1269,9 @@ function plotAutoSize(gd,aobj) {
1269
1269
gd . layout . height = newheight ;
1270
1270
gd . layout . width = newwidth ;
1271
1271
}
1272
- else { // if there's no size change, update layout but only restyle (different element may get margin color)
1272
+ // if there's no size change, update layout but only restyle (different
1273
+ // element may get margin color)
1274
+ else if ( gd . layout . autosize != 'initial' ) { // can't call layoutStyles for initial autosize
1273
1275
delete ( aobj . autosize ) ;
1274
1276
gd . layout . autosize = true ;
1275
1277
layoutStyles ( gd ) ;
@@ -1329,6 +1331,16 @@ function newPlot(divid, layout) {
1329
1331
. style ( 'position' , 'relative' ) ;
1330
1332
}
1331
1333
1334
+ // destroy calculated vars that may cause problems
1335
+ // TODO: better way to do this? should I be storing these all in some other
1336
+ // object that I can wipe, rather than directly in gd?
1337
+ // I ignored the ones that are reset each time through plot()
1338
+ gd . lw = undefined ; // "legend width" for legends outside the plot area to increase margins
1339
+ gd . undoqueue = undefined ; // action queue
1340
+ gd . undonum = undefined ;
1341
+ gd . autoplay = undefined ; // are we doing an action that doesn't go in undo queue?
1342
+ gd . axtypesok = undefined ; // have we already deduced axis types, so we can skip?
1343
+
1332
1344
// Get the layout info - take the default and update it with layout arg
1333
1345
gd . layout = updateObject ( defaultLayout ( ) , layout ) ;
1334
1346
@@ -1337,11 +1349,12 @@ function newPlot(divid, layout) {
1337
1349
1338
1350
// initial autosize
1339
1351
if ( gl . autosize == 'initial' ) {
1340
- gd . paper = gd3 . append ( 'svg' )
1341
- . attr ( 'width' , gl . width )
1342
- . attr ( 'height' , gl . height ) ;
1352
+ // gd.paperdiv=gd3.append('svg')
1353
+ // .attr('width',gl.width)
1354
+ // .attr('height',gl.height);
1355
+ console . log ( 'initial autosize' ) ;
1343
1356
plotAutoSize ( gd , { } ) ;
1344
- gd . paper . remove ( ) ;
1357
+ // gd.paper.remove();
1345
1358
gl . autosize = true ;
1346
1359
}
1347
1360
// Make the graph containers
0 commit comments