@@ -656,25 +656,13 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut) {
656
656
} ;
657
657
658
658
plots . supplyLayoutModuleDefaults = function ( layoutIn , layoutOut , fullData ) {
659
- var moduleLayoutDefaults = [
660
- 'Axes' , 'Annotations' , 'Shapes' , 'Fx' ,
661
- 'Bar' , 'Box' , 'Pie' , 'Legend'
662
- ] ;
663
-
664
659
var i , _module ;
665
660
666
- // don't add a check for 'function in module' as it is better to error out and
667
- // secure the module API then not apply the default function.
668
- for ( i = 0 ; i < moduleLayoutDefaults . length ; i ++ ) {
669
- _module = moduleLayoutDefaults [ i ] ;
670
-
671
- if ( Plotly [ _module ] ) {
672
- Plotly [ _module ] . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
673
- }
674
- }
661
+ // TODO incorporate into subplotRegistry
662
+ Plotly . Axes . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
675
663
664
+ // plot module layout defaults
676
665
var plotTypes = Object . keys ( subplotsRegistry ) ;
677
-
678
666
for ( i = 0 ; i < plotTypes . length ; i ++ ) {
679
667
_module = subplotsRegistry [ plotTypes [ i ] ] ;
680
668
@@ -683,6 +671,27 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) {
683
671
_module . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
684
672
}
685
673
}
674
+
675
+ // trace module layout defaults
676
+ var traceTypes = Object . keys ( modules ) ;
677
+ for ( i = 0 ; i < traceTypes . length ; i ++ ) {
678
+ _module = modules [ allTypes [ i ] ] . module ;
679
+
680
+ if ( _module . supplyLayoutDefaults ) {
681
+ _module . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
682
+ }
683
+ }
684
+
685
+ // TODO register these
686
+ // Legend must come after traces (e.g. it depends on 'barmode')
687
+ var moduleLayoutDefaults = [ 'Fx' , 'Annotations' , 'Shapes' , 'Legend' ] ;
688
+ for ( i = 0 ; i < moduleLayoutDefaults . length ; i ++ ) {
689
+ _module = moduleLayoutDefaults [ i ] ;
690
+
691
+ if ( Plotly [ _module ] ) {
692
+ Plotly [ _module ] . supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
693
+ }
694
+ }
686
695
} ;
687
696
688
697
plots . purge = function ( gd ) {
0 commit comments