Skip to content

Instantly share code, notes, and snippets.

@ABrouwer
Created February 24, 2014 11:43
Show Gist options
  • Save ABrouwer/9186906 to your computer and use it in GitHub Desktop.
Save ABrouwer/9186906 to your computer and use it in GitHub Desktop.
Assingment 3, barchard
alert(localStorage.getItem('assignment'));
var Rawdataset = [{"events":[
{"name":"sint", "rating":3,"ficticious":false},
{"name":"dolore tempor","rating":4, "ficticious":false},
{"name":"id", "rating":4, "ficticious": true},
{"name":"est","rating":3, "ficticious":false},
{"name":"incididunt Ut", "rating":3, "ficticious": false},
{"name": "dolore aute", "rating": 1, "ficticious": false},
{"name":"veniam in", "rating": 3, "ficticious": false},
{"name": "Ut deserunt", "rating": 2, "ficticious": true},
{"name": "est ad", "rating": 2, "ficticious": true},
]}];
var dataset = [30, 40, 40, 30, 30, 10, 30, 20, 20]
var w = 500;
var h = 100;
var barPadding = 1;
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
svg.selectAll("rect")
.data(dataset)
.enter()
.append("rect")
.attr("x", function(d, i) {
return i * (w / dataset.length);
})
.attr("y", function(d) {
return h - d;
})
.attr("width", w / dataset.length - barPadding)
.attr("height", function(d) {
return d * 100;
})
.attr("fill", "teal");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment