mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Merge pull request #677 from rylanhalteman/fix-yLabel-padding
add 10 to yLabelWidth on set, rather than on use
This commit is contained in:
commit
604d6bd4e3
@ -1530,7 +1530,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);
|
||||
@ -1603,7 +1603,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){
|
||||
@ -1622,7 +1622,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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user