Mercurial > gemma
changeset 4114:b9ddc6cdc871 request_hist_bns
Merged default.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 31 Jul 2019 17:05:24 +0200 |
parents | f39d20427e89 (current diff) 7959f62d3051 (diff) |
children | 0cf0008070db |
files | |
diffstat | 3 files changed, 28 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/gauge/HydrologicalConditions.vue Wed Jul 31 17:04:31 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Wed Jul 31 17:05:24 2019 +0200 @@ -241,38 +241,41 @@ }, // Diagram legend addDiagramLegend(position, offset, color) { - let x = offset.x, - y = offset.y; - let width = - (this.pdf.doc.getStringUnitWidth("Long-term Amplitude") * 10) / - (72 / 25.6) + - 5; + let x = offset.x + 2, // 2 is the radius of the circle + y = offset.y, + padding = 3; + this.pdf.doc.setFontStyle("normal"); + this.pdf.doc.setFontSize(10); + let width = this.pdf.doc.getTextWidth("Long-term Amplitude") + padding; // if position is on the right, x needs to be calculate with pdf width and // the size of the element 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 - this.getTextHeight(4); + y = this.pdf.height - offset.y - this.getTextHeight(5) - 2; } - this.pdf.doc.setFontSize(10); + if (y < this.getTextHeight(1)) { + y = y + this.getTextHeight(1) / 2; + } + console.log(y); this.pdf.doc.setTextColor(color); this.pdf.doc.setDrawColor("white"); this.pdf.doc.setFillColor("red"); this.pdf.doc.circle(x, y, 2, "FD"); - this.pdf.doc.text(x + 3, y + 1, "" + this.yearCompare); + this.pdf.doc.text(x + padding, y + 1, "" + this.yearCompare); this.pdf.doc.setFillColor("orange"); this.pdf.doc.circle(x, y + 5, 2, "FD"); - this.pdf.doc.text(x + 3, y + 6, "Q25%"); + this.pdf.doc.text(x + padding, y + 6, "Q25%"); this.pdf.doc.setFillColor("black"); this.pdf.doc.circle(x, y + 10, 2, "FD"); this.pdf.doc.text(x + 3, y + 11, "Median "); this.pdf.doc.setFillColor("purple"); this.pdf.doc.circle(x, y + 15, 2, "FD"); - this.pdf.doc.text(x + 3, y + 16, "Q75%"); + this.pdf.doc.text(x + padding, y + 16, "Q75%"); this.pdf.doc.setFillColor("lightsteelblue"); this.pdf.doc.circle(x, y + 20, 2, "FD"); - this.pdf.doc.text(x + 3, y + 21, "Long-term Amplitude"); + this.pdf.doc.text(x + padding, y + 21, "Long-term Amplitude"); }, getPrintLayout(svgHeight) { return {
--- a/client/src/components/gauge/Waterlevel.vue Wed Jul 31 17:04:31 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Wed Jul 31 17:05:24 2019 +0200 @@ -209,12 +209,10 @@ this.dateFrom.toLocaleDateString() + " - " + this.dateTo.toLocaleDateString(); - this.generatePDF({ templateData: this.templateData, diagramTitle: diagramTitle }); - this.pdf.doc.save( this.selectedGauge.properties.objname + " Waterlevel-Diagram.pdf" ); @@ -247,33 +245,35 @@ }, // Diagram legend addDiagramLegend(position, offset, color) { - let x = offset.x; - let y = offset.y; + let x = offset.x + 2, // 2 is the radius of the circle + y = offset.y, + padding = 3; + this.pdf.doc.setFontStyle("normal"); this.pdf.doc.setFontSize(10); - let width = - (this.pdf.doc.getStringUnitWidth("Navigable Range") * 10) / - (72 / 25.6) + - 5; + let width = this.pdf.doc.getTextWidth("Navigable Range") + padding; 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 - this.getTextHeight(4); + y = this.pdf.height - offset.y - this.getTextHeight(3); + } + if (y < this.getTextHeight(1)) { + y = y + this.getTextHeight(1) / 2; } this.pdf.doc.setTextColor(color); this.pdf.doc.setDrawColor("white"); this.pdf.doc.setFillColor("steelblue"); this.pdf.doc.circle(x, y, 2, "FD"); - this.pdf.doc.text(x + 3, y + 1, "Waterlevel"); + this.pdf.doc.text(x + padding, y + 1, "Waterlevel"); this.pdf.doc.setFillColor("#dae6f0"); this.pdf.doc.circle(x, y + 5, 2, "FD"); this.pdf.doc.setFillColor("#e5ffe5"); this.pdf.doc.circle(x, y + 10, 2, "FD"); - this.pdf.doc.text(x + 3, y + 11, "Navigable Range"); + this.pdf.doc.text(x + padding, y + 11, "Navigable Range"); this.pdf.doc.setDrawColor("#90b4d2"); this.pdf.doc.setFillColor("#90b4d2"); this.pdf.doc.circle(x, y + 5, 0.6, "FD"); - this.pdf.doc.text(x + 3, y + 6, "Prediction"); + this.pdf.doc.text(x + padding, y + 6, "Prediction"); }, getPrintLayout(svgHeight) { return {