Created
May 6, 2017 20:03
-
-
Save tcash21/447044c53b5c680796f0f3eb31f1120b to your computer and use it in GitHub Desktop.
This file contains 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
d3.csv("../data/imdb.csv", function(data) { | |
dataset = data | |
}); | |
offset = 2 | |
circles = d3.select("body") | |
.append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.selectAll("circle") | |
.data(dataset) | |
.enter().append("circle") | |
function getRandomOffset() { | |
return (((Math.random() * 2 * offset) - offset) * 400); | |
} | |
dataset.forEach(d => { | |
d.cx =+ Math.abs(getRandomOffset()); | |
d.cy =+ Math.abs(getRandomOffset()); | |
d.r =+ d.score; | |
}) | |
circles.attr("r", function(d) { | |
return d.r; | |
} ).attr("cx", function(d) { | |
return d.cx; | |
}).attr("cy", function(d) { | |
return d.cy; | |
}).attr("fill", "green") | |
hrbrmstr
commented
May 6, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment