Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SpringLayout (Read 1746 times)
Dunedan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 14
Joined: Apr 14th, 2009
SpringLayout
Aug 12th, 2009 at 2:05pm
Print Post  
Hi,

I have to display a central node and the linked node around it. So I use the SpringLayout.

It works perfectly if I set a distance of 50.
But if I increase the distance to 200, the nodes are not well displayed: a part of the nodes are staying together.
I use: SpringLayout layout = new SpringLayout(1000, 200f, false, true);

What am i doing wrong ? Should I use another layout ?

Thanks,
Fabrice.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SpringLayout
Reply #1 - Aug 12th, 2009 at 2:51pm
Print Post  
Hi,

Are the other nodes linked only to the central node? In such case use TreeLayout with Type set to Radial. Otherwise please email us a saved diagram xml file for our developer to check that.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SpringLayout
Reply #2 - Aug 13th, 2009 at 10:41am
Print Post  
Hi Fabrice,

The problem is that the NodeDistance value is applied only as a desired length of links between connected nodes. Nodes that are not connected repulse each other with a force inversely proportional to the square of the distance, and we rely on this to get some symmetry. However this force becomes much weaker than the spring force when you change from 50 to 200, and the symmetry is lost. Now there is a RepulsionFactor attribute in the class, but it wasn't applied at all. You can find a fixed version on the private messages page; it now multiples the repulsion force that factor and you can get a symmetry at larger distances like this:

Code
Select All
SpringLayout layout = new SpringLayout(1000, 200f, false, false);
layout.setRepulsionFactor(3000);
layout.setRandomSeed(10);
layout.arrange(diagram);
 



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