d3heatmap
d3heatmap copied to clipboard
tooltips stay visible when Shiny redraws the heatmap
When a tooltip is shown while Shiny changes the heatmap, the old tooltip stays visible and cannot be removed by the user. In general, it seems that d3heatmap creates new tooltip divs every time it is redrawn. As a workaround, I have added this code to my Shiny app:
tags$script('
$(document).ready(function() {
$("#heatmap").on("shiny:recalculating", function(event) {
$(".d3heatmap-tip").remove();
});
});
')
However, it would be nice if d3heatmap would remove or recycle the tooltips.
@mkuhn thank you very much for sharing your code! I had the exact same problem, and it fixed it.
The same issue also happens when resizing the window. Adding a snippet with shiny:visualchange
instead of shiny:recalculating
does the trick though.