Do not draw tooltips that have no items (#4034)

This commit is contained in:
Samuel Jo
2017-03-20 20:40:28 -04:00
committed by Evert Timberg
parent cffa9447a1
commit 8367f90df0

View File

@@ -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);