]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix a divide by 0 error when there is only 1 label 898/head
authorEvert Timberg <evert.timberg@gmail.com>
Tue, 27 Jan 2015 23:31:03 +0000 (18:31 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Tue, 27 Jan 2015 23:31:03 +0000 (18:31 -0500)
src/Chart.Core.js

index 7cea9953578cd6d6814548432a0300fc6b83f1b5..eb34c871c18982780cc0bd5812a2174db823c70e 100755 (executable)
                        var isRotated = (this.xLabelRotation > 0),
                                // innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding,
                                innerWidth = this.width - (this.xScalePaddingLeft + this.xScalePaddingRight),
-                               valueWidth = innerWidth/(this.valuesCount - ((this.offsetGridLines) ? 0 : 1)),
+                               valueWidth = innerWidth/Math.max((this.valuesCount - ((this.offsetGridLines) ? 0 : 1)), 1),
                                valueOffset = (valueWidth * index) + this.xScalePaddingLeft;
 
                        if (this.offsetGridLines){