@@ -31,6 +31,11 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
31
31
old2new = function ( zOld , i , j ) { return zOld [ i ] [ j ] ; } ;
32
32
}
33
33
34
+ var padOld2new = function ( zOld , i , j ) {
35
+ if ( i === undefined || j === undefined ) return undefined ;
36
+ return old2new ( zOld , i , j ) ;
37
+ } ;
38
+
34
39
function axisMapping ( ax ) {
35
40
if ( trace && trace . type !== 'carpet' && trace . type !== 'contourcarpet' &&
36
41
ax && ax . type === 'category' && trace [ '_' + ax . _id . charAt ( 0 ) ] . length ) {
@@ -51,10 +56,13 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
51
56
52
57
if ( ya && ya . type === 'category' ) rowlen = ya . _categories . length ;
53
58
for ( i = 0 ; i < rowlen ; i ++ ) {
54
- collen = getCollen ( zOld , i ) ;
55
- if ( xa && xa . type === 'category' ) collen = xa . _categories . length ;
59
+ if ( xa && xa . type === 'category' ) {
60
+ collen = xa . _categories . length ;
61
+ } else {
62
+ collen = getCollen ( zOld , i ) ;
63
+ }
56
64
zNew [ i ] = new Array ( collen ) ;
57
- for ( j = 0 ; j < collen ; j ++ ) zNew [ i ] [ j ] = cleanZvalue ( old2new ( zOld , yMap ( i ) , xMap ( j ) ) ) ;
65
+ for ( j = 0 ; j < collen ; j ++ ) zNew [ i ] [ j ] = cleanZvalue ( padOld2new ( zOld , yMap ( i ) , xMap ( j ) ) ) ;
58
66
}
59
67
60
68
return zNew ;
0 commit comments