From: Ben Woodford Date: Thu, 24 Sep 2015 14:54:10 +0000 (+0100) Subject: Only rotate label while rotation is < maxRotation X-Git-Tag: 2.0.0-alpha4~13^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7ab51f29b933659ca2058110e35219d3d002068;p=thirdparty%2FChart.js.git 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) --- diff --git a/src/scales/scale.category.js b/src/scales/scale.category.js index 939d32404..5ba78e2d6 100644 --- a/src/scales/scale.category.js +++ b/src/scales/scale.category.js @@ -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));