Skip to content

Commit

Permalink
Bugfix: nvd3 tooltips do not disappear
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogball committed Sep 18, 2017
1 parent e22aecb commit ca449f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,19 @@ function nvd3Vis(slice, payload) {
.call(chart);
}

// clean up tooltips when switching to another viz
const container = $(slice.selector);
if (!container.data('observed')) {
container.data('observed', true); // limit to one observer
const observer = new MutationObserver(() => {
container.data('observed', false);
$('.nvtooltip').remove();
observer.disconnect();
});
const cfg = { attributes: true, attributeFilter: ['class'] };
observer.observe(container[0], cfg);
}

// on scroll, hide tooltips. throttle to only 4x/second.
$(window).scroll(throttle(hideTooltips, 250));

Expand Down

0 comments on commit ca449f8

Please sign in to comment.