]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Ignore null values when calculating scale 1875/head
authorMichaël Arnauts <michael.arnauts@gmail.com>
Sat, 9 Jan 2016 11:04:29 +0000 (12:04 +0100)
committerMichaël Arnauts <michael.arnauts@gmail.com>
Sat, 9 Jan 2016 11:04:29 +0000 (12:04 +0100)
src/Chart.Core.js

index 16f9d50d1cc16449e54d0bb81674846e38e0f7b2..3a21f0abd0c7f6455a2525e5f1220307781cfd02 100755 (executable)
                                maxSteps = Math.floor(drawingSize/(textSize * 1.5)),
                                skipFitting = (minSteps >= maxSteps);
 
-                       var maxValue = max(valuesArray),
-                               minValue = min(valuesArray);
+                       // Filter out null values since these would min() to zero
+                       var values = [];
+                       each(valuesArray, function( v ){
+                               v == null || values.push( v );
+                       });
+                       var minValue = min(values),
+                           maxValue = max(values);
 
                        // We need some degree of separation here to calculate the scales if all the values are the same
                        // Adding/minusing 0.5 will give us a range of 1.