xxxxxxxxxx
<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 = 960;
var height = 500;
var svg = d3.select('svg');
for(var i = 0; i < 1389; i++) {
width = Math.random() * 1000;
var data = {
x: Math.random() * width,
y: Math.random() * height,
radius : Math.random() * 10 + 1,
width: width
};
svg.append('circle')
.datum(data);
}
// new value
width = 2000000;
// the last value
console.log(data);
svg.selectAll('circle')
.attr('cx', function(jon) {
console.log(jon);
return jon.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