]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
prevent divide by zero error when calculating a circumference 756/head
authorchad <chasd00@gmail.com>
Thu, 13 Nov 2014 17:36:13 +0000 (11:36 -0600)
committerchad <chasd00@gmail.com>
Thu, 13 Nov 2014 17:36:13 +0000 (11:36 -0600)
src/Chart.Doughnut.js

index 35de93c7fd606ad844f0ffc9f1c436f29868b546..5044be6046cdd559e5e8ba83cca619bc3b384901 100644 (file)
                                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;
                defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
        });
 
-}).call(this);
\ No newline at end of file
+}).call(this);