How to avoid Node Overlapping

How do we avoid overlapping between the nodes?



In the attached fig, nodes are overlapped between each other. but i want to avoid this kind of overlapping when it is loaded from an xml file.



i am using GoXam wpf - dll version 1.2.3.3

Microsoft .Net 3.5

Are you using some kind of automatic layout (usually as the value of Diagram.Layout), or are you positioning nodes programmatically or manually (usually data-binding go:Node.Location to some data property)?

I am using Grid layout and it’s parameters are

<Layout:GridLayout CellSize=“100 30” Spacing=“0 0” Sorting=“Forward” />

For positioning the node yes we set the data binding property go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"

GridLayout is probably not what you want. You might try using ForceDirectedLayout.

Are all four white nodes members of a Group? If so, you probably want to make sure that the value of Group.Layout is the layout that you want to use. That’s in addition to whatever layout you want to use as the Diagram.Layout.

All the white nodes are members of a group. You mean to say that we need to set the Group.Layout in the Group Template and also set the Diagram.Layout as ForceDirectedLayout? Is there any example in the downloaded demo, which will show nodes are non overlapping each other?



Yes, that’s right.

There are two examples of this in the demo. Search for “go:Group.Layout”.

The Diagram.LayoutManager will make sure that the Group layouts get performed first, so that the Diagram layout can work with the updated Groups.

But note that ForceDirectedLayout does not guaratee that no nodes overlap each other. That depends on the nature of the nodes and links and forces between them. Since your nodes are relatively large you may want to increase the DefaultSpringLength. You’ll need to experiment setting the other properties too, until you get settings that work with your kinds of graphs.

Also you might try using Link.Route.Routing=“Orthogonal” instead of Routing=“AvoidsNodes”.