Class Layout
Automatically arranges the nodes and connectors in a predefined manner.
Inherited Members
Namespace: Syncfusion.JavaScript.DataVisualization.Models.Diagram
Assembly: Syncfusion.EJ.dll
Syntax
public class Layout : EJTagHelper
Constructors
Layout()
Declaration
public Layout()
Properties
AvoidSegmentOverlapping
Enable/Disable to avoid overlapping the segments in layout with multiple parents
Declaration
[JsonProperty("avoidSegmentOverlapping")]
public bool AvoidSegmentOverlapping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.AvoidSegmentOverlapping = true;
ViewData["diagramModel"] = Model;
Bounds
Gets or sets value of the bounds of layout
Declaration
[JsonProperty("bounds")]
public Rectangle Bounds { get; set; }
Property Value
Type | Description |
---|---|
Rectangle | 0 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.Bounds = new Rectangle() { X = 10, Y = 10, Width = 100, Height = 100 };
FixedNode
Gets or sets the fixed node with reference to which, the layout will be arranged and fixed node will not be repositioned
Declaration
[JsonProperty("fixedNode")]
public string FixedNode { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
//fixedNode of the layout
DiagramProperties Model = new DiagramProperties();
Model.Layout.FixedNode = "nodename";
GetConnectorSegments
Connectors in the layout can be customized.
Declaration
[JsonProperty("getConnectorSegments")]
public string GetConnectorSegments { get; set; }
Property Value
Type | Description |
---|---|
System.String | null |
Examples
<script>
function getConnectorSegments(diagram, connector) { };
</script>
DiagramProperties Model = new DiagramProperties();
Model.Layout.GetConnectorSegments = "getConnectorSegments";
ViewData["diagramModel"] = Model;
GetLayoutInfo
Gets or sets the orientation of trees/sub trees
Declaration
[JsonProperty("getLayoutInfo")]
public string GetLayoutInfo { get; set; }
Property Value
Type | Description |
---|---|
System.String | null |
Examples
<script>
function getLayoutInfo(diagram, node, options) { options.orientation = "vertical"; options.type = "left"; offset = 10;};
</script>
DiagramProperties Model = new DiagramProperties();
Model.Layout.GetLayoutInfo = "getLayoutInfo";
ViewData["diagramModel"] = Model;
HorizontalAlignment
Gets or sets the horizontal alignment of layout
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("HorizontalAlignment")]
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Type | Description |
---|---|
HorizontalAlignment | HorizontalAlignment.Center |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.HorizontalAlignment = HorizontalAlignment.Center;
HorizontalSpacing
Gets or sets the space to be horizontally left between nodes
Declaration
[JsonProperty("horizontalSpacing")]
public double HorizontalSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 30 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.HorizontalSpacing = 50;
Level
Gets or sets the nullable value of the layout level
Declaration
[JsonProperty("level")]
public int? Level { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | null |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.Level = 2;
Margin
Gets or sets the margin value to be horizontally left between the layout and diagram
Declaration
[JsonProperty("margin")]
public Margin Margin { get; set; }
Property Value
Type | Description |
---|---|
Margin | 0 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.margin = new Margin() { Left = 20, Right = 20, Top = 20, Bottom = 20 };
MarginX
Gets or sets the margin value to be horizontally left between the layout and diagram
Declaration
[JsonProperty("marginX")]
[Obsolete("Use Margin.Left")]
public double MarginX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.MarginX = 50;
MarginY
Gets or sets the margin value to be vertically left between layout and diagram
Declaration
[Obsolete("Use Margin.Top")]
[JsonProperty("marginY")]
public double MarginY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.MarginY = 50;
MaxIteration
Gets or sets the iterative count for the minimization process
Declaration
[JsonProperty("maxIteration")]
public double MaxIteration { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 30 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.MaxIteraction = 50;
Orientation
Gets or sets the orientation/direction to arrange the diagram elements.
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("orientation")]
public LayoutOrientations Orientation { get; set; }
Property Value
Type | Description |
---|---|
LayoutOrientations | LayoutOrientations.TopToBottom |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.Orientation = LayoutOrientations.LeftToRight;
Root
Gets or sets the root node with reference
Declaration
[JsonProperty("root")]
public string Root { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
//RootNode of the layout
DiagramProperties Model = new DiagramProperties();
Model.Layout.Root = "nodename";
RootNode
Gets or sets the root node with reference
Declaration
[JsonProperty("rootNode")]
[Obsolete("Use Root instad of RootNode")]
public string RootNode { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
//RootNode of the layout
DiagramProperties Model = new DiagramProperties();
Model.Layout.RootNode = "nodename";
SpringFactor
Gets or sets coulomb constant. The bigger the constant, the more sibling nodes repel each other.
Declaration
[JsonProperty("springFactor")]
public float SpringFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Single | 0.442F |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.SpringFactor = .4F;
SpringLength
Gets or sets how long edges should be, ideally. This will be the resting length for the springs.
Declaration
[JsonProperty("springLength")]
public double SpringLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 100 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.SpringLength = 50;
Type
Gets or sets the type of the layout based on which the elements will be arranged
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("type")]
public LayoutTypes Type { get; set; }
Property Value
Type | Description |
---|---|
LayoutTypes | LayoutTypes.None |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.Type = LayoutTypes.HierarchicalTree;
ViewData["diagramModel"] = Model;
VerticalAlignment
Gets or sets the vertical alignment of layout
Declaration
[JsonProperty("VerticalAlignment")]
[JsonConverter(typeof(StringEnumConverter))]
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
VerticalAlignment | VerticalAlignment.Center |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.VerticalAlignment = VerticalAlignment.Center;
VerticalSpacing
Gets or sets the space to be vertically left between nodes
Declaration
[JsonProperty("verticalSpacing")]
public double VerticalSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 30 |
Examples
DiagramProperties Model = new DiagramProperties();
Model.Layout.VerticalSpacing = 50;