From 63e549aa913e7b79e3cba96892bdbcf6c3b73923 Mon Sep 17 00:00:00 2001 From: Ossama Rafique Date: Tue, 16 Jan 2024 12:20:26 -0500 Subject: [PATCH] Bugfix/legend renders twice when you render the plot twice (#33) * Remove Existing Legend Before Creating A New One * Bump up lib version --- package.json | 2 +- src/BaseGL.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 80de23f..6b53717 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "epiviz.heatmap.gl", - "version": "0.0.22", + "version": "0.0.23", "repository": "https://github.com/jkanche/epiviz.heatmap.gl", "homepage": "https://github.com/jkanche/epiviz.heatmap.gl", "author": { diff --git a/src/BaseGL.js b/src/BaseGL.js index 321bcfd..27a4efa 100644 --- a/src/BaseGL.js +++ b/src/BaseGL.js @@ -749,6 +749,9 @@ class BaseGL { // Only render the legend if we have the legend data and the legend dom element if (!this.legendDomElement || !this.intensityLegendData) return; + //Clear the legend dom element + select(this.legendDomElement).select("svg").remove(); + const parsedMargins = parseMargins(this._spec.margins); const containerWidth = this.legendWidth ||