Class Port
Essential Diagram for JS provides support to define custom ports for making connections.
Inherited Members
Namespace: Syncfusion.JavaScript.DataVisualization.Models.Diagram
Assembly: Syncfusion.EJ.dll
Syntax
public class Port : EJTagHelper
Constructors
Port()
Initializes a new instance of the Port class.
Declaration
public Port()
Port(Port)
Initializes a new instance of the Port class.
Declaration
public Port(Port src)
Parameters
Type | Name | Description |
---|---|---|
Port | src |
Properties
BorderColor
Gets or sets border color of the port
Declaration
[JsonProperty("borderColor")]
public string BorderColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | "#1a1a1a" |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", BorderColor = "yellow" });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
BorderWidth
Gets or sets the stroke width of the port
Declaration
[JsonProperty("borderWidth")]
public double BorderWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 1 |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", BorderWidth = 3 });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
ConnectorPadding
Gets or sets the space to be left between the port bounds and its incoming and outgoing connections.
Declaration
[JsonProperty("connectorPadding")]
public double ConnectorPadding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 0 |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", ConnectorPadding = 3 });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Constraints
Gets or sets whether connections can be created with the port
Declaration
[JsonProperty("constraints")]
[JsonConverter(typeof(StringEnumConverter))]
public PortConstraints Constraints { get; set; }
Property Value
Type | Description |
---|---|
PortConstraints | PortConstraints.Connect |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Constraints = PortConstraints.Connect });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
CssClass
Gets or sets cssClass to be applied for the port
Declaration
[JsonProperty("cssClass")]
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", CssClass = "classname" });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
FillColor
Gets or sets fill color of the port
Declaration
[JsonProperty("fillColor")]
public string FillColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | "white" |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", FillColor = "white" });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Margin
Gets or sets margin of the port from the offset
Declaration
[JsonProperty("margin")]
public LabelMargin Margin { get; set; }
Property Value
Type | Description |
---|---|
LabelMargin | LabelMargin() { Bottom = 0, Right = 0, Top = 0, Left = 0 } |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", CssClass = "classname", Margin = new LabelMargin() { Bottom = 10, Right = 10, Top = 10, Left = 10 } });
BasicShape Node = new BasicShape() { Name = "SwimLane" };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Name
Gets or sets the unique identifier of the port
Declaration
[JsonProperty("name")]
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", FillColor = "red" });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
Offset
Gets or sets offset of the port
Declaration
[JsonProperty("offset")]
public DiagramPoint Offset { get; set; }
Property Value
Type | Description |
---|---|
DiagramPoint | DiagramPoint() { X = .5f, Y = .5f } }); |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Offset = new DiagramPoint() { X = .1f, Y = .3f } });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Parent
Gets or sets the unique identifier of the port
Declaration
[JsonProperty("parent")]
public string Parent { get; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1" Parent=""});
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
PathData
Gets or sets the path data to draw the port. Applicable, if the port shape
is
path.
Declaration
[JsonProperty("pathData")]
public string PathData { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Shape = PortShapes.Path, PathData = "M5,0 L10,10 L0,10 z" });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Shape
Gets or sets the shape of the port.
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("shape")]
public PortShapes Shape { get; set; }
Property Value
Type | Description |
---|---|
PortShapes | PortShapes.Square |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Shape = PortShapes.Square });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Size
Gets or sets the size of the port
Declaration
[JsonProperty("size")]
public double Size { get; set; }
Property Value
Type | Description |
---|---|
System.Double | 8 |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Size = 10 });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Visibility
Gets or sets when the port should be visible
Declaration
[JsonProperty("visibility")]
[JsonConverter(typeof(StringEnumConverter))]
public PortVisibility Visibility { get; set; }
Property Value
Type | Description |
---|---|
PortVisibility | PortVisibility.Default |
Examples
DiagramProperties Model = new DiagramProperties();
Collection Ports = new Collection();
Ports.Add(new Port() { Name = "port1", Visibility = PortVisibility.Visible });
BasicShape Node = new BasicShape() { Name = "SwimLane", Ports = Ports };
Model.Nodes.Add(Node);
ViewData["diagramModel"] = Model;
Methods
Clone()
Performs a deep copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | object |