@@ -1973,8 +1973,6 @@ plots.doCalcdata = function(gd, traces) {
19731973
19741974 var trace , _module , i , j ;
19751975
1976- var hasCategoryAxis = false ;
1977-
19781976 // XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without
19791977 // *all* needing doCalcdata:
19801978 var calcdata = new Array ( fullData . length ) ;
@@ -1996,20 +1994,6 @@ plots.doCalcdata = function(gd, traces) {
19961994 fullLayout . _piecolormap = { } ;
19971995 fullLayout . _piedefaultcolorcount = 0 ;
19981996
1999- // initialize the category list, if there is one, so we start over
2000- // to be filled in later by ax.d2c
2001- for ( i = 0 ; i < axList . length ; i ++ ) {
2002- axList [ i ] . _categories = axList [ i ] . _initialCategories . slice ( ) ;
2003-
2004- // Build the lookup map for initialized categories
2005- axList [ i ] . _categoriesMap = { } ;
2006- for ( j = 0 ; j < axList [ i ] . _categories . length ; j ++ ) {
2007- axList [ i ] . _categoriesMap [ axList [ i ] . _categories [ j ] ] = j ;
2008- }
2009-
2010- if ( axList [ i ] . type === 'category' ) hasCategoryAxis = true ;
2011- }
2012-
20131997 // If traces were specified and this trace was not included,
20141998 // then transfer it over from the old calcdata:
20151999 for ( i = 0 ; i < fullData . length ; i ++ ) {
@@ -2019,6 +2003,8 @@ plots.doCalcdata = function(gd, traces) {
20192003 }
20202004 }
20212005
2006+ var hasCategoryAxis = plots . initCategories ( axList ) ;
2007+
20222008 var hasCalcTransform = false ;
20232009
20242010 // transform loop
@@ -2051,9 +2037,9 @@ plots.doCalcdata = function(gd, traces) {
20512037 axList [ i ] . _min = [ ] ;
20522038 axList [ i ] . _max = [ ] ;
20532039 axList [ i ] . _categories = [ ] ;
2054- // Reset the look up map
20552040 axList [ i ] . _categoriesMap = { } ;
20562041 }
2042+ plots . initCategories ( axList ) ;
20572043 }
20582044
20592045 // 'regular' loop
@@ -2099,6 +2085,26 @@ plots.doCalcdata = function(gd, traces) {
20992085 }
21002086} ;
21012087
2088+ plots . initCategories = function ( axList ) {
2089+ var hasCategoryAxis = false ;
2090+
2091+ // initialize the category list, if there is one, so we start over
2092+ // to be filled in later by ax.d2c
2093+ for ( var i = 0 ; i < axList . length ; i ++ ) {
2094+ axList [ i ] . _categories = axList [ i ] . _initialCategories . slice ( ) ;
2095+
2096+ // Build the lookup map for initialized categories
2097+ axList [ i ] . _categoriesMap = { } ;
2098+ for ( var j = 0 ; j < axList [ i ] . _categories . length ; j ++ ) {
2099+ axList [ i ] . _categoriesMap [ axList [ i ] . _categories [ j ] ] = j ;
2100+ }
2101+
2102+ if ( axList [ i ] . type === 'category' ) hasCategoryAxis = true ;
2103+ }
2104+
2105+ return hasCategoryAxis ;
2106+ } ;
2107+
21022108plots . rehover = function ( gd ) {
21032109 if ( gd . _fullLayout . _rehover ) {
21042110 gd . _fullLayout . _rehover ( ) ;
0 commit comments