Created
July 25, 2015 10:31
-
-
Save junkwhinger/0bf01eb6bad614dc7857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<head><h1>The Hacking Team: Top Receiver</h1></head> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis { | |
font: 11px sans-serif; | |
} | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
.bar { | |
fill: steelblue; | |
} | |
.barText { | |
fill: black; | |
} | |
</style> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
<script> | |
var margin = {top: 20, right: 150, bottom: 30, left: 180}, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var percent = d3.format("0.2%"); | |
var x = d3.scale.linear() | |
.range([0, width]); | |
var y = d3.scale.ordinal() | |
.rangeRoundBands([0, height], .1); | |
var xAxis = d3.svg.axis() | |
.scale(x) | |
.orient("bottom"); | |
var yAxis = d3.svg.axis() | |
.scale(y) | |
.orient("left"); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.top + margin.bottom) | |
.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
var status_dic = { | |
'[email protected]':'Chief of HT Singapore Representative', | |
'[email protected]':'Client', | |
'[email protected]':'Client', | |
'[email protected]':'Client', | |
'[email protected]':'Client', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Chief Technology Officer', | |
'[email protected]':'Operations Manager', | |
'[email protected]':'CEO', | |
'[email protected]':'Sales Manager', | |
'[email protected]':'Key Account Manager', | |
'[email protected]':'QA Manager', | |
'[email protected]':'The Licensing System', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Senior Security Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Security Engineer', | |
'[email protected]':'Senior Security Consultant', | |
'[email protected]':'Chief Operation Officer', | |
'[email protected]':'Chief Information Officer', | |
'[email protected]':'Financial Controller', | |
'[email protected]':'Software Developer', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]': 'Software Developer', | |
'[email protected]':'Software Developer', | |
'[email protected]':'Key Account Manager', | |
'[email protected]':'VP Business Development', | |
'[email protected]':'Software Developer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Software Development Manager', | |
'[email protected]':'Senior Security Engineer', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Senior Security Engineer', | |
'[email protected]':'Financial Controller', | |
'[email protected]':'undisclosed', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Financial Controller', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Senior Security Engineer', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Administrative Support', | |
'[email protected]':'Administrative Support', | |
'[email protected]':'Field Application Engineer', | |
'[email protected]':'Senior Security Engineer', | |
'[email protected]':'Software Developer', | |
'[email protected]':'Key Account Manager', | |
'[email protected]':'Key Account Manager', | |
'[email protected]':'Senior Software Developer', | |
'[email protected]':'Key Account Manager' | |
} | |
d3.csv("receiver_frequency.csv", type, function(error, data) { | |
if (error) throw error; | |
y.domain(data.map(function(d) { return d.receiver; })); | |
x.domain([0, d3.max(data, function(d) { return d.freq; })]); | |
svg.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(0," + height + ")") | |
.call(xAxis); | |
svg.append("g") | |
.attr("class", "y axis") | |
.call(yAxis) | |
.append("text") | |
.attr("transform", "rotate(-90)") | |
.attr("y", 6) | |
.attr("dy", ".71em") | |
.style("text-anchor", "end"); | |
svg.selectAll(".bar") | |
.data(data) | |
.enter().append("rect") | |
.attr("class", "bar") | |
.attr("y", function(d) { return y(d.receiver); }) | |
.attr("height", y.rangeBand()) | |
.attr("x", 0) | |
.attr("width", function(d) { return x(d.freq); }) | |
.on("mouseover", function(d,i) { | |
d3.select(this) | |
.style("fill", "red") | |
}) | |
.on("mouseout", function(d,i) { | |
d3.select(this) | |
.style("fill", "steelblue") | |
}); | |
svg.selectAll(".barText") | |
.data(data) | |
.enter().append("text") | |
.attr("class", "barText") | |
.attr("x", function(d) { return x(d.freq) + 10; }) | |
.attr("y", function(d) { return y(d.receiver) + y.rangeBand()/1.5; }) | |
.attr("text-anchor","start") | |
.text(function(d,i){return d.freq + " / " + status_dic[d.receiver]}); | |
}); | |
function type(d) { | |
d.freq = +d.freq; | |
return d; | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
receiver | freq | |
---|---|---|
[email protected] | 447 | |
[email protected] | 264 | |
[email protected] | 205 | |
[email protected] | 191 | |
[email protected] | 155 | |
[email protected] | 66 | |
[email protected] | 49 | |
[email protected] | 47 | |
[email protected] | 41 | |
[email protected] | 37 | |
[email protected] | 32 | |
[email protected] | 31 | |
[email protected] | 28 | |
[email protected] | 27 | |
[email protected] | 26 | |
[email protected] | 23 | |
[email protected] | 23 | |
[email protected] | 22 | |
[email protected] | 14 | |
[email protected] | 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment