Skip to content

Commit 4697f9c

Browse files
committed
flat 2d arrays before passing to autotypes
1 parent 560405c commit 4697f9c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/plots/cartesian/axis_autotype.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@ module.exports = function autoType(array, calendar, opts) {
1919

2020
if(Lib.isArrayOrTypedArray(a) && !a.length) return '-';
2121
if(!opts.noMultiCategory && multiCategory(a)) return 'multicategory';
22-
if(opts.noMultiCategory && Lib.isArrayOrTypedArray(a[0])) {
23-
a = a.flat(); // TODO: add support for IE
22+
if(opts.noMultiCategory && Array.isArray(a[0])) {
23+
var b = [];
24+
for(var i = 0; i < a.length; i++) {
25+
if(Array.isArray(a[i])) {
26+
for(var j = 0; j < a[i].length; j++) {
27+
b.push(a[i][j]);
28+
}
29+
}
30+
}
31+
a = b;
2432
}
2533

2634
if(moreDates(a, calendar)) return 'date';

0 commit comments

Comments
 (0)