mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
prevent divide by zero error when calculating a circumference
This commit is contained in:
parent
1cfa42bc24
commit
a7712e8c71
@ -108,8 +108,12 @@
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
calculateCircumference : function(value){
|
||||
return (Math.PI*2)*(value / this.total);
|
||||
calculateCircumference : function(value) {
|
||||
if ( this.total > 0 ) {
|
||||
return (Math.PI*2)*(value / this.total);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
calculateTotal : function(data){
|
||||
this.total = 0;
|
||||
@ -181,4 +185,4 @@
|
||||
defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
}).call(this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user