-
Notifications
You must be signed in to change notification settings - Fork 2
/
white.html
536 lines (485 loc) · 21 KB
/
white.html
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
<html>
<head>
<title>UK 3D Hex Map</title>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@daalwr" />
<meta name="twitter:title" content="UK 3D Hex Map" />
<meta name="twitter:description" content="A 3D Hexagon Map of the UK visualising constituency voting data." />
<meta name="twitter:image" content="http://i.imgur.com/FH38fwc.png" />
<meta name="twitter:creator" content="@daalwr">
<meta property="og:image" content="http://i.imgur.com/FH38fwc.png"/>
<meta property="og:title" content="UK 3D Hex Map"/>
<meta property="og:description" content="A 3D Hexagon Map of the UK visualising constituency voting data."/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link rel="stylesheet" href="css/darkly.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script src="js/three.js"></script>
<script src="js/orbit.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.23.0/ramda.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/16.3.5/Tween.min.js"></script>
<script src="js/hexmap.js"></script>
<style>
body {
margin: 0;
background-color: white;
color: black
}
canvas {
width: 100%;
height: 100%;
}
.data-column {
padding-top: 75px;
overflow: auto;
}
.color-con{
color: #2254F4
}
.color-lab{
color: #D60303
}
.color-ld{
color: #F9BC26
}
.color-ukip{
color: #722EA5
}
.color-green{
color: #0DBC37
}
.color-snp{
color: #FF6700
}
.color-pc{
color: #1DD3A7
}
.color-dup{
color: #4f4c9a
}
.color-sf{
color: #b6c727
}
.color-sdlp{
color: #fbb675
}
.color-uup{
color: #EF3AAB
}
.color-alliance{
color: #909090
}
.color-other{
color: #909090
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="mainContainer" class="container-fluid">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a id="home" class="navbar-brand" href="#">UK 3D Hex Map</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li id="nav-summary" class="active"><a id="summary" href="#">Summary </a></li>
<li id="nav-by-party" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Votes By Party <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a class="color-con" href="#" id="colorCon">Con</a></li>
<li><a class="color-dup" href="#" id="colorDUP">DUP</a></li>
<li><a class="color-ind" href="#" id="colorInd">Ind</a></li>
<li><a class="color-sdlp" href="#" id="colorSDLP">SDLP</a></li>
<li><a class="color-sf" href="#" id="colorSF">SF</a></li>
<li><a class="color-uup" href="#" id="colorUUP">UUP</a></li>
<li><a class="color-lab" href="#" id="colorLab">Lab</a></li>
<li><a class="color-snp" href="#" id="colorSNP">SNP</a></li>
<li><a class="color-ld" href="#" id="colorLD">LD</a></li>
<li><a class="color-ukip" href="#" id="colorUKIP">UKIP</a></li>
<li><a class="color-green" href="#" id="colorGreen">Green</a></li>
<li><a class="color-pc" href="#" id="colorPC">PC</a></li>
</ul>
</li>
<li id="nav-rectangle"><a href="#" id="rectangle">Rectangle</a></li>
<li id="nav-explode"><a href="#" id="explode">Explode</a></li>
<li id="nav-gains"><a href="#" id="gains">Gains</a></li>
<li id="nav-electorate"><a href="#" id="electorate">Electorate Size</a></li>
</ul>
<!--TODO - Postcode search? -->
<!--<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form><-->
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Find out more <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/daalwr/3dmap">Source code</a></li>
<li><a href="https://twitter.com/daalwr">Twitter</a></li>
<li><a href="#" data-toggle="modal" data-target="#data-source-modal">About</a></li>
<li><a href="#"><img src="img/parrot.gif" alt="Party Parrot"></a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div id="data-source-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Credits</h4>
</div>
<div class="modal-body">
<p>
MIT License <br />
Copyright (c) Daniel Wright<br />
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:<br />
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.<br />
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.<br />
----------------------------------------------------------------------------------------------------------<br />
Hexagon layout data taken from <a href="https://github.com/odileeds/hexmaps">https://github.com/odileeds/hexmaps</a><br />
MIT License<br />
Copyright (c) 2017 ODI Leeds<br />
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:<br />
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.<br />
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.<br />
----------------------------------------------------------------------------------------------------------<br />
2015 election results data from <a href="http://www.data.parliament.uk/dataset/general-election-2015">http://www.data.parliament.uk/dataset/general-election-2015</a>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="maprow" class="row">
<div id="mapcontainer" class="col-sm-9"></div>
<div class="col-sm-3 data-column hidden-xs ">
<p>Data: 2015 General Election Results</p>
<p>ONS ID: <span id="ons_id_label"></span></p>
<p>ONS Region ID: <span id="ons_region_id_label"></span></p>
<p>Constituency name: <span id="constituency_name_label"></span></p>
<p>County name: <span id="county_name_label"></span></p>
<p>Region name: <span id="region_name_label"></span></p>
<p>Country name: <span id="country_name_label"></span></p>
<p>Constituency type: <span id="constituency_type_label"></span></p>
<p>Declaration time: <span id="declaration_time_label"></span></p>
<br />
<p>Result: <span id="result_label"></span></p>
<p>First party: <span id="first_party_label"></span></p>
<p>Second party: <span id="second_party_label"></span></p>
<br />
<p>Electorate: <span id="electorate_label"></span></p>
<p>Valid votes: <span id="valid_votes_label"></span></p>
<p>Invalid votes: <span id="invalid_votes_label"></span></p>
<p>Majority: <span id="majority_label"></span></p>
<br />
<p class="color-con">Con: <span id="con_label"></span></p>
<p class="color-lab">Lab: <span id="lab_label"></span></p>
<p class="color-ld">Ld: <span id="ld_label"></span></p>
<p class="color-ukip">UKIP: <span id="ukip_label"></span></p>
<p class="color-green">Green: <span id="green_label"></span></p>
<p class="color-snp">SNP: <span id="snp_label"></span></p>
<p class="color-pc">PC: <span id="pc_label"></span></p>
<p class="color-dup">DUP: <span id="dup_label"></span></p>
<p class="color-sf">SF: <span id="sf_label"></span></p>
<p class="color-sdlp">SDLP: <span id="sdlp_label"></span></p>
<p class="color-uup">UUP: <span id="uup_label"></span></p>
<p class="color-alliance">Alliance: <span id="alliance_label"></span></p>
<p class="color-other">Other: <span id="other_label"></span></p>
</div>
</div>
</div>
<script>
var data = $.ajax({
url: "data/combined3.json",
dataType: "application/json",
async: false
});
var data = JSON.parse(data.responseText);
// Colouring Functions
var colorCon = new THREE.Color(0x2254F4);
var colorDUP = new THREE.Color(0x4f4c9a);
var colorInd = new THREE.Color(0xdfdfdf);
var colorSDLP = new THREE.Color(0xfbb675);
var colorSF = new THREE.Color(0xb6c727);
var colorUUP = new THREE.Color(0xEF3AAB);
var colorLab = new THREE.Color(0xD60303);
var colorSNP = new THREE.Color(0xFF6700);
var colorLD = new THREE.Color(0xF9BC26);
var colorUKIP = new THREE.Color(0x722EA5);
var colorGreen = new THREE.Color(0x0DBC37);
var colorPC = new THREE.Color(0x1DD3A7);
var colorSpk = new THREE.Color(0x909090);
const colorWithParty = obj => {
switch (obj.first_party) {
case "Con": return colorCon;
case "DUP": return colorDUP;
case "Ind": return colorInd;
case "SDLP": return colorSDLP;
case "SF": return colorSF;
case "UUP": return colorUUP;
case "Lab": return colorLab;
case "SNP": return colorSNP;
case "LD": return colorLD;
case "UKIP": return colorUKIP;
case "Green": return colorGreen;
case "PC": return colorPC;
case "Spk": return colorSpk;
default: return new THREE.Color(0x000000);
}
}
function scaleColor(number, color, maxVote) {
const colorCopy = new THREE.Color(color)
var scale = number / maxVote
if (scale > 1) {
scale = 1
}
return colorCopy.multiplyScalar(scale)
}
const values = R.values(data)
function calculateMaxVote(getVotesFunc) {
return R.reduce((a, b) => R.max(a, b), 0, R.map(getVotesFunc, values))
}
const maxConVote = calculateMaxVote(obj => parseInt(obj.con))
const maxDUPVote = calculateMaxVote(obj => parseInt(obj.dup))
const maxIndVote = calculateMaxVote(obj => parseInt(obj.other))
const maxSDLPVote = calculateMaxVote(obj => parseInt(obj.sdlp))
const maxSFVote = calculateMaxVote(obj => parseInt(obj.sf))
const maxUUPVote = calculateMaxVote(obj => parseInt(obj.uup))
const maxLabVote = calculateMaxVote(obj => parseInt(obj.lab))
const maxSNPVote = calculateMaxVote(obj => parseInt(obj.snp))
const maxLDVote = calculateMaxVote(obj => parseInt(obj.ld))
const maxUKIPVote = calculateMaxVote(obj => parseInt(obj.ukip))
const maxGreenVote = calculateMaxVote(obj => parseInt(obj.green))
const maxPCVote = calculateMaxVote(obj => parseInt(obj.pc))
const colorWithCon = obj => { return scaleColor(obj.con, colorCon, maxConVote) }
const colorWithDUP = obj => { return scaleColor(obj.dup, colorDUP, maxDUPVote) }
const colorWithInd = obj => { return scaleColor(obj.other, colorInd, maxIndVote) }
const colorWithSDLP = obj => { return scaleColor(obj.sdlp, colorSDLP, maxSDLPVote) }
const colorWithSF = obj => { return scaleColor(obj.sf, colorSF, maxSFVote) }
const colorWithUUP = obj => { return scaleColor(obj.uup, colorUUP, maxUUPVote) }
const colorWithLab = obj => { return scaleColor(obj.lab, colorLab, maxLabVote) }
const colorWithSNP = obj => { return scaleColor(obj.snp, colorSNP, maxSNPVote) }
const colorWithLD = obj => { return scaleColor(obj.ld, colorLD, maxLDVote) }
const colorWithUKIP = obj => { return scaleColor(obj.ukip, colorUKIP, maxUKIPVote) }
const colorWithGreen = obj => { return scaleColor(obj.green, colorGreen, maxGreenVote) }
const colorWithPC = obj => { return scaleColor(obj.pc, colorPC, maxPCVote) }
const colorWithElectorateSize = obj => { return scaleColor(parseInt(obj.electorate) - 50000, new THREE.Color(0xFFFFFF), 30000) }
// Height Functions
const heightToMajority = obj => {
return parseInt(obj.majority) / 3000
}
const heightToCon = obj => { return parseInt(obj.con) / 3000 }
const heightToDUP = obj => { return parseInt(obj.dup) / 3000 }
const heightToInd = obj => { return parseInt(obj.other) / 3000 }
const heightToSDLP = obj => { return parseInt(obj.sdlp) / 3000 }
const heightToSF = obj => { return parseInt(obj.sf) / 3000 }
const heightToUUP = obj => { return parseInt(obj.uup) / 3000 }
const heightToLab = obj => { return parseInt(obj.lab) / 3000 }
const heightToSNP = obj => { return parseInt(obj.snp) / 3000 }
const heightToLD = obj => { return parseInt(obj.ld) / 3000 }
const heightToUKIP = obj => { return parseInt(obj.ukip) / 3000 }
const heightToGreen = obj => { return parseInt(obj.green) / 3000 }
const heightToPC = obj => { return parseInt(obj.pc) / 3000 }
const heightToElectorate = obj => { return parseInt(obj.electorate) / 3000 }
const generateOpacity = obj => { return 0.5 }
const hoverCallback = (hexObjectUserData) => {
$("#ons_id_label").text(hexObjectUserData.ons_id);
$("#ons_id_label").text(hexObjectUserData.ons_id)
$("#ons_region_id_label").text(hexObjectUserData.ons_region_id)
$("#constituency_name_label").text(hexObjectUserData.constituency_name)
$("#county_name_label").text(hexObjectUserData.county_name)
$("#region_name_label").text(hexObjectUserData.region_name)
$("#country_name_label").text(hexObjectUserData.country_name)
$("#constituency_type_label").text(hexObjectUserData.constituency_type)
$("#declaration_time_label").text(hexObjectUserData.declaration_time)
$("#result_label").text(hexObjectUserData.result)
$("#first_party_label").text(hexObjectUserData.first_party)
$("#second_party_label").text(hexObjectUserData.second_party)
$("#electorate_label").text(hexObjectUserData.electorate)
$("#valid_votes_label").text(hexObjectUserData.valid_votes)
$("#invalid_votes_label").text(hexObjectUserData.invalid_votes)
$("#majority_label").text(hexObjectUserData.majority)
$("#con_label").text(hexObjectUserData.con)
$("#lab_label").text(hexObjectUserData.lab)
$("#ld_label").text(hexObjectUserData.ld)
$("#ukip_label").text(hexObjectUserData.ukip)
$("#green_label").text(hexObjectUserData.green)
$("#snp_label").text(hexObjectUserData.snp)
$("#pc_label").text(hexObjectUserData.pc)
$("#dup_label").text(hexObjectUserData.dup)
$("#sf_label").text(hexObjectUserData.sf)
$("#sdlp_label").text(hexObjectUserData.sdlp)
$("#uup_label").text(hexObjectUserData.uup)
$("#alliance_label").text(hexObjectUserData.alliance)
$("#other_label").text(hexObjectUserData.other)
}
// Layout Functions
const mapPosition = obj => {
return { x: obj.originX, y: obj.originY }
}
const rectanglePosition = obj => {
return { x: obj.sortOrder % 25 * 2 - 25, y: obj.sortOrder / 25 * 2 - 25 }
}
const explodePosition = obj => {
return { x: obj.originX * 20, y: obj.originY * 20 }
}
const partySortOrder = party => {
switch(party) {
case "Con": return 0;
case "DUP": return 8;
case "Ind": return 7;
case "SDLP": return 4;
case "SF": return 5;
case "UUP": return 6;
case "Lab": return 1;
case "SNP": return 3;
case "LD": return 2;
case "UKIP": return 9;
case "Green": return 10;
case "PC": return 11;
case "Spk": return 12;
default: return -1;
}
}
const sortByParty = R.sortWith([
R.descend(obj => partySortOrder(R.path(["userData", "first_party"])(obj))),
R.descend(R.compose(x => parseInt(x), R.path(["userData", "majority"])))
]);
const showAlways = obj => true
const showGains = obj => {
if(obj.userData.result.includes("gain")) {
return true
} else {
return false
}
}
generateHexMap(data, colorWithParty, heightToMajority, generateOpacity, hoverCallback, "white")
function setActive(id) {
$(".active").removeClass("active")
$(id).addClass("active")
}
$("#home").click(function () {
setActive("#nav-summary")
animateTo(colorWithParty, heightToMajority, mapPosition, null, showAlways)
});
$("#summary").click(function () {
setActive("#nav-summary")
animateTo(colorWithParty, heightToMajority, mapPosition, null, showAlways)
});
$('#colorCon').click(function () {
setActive("#nav-by-party")
animateTo(colorWithCon, heightToCon, mapPosition, null, showAlways)
})
$('#colorDUP').click(function () {
setActive("#nav-by-party")
animateTo(colorWithDUP, heightToDUP, mapPosition, null, showAlways)
})
$('#colorInd').click(function () {
setActive("#nav-by-party")
animateTo(colorWithInd, heightToInd, mapPosition, null, showAlways)
})
$('#colorSDLP').click(function () {
setActive("#nav-by-party")
animateTo(colorWithSDLP, heightToSDLP, mapPosition, null, showAlways)
})
$('#colorSF').click(function () {
setActive("#nav-by-party")
animateTo(colorWithSF, heightToSF, mapPosition, null, showAlways)
})
$('#colorUUP').click(function () {
setActive("#nav-by-party")
animateTo(colorWithUUP, heightToUUP, mapPosition, null, showAlways)
})
$('#colorLab').click(function () {
setActive("#nav-by-party")
animateTo(colorWithLab, heightToLab, mapPosition, null, showAlways)
})
$('#colorSNP').click(function () {
setActive("#nav-by-party")
animateTo(colorWithSNP, heightToSNP, mapPosition, null, showAlways)
})
$('#colorLD').click(function () {
setActive("#nav-by-party")
animateTo(colorWithLD, heightToLD, mapPosition, null, showAlways)
})
$('#colorUKIP').click(function () {
setActive("#nav-by-party")
animateTo(colorWithUKIP, heightToUKIP, mapPosition, null, showAlways)
})
$('#colorGreen').click(function () {
setActive("#nav-by-party")
animateTo(colorWithGreen, heightToGreen, mapPosition, null, showAlways)
})
$('#colorPC').click(function () {
setActive("#nav-by-party")
animateTo(colorWithPC, heightToPC, mapPosition, null, showAlways)
})
$('#rectangle').click(function () {
setActive("#nav-rectangle")
animateTo(colorWithParty, heightToMajority, rectanglePosition, sortByParty, showAlways)
})
$('#explode').click(function () {
setActive("#nav-explode")
animateTo(colorWithParty, heightToMajority, explodePosition, null, showAlways)
})
$('#gains').click(function () {
setActive("#nav-gains")
animateTo(colorWithParty, heightToMajority, mapPosition, null, showGains)
})
$('#electorate').click(function () {
setActive("#nav-electorate")
animateTo(colorWithElectorateSize, heightToElectorate, mapPosition, null, showAlways)
})
</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-99095105-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>