-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.html
More file actions
214 lines (193 loc) · 10.4 KB
/
index.html
File metadata and controls
214 lines (193 loc) · 10.4 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
<!DOCTYPE html>
<html>
<head>
<title>Northern Ireland Elections - Results</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://cdn.jsdelivr.net/lodash/4.11.1/lodash.min.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.hexbin.v0.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/json5/0.3.0/json5.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vega/2.5.2/vega.min.js"></script>
<link rel="stylesheet" href="/website/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/website/css/style.css" media="screen, handheld" />
<link rel="stylesheet" type="text/css" href="/website/css/overview.css" media="screen, handheld" />
<link rel="stylesheet" type="text/css" href="/website/css/enhanced.css" media="screen and (min-width: 60.5em)" />
<link rel="stylesheet" type="text/css" href="/website/css/stages.css" media="screen, handheld" />
<link rel="stylesheet" type="text/css" href="/website/css/transfers.css" media="screen, handheld" />
<link rel="icon" type="image/png" href="/website/image/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/website/image/favicon-16x16.png" sizes="16x16" />
<!--[if (lt IE 9)&(!IEMobile)]>
<link rel="stylesheet" type="text/css" href="enhanced.css" />
<![endif]-->
<meta name="description" content="Generating crowdsourced open data, live results and data visualisations for the Northern Ireland Assembly Elections 2016." />
<meta name="keywords" content="assembly, elections, open data, northern ireland, 2016, crowdsource, results, single transferable vote, stv, constituency, candidate, odi belfast, open government network, nicva, voting, #ae16, tally, count, electoral" />
<meta name="author" content="metatags generator">
<meta name="robots" content="index, follow">
<meta name="revisit-after" content="1 month">
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@electionsni" />
<meta name="twitter:creator" content="@odibelfast" />
<meta property="og:url" content="http://electionsni.org" />
<meta property="og:title" content="Elections NI #AE16" />
<meta property="og:description" content="Generating crowdsourced open data, live results and data visualisations for the Northern Ireland Assembly Elections 2016." />
<meta property="og:image" content="https://s3-eu-west-1.amazonaws.com/electionsni.org/website/image/banner.png" />
<!-- data, elections, ni -->
</head>
<style>
#charttooltip {
font-size: 12px;
position: absolute;
height: auto;
padding: 10px;
color: #ffffff;
background-color: #000000;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
pointer-events: none;
}
#charttooltip.hidden {
display: none;
}
</style>
<body>
<div id="wrap">
<header>
<h1><a href = "/">Elections NI</a></h1>
<p>Open data for the Assembly Elections #AE16</p>
</header>
<label for="show-menu" class="show-menu">Menu</label>
<input type="checkbox" id="show-menu" role="button">
<div id='cssmenu'>
<ul>
<li><a href='/constituencies'><span>Constituencies</span></a></li>
<li class='active'><a href='/results'><span>Results</span></a></li>
<li><a href='/candidates'><span>Candidates</span></a></li>
<li><a href='/data'><span>Data</span></a></li>
<li class='last'><a href='/about'><span>About</span></a></li>
</ul>
</div>
<div class="cta"><b>This is the 'live' process of updating crowdsourced Assembly Elections data. The 2016 data may be incomplete and is provisional until further notice. <a href="/about#help">How can I contribute data?</a>.</b></div>
<div class="content">
<p>We'll be bringing you live (or as close to live) data on the vote counting as it happens after the Assembly Elections on 5 May 2016.</p>
<div id = "overview_container">
<div id="overview_matrix"></div>
<div id="party_matrix">
<div id="thirtySeats"></div>
</div>
</div>
<h2>Elected Candidates Hexchart</h2>
<form id="year">
<b>Choose year:</b>
<input type="radio" name="year" value="2016" checked onchange="getdata(2016)"/> 2016
<input type="radio" name="year" value="2011" onchange="getdata(2011)"/> 2011<br/>
</form>
<form id="sorter">
<p><b>Sort by</b>
<input type="radio" name="sorter" value="party" onchange='pushdata(data,"Party_Name","asc");visualise();') checked>Party</input>
<input type="radio" name="sorter" value="constituency" onchange='pushdata(data,"Constituency_Number","asc");visualise();'>Constituency</input>
<input type="radio" name="sorter" value="fpv" onchange='pushdata(data,"Candidate_First_Pref_Votes","desc");visualise();'>1st Pref Votes</input>
</p>
</form>
<div id="chart"></div>
<div id="number-elected"></div>
<div id="charttooltip" class="hidden">
<span id="constituencyname" style="font-weight: bold"></span></br>
<span id="name"></span></br>
<span id="party" style="color: red"></span></br>
<span id="fpv"></span></br>
</div>
<h2>Visualisations</h2>
<p>Choose a constituency and year.</p>
<div id="menuBar">
<select id="constituencySelect">
</select>
<select id="yearSelect">
<option>2016</option>
<option>2011</option>
</select>
</div>
<h3>Transfers</h3>
<div id="stageNumbers"></div>
<div id="controls">
<a href="#Again" id="again" class="fa fa-step-backward"></a>
<a href="#Pause" id="pause-replay" class="fa fa-pause"></a>
<a href="#Next" id="step" class="fa fa-step-forward"></a>
</div>
<div id="quota"></div>
<div id="animation"></div>
<h3>Count Matrix</h3>
<div id="overview_container"><div id="count_matrix"></div></div>
<div id="matrixtooltip"></div>
<h3>Party to Party Transfers</h3>
<p>This matrix summarises the percentage of transfers between candidates from each party. It is based on only those count stages with a transfer from one single candidate. It is only indicative of the transfers that were calculated during the actual count process, and cannot account for all ballots cast in a constituency.</p>
<div id="transfers"></div>
<p>Thanks to James Bligh (<a href="http://twitter.com/anamates" target="_blank" title="External Link">@anamates</a>) for sharing the <a href="https://github.com/NICVA/electionsni/blob/master/website/js/stages.js" target="_blank" title="External Link">code</a> for the transfers animation.</p>
</div>
</div>
<div id="footer">
Project by <a href="http://belfast.theodi.org">ODI Belfast</a> at <a href="http://www.nicva.org">NICVA</a> and the <a href="http://www.opengovernment.org.uk/about/ni-ogn/">Open Government Network NI</a></br><a href="http://www.nicva.org"><img src="/website/image/nicva500.png" height="75px" align="middle"></a><a href="http://belfast.theodi.org"><img src="/website/image/odibelfast500.png" height="75px" align="middle"></a><a href="http://www.opengovernment.org.uk/about/ni-ogn/"><img src="/website/image/ognni500.png" height="75px" align="middle"></a>
</div>
<!--Load local scripts-->
<script type="text/javascript" src="/website/js/d3hexbin.js"></script>
<script type="text/javascript" src="/website/js/script.js"></script>
<script type="text/javascript" src="/website/js/stages2.js"></script>
<script src="/website/js/transfers.js"></script>
<script src="/website/js/overview_matrix2.js"></script>
<script type="text/javascript">
// for AE16-LIVE we don't want to chace json in case users don't see the updates
$(document).ready(function() {
$.ajaxSetup({ cache: false });
});
// tooltip
$(document).bind('mousemove', function(e) {
$('#matrixtooltip').css({
"left": e.pageX + 20,
"top": e.pageY
});
});
var year = $("#yearSelect :selected").text();
$.getJSON('/' + year + "/NI/all-constituency-info.json", function(data) {
var constituencies = data.Constituencies;
var constituencySelect = $("#constituencySelect");
var yearSelect = $("#yearSelect");
$.each(constituencies, function(i, constituency){
var name = constituency.Constituency_Name;
var folder = name.toLowerCase().replace(" and ","-").replace(/\s/,"-");
$(constituencySelect).append($("<option/>").val(folder).text(name))
})
constituencySelect.change(function() {
var constituencyFolder = $("#constituencySelect :selected").val();
var year = $("#yearSelect :selected").text();
countMatrix(year, constituencyFolder);
animateStages(year, constituencyFolder);
})
yearSelect.change(function() {
var constituencyFolder = $("#constituencySelect :selected").val();
var year = $("#yearSelect :selected").text();
getTransfersData(year);
countMatrix(year, constituencyFolder);
animateStages(year, constituencyFolder);
})
var constituencyFolder = $("#constituencySelect :selected").val();
var year = $("#yearSelect :selected").text();
getTransfersData(year);
countMatrix(year, constituencyFolder);
animateStages(year,constituencyFolder);
})
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-77063537-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>