]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Bad values for data are now converted to NaN
authorTanner Linsley <tannerlinsley@gmail.com>
Fri, 23 Oct 2015 22:36:59 +0000 (16:36 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Fri, 23 Oct 2015 22:36:59 +0000 (16:36 -0600)
src/core/core.scale.js

index 1338011500c117d4f390f5d8e32f98b067a0f45f..02fa87ce6aba35509bf55939df5f776acaadab57 100644 (file)
                isHorizontal: function() {
                        return this.options.position == "top" || this.options.position == "bottom";
                },
-               
-               // Get the correct value. If the value type is object get the x or y based on whether we are horizontal or not
+
+               // Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
                getRightValue: function(rawValue) {
-                       return (typeof(rawValue) === "object" && rawValue !== null) ? (this.isHorizontal() ? rawValue.x : rawValue.y) : rawValue;
+                       if (isNaN(rawValue) || rawValue === null || typeof(rawValue) === 'undefined') {
+                               return NaN;
+                       }
+                       return typeof(rawValue) === "object" ? (this.isHorizontal() ? rawValue.x : rawValue.y) : rawValue;
                },
 
                // Used to get the value to display in the tooltip for the data at the given index