changeset 3888:ccd77fe5072c

client: waterlevels: diagram size dynamic, taken from tamplate
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 10 Jul 2019 13:17:41 +0200
parents 83c4672369a2
children 851c0ccba59b 59dba489ec7b
files client/src/components/gauge/Waterlevel.vue
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue	Wed Jul 10 12:47:24 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Wed Jul 10 13:17:41 2019 +0200
@@ -287,8 +287,14 @@
     addDiagram(position, offset, width, height) {
       let x = offset.x,
         y = offset.y;
-      const svgWidth = 1550;
-      const svgHeight = 400;
+      const svgWidth = this.millimeter2pixels(
+        width,
+        this.templateData.properties.resolution || 80
+      );
+      const svgHeight = this.millimeter2pixels(
+        height,
+        this.templateData.properties.resolution || 80
+      );
       // check if there are tow diagrams on the screen
       // draw the diagram in a separated html element to get the full size
       const offScreen = document.querySelector("#offScreen");
@@ -319,7 +325,7 @@
         xOffset: x,
         yOffset: y,
         // TODO depend on the size and aspect ration on paper
-        scale: this.templateData.properties.paperSize === "a3" ? 0.45 : 0.18
+        scale: this.templateData.properties.paperSize === "a3" ? 0.3 : 0.27
       });
       offScreen.removeChild(svg);
     },