Only rotate label while rotation is < maxRotation

Checking for <= maxRotation results in a labelRotation of 1 if maxRotation is 0, which doesn't make any sense (and also causes the text to be right aligned not centred)
This commit is contained in:
Ben Woodford 2015-09-24 15:54:10 +01:00
parent 36493e042e
commit d7ab51f29b

View File

@ -147,7 +147,7 @@
var datasetWidth = Math.floor(this.getPixelForValue(0, 1) - this.getPixelForValue(0, 0)) - 6;
//Max label rotation can be set or default to 90 - also act as a loop counter
while (this.labelWidth > datasetWidth && this.labelRotation <= this.options.labels.maxRotation) {
while (this.labelWidth > datasetWidth && this.labelRotation < this.options.labels.maxRotation) {
cosRotation = Math.cos(helpers.toRadians(this.labelRotation));
sinRotation = Math.sin(helpers.toRadians(this.labelRotation));