changeset 4011:44060b9027da

available_fairway_depth: in case the limits are equal the middle label is omitted. and in print too
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 19 Jul 2019 12:39:50 +0200
parents ccdfa66e33c3
children 7a0f56f9d0dd
files client/src/components/fairway/AvailableFairwayDepth.vue client/src/components/fairway/AvailableFairwayDepthLNWL.vue
diffstat 2 files changed, 55 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue	Fri Jul 19 12:08:15 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepth.vue	Fri Jul 19 12:39:50 2019 +0200
@@ -169,12 +169,18 @@
       const w = [this.widthlimit1, this.widthlimit2].sort();
       const lowerBound = [d[0], w[0]].filter(x => x).join(", ");
       const upperBound = [d[1], w[1]].filter(x => x).join(", ");
-      return [
-        `> LDC`,
-        `>= ${upperBound}`,
-        `< ${upperBound}`,
-        `< ${lowerBound}`
-      ];
+      let result;
+      if (this.depthlimit1 !== this.depthlimit2) {
+        result = [
+          `> LDC`,
+          `>= ${upperBound}`,
+          `< ${upperBound}`,
+          `< ${lowerBound}`
+        ];
+      } else {
+        result = [`> LDC`, `>= ${upperBound}`, `< ${upperBound}`];
+      }
+      return result;
     },
     dataLink() {
       return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`;
@@ -265,26 +271,39 @@
         y = this.pdf.height - offset.y - this.getTextHeight(6);
       }
 
-      this.pdf.doc.setTextColor(color);
-      this.pdf.doc.setDrawColor(this.$options.COLORS.LDC);
-      this.pdf.doc.setFillColor(this.$options.COLORS.LDC);
-      this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD");
-      this.pdf.doc.text(this.legend[0], x + 12, y + 3);
+      if (this.legend[3]) {
+        this.pdf.doc.setTextColor(color);
+        this.pdf.doc.setDrawColor(this.$options.COLORS.LDC);
+        this.pdf.doc.setFillColor(this.$options.COLORS.LDC);
+        this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[0], x + 12, y + 3);
+
+        this.pdf.doc.setDrawColor(this.$options.COLORS.REST[0]);
+        this.pdf.doc.setFillColor(this.$options.COLORS.REST[0]);
+        this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[1], x + 12, y + 8);
+
+        this.pdf.doc.setDrawColor(this.$options.COLORS.REST[1]);
+        this.pdf.doc.setFillColor(this.$options.COLORS.REST[1]);
+        this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[2], x + 12, y + 13);
 
-      this.pdf.doc.setDrawColor(this.$options.COLORS.REST[0]);
-      this.pdf.doc.setFillColor(this.$options.COLORS.REST[0]);
-      this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD");
-      this.pdf.doc.text(this.legend[1], x + 12, y + 8);
+        this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST);
+        this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST);
+        this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[3], x + 12, y + 18);
+      } else {
+        this.pdf.doc.setTextColor(color);
+        this.pdf.doc.setDrawColor(this.$options.COLORS.LDC);
+        this.pdf.doc.setFillColor(this.$options.COLORS.LDC);
+        this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[0], x + 12, y + 3);
 
-      this.pdf.doc.setDrawColor(this.$options.COLORS.REST[1]);
-      this.pdf.doc.setFillColor(this.$options.COLORS.REST[1]);
-      this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD");
-      this.pdf.doc.text(this.legend[2], x + 12, y + 13);
-
-      this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST);
-      this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST);
-      this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD");
-      this.pdf.doc.text(this.legend[3], x + 12, y + 18);
+        this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST);
+        this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST);
+        this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD");
+        this.pdf.doc.text(this.legend[1], x + 12, y + 8);
+      }
     },
     legendStyle(index) {
       return [
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri Jul 19 12:08:15 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri Jul 19 12:39:50 2019 +0200
@@ -166,12 +166,18 @@
       const w = [this.widthlimit1, this.widthlimit2].sort();
       const lowerBound = [d[0], w[0]].filter(x => x).join(", ");
       const upperBound = [d[1], w[1]].filter(x => x).join(", ");
-      return [
-        `> LDC`,
-        `< ${lowerBound}`,
-        `< ${upperBound}`,
-        `>= ${upperBound}`
-      ];
+      let result;
+      if (this.depthlimit1 !== this.depthlimit2) {
+        result = [
+          `> LDC`,
+          `>= ${upperBound}`,
+          `< ${upperBound}`,
+          `< ${lowerBound}`
+        ];
+      } else {
+        result = [`> LDC`, `>= ${upperBound}`, `< ${upperBound}`];
+      }
+      return result;
     },
     dataLink() {
       return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`;