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