aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-09-23 04:39:47 +0300
committerFrederick Muriuki Muriithi2021-09-23 04:39:47 +0300
commit82a2480dd4ffd74f54334ff9a2d4eed8272daa47 (patch)
treead93a8409ed74865a442d6d32ca2af03a77dd645
parent1ef632d1b455e9c78b0c40caab1686b8c5ad80bf (diff)
downloadgenenetwork2-82a2480dd4ffd74f54334ff9a2d4eed8272daa47.tar.gz
Clear any existing image on subsequent clicks
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * If the user clicks on the "Clustered Heatmap" button, the system should remove any previously existing clustered heatmap image and replace it with the new image.
-rw-r--r--wqflask/wqflask/templates/collections/view.html8
1 files changed, 8 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index a034f628..99ba3756 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -265,12 +265,20 @@
e.preventDefault();
});
+ function clear_heatmap_area() {
+ area = document.getElementById("clustered-heatmap-image-area");
+ area.querySelectorAll("svg").forEach(function(child) {
+ child.remove();
+ });
+ }
+
function generate_clustered_heatmap(heatmap_data) {
image_area = document.getElementById("clustered-heatmap-image-area")
Plotly.newPlot(image_area, heatmap_data)
}
$("#clustered-heatmap").on("click", function() {
+ clear_heatmap_area();
heatmap_url = $(this).attr("data-url")
traits = $(".trait_checkbox:checked").map(function() {
return this.value