This is an automated email from the ASF dual-hosted git repository.
christine pushed a commit to branch release--0.31
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/release--0.31 by this push:
new d7e038e Fixing issue where tooltip gets hidden on dashboard for all
charts (#6852)
d7e038e is described below
commit d7e038eaa5c29ada4cd3506033814700bf4f34f7
Author: michellethomas <[email protected]>
AuthorDate: Mon Feb 11 15:15:47 2019 -0800
Fixing issue where tooltip gets hidden on dashboard for all charts (#6852)
(cherry picked from commit 4638618545f502bb93dba7bdce78f4cf4d2f8026)
---
superset/assets/src/visualizations/nvd3/NVD3Vis.js | 4 ++--
superset/assets/src/visualizations/nvd3/utils.js | 10 ++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/superset/assets/src/visualizations/nvd3/NVD3Vis.js
b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
index 062906e..e7f9445 100644
--- a/superset/assets/src/visualizations/nvd3/NVD3Vis.js
+++ b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
@@ -712,7 +712,7 @@ function nvd3Vis(element, props) {
.call(chart);
// on scroll, hide tooltips. throttle to only 4x/second.
- window.addEventListener('scroll', throttle(hideTooltips, 250));
+ window.addEventListener('scroll', throttle(() => hideTooltips(element),
250));
// The below code should be run AFTER rendering because chart is updated
in call()
if (isTimeSeries && activeAnnotationLayers.length > 0) {
@@ -936,7 +936,7 @@ function nvd3Vis(element, props) {
// hide tooltips before rendering chart, if the chart is being re-rendered
sometimes
// there are left over tooltips in the dom,
// this will clear them before rendering the chart again.
- hideTooltips();
+ hideTooltips(element);
nv.addGraph(drawGraph);
}
diff --git a/superset/assets/src/visualizations/nvd3/utils.js
b/superset/assets/src/visualizations/nvd3/utils.js
index 92ac3dd..a6d4842 100644
--- a/superset/assets/src/visualizations/nvd3/utils.js
+++ b/superset/assets/src/visualizations/nvd3/utils.js
@@ -165,10 +165,12 @@ export function generateBubbleTooltipContent({
return s;
}
-export function hideTooltips() {
- const targets = document.querySelectorAll('.nvtooltip');
- if (targets.length > 0) {
- targets.forEach(t => t.remove());
+export function hideTooltips(element) {
+ if (element) {
+ const targets = element.querySelectorAll('.nvtooltip');
+ if (targets.length > 0) {
+ targets.forEach(t => t.remove());
+ }
}
}