Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Created June 10, 2013 22:18
Show Gist options
  • Select an option

  • Save aaronj1335/5752917 to your computer and use it in GitHub Desktop.

Select an option

Save aaronj1335/5752917 to your computer and use it in GitHub Desktop.
var node = svg.selectAll('circle.node')
.data(nodes)
.enter().append('svg:circle')
.attr('class', 'node')
.attr('cx', function(d) { return d.x; })
.attr('cy', function(d) { return d.y; })
.attr('r', 8)
.style('fill', function(d, i) { return fill(i & 3); })
.style('stroke', function(d, i) { return d3.rgb(fill(i & 3)).darker(2); })
.style('stroke-width', 1.5)
.on('mousedown', function() {
console.log('starting layout');
force.resume();
})
.on('mouseup', function() {
console.log('stopping layout');
force.stop();
})
.call(force.drag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment