How can I make a custom Layout?


The DiagramLayout in GoXam is not very suitable for a large amout of nodes and links,especially the ForceDirectedLayout.Follow is my illustration:

As you see in the graph, the nodes overlapped,and the effect of display is not good.
So I want to use my Custom Layout with my layout algorithm,so implement the DiagramLayout and rewrite the function DOLayout(); but it didn’t work;
Can any one help me ?


When you have a graph that is tightly interconnected, you may need to relax the parameters of the ForceDirectedLayout. That means decreasing the edge spring stiffness and increasing the spring length and vertex electrical charge.

If you still want to write your own custom layout, I can help you. I assume you have looked at the custom layout samples.


I tried the way you told me,and the effect is better than before.But the layouts that GoXam owns are only five,So If our customers want to get the layout that it does not exsit in the GoXam,we need to Custom our own layout to satisfy their need.
:grin:Walter,I need you help.


I guess the first question is whether the layout(s) that you want to define will be derived from an existing layout class or whether you will create them entirely by deriving from the DiagramLayout class.

The second question is whether you want to make use of GenericNetwork and Edge and Vertex classes, so that you can save state on and manipulate vertexes as an abstraction of Nodes and edges as an abstraction of Links. Or whether, like GridLayout, the layout is simple enough and not involving links that you do not need to use a Network composed of Vertexes and Edges.

I do recommend that you search the samples for classes inheriting either from DiagramLayout or from an existing layout such as TreeLayout.


how should i use GenericNetwork Class for getting subnets.??