-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
236 lines (206 loc) · 5.49 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
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
<!DOCTYPE html>
<html>
<head>
<title>China Migrants Visualisation Experiments</title>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.12.0/mapbox-gl.css' rel='stylesheet' />
<style>
@import url(force.css);
body {
margin: 0;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
#map {
position: absolute;
width: 100%;
height: 100%;
}
svg {
position: absolute;
width: 100%;
height: 100%;
}
.mapboxgl-marker {
width: 25px;
height: 25px;
border-radius: 50%;
border: 1px solid gray;
background-color: lightblue;
}
#legend {
display: hidden;
position: fixed;
bottom: 30px;
left: 10px;
margin-top: 10px;
margin-left: 10px;
z-index: 1000;
font-family: "Open Sans", sans-serif;
width: fit-content;
overflow: auto;
min-height: 160px;
background: white;
padding: 5px;
border: 3px solid black;
}
#legend dl dd {
display: inline;
margin: 0;
}
#legend dl dd:after {
display: block;
content: '';
}
#legend dl dt {
height: 10px;
width: 10px;
border-radius: 50%;
display: inline-block;
}
#controls {
position: fixed;
bottom: 10px;
left: 10px;
margin-top: 10px;
margin-left: 10px;
z-index: 1000;
font-family: "Open Sans", sans-serif;
width: 640px;
height: 160px;
background: white;
padding: 10px;
text-align: center;
border: 3px solid black;
}
#controls input {
display: block;
}
#yearrange {
position: fixed;
margin-top: 10px;
margin-left: 10px;
z-index: 1000;
font-family: "Open Sans", sans-serif;
width: 320px;
height: 160px;
background: white;
padding: 10px;
text-align: center;
border: 3px solid black;
}
#yearrange select {
text-align: center;
text-align-last: center;
-moz-text-align-last: center;
margin-bottom: 2px;
}
#yearselect {
position: fixed;
margin-top: 10px;
margin-left: 60px;
z-index: 1000;
}
.row0,
.row1,
.row2 {
text-align: center;
}
.row1 {
padding: 0 10px;
}
.row0 {
padding: 0 10px;
}
.row1.company {
border-bottom: 2px solid blue;
}
.row1.person {
border-bottom: 2px solid green;
}
.row1.location {
border-bottom: 2px solid orange;
}
.row2 {
padding: 0 10px 10px 10px;
}
.mapboxgl-popup-content {}
</style>
<script src='https://api.mapbox.com/mapbox-gl-js/v2.12.0/mapbox-gl.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/geojson/0.4.1/geojson.min.js'></script>
<script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script src="https://d3js.org/d3.v7.min.js"></script>
<!--
<script src="https://unpkg.com/d3-force-cluster@latest"></script>
-->
<script src="https://unpkg.com/d3-force-cluster@0.1.2/dist/d3-force-cluster.min.js"></script>
<script src="https://unpkg.com/netclustering@0.0.3/dist/netClustering.js"></script>
<!--
<script src="/china/demos/bilevel-edge-bundling2/netClustering.js"></script>
<script src="https://unpkg.com/force-in-a-box@1.0.1/dist/forceInABox.js"></script>
-->
<script src="https://unpkg.com/@seregpie/bron-kerbosch"></script>
<script src="forceInABox.js"></script>
</head>
<body>
<div id="yearrange">
<form id="filters" onchange="formChange()">
<span id="year" onmouseover='document.getElementById("yearRange").focus();'>Year</span>
<input type="range" class="form-range" id="yearRange"
oninput="document.getElementById('yeareval').innerText = document.getElementById('yearRange').value" min="1842"
max="1891" value="1842" autofocus="true" />
<span id="yeareval">1842</span>
<div>
Colour by:
<select id="clusterBy">
<option value="Company">Company</option>
<option value="Location">Location</option>
<option value="Occupation">Occupation</option>
<option value="Nationality">Nationality</option>
<option value="NetworkClustering">Network Clustering</option>
<option value="BronKerborsch">Bron Kerborsch</option>
</select>
</div>
<div>
<select id="selectCompany">
<option value="na">Filter by company</option>
</select>
</div>
<div>
<select id="selectLocation">
<option value="na">Filter by location</option>
</select>
</div>
<div>
<select id="selectOccupation">
<option value="na">Filter by person's occupation</option>
</select>
</div>
<div>
<select id="selectNationality">
<option value="na">Filter by person's nationality</option>
</select>
</div>
<div>
<button onclick="document.getElementById('filters').reset()">Reset Filters</button>
</div>
</form>
</div>
<div id="legend">
</div>
<div id="map"></div>
<!--
<script type="text/javascript" src="force.js"></script>
-->
<script>
$(document).ready(function () {
var randomNum = Math.ceil(Math.random() * 999999);
var jsfile = 'force.js?v=' + randomNum;
$.getScript(jsfile, function (data, textStatus, jqxhr) { });
});
</script>
</body>
</html>