From: dima117 Date: Fri, 3 Apr 2015 19:19:34 +0000 (+0300) Subject: fix multiTooltip appearance with empty title X-Git-Tag: v1.1.0~28^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca7a39232a265437acda0b8d772665ace6092c80;p=thirdparty%2FChart.js.git fix multiTooltip appearance with empty title https://github.com/nnnick/Chart.js/issues/1039 --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 296844ea2..31b96f887 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -1436,7 +1436,8 @@ 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; @@ -1472,9 +1473,9 @@ //If the index is zero, we're getting the title if (index === 0){ - return baseLineHeight + this.titleFontSize/2; + return baseLineHeight + this.titleHeight / 3; } 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; } },