-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement strict autotypenumbers #5240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/plots/cartesian/axis_autotype.js
Outdated
if(linearOK(array)) return 'linear'; | ||
else return '-'; | ||
if(linearOK(array, convertNumeric)) return 'linear'; | ||
else return convertNumeric ? '-' : 'category'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to leave else return '-'
, for empty arrays and arrays with only null
entries, and instead include convertNumeric
in the category(array)
call, ie replace:
else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++;
with something like:
else if(convertNumeric ? Lib.cleanNumber(ai) !== BADNUM : typeof ai === 'number') curvenums++;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Done in b73d395.
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
OK so @alexcjohnson and I chatted about this and the attribute name should be |
@archmoj pointed out just now that while we're at it here we could stop treating the number I like this idea, and I think |
is it just the number 2000 or something like "integers below 3000" ? |
I'd have to check exactly, but I believe it's at least all 4-digit integers, possibly also 2-digit integers. |
Also 2-digit integers: Demo. |
… & linear functions
@nicolaskruchten @alexcjohnson |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 💯
Fixes #5250 and,
Resolves #5195 by introducing two new attributes at
layout
andaxis
levels.TODO:
@plotly/plotly_js