fix multiTooltip appearance with empty title

https://github.com/nnnick/Chart.js/issues/1039
This commit is contained in:
dima117 2015-04-03 22:19:34 +03:00
parent 4009dbd6a0
commit ca7a39232a

View File

@ -1436,7 +1436,8 @@
this.titleFont = fontString(this.titleFontSize,this.titleFontStyle,this.titleFontFamily); this.titleFont = fontString(this.titleFontSize,this.titleFontStyle,this.titleFontFamily);
this.height = (this.labels.length * this.fontSize) + ((this.labels.length-1) * (this.fontSize/2)) + (this.yPadding*2) + this.titleFontSize *1.5; this.titleHeight = this.title ? this.titleFontSize * 1.5 : 0;
this.height = (this.labels.length * this.fontSize) + ((this.labels.length-1) * (this.fontSize/2)) + (this.yPadding*2) + this.titleHeight;
this.ctx.font = this.titleFont; this.ctx.font = this.titleFont;
@ -1472,9 +1473,9 @@
//If the index is zero, we're getting the title //If the index is zero, we're getting the title
if (index === 0){ if (index === 0){
return baseLineHeight + this.titleFontSize/2; return baseLineHeight + this.titleHeight / 3;
} else{ } else{
return baseLineHeight + ((this.fontSize*1.5*afterTitleIndex) + this.fontSize/2) + this.titleFontSize * 1.5; return baseLineHeight + ((this.fontSize * 1.5 * afterTitleIndex) + this.fontSize / 2) + this.titleHeight;
} }
}, },