Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrange diagram after adding nodes on expansion (Read 5250 times)
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Arrange diagram after adding nodes on expansion
Aug 23rd, 2007 at 8:18am
Print Post  
We are displaying physical network data (i. e. hardware (monitors, computers, switches ...) and their relations) contained in our database in a FlowChart.NET diagram. The user chooses a HW node from which to start and then explores the network by expanding HW nodes of interest.
When the user clicks the + symbol of an expandable node, our program fetches the data of the related nodes, displays those nodes and links the newly added nodes to the expanded one. Everything works fine so far.

Now we would like the network that is being displayed be arranged neatly at any time. One of the basic question hereby is where to put the new nodes when an existing node is expanded. Basically the new nodes should not overlap existing nodes and should "fit best into the rest of the diagram" (I know that this is a very squishy statement).
We tried to come up with different approaches:

A) Search the spots on our own
We find the node that is located bottom most in the diagram and add the new nodes a little below it. It works ok, but I can't claim that the results are astonishing Wink

B) Let FlowChart.NET look for appropriate spots
Here the idea was to somehow make use of your built in layout algoritm and let them do the work, instead of trying to come up with an own algorithm respectively heuristics.

B1) Always re-arrange the entire diagram after expanding a node
This works fine and when limiting the time permitted for the single algorithms offers acceptable performance. The problem with this approch however is that all the nodes are moved around after an expansion and thus the user is getting lost. Nodes that used to be in one place are moved to a totally different location by the algoritm (no blame to the algorithm!!) and so after each expand operation the user has to orient herself again. So in the end we considered this approach not to be suitable.

B2) Only re-arrange parts of the diagram after expanding a node
So we thought to not re-arrange the entire diagram after expansion, but to re-arrange only the nodes that were newly added during the expansion. Hereby we tried 2 different implementations:
a) Set the IgnoreLayout property to true for any nodes existing before the expansion actually happens and re-arrange the entire diagram after the new nodes (with IgnoreLayout set to false) have been added.
b) Call the layout algorithm's Arrange() method passing in a ChartObjectCollection containing only the nodes and arrows added during the expansion.
The issue that I noticed with this approach is that Arrange() does not seem to care about existing nodes when arranging the passed in new nodes. Result is that the new nodes are placed "on top" of existing nodes and thus the diagram becomes unreadable.

So after this lenghty introduction (I am sorry, but I wanted you to have some background info) here the question:

Can any of you think of any other way of getting nicely layouted diagrams after expanding nodes and thereby adding new ones? Is there maybe some tweak to the layout algorithms or some property that I might set to get better results?

It would be great, if you could share any experience with us.

Thanks,
Michael
  
Back to top
 
IP Logged
 
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: Arrange diagram after adding nodes on expansio
Reply #1 - Aug 23rd, 2007 at 8:21am
Print Post  
  
Back to top
 
IP Logged
 
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: Arrange diagram after adding nodes on expansio
Reply #2 - Aug 23rd, 2007 at 8:26am
Print Post  
Also, I e-mailed to Mindfusion support and as always I got a quick and excellent reply (big compliment to Mindfusion support at this point). I am posting it here. I will try their suggestions too and dare to log a feature proposal for their layout algorithms Wink
Anyway, any other help is highly appreciated.

Cheers,
Michael


Hello Michael,

You might try adding the new nodes as in your point A, and then running only a few iterations of one of the force-directed algorithms, e.g. SpringLayout or AnnealLayout. A few iterations should not displace the already arranged nodes a lot, but move the new nodes to more appropriate positions which would achieve balance in the simulated system. For this to work, set the Randomize property of the algorithm to false, and use a fixed RndSeed value.


If that does not work very well, our developers can add a new property to nodes that will make the force-directed algorithms include a node in the calculations but never move it - then you an use it to mark existing nodes as already arranged, only the new ones will be moved.

Regards,
Iva
MindFusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint