@@ -435,23 +435,29 @@ plots.sendDataToCloud = function(gd) {
435
435
return false ;
436
436
} ;
437
437
438
+ // Fill in default values:
439
+ //
440
+ // gd.data, gd.layout:
441
+ // are precisely what the user specified
442
+ //
443
+ // gd._fullData, gd._fullLayout:
444
+ // are complete descriptions of how to draw the plot
445
+ //
446
+ // gd._fullLayout._modules
447
+ // is a list of all the trace modules required to draw the plot
448
+ //
438
449
plots . supplyDefaults = function ( gd ) {
439
- // fill in default values:
440
- // gd.data, gd.layout:
441
- // are precisely what the user specified
442
- // gd._fullData, gd._fullLayout:
443
- // are complete descriptions of how to draw the plot
444
450
var oldFullLayout = gd . _fullLayout || { } ,
445
451
newFullLayout = gd . _fullLayout = { } ,
446
- newLayout = gd . layout || { } ,
447
- oldFullData = gd . _fullData || [ ] ,
452
+ newLayout = gd . layout || { } ;
453
+
454
+ var oldFullData = gd . _fullData || [ ] ,
448
455
newFullData = gd . _fullData = [ ] ,
449
- newData = gd . data || [ ] ,
450
456
newData = gd . data || [ ] ;
451
457
452
458
var modules = newFullLayout . _modules = [ ] ;
453
- var i , trace , fullTrace , _module , axList , ax ;
454
459
460
+ var i , _module ;
455
461
456
462
// first fill in what we can of layout without looking at data
457
463
// because fullData needs a few things from layout
@@ -462,9 +468,7 @@ plots.supplyDefaults = function(gd) {
462
468
463
469
// then do the data
464
470
for ( i = 0 ; i < newData . length ; i ++ ) {
465
- trace = newData [ i ] ;
466
-
467
- fullTrace = plots . supplyDataDefaults ( trace , i , newFullLayout ) ;
471
+ var fullTrace = plots . supplyDataDefaults ( newData [ i ] , i , newFullLayout ) ;
468
472
newFullData . push ( fullTrace ) ;
469
473
470
474
// detect plot type
@@ -476,8 +480,9 @@ plots.supplyDefaults = function(gd) {
476
480
else if ( plots . traceIs ( fullTrace , 'ternary' ) ) newFullLayout . _hasTernary = true ;
477
481
else if ( 'r' in fullTrace ) newFullLayout . _hasPolar = true ;
478
482
483
+ // fill in modules list
479
484
_module = fullTrace . _module ;
480
- if ( _module && modules . indexOf ( _module ) === - 1 ) modules . push ( _module ) ;
485
+ if ( _module && modules . indexOf ( _module ) === - 1 ) modules . push ( _module ) ;
481
486
}
482
487
483
488
// special cases that introduce interactions between traces
@@ -498,27 +503,24 @@ plots.supplyDefaults = function(gd) {
498
503
// clean subplots and other artifacts from previous plot calls
499
504
plots . cleanPlot ( newFullData , newFullLayout , oldFullData , oldFullLayout ) ;
500
505
501
- /*
502
- * Relink functions and underscore attributes to promote consistency between
503
- * plots.
504
- */
506
+ // relink functions and _ attributes to promote consistency between plots
505
507
relinkPrivateKeys ( newFullLayout , oldFullLayout ) ;
506
508
507
509
plots . doAutoMargin ( gd ) ;
508
510
509
511
// can't quite figure out how to get rid of this... each axis needs
510
512
// a reference back to the DOM object for just a few purposes
511
- axList = Plotly . Axes . list ( gd ) ;
513
+ var axList = Plotly . Axes . list ( gd ) ;
512
514
for ( i = 0 ; i < axList . length ; i ++ ) {
513
- ax = axList [ i ] ;
515
+ var ax = axList [ i ] ;
514
516
ax . _gd = gd ;
515
517
ax . setScale ( ) ;
516
518
}
517
519
518
520
// update object references in calcdata
519
521
if ( ( gd . calcdata || [ ] ) . length === newFullData . length ) {
520
522
for ( i = 0 ; i < newFullData . length ; i ++ ) {
521
- trace = newFullData [ i ] ;
523
+ var trace = newFullData [ i ] ;
522
524
( gd . calcdata [ i ] [ 0 ] || { } ) . trace = trace ;
523
525
}
524
526
}
@@ -725,7 +727,7 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut) {
725
727
plots . supplyLayoutModuleDefaults = function ( layoutIn , layoutOut , fullData ) {
726
728
var i , _module ;
727
729
728
- // TODO incorporate into subplotRegistry
730
+ // TODO incorporate into subplotsRegistry
729
731
Plotly . Axes . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
730
732
731
733
// plot module layout defaults
0 commit comments