I have some data that Im trying to plot in a specific way: all the nodes have a way to identify which group it belongs, let say position:L or position:R.
I would like to take that property into account an order all the "l" (left) nodes to be on the left of a central node and all of the "R" (right) nodes to be on the right hand side of a static central node (something similar like drawn in the picture ).
Previously Ive used this:
tick = function () {
nodes.forEach(function (n) {
if (n.position == "L") {
n.x -= force.alpha() * 80;
}
if (n.position == "R") {
n.x += force.alpha() * 80;
}
});
.... };
This solution was okay for small sets but when nodes reach a certain number, say a 1000+, it becomes a very expensive one. Ive looked at these two examples: 1st one and 2nd one and I was wondering maybe I could solve may problem with combining couple of forces on the page trying to "tear" the (static) central node apart and pulling different nodes to the sides ?
Any suggestions are welcome, thank You.