Skip to content

Instantly share code, notes, and snippets.

@romsson
Last active April 28, 2019 05:28
Show Gist options
  • Save romsson/1e1cd0f8af1c2c043ff54299ce8fa13f to your computer and use it in GitHub Desktop.
Save romsson/1e1cd0f8af1c2c043ff54299ce8fa13f to your computer and use it in GitHub Desktop.
minimalistic circle grid #d3-gridding
license: mit
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v4.js"></script>
<script src="https://romsson.github.io/d3-gridding/build/d3-gridding.js"></script>
<script>
d3.select("body").append("svg")
.attr("width", 800)
.attr("height", 600)
.selectAll("circle")
.data(
d3.gridding()
.size([800, 600])
.mode("vertical")(d3.range(10))
)
.enter().append("circle")
.attr("r", 10)
.attr("transform", function(d) {
return "translate(" + d.cx + "," + d.cy + ")";
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment