[ Launch: First d3 stuff ] 9db9806a79f8d89e8aee by jefferydutra
-
-
Save jefferydutra/9db9806a79f8d89e8aee to your computer and use it in GitHub Desktop.
First d3 stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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