# HG changeset patch # User Thomas Junk # Date 1563532790 -7200 # Node ID 44060b9027da9aecf2bd7add1aa8e44aa6fdbf3e # Parent ccdfa66e33c38cce505d863d620ce5bef4bc833d available_fairway_depth: in case the limits are equal the middle label is omitted. and in print too diff -r ccdfa66e33c3 -r 44060b9027da client/src/components/fairway/AvailableFairwayDepth.vue --- a/client/src/components/fairway/AvailableFairwayDepth.vue Fri Jul 19 12:08:15 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepth.vue Fri Jul 19 12:39:50 2019 +0200 @@ -169,12 +169,18 @@ const w = [this.widthlimit1, this.widthlimit2].sort(); const lowerBound = [d[0], w[0]].filter(x => x).join(", "); const upperBound = [d[1], w[1]].filter(x => x).join(", "); - return [ - `> LDC`, - `>= ${upperBound}`, - `< ${upperBound}`, - `< ${lowerBound}` - ]; + let result; + if (this.depthlimit1 !== this.depthlimit2) { + result = [ + `> LDC`, + `>= ${upperBound}`, + `< ${upperBound}`, + `< ${lowerBound}` + ]; + } else { + result = [`> LDC`, `>= ${upperBound}`, `< ${upperBound}`]; + } + return result; }, dataLink() { return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`; @@ -265,26 +271,39 @@ y = this.pdf.height - offset.y - this.getTextHeight(6); } - this.pdf.doc.setTextColor(color); - this.pdf.doc.setDrawColor(this.$options.COLORS.LDC); - this.pdf.doc.setFillColor(this.$options.COLORS.LDC); - this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD"); - this.pdf.doc.text(this.legend[0], x + 12, y + 3); + if (this.legend[3]) { + this.pdf.doc.setTextColor(color); + this.pdf.doc.setDrawColor(this.$options.COLORS.LDC); + this.pdf.doc.setFillColor(this.$options.COLORS.LDC); + this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[0], x + 12, y + 3); + + this.pdf.doc.setDrawColor(this.$options.COLORS.REST[0]); + this.pdf.doc.setFillColor(this.$options.COLORS.REST[0]); + this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[1], x + 12, y + 8); + + this.pdf.doc.setDrawColor(this.$options.COLORS.REST[1]); + this.pdf.doc.setFillColor(this.$options.COLORS.REST[1]); + this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[2], x + 12, y + 13); - this.pdf.doc.setDrawColor(this.$options.COLORS.REST[0]); - this.pdf.doc.setFillColor(this.$options.COLORS.REST[0]); - this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD"); - this.pdf.doc.text(this.legend[1], x + 12, y + 8); + this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST); + this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST); + this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[3], x + 12, y + 18); + } else { + this.pdf.doc.setTextColor(color); + this.pdf.doc.setDrawColor(this.$options.COLORS.LDC); + this.pdf.doc.setFillColor(this.$options.COLORS.LDC); + this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[0], x + 12, y + 3); - this.pdf.doc.setDrawColor(this.$options.COLORS.REST[1]); - this.pdf.doc.setFillColor(this.$options.COLORS.REST[1]); - this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD"); - this.pdf.doc.text(this.legend[2], x + 12, y + 13); - - this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST); - this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST); - this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD"); - this.pdf.doc.text(this.legend[3], x + 12, y + 18); + this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST); + this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST); + this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD"); + this.pdf.doc.text(this.legend[1], x + 12, y + 8); + } }, legendStyle(index) { return [ diff -r ccdfa66e33c3 -r 44060b9027da client/src/components/fairway/AvailableFairwayDepthLNWL.vue --- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue Fri Jul 19 12:08:15 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue Fri Jul 19 12:39:50 2019 +0200 @@ -166,12 +166,18 @@ const w = [this.widthlimit1, this.widthlimit2].sort(); const lowerBound = [d[0], w[0]].filter(x => x).join(", "); const upperBound = [d[1], w[1]].filter(x => x).join(", "); - return [ - `> LDC`, - `< ${lowerBound}`, - `< ${upperBound}`, - `>= ${upperBound}` - ]; + let result; + if (this.depthlimit1 !== this.depthlimit2) { + result = [ + `> LDC`, + `>= ${upperBound}`, + `< ${upperBound}`, + `< ${lowerBound}` + ]; + } else { + result = [`> LDC`, `>= ${upperBound}`, `< ${upperBound}`]; + } + return result; }, dataLink() { return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`;