doughnut charts handling negative values

This commit is contained in:
Ben Dixon 2015-01-15 13:31:54 -06:00
parent 092b011f9b
commit 8b3a98f242
3 changed files with 5 additions and 5 deletions

4
Chart.js vendored
View File

@ -2416,12 +2416,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(){

2
Chart.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -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(){