@@ -2749,17 +2749,13 @@ plots.doCalcdata = function(gd, traces) {
27492749 ) ;
27502750 }
27512751
2752- setupAxisCategories ( axList , fullData ) ;
2753-
27542752 var hasCalcTransform = false ;
27552753
2756- // transform loop
2757- for ( i = 0 ; i < fullData . length ; i ++ ) {
2754+ function transformCalci ( i ) {
27582755 trace = fullData [ i ] ;
2756+ _module = trace . _module ;
27592757
27602758 if ( trace . visible === true && trace . transforms ) {
2761- _module = trace . _module ;
2762-
27632759 // we need one round of trace module calc before
27642760 // the calc transform to 'fill in' the categories list
27652761 // used for example in the data-to-coordinate method
@@ -2786,9 +2782,6 @@ plots.doCalcdata = function(gd, traces) {
27862782 }
27872783 }
27882784
2789- // clear stuff that should recomputed in 'regular' loop
2790- if ( hasCalcTransform ) setupAxisCategories ( axList , fullData ) ;
2791-
27922785 function calci ( i , isContainer ) {
27932786 trace = fullData [ i ] ;
27942787 _module = trace . _module ;
@@ -2797,7 +2790,7 @@ plots.doCalcdata = function(gd, traces) {
27972790
27982791 var cd = [ ] ;
27992792
2800- if ( trace . visible === true ) {
2793+ if ( trace . visible === true && trace . _length !== 0 ) {
28012794 // clear existing ref in case it got relinked
28022795 delete trace . _indexToPoints ;
28032796 // keep ref of index-to-points map object of the *last* enabled transform,
@@ -2833,6 +2826,16 @@ plots.doCalcdata = function(gd, traces) {
28332826 calcdata [ i ] = cd ;
28342827 }
28352828
2829+ setupAxisCategories ( axList , fullData ) ;
2830+
2831+ // 'transform' loop - must calc container traces first
2832+ // so that if their dependent traces can get transform properly
2833+ for ( i = 0 ; i < fullData . length ; i ++ ) calci ( i , true ) ;
2834+ for ( i = 0 ; i < fullData . length ; i ++ ) transformCalci ( i ) ;
2835+
2836+ // clear stuff that should recomputed in 'regular' loop
2837+ if ( hasCalcTransform ) setupAxisCategories ( axList , fullData ) ;
2838+
28362839 // 'regular' loop - make sure container traces (eg carpet) calc before
28372840 // contained traces (eg contourcarpet)
28382841 for ( i = 0 ; i < fullData . length ; i ++ ) calci ( i , true ) ;
0 commit comments