-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (150 loc) · 6.03 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Senate Grapher</title>
<link rel='shortcut icon' type='image/png' href='./favicon.png' />
<style>
* {
font-family:sans-serif;
}
body {
padding: 0;
margin: 0;
}
a {
color: #FFF;
text-decoration: underline;
}
.top-header {
background-color: #A03232;
}
.settings {
background-color: #EAC492;
}
.navigation {
padding: 10px;
}
.page-title {
color: #FFF;
padding: 10px;
margin: 0;
display: block;
font-size: 2em;
font-weight: bold;
}
.tooltip {
float: right;
display: inline-block;
position: relative;
padding: 16px;
margin: 0;
text-decoration: underline;
font-weight: bold;
font-size: 1.2em;
color: #FFF;
}
.tooltip-text {
visibility: hidden;
opacity: 0;
transition: opacity 0.3s;
width: 500px;
background-color: rgba(160,50,50,0.9);
color: #FFF;
font-weight: normal;
border-radius: 0px 0px 10px 10px;
padding: 8px;
position: absolute;
z-index: 1;
top: 100%;
right: 10%;
}
.tooltip:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
.settings-text {
color: #000;
font-size: 1.2em;
font-weight: bold;
padding: 10px;
margin: 0;
display: block;
}
#scale-choice-wrapper {
padding: 5px;
border-radius: 20px;
border: 1px solid black;
font-size: 0.8em;
font-weight: normal;
}
#race-chooser {
font-size: 0.8em;
}
#chart-container {
padding-left: 20px;
padding-right: 20px;
}
#election-blurb {
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 0px;
}
#count_to_jump_to {
width: 5em;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2"></script>
</head>
<body>
<div class="top-header">
<span class="tooltip">Credits
<span class="tooltip-text">
<b>SenateGrapher credits</b>
<ul>
<li><b>Code</b>: Written by Gus Evans and Xavier Cooney, and licensed under the <a href="https://github.com/GusEvans/SenateGrapher/blob/main/LICENSE">MIT License</a>.</li>
<li><b>Graphing library</b>: <a href="https://www.chartjs.org">Chart.js</a> (with <a href="https://chartjs-plugin-datalabels.netlify.app">chartjs-plugin-datalabels</a>), licensed under the <a href="https://github.com/chartjs/Chart.js/blob/master/LICENSE.md">MIT </a><a href="https://github.com/chartjs/chartjs-plugin-datalabels/blob/master/LICENSE.md">License</a>.</li>
<li><b>Election data</b>: From the <a href="https://www.aec.gov.au">Australian Electoral Commission</a>'s online <a href="https://results.aec.gov.au">Tally Room</a>, licensed under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0</a>.</li>
<li><b>Party colours</b>: From the <a href="https://en.wikipedia.org/wiki/Template:Australian_politics/party_colours">English Wikipedia</a>, licensed under <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0</a>.</li>
</ul>
<a href="https://github.com/GusEvans/SenateGrapher">View the code online</a>
</span>
</span>
<span class="tooltip">How to use
<span class="tooltip-text">
<b>How to use SenateGrapher</b><br><br>
SenateGrapher is a program for graphing the distribution of preferences in Australian Senate elections. Select an election from the dropdown menu, and step through the process with the "Next Count" and "Previous Count" buttons. You can also use the arrow keys.<br><br>
On each count, votes are distributed between candidates based on voter preferences, either from candidates in last place being excluded, or as surplus votes from candidates who have successfully reached the quota (marked by the dotted line).<br><br>
Hover the mouse over a candidate's bar to see their party and how many votes they have. You can switch between a linear and logarithmic scale to make some of the bars easier to see.
</span>
</span>
<span class="page-title">SenateGrapher</span>
</div>
<div class="settings">
<span class="settings-text">
Election: <select id="race-chooser"></select>
Settings: <span id="scale-choice-wrapper">
<label>
Linear <input type="radio" id="scale-linear" name="scale-choice" value="linear" checked>
</label>
<label style="margin-left: 20px">
Logarithmic <input type="radio" id="scale-logarithmic" name="scale-choice" value="logarithmic">
</label>
</span>
</span>
</div>
<div id="election-blurb"></div>
<div class="navigation">
<button type="button" id="backwards">Previous Count</button>
<button type="button" id="advance">Next Count</button>
<button type="button" id="jump_to_count">Jump to count:</button>
<input type="number" id="count_to_jump_to" value="1" min="1" max="9999">
</div>
<div id="chart-container">
<canvas id="vote-chart"></canvas>
</div>
<script src="senate_graph.js"></script>
</body>
</html>