From 57bd8c7715998a668d1a3b41daa8a520070969fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C3=ABl=20Arnauts?= Date: Sat, 9 Jan 2016 12:04:29 +0100 Subject: [PATCH] Ignore null values when calculating scale --- src/Chart.Core.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 16f9d50d1..3a21f0abd 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -409,8 +409,13 @@ 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. -- 2.47.2