Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Clustered Layout (Read 1684 times)
srinup
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Oct 8th, 2009
Clustered Layout
Oct 8th, 2009 at 6:40pm
Print Post  
Hi,

I was trying to achieve some thing similar to your example clustered layout.

I have few questions.

1. How do i make sure that the root node is at the center of the window. I tried setting it manually and use the property IgnoreLayout. It keeps the root at the center and links are messed up and then it was not looking like clusters.

2. Is there any way to set length of the link between clusters ?

3. How do i make sure that i get the same layout everytime. The layout changes everytime i reload the screen.

I am using C#2.0 and Windows forms with your professional version of FlowChart.NET

Please help me regarding this.

Thanks You
Srinu
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Clustered Layout
Reply #1 - Oct 9th, 2009 at 5:41am
Print Post  
Hi,

1. Set rootNode.LayoutTraits[SpringLayoutTraits.Frozen] = true.

2. Currently the distance between clusters is set to some hard-coded factor multiplied by NodeDistance. We can make that factor a public property in the next version of the control.

3. Set SpringLayout.RandomSeed to some constant greater than 0.

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


I love YaBB 1G - SP1!

Posts: 2
Joined: Oct 8th, 2009
Re: Clustered Layout
Reply #2 - Oct 9th, 2009 at 9:08pm
Print Post  
Thank you for the quick reply.

The following was the code i was using -

Code
Select All
SpringLayout layout = new SpringLayout();
m_diagram.DynamicLinks = true;
root.LayoutTraits[SpringLayoutTraits.Frozen] = true;
layout.Root = root;
layout.IterationCount = 500;
layout.EnableClusters = true;
layout.NodeDistance =40;
layout.RepulsionFactor = 1;
layout.MinimizeCrossings = true;
layout.Anchoring = Anchoring.Reassign;
layout.KeepGroupLayout = true;
layout.RandomSeed = 120;

m_diagram.LinkStyle = LinkStyle.Polyline ;
layout.Arrange(m_diagram);
this.m_diagram.ResizeToFitItems(5);

 



I have a refresh button on the screen,

1. Even after setting the random seed it rearranges first couple of times and then settles down to one layout. Pelase help me in this>

2. How do i make sure that the nodes never intersect with each other and other links ?

3. I need to have the root node at the center with the direct links to it around it and expand the next level links horizontally ( to the left and right of the root node).

Can you give me some pointers to achieve this ? I can send a sample diagram if you need it.

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Clustered Layout
Reply #3 - Oct 11th, 2009 at 9:30am
Print Post  
1. SpringLayout starts the physical simulation from the positions of graph nodes it finds when Arrange is called, and subsequent calls to Arrange will change the node placement further. Random numbers are used only when nodes collide, and RandomSeed is useful if you need to get the same result when starting from the same node configuration.

If you want to run the layout until it settles on some node placement, you might run Arrange in a loop until the nodes stop changing their position that much. E.g. save the positions of a few nodes before the Arrange call, and if they haven't moved more than a few millimeters after Arrange, exit the loop.

2 & 3. Try using RepulsionFactor greater than 1, or the nodes won't repulse enough. The default is 150.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint