@@ -401,36 +401,33 @@ Plotly.plot = function(gd, data, layout) {
401
401
402
402
403
403
// Polar plots
404
- if ( gd . data && gd . data [ 0 ] && gd . data [ 0 ] . type ) gd . mainPlotType = gd . data [ 0 ] . type ;
405
- if ( gd . mainPlotType && gd . mainPlotType . indexOf ( 'Polar' ) != - 1 ) {
406
-
407
- if ( data ) {
408
- gd . data = data ;
409
- gd . plotType = gd . data [ 0 ] . type ;
410
- }
404
+ var hasPolarType = false ;
405
+ if ( gd . data && gd . data [ 0 ] && gd . data [ 0 ] . type ) hasPolarType = gd . data [ 0 ] . type . indexOf ( 'Polar' ) != - 1 ;
406
+ if ( ! hasPolarType ) gd . framework = undefined ;
407
+ if ( hasPolarType || gd . framework && gd . framework . isPolar ) {
408
+ if ( data ) gd . data = data ;
411
409
gd . layout = layout ;
412
410
413
- gd . layout . _container = d3 . select ( gd ) . select ( '.plot-container' ) ;
414
- if ( gd . layout . _container . empty ( ) ) {
415
- gd . layout . _container = d3 . select ( gd ) . append ( 'div' ) . classed ( '.plot-container' , true ) . classed ( 'plotly' , true ) ;
416
- }
417
- gd . paperdiv = gd . layout . _container . select ( '.svg-container' ) ;
418
- if ( gd . paperdiv . empty ( ) ) {
419
- gd . paperdiv = gd . layout . _container . append ( 'div' )
420
- . classed ( 'svg-container' , true )
421
- . style ( 'position' , 'relative' ) ;
422
- }
411
+ var plotContainer = d3 . select ( gd ) . selectAll ( '.plot-container' ) . data ( [ 0 ] ) ;
412
+ plotContainer . enter ( ) . append ( 'div' ) . classed ( 'plot-container plotly' , true ) ;
413
+ var paperDiv = plotContainer . selectAll ( '.svg-container' ) . data ( [ 0 ] ) ;
414
+ paperDiv . enter ( ) . append ( 'div' )
415
+ . classed ( 'svg-container' , true )
416
+ . style ( 'position' , 'relative' ) ;
417
+
418
+ gd . layout . _container = plotContainer ;
419
+ gd . paperdiv = paperDiv
423
420
424
421
if ( gd . layout . autosize == 'initial' ) {
425
422
plotAutoSize ( gd , { } ) ;
426
423
gd . layout . autosize = true ;
427
424
}
428
425
429
- if ( ! gd . framework || gd . framework . name != 'micropolarPlotlyManager' ) gd . framework = micropolar . manager . plotly ( ) ;
426
+ if ( ! gd . framework || ! gd . framework . isPolar ) gd . framework = micropolar . manager . plotly ( ) ;
430
427
gd . framework ( { container : gd . paperdiv . node ( ) , data : gd . data , layout : gd . layout } ) ;
431
428
gd . paper = gd . framework . svg ( ) ;
432
429
return null ;
433
- } else delete gd . mainPlotType ;
430
+ }
434
431
435
432
// Make or remake the framework (ie container and axes) if we need to
436
433
// figure out what framework the data imply,
0 commit comments