Dear Friends,
If the forces are such that there isn’t enough room for some (or all) of the nodes, then some nodes might overlap. The force-directed algorithm doesn’t guarantee that there won’t be overlap, although it’s unlikely for most graphs.
Hai,
By default GoLayoutForceDirected.ElectricalCharge returns 150.0f. You could try returning larger values.
Thanks
Hai,
As I said originally, the force-directed algorithm does not guarantee that nodes might not overlap.
Is there any other algorithm available to draw a digram without overlapping
Layered-digraph and tree always avoid overlapping the nodes that they lay out.
I have the same problem. I am using the Tree and nodes do in fact overlap.
I am also a bit unsure of all the different types of graphs.
The various GoLayout classes are just responsible for moving nodes around in a document. Some of them also route the links connecting the nodes. It appears that you are not using GoLayout, but the very simple tree-like layout used by the FamilyTree sample.
Thanks for the quick reply.
GoDocument.Bounds is just a combination of GoDocument.TopLeft and GoDocument.Size. Just do:
How will that affect the code you gave me about snapping to grid?
GoSelection sel = new GoSelection(null);
sel.AddRange(this.view.Document);
SizeF size = new SizeF(0, 1);
this.view.MoveSelection(sel, size, true);
There is also no GoView.DocExtentCenter property in version 2.5.2.
If you could tell me whether or not my company qualifies for a free upgrade I could just use 2.6.2 and get the new license.The behavior you see is when the document is smaller than the view, the view, like Notepad and Word and other applications, naturally positions everything at the top or at the top-left. You can change that behavior in 2.6 by setting GoView.SheetStyle to GoViewSheetStyle.Sheet (or any value other than None), even if there’s no GoView.Sheet.
Yes, the snap-to-grid feature is supposed to work on each node, separately.
Again, thanks for the prompt reply.
- Save all of the X/Y coordinates of all of the nodes that remain in the tree in my database.
- Then I call a method called CleanUp() that calls a modified reload method from the GenDB class.
- Within the CleanUp() method I call GoDocument.Clear(), GoDocument.InitNodes(), GoView.UpdateScrollbars() and finally GoView.RescaleWithCenter().