From: Rylan Halteman Date: Wed, 8 Oct 2014 15:36:39 +0000 (-0400) Subject: add 10 to yLabelWidth on set, rather than on use X-Git-Tag: v2.0-alpha~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ab5e8400afad4ea3e3d3d47531465984f31a2ee;p=thirdparty%2FChart.js.git add 10 to yLabelWidth on set, rather than on use --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 03b99b45a..bf3fbe9f9 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -1411,7 +1411,7 @@ 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); @@ -1484,7 +1484,7 @@ 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){ @@ -1503,7 +1503,7 @@ 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;