handling negative values in doughnut charts

This commit is contained in:
Ben Dixon 2015-01-15 13:40:08 -06:00
parent 06b02e9c33
commit d051dfe47f

View File

@ -109,12 +109,12 @@
} }
}, },
calculateCircumference : function(value){ calculateCircumference : function(value){
return (Math.PI*2)*(value / this.total); return (Math.PI*2)*(Math.abs(value) / this.total);
}, },
calculateTotal : function(data){ calculateTotal : function(data){
this.total = 0; this.total = 0;
helpers.each(data,function(segment){ helpers.each(data,function(segment){
this.total += segment.value; this.total += Math.abs(segment.value);
},this); },this);
}, },
update : function(){ update : function(){