Skip to content

Instantly share code, notes, and snippets.

@aendra-rininsland
Created September 13, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aendra-rininsland/077f28bdb3d553b5b4bed91788eb1ad8 to your computer and use it in GitHub Desktop.
Save aendra-rininsland/077f28bdb3d553b5b4bed91788eb1ad8 to your computer and use it in GitHub Desktop.
d3-party
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://unpkg.com/d3-party"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
const w = 960;
const h = 500;
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", w)
.attr("height", h)
const party = d3.party(svg);
d3.selectAll('circle').data(Array(100).fill(null)).enter().append('circle')
.attr('cx', d3.randomUniform(0, w)())
.attr('cy', d3.randomUniform(0, h)())
.attr('r', d3.randomUniform(1, 100)())
.call(party);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment