Skip to content

Commit b73d395

Browse files
committed
pass convertNumeric to linearOK and category
1 parent 837761c commit b73d395

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plots/cartesian/axis_autotype.js

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

2020
if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory';
2121
if(moreDates(array, calendar)) return 'date';
22-
if(category(array)) return 'category';
23-
if(linearOK(array)) return 'linear';
24-
else return convertNumeric ? '-' : 'category';
22+
if(category(array, convertNumeric)) return 'category';
23+
if(linearOK(array, convertNumeric)) return 'linear';
24+
else return '-';
2525
};
2626

2727
function hasTypeNumber(v, convertNumeric) {
@@ -68,7 +68,7 @@ function moreDates(a, calendar) {
6868

6969
// are the (x,y)-values in gd.data mostly text?
7070
// require twice as many DISTINCT categories as distinct numbers
71-
function category(a) {
71+
function category(a, convertNumeric) {
7272
var len = a.length;
7373
if(!len) return false;
7474

@@ -86,7 +86,7 @@ function category(a) {
8686
seen[stri] = 1;
8787

8888
if(typeof ai === 'boolean') curvecats++;
89-
else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++;
89+
else if(convertNumeric ? Lib.cleanNumber(ai) !== BADNUM : typeof ai === 'number') curvenums++;
9090
else if(typeof ai === 'string') curvecats++;
9191
}
9292

0 commit comments

Comments
 (0)