# HG changeset patch # User Thomas Junk # Date 1562845886 -7200 # Node ID f7f09f32d6e098382796a0e515e166193684a580 # Parent 9440d29220976cbd1482b8f36a7b37ac030da04f hydrological conditions: omit rendering, when container isn't visible diff -r 9440d2922097 -r f7f09f32d6e0 client/src/components/gauge/HydrologicalConditions.vue --- a/client/src/components/gauge/HydrologicalConditions.vue Thu Jul 11 12:49:38 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Thu Jul 11 13:51:26 2019 +0200 @@ -334,12 +334,16 @@ drawDiagram() { // remove old diagram d3.select("#" + this.containerId + " svg").remove(); - if (!this.selectedGauge || !this.longtermWaterlevels.length) return; + const el = document.querySelector("#" + this.containerId); + if (!this.selectedGauge || !this.longtermWaterlevels.length || !el) + return; + const svgWidth = el.clientWidth; + const svgHeight = el.clientHeight; this.renderTo({ element: `#${this.containerId}`, dimensions: this.getDimensions({ - svgWidth: document.querySelector("#" + this.containerId).clientWidth, - svgHeight: document.querySelector("#" + this.containerId).clientHeight + svgWidth: svgWidth, + svgHeight: svgHeight }) }); },