-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
444 lines (386 loc) · 17.4 KB
/
index.html
File metadata and controls
444 lines (386 loc) · 17.4 KB
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
<head><meta charset="utf-8">
<!-- TITLE AND FAVICON =========================================================================================================-->
<title>what classes make up 2a?</title>
<link rel="icon" type="image/png" href="icon-v7.png">
<!--============================================================================================================================-->
<!-- CSS =======================================================================================================================-->
<!--============================================================================================================================-->
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
margin: 0;
position: absolute;
top: -12px;
width: auto;
background: #333;
color: #333;
padding: 0;
}
#title {
position: absolute;
right: 0;
margin: -5em 0 0 -10em;
width: 20em;
height: 0em;
text-align: center;
line-height: 1.4em;
}
#reset {
color: #d3cccc;
position: absolute;
text-align: absolute;
font-style: italic;
width: 100%;
text-align: center;
margin-top: 4em;
display: none;
}
.tip, .tip-deps {
z-index:1000;
text-align:left;
border-radius: 0 0.5em 0.5em 1em;
-moz-border-radius: 0 0.5em 0.5em 1em;
-webkit-border-radius: 0 0.5em 0.5em 1em;
padding: 0.2em 0.3em 0.15em 0.6em;
max-width: 50em;
color: #e3dada;
background-color: #666;
font-size: 0.8em;
pointer-events: none
-webkit-box-shadow: 0.1em 0.1em 0.2em 0.1em #555;
-moz-box-shadow: 0.1em 0.1em 0.2em 0.1em #555;
box-shadow: 0.1em 0.1em 0.2em 0.1em #555;
}
.tip-deps {
text-align: center;
-moz-border-radius: 0 0 1em 1em;
border-radius: 0 0 1em 1em;
-webkit-border-radius: 0 0 1em 1em;
height: 6em;
-webkit-box-shadow: 0 0.1em 0.1em 0.1em #555;
-moz-box-shadow: 0 0.1em 0.1em 0.1em #555;
box-shadow: 0 0.1em 0.1em 0.1em #555;
}
.arc {
stroke: #333;
stroke-width: 1;
stroke-opacity: 0.5;
fill-rule: evenodd;
cursor: pointer;
}
.course {
stroke: #d3cccc;
stroke-width: 3;
stroke-opacity: 0.4;
}
h1 {
margin: 0;
margin-bottom: 0.18em;
line-height: 0.8em;
font-size: 2.5em;
}
#deps {
overflow: hidden;
border: none;
border-top: 0.2em solid #333;
resize:none;
background: #666;
font-family: inherit;
color: #e3dada;
width: 15em;
font-size: 0.8em;
margin: 0 auto 0.9em auto;
width: 23em;
height: 3.1em;
text-align: center;
border-radius: 0 0 1em 1em;
-moz-border-radius: 0 0 1em 1em;
-webkit-border-radius: 0 0 1em 1em;
display: none;
}
#deps:focus {
outline-width: 0;
}
#course {
margin: 0;
padding: 0;
margin-bottom: 0.7em;
}
#github {
position: absolute;
top: 4px;
left: 4px;
height: 32px;
margin-top: 12px;
overflow: hidden;
}
#github a img:hover{
position: relative;
top: -32px;
}
#tracks {
position: absolute;
top: 0.7em;
margin-top: 12px;
right: 1em;
color: #d3cccc;
text-align: right;
display: none;
}
a {
color: #777;
font-size: 0.8em;
}
#email {
position: absolute;
left: 4px;
top: 44px;
color: #777;
height: auto;
}
#email a {
color: #a39999;
font-size: 1em;
line-height: 1em;
}
#email a:hover {
color: #d3cccc;
}
</style>
</head>
<!--============================================================================================================================-->
<!-- BODY HTML ================================================================================================================-->
<!--============================================================================================================================-->
<body><!DOCTYPE html>
<!-- BACKGROUND DIVS ==========================================================================================================-->
<div id="github"><a href="https://github.com/bqpd/2a-graphs" title="bqpd/2a-graphs">
<img alt="link to this project on github" src="github.png" width="32px"/></a></div>
<div id="email">feedback.<br><a href="mailto:eburn@mit.edu">how could this<br>be more useful?</a></div>
<div id="reset">click the circle to start</div>
<div id="tracks">
<p style="text-align: left; margin: 0 0 0.3em 0;"> classes that are in tracks </p>
<a id="all" href="#all" onclick="loadTrack('all');"> [all tracks combined]</a><br>
<a id="control" href="#control" onclick="loadTrack('control');"> control, instrumentation, and robotics</a><br>
<a id="sustainableglobal" href="#sustainableglobal" onclick="loadTrack('sustainableglobal');"> sustainable and global development</a><br>
<a id="management" href="#management" onclick="loadTrack('management');"> engineering management</a><br>
<a id="environmental" href="#environmental" onclick="loadTrack('environmental');"> environmental mechanics</a><br>
<a id="nanomicro" href="#nanomicro" onclick="loadTrack('nanomicro');"> nano/micro engineering</a><br>
<a id="product" href="#product" onclick="loadTrack('product');"> product development</a><br>
<a id="entrepreneurship" href="#entrepreneurship" onclick="loadTrack('entrepreneurship');"> entrepreneurship</a><br>
<a id="manufacturing" href="#manufacturing" onclick="loadTrack('manufacturing');"> manufacturing</a><br>
<a id="transportation" href="#transportation" onclick="loadTrack('transportation');"> transportation</a><br>
<a id="mechanics" href="#mechanics" onclick="loadTrack('mechanics');"> mechanics</a><br>
<a id="energy" href="#energy" onclick="loadTrack('energy');"> energy</a><br>
<a id="bio" href="#bio" onclick="loadTrack('bio');"> bio</a>
</div>
<!-- CENTER CIRCLE DIVS ====================================================================================================-->
<div id="title">
<h1>what classes make up 2A?</h1>
showing <span id="percent_shown">100.0</span>% of concentration classes</strong>
<textarea name="deps" id="deps" spellcheck="false" onkeypress="return event.keyCode != 13;"
title='<p id="course" style="margin-bottom: 0.7em">
<strong><i> enter comma-separated course names
<br></strong> (e.g., "2", "ESD", "4, mas, 11")
</p><strong> or filter with partial class names
<br></strong> (e.g., "2.00" will show 2.007 but not 2.72)'></textarea>
<i> edit the list above to search or filter
<br> click arcs to zoom in or see details
<br> click the circle to zoom out
</i>
</div>
<!--============================================================================================================================-->
<!-- JAVASCRIPT ================================================================================================================-->
<!--============================================================================================================================-->
<script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.poshytip.min.js"></script>
<script type="text/javascript" >
var colors = []; // 24 shades of rainbow, made by rotating hue while keeping saturation and value constant
for (var i = 0; i < 24; i++) { colors[i] = d3.hsl(195+i*15,0.45,0.5); };
$('#deps').val(''); // clear the area
var width = window.innerWidth,
height = window.innerHeight+12, // Set SVG height and width by initial windowsize
radius = Math.min(width, height-24) / 2.1, // make sure the circle fits
color = d3.scale.ordinal().range(colors), // use those colors!
path, percent_shown, mult,
alldeps = '1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 20, 22, 24, ESD, SP, MAS, EC', // reset state
refreshDeps = function() {
percent_shown = 0;
if (!$('#deps').val()) { setTimeout(function() { if (!$('#deps').val()) { $('#reset').css("display","inherit"); } }, 1500); }
else { $('#reset').css("display","none"); }
var value = function(d) {
mult = 0;
if (!d.children) {
deps = $('#deps').val().split(',');
for (var i = deps.length - 1; i >= 0; i--) {
dep = deps[i].replace(/ */,'').toUpperCase();
if (d.parent.id === dep.replace(/(\w{1,3})\..*/,'$1')) {
if (d.name.search(dep) === 0) { mult = 1; i = -1;}
}
}
percent_shown += d.pop*mult;
}
return d.pop * mult;
};
path.data(partition.value(value).nodes)
.transition()
.duration(1250)
.attrTween("d", arcTween)
.transition()
.duration(1000)
.attr("d", arc
.innerRadius(function(d) { return Math.sqrt(d.y); })
.outerRadius(function(d) { return Math.sqrt(d.y + d.dy); }) );
percent_shown /= 12.18;
$("#percent_shown").text(percent_shown.toFixed(1));
};
// Resize text, and move center element, based on SVG size
$('body').css("fontSize",(height/700)+'em');
document.getElementById("title").style.left = (width/2)+'px';
document.getElementById("title").style.top = (height/2)+'px';
// Create large SVG canvas
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height * .52 + ")");
// Make a partition to store values in
var partition = d3.layout.partition()
.sort(function(a,b) {return b.pop - a.pop; })
.size([2 * Math.PI, radius * radius])
.value(function(d) { return d.pop; });
// Define an arc
var arc = d3.svg.arc()
.startAngle(function(d) { return d.x; })
.endAngle(function(d) { return d.x + d.dx; })
.innerRadius(function(d) { return Math.sqrt(d.y); })
.outerRadius(function(d) { return Math.sqrt(d.y + d.dy); });
// Enter the data
d3.json("2a_concentration.json", function(error, root) {
path = svg.datum(root).selectAll("path")
.data(partition.nodes)
.enter()
.append("svg:a")
.attr('xlink:title', function(d) {
title = d.depth ? d.name : null;
if (!d.children) {
noun_ending = (d.pop === 1) ? ')' : 's)';
title += '<br>(picked by '+d.pop+' student'+noun_ending;
}
return title;
})
.attr('xlink:href', function(d) { return d.url ? d.url : null; })
.attr("target","_blank")
.classed("tooltip", function(d) { return d.depth ? true : false; })
.append("path")
.attr("d", arc)
.classed("arc",true)
.classed("course",function(d) { return d.children ? true : false; })
.style("fill", function(d) { return d.depth ? color((d.children ? d : d.parent).name) : d3.rgb("#d3cccc"); })
.each(stash);
// Add course-click
d3.selectAll(".course").on("mousedown", function(d) {
if (d.id == null) { dep = alldeps; } // reset if the center node is clicked
else { dep = d.id; }
$('#deps').val(dep); // set textbox value appropriately
location.href = "#"; // rehome location
$('#tracks a').css("color","#777").css("font-weight","inherit").css("text-decoration","underline");
refreshDeps(); // update values based on textbox contents
});
// Add textbox-filter
d3.selectAll("#deps").on("keyup", function change() {
if (false == 1 + $.inArray(d3.event.keyCode,[13,37,38,39,40])) {
// don't trigger for enter or arrow keys
location.href = "#"; // rehome location
$('#tracks a').css("color","#777").css("font-weight","inherit").css("text-decoration","underline");
refreshDeps(); // update values based on textbox contents
}
});
// Add mouseover animations
d3.selectAll(".arc").on("mouseover", function(d) {
d3.select(this).transition()
.duration(250)
.ease("circle")
.attr("d", arc
.innerRadius(function(d) { return Math.sqrt(Math.max(d.y - 0.1*d.dy*Math.pow(d.dx,-0.5),d.y-d.dy/1.2)); })
.outerRadius(function(d) { return Math.sqrt(d.y + d.dy*2); }) ); })
.on("mouseout", function(d) {
d3.select(this).transition()
.duration(375)
.ease("circle")
.attr("d", arc
.innerRadius(function(d) { return Math.sqrt(d.y); })
.outerRadius(function(d) { return Math.sqrt(d.y + d.dy); }) ); })
// setup tooltips
$('a.tooltip').poshytip({
className: 'tip',
followCursor: true,
slide: false,
showTimeout: 5,
showAniDuration: 245,
hideTimeout: 10,
hideAniDuration: 365,
alignX: 'right',
alignY: 'bottom',
offsetX: 20,
offsetY: 40 });
// make visible and focus textbox
$('#deps').css("display","inherit");
// are we somewhere in particular?
var hash = window.location.hash.substring(1);
if (hash) { loadTrack(hash); }
$('#tracks').css("display","inherit").focus();
// update values based on textbox contents
refreshDeps();
});
// Stash the old values for transition.
function stash(d) {
d.x0 = d.x;
d.dx0 = d.dx;
}
// Interpolate the arcs in data space.
function arcTween(a) {
var i = d3.interpolate({x: a.x0, dx: a.dx0}, a);
return function(t) {
var b = i(t);
a.x0 = b.x;
a.dx0 = b.dx;
return arc(b);
};
}
// Make textbox popup help
$('#deps').poshytip({
className: 'tip-deps',
showOn: 'focus',
alignTo: 'target',
alignX: 'center',
alignY: 'bottom',
offsetX: 0,
offsetY: 13,
slide: false,
showAniDuration: 125,
hideAniDuration: 375
});
var loadTrack = function(track) {
$('#deps').val(tracks[track]);
$('#tracks a').css("color","#777").css("font-weight","inherit").css("text-decoration","underline");
$('#'+track).css("color","#d3cccc").css("font-weight","700").css("text-decoration","none");
refreshDeps(); },
tracks = {
control: '2.12, 2.14, 2.017J, 2.151, 2.161, 2.673, 2.71, 2.737, 6.01, 6.02, 6.002, 6.003, 6.005, 6.034, 6.071, 6.115, 6.141J, 6.142J, 6.801, 6.S196, 16.30, 16.35, 16.410',
sustainableglobal: '1.020, 1.080, 1.107, 2.500, 2.650, 2.66J, 2.722J, SP.722, 2.813, 3.080, EC.723, EC.711, SP.775, 1.801J, 4.231J, 11.601, 14.42, 14.44, 14.74, 17.181, 12.348J, SP.721, 11.025J, EC.715, SP.718, 1.851J, 2.965J, 11.491J, 14.771, 14.772, MAS.665J, 12.348J',
management: '1.040, 2.96, 3.080, 15.053, 15.065, 15.7, 15.871, 15.872, 15.501, 15.616, 15.812, SP.784',
environmental: '1.018, 1.020, 1.061, 1.070, 1.071, 1.080, 1.084, 1.083, 1.106, 1.107, 12.003, 12.009, 12.021, 12.086, 12.102, 12.120, 12.214, 12.301, 12.306, 12.340, 12.348',
nanomicro: '2.370, 2.772J, 6.152J, 2.088J, 2.180, 2.374J, 2.391J, 2.500, 2.570, 2.60, 2.627, 2.673, 2.674, 2.71, 2.715, 2.760, 2.793',
product: '15.301, 15.812, 15.501, 15.053, 15.075, 2.72, 2.739J, 2.744, 6.071, 6.041',
entrepreneurship: 'MAS.863J, 2.96, 6.933, ESD.051, ESD.260, 1.040, 15.501, 15.812, 15.411, 15.431, 14.01, 14.02, 15.615, 15.390, ESD.251, ESD.265, 15.S24, 15.054',
manufacturing: '2.14, 2.12, 2.72, 2.750, 2.853, 2.96, 2.888, 2.370, 2.813, 6.152J, 15.075J, 15.053, 15.668, ESD.267',
transportation: '2.23, 2.28, 2.60J, 2.61, 2.612, 6.061, 6.141J, 6.142J, 6.281J, 16.682, 16.50, 16.512, 16.522, 1.010, 1.011, 1.041, 2.96, 6.01, 6.006, 6.007, 6.041, 6.046, 6.255J, 6.262, 6.264J, 15.053, 15.075, 15.501, 15.812',
mechanics: '22.002, 2.672, 2.092, 18.330, 2.016, 2.51, 18.353J, 18.354J',
energy: '2.28, 2.41, 2.42, 2.51, 2.60J, 2.61, 2.612, 2.625, 2.627, 2.650J, 2.66J, 2.67J, 2.813, 6.007, 6.061, 6.131, 10.27, 10.426, 22.05, 22.06, 1.071J',
bio: '2.184, 2.673J, 2.772, 2.791J, 2.792J, 2.793J, 2.797J, 2.750, 6.002, 6.071J, 6.115, 6.131, 6.041, 18.443',
all: '2.00, 2.12, 2.14, 2.017J, 2.151, 2.161, 2.673, 2.71, 2.737, 6.01, 6.02, 6.002, 6.003, 6.005, 6.034, 6.071, 6.115, 6.141J, 6.142J, 6.801, 6.S196, 16.30, 16.35, 16.410, 1.020, 1.080, 1.107, 2.500, 2.650, 2.66J, 2.722J, SP.722, 2.813, 3.080, EC.723, EC.711, SP.775, 1.801J, 4.231J, 11.601, 14.42, 14.44, 14.74, 17.181, 12.348J, SP.721, 11.025J, EC.715, SP.718, 1.851J, 2.965J, 11.491J, 14.771, 14.772, MAS.665J, 1.040, 2.96, 15.053, 15.065, 15.7, 15.871, 15.872, 15.501, 15.616, 15.812, 1.018, 1.061, 1.070, 1.071, 1.084, 1.083, 1.106, 12.003, 12.009, 12.021, 12.086, 12.102, 12.120, 12.214, 12.301, 12.306, 12.340, 12.348, 2.370, 2.772J, 6.152J, 2.088J, 2.180, 2.374J, 2.391J, 2.570, 2.60, 2.627, 2.674, 2.715, 2.760, 2.793, 15.301, 15.075, 2.72, 2.739J, 2.744, 6.041, MAS.863J, 6.933, ESD.051, ESD.260, 15.411, 15.431, 14.01, 14.02, 15.615, 15.390, ESD.251, ESD.265, 15.S24, 15.054, 2.750, 2.853, 2.888, 15.075J, 15.668, ESD.267, 2.23, 2.28, 2.60J, 2.61, 2.612, 6.061, 6.281J, 16.682, 16.50, 16.512, 16.522, 1.010, 1.011, 1.041, 6.006, 6.007, 6.046, 6.255J, 6.262, 6.264J, 22.002, 2.672, 2.092, 18.330, 2.016, 2.51, 18.353J, 18.354J, 2.41, 2.42, 2.625, 2.650J, 2.67J, 6.131, 10.27, 10.426, 22.05, 22.06, 1.071J, 2.184, 2.673J, 2.772, 2.791J, 2.792J, 2.793J, 2.797J, 6.071J, 18.443, SP.784'
};
</script>
</body>