Keeps the bubbles inside the force bounds and draws text if so configured
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