From 8367f90df0ce765d096c3175b44ffa31d677a14e Mon Sep 17 00:00:00 2001 From: Samuel Jo Date: Mon, 20 Mar 2017 20:40:28 -0400 Subject: [PATCH] Do not draw tooltips that have no items (#4034) --- src/core/core.tooltip.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);