We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb67c82 commit f1c0e31Copy full SHA for f1c0e31
src/plots/cartesian/axis_autotype.js
@@ -69,14 +69,18 @@ function moreDates(a, calendar) {
69
// are the (x,y)-values in gd.data mostly text?
70
// require twice as many DISTINCT categories as distinct numbers
71
function category(a) {
72
+ var len = a.length;
73
+ if(!len) return false;
74
+
75
// test at most 1000 points
- var inc = Math.max(1, (a.length - 1) / 1000);
76
+ var inc = Math.max(1, (len - 1) / 1000);
77
var curvenums = 0;
78
var curvecats = 0;
79
var seen = {};
80
- for(var i = 0; i < a.length; i += inc) {
- var ai = a[Math.round(i)];
81
+ for(var f = 0; f < len; f += inc) {
82
+ var i = Math.round(f);
83
+ var ai = a[i];
84
var stri = String(ai);
85
if(seen[stri]) continue;
86
seen[stri] = 1;
0 commit comments