@@ -1921,8 +1921,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
19211921plots . doCalcdata = function ( gd , traces ) {
19221922 var axList = Plotly . Axes . list ( gd ) ,
19231923 fullData = gd . _fullData ,
1924- fullLayout = gd . _fullLayout ,
1925- i , j ;
1924+ fullLayout = gd . _fullLayout ;
1925+
1926+ var trace , _module , i , j ;
19261927
19271928 // XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without
19281929 // *all* needing doCalcdata:
@@ -1951,46 +1952,45 @@ plots.doCalcdata = function(gd, traces) {
19511952 axList [ i ] . _categories = axList [ i ] . _initialCategories . slice ( ) ;
19521953 }
19531954
1955+ // If traces were specified and this trace was not included,
1956+ // then transfer it over from the old calcdata:
19541957 for ( i = 0 ; i < fullData . length ; i ++ ) {
1955- // If traces were specified and this trace was not included, then transfer it over from
1956- // the old calcdata:
1957- if ( Array . isArray ( traces ) && traces . indexOf ( i ) === - 1 ) {
1958- calcdata [ i ] = oldCalcdata [ i ] ;
1959- continue ;
1960- }
1961-
1962- var trace = fullData [ i ] ,
1963- cd = [ ] ;
1964-
1965- // If traces were specified and this trace was not included, then transfer it over from
1966- // the old calcdata:
19671958 if ( Array . isArray ( traces ) && traces . indexOf ( i ) === - 1 ) {
19681959 calcdata [ i ] = oldCalcdata [ i ] ;
19691960 continue ;
19701961 }
1962+ }
19711963
1972- var _module ;
1973- if ( trace . visible === true ) {
1964+ // transform loop
1965+ for ( i = 0 ; i < fullData . length ; i ++ ) {
1966+ trace = fullData [ i ] ;
19741967
1975- // call calcTransform method if any
1976- if ( trace . transforms ) {
1968+ if ( trace . visible === true && trace . transforms ) {
1969+ _module = trace . _module ;
19771970
1978- // we need one round of trace module calc before
1979- // the calc transform to 'fill in' the categories list
1980- // used for example in the data-to-coordinate method
1981- _module = trace . _module ;
1982- if ( _module && _module . calc ) _module . calc ( gd , trace ) ;
1971+ // we need one round of trace module calc before
1972+ // the calc transform to 'fill in' the categories list
1973+ // used for example in the data-to-coordinate method
1974+ if ( _module && _module . calc ) _module . calc ( gd , trace ) ;
19831975
1984- for ( j = 0 ; j < trace . transforms . length ; j ++ ) {
1985- var transform = trace . transforms [ j ] ;
1976+ for ( j = 0 ; j < trace . transforms . length ; j ++ ) {
1977+ var transform = trace . transforms [ j ] ;
19861978
1987- _module = transformsRegistry [ transform . type ] ;
1988- if ( _module && _module . calcTransform ) {
1989- _module . calcTransform ( gd , trace , transform ) ;
1990- }
1979+ _module = transformsRegistry [ transform . type ] ;
1980+ if ( _module && _module . calcTransform ) {
1981+ _module . calcTransform ( gd , trace , transform ) ;
19911982 }
19921983 }
1984+ }
1985+ }
19931986
1987+ // 'regular' loop
1988+ for ( i = 0 ; i < fullData . length ; i ++ ) {
1989+ var cd = [ ] ;
1990+
1991+ trace = fullData [ i ] ;
1992+
1993+ if ( trace . visible === true ) {
19941994 _module = trace . _module ;
19951995 if ( _module && _module . calc ) cd = _module . calc ( gd , trace ) ;
19961996 }
0 commit comments