10
10
11
11
var isNumeric = require ( 'fast-isnumeric' ) ;
12
12
var Lib = require ( '../../lib' ) ;
13
+ var BADNUM = require ( '../../constants/numerical' ) . BADNUM ;
13
14
14
15
module . exports = function clean2dArray ( zOld , trace , xa , ya ) {
15
16
var rowlen , collen , getCollen , old2new , i , j ;
@@ -19,7 +20,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
19
20
return + v ;
20
21
}
21
22
22
- if ( trace && trace . transpose ) {
23
+ if ( trace . transpose ) {
23
24
rowlen = 0 ;
24
25
for ( i = 0 ; i < zOld . length ; i ++ ) rowlen = Math . max ( rowlen , zOld [ i ] . length ) ;
25
26
if ( rowlen === 0 ) return false ;
@@ -39,11 +40,12 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
39
40
function axisMapping ( ax ) {
40
41
if ( trace && trace . type !== 'carpet' && trace . type !== 'contourcarpet' &&
41
42
ax && ax . type === 'category' && trace [ '_' + ax . _id . charAt ( 0 ) ] . length ) {
43
+ var axLetter = ax . _id . charAt ( 0 ) ;
42
44
var axMapping = [ ] ;
43
45
for ( i = 0 ; i < ax . _categories . length ; i ++ ) {
44
- axMapping . push ( ( trace [ '_' + ax . _id . charAt ( 0 ) + 'Map' ] || trace [ ax . _id . charAt ( 0 ) ] ) . indexOf ( ax . _categories [ i ] ) ) ;
46
+ axMapping . push ( ( trace [ '_' + axLetter + 'Map' ] || trace [ axLetter ] ) . indexOf ( ax . _categories [ i ] ) ) ;
45
47
}
46
- return function ( i ) { return axMapping [ i ] === - 1 ? undefined : axMapping [ i ] ; } ;
48
+ return function ( i ) { return axMapping [ i ] === - 1 ? BADNUM : axMapping [ i ] ; } ;
47
49
} else {
48
50
return Lib . identity ;
49
51
}
0 commit comments