Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Layouting misbehaviour (Read 6672 times)
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Layouting misbehaviour
Apr 15th, 2009 at 9:31am
Print Post  
Hi !

I am facing a very big problem in layouting, the diagram nodes are not rendered as expected. Here is what I do:

1. On Pageload, I invoke a http request which returns me an XML with a list of nodes and links.

2. First, I parse these Nodes on the SL client, and create all the ShapeNodes one by one and add them to the diagram Nodes collection

3. Then I parse the Links on the SL client, and create all the Links one by one and add them to the diagram Links collection. The links are created between the shapenodes created on step 2.

4. After all the nodes and links are added, I call one of the layouting algorithm to render the diagram layout like this:
     ILayout layout = new MindFusion.Diagramming.Silverlight.Layout.TreeLayout();
(layout as TreeLayout).Type = TreeLayoutType.Radial;
layout.Arrange(graphCanvas);
graphCanvas.ResizeToFitItems(0, true);

5. When the diagram comes on the screen, it looks all messed up and overlapped etc.

What could be the problem  ???, any help please?
I have a urgent requirement to fix this issue.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #1 - Apr 15th, 2009 at 11:02am
Print Post  
Do your nodes and links form a tree?
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #2 - Apr 15th, 2009 at 11:51am
Print Post  
Yes they do have.
Infact, If I add the Nodes and their corresponding links simultaneously, the layouting is perfect.
For eg if I have 4 nodes N1..N4,
Then I add N1, and N2,
add a link from N2<-N1,
add Node N3
add a link from N2<-N3, N3->N1
add Node N4
add a link from N4<-N3

It looks fine. But If I add all the nodes to the diagram N1 to N4, then add the links in the end, it gets messed up.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #3 - Apr 15th, 2009 at 12:51pm
Print Post  
It's not a tree if a node has two parents (as N2). In that case TreeLayout would arrange only a spanning tree of the graph, and ignore the links that are not part of the tree. Since a graph can have many different spanning trees, and it depends on the order of the nodes and links collections which tree is found, you get different results for the different ways the items are added. For arranging arbitrary graphs better use LayeredLayout. If you prefer radial layout, you could call Route on the links that are not part of the graph's spanning tree after applying TreeLayout.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #4 - Apr 15th, 2009 at 2:02pm
Print Post  
Actually it might still be considered a tree if you use the IgnoreLinkDirection option, as long as there are no cycles in the graph.

Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #5 - Apr 15th, 2009 at 2:09pm
Print Post  
Thanks - I am really worried. When my diagram has plenty of nodes (more than say 10 or so), the layouting are misbehaving badly, when I sweitch from one to another based on a dropdown I have in the UI on whose selection I change the layout arrangement of the diagram.

Where do I use this IgnoreLinkDirection option?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #6 - Apr 15th, 2009 at 2:15pm
Print Post  
It's a property of TreeLayout.
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #7 - Apr 15th, 2009 at 2:23pm
Print Post  
If I use this option, all the nodes are overlapping one each other and there is no link built between them at all.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #8 - Apr 15th, 2009 at 2:25pm
Print Post  
When IgnoreLinkDirection is enabled, the algorithm cannot find a root node for the tree automatically, so you should explicitly set TreeLayout.Root.
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #9 - Apr 24th, 2009 at 3:37pm
Print Post  
Hi Stoyan,

Is there anyway you can help me display cyclic display of 3 nodes in tree layout correctly. Any properties settings etc?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #10 - Apr 26th, 2009 at 1:36pm
Print Post  
TreeLayout was designed to arrange trees and cannot process graphs with cycles. Try LayeredLayout or AnnealLayout to arrange arbitrary graphs.

Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #11 - Apr 27th, 2009 at 6:15am
Print Post  
Yes I understand the design and surely agree with the functionality. But what I am looking for is, Is there a way where I can know using some properites of the diagram or anyother object by which I can determine that this arrangement is not a TREE and would not be suitable for viewing in the treelayout, so that I can default the arrangment to Layered or Spring layout.

Regatds,
Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouting misbehaviour
Reply #12 - Apr 27th, 2009 at 9:27am
Print Post  
There's an internal PathFinder method you could use to detect cycles. We'll make it public for the 1.0.3 release.

Regards,
Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Layouting misbehaviour
Reply #13 - Apr 27th, 2009 at 10:06am
Print Post  
Thanks Stoyan.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint