Fixing issue where tooltip gets hidden on dashboard for all charts (#6852)

This commit is contained in:
michellethomas 2019-02-11 15:15:47 -08:00 committed by GitHub
parent 73e119a84e
commit 4638618545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

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

View File

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