Mercurial > gemma
annotate client/src/components/fairway/AvailableFairwayDepthLNWL.vue @ 3915:f7f09f32d6e0
hydrological conditions: omit rendering, when container isn't visible
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 11 Jul 2019 13:51:26 +0200 |
parents | 9ec50fd5c9fa |
children | c76bbd27f89c |
rev | line source |
---|---|
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div class="d-flex flex-column flex-fill"> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <UIBoxHeader icon="chart-area" :title="title" :closeCallback="close" /> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 <UISpinnerOverlay v-if="loading" /> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <div class="d-flex flex-fill"> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 <DiagramLegend> |
3366 | 7 <div v-for="(entry, index) in legendLNWL" :key="index" class="legend"> |
3474 | 8 <span |
9 :style=" | |
10 `${legendStyle( | |
11 index | |
12 )}; border-radius: 0.25rem; width: 40px; height: 20px;` | |
13 " | |
14 ></span> | |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 {{ entry }} |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 </div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 <div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 <select |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 @change="applyChange" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 v-model="form.template" |
3466
dfa97aad1134
client: unify the buttons style for diagram legend
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3463
diff
changeset
|
21 class="form-control d-block custom-select-sm w-100 mt-2" |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 > |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 <option |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 v-for="template in templates" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 :value="template" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 :key="template.name" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 > |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 {{ template.name }} |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 </option> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 </select> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 <button |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 @click="downloadPDF" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
33 type="button" |
3466
dfa97aad1134
client: unify the buttons style for diagram legend
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3463
diff
changeset
|
34 class="btn btn-sm btn-info d-block w-100 mt-2" |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 > |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 <translate>Export to PDF</translate> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 </button> |
3450
213b703bdd85
afdLNWL: CSV-Export
Thomas Junk <thomas.junk@intevation.de>
parents:
3437
diff
changeset
|
38 <a |
213b703bdd85
afdLNWL: CSV-Export
Thomas Junk <thomas.junk@intevation.de>
parents:
3437
diff
changeset
|
39 :href="dataLink" |
213b703bdd85
afdLNWL: CSV-Export
Thomas Junk <thomas.junk@intevation.de>
parents:
3437
diff
changeset
|
40 :download="csvFileName" |
3466
dfa97aad1134
client: unify the buttons style for diagram legend
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3463
diff
changeset
|
41 class="mt-2 btn btn-sm btn-info w-100" |
3437 | 42 >Download CSV</a |
43 > | |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 </div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 </DiagramLegend> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 <div |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
47 ref="diagramContainer" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 :id="containerId" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 class="mx-auto my-auto diagram-container" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 ></div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 </div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 </div> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 </template> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 <style></style> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
56 |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 <script> |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 * without warranty, see README.md and license for details. |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 * |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 * SPDX-License-Identifier: AGPL-3.0-or-later |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 * License-Filename: LICENSES/AGPL-3.0.txt |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 * |
3800
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
64 * Copyright (C) 2018, 2019 by via donau |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 * – Österreichische Wasserstraßen-Gesellschaft mbH |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 * Software engineering by Intevation GmbH |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 * |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 * Author(s): |
3800
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
69 * * Thomas Junk <thomas.junk@intevation.de> |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
70 * * Markus Kottländer <markus.kottlaender@intevation.de> |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
71 * * Fadi Abbud <fadi.abbud@intevation.de> |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 */ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
73 import * as d3 from "d3"; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
74 import app from "@/main"; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 import debounce from "debounce"; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 import { mapState } from "vuex"; |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
77 import svg2pdf from "svg2pdf.js"; |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 import filters from "@/lib/filters.js"; |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
79 import { pdfgen, templateLoader } from "@/lib/mixins"; |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 import { HTTP } from "@/lib/http"; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 import { displayError } from "@/lib/errors"; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 export default { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
84 mixins: [pdfgen, templateLoader], |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
85 components: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 DiagramLegend: () => import("@/components/DiagramLegend") |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 data() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 return { |
3299
ef52926ce2fc
available_fairwaydepth_vs_lnwl: Scales adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
3296
diff
changeset
|
90 containerId: "availablefairwaydepthlnwl", |
3682
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
91 resizeListenerFunction: null, |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 loading: false, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 labelPaddingTop: 15, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 scalePaddingLeft: 50, |
3876
0c6ef9e655fc
client: available fairway depth diagrams: added second y-axis on the right
Markus Kottlaender <markus@intevation.de>
parents:
3717
diff
changeset
|
95 scalePaddingRight: 30, |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 paddingTop: 10, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 pdf: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 doc: null, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
99 width: null, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 height: null |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 form: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 template: null |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 templateData: null, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 templates: [], |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 defaultTemplate: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 name: "Default", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 properties: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 paperSize: "a4" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 elements: [ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 type: "diagram", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 position: "topleft", |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
116 offset: { x: 20, y: 30 }, |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 width: 290, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 height: 100 |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 type: "diagramtitle", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 position: "topleft", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 offset: { x: 70, y: 20 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 fontsize: 20, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 color: "steelblue" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
127 { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
128 type: "diagramlegend", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 position: "topleft", |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
130 offset: { x: 30, y: 170 }, |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 color: "black" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
133 ] |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 }; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 created() { |
3682
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
138 this.resizeListenerFunction = debounce(this.drawDiagram, 100); |
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
139 window.addEventListener("resize", this.resizeListenerFunction); |
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
140 }, |
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
141 destroyed() { |
c086f5176ef2
client: diagrams: fixed removal of resize listener
Markus Kottlaender <markus@intevation.de>
parents:
3544
diff
changeset
|
142 window.removeEventListener("resize", this.resizeListenerFunction); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
143 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
144 mounted() { |
3688
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
145 // Nasty but necessary if we don't want to use the updated hook to re-draw |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
146 // the diagram because this would re-draw it also for irrelevant reasons. |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
147 // In this case we need to wait for the child component (DiagramLegend) to |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
148 // render. According to the docs (https://vuejs.org/v2/api/#mounted) this |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
149 // should be possible with $nextTick() but it doesn't work because it does |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
150 // not guarantee that the DOM is not only updated but also re-painted on the |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
151 // screen. |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
152 setTimeout(this.drawDiagram, 150); |
af06045e87c9
client: diagrams: wait (longer) for legend child component to render before rendering diagram (see comments for explanation)
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
153 |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
154 this.templates[0] = this.defaultTemplate; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
155 this.form.template = this.templates[0]; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
156 this.templateData = this.form.template; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
157 HTTP.get("/templates/diagram", { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
158 headers: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
159 "X-Gemma-Auth": localStorage.getItem("token"), |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
160 "Content-type": "text/xml; charset=UTF-8" |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
161 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
162 }) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
163 .then(response => { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
164 if (response.data.length) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
165 this.templates = response.data; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
166 this.form.template = this.templates[0]; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
167 this.templates[this.templates.length] = this.defaultTemplate; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 this.applyChange(); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
170 }) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
171 .catch(e => { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
172 const { status, data } = e.response; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
173 displayError({ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
174 title: this.$gettext("Backend Error"), |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
175 message: `${status}: ${data.message || data}` |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
176 }); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
177 }); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
178 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
179 computed: { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
180 ...mapState("fairwayavailability", [ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
181 "selectedFairwayAvailabilityFeature", |
3299
ef52926ce2fc
available_fairwaydepth_vs_lnwl: Scales adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
3296
diff
changeset
|
182 "fwLNWLData", |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
183 "from", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
184 "to", |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
185 "frequency", |
3471 | 186 "csv", |
187 "depthlimit1", | |
188 "depthlimit2", | |
189 "widthlimit1", | |
190 "widthlimit2" | |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
191 ]), |
3471 | 192 legendLNWL() { |
193 const d = [this.depthlimit1, this.depthlimit2].sort(); | |
194 const w = [this.widthlimit1, this.widthlimit2].sort(); | |
195 const lowerBound = [d[0], w[0]].filter(x => x).join(", "); | |
196 const upperBound = [d[1], w[1]].filter(x => x).join(", "); | |
197 return [ | |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
198 `> LDC`, |
3471 | 199 `< ${lowerBound}`, |
200 `< ${upperBound}`, | |
201 `>= ${upperBound}` | |
202 ]; | |
203 }, | |
3437 | 204 dataLink() { |
205 return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`; | |
206 }, | |
207 csvFileName() { | |
208 return `${this.$gettext("fairwayavailabilityLNWL")}-${ | |
3483
879a85aea8a5
afdLNWL: robust legend name
Thomas Junk <thomas.junk@intevation.de>
parents:
3475
diff
changeset
|
209 this.featureName |
3437 | 210 }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate( |
211 this.toDate | |
212 )}-${this.$gettext(this.frequency)}-.csv`; | |
213 }, | |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
214 fromDate() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
215 return this.from; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
216 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
217 toDate() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
218 return this.to; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
219 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
220 availability() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
221 return this.plainAvailability; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
222 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
223 title() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
224 return `Available Fairway Depth vs LNWL: ${ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
225 this.featureName |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
226 } (${filters.surveyDate(this.fromDate)} - ${filters.surveyDate( |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
227 this.toDate |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
228 )}) ${this.$gettext(this.frequency)}`; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
229 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
230 featureName() { |
3483
879a85aea8a5
afdLNWL: robust legend name
Thomas Junk <thomas.junk@intevation.de>
parents:
3475
diff
changeset
|
231 if (this.selectedFairwayAvailabilityFeature == null) return ""; |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
232 return this.selectedFairwayAvailabilityFeature.properties.name; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
233 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
234 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
235 methods: { |
3474 | 236 legendStyle(index) { |
237 const style = { | |
238 0: `background-color: ${this.$options.LWNLCOLORS.LDC};`, | |
3475 | 239 1: `background-color: ${this.$options.AFDCOLORS[2]};`, |
3474 | 240 2: `background-color: ${this.$options.AFDCOLORS[1]};`, |
3475 | 241 3: `background-color: ${this.$options.AFDCOLORS[0]};` |
3474 | 242 }; |
243 return style[index]; | |
244 }, | |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
245 applyChange() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
246 if (this.form.template.hasOwnProperty("properties")) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
247 this.templateData = this.defaultTemplate; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
248 return; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
249 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
250 if (this.form.template) { |
3806
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
251 this.loadTemplates("/templates/diagram/" + this.form.template.name) |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
252 .then(response => { |
3806
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
253 this.prepareImages(response.data.template_data.elements).then( |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
254 values => { |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
255 values.forEach(v => { |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
256 response.data.template_data.elements[v.index].url = v.url; |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
257 }); |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
258 this.templateData = response.data.template_data; |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
259 } |
cc80a37173f8
Available-fairway-depth(both): use mixin for template loading and image processing
Thomas Junk <thomas.junk@intevation.de>
parents:
3800
diff
changeset
|
260 ); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
261 }) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
262 .catch(e => { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
263 const { status, data } = e.response; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
264 displayError({ |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
265 title: this.$gettext("Backend Error"), |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
266 message: `${status}: ${data.message || data}` |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
267 }); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
268 }); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
269 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
270 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
271 downloadPDF() { |
3800
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
272 let title = `Available Fairway Depth vs LNWL: ${this.featureName}`; |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
273 this.generatePDF({ |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
274 templateData: this.templateData, |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
275 diagramTitle: title |
26325370ba18
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3780
diff
changeset
|
276 }); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
277 this.pdf.doc.save(`Available Fairway Depth LNWL: ${this.featureName}`); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
278 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
279 addDiagram(position, offset, width, height) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
280 let x = offset.x, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
281 y = offset.y; |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
282 const svgWidth = this.millimeter2pixels(width, 80); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
283 const svgHeight = this.millimeter2pixels(height, 80); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
284 // draw the diagram in a separated html element to get the full size |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
285 const offScreen = document.querySelector("#offScreen"); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
286 offScreen.style.width = `${svgWidth}px`; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
287 offScreen.style.height = `${svgHeight}px`; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
288 this.renderTo({ |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
289 element: offScreen, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
290 dimensions: this.getDimensions({ |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
291 svgWidth: svgWidth, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
292 svgHeight: svgHeight |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
293 }) |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
294 }); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
295 var svg = offScreen.querySelector("svg"); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
296 if (["topright", "bottomright"].indexOf(position) !== -1) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
297 x = this.pdf.width - offset.x - width; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
298 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
299 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
300 y = this.pdf.height - offset.y - height; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
301 } |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
302 svg2pdf(svg, this.pdf.doc, { |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
303 xOffset: x, |
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
304 yOffset: y, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
305 scale: 0.354 |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
306 }); |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
307 offScreen.removeChild(svg); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
308 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
309 addDiagramLegend(position, offset, color) { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
310 let x = offset.x, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
311 y = offset.y; |
3333
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
312 this.pdf.doc.setFontSize(10); |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
313 let width = |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
314 (this.pdf.doc.getStringUnitWidth(">= LDC") * 10) / (72 / 25.6) + 15; |
3333
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
315 // if position is on the right, x needs to be calculate with pdf width and |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
316 // the size of the element |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
317 if (["topright", "bottomright"].indexOf(position) !== -1) { |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
318 x = this.pdf.width - offset.x - width; |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
319 } |
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
320 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
321 y = this.pdf.height - offset.y - this.getTextHeight(6); |
3333
d5dbfba9faae
clinet: pdf-template: fix positioning of diagramlegend (FairwayAvailability,AvailableFairwayDepth)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3299
diff
changeset
|
322 } |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
323 this.pdf.doc.setTextColor(color); |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
324 this.pdf.doc.setDrawColor(this.$options.LWNLCOLORS.LDC); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
325 this.pdf.doc.setFillColor(this.$options.LWNLCOLORS.LDC); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
326 this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD"); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
327 this.pdf.doc.text(this.legendLNWL[0], x + 12, y + 3); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
328 |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
329 this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[2]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
330 this.pdf.doc.setFillColor(this.$options.AFDCOLORS[2]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
331 this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD"); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
332 this.pdf.doc.text(this.legendLNWL[1], x + 12, y + 8); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
333 |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
334 this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[1]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
335 this.pdf.doc.setFillColor(this.$options.AFDCOLORS[1]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
336 this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD"); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
337 this.pdf.doc.text(this.legendLNWL[2], x + 12, y + 13); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
338 |
3489
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
339 this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[0]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
340 this.pdf.doc.setFillColor(this.$options.AFDCOLORS[0]); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
341 this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD"); |
e6673f35d5d1
client: diagram-template: improve diagramlegend element (AvailableFairwayDepthLNWL)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3484
diff
changeset
|
342 this.pdf.doc.text(this.legendLNWL[3], x + 12, y + 18); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
343 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
344 close() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
345 this.$store.commit("application/paneSetup", "DEFAULT"); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
346 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
347 getDimensions({ svgHeight, svgWidth }) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
348 const mainMargin = { top: 20, right: 20, bottom: 110, left: 200 }; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
349 const navMargin = { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
350 top: svgHeight - mainMargin.top - 65, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
351 right: 20, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
352 bottom: 30, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
353 left: 80 |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
354 }; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
355 const width = Number(svgWidth) - mainMargin.left - mainMargin.right; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
356 const mainHeight = Number(svgHeight) - mainMargin.top - mainMargin.bottom; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
357 const navHeight = Number(svgHeight) - navMargin.top - navMargin.bottom; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
358 return { width, mainHeight, navHeight, mainMargin, navMargin }; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
359 }, |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
360 drawDiagram() { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
361 const elem = document.querySelector("#" + this.containerId); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
362 const svgWidth = elem != null ? elem.clientWidth : 0; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
363 const svgHeight = elem != null ? elem.clientHeight : 0; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
364 const dimensions = this.getDimensions({ |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
365 svgHeight, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
366 svgWidth |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
367 }); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
368 d3.select(".diagram-container svg").remove(); |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
369 this.renderTo({ element: ".diagram-container", dimensions }); |
3377
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
370 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
371 drawTooltip(diagram) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
372 diagram |
3377
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
373 .append("text") |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
374 .text("") |
3377
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
375 .attr("font-size", "0.8em") |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
376 .attr("opacity", 0) |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
377 .attr("id", "tooltip"); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
378 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
379 renderTo({ element, dimensions }) { |
3913
9ec50fd5c9fa
available_fairwaydepthLNWL: readd padding.top
Thomas Junk <thomas.junk@intevation.de>
parents:
3912
diff
changeset
|
380 let diagram = d3 |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
381 .select(element) |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
382 .append("svg") |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
383 .attr("width", dimensions.width) |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
384 .attr("height", dimensions.mainHeight); |
3913
9ec50fd5c9fa
available_fairwaydepthLNWL: readd padding.top
Thomas Junk <thomas.junk@intevation.de>
parents:
3912
diff
changeset
|
385 diagram = diagram |
9ec50fd5c9fa
available_fairwaydepthLNWL: readd padding.top
Thomas Junk <thomas.junk@intevation.de>
parents:
3912
diff
changeset
|
386 .append("g") |
9ec50fd5c9fa
available_fairwaydepthLNWL: readd padding.top
Thomas Junk <thomas.junk@intevation.de>
parents:
3912
diff
changeset
|
387 .attr("transform", `translate(0 ${this.paddingTop})`); |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
388 const yScale = d3 |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
389 .scaleLinear() |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
390 .domain([0, 100]) |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
391 .range([dimensions.mainHeight - 30, 0]); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
392 this.drawScaleLabel({ diagram, dimensions }); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
393 this.drawScale({ diagram, dimensions, yScale }); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
394 this.drawBars({ diagram, yScale, dimensions }); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
395 this.drawTooltip(diagram); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
396 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
397 drawBars({ diagram, yScale, dimensions }) { |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
398 if (this.fwLNWLData) { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
399 const widthPerItem = Math.min( |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
400 (dimensions.width - this.scalePaddingLeft - this.scalePaddingRight) / |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
401 this.fwLNWLData.length, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
402 180 |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
403 ); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
404 const spaceBetween = widthPerItem * 0.2; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
405 const afdWidth = widthPerItem * 0.5; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
406 const ldcWidth = widthPerItem * 0.3; |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
407 this.fwLNWLData.forEach((data, i) => { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
408 this.drawLNWL( |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
409 data, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
410 i, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
411 diagram, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
412 spaceBetween, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
413 widthPerItem, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
414 ldcWidth, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
415 yScale |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
416 ); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
417 this.drawAFD( |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
418 data, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
419 i, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
420 diagram, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
421 spaceBetween, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
422 widthPerItem, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
423 ldcWidth, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
424 yScale, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
425 afdWidth |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
426 ); |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
427 this.drawLabel(data.date, i, diagram, widthPerItem, dimensions); |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
428 }); |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
429 } |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
430 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
431 drawLabel(date, i, diagram, widthPerItem, dimensions) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
432 diagram |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
433 .append("text") |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
434 .text(date) |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
435 .attr("text-anchor", "middle") |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
436 .attr("font-size", "9") |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
437 .attr( |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
438 "transform", |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
439 `translate(${this.scalePaddingLeft + |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
440 widthPerItem * i + |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
441 widthPerItem / 2} ${dimensions.mainHeight - 15})` |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
442 ); |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
443 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
444 drawAFD( |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
445 data, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
446 i, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
447 diagram, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
448 spaceBetween, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
449 widthPerItem, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
450 ldcWidth, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
451 yScale, |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
452 afdWidth |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
453 ) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
454 let afd = diagram |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
455 .append("g") |
3386 | 456 .attr( |
457 "transform", | |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
458 `translate(${this.scalePaddingLeft + |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
459 spaceBetween / 2 + |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
460 widthPerItem * i + |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
461 ldcWidth})` |
3386 | 462 ); |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
463 afd |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
464 .selectAll("rect") |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
465 .data([data.above, data.between, data.below]) |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
466 .enter() |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
467 .append("rect") |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
468 .on("mouseover", function() { |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
469 d3.select(this).attr("opacity", "0.8"); |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
470 d3.select("#tooltip").attr("opacity", 1); |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
471 }) |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
472 .on("mouseout", function() { |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
473 d3.select(this).attr("opacity", 1); |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
474 d3.select("#tooltip").attr("opacity", 0); |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
475 }) |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
476 .on("mousemove", function(d) { |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
477 let y = d3.mouse(this)[1]; |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
478 const dy = document |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
479 .querySelector(".diagram-container") |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
480 .getBoundingClientRect().left; |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
481 d3.select("#tooltip") |
3907
7b172a1fd9e7
client: available fairway depth diagram: rounded values in tooltip
Markus Kottlaender <markus@intevation.de>
parents:
3905
diff
changeset
|
482 .text(Math.round(d)) |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
483 .attr("y", y - 10) |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
484 .attr("x", d3.event.pageX - dy); |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
485 //d3.event.pageX gives coordinates relative to SVG |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
486 //dy gives offset of svg on page |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
487 }) |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
488 .attr("height", d => { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
489 return yScale(0) - yScale(d); |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
490 }) |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
491 .attr("y", (d, i) => { |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
492 if (i === 0) { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
493 return yScale(d); |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
494 } |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
495 if (i === 1) { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
496 return yScale(data.above + d); |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
497 } |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
498 if (i === 2) { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
499 return yScale(data.above + data.between + d); |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
500 } |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
501 }) |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
502 .attr("width", afdWidth) |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
503 .attr("fill", (d, i) => { |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
504 return this.$options.AFDCOLORS[i]; |
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
505 }); |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
506 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
507 drawLNWL(data, i, diagram, spaceBetween, widthPerItem, ldcWidth, yScale) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
508 let lnwl = diagram |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
509 .append("g") |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
510 .attr( |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
511 "transform", |
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
512 `translate(${this.scalePaddingLeft + |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
513 spaceBetween / 2 + |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
514 widthPerItem * i})` |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
515 ); |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
516 lnwl |
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
517 .append("rect") |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
518 .datum([data.ldc]) |
3377
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
519 .on("mouseover", function() { |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
520 d3.select(this).attr("opacity", "0.8"); |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
521 d3.select("#tooltip").attr("opacity", 1); |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
522 }) |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
523 .on("mouseout", function() { |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
524 d3.select(this).attr("opacity", 1); |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
525 d3.select("#tooltip").attr("opacity", 0); |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
526 }) |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
527 .on("mousemove", function(d) { |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
528 let y = d3.mouse(this)[1]; |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
529 const dy = document |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
530 .querySelector(".diagram-container") |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
531 .getBoundingClientRect().left; |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
532 d3.select("#tooltip") |
3907
7b172a1fd9e7
client: available fairway depth diagram: rounded values in tooltip
Markus Kottlaender <markus@intevation.de>
parents:
3905
diff
changeset
|
533 .text(Math.round(d[0])) |
3377
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
534 .attr("y", y - 10) |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
535 .attr("x", d3.event.pageX - dy); |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
536 //d3.event.pageX gives coordinates relative to SVG |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
537 //dy gives offset of svg on page |
ccb5455f0713
available_fairway_depthLNWL: tooltips added
Thomas Junk <thomas.junk@intevation.de>
parents:
3368
diff
changeset
|
538 }) |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
539 .attr("height", d => { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
540 return yScale(0) - yScale(d); |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
541 }) |
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
542 .attr("y", d => { |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
543 return yScale(d); |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
544 }) |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
545 .attr("width", ldcWidth) |
3463
6f4dad7473d7
afdLNWL: basical usage of classbreaks
Thomas Junk <thomas.junk@intevation.de>
parents:
3461
diff
changeset
|
546 .attr("fill", () => { |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
547 return this.$options.LWNLCOLORS.LDC; |
3368
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
548 }); |
70605404f37d
fa_lnwl: prototypical diagram added
Thomas Junk <thomas.junk@intevation.de>
parents:
3366
diff
changeset
|
549 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
550 drawScaleLabel({ diagram, dimensions }) { |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
551 const center = dimensions.mainHeight / 2; |
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
552 diagram |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
553 .append("text") |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
554 .text(this.$options.LEGEND) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
555 .attr("text-anchor", "middle") |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
556 .attr("x", 0) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
557 .attr("y", 0) |
3814
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
558 .attr("dy", "10") |
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
559 // translate a few mm to the right to allow for slightly higher letters |
ff8ca2d80ce9
client: improve pdf generation towards vector diagrams
Bernhard Reiter <bernhard@intevation.de>
parents:
3806
diff
changeset
|
560 .attr("transform", `translate(2, ${center}), rotate(-90)`); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
561 }, |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
562 drawScale({ diagram, dimensions, yScale }) { |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
563 const yAxisLeft = d3 |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
564 .axisLeft() |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
565 .tickSizeInner( |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
566 dimensions.width - this.scalePaddingLeft - this.scalePaddingRight |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
567 ) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
568 .tickSizeOuter(0) |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
569 .scale(yScale); |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
570 const yAxisRight = d3 |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
571 .axisRight() |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
572 .tickSizeInner( |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
573 dimensions.width - this.scalePaddingLeft - this.scalePaddingRight |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
574 ) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
575 .tickSizeOuter(0) |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
576 .scale(yScale); |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
577 |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
578 diagram |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
579 .append("g") |
3876
0c6ef9e655fc
client: available fairway depth diagrams: added second y-axis on the right
Markus Kottlaender <markus@intevation.de>
parents:
3717
diff
changeset
|
580 .attr( |
0c6ef9e655fc
client: available fairway depth diagrams: added second y-axis on the right
Markus Kottlaender <markus@intevation.de>
parents:
3717
diff
changeset
|
581 "transform", |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
582 `translate(${dimensions.width - this.scalePaddingRight})` |
3876
0c6ef9e655fc
client: available fairway depth diagrams: added second y-axis on the right
Markus Kottlaender <markus@intevation.de>
parents:
3717
diff
changeset
|
583 ) |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
584 .call(yAxisLeft) |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
585 .selectAll(".tick text") |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
586 .attr("fill", "black") |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
587 .attr("dx", -6) |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
588 .select(function() { |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
589 return this.parentNode; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
590 }) |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
591 .selectAll(".tick line") |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
592 .attr("stroke-dasharray", 5) |
3905
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
593 .attr("stroke", "#ccc") |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
594 .select(function() { |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
595 return this.parentNode; |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
596 }) |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
597 .filter(d => d === 0) |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
598 .selectAll(".tick line") |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
599 .attr("stroke-dasharray", "none") |
3c095749efb2
client: available fairwaydepth diagrams: emphasize 0-ticks
Markus Kottlaender <markus@intevation.de>
parents:
3890
diff
changeset
|
600 .attr("stroke", "#333"); |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
601 diagram |
3877
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
602 .append("g") |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
603 .attr("transform", `translate(${this.scalePaddingLeft})`) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
604 .call(yAxisRight) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
605 .selectAll(".tick text") |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
606 .attr("fill", "black") |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
607 .attr("dx", 6) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
608 .select(function() { |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
609 return this.parentNode; |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
610 }) |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
611 .selectAll(".tick line") |
d82b5e5868e3
client: available fairway depth diagrams: draw horizontal scale lines for better readability
Markus Kottlaender <markus@intevation.de>
parents:
3876
diff
changeset
|
612 .attr("stroke", "transparent"); |
3912
b7dfee369f2f
available_fairwaydepthLNWL: factor out sideeffects and render offscreen
Thomas Junk <thomas.junk@intevation.de>
parents:
3907
diff
changeset
|
613 diagram.selectAll(".domain").attr("stroke", "black"); |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
614 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
615 }, |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
616 watch: { |
3299
ef52926ce2fc
available_fairwaydepth_vs_lnwl: Scales adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
3296
diff
changeset
|
617 fwLNWLData() { |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
618 this.drawDiagram(); |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
619 } |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
620 }, |
3380
d83c738e8627
fairway_availability_LNWL: draw chart with MOCKDATA
Thomas Junk <thomas.junk@intevation.de>
parents:
3377
diff
changeset
|
621 LEGEND: app.$gettext("Percent"), |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
622 AFDCOLORS: ["#3636ff", "#f49b7f", "#e15472"], |
3381 | 623 LWNLCOLORS: { |
3461
b43cf476d791
client: spuc05: implemented new data structure (CSV) and added support for multiple charts
Markus Kottlaender <markus@intevation.de>
parents:
3450
diff
changeset
|
624 LDC: "#97ddf3", |
3386 | 625 HDC: "#43FFE1" |
3381 | 626 } |
3296
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
627 }; |
fa7dc3f31ef3
available_fairwaydepth_vs_lnwl: POC etd.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
628 </script> |