]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
add 10 to yLabelWidth on set, rather than on use 676/head 677/head
authorRylan Halteman <rylan@wattpad.com>
Wed, 8 Oct 2014 15:36:39 +0000 (11:36 -0400)
committerRylan Halteman <rylan@wattpad.com>
Wed, 8 Oct 2014 15:36:39 +0000 (11:36 -0400)
src/Chart.Core.js

index 03b99b45a582e69ae57ea79f3ed3e5bbae3bb0d1..bf3fbe9f9953f8fefc3aae457d28166f740a6603 100755 (executable)
                        for (var i=0; i<=this.steps; i++){
                                this.yLabels.push(template(this.templateString,{value:(this.min + (i * this.stepValue)).toFixed(stepDecimalPlaces)}));
                        }
-                       this.yLabelWidth = (this.display && this.showLabels) ? longestText(this.ctx,this.font,this.yLabels) : 0;
+                       this.yLabelWidth = (this.display && this.showLabels) ? longestText(this.ctx,this.font,this.yLabels) + 10 : 0;
                },
                addXLabel : function(label){
                        this.xLabels.push(label);
 
 
                        this.xScalePaddingRight = lastWidth/2 + 3;
-                       this.xScalePaddingLeft = (firstWidth/2 > this.yLabelWidth + 10) ? firstWidth/2 : this.yLabelWidth + 10;
+                       this.xScalePaddingLeft = (firstWidth/2 > this.yLabelWidth) ? firstWidth/2 : this.yLabelWidth;
 
                        this.xLabelRotation = 0;
                        if (this.display){
                                        lastRotated = cosRotation * lastWidth;
 
                                        // We're right aligning the text now.
-                                       if (firstRotated + this.fontSize / 2 > this.yLabelWidth + 8){
+                                       if (firstRotated + this.fontSize / 2 > this.yLabelWidth){
                                                this.xScalePaddingLeft = firstRotated + this.fontSize / 2;
                                        }
                                        this.xScalePaddingRight = this.fontSize/2;