comparison client/src/components/gauge/Waterlevel.vue @ 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 d42158f77841
children e5bd8601bee1
comparison
equal deleted inserted replaced
3887:83c4672369a2 3888:ccd77fe5072c
285 } 285 }
286 }, 286 },
287 addDiagram(position, offset, width, height) { 287 addDiagram(position, offset, width, height) {
288 let x = offset.x, 288 let x = offset.x,
289 y = offset.y; 289 y = offset.y;
290 const svgWidth = 1550; 290 const svgWidth = this.millimeter2pixels(
291 const svgHeight = 400; 291 width,
292 this.templateData.properties.resolution || 80
293 );
294 const svgHeight = this.millimeter2pixels(
295 height,
296 this.templateData.properties.resolution || 80
297 );
292 // check if there are tow diagrams on the screen 298 // check if there are tow diagrams on the screen
293 // draw the diagram in a separated html element to get the full size 299 // draw the diagram in a separated html element to get the full size
294 const offScreen = document.querySelector("#offScreen"); 300 const offScreen = document.querySelector("#offScreen");
295 offScreen.style.width = `${svgWidth}px`; 301 offScreen.style.width = `${svgWidth}px`;
296 offScreen.style.height = `${svgHeight}px`; 302 offScreen.style.height = `${svgHeight}px`;
317 } 323 }
318 svg2pdf(svg, this.pdf.doc, { 324 svg2pdf(svg, this.pdf.doc, {
319 xOffset: x, 325 xOffset: x,
320 yOffset: y, 326 yOffset: y,
321 // TODO depend on the size and aspect ration on paper 327 // TODO depend on the size and aspect ration on paper
322 scale: this.templateData.properties.paperSize === "a3" ? 0.45 : 0.18 328 scale: this.templateData.properties.paperSize === "a3" ? 0.3 : 0.27
323 }); 329 });
324 offScreen.removeChild(svg); 330 offScreen.removeChild(svg);
325 }, 331 },
326 // Diagram legend 332 // Diagram legend
327 addDiagramLegend(position, offset, color) { 333 addDiagramLegend(position, offset, color) {