Mercurial > bottledash
annotate modules/web_view/bottledash_graph.html @ 43:2e2981af7d2d
Use bottledash-specific graph template
This version differs from roundup_cc's graph.html in that is not a complete
HTML file but a snippet.
author | Gernot Schulz <gernot@intevation.de> |
---|---|
date | Sun, 31 Jan 2016 15:21:18 +0100 |
parents | |
children |
rev | line source |
---|---|
43
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
1 <style type = text/css> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
2 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
3 * { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
4 font-family: "Sans-serif"; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
5 /*font-size: 20px;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
6 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
7 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
8 .svg div{ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
9 /*font: 10px;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
10 /*text-align: right;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
11 /*float: left;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
12 /*display: block;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
13 /*padding: 10px;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
14 /*margin: 10px;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
15 color: white; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
16 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
17 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
18 .axis path, |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
19 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
20 .axis line { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
21 fill: none; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
22 stroke: lightgrey; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
23 /*opacity: 0.7;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
24 stroke-width: 1px; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
25 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
26 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
27 .y.axis path { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
28 display: none; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
29 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
30 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
31 .line { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
32 fill: none; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
33 stroke-width: 4px; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
34 opacity: 1; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
35 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
36 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
37 .line.critical { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
38 stroke: red; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
39 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
40 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
41 .line.critical.legend { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
42 fill: red; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
43 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
44 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
45 .line.urgent { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
46 stroke: orange; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
47 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
48 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
49 .line.urgent.legend { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
50 fill: orange; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
51 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
52 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
53 .line.bug { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
54 stroke: violet; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
55 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
56 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
57 .line.bug.legend { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
58 fill: violet; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
59 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
60 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
61 .line.feature { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
62 stroke: chartreuse; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
63 style: stroke-dasharray; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
64 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
65 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
66 .line.feature.legend { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
67 fill: chartreuse; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
68 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
69 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
70 .line.wish { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
71 stroke: blue; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
72 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
73 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
74 .line.wish.legend { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
75 fill: blue; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
76 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
77 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
78 .grid .tick { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
79 stroke: lightgrey; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
80 /*opacity: 0.7;*/ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
81 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
82 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
83 .grid path { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
84 stroke-width: 0; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
85 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
86 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
87 </style> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
88 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
89 <!-- <div id="content" style="display: inline-block"></div> --> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
90 <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script> --> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
91 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
92 <script type="text/javascript" src="static/d3.v3.min.js"></script> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
93 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
94 <script type="text/javascript"> |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
95 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
96 var d3jsInjectionTarget="X"; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
97 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
98 // window.onresize = function(){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
99 // document.getElementById(d3jsInjectionTarget).innerHTML = ""; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
100 // makeChart(); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
101 // }; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
102 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
103 var critical=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
104 var urgent=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
105 var bug=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
106 var feature=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
107 var wish=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
108 var timestamp=[]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
109 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
110 document.addEventListener("DOMContentLoaded", function(event) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
111 try { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
112 document.getElementById(d3jsInjectionTarget).getElementsByClassName("svg")[0].innerHTML = "" |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
113 } catch (e) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
114 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
115 makeChart(); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
116 }); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
117 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
118 function assignIssueToDate(issueArray, dateArray){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
119 a = []; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
120 for (var i = 0; i < issueArray.length; i++) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
121 a.push({points: issueArray[i].points, date : dateArray[i].date}); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
122 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
123 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
124 return a; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
125 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
126 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
127 function limitDatesOnXAxis(limit){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
128 if (timestamp.length < limit){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
129 return timestamp.length; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
130 } else { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
131 return limit; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
132 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
133 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
134 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
135 function maxInObject( array ){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
136 var maxVal = 0; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
137 for (var i = 0; i < array.length; i++) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
138 if (maxVal < array[i].points){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
139 maxVal = array[i].points; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
140 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
141 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
142 return maxVal; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
143 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
144 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
145 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
146 function getMaxIssues(){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
147 maxIssuesOfAllArrays = []; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
148 maxIssuesOfAllArrays.push(maxInObject(critical)); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
149 maxIssuesOfAllArrays.push(maxInObject(urgent)); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
150 maxIssuesOfAllArrays.push(maxInObject(bug)); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
151 maxIssuesOfAllArrays.push(maxInObject(feature)); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
152 maxIssuesOfAllArrays.push(maxInObject(wish)); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
153 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
154 return Math.max.apply(Math, maxIssuesOfAllArrays)+1; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
155 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
156 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
157 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
158 function dayDifference(first, second) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
159 "use strict"; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
160 var difference = (second - first) / (1000 * 60 * 60 * 24); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
161 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
162 // just to avoid the get thousands of lines... would look ugly. |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
163 if (difference > 60){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
164 difference = 60; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
165 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
166 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
167 return difference; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
168 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
169 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
170 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
171 // function for the grid lines |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
172 function makeGrid(direction, orientation, ticknumber) { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
173 return d3.svg.axis() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
174 .scale(direction) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
175 .orient(orientation) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
176 .ticks( ticknumber ); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
177 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
178 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
179 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
180 //append a svg_path. pretty generic |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
181 function draw_line(svg, data_array, css_class, line_object){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
182 svg.append("path") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
183 .datum(assignIssueToDate(data_array, timestamp)) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
184 .attr("class", css_class) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
185 .attr("d", line_object); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
186 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
187 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
188 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
189 function makeLegend(svg, width){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
190 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
191 var legend_distance = width+40; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
192 var top_distance = 20; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
193 var distance_steps = 50; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
194 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
195 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
196 function set_propper_distance(steps){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
197 top_distance += steps; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
198 return top_distance; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
199 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
200 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
201 function draw_legend_line(svg, width, Ypos, text, issues){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
202 svg.append("svg:text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
203 .attr("class", "legend") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
204 .attr("x", width-30 ) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
205 .attr("y", Ypos) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
206 .text(text + ":"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
207 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
208 svg.append("svg:text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
209 .attr("class", "legend") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
210 .attr("x", width+35 ) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
211 .attr("y", Ypos) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
212 .text(issues); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
213 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
214 svg.append("rect") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
215 .attr("class", "line " + text.toLowerCase() + " legend") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
216 .attr("x", width-30) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
217 .attr("y", Ypos-20) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
218 .attr("width", 100) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
219 .attr("height", 2); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
220 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
221 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
222 draw_legend_line(svg, legend_distance, set_propper_distance(distance_steps), "Critical", critical[critical.length-1].points); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
223 draw_legend_line(svg, legend_distance, set_propper_distance(distance_steps), "Urgent", urgent[urgent.length-1].points); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
224 draw_legend_line(svg, legend_distance, set_propper_distance(distance_steps), "Bug", bug[bug.length-1].points); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
225 draw_legend_line(svg, legend_distance, set_propper_distance(distance_steps), "Feature", feature[feature.length-1].points); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
226 draw_legend_line(svg, legend_distance, set_propper_distance(distance_steps), "Wish", wish[wish.length-1].points); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
227 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
228 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
229 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
230 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
231 //draw the chart |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
232 function makeChart(div_name){ |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
233 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
234 //declaration |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
235 var targetDiv = document.getElementById(d3jsInjectionTarget) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
236 // var sizeOfSystemBorders = 20; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
237 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
238 var margin = {top: 20, right: 10, bottom: 50, left:50} |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
239 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
240 var width = targetDiv.clientWidth - margin.left - margin.right |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
241 var height = targetDiv.clientHeight - margin.top - margin.bottom |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
242 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
243 var x = d3.time.scale() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
244 .range([0, width]); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
245 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
246 var y = d3.scale.linear() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
247 .range([height, 0]); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
248 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
249 var base_line = d3.svg.line() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
250 .x(function(d) { return x(d.date); }) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
251 .y(function(d) { return y(d.points); }); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
252 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
253 //lines |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
254 var criticalLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
255 var urgentLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
256 var bugLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
257 var featureLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
258 var wishLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
259 var timestampLine = base_line; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
260 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
261 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
262 //set domain of y axis |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
263 var yDomain = [ ]; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
264 yDomain[0] = 0; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
265 yDomain[1] = getMaxIssues(); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
266 y.domain(d3.extent(yDomain, function(d){return d; })); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
267 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
268 //set domain of y axis |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
269 x.domain(d3.extent(timestamp, function(d){return d.date; })); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
270 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
271 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
272 var xAxis = d3.svg.axis() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
273 .scale(x) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
274 .orient("bottom") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
275 .ticks(limitDatesOnXAxis(10)) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
276 .tickFormat(d3.time.format("%d.%m")); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
277 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
278 var yAxis = d3.svg.axis() |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
279 .scale(y) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
280 .orient("left"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
281 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
282 var svg = d3.select("#" + d3jsInjectionTarget) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
283 .append("svg") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
284 .attr("class", "svg") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
285 .attr("width", width + margin.left + margin.right) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
286 .attr("height", height + margin.top + margin.bottom) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
287 .append("g") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
288 .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
289 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
290 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
291 // creation |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
292 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
293 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
294 // Draw the x Grid lines |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
295 // svg.append("g") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
296 // .attr("class", "grid") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
297 // .attr("transform", "translate(0," + height + ")") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
298 // .call(makeGrid(x, "bottom", timestamp.length) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
299 // .tickSize(-height, 0, 0) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
300 // .tickFormat("") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
301 // ); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
302 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
303 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
304 // Draw the y Grid lines |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
305 svg.append("g") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
306 .attr("class", "grid") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
307 .call(makeGrid(y, "left", function(){return Math.min(getMaxIssues(), 10);}()) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
308 .tickSize(-width, 0, 0) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
309 .tickFormat("") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
310 ); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
311 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
312 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
313 // Draw the x-axis |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
314 svg.append("g") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
315 .attr("class", "x axis") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
316 // .attr("transform", "translate(0, " + 20-height + ")") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
317 .attr("transform", "translate(0," + height + ")") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
318 .call(xAxis) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
319 .selectAll("text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
320 // .style("text-anchor", "end") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
321 // .attr("dx", "-.5em") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
322 // .attr("dy", ".1em") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
323 // .attr("transform", function() { |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
324 // return "rotate(-30)"; |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
325 // }); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
326 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
327 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
328 // Draw the y-axis |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
329 svg.append("g") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
330 .attr("class", "y axis") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
331 .call(yAxis) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
332 .append("text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
333 .attr("transform", "rotate(-90)") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
334 // .attr("y", 6) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
335 // .attr("dy", ".71em") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
336 .style("text-anchor", "end"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
337 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
338 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
339 // Text for y-axis |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
340 // svg.append("text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
341 // .attr("transform", "rotate(-90)") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
342 // .attr("y", 10 - margin.left) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
343 // .attr("x", 0 - (height / 2)) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
344 // .attr("dy", "1em") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
345 // .style("text-anchor", "middle") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
346 // .text("Issues"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
347 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
348 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
349 //Titel und Legende |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
350 // svg.append("svg:text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
351 // .attr("class", "text") |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
352 // .attr("x", 10) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
353 // .attr("y", -5) |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
354 // .text("Issues Nach Zeit"); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
355 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
356 draw_line(svg, wish, "line wish", wishLine); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
357 draw_line(svg, feature, "line feature", featureLine); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
358 draw_line(svg, bug, "line bug", bugLine); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
359 draw_line(svg, urgent, "line urgent", urgentLine); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
360 draw_line(svg, critical, "line critical", criticalLine); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
361 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
362 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
363 // makeLegend(svg, width); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
364 } |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
365 // makeChart(); |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
366 |
2e2981af7d2d
Use bottledash-specific graph template
Gernot Schulz <gernot@intevation.de>
parents:
diff
changeset
|
367 </script> |