changeset 4009:aee74a3a17f3

available_fairway_depth: in case the resultset has no inbetween result, the bar chart should render correct
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 19 Jul 2019 11:53:06 +0200
parents 224ee5a3acb1
children ccdfa66e33c3
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Fri Jul 19 11:04:24 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Fri Jul 19 11:53:06 2019 +0200
@@ -102,17 +102,31 @@
 const transformAFD = csv => {
   return csv.map(e => {
     const result = e.split(",");
-    let [label, _, ldc, lower, middle, highestLevel] = result;
-    let levelsWithSum = [
+    let label, _, ldc, lower, middle, highestLevel;
+    let levelsWithSum;
+    if (result.length == 6) {
+      [label, _, ldc, lower, middle, highestLevel] = result;
+      levelsWithSum = [
+        {
+          height: Number(lower),
+          translateY: Number(middle)
+        },
+        {
+          height: Number(middle),
+          translateY: 0
+        }
+      ];
+    } else {
       {
-        height: Number(lower),
-        translateY: Number(middle)
-      },
-      {
-        height: Number(middle),
-        translateY: 0
+        [label, _, ldc, middle, highestLevel] = result;
+        levelsWithSum = [
+          {
+            height: Number(middle),
+            translateY: 0
+          }
+        ];
       }
-    ];
+    }
     return {
       label: label,
       ldc: ldc,