mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
doughnut charts handling negative values
This commit is contained in:
parent
092b011f9b
commit
8b3a98f242
4
Chart.js
vendored
4
Chart.js
vendored
@ -2416,12 +2416,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(){
|
||||||
|
2
Chart.min.js
vendored
2
Chart.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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(){
|
||||||
|
Loading…
Reference in New Issue
Block a user