Skip to content

Commit

Permalink
Do not draw tooltips that have no items (chartjs#4034)
Browse files Browse the repository at this point in the history
  • Loading branch information
samueljo authored and roicos committed Aug 21, 2017
1 parent 5f06e6b commit 85e3645
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/core.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 85e3645

Please sign in to comment.