mistercrunch closed pull request #3487: [Bugfix] nvd3 tooltips do not disappear
URL: https://github.com/apache/incubator-superset/pull/3487
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/visualizations/nvd3_vis.js
b/superset/assets/visualizations/nvd3_vis.js
index 831b99710e..5f8be80faa 100644
--- a/superset/assets/visualizations/nvd3_vis.js
+++ b/superset/assets/visualizations/nvd3_vis.js
@@ -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));
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services