# HG changeset patch # User Fadi Abbud # Date 1558425121 -7200 # Node ID 13bb0ff62ac8d7ef1c1647c346ea968ae8c1b898 # Parent 8c435f9a85bbb13a049e1b7c4b9bf41eda98524b client: diagram-template: cleanup (waterlevel) * remove unnecessary function * imrove positioning of diagram legend diff -r 8c435f9a85bb -r 13bb0ff62ac8 client/src/components/gauge/Waterlevel.vue --- a/client/src/components/gauge/Waterlevel.vue Mon May 20 18:57:47 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Tue May 21 09:52:01 2019 +0200 @@ -390,28 +390,21 @@ } this.pdf.doc.addImage(imgData, "PNG", x, y, width, height); }, - // Gauge info as a title for pdf - - getTextHeight(numberOfLines) { - return ( - numberOfLines * - ((this.pdf.doc.getFontSize() * 25.4) / 80) * - this.pdf.doc.getLineHeightFactor() - ); - }, // Diagram legend addDiagramLegend(position, offset, color) { let x = offset.x; let y = offset.y; - let width = this.pdf.doc.getTextWidth("Navigable Range") + 12; - let height = 15; + this.pdf.doc.setFontSize(10); + let width = + (this.pdf.doc.getStringUnitWidth("Navigable Range") * 10) / + (72 / 25.6) + + 5; if (["topright", "bottomright"].indexOf(position) !== -1) { x = this.pdf.width - offset.x - width; } if (["bottomright", "bottomleft"].indexOf(position) !== -1) { - y = this.pdf.height - offset.y - height; + y = this.pdf.height - offset.y - this.getTextHeight(4); } - this.pdf.doc.setFontSize(10); this.pdf.doc.setTextColor(color); this.pdf.doc.setDrawColor("white"); this.pdf.doc.setFillColor("steelblue");