changeset 3618:c03170a1c333

client: waterlevel: check if there is prediction data before drawing the predictionarea
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 05 Jun 2019 15:47:30 +0200
parents bcf9713ee359
children ca7821e1f720 2893ee8ce06f
files client/src/components/gauge/Waterlevel.vue
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue	Wed Jun 05 14:57:44 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Wed Jun 05 15:47:30 2019 +0200
@@ -217,6 +217,9 @@
       }-${this.dateFrom.toISOString().split("T")[0]}-${
         this.dateTo.toISOString().split("T")[0]
       }.csv`;
+    },
+    hasPredictions() {
+      return this.waterlevels.find(d => d.predicted);
     }
   },
   watch: {
@@ -552,7 +555,9 @@
       // draw (order matters)
       updaters.push(this.drawAxes());
       updaters.push(this.drawWaterlevelChart());
-      updaters.push(this.drawPredictionAreas());
+      if (this.hasPredictions) {
+        updaters.push(this.drawPredictionAreas());
+      }
       updaters.push(this.drawNowLines());
 
       // static, don't need updater