From: Ben Dixon Date: Thu, 15 Jan 2015 19:40:08 +0000 (-0600) Subject: handling negative values in doughnut charts X-Git-Tag: v1.0.2~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d051dfe47fe422ea9c40b73695e3ccdf9ba6c511;p=thirdparty%2FChart.js.git handling negative values in doughnut charts --- diff --git a/src/Chart.Doughnut.js b/src/Chart.Doughnut.js index 35de93c7f..a892b0efc 100644 --- a/src/Chart.Doughnut.js +++ b/src/Chart.Doughnut.js @@ -109,12 +109,12 @@ } }, calculateCircumference : function(value){ - return (Math.PI*2)*(value / this.total); + return (Math.PI*2)*(Math.abs(value) / this.total); }, calculateTotal : function(data){ this.total = 0; helpers.each(data,function(segment){ - this.total += segment.value; + this.total += Math.abs(segment.value); },this); }, update : function(){