Mercurial > gemma
annotate client/src/components/fairway/Fairwayprofile.vue @ 3089:813309225e35
Made 'go vet' happy again.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 21 Apr 2019 19:02:35 +0200 |
parents | 563176194d74 |
children | 136b86794453 |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
2 <div class="d-flex flex-fill"> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
3 <DiagramLegend> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
4 <div class="legend"> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
5 <span style="background-color: #5995ff"></span> Water |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
6 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
7 <div class="legend"> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
8 <span style="background-color: #1f4fff"></span> Fairway |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
9 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
10 <div class="legend"> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
11 <span style="background-color: #4a2f06"></span> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
12 Ground |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
13 </div> |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
14 <div> |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
15 <button |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
16 @click="downloadPDF" |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
17 type="button" |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
18 class="btn btn-sm btn-info d-block w-100 mt-2" |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
19 > |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
20 <translate>Export to PDF</translate> |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
21 </button> |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
22 </div> |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
23 </DiagramLegend> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
24 <div |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
25 ref="diagramContainer" |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
26 class="d-flex flex-fill justify-content-center align-items-center diagram-container" |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
27 > |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
28 <div v-if="!fairwayData"> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
29 <translate>No data available.</translate> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
30 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
31 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
32 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
36 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
37 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
38 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
40 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
41 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
42 * Copyright (C) 2018 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
43 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
45 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
46 * Author(s): |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
47 * Thomas Junk <thomas.junk@intevation.de> |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
48 * Markus Kottländer <markus.kottlaender@intevation.de> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
49 */ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 import * as d3 from "d3"; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 import { mapState, mapGetters } from "vuex"; |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
52 import debounce from "debounce"; |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
53 import jsPDF from "jspdf"; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
54 import canvg from "canvg"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
55 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 const GROUND_COLOR = "#4A2F06"; |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
57 const WATER_COLOR = "#005DFF"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 name: "fairwayprofile", |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
61 components: { |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
62 DiagramLegend: () => import("@/components/DiagramLegend") |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
63 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 data() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 return { |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
66 width: null, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
67 height: null, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
68 margin: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
69 top: 20, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
70 right: 40, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
71 bottom: 30, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
72 left: 40 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
73 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
74 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
75 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
76 computed: { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
77 ...mapGetters("fairwayprofile", ["totalLength"]), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
78 ...mapState("fairwayprofile", [ |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
79 "additionalSurvey", |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
80 "currentProfile", |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
81 "startPoint", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 "endPoint", |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
83 "fairwayData", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 "maxAlt", |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
85 "referenceWaterLevel", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 "selectedWaterLevel", |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
87 "waterLevels" |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 ]), |
3061
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
89 selectedSurvey: { |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
90 get() { |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
91 return this.$store.state.bottlenecks.selectedSurvey; |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
92 } |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
93 }, |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
94 selectedBottleneck: { |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
95 get() { |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
96 return this.$store.state.bottlenecks.selectedBottleneck; |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
97 } |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
98 }, |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
99 ...mapState("bottlenecks", ["selectedSurvey"]), |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
100 relativeWaterLevelDelta() { |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
101 return this.selectedWaterLevel.value - this.referenceWaterLevel; |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
102 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 !this.selectedSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 !this.currentProfile.hasOwnProperty(this.selectedSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
109 return this.currentProfile[this.selectedSurvey.date_info].points; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 additionalData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 !this.additionalSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 !this.currentProfile.hasOwnProperty(this.additionalSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
117 return this.currentProfile[this.additionalSurvey.date_info].points; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 }, |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
119 xScale() { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
120 return [0, this.totalLength]; |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
121 }, |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
122 yScaleRight() { |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
123 //ToDO calcReleativeDepth(this.maxAlt) to get the |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
124 // maximum depth according to the actual waterlevel |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
125 // additionally: take the one which is higher reference or current waterlevel |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
126 const DELTA = this.maxAlt * 1.1 - this.maxAlt; |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
127 return [this.maxAlt * 1 + DELTA, -DELTA]; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
129 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 watch: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
131 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
132 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 }, |
1382
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
134 additionalData() { |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
135 this.drawDiagram(); |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
136 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 width() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
140 height() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 waterLevels() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
144 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
145 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 selectedWaterLevel() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
148 }, |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
149 fairwayData() { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
150 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
151 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
152 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
153 methods: { |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
154 downloadPDF() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
155 var svg = this.$refs.diagramContainer.innerHTML; |
3061
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
156 var fairwayInfo = |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
157 this.selectedBottleneck + " (" + this.selectedSurvey.date_info + ")"; |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
158 if (svg) { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
159 svg = svg.replace(/\r?\n|\r/g, "").trim(); |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
160 } |
3032
3aca036e11f1
client: improve pdf properties for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3020
diff
changeset
|
161 var pdf = new jsPDF("l", "mm", "a3"); |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
162 var canvas = document.createElement("canvas"); |
3018
42d1e31de844
client:give the generated pdf name and improve canvas size
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3007
diff
changeset
|
163 canvas.width = window.innerWidth; |
3020 | 164 canvas.height = window.innerHeight / 2; |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
165 canvg(canvas, svg, { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
166 ignoreMouse: true, |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
167 ignoreAnimation: true, |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
168 ignoreDimensions: true |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
169 }); |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
170 var imgData = canvas.toDataURL("image/png"); |
3032
3aca036e11f1
client: improve pdf properties for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3020
diff
changeset
|
171 pdf.addImage(imgData, "PNG", 40, 60, 380, 130); |
3061
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
172 // Fairway profile info for the pdf title |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
173 pdf.setTextColor("steelblue"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
174 pdf.setFontSize(22); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
175 pdf.setFontStyle("bold"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
176 pdf.text(fairwayInfo, 140, 30); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
177 // Diagram legend |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
178 pdf.setFontSize(10); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
179 pdf.setTextColor("black"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
180 pdf.setDrawColor("white"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
181 pdf.setFillColor("#5995ff"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
182 pdf.circle(60, 190, 2, "FD"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
183 pdf.text(63, 191, "Water"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
184 pdf.setFillColor("#1f4fff"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
185 pdf.circle(60, 195, 2, "FD"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
186 pdf.text(63, 196, "Fairway"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
187 pdf.setFillColor("#4a2f06"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
188 pdf.circle(60, 200, 2, "FD"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
189 pdf.text(63, 201, "Ground"); |
563176194d74
client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3032
diff
changeset
|
190 pdf.save("Fairwayprofile diagram"); |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
191 }, |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
192 calcRelativeDepth(depth) { |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
193 /* takes a depth value and substracts the delta of the relative waterlevel |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
194 * say the reference level is above the current level, the ground is nearer, |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
195 * thus, the depth is lower. |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
196 * |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
197 * E.g.: |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
198 * |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
199 * Reference waterlevel 5m, current 4m => delta = -1m |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
200 * If the distance to the ground was 3m from the 5m mark |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
201 * it is now only 2m from the current waterlevel. |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
202 * |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
203 * Vice versa: |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
204 * |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
205 * If the reference level is 5m and the current 6m => delta = +1m |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
206 * The ground is one meter farer away from the current waterlevel |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
207 * |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
208 */ |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
209 return depth - this.relativeWaterLevelDelta; |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
210 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 drawDiagram() { |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
212 d3.select(".diagram-container svg").remove(); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
213 this.scaleFairwayProfile(); |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
214 let svg = d3.select(".diagram-container").append("svg"); |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
215 svg.attr("width", "100%"); |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
216 svg.attr("height", "100%"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
217 const width = this.width - this.margin.right - 1.5 * this.margin.left; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
218 const height = this.height - this.margin.top - 2 * this.margin.bottom; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
219 const currentData = this.currentData; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
220 const additionalData = this.additionalData; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
221 const { xScale, yScaleRight, graph } = this.generateCoordinates( |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
222 svg, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 width |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
225 ); |
1588
2888bfacd331
fairwayprofile: do not try to render fairwayprofile without dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
226 if (!this.height || !this.width) return; // do not try to render when height and width are unknown |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
227 this.drawWaterlevel({ graph, xScale, yScaleRight, height }); |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
228 this.drawLabels({ graph, height }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 if (currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 strokeColor: "black", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 opacity: 1 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 if (additionalData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
246 currentData: additionalData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 strokeColor: "#943007", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 opacity: 0.6 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
251 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
252 } |
2358
da75385887b9
fairway_profile: render riverbed on layer behind LOS
Thomas Junk <thomas.junk@intevation.de>
parents:
2265
diff
changeset
|
253 this.drawFairway({ graph, xScale, yScaleRight }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
254 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
255 drawFairway({ graph, xScale, yScaleRight }) { |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
256 if (this.fairwayData === undefined) { |
2265
940ae7c20326
client: pdf-gen: use default template when backend does not provide any
Markus Kottlaender <markus@intevation.de>
parents:
2264
diff
changeset
|
257 return; |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
258 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
259 for (let data of this.fairwayData) { |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
260 const [startPoint, endPoint, depth] = data.coordinates[0]; |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
261 const style = data.style(); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
262 let fairwayArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
263 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
264 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
265 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
266 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
267 .y0(yScaleRight(0)) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
268 .y1(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
269 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
270 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
272 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
273 .datum([{ x: startPoint, y: depth }, { x: endPoint, y: depth }]) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
274 .attr("fill", "#002AFF") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
275 .attr("fill-opacity", 0.65) |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
276 .attr("stroke", style[0].getStroke().getColor()) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
277 .attr("d", fairwayArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
278 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
279 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 drawLabels({ graph, height }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
282 .append("text") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 .attr("transform", ["rotate(-90)"]) |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
284 .attr("y", this.width - 70) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 .attr("x", -(this.height - this.margin.top - this.margin.bottom) / 2) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 .attr("dy", "1em") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
288 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
289 .text("Depth [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
290 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
291 .append("text") |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
292 .attr("y", -50) |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
293 .attr("x", -(height / 4)) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
294 .attr("dy", "1em") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
295 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
296 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
297 .attr("transform", [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
298 "translate(" + this.width / 2 + "," + this.height + ")", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
299 "rotate(0)" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
300 ]) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
301 .text("Width [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
302 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
303 generateCoordinates(svg, height, width) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
304 let xScale = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
305 .scaleLinear() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
306 .domain(this.xScale) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
307 .rangeRound([0, width]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
308 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
309 xScale.ticks(5); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
310 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
311 let yScaleRight = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
312 .scaleLinear() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
313 .domain(this.yScaleRight) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
314 .rangeRound([height, 0]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
315 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
316 let xAxis = d3.axisBottom(xScale); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
317 let yAxis2 = d3.axisRight(yScaleRight); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
318 let graph = svg |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
319 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
320 .attr( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
321 "transform", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
322 "translate(" + this.margin.left + "," + this.margin.top + ")" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
323 ); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
324 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
325 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
326 .attr("transform", "translate(0," + height + ")") |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
327 .call(xAxis.ticks(5)) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
328 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
329 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
330 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
331 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
332 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
333 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
334 .attr("stroke", "black"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
335 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
336 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
337 .attr("transform", "translate(" + width + ",0)") |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
338 .call(yAxis2) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
339 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
340 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
341 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
342 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
343 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
344 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
345 .attr("stroke", "black"); |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
346 graph.selectAll(".domain").attr("stroke", "black"); |
2368
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2358
diff
changeset
|
347 return { xScale, yScaleRight, graph }; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
348 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
349 drawWaterlevel({ graph, xScale, yScaleRight, height }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
350 let waterArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
351 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
352 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
353 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
354 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
355 .y0(height) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
356 .y1(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
357 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
358 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
359 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
360 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
361 .datum([{ x: 0, y: 0 }, { x: this.totalLength, y: 0 }]) |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
362 .attr("fill-opacity", 0.65) |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
363 .attr("fill", WATER_COLOR) |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
364 .attr("stroke", WATER_COLOR) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
365 .attr("d", waterArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
366 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
367 drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
368 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
369 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
370 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
371 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
372 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
373 color, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
374 strokeColor, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
375 opacity |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
376 }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
377 for (let part of currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
378 let profileLine = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
379 .line() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
380 .x(d => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
381 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
382 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
383 .y(d => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
384 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
385 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
386 let profileArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
387 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
388 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
389 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
390 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
391 .y0(height) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
392 .y1(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
393 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
394 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
395 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
396 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
397 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
398 .attr("fill", color) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
399 .attr("stroke", color) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
400 .attr("stroke-width", 3) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
401 .attr("stroke-opacity", opacity) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
402 .attr("fill-opacity", opacity) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
403 .attr("d", profileArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
404 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
405 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
406 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
407 .attr("fill", "none") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
408 .attr("stroke", strokeColor) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
409 .attr("stroke-linejoin", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
410 .attr("stroke-linecap", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
411 .attr("stroke-width", 3) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
412 .attr("stroke-opacity", opacity) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
413 .attr("fill-opacity", 0) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
414 .attr("d", profileLine); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
415 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
416 }, |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
417 scaleFairwayProfile() { |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
418 if (!document.querySelector(".diagram-container")) return; |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
419 const clientHeight = document.querySelector(".diagram-container") |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
420 .clientHeight; |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
421 const clientWidth = document.querySelector(".diagram-container") |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
422 .clientWidth; |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
423 if (!clientHeight || !clientWidth) return; |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
424 this.height = clientHeight; |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
425 this.width = clientWidth; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
426 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
427 }, |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
428 created() { |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
429 window.addEventListener("resize", debounce(this.drawDiagram), 100); |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
430 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
431 mounted() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
432 this.drawDiagram(); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
433 }, |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
434 updated() { |
2860
dbc799261811
client: fairway profile: removed old code
Markus Kottlaender <markus@intevation.de>
parents:
2854
diff
changeset
|
435 this.drawDiagram(); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
436 }, |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
437 destroyed() { |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
438 window.removeEventListener("resize", debounce(this.drawDiagram)); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
439 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
440 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
441 </script> |