Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Error while tree layouting (Read 3753 times)
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Error while tree layouting
Mar 30th, 2017 at 12:04pm
Print Post  
I am creating custom container using createContainerNode. it contains 4 Shape node. As you can see in below pic.

In our diagram we are having many custom nodes to show. I need to use tree layout for our custom node but not able to layout it properly please the pic below

My Code for layout :
private rearrangeDiagram(diagram: any) {
        //Apply Layout
        if (diagram != undefined) {
            var layout = new MindFusion.Graphs.TreeLayout();

            if (this.layoutDirection != undefined) {
                layout.direction = this.layoutDirection.toLowerCase().trim().toString() == "horizontal" ? MindFusion.Graphs.LayoutDirection.LeftToRight : MindFusion.Graphs.LayoutDirection.TopToBottom ;
            } else {
                //default is TopToBottom
                layout.direction = MindFusion.Graphs.LayoutDirection.TopToBottom;
            }

            layout.linkType = MindFusion.Graphs.TreeLayoutLinkType.Cascading;
            layout.levelDistance = 25;
            layout.nodeDistance = 20;
            diagram.arrange(layout);
            diagram.resizeToFitItems(50);
        }
    }
  

customnode.PNG (Attachment deleted)
customnode_error.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3380
Joined: Oct 19th, 2005
Re: Error while tree layouting
Reply #1 - Mar 30th, 2017 at 1:01pm
Print Post  
Try setting TreeLayout.keepGroupLayout = true;

You could also avoid this and similar problems by custom-drawing the container instead of attaching nodes using updated build and .d.ts from http://mindfusion.eu/Forum/YaBB.pl?num=1489662828/15#15
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Error while tree layouting
Reply #2 - Mar 30th, 2017 at 5:30pm
Print Post  
Thanks it works
Can you please let me know how can we arranges these nodes in a tree layout?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3380
Joined: Oct 19th, 2005
Re: Error while tree layouting
Reply #3 - Mar 31st, 2017 at 5:42am
Print Post  
Do you mean the ones you are showing inside container caption-bar?
  
Back to top
 
IP Logged
 
Ankur shah
Junior Member
**
Offline


I Love MindFusion!

Posts: 63
Joined: Mar 16th, 2017
Re: Error while tree layouting
Reply #4 - Mar 31st, 2017 at 7:46am
Print Post  
No i mean to we have many custom container and i need arrange all the container in to Tree lay out how can we achieve this.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3380
Joined: Oct 19th, 2005
Re: Error while tree layouting
Reply #5 - Mar 31st, 2017 at 7:54am
Print Post  
Your code above should arrange a tree of containers - only if you have links between them defining the parent-to-child relationship. If you need some automatic arrangement without drawing links between nodes, try TreeMapLayout instead, or add invisible links to define parent-to-child relations.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint