D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
kataquino
Full window
Github gist
Random Dots
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } svg { width: 100%; height: 100%; } </style> </head> <body> <svg> </svg> <script> var i = 4; var width = 500; var height = 500; var svg = d3.select('svg'); for (var i = 0; i < 2587; i++){ var data = {x : Math.random() * 848, y : Math.random() * 655, radius : Math.random() * 10 + 1 }; svg.append('circle') .datum(data); } svg.selectAll('circle') .attr('cx', function(d){ return d.x; }) .attr('cy', function(d){ return d.y; }) .attr('r', function(d){ return d.radius; }); console.log(d3.selectAll('circle')); /* .attr('cx', x) .attr('cy', y) .attr('r', radius); */ </script> </body>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js