Draw a directed graph using Sfdiagram

Is there a way to position the nodes without specifying offset?

I want to draw a workflow( which is a directed graph). Is there a way to just specify the nodes and connectors between nodes using SourceNodeID and TargetNodeID and draw the graph without positioning the nodes myself?


3 Replies 1 reply marked as answer

DT Deepa Thiruppathy Syncfusion Team June 17, 2022 09:04 AM UTC

Hi Ragul,


Requirement: How to position the nodes automatically without setting positions to the nodes.


You can arrange and positioning the nodes by initialising the Layout to diagram.


Code snippet:


//Initialize layout Manager to arrange and position the nodes automatically.

diagram.LayoutManager = new LayoutManager()

{

    Layout = new DirectedTreeLayout()

    {

        HorizontalSpacing = 70,

        VerticalSpacing = 50,

        Orientation = TreeOrientation.TopToBottom,

        Type = LayoutType.Hierarchical,

        AvoidSegmentOverlapping = false,

    },

};


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/LayoutWithoutDataSource642218023


Marked as answer

RA Ragul June 20, 2022 06:44 PM UTC

I get this error if I run the so

FileLoadException: Could not load file or assembly 'Syncfusion.Licensing, Version=16.3400.0.21, Culture=neutral, PublicKeyToken=632609b4d040f6b4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)




DT Deepa Thiruppathy Syncfusion Team June 21, 2022 06:28 AM UTC

Hi Ragul,


We have changed the sample to 16.3.0.21 version. Please use this sample and if issue is still reproducing, please share video representation of the issue with us.


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/LayoutWithoutDataSourceModified1336898836


Loader.
Up arrow icon