Skip to content

Instantly share code, notes, and snippets.

@junkwhinger
Created July 20, 2015 14:47
Show Gist options
  • Save junkwhinger/6fc3d96e7e841fbdb857 to your computer and use it in GitHub Desktop.
Save junkwhinger/6fc3d96e7e841fbdb857 to your computer and use it in GitHub Desktop.
date freq
2011-07-10 1
2011-09-20 3
2011-12-20 3
2011-12-23 2
2012-01-16 7
2012-01-17 4
2012-01-18 42
2012-01-19 6
2012-01-20 4
2012-01-26 3
2012-01-27 7
2012-02-01 7
2012-02-02 4
2012-02-06 3
2012-02-14 5
2012-02-22 1
2012-02-23 3
2012-02-24 1
2012-02-27 1
2012-02-29 1
2012-03-05 3
2012-03-06 1
2012-04-04 3
2012-04-10 1
2012-04-11 2
2012-04-12 3
2012-04-16 1
2012-04-17 1
2012-04-23 2
2012-04-26 7
2012-05-01 1
2012-05-02 2
2012-05-03 3
2012-05-07 1
2012-05-08 4
2012-05-09 1
2012-05-10 3
2012-05-11 2
2012-05-14 9
2012-05-15 13
2012-05-16 3
2012-05-17 2
2012-05-20 1
2012-05-21 1
2012-05-22 1
2012-05-24 1
2012-06-04 1
2012-06-07 1
2012-06-15 2
2012-06-18 2
2012-06-19 1
2012-06-21 2
2012-06-26 1
2012-07-04 1
2012-07-17 4
2012-07-19 2
2012-07-23 1
2012-07-24 3
2012-07-31 35
2012-08-03 7
2012-08-10 1
2012-08-27 1
2012-08-30 10
2012-08-31 2
2012-09-03 4
2012-09-07 13
2012-09-17 1
2012-11-27 1
2012-12-06 1
2013-01-29 1
2013-01-31 8
2013-02-01 3
2013-02-08 3
2013-02-14 8
2013-02-15 18
2013-02-16 2
2013-02-18 2
2013-02-19 4
2013-03-21 7
2013-03-22 2
2013-03-25 5
2013-03-26 2
2013-03-27 16
2013-03-28 1
2013-04-09 4
2013-04-12 13
2013-04-30 3
2013-05-23 1
2013-08-06 6
2013-08-07 4
2013-09-12 30
2013-09-13 10
2013-09-16 3
2013-09-17 14
2013-10-02 3
2013-10-03 2
2013-10-16 3
2013-10-17 4
2013-10-29 2
2013-11-04 1
2013-11-26 1
2013-12-30 1
2014-01-13 2
2014-01-14 2
2014-01-27 2
2014-01-28 4
2014-01-29 9
2014-02-03 2
2014-02-04 1
2014-02-06 8
2014-02-07 4
2014-02-08 2
2014-02-11 1
2014-02-18 3
2014-02-20 1
2014-02-21 6
2014-02-24 4
2014-02-25 5
2014-02-26 1
2014-03-03 5
2014-03-05 1
2014-03-06 11
2014-03-07 17
2014-03-10 19
2014-03-11 1
2014-03-14 2
2014-03-17 4
2014-03-18 2
2014-03-21 7
2014-03-22 7
2014-03-23 8
2014-03-26 11
2014-03-27 4
2014-03-28 1
2014-03-31 7
2014-04-02 2
2014-04-15 1
2014-04-17 2
2014-04-23 2
2014-04-30 3
2014-05-02 1
2014-05-21 4
2014-06-05 1
2014-06-25 8
2014-06-30 6
2014-07-16 1
2014-07-17 1
2014-07-20 1
2014-07-24 1
2014-07-28 6
2014-07-29 1
2014-07-30 1
2014-07-31 1
2014-08-27 2
2014-09-26 9
2014-10-06 1
2014-10-28 2
2014-11-01 1
2014-11-04 6
2014-11-05 2
2014-11-14 3
2014-11-15 8
2014-11-16 2
2014-11-18 4
2014-11-27 2
2014-12-01 18
2014-12-02 7
2014-12-05 7
2014-12-08 3
2014-12-09 3
2014-12-10 6
2014-12-16 2
2014-12-17 15
2014-12-18 9
2014-12-28 9
2014-12-29 3
2014-12-30 16
2014-12-31 1
2015-01-05 6
2015-01-06 2
2015-01-08 2
2015-01-14 1
2015-01-16 9
2015-01-23 5
2015-01-26 8
2015-01-27 5
2015-01-28 11
2015-01-29 6
2015-02-01 1
2015-02-08 5
2015-02-09 3
2015-02-13 8
2015-02-25 2
2015-02-26 5
2015-02-28 2
2015-03-04 7
2015-03-09 6
2015-03-10 3
2015-03-16 6
2015-03-17 4
2015-03-18 2
2015-03-24 2
2015-03-30 4
2015-04-06 3
2015-04-08 1
2015-04-09 2
2015-04-10 7
2015-04-21 2
2015-05-07 4
2015-05-19 5
2015-06-04 5
2015-06-15 12
2015-06-16 37
2015-06-19 32
2015-06-23 6
2015-06-24 11
2015-06-25 11
2015-06-26 8
2015-06-27 9
2015-06-30 2
2015-07-01 14
2015-07-02 51
<!DOCTYPE html>
<meta charset="utf-8">
<head><h1>The Hacking Team: # of emails containing 'SKA'</h1></head>
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.x.axis path {
display: none;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<body><body>
<script>
var margin = {
top: 30,
right: 120,
bottom: 30,
left: 50
},
width = 900 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseDate = d3.time.format("%Y-%m-%d").parse;
var x = d3.time.scale()
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left");
var line = d3.svg.line()
.interpolate("basis")
.x(function (d) {return x(d.date);})
.y(function (d) {return y(d.freq);});
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 + ")");
d3.csv("data.csv", function(error, data) {
if (error) throw error;
data.forEach(function (d) {
d.date = parseDate(d.date);
d.freq = +d.freq;
});
x.domain(d3.extent(data, function (d) {
return d.date;
}));
y.domain(d3.extent(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")
.style("fill", "black")
.call(yAxis)
.append("text")
.attr("x", 110)
.attr("y", -5)
.attr("dy", "-.5em")
.style("text-anchor", "end")
.text("# of emails that contains 'SKA'");
svg.append("path")
.datum(data)
.attr("class","line")
.attr("d", line);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment