-
Notifications
You must be signed in to change notification settings - Fork 1
/
collaborator.tmpl
112 lines (89 loc) · 3.3 KB
/
collaborator.tmpl
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
<!DOCTYPE html>
<html lang="en">
<% include header.tmpl %>
<style>
text {
font: 12px sans-serif;
}
</style>
<body>
<% include navbar.tmpl %>
<script src="http://d3js.org/d3.v3.min.js"></script>
<div class="container">
<div class="row">
<div class="col-md-3">
<ul class="nav nav-pills">
<li {showingchair}><a href="collaborator.php?q=Chair">Chair</a></li>
<li {showingmember}><a href="collaborator.php?q=Member">Member</a></li>
</ul>
</div>
<div class="col-md-9">
<h4>ETD {title} Graph</h4>
<p>The size of the bubbles is based on participation
in ETDs committees. Click on the bubble to see
the list of ETDs.</p>
</div>
</div> <!-- row -->
<div class="row">
<div id="theBubbles" class="col-lg-12">
<!-- graph goes here -->
</div>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- Obtain latest version of jquery automatically -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!-- Obtain Bootstrap javascript from CDN (online service) so it doesn't have to be on my machine -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- http://bl.ocks.org/mbostock/4063269#index.html -->
<script>
var diameter = 960,
format = d3.format(",d"),
color = d3.scale.category20c();
var bubble = d3.layout.pack()
.sort(null)
.size([diameter, diameter])
.padding(1.5);
var svg = d3.select("#theBubbles").append("svg")
.attr("width", diameter)
.attr("height", diameter)
.attr("class", "bubble");
d3.json("{file}", function(error, root) {
var node = svg.selectAll(".node")
.data(bubble.nodes(classes(root))
.filter(function(d) { return !d.children; }))
.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
node.append("title")
.text(function(d) { return d.className + ": " + format(d.value); });
node.append("circle")
.attr("r", function(d) { return d.r; })
.style("fill", function(d) { return color(d.packageName); });
node.append("text")
.attr("dy", ".3em")
.style("text-anchor", "middle")
.text(function(d) { return d.className.substring(0, d.r / 3); });
node.on("click", function (d) {
window.open("advisor.php?q="+d.fullName,"_self");
});
});
// Returns a flattened hierarchy containing all leaf nodes under the root.
function classes(root) {
var classes = [];
function recurse(name, node) {
if (node.children) node.children.forEach(function(child) { recurse(node.name, child); });
else classes.push({packageName: name,
className: node.name,
value: node.size,
fullName: node.fullName});
}
recurse(null, root);
return {children: classes};
}
d3.select(self.frameElement).style("height", diameter + "px");
</script>
</body>
</html>