Created
June 10, 2013 22:18
-
-
Save aaronj1335/5752917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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