Linear Arrangement in Blazor Diagram Component

15 Dec 20221 minute to read

Linear arrangement is used to linearly arrange the child nodes in layout, which means the parent node is placed in the center corresponding to its children. When line distribution is enabled, linear arrangement is also activated by default. The Arrangement property of layout is used to enable or disable the linear arrangement in layout. By default Arrangement will be Nonlinear.

NOTE

Linear arrangement is applicable only for complex hierarchical tree layout.

The following code illustrates how to allow a linear arrangement in diagram layout.

  
protected override void OnInitialized()
{
    LayoutValue = new DiagramLayout()
        {
            Type = LayoutType.ComplexHierarchicalTree,
            HorizontalSpacing = 40,
            VerticalSpacing = 40,
            Orientation = LayoutOrientation.TopToBottom,
            //To arrange a child nodes in a linear manner
            Arrangement = ChildArrangement.Linear
        };
    }
}

See also