Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Relayout after node delete (Read 947 times)
cbucher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Sep 7th, 2010
Relayout after node delete
Sep 9th, 2010 at 5:14pm
Print Post  
I have an application that starts with the many nodes (100-500) being layout (anneal). The user can click nodes to hide them (visible = false) with the corresponding links. This creates large open areas in the layout. Is there a way to relayout the view to condense it with only the visible nodes and links?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Relayout after node delete
Reply #1 - Sep 10th, 2010 at 9:17am
Print Post  
Try running Arrange again as below. You might play with InitialTemperature, Stages and IterationsPerStage parameters to find better balance between filling the empty space and preserving the existing arrangement, so that user's mental image of the diagram is preserved.

Code
Select All
diagram.NodeDoubleClicked += (s, e) =>
{
	e.Node.Visible = false;
	foreach (DiagramLink link in e.Node.GetAllLinks())
		link.Visible = false;

	var layout = AnnealLayout();
	layout.Randomize = false;
	layout.InitialTemperature /= 2;
	layout.Stages = 1;
	layout.Arrange(diagram);
	diagram.ResizeToFitItems(0);
}; 



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