From: Samuel Jo Date: Tue, 21 Mar 2017 00:40:28 +0000 (-0400) Subject: Do not draw tooltips that have no items (#4034) X-Git-Tag: v2.6.0~2^2~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8367f90df0ce765d096c3175b44ffa31d677a14e;p=thirdparty%2FChart.js.git Do not draw tooltips that have no items (#4034) --- diff --git a/src/core/core.tooltip.js b/src/core/core.tooltip.js index 16fcb099b..15574a827 100755 --- a/src/core/core.tooltip.js +++ b/src/core/core.tooltip.js @@ -789,7 +789,10 @@ module.exports = function(Chart) { // IE11/Edge does not like very small opacities, so snap to 0 var opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity; - if (this._options.enabled) { + // Truthy/falsey value for empty tooltip + var hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length; + + if (this._options.enabled && hasTooltipContent) { // Draw Background this.drawBackground(pt, vm, ctx, tooltipSize, opacity);