Mercurial > gemma
comparison client/src/components/gauge/Waterlevel.vue @ 3343:13bb0ff62ac8
client: diagram-template: cleanup (waterlevel)
* remove unnecessary function
* imrove positioning of diagram legend
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Tue, 21 May 2019 09:52:01 +0200 |
parents | de0d0685a17b |
children | 83210507aaca |
comparison
equal
deleted
inserted
replaced
3338:8c435f9a85bb | 3343:13bb0ff62ac8 |
---|---|
388 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { | 388 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
389 y = this.pdf.height - offset.y - height; | 389 y = this.pdf.height - offset.y - height; |
390 } | 390 } |
391 this.pdf.doc.addImage(imgData, "PNG", x, y, width, height); | 391 this.pdf.doc.addImage(imgData, "PNG", x, y, width, height); |
392 }, | 392 }, |
393 // Gauge info as a title for pdf | |
394 | |
395 getTextHeight(numberOfLines) { | |
396 return ( | |
397 numberOfLines * | |
398 ((this.pdf.doc.getFontSize() * 25.4) / 80) * | |
399 this.pdf.doc.getLineHeightFactor() | |
400 ); | |
401 }, | |
402 // Diagram legend | 393 // Diagram legend |
403 addDiagramLegend(position, offset, color) { | 394 addDiagramLegend(position, offset, color) { |
404 let x = offset.x; | 395 let x = offset.x; |
405 let y = offset.y; | 396 let y = offset.y; |
406 let width = this.pdf.doc.getTextWidth("Navigable Range") + 12; | 397 this.pdf.doc.setFontSize(10); |
407 let height = 15; | 398 let width = |
399 (this.pdf.doc.getStringUnitWidth("Navigable Range") * 10) / | |
400 (72 / 25.6) + | |
401 5; | |
408 if (["topright", "bottomright"].indexOf(position) !== -1) { | 402 if (["topright", "bottomright"].indexOf(position) !== -1) { |
409 x = this.pdf.width - offset.x - width; | 403 x = this.pdf.width - offset.x - width; |
410 } | 404 } |
411 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { | 405 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
412 y = this.pdf.height - offset.y - height; | 406 y = this.pdf.height - offset.y - this.getTextHeight(4); |
413 } | 407 } |
414 this.pdf.doc.setFontSize(10); | |
415 this.pdf.doc.setTextColor(color); | 408 this.pdf.doc.setTextColor(color); |
416 this.pdf.doc.setDrawColor("white"); | 409 this.pdf.doc.setDrawColor("white"); |
417 this.pdf.doc.setFillColor("steelblue"); | 410 this.pdf.doc.setFillColor("steelblue"); |
418 this.pdf.doc.circle(x, y, 2, "FD"); | 411 this.pdf.doc.circle(x, y, 2, "FD"); |
419 this.pdf.doc.text(x + 3, y + 1, "Waterlevel"); | 412 this.pdf.doc.text(x + 3, y + 1, "Waterlevel"); |