File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,19 @@ var Lib = require('../../lib');
1515var BADNUM = require ( '../../constants/numerical' ) . BADNUM ;
1616
1717module . exports = function autoType ( array , calendar , opts ) {
18- if ( Lib . isArrayOrTypedArray ( array ) && ! array . length ) return '-' ;
19- if ( ! opts . noMultiCategory && multiCategory ( array ) ) return 'multicategory' ;
18+ var a = array ;
2019
21- if ( Lib . isArrayOrTypedArray ( array [ 0 ] ) ) return '-' ;
22- if ( moreDates ( array , calendar ) ) return 'date' ;
20+ if ( Lib . isArrayOrTypedArray ( a ) && ! a . length ) return '-' ;
21+ if ( ! opts . noMultiCategory && multiCategory ( a ) ) return 'multicategory' ;
22+ if ( opts . noMultiCategory && Lib . isArrayOrTypedArray ( a [ 0 ] ) ) {
23+ a = a . flat ( ) ; // TODO: add support for IE
24+ }
25+
26+ if ( moreDates ( a , calendar ) ) return 'date' ;
2327
2428 var convertNumeric = opts . autotypenumbers !== 'strict' ; // compare against strict, just in case autotypenumbers was not provided in opts
25- if ( category ( array , convertNumeric ) ) return 'category' ;
26- if ( linearOK ( array , convertNumeric ) ) return 'linear' ;
29+ if ( category ( a , convertNumeric ) ) return 'category' ;
30+ if ( linearOK ( a , convertNumeric ) ) return 'linear' ;
2731
2832 return '-' ;
2933} ;
Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ describe('Test axes', function() {
332332 [ 'd' , 'e' , 'f' ]
333333 ]
334334 } ) ;
335- checkTypes ( 'linear' , 'linear ' ) ;
335+ checkTypes ( 'linear' , 'category ' ) ;
336336 } ) ;
337337 } ) ;
338338
You can’t perform that action at this time.
0 commit comments