-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
543 lines (487 loc) · 18.7 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
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
537
538
539
540
541
542
543
<!doctype html>
<html>
<head>
<title>Gallery - Multiclass Density Maps </title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/solid.css" integrity="sha384-VGP9aw4WtGH/uPAOseYxZ+Vz/vaTb1ehm1bwx92Fm8dTrE+3boLfF1SpAtB1z7HW"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/brands.css" integrity="sha384-rf1bqOAj3+pw6NqYrtaE1/4Se2NBwkIfeYbsFdtiR6TQz0acWiwJbv1IM/Nt/ite"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/fontawesome.css" integrity="sha384-1rquJLNOM3ijoueaaeS5m+McXPJCGdr5HcA03/VHXxcp2kX2sUrQDmFc3jR5i/C7"
crossorigin="anonymous">
<style>
@media (min-width: 1400px) {
.container {
max-width: 1340px;
}
}
.card {
margin: 10px 0;
}
.card-body {
padding: 0.5rem;
}
.mdm {
text-align: center;
}
.map {
display: inline-block;
}
.legend {
display: inline-block;
}
pre {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
background: #eee;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href=".">
<img src="logo.png" width="30" height="30" class="d-inline-block align-top" alt="Multiclass Density Map Logo">
Multiclass Density Map Gallery
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="https://jaeminjo.github.io/Multiclass-Density-Map-Editor/" target="_blank">
<i class="fas fa-edit"></i> Editor</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="https://ieeexplore.ieee.org/abstract/document/8440817/" target="_blank">
<i class="fas fa-file"></i> Paper</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="https://github.com/e-/Multiclass-Density-Maps" target="_blank">
<i class="fab fa-github"></i> Github</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container pt-4">
<section id="gallery" class="row">
</section>
</div>
<script src="dist/multiclass-density-maps.js" type="text/javascript" charset="utf-8"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="
crossorigin="anonymous"></script>
<script>
$(function () {
var $gallery = $('#gallery')
var canvasCount = 0;
function SVG() {
return document.createElementNS('http://www.w3.org/2000/svg', 'svg')
}
function render(title, spec, wide, width, height, timeN) {
var
$wrapper = $('<div></div>').attr('class', wide ? 'col-lg-12' : 'col-lg-4').appendTo($gallery),
$card = $('<div class="card"></div>').appendTo($wrapper),
$title = $('<h5 class="card-header"></h5>').html(title).appendTo($card),
$body = $('<div class="card-body"></div>').appendTo($card),
$mdm = $('<div class="mdm">').appendTo($body),
$desc = $('<p class="card-text">').html('').appendTo($body),
$pre = $('<code>').css('display', 'none').appendTo($body),
$code = $('<pre>').appendTo($pre).text(JSON.stringify(spec, null, 2)),
$buttonGroup = $('<div class="btn-group w-100" role="group">').appendTo($body),
$button = $('<button class="btn btn-light w-75">').text('Toggle MDM Specification').appendTo($buttonGroup),
$editor = $('<a class="btn btn-primary w-25" target="_blank" role="button">').html('Edit <i class="fas fa-external-link-alt"></i>').appendTo($buttonGroup)
;
$button.click(function () {
$pre.toggle();
})
$editor.attr('href', 'https://jaeminjo.github.io/Multiclass-Density-Map-Editor/?spec=' + btoa(JSON.stringify(spec)))
var config = new MDM.Config(spec);
config.load('data').then(function () {
var interp = new MDM.Interpreter(config);
var start = +new Date();
interp.interpret();
interp.render($mdm.get(0));
var end = +new Date();
console.log(title, 'took ', (end - start), 'ms')
});
}
window.render = render;
render('Linear Color Scale',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "max"
}
});
render('Log Color Scale',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "max",
},
"rescale": {
"type": "log"
}
});
render('EquiDepth Color Scale',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "max",
},
"rescale": {
"type": "equidepth",
"levels": 3
}
});
render('EquiDepth Color Scale Small Multiples',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "separate"
},
"rescale": {
"type": "equidepth",
"levels": 4
}
});
render('Square Weaving',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "weaving",
"shape": "square"
}
});
render('Random Square Weaving',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "weaving",
"shape": "square",
"random": true
}
});
render('Hexagonal Weaving',
{
"description": "multivariate normal data",
"data": { "url": "mn_data.json" },
"compose": {
"mix": "weaving",
"shape": "hex"
}
});
render('Random Trianglular Weaving',
{
"data": { "url": "mn_data.json" },
"compose": {
"mix": "weaving",
"shape": "tri",
"random": true
},
"rescale": {
"type": "equidepth"
}
});
render('Rectangular Rebinning + Punchcard',
{
"data": { "url": "mn_data.json" },
"rebin": {
"type": "square",
"size": 32
},
"compose": {
"mix": "glyph",
"glyphSpec": {
"template": "punchcard"
}
}
});
render('Voronoi Tiling',
{
"data": { "url": "mn_data.json" },
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "weaving",
"shape": "random",
"size": 4
}
});
render('Voronoi Tiling + Dot Densities',
{
"data": { "url": "mn_data.json" },
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "dotdensity",
"size": 4
}
});
render('Voronoi Tiling Multiplicative', {
"data": { "url": "mn_data.json" },
"reencoding": {
"color": {
"field": "z",
"type": "nominal",
"scale": {
"range0": ["White", "White", "White", "White"],
"range1": ["Blue", "Orange", "Red", "Green"]
}
}
},
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "blend",
"blending": "multiplicative"
}
});
render('Voronoi Tiling + Prop. Lines',
{
"data": { "url": "mn_data.json" },
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "propline",
"size": 4,
"widthprop": 'percent',
"colprop": true
}
});
render('Voronoi Tiling + Hatching',
{
"data": { "url": "mn_data.json" },
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "hatching",
"size": 2,
"widthprop": 1,
"colprop": false
}
});
render('Voronoi Tiling + Bars', {
"data": { "url": "mn_data.json" },
"smooth": {},
"rebin": {
"type": "voronoi",
"size": 32,
"stroke": "black"
},
"compose": {
"mix": "glyph",
"glyphSpec": {
"template": "bars",
"width": 20,
"height": 20
}
}
});
render('Time multiplexing', {
"data": { "url": "mn_data.json" },
"compose": {
"mix": "time"
}
});
render('Linear Color Scale (color remapping)', {
"data": { "url": "mn_data.json" },
"compose": {
"mix": "max"
}
});
render('Census Data', {
"data": { "url": "census.snappy_data.json" },
"compose": {
"mix": "mean",
},
"rescale": {
"type": "log"
}
}, true);
render('Census Data (Class Reordered and Renamed)', {
"data": {
"url": "census.snappy_data.json"
},
"style": {
"classes": [
{
"name": "w",
"alias": "White",
"color0": "White",
"color1": "Blue"
},
{
"name": "h",
"alias": "Hispanic",
"color0": "White",
"color1": "Orange"
},
{
"name": "a",
"alias": "Asian",
"color0": "White",
"color1": "Red"
},
{
"name": "b",
"alias": "Black",
"color0": "White",
"color1": "Green"
},
{
"name": "o",
"alias": "Other",
"color0": "White",
"color1": "Brown"
},
],
"scale": {
"type": "log"
}
},
"assembly": {
"mix": "mean",
}
}, true);
render('Census Data Smoothed', {
"data": { "url": "census.snappy_data.json" },
"smooth": { "radius": 1 },
"compose": {
"mix": "mean"
},
"rescale": {
"type": "log"
}
}, true);
render('Census Data Random Weaving', {
"description": "US Census Synthetic people",
"data": { "url": "census.snappy_data.json" },
"rebin": {
"type": "topojson",
"url": "us.json",
"feature": "states",
"stroke": "rgba(0,0,0,0.25)"
},
"compose": {
"mix": "weaving",
"shape": "random",
"size": 4
},
"rescale": {
"type": "cbrt"
}
}, true);
render('Census Data Weaving', {
"description": "US Census Synthetic people",
"data": { "url": "census.snappy_data.json" },
"rebin": {
"type": "topojson",
"url": "us.json",
"feature": "states",
"stroke": "grey"
},
"compose": {
"mix": "weaving",
"shape": "square",
"size": 4
},
"rescale": {
"type": "cbrt"
}
}, true);
render('Census Data Choropleth', {
"description": "US Census Synthetic people",
"data": { "url": "census.snappy_data.json" },
"rebin": {
"type": "topojson",
"url": "us.json",
"feature": "states",
"stroke": "white"
},
"compose": {
"mix": "mean",
"size": 2
},
"rescale": {
"type": "cbrt"
}
}, true);
render('Census Data Multiplicative Choropleth', {
"description": "US Census Synthetic people",
"data": { "url": "census.snappy_data.json" },
"rebin": {
"type": "topojson",
"url": "us.json",
"feature": "counties",
"stroke": "rgba(255,255,255,0.1)"
},
"compose": {
"mix": "blend",
"blending": "multiplicative"
},
"rescale": {
"type": "log"
}
}, true);
/* render('Census Data Contour', {
"description": "US Census Synthetic people",
"data": { "url": "census.snappy_data.json" },
"reencoding": {
"label": {
"field": "z",
"type": "nominal",
"scale": {
"domain": ["w", "h", "a", "b", "o"],
"range": ["White", "Hispanic", "Asian", "Black", "Other"]
}
},
"color": {
"field": "z",
"type": "nominal",
"scale": {
"range": ["Blue", "Orange", "Red", "Green", "Brown"]
}
}
},
"rebin": {
"type": "topojson",
"url": "us.json",
"feature": "states",
"stroke": "grey"
},
"rescale": {
"type": "cbrt"
},
"contour": {
"stroke": 5,
"lineWidth": 1,
"blur": 1
}
}, true);
*/
})
</script>
</body>
</html>