RadDiagram TreeDown

3 posts, 0 answers
  1. Gregor
    Gregor avatar
    2 posts
    Member since:
    Oct 2014

    Posted 14 Oct 2014 Link to this post

    Good day,

    I'm wondering how can I fix wrong positioning (you can see how does it look right now in attached picture) of RadDiagramShapes in TreeDown? When I have like 5 nodes it works quite OK. But when i have let's say 90 nodes it becomes a mess.

    I use this code after i fill RadDiagram with shapes and after i connect them with each other.
    TreeLayoutSettings settings = new TreeLayoutSettings()
    {
        TreeLayoutType = TreeLayoutType.TreeDown,
    };
    settings.Roots.Add(rd.Shapes[0]);
      
    rd.RoutingService.Router = new OrgTreeRouter()
    {
        TreeLayoutType = TreeLayoutType.TreeDown,
        ConnectionOuterSpacing = 20,
    };
    rd.LayoutAsync(LayoutType.Tree, settings);
    rd.AutoFitAsync(new Thickness(0, 0, 0, 0), false);


    I have only one root and I have already tried with positioning root shape on some position. Also i tried to fit layout after each diagram was put on diagram.

    Thanks for your help.

    Regards,

    Gregor
  2. Gregor
    Gregor avatar
    2 posts
    Member since:
    Oct 2014

    Posted 14 Oct 2014 Link to this post

    I forgot to attach the picture.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 16 Oct 2014 Link to this post

    Hello Gregor,
    Here I'll copy/paste my answer from the support thread so that other customers with similar problems may read it:
    As far as I understand the issue is that some of the children are stretched far to the right or left is that correct ? This actually is by design - in the tree layout places every child so that there are no shapes from another branch underneath it. Unfortunately this is not easily customizable at the moment and you'll have to chose one of the workarounds:
    1) Handle the diagram's DiagramLayoutComplete event and manually move the stretched items
    2) Instead of the Layout method use save/load - first you'll need to manually layout the diagram as desired, save it to an xml/string and then whenever you want you could load it with the saved layout.
    3) Implement your own TreeDown layout. To do this you'll need a custom layout service:

    public class MyLayoutService : ILayoutService
    {
        public bool IsLayouting
        {
            get;
            private set;
        }
     
        public void Layout(LayoutType type, object settings)
        {
            this.IsLayouting = true;
            // Implement your layout here.
            this.IsLayouting = false;
        }
    }
    And then you'll have to register it to the diagram:
    this.diagram.ServiceLocator.Register<ILayoutService>(new MyLayoutService());
    I hope I was able to help.


    Regards,
    Zarko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top