mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix a divide by 0 error when there is only 1 label
This commit is contained in:
parent
8244dd1271
commit
2e0211320b
@ -1575,7 +1575,7 @@
|
||||
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){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user