I want some of the nodes in my force-directed layout to ignore all forces and stay in fixed positions based on an attribute of the node, while still being able to be dragged and exert repulsion on other nodes and maintain their link lines.
I thought it would be as simple as this:
force.on(tick, function() {
vis.selectAll(g.node)
.attr(transform, function(d) {
return (d.someAttribute == true) ?
translate( + d.xcoordFromAttribute + , + d.ycoordFromAttribute +) :
translate( + d.x + , + d.y + )
});
});
I have also tried to manually set the node's x and y attributes each tick, but then the links continue to float out to where the node would be if it was affected by the force.
Obviously I have a basic misunderstanding of how this is supposed to work. How can I fix nodes in a position, while keeping links and still allowing for them to be draggable?