@@ -659,6 +659,39 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa
659659 }
660660} ;
661661
662+ // This function clears defaults between the first and second pass of
663+ // supplyDefaults. It exists because otherwise null attributes are
664+ // supplyDefault'd and inherited as *colors* instead of an actual null
665+ // attribute which needs to be supplydefaulted by the individual
666+ // expanded traces.
667+ plots . clearExpandedTraceDefaultColors = function ( expandedTraces ) {
668+ var colorAttrs , path , trace , i , j ;
669+
670+ // A better check *might* be to explicitly check for a groupby transform
671+ if ( expandedTraces . length <= 1 ) return ;
672+
673+ function locateExpandedTraceAttrs ( attr , attrName , attrs , level ) {
674+ path [ level ] = attrName ;
675+ path . length = level + 1 ;
676+ if ( attr . useExpandedTraceDefaultColor ) {
677+ colorAttrs . push ( path . join ( '.' ) ) ;
678+ }
679+ }
680+
681+ for ( i = 0 ; i < expandedTraces . length ; i ++ ) {
682+ trace = expandedTraces [ i ] ;
683+ colorAttrs = [ ] ;
684+ path = [ ] ;
685+
686+ PlotSchema . crawl ( trace . _module . attributes , locateExpandedTraceAttrs ) ;
687+
688+ for ( j = 0 ; j < colorAttrs . length ; j ++ ) {
689+ Lib . nestedProperty ( trace , colorAttrs [ j ] ) . set ( null ) ;
690+ }
691+ }
692+ } ;
693+
694+
662695plots . supplyDataDefaults = function ( dataIn , dataOut , layout , fullLayout ) {
663696 var i , fullTrace , trace ;
664697 var modules = fullLayout . _modules = [ ] ,
@@ -693,6 +726,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
693726 if ( fullTrace . transforms && fullTrace . transforms . length ) {
694727 var expandedTraces = applyTransforms ( fullTrace , dataOut , layout , fullLayout ) ;
695728
729+ plots . clearExpandedTraceDefaultColors ( expandedTraces ) ;
730+
696731 for ( var j = 0 ; j < expandedTraces . length ; j ++ ) {
697732 var expandedTrace = expandedTraces [ j ] ,
698733 fullExpandedTrace = plots . supplyTraceDefaults ( expandedTrace , cnt , fullLayout , i ) ;
0 commit comments