Node overlap
thomakl opened this issue · comments
Hi,
I have an issue with overlapping nodes.
Every time I insert an element in the graph, I update it with graphView.update().
I am currently putting on the graph around 70 nodes in row.
Do you think the issue has something to do with the "smartgraph.properties" and the Force-directed layout ? Or graphView.updateAndWait()
could do the trick ?
NB : there are currently no edge in the graph
_Figure 1 : Node overlap_ _Figure 1 : Node overlap after I drag the top node of the stack_Thank you for you help
TL
The problem has two causes:
- you're using the automatic layout, and
- the nodes are isolated, i.e., they are not connected.
As per documentation, currently when you add a new isolated node, it will be placed in the center of the pane. Since you are adding several isolated nodes, they are all overlapping at the same coordinates. In this case, the force directed algorithm reaches an edge case and does not repulse the nodes.
When you move the top node, than the algorithm is able to kick in and, the consequence, is that all nodes are repulsed to the edge of the pane, since there are no attractive forces from edges.
I should maybe include a node arrangement strategy that uses a fixed layout, but repositions the nodes when new nodes are inserted.