Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) scatter the boxes in chart (Read 16717 times)
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
scatter the boxes in chart
May 27th, 2007 at 1:33pm
Print Post  
Hi,

I am trying to use a layout and to scatter the non-attached boxes around. Meaning - boxes that have no arrows should be scattered in space.
When I use FlowLayout or SpringLayout - all the boxes are ordered in a horizontal line.
This causes a problem - when I have 1000 boxes, I get a long line instead of a square surface with the boxes in it.
Is there a layout that can scatter the boxes evenly? Or at least in a way that may look randomly?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #1 - May 27th, 2007 at 6:12pm
Print Post  
Hi,

At this time all layout classes, except the new AnnealLayout, process each connected graph in the diagram separately from the others. In the end, all such graphs are placed one next to the other horizontally. So you might try using the AnnealLayout, or you can scatter the unconnected nodes yourself using the setBounds method after applying any of the other layouts.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #2 - May 28th, 2007 at 6:48am
Print Post  
I was looking for API or documentation on AnnealLayout but couldn't find any.
Is there a code example how to use it?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #3 - May 28th, 2007 at 10:55am
Print Post  
Hi,

You can find some documentation on AnnealLayout in this preview version of JDiagram 1.2:

https://mindfusion.org/_temp/JDiagramTrial.zip

I will post a code example in awhile.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #4 - May 28th, 2007 at 11:47am
Print Post  
Here is some sample code:

Code
Select All
AnnealLayout layout = new AnnealLayout();
layout.setIterationsPerStage(50);
layout.setStages(15);
layout.setInitialTemperature(40f);
layout.setTemperatureScale(0.75f);
layout.arrange(fc);

fc.repaint();
 



You might have to run more iterations and cooling stages when there are more nodes in the graph. Starting from a higher initial temperature will help the algorithm find a low-cost configuration much faster, but it introduces a lot of randomness. Starting from a low temperature will yield results closer to the initial configuration of the graph.

We forgot to call repaint() at the end of AnnealLayout.Arrange(), so you will need to call it yourself. We'll fix this in the official release.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #5 - May 28th, 2007 at 12:07pm
Print Post  
It has a nice scattering!  Cheesy
I'll research it more on later tests.

Thanks!
Yoav
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #6 - May 30th, 2007 at 1:12pm
Print Post  
Hi,

I used the default values as you wrote here. I'm using a really simple diagram: 5 pairs of boxes, each pair connected from one to another.
When I use the Anneal (to create a scatter), I seem to be getting these problems:
1. Boxes still overlap.
2. There is a really large empty space between each pair. No matter how I chage the parameter - they don't seem to get closer.
See link:
http://albums.tapuz.co.il/Albums/getImage.asp?a=1248443&b=0&c=124844320075301883...

Do you have any suggestion for me?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #7 - May 30th, 2007 at 3:04pm
Print Post  
Hi,

1. You could assign a smaller value to ArrowLengthFactor (default is 0.25) and slightly larger DistributionFactor (default is 40000). Though I guess the best is our developer to change the algorithm, so that it considers the nodes' sizes and not only their positions, when calculating distances.

2. A large BoundaryFactor should make the algorithm choose configurations in which the nodes are placed closer to each other towards the center of the layout area. Or you could call setLayoutArea to choose a smaller region in which the nodes are distributed.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #8 - May 31st, 2007 at 5:29am
Print Post  
Hi,

I'm sorry, by I don't seem to find these parameters... 
ArrowLengthFactor - do you mean maybe ArrowsCompactFactor? If not - where do I find it?
The same for DistributionFactor and BoundaryFactor  - I don't find these parameters in FlowChart or in AnnealLayout. Where can I find them?

Thanks,
Yoav
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #9 - May 31st, 2007 at 5:48am
Print Post  
Sorry, my mistake - I looked are LayeredLayout....  Undecided
I'll check these out.

Thanks!
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #10 - May 31st, 2007 at 6:25am
Print Post  
I've created a small program that draws a simple diagram (5 pairs of boxes, each pair connected from one to another). It has a panel with slider that control the different parameters of Anneal Layout: Stages, Iter. per stage, Init. temp., Temp. scale, Arrow length factor, Dist. factor, Boundary factor.
I played with the settings a lot. The diagram does change all the time - but I don't see any big changes between the parameters. No parameter seems to help - the distribution and overlap of boxes seems like random - sometimes I have it aometimes I don't.
I've tried changing the Arrow length and Distribuition factors - still I get overlaps.
See here: [url]http://albums.tapuz.co.il/Albums/getImage.asp?a=1248443&b=0&c=12484432007531112357.jpg&d=87.-14.-13.-11.-7.-11.-11.-12.-13.-15.-15.-8.-10.-12.-14.-14.-14.-13.-12.-10.-8.-17.43.49.40.111[/url]
The same when I test higher Boundary factor - the position changes all the time but they don't get any nearer or further.
Suggestions?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #11 - May 31st, 2007 at 7:58am
Print Post  
Hi,

I get similar layouts by setting

layout.setLayoutArea(fc.getDocBounds());

and changing the arrow length factor to 0.01:



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: scatter the boxes in chart
Reply #12 - May 31st, 2007 at 8:02am
Print Post  
And calling layout.setBoundaryFactor(100000); does a good job on moving the nodes closer one to another:



Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #13 - May 31st, 2007 at 11:15am
Print Post  
It looks much better.
I'll check it more in the next week.

Thanks!
Yoav
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: scatter the boxes in chart
Reply #14 - Jun 11th, 2007 at 7:50am
Print Post  
I have discovered something interesting in the Anneal layout.
It seems that if I run it several times on the same chart, on each iteration the layout becomes less and less scattered. After too many re-layouting (about 5-6 of them) they become so close that arrows start to cross over each other.
Do you know the reason for this behaviour?
Is it possible to imitate it in the Anneal Layout?

Thanks,
Yoav
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint