changeset 4140:4d7569cca5e6 improvepdf

client: fix rendering of nash-sutcliffe lines on pdf
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 01 Aug 2019 12:48:33 +0200
parents 0becdd2812c9
children 552ea22ed266
files client/src/components/gauge/Waterlevel.vue
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue	Thu Aug 01 12:20:07 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Thu Aug 01 12:48:33 2019 +0200
@@ -838,19 +838,27 @@
             "stroke-opacity",
             scale.x.domain()[1] - scale.x.domain()[0] > 90 * 86400000 ? 0 : 1
           );
-
         return d3
           .area()
           .x(d => scale.x(d))
           .y0(() => dimensions.mainHeight + 0.5)
-          .y1(() => dimensions.mainHeight - 15 * (hours / 24));
+          .y1(
+            () =>
+              dimensions.mainHeight -
+              Math.floor(0.06 * dimensions.mainHeight) * (hours / 24)
+          );
       };
 
       const nashSutcliffeLabel = (label, date, hours) => {
         let days = hours / 24;
         label
           .attr("x", Math.min(scale.x(date), dimensions.width) - 4)
-          .attr("y", dimensions.mainHeight - (15 * days + 0.5) + 12);
+          .attr(
+            "y",
+            dimensions.mainHeight -
+              (Math.floor(0.06 * dimensions.mainHeight) * days + 0.5) +
+              12
+          );
       };
 
       if (coeff.samples) {