-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdvp.html
353 lines (325 loc) · 20.5 KB
/
gdvp.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Geographic Distribution of Voting Power</title>
<link rel="stylesheet" href="./gdvp.css" type="text/css">
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<!-- Header -->
<header class="header">
<!-- Info -->
<div id="gdvp-info"><h4 id="gdvp-info-text">Overall Relative Voting Power</h4></div>
<div class="header-container">
<!-- Buttons -->
<a class="button button-main gdvp-header" id="button-back" href="./index">Home</a>
<a class="button button-main gdvp-header" id="gdvp-explanation" onclick="popup('exp')">Explanation</a>
<!-- Tooltip Open/Close -->
<a class="button button-main gdvp-header" id="button-tooltip">Toggle Tooltip</a>
</div>
</header>
<!-- Body -->
<div class="body-container">
<!-- Map -->
<div id="gdvp-map"></div>
<!-- Tooltip -->
<div id="tooltip">
<div class="option gdvp-tooltip" id="display-state">
<button class="button button-gdvp" onclick="toggleCheckContainer()">Display Individual State(s)</button>
<a class="button" id="button-state" onclick="toggleAllStates()">Hide All</a>
<div class="tool-container" id="state-checks">
<li onclick="toggleState('Alabama')">
<input type="checkbox" class="checkbox" id="check-Alabama" checked>
<span class="check-text">Alabama</span><br>
</li>
<li onclick="toggleState('Alaska')">
<input type="checkbox" class="checkbox" id="check-Alaska" checked>
<span class="check-text">Alaska</span><br>
</li>
<li onclick="toggleState('Arizona')">
<input type="checkbox" class="checkbox" id="check-Arizona" checked>
<span class="check-text">Arizona</span><br>
</li>
<li onclick="toggleState('Arkansas')">
<input type="checkbox" class="checkbox" id="check-Arkansas" checked>
<span class="check-text">Arkansas</span><br>
</li>
<li onclick="toggleState('California')">
<input type="checkbox" class="checkbox" id="check-California" checked>
<span class="check-text">California</span><br>
</li>
<li onclick="toggleState('Colorado')">
<input type="checkbox" class="checkbox" id="check-Colorado" checked>
<span class="check-text">Colorado</span><br>
</li>
<li onclick="toggleState('Connecticut')">
<input type="checkbox" class="checkbox" id="check-Connecticut" checked>
<span class="check-text">Connecticut</span><br>
</li>
<li onclick="toggleState('Delaware')">
<input type="checkbox" class="checkbox" id="check-Delaware" checked>
<span class="check-text">Delaware</span><br>
</li>
<li onclick="toggleState('District of Columbia')">
<input type="checkbox" class="checkbox" id="check-District of Columbia" checked>
<span class="check-text">District of Columbia</span><br>
</li>
<li onclick="toggleState('Florida')">
<input type="checkbox" class="checkbox" id="check-Florida" checked>
<span class="check-text">Florida</span><br>
</li>
<li onclick="toggleState('Georgia')">
<input type="checkbox" class="checkbox" id="check-Georgia" checked>
<span class="check-text">Georgia</span><br>
</li>
<li onclick="toggleState('Hawaii')">
<input type="checkbox" class="checkbox" id="check-Hawaii" checked>
<span class="check-text">Hawaii</span><br>
</li>
<li onclick="toggleState('Idaho')">
<input type="checkbox" class="checkbox" id="check-Idaho" checked>
<span class="check-text">Idaho</span><br>
</li>
<li onclick="toggleState('Illinois')">
<input type="checkbox" class="checkbox" id="check-Illinois" checked>
<span class="check-text">Illinois</span><br>
</li>
<li onclick="toggleState('Indiana')">
<input type="checkbox" class="checkbox" id="check-Indiana" checked>
<span class="check-text">Indiana</span><br>
</li>
<li onclick="toggleState('Iowa')">
<input type="checkbox" class="checkbox" id="check-Iowa" checked>
<span class="check-text">Iowa</span><br>
</li>
<li onclick="toggleState('Kansas')">
<input type="checkbox" class="checkbox" id="check-Kansas" checked>
<span class="check-text">Kansas</span><br>
</li>
<li onclick="toggleState('Kentucky')">
<input type="checkbox" class="checkbox" id="check-Kentucky" checked>
<span class="check-text">Kentucky</span><br>
</li>
<li onclick="toggleState('Louisiana')">
<input type="checkbox" class="checkbox" id="check-Louisiana" checked>
<span class="check-text">Louisiana</span><br>
</li>
<li onclick="toggleState('Maine')">
<input type="checkbox" class="checkbox" id="check-Maine" checked>
<span class="check-text">Maine</span><br>
</li>
<li onclick="toggleState('Maryland')">
<input type="checkbox" class="checkbox" id="check-Maryland" checked>
<span class="check-text">Maryland</span><br>
</li>
<li onclick="toggleState('Massachusetts')">
<input type="checkbox" class="checkbox" id="check-Massachusetts" checked>
<span class="check-text">Massachusetts</span><br>
</li>
<li onclick="toggleState('Michigan')">
<input type="checkbox" class="checkbox" id="check-Michigan" checked>
<span class="check-text">Michigan</span><br>
</li>
<li onclick="toggleState('Minnesota')">
<input type="checkbox" class="checkbox" id="check-Minnesota" checked>
<span class="check-text">Minnesota</span><br>
</li>
<li onclick="toggleState('Mississippi')">
<input type="checkbox" class="checkbox" id="check-Mississippi" checked>
<span class="check-text">Mississippi</span><br>
</li>
<li onclick="toggleState('Missouri')">
<input type="checkbox" class="checkbox" id="check-Missouri" checked>
<span class="check-text">Missouri</span><br>
</li>
<li onclick="toggleState('Montana')">
<input type="checkbox" class="checkbox" id="check-Montana" checked>
<span class="check-text">Montana</span><br>
</li>
<li onclick="toggleState('Nebraska')">
<input type="checkbox" class="checkbox" id="check-Nebraska" checked>
<span class="check-text">Nebraska</span><br>
</li>
<li onclick="toggleState('Nevada')">
<input type="checkbox" class="checkbox" id="check-Nevada" checked>
<span class="check-text">Nevada</span><br>
</li>
<li onclick="toggleState('New Hampshire')">
<input type="checkbox" class="checkbox" id="check-New Hampshire" checked>
<span class="check-text">New Hampshire</span><br>
</li>
<li onclick="toggleState('New Jersey')">
<input type="checkbox" class="checkbox" id="check-New Jersey" checked>
<span class="check-text">New Jersey</span><br>
</li>
<li onclick="toggleState('New Mexico')">
<input type="checkbox" class="checkbox" id="check-New Mexico" checked>
<span class="check-text">New Mexico</span><br>
</li>
<li onclick="toggleState('New York')">
<input type="checkbox" class="checkbox" id="check-New York" checked>
<span class="check-text">New York</span><br>
</li>
<li onclick="toggleState('North Carolina')">
<input type="checkbox" class="checkbox" id="check-North Carolina" checked>
<span class="check-text">North Carolina</span><br>
</li>
<li onclick="toggleState('North Dakota')">
<input type="checkbox" class="checkbox" id="check-North Dakota" checked>
<span class="check-text">North Dakota</span><br>
</li>
<li onclick="toggleState('Ohio')">
<input type="checkbox" class="checkbox" id="check-Ohio" checked>
<span class="check-text">Ohio</span><br>
</li>
<li onclick="toggleState('Oklahoma')">
<input type="checkbox" class="checkbox" id="check-Oklahoma" checked>
<span class="check-text">Oklahoma</span><br>
</li>
<li onclick="toggleState('Oregon')">
<input type="checkbox" class="checkbox" id="check-Oregon" checked>
<span class="check-text">Oregon</span><br>
</li>
<li onclick="toggleState('Pennsylvania')">
<input type="checkbox" class="checkbox" id="check-Pennsylvania" checked>
<span class="check-text">Pennsylvania</span><br>
</li>
<li onclick="toggleState('Rhode Island')">
<input type="checkbox" class="checkbox" id="check-Rhode Island" checked>
<span class="check-text">Rhode Island</span><br>
</li>
<li onclick="toggleState('South Carolina')">
<input type="checkbox" class="checkbox" id="check-South Carolina" checked>
<span class="check-text">South Carolina</span><br>
</li>
<li onclick="toggleState('South Dakota')">
<input type="checkbox" class="checkbox" id="check-South Dakota" checked>
<span class="check-text">South Dakota</span><br>
</li>
<li onclick="toggleState('Tennessee')">
<input type="checkbox" class="checkbox" id="check-Tennessee" checked>
<span class="check-text">Tennessee</span><br>
</li>
<li onclick="toggleState('Texas')">
<input type="checkbox" class="checkbox" id="check-Texas" checked>
<span class="check-text">Texas</span><br>
</li>
<li onclick="toggleState('Utah')">
<input type="checkbox" class="checkbox" id="check-Utah" checked>
<span class="check-text">Utah</span><br>
</li>
<li onclick="toggleState('Vermont')">
<input type="checkbox" class="checkbox" id="check-Vermont" checked>
<span class="check-text">Vermont</span><br>
</li>
<li onclick="toggleState('Virginia')">
<input type="checkbox" class="checkbox" id="check-Virginia" checked>
<span class="check-text">Virginia</span><br>
</li>
<li onclick="toggleState('Washington')">
<input type="checkbox" class="checkbox" id="check-Washington" checked>
<span class="check-text">Washington</span><br>
</li>
<li onclick="toggleState('West Virginia')">
<input type="checkbox" class="checkbox" id="check-West Virginia" checked>
<span class="check-text">West Virginia</span><br>
</li>
<li onclick="toggleState('Wisconsin')">
<input type="checkbox" class="checkbox" id="check-Wisconsin" checked>
<span class="check-text">Wisconsin</span><br>
</li>
<li onclick="toggleState('Wyoming')">
<input type="checkbox" class="checkbox" id="check-Wyoming" checked>
<span class="check-text">Wyoming</span><br>
</li>
</div>
</div>
<div class="option gdvp-tooltip" id="display-field">
<button class="button button-gdvp" onclick="toggleFieldContainer()">Change Display Field</button>
<div class="tool-container" id="field-container">
<h3>Individual Voting Power</h3>
<li onclick="changeField('rawUtility')">
<input type="checkbox" class="checkbox circle" id="rawUtility" checked>
<span class="check-text">Overall Voting Power</span><br>
</li>
<li onclick="changeField('h_rawMargin_avg')">
<input type="checkbox" class="checkbox circle" id="h_rawMargin_avg">
<span class="check-text">Average House Margin</span><br>
</li>
<li onclick="changeField('s_rawMargin_avg')">
<input type="checkbox" class="checkbox circle" id="s_rawMargin_avg">
<span class="check-text">Average Senate Margin</span><br>
</li>
<li onclick="changeField('p_rawMargin_avg')">
<input type="checkbox" class="checkbox circle" id="p_rawMargin_avg">
<span class="check-text">Average Presidential Margin</span><br>
</li>
<h3>Proportional Voting Power</h3>
<li onclick="changeField('decUtility')">
<input type="checkbox" class="checkbox circle" id="decUtility">
<span class="check-text">Overall Voting Power</span><br>
</li>
<li onclick="changeField('h_decMargin_avg')">
<input type="checkbox" class="checkbox circle" id="h_decMargin_avg">
<span class="check-text">Average House Margin</span><br>
</li>
<li onclick="changeField('s_decMargin_avg')">
<input type="checkbox" class="checkbox circle" id="s_decMargin_avg">
<span class="check-text">Average Senate Margin</span><br>
</li>
<li onclick="changeField('p_decMargin_avg')">
<input type="checkbox" class="checkbox circle" id="p_decMargin_avg">
<span class="check-text">Average Presidential Margin</span><br>
</li>
<h3>Other</h3>
<li onclick="changeField('changes')">
<input type="checkbox" class="checkbox circle" id="changes">
<span class="check-text">Number of Times Redistricted</span><br>
</li>
</div>
</div>
<div class="option gdvp-tooltip">
<button class="button button-gdvp" id="set-scheme" onclick="setScheme()">Set Colors to Monochrome</button>
</div>
</div>
</div>
<div class="popup-container" id="exp-container">
<div class="barrier" id="exp-barrier", onclick="popup('exp')"></div>
<div class="popup-main popup-text" id="exp-main">
<h2>Where do Votes Matter Most?</h2>
<h3>
Your voting power depends which elections you can vote in. In the United States, where you live determines which
elections those are. This map models how voting power in federal elections has been geographically distributed
since 1999.
</h3>
<h3>
The polygons represent areas that were in different congressional districts at some time. They were created by
overlaying every congressional district map implemented since 1999. Voting data were then geocoded so that for each
polygon, it is possible to see the outcome of every federal election in which someone who lived in that area would
have been able to vote.
</h3>
<h3>
The "Overall Voting Power" fields are modeled utility values that represent total voting power. They are derived
from the average margins in House, Senate, and Presidential elections. Both <b>raw (# of votes)</b> and
<b>proportional (% of votes)</b> average margins for all three types of elections can be seen on this map.
You can also see how redistricting affected the map by looking at which district each polygon was in at which time.
</h3>
<h3>
This project's <a href="https://github.com/joelsalzman/Voting-Power/">GitHub repository</a> contains a more detailed
explanation of the methodology, a summary of the results, and the code involved in the analysis.
</h3>
</div>
</div>
<!-- Load the JavaScript -->
<script src="./gdvp.js"></script>
<script src="./popup.js"></script>
</body>
</html>