D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
DataBeast03
Full window
Github gist
Planets
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> <svg> </svg> <body> <script> var height = 600; var width = 100; var svg = d3.select('svg'); for(var i = 0; i < 1500; i++){ width = Math.random() *900; var data = { x: Math.random() * width, y: Math.random() * height, radius: Math.random() * 9 + 1, width:width }; svg.append('circle') .datum(data); } console.log(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')) </script> </body>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js