]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Handle transitioning NaNs
authorEvert Timberg <evert.timberg@gmail.com>
Sun, 15 Nov 2015 03:49:53 +0000 (22:49 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Sun, 15 Nov 2015 03:49:53 +0000 (22:49 -0500)
src/core/core.element.js
src/scales/scale.radialLinear.js

index 5942696199f09a93d864b7d941e7a6893f3dc984..d9c0d35a623715987693e2be9fe142b535bdd1da 100644 (file)
@@ -38,7 +38,7 @@
 
                                // Init if doesn't exist
                                else if (!this._view[key]) {
-                                       if (typeof value === 'number') {
+                                       if (typeof value === 'number' && isNaN(this._view[key]) === false) {
                                                this._view[key] = value * ease;
                                        } else {
                                                this._view[key] = value || null;
                                }
                                // Number transitions
                                else if (typeof value === 'number') {
-                                       var startVal = this._start[key] !== undefined ? this._start[key] : 0;
+                                       var startVal = this._start[key] !== undefined && isNaN(this._start[key]) === false ? this._start[key] : 0;
                                        this._view[key] = ((this._model[key] - startVal) * ease) + startVal;
                                }
                                // Everything else
                                else {
                                        this._view[key] = value;
                                }
-
                        }, this);
 
                        if (ease === 1) {
index 15fdb36269672488706033687f2d225cfb890efe..4d622cc98aa2cd059a06f487f2870118781e41d9 100644 (file)
                        return index * angleMultiplier - (Math.PI / 2);
                },
                getDistanceFromCenterForValue: function(value) {
-                       if (value === null) return 0; // null always in center
+                       if (value === null || value === undefined || isNaN(value)) {
+                               return 0; // null always in center      
+                       } 
+                       
                        // Take into account half font size + the yPadding of the top value
                        var scalingFactor = this.drawingArea / (this.max - this.min);
                        if (this.options.reverse) {