]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
fix multiTooltip appearance with empty title 1040/head
authordima117 <dima117a@gmail.com>
Fri, 3 Apr 2015 19:19:34 +0000 (22:19 +0300)
committerdima117 <dima117a@gmail.com>
Fri, 3 Apr 2015 19:19:34 +0000 (22:19 +0300)
https://github.com/nnnick/Chart.js/issues/1039

src/Chart.Core.js

index 296844ea2ecc5f863ce894bd66d900ddb2ecc810..31b96f8870c1de1e137381fdc2e5d35e1b189589 100755 (executable)
 
                        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;
 
 
                        //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;
                        }
 
                },