]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
maxRotation test is off by one 1797/head
authorKriss <kriss@xixs.com>
Thu, 17 Dec 2015 22:00:12 +0000 (22:00 +0000)
committerKriss <kriss@xixs.com>
Thu, 17 Dec 2015 22:00:12 +0000 (22:00 +0000)
Most notable when maxRotation=0 and you end up with the text becoming non centred as it has rotated it by 1 and switched to right alligned mode.

src/core/core.scale.js

index 6f15033e69ae6a4b00fd1cbd4d51cfa14df70daa..aa8161684c8ba3c02dfe362fe7b98ad8aeb11877 100644 (file)
                                var tickWidth = this.getPixelForTick(1) - this.getPixelForTick(0) - 6;
 
                                //Max label rotation can be set or default to 90 - also act as a loop counter
-                               while (this.labelWidth > tickWidth && this.labelRotation <= this.options.ticks.maxRotation) {
+                               while (this.labelWidth > tickWidth && this.labelRotation < this.options.ticks.maxRotation) {
                                        cosRotation = Math.cos(helpers.toRadians(this.labelRotation));
                                        sinRotation = Math.sin(helpers.toRadians(this.labelRotation));