| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
There might be some user applications that expect to have the scale range [-1, 1] with no data, but it does not seem to be the intention of the current implementation, and for better consistency, I'm fine with the changes in this PR.
Sorry, something went wrong.
* [performance] replace helpers.each calls with for-loops * Use Math.min/max instead of if statement * Rename variable
| Back | FazBrowse Home | New Git URL |
for-loop and Math.min/max is much faster than helpers.forEach and if statements: https://jsperf.com/chartjs-helpers-each
I was focused on determineDataLimits since that's a particularly costly method that iterates over each data point. There are more places where helpers.each is called in less performance-sensitive locations where there wasn't a compelling reason to change it
The scale behavior was really inconsistent. If there was no data then the tests expected the scale to start at -1. I changed it to start at 0 instead for consistency. E.g. I would expect it to behave the same when there's no data and all data points are hidden. When all data points are hidden then the tests expect the scale to start at 0. E.g.:
Chart.js/test/specs/scale.linear.tests.js
Line 1037 in 70b32ff