@@ -2927,8 +2927,8 @@ function sortAxisCategoriesByValue(axList, gd) {
2927
2927
var cdi = cd [ k ] ;
2928
2928
var cat , catIndex , value ;
2929
2929
2930
- // If `splom`, collect values across dimensions
2931
2930
if ( type === 'splom' ) {
2931
+ // If `splom`, collect values across dimensions
2932
2932
// Find which dimension the current axis is representing
2933
2933
var currentDimensionIndex = fullTrace . _axesDim [ ax . _id ] ;
2934
2934
@@ -2950,8 +2950,8 @@ function sortAxisCategoriesByValue(axList, gd) {
2950
2950
categoriesValue [ catIndex ] [ 1 ] . push ( dimension . values [ l ] ) ;
2951
2951
}
2952
2952
}
2953
- // If `scattergl`, collect all values stashed under cdi.t
2954
2953
} else if ( type === 'scattergl' ) {
2954
+ // If `scattergl`, collect all values stashed under cdi.t
2955
2955
for ( l = 0 ; l < cdi . t . x . length ; l ++ ) {
2956
2956
if ( axLetter === 'x' ) {
2957
2957
cat = cdi . t . x [ l ] ;
@@ -2971,32 +2971,29 @@ function sortAxisCategoriesByValue(axList, gd) {
2971
2971
if ( cdi . t && cdi . t . _scene ) {
2972
2972
delete cdi . t . _scene . dirty ;
2973
2973
}
2974
- // For all other 2d cartesian traces
2974
+ } else if ( cdi . hasOwnProperty ( 'z' ) ) {
2975
+ // If 2dMap, collect values in `z`
2976
+ value = cdi . z ;
2977
+ var mapping = zMapCategory ( fullTrace . type , ax , value ) ;
2978
+
2979
+ for ( l = 0 ; l < value . length ; l ++ ) {
2980
+ for ( o = 0 ; o < value [ l ] . length ; o ++ ) {
2981
+ catIndex = mapping ( o , l ) ;
2982
+ if ( catIndex + 1 ) categoriesValue [ catIndex ] [ 1 ] . push ( value [ l ] [ o ] ) ;
2983
+ }
2984
+ }
2975
2985
} else {
2986
+ // For all other 2d cartesian traces
2976
2987
if ( axLetter === 'x' ) {
2977
2988
cat = cdi . p + 1 ? cdi . p : cdi . x ;
2978
2989
value = cdi . s || cdi . v || cdi . y ;
2979
2990
} else if ( axLetter === 'y' ) {
2980
2991
cat = cdi . p + 1 ? cdi . p : cdi . y ;
2981
2992
value = cdi . s || cdi . v || cdi . x ;
2982
2993
}
2983
-
2984
- // If 2dMap, collect values in `z`
2985
- if ( cdi . hasOwnProperty ( 'z' ) ) {
2986
- value = cdi . z ;
2987
- var mapping = zMapCategory ( fullTrace . type , ax , value ) ;
2988
-
2989
- for ( l = 0 ; l < value . length ; l ++ ) {
2990
- for ( o = 0 ; o < value [ l ] . length ; o ++ ) {
2991
- catIndex = mapping ( o , l ) ;
2992
- if ( catIndex + 1 ) categoriesValue [ catIndex ] [ 1 ] . push ( value [ l ] [ o ] ) ;
2993
- }
2994
- }
2995
- } else {
2996
- if ( ! Array . isArray ( value ) ) value = [ value ] ;
2997
- for ( l = 0 ; l < value . length ; l ++ ) {
2998
- categoriesValue [ cat ] [ 1 ] . push ( value [ l ] ) ;
2999
- }
2994
+ if ( ! Array . isArray ( value ) ) value = [ value ] ;
2995
+ for ( l = 0 ; l < value . length ; l ++ ) {
2996
+ categoriesValue [ cat ] [ 1 ] . push ( value [ l ] ) ;
3000
2997
}
3001
2998
}
3002
2999
}
0 commit comments