@@ -1973,8 +1973,6 @@ plots.doCalcdata = function(gd, traces) {
1973
1973
1974
1974
var trace , _module , i , j ;
1975
1975
1976
- var hasCategoryAxis = false ;
1977
-
1978
1976
// XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without
1979
1977
// *all* needing doCalcdata:
1980
1978
var calcdata = new Array ( fullData . length ) ;
@@ -1996,20 +1994,6 @@ plots.doCalcdata = function(gd, traces) {
1996
1994
fullLayout . _piecolormap = { } ;
1997
1995
fullLayout . _piedefaultcolorcount = 0 ;
1998
1996
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
-
2013
1997
// If traces were specified and this trace was not included,
2014
1998
// then transfer it over from the old calcdata:
2015
1999
for ( i = 0 ; i < fullData . length ; i ++ ) {
@@ -2019,6 +2003,8 @@ plots.doCalcdata = function(gd, traces) {
2019
2003
}
2020
2004
}
2021
2005
2006
+ var hasCategoryAxis = plots . initCategories ( axList ) ;
2007
+
2022
2008
var hasCalcTransform = false ;
2023
2009
2024
2010
// transform loop
@@ -2051,9 +2037,9 @@ plots.doCalcdata = function(gd, traces) {
2051
2037
axList [ i ] . _min = [ ] ;
2052
2038
axList [ i ] . _max = [ ] ;
2053
2039
axList [ i ] . _categories = [ ] ;
2054
- // Reset the look up map
2055
2040
axList [ i ] . _categoriesMap = { } ;
2056
2041
}
2042
+ plots . initCategories ( axList ) ;
2057
2043
}
2058
2044
2059
2045
// 'regular' loop
@@ -2099,6 +2085,26 @@ plots.doCalcdata = function(gd, traces) {
2099
2085
}
2100
2086
} ;
2101
2087
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
+
2102
2108
plots . rehover = function ( gd ) {
2103
2109
if ( gd . _fullLayout . _rehover ) {
2104
2110
gd . _fullLayout . _rehover ( ) ;
0 commit comments