Skip to content

Commit ebf545f

Browse files
committed
categorial 2dMap: replace undefined with BADNUM
1 parent e68c170 commit ebf545f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/traces/heatmap/clean_2d_array.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
var isNumeric = require('fast-isnumeric');
1212
var Lib = require('../../lib');
13+
var BADNUM = require('../../constants/numerical').BADNUM;
1314

1415
module.exports = function clean2dArray(zOld, trace, xa, ya) {
1516
var rowlen, collen, getCollen, old2new, i, j;
@@ -19,7 +20,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
1920
return +v;
2021
}
2122

22-
if(trace && trace.transpose) {
23+
if(trace.transpose) {
2324
rowlen = 0;
2425
for(i = 0; i < zOld.length; i++) rowlen = Math.max(rowlen, zOld[i].length);
2526
if(rowlen === 0) return false;
@@ -39,11 +40,12 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) {
3940
function axisMapping(ax) {
4041
if(trace && trace.type !== 'carpet' && trace.type !== 'contourcarpet' &&
4142
ax && ax.type === 'category' && trace['_' + ax._id.charAt(0)].length) {
43+
var axLetter = ax._id.charAt(0);
4244
var axMapping = [];
4345
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]));
4547
}
46-
return function(i) {return axMapping[i] === -1 ? undefined : axMapping[i];};
48+
return function(i) {return axMapping[i] === -1 ? BADNUM : axMapping[i];};
4749
} else {
4850
return Lib.identity;
4951
}

0 commit comments

Comments
 (0)