Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problems using SpringLayout? (Read 3191 times)
rcruzmar
YaBB Newbies
*
Offline



Posts: 25
Location: FL
Joined: Sep 19th, 2007
Problems using SpringLayout?
Sep 28th, 2007 at 11:47am
Print Post  
Hello,

I have a question about using the layout SpringLayout, I may not be using it correctly.

Disclaimer: The images of people and related found in these sample images are not real. the phone numbers which appear are from a foriegn country and not that of any US household or business. Any similarities are coincidental.

I am developing a program which analyzes phone calls and dynamically create a graph like this one:



What I would really like is a layout like this one:



The following is the code used to create the first layout.

Code
Select All
SpringLayout sl;
sl.CreateDispatch(_T("FlowChartPro.SpringLayout"));
sl.SetArrowAnchoring(ancReassign);
sl.SetNodeDistance(300);
sl.SetEnableClusters(TRUE);
sl.SetNumIterations(1000);
sl.SetMinimizeCrossings(TRUE);
m_FlowCtrl.ArrangeDiagram(sl);
m_FlowCtrl.FitDocToObjects(5);
 



Am I missing something? I got this code by reading the API documentation as well as follow the same code from the Demo program.

I know I am close because I can dynamically generate layouts like this one:



Thanks for your help in this matter.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problems using SpringLayout?
Reply #1 - Sep 28th, 2007 at 12:28pm
Print Post  
Hi,

The SpringLayout only cares about the distances between connected nodes, and does not try to achieve any symmetry. You might run a RadialLayout when you know there is only one group (cluster) of boxes like that in the diagram.

Stoyan
  
Back to top
 
IP Logged
 
rcruzmar
YaBB Newbies
*
Offline



Posts: 25
Location: FL
Joined: Sep 19th, 2007
Re: Problems using SpringLayout?
Reply #2 - Sep 28th, 2007 at 1:41pm
Print Post  
Hi and thanks for the quick response. Grin

Your suggestion is on using RadialLayout for one cluster. Since I do know the root node of each cluster hypothetically I could then apply this (RadialLayout) to each one of the clusters or would that dramatically change the way the nodes are grouped together?

As you see in the last image some of the root nodes are linked by common nodes.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problems using SpringLayout?
Reply #3 - Sep 28th, 2007 at 3:32pm
Print Post  
Yes, probably you could run the SpringLayout once to move apart the clusters, and then run TreeLayout for each of the root nodes. You might have to set the IgnoreLayout property of the clusters' common node when running the TreeLayouts, so that the layout affects only the nodes around the root.

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



Posts: 25
Location: FL
Joined: Sep 19th, 2007
Re: Problems using SpringLayout?
Reply #4 - Sep 28th, 2007 at 6:54pm
Print Post  
Thanks for your asistance here. I will confirm that the SpringLayout is needed so the clusters can be kept separate, otherwise the graph draws all over itself. (Not very pretty)

This really helped me out. Grin You're the best! 8)

Rolando
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint