Skip to content

Instantly share code, notes, and snippets.

@bjorngi
Last active Jan 13, 2016
Embed
What would you like to do?
spoonman
{"description":"spoonman","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"thumbnail":"http://i.imgur.com/NrUHWki.png"}
var data = [55, 44, 30, 23, 17, 14, 16, 25, 41, 61, 85,
101, 95, 105, 114, 150, 180, 210, 125, 100, 71,
75, 72, 67, 99, 72, 25, 72, 26, 71, 66, 19, 7, 42, 53];
var barWidth = 10;
var barPadding = 3;
var width = 500;
var height = 400;
var chartGroup = d3.selectAll('svg')
.attr({
width: width,
height: height
})
.append('g');
chartGroup.selectAll('rect')
.data(data)
.enter()
.append('rect')
.attr("class", "bar")
.attr('width', barWidth)
.attr('height', function(d, i) {
return(d);
})
.attr('x', function(d, i) {
return i * (barWidth + barPadding);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment