Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Node Distance in LayerdLayout (Read 3903 times)
KillaChris
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Apr 25th, 2012
Node Distance in LayerdLayout
Jan 21st, 2013 at 10:58am
Print Post  
Hello i have a problem with the node distance in the LayerdLayout.
I'm using Horizontal Orientation.
If there are only a few nodes everything is working allright. But if there are some more Nodes then the result looks very ugly.
My links are all AutoRoute = True
And the layout is created like this:
Code
Select All
        layeredLt.Orientation = Layout.Orientation.Horizontal
        layeredLt.NodeDistance = 15
        layeredLt.LayerDistance = 35
        layeredLt.IgnoreNodeSize = False
        layeredLt.SplitLayers = False
        layeredLt.Margins = New System.Drawing.SizeF(15, 30)
        layeredLt.Arrange(diagramm) 



Now i tried a lot of other values and other functions but I'm not able to get a better result.
As you can see in the Attachment there is a far distance between the "node groups" and because of that everything is really small.
It would be great if everything could be closer to each other, that it doesn't use that much place.
Well now i can zoom in but I have to scroll a lot and I'm not getting much information on the first view, because everything is split so far.
  

screen_002.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node Distance in LayerdLayout
Reply #1 - Jan 21st, 2013 at 2:09pm
Print Post  
Hi,

Are you using some old version of the control? I'm getting more compact results as shown below, though I'm not sure how close this is to your graph. In any case, you might try connecting all your leaf nodes to a temporary destination node to bring them closer together, and removing the temp. node after layout.

Stoyan

  
Back to top
 
IP Logged
 
KillaChris
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Apr 25th, 2012
Re: Node Distance in LayerdLayout
Reply #2 - Jan 21st, 2013 at 3:02pm
Print Post  
No I'm using the latest Version (6?).
If I set IgnoreNodeSize to true then my result is compact as well, but then some Nodes cover other Nodes.
And adding such a "Help-Node" for the leaf nodes doesn't change the result either.
It's really strange somehow the layout creates some compact blocks, but the distance between this blocks is huge.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node Distance in LayerdLayout
Reply #3 - Jan 21st, 2013 at 4:59pm
Print Post  
Could you attach here your diagram saved as XML file?
  
Back to top
 
IP Logged
 
KillaChris
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Apr 25th, 2012
Re: Node Distance in LayerdLayout
Reply #4 - Jan 22nd, 2013 at 8:09am
Print Post  
Yes. Here you are. I had to Zip the File, cause somehow .xml Extensions aren't allowed in the Forum-Attachments.
  

XmlDiag.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Node Distance in LayerdLayout
Reply #5 - Jan 22nd, 2013 at 11:45am
Print Post  
Apparently the node size processing scales the layout grid too much when the nodes are as large as yours. Our developers will try to fix this for next release. For the time being you could leave IgnoreNodeSize enabled and offset overlapping nodes yourself after applying the layout:

Code
Select All
ll.Arrange(diagram);

var layers = new Dictionary<int, List<DiagramNode>>();
foreach (var node in diagram.Nodes)
{
	if (!ll.Statistics.NodeLayerIndices.ContainsKey(node))
		continue;
	var l = ll.Statistics.NodeLayerIndices[node];
	if (!layers.ContainsKey(l))
		layers[l] = new List<DiagramNode>();
	layers[l].Add(node);
}

foreach (var layer in layers.Values)
{
	layer.Sort((n1, n2) => n1.Bounds.Y.CompareTo(n2.Bounds.Y));
	for (int i = 1; i < layer.Count; i++)
	{
		var node = layer[i];
		var prev = layer[i - 1];
		if (node.Bounds.Top <= prev.Bounds.Bottom)
			node.Move(node.Bounds.X, prev.Bounds.Bottom + 5);
	}
} 



However this might lose the centering of nodes relative to their neighbors in adjacent layers.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
KillaChris
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 18
Joined: Apr 25th, 2012
Re: Node Distance in LayerdLayout
Reply #6 - Jan 22nd, 2013 at 1:26pm
Print Post  
Okay.
Thank you very much with your workaround the result looks much better.
I hope that it'll work in the next version without that workaroud Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint