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 etimberg committed Mar 21, 2017
1 parent 4565991 commit f718e16
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 f718e16

Please sign in to comment.