-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprimerjava.html
More file actions
243 lines (204 loc) · 7.91 KB
/
primerjava.html
File metadata and controls
243 lines (204 loc) · 7.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!DOCTYPE html>
<html lang="en">
<head>
<title>Povprečna Plača</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="Spletna stran Rokodelstva Baša">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="icon" href="Images/Icon2.jpg">
<script src="scripts/d3.js"></script>
<script src="index.js"></script>
<link rel="stylesheet" href="index.css">
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'>
<style>
* {
box-sizing: border-box;
}
/*the container must be positioned relative:*/
.autocomplete {
position: relative;
display: inline-block;
}
input {
border: 1px solid transparent;
background-color: #f1f1f1;
padding: 10px;
font-size: 16px;
}
input[type=text] {
background-color: #f1f1f1;
width: 100%;
}
input[type=submit] {
background-color: DodgerBlue;
color: #fff;
cursor: pointer;
}
.autocomplete-items {
position: absolute;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 99;
/*position the autocomplete items to be the same width as the container:*/
top: 100%;
left: 0;
right: 0;
}
.autocomplete-items div {
padding: 10px;
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
/*when hovering an item:*/
.autocomplete-items div:hover {
background-color: #e9e9e9;
}
/*when navigating through the items using the arrow keys:*/
.autocomplete-active {
background-color: DodgerBlue !important;
color: #ffffff;
}
</style>
</head>
<body>
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-primary">
<div class="container-fluid">
<div class="navbar-header align-middle">
<button class="collapsed navbar-toggler align-middle" type="button" data-toggle="collapse" data-target="#navbarMenu" onclick="resize_body_padding();">
<span> </span>
<span> </span>
<span> </span>
</button>
<a href="#" class="navbar-brand align-middle">
<h3>Povprečna plača</h3>
</a>
<div class="logo align-middle">
<img src="Images/Icon2.jpg" height="40" alt="EURO" class="logo"/>
</div>
</div>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class = "nav navbar-nav">
<li><a class="nav-link" href="index.html"><button id="domov" class="btn btn-info">DOMOV</button></a></li>
<li><a class="nav-link" href="obcine.html"><button id="regije" class="btn btn-info">REGIJE</button></a></li>
<li><a class="nav-link" href="primerjava.html"><button id="dejavnosti" class="btn btn-info">PRIMERJAJ</button></a></li>
<li><a class="nav-link" href="casovnica.html"><button id="casovnica" class="btn btn-info">ČASOVNICA</button></a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid" style="margin-bottom: 20px; margin-top: 20px;">
<div class="autocomplete row w-100">
<form class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="input-group">
<input id="myInput" type="text" class="form-control" placeholder="Npr. Veterinarstvo / Rudarstvo name..." name="myCountry">
<div class="input-group-append">
<button class="btn btn-link btn-outline-primary" type="button" onclick="potegni()" id="iscem">IŠČI</button>
</div>
</div>
</form>
</div>
</div>
<script src="https://d3js.org/d3.v4.js"></script>
<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>
<!-- Color Scale -->
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
// set the dimensions and margins of the graph
var margin = {top: 10, right: 200, bottom: 200, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
// append the svg object to the body of the page
var svg = d3.select("#my_dataviz")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
//Read the data
d3.csv("vse.csv", function(data) {
// List of groups (here I have one group per column)
var allGroup = ["Vzhodna Slovenija", "Podravska"]
// Reformat the data: we need an array of arrays of {x, y} tuples
var dataReady = allGroup.map( function(grpName) { // .map allows to do something for each element of the list
return {
name: grpName,
values: data.map(function(d) {
return {time: d.time, value: +d[grpName]};
})
};
});
// I strongly advise to have a look to dataReady with
// console.log(dataReady)
// A color scale: one color for each group
var myColor = d3.scaleOrdinal()
.domain(allGroup)
.range(d3.schemeSet2);
// Add X axis --> it is a date format
var x = d3.scaleLinear()
.domain([2005,2018])
.range([ 0, width ]);
svg.append("g")
.attr("transform", "translate(0," + height + ")")
.call(d3.axisBottom(x));
// Add Y axis
var y = d3.scaleLinear()
.domain( [600,1100])
.range([ height, 0 ]);
svg.append("g")
.call(d3.axisLeft(y));
// Add the lines
var line = d3.line()
.x(function(d) { return x(+d.time) })
.y(function(d) { return y(+d.value) })
svg.selectAll("myLines")
.data(dataReady)
.enter()
.append("path")
.attr("d", function(d){ return line(d.values) } )
.attr("stroke", function(d){ return myColor(d.name) })
.style("stroke-width", 4)
.style("fill", "none")
// Add the points
svg
// First we need to enter in a group
.selectAll("myDots")
.data(dataReady)
.enter()
.append('g')
.style("fill", function(d){ return myColor(d.name) })
// Second we need to enter in the 'values' part of this group
.selectAll("myPoints")
.data(function(d){ return d.values })
.enter()
.append("circle")
.attr("cx", function(d) { return x(d.time) } )
.attr("cy", function(d) { return y(d.value) } )
.attr("r", 5)
.attr("stroke", "white")
// Add a legend at the end of each line
svg
.selectAll("myLabels")
.data(dataReady)
.enter()
.append('g')
.append("text")
.datum(function(d) { return {name: d.name, value: d.values[d.values.length - 1]}; }) // keep only the last value of each time series
.attr("transform", function(d) { return "translate(" + x(d.value.time) + "," + y(d.value.value) + ")"; }) // Put the text at the position of the last point
.attr("x", 12) // shift the text a bit more right
.text(function(d) { return d.name; })
.style("fill", function(d){ return myColor(d.name) })
.style("font-size", 15)
})
</script>
</body>
</html>