-
Notifications
You must be signed in to change notification settings - Fork 0
/
compensation.html
74 lines (73 loc) · 2.69 KB
/
compensation.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="d3/d3.v3.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="visualization.css">
<title>Estimated Compensation Comparison</title>
</head>
<body>
<div id="header"><a id="home" href="index.html"><div class="circ"></div></a><a href="index.html" id="title">2012 Estimated Compensation Comparison</a></div>
<blockquote cite="http://www.newrepublic.com/article/113272/eric-schmidt-and-jared-cohenthe-new-digital-ages-futurist-schlock"><p>"[The digital revolution] is the first that will make it possible for almost everybody to own, develop and disseminate real-time content without having to rely on intermediaries."</p>
<footer>Eric Schmidt & Jared Cohen (of Google) in <em>The New Digital Age</em></footer></blockquote>
<div id="side">
<p>
A visualization of the yearly compensation
to different employees of tech companies.
The area of the circles is proportional
to the approximate amount compensated in
2012. (citations <a href="citations.html">here</a>).
</p>
</div>
<script type="text/javascript">
d3.json("workers.json", function(workers) {
var max = 15400000;
var height = workers.length * 160;
var width = 850;
var max_radius = 120;
var rScale = d3.scale.sqrt()
.domain([0, d3.max(workers, function(d) { return d.salary; })])
.range([0, max_radius]);
var vis = d3.select("body").append("svg").attr("width", width).attr("height", height);
var circs = vis.selectAll("circle")
.data(workers)
.enter()
.append("circle")
.attr("id", function(d,i) { return "c" + i;})
circs
.attr("cy", function(d,i) { return i*150 + 40; })
.attr("cx", function(d,i) { return width/2; })
.attr("r", function(d) { return rScale(d.salary); })
.append("title")
.text(function(d) { return '$' + d.salary.toString(); });
circs.on("mouseover", function(d,i) {
d3.select("#c" + i)
.attr("stroke", "black")
.attr("stroke-width", "3");
});
circs.on("mouseout", function(d,i) {
d3.select("#c" + i)
.attr("stroke-width", "0");
});
var txt = vis.selectAll("text")
.data(workers)
.enter()
.append("text")
.text(function(d) { return d.description; })
.attr("y", function(d,i) { return i*150 + 45; })
.attr("x", function(d,i) { return width/2 + (rScale(d.salary))+20; })
.attr("class", "big");
txt.on("mouseover", function(d,i) {
d3.select("#c" + i)
.attr("stroke", "black")
.attr("stroke-width", "3");
});
txt.on("mouseout", function(d,i) {
d3.select("#c" + i)
.attr("stroke-width", "0");
});
});
</script>
</body>
</html>