//Adding a connection private void Connect(Node tail, Node head) { Connector conn = new Connector(); conn.Segments = new Collection(); Segment seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Bezier); conn.Segments.Add(seg); conn.Constraints = conn.Constraints & ~(ConnectorConstraints.Select); conn.Name = "connector_" + DiagramWebControl1.Model.Connectors.Count; conn.TargetNode = head.Name; conn.SourceNode = tail.Name; conn.Visible = false; Dictionary <string, object> addInfo = head.AddInfo as Dictionary <string, object>; if (addInfo["type"].ToString() == "right" || addInfo["type"].ToString() == "subright") { conn.SourcePort = (tail.Ports[1] as Port).Name; conn.TargetPort = (head.Ports[0] as Port).Name; } else if (addInfo["type"].ToString() == "left" || addInfo["type"].ToString() == "subleft") { conn.SourcePort = (tail.Ports[0] as Port).Name; conn.TargetPort = (head.Ports[1] as Port).Name; } conn.TargetDecorator.Shape = DecoratorShapes.None; DiagramWebControl1.Model.Connectors.Add(conn); }
private Connector ConnectDiagramNode(DiagramProperties model, Node targetNode, Node sourceNode, string labelText) { Connector connector = new Connector(); connector.Name = "line" + model.Connectors.Count + 1; connector.Segments = new Collection(); Segment seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Orthogonal); connector.Segments.Add(seg); connector.TargetNode = targetNode.Name; connector.SourceNode = sourceNode.Name; connector.LineWidth = 2; if (!string.IsNullOrEmpty(labelText)) { Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label.FontColor = "black"; label.FillColor = "white"; label.Text = labelText; connector.Labels.Add(label); } connector.SourceDecorator.Shape = Syncfusion.JavaScript.DataVisualization.DiagramEnums.DecoratorShapes.Arrow; connector.TargetDecorator.Shape = Syncfusion.JavaScript.DataVisualization.DiagramEnums.DecoratorShapes.None; connector.TargetDecorator.BorderColor = "#606060"; connector.TargetDecorator.Width = 10; connector.TargetDecorator.Height = 10; model.Connectors.Add(connector); return(connector); }
public void createSymbolPaletteNode(SymbolPaletteProperties symbolpalette) { Palette connectors = new Palette("Connectors"); connectors.Expanded = true; Collection segments = new Collection(); Segment seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Orthogonal); segments.Add(seg); connectors.Items.Add(new Connector { Name = "link1", Segments = segments, SourcePoint = new DiagramPoint(0, 0), TargetPoint = new DiagramPoint(40, 40), LineWidth = 1 }); segments = new Collection(); seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Straight); segments.Add(seg); connectors.Items.Add(new Connector { Name = "link2", Segments = segments, SourcePoint = new DiagramPoint(0, 0), TargetPoint = new DiagramPoint(40, 40), LineWidth = 1 }); symbolpalette.Palettes.Add(connectors); }