Skip to content

Instantly share code, notes, and snippets.

@jefferydutra
Created June 10, 2015 12:18
Show Gist options
  • Save jefferydutra/9db9806a79f8d89e8aee to your computer and use it in GitHub Desktop.
Save jefferydutra/9db9806a79f8d89e8aee to your computer and use it in GitHub Desktop.
First d3 stuff
var margin = {
top: 20,
right: 40,
bottom: 20,
left: 150
};
var height = 600 - margin.top - margin.bottom - 5;
var width = 1000 - margin.right - margin.left - 5;
var dataset = [5, 10, 15, 20, 35];
var svg = d3.select('svg')
.attr('width', width)
.attr('height', height);
console.info(dataset);
var circles = svg
.selectAll('circle')
.data(dataset)
.enter()
.append('circle');
circles.attr('cx', function(d, i) {
return (i * 84) + 25;
})
.attr('cy', height / 2)
.attr('r', function(d) {
return d;
})
.attr('fill', 'yellow')
.attr('stroke', 'orange');
{"description":"First d3 stuff","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"circles":{"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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment