|
<!DOCTYPE html> |
|
<meta charset="utf-8"> |
|
<style> |
|
|
|
|
|
<head> |
|
<title>Fall 2014 University of Toronto Grading Data</title> |
|
</head> |
|
|
|
body { |
|
font: 10px sans-serif; |
|
} |
|
|
|
.axis path, |
|
.axis line { |
|
fill: none; |
|
stroke: #000; |
|
shape-rendering: crispEdges; |
|
} |
|
|
|
.dot { |
|
stroke: #000; |
|
} |
|
|
|
</style> |
|
<body> |
|
<script src="http://d3js.org/d3.v3.min.js"></script> |
|
<script> |
|
|
|
var margin = {top: 20, right: 20, bottom: 30, left: 40}, |
|
width = 960 - margin.left - margin.right, |
|
height = 500 - margin.top - margin.bottom; |
|
|
|
|
|
// var xScale = d3.time.scale() |
|
// .domain([new Date(dataset[0][0].time),d3.time.day.offset(new Date(dataset[0][dataset[0].length-1].time),8)]) |
|
// .rangeRound([0, w-padding.left-padding.right]); |
|
|
|
// var x = d3.scale.linear() |
|
// .range([0, width]); |
|
|
|
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 radius = d3.scale.linear() |
|
.range([0, 0.5 * height]) |
|
|
|
var color = d3.scale.category10(); |
|
|
|
// var tip = d3.tip() |
|
// .attr('class', 'd3-tip') |
|
// .offset([-10, 10]) |
|
// .html(function(d) { |
|
// return "<strong>Uploaded:</strong> <span style='color:red'>" + d.UploadedPages + "</span>"; |
|
// }) |
|
|
|
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 + ")"); |
|
|
|
// d3.tsv("wdata_full.tsv", function(error, data) { |
|
// data.forEach(function(d) { |
|
// d.Velocity = +d.Velocity; |
|
// d.SentDate = +d.SentDate; |
|
// }); |
|
|
|
|
|
d3.tsv("qdata_full.tsv", function(error, data) { |
|
data.forEach(function(d) { |
|
d.SentDate = parseDate(d.SentDate); |
|
d.ReturnInterval = +d.ReturnInterval; |
|
d.UploadedPages = + d.UploadedPages |
|
}); |
|
|
|
x.domain(d3.extent(data, function(d) { return d.SentDate; })).nice(); |
|
y.domain(d3.extent(data, function(d) { return d.ReturnInterval; })).nice(); |
|
radius.domain(d3.extent(data, function(d) { return d.UploadedPages; })).nice(); |
|
|
|
// Define x axis |
|
|
|
svg.append("g") |
|
.attr("class", "x axis") |
|
.attr("transform", "translate(0," + height + ")") |
|
.call(xAxis) |
|
.append("text") |
|
.attr("class", "label") |
|
.attr("x", width) |
|
.attr("y", -6) |
|
.style("text-anchor", "end") |
|
.text("Sent Date (Day of Year)"); |
|
|
|
// Define y axis |
|
|
|
|
|
svg.append("g") |
|
.attr("class", "y axis") |
|
.call(yAxis) |
|
.append("text") |
|
.attr("class", "label") |
|
.attr("transform", "rotate(-90)") |
|
.attr("y", 6) |
|
.attr("dy", ".71em") |
|
.style("text-anchor", "end") |
|
.text("Return (days)") |
|
|
|
|
|
// //Define dots of data on the grid |
|
|
|
// svg.selectAll(".dot") |
|
// .data(data) |
|
// .enter().append("circle") |
|
// .attr("class", "dot") |
|
// .attr("r", function(d) {return Math.sqrt(radius(d.UploadedPages)); }) |
|
// // .attr("r", 3.5) |
|
// .attr("cx", function(d) { return x(d.SentDate); }) |
|
// .attr("cy", function(d) { return y(d.ReturnInterval); }) |
|
// .style("fill", function(d) { return color(d.Course); }) |
|
// .append("svg:title") |
|
// .text(function(d){ return " " + d.Course + "\n " + d.Slug + "\n " + d.UploadedPages + " " + "pages" + "\n " +d.ReturnInterval + " " + "days"}); |
|
// // .text(function(d) { return "Slug:" + d.Slug ;}) |
|
|
|
|
|
|
|
//Define dots of data on the grid |
|
|
|
svg.selectAll(".dot") |
|
.data(data) |
|
.enter().append("circle") |
|
.attr("class", "dot") |
|
.attr("r", function(d) {return Math.sqrt(radius(d.UploadedPages)); }) |
|
// .attr("r", 3.5) |
|
.attr("cx", function(d) { return x(d.SentDate); }) |
|
.attr("cy", function(d) { return y(d.ReturnInterval); }) |
|
.style("fill", function(d) { return color(d.Course); }) |
|
.append("svg:title") |
|
.text(function(d){ return " " + d.Course + "\n " + d.Slug + "\n " + d.UploadedPages + " " + "pages" + "\n " +d.ReturnInterval + " " + "days"}); |
|
// .text(function(d) { return "Slug:" + d.Slug ;}) |
|
|
|
|
|
// svg.selectAll(".dot") |
|
// .data(data) |
|
// .enter().append("circle") |
|
// .attr("class", "dot") |
|
// .attr("r", 5) |
|
// .attr("cx", function(d) { return x(d.SentDate); }) |
|
// .attr("cy", function(d) { return y(d.ReturnInterval); }) |
|
// .style("fill", function(d) { return color(d.Course); }); |
|
|
|
|
|
var legend = svg.selectAll(".legend") |
|
.data(color.domain()) |
|
.enter().append("g") |
|
.attr("class", "legend") |
|
.attr("transform", function(d, i) { return "translate(0," + i * 20 + ")"; }); |
|
|
|
legend.append("rect") |
|
.attr("x", width - 18) |
|
.attr("width", 18) |
|
.attr("height", 18) |
|
.style("fill", color); |
|
|
|
legend.append("text") |
|
.attr("x", width - 24) |
|
.attr("y", 9) |
|
.attr("dy", ".35em") |
|
.style("text-anchor", "end") |
|
.text(function(d) { return d; }); |
|
|
|
}); |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<h1> Grading Performance Visualizations </h1> |
|
<h2> |
|
<a href="index.html">Grading Velocity vs. Day of Year</a><br> |
|
<a href="return.html">Return Inteval vs. Day of Year</a><br> |
|
<a href="uploaded.html">Uploaded Pages vs. Day of Year</a><br> |
|
</h2> |
|
|