Last active
December 24, 2015 05:39
-
-
Save lpand/6752419 to your computer and use it in GitHub Desktop.
Keeps the bubbles inside the force bounds and draws text if so configured
This file contains 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
config.force.tick = function() { | |
graphChart.links.attr({ | |
x1: function(d) { return d.source.x }, | |
y1: function(d) { return d.source.y }, | |
x2: function(d) { return d.target.x }, | |
y2: function(d) { return d.target.y } }) | |
graphChart.bubbles | |
.selectAll('circle') | |
.attr({ | |
cx: function(d) { | |
return d.x = Math.max(r, Math.min(w - r, d.x)) }, | |
cy: function(d) { | |
return d.y = Math.max(r, Math.min(h - r, d.y)) } }) | |
text && text.attr({ | |
x: function(d) { return d.x }, | |
y: function(d) { return d.y } }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment