We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Question about connectors in diagrams

The documentation for the WinRT diagram control makes reference to SourcePort and TargetPort in Figure 7 but, as far as I can tell, they aren't referenced again.

What I would like to know is whether or not you can specify which side of a node the connector starts from and connects to.

Thanks.

 


3 Replies

JR Jegan R Syncfusion Team July 1, 2013 10:24 AM UTC

Hi Philip,

Query

Response

The documentation for the WinRT diagram control makes reference to SourcePort and TargetPort in Figure 7 but, as far as I can tell, they aren't referenced again.

Port functionality is explained in further part of documentation.

Link : http://help.syncfusion.com/UG/winrt/Documents/ports.htm

 

Or Navigation :

http://help.syncfusion.com/winrt > Diagram > Features > Ports

What I would like to know is whether or not you can specify which side of a node the connector starts from and connects to.

A connector’s source and target can be a Point, Node or Port and the connected side/direction depends where the source and targets are placed.

 

Currently there is no inbuilt API to get the Node’s side to which a connector is connected. However, it can be evaluated easily.

 

Suggestion 1:

//Example :

// Say node1 and line1 are the instances of a Node and Connector respectively.

// line1’s SourceNode property is set to node1

if ((line1.SourcePoint.X - node1.OffsetX) > 10)

{

    //line is connected towards right side of the node.

}

else if ((line1.SourcePoint.Y - node1.OffsetY) > 10)

{

    //line is connected towards bottom side of the node.

}

// Same way we can check for other sides.

 

Suggestion 2:

You can find the angle between Node’s Center point and Connector’s SourcePoint and determine its side/direction based on the angle.

 

Please let us know if you have any clarification.

Regards,
Jegan



PC Philip Colmer July 24, 2013 01:33 PM UTC

Thanks for your reply.

If I have a connector, do I specify the *nodes* that it connects between, or the *ports*? The documentation for Connectors has sample code that references nodes but I'm wondering why ports are shown on the diagram if they aren't used.

If ports *aren't* used to specify how a connector joins two nodes together, does the library just pick the two nearest sides of the nodes, which is why you said I can't determine where the connector has joined up?

I want to put together a diagram that is pretty close to a directed-tree layout but the nodes aren't *entirely* in a unique root/child relationship. I need to be able to support some nodes that are shown to be drawn at the same level as, say, a manager and connected to that manager, e.g. a personal assistant. I was hoping I could do this by specifying the position on the node of the port and then specify the port for the connector.

Thanks.

 



RT Ramya Thirugnanam Syncfusion Team July 25, 2013 08:55 AM UTC

Hi Philip,

Please find the responses to your queries as below.

S.No

Query

Solution

1.

If I have a connector, do I specify the *nodes* that it connects between, or the *ports*? The documentation for Connectors has sample code that references nodes but I'm wondering why ports are shown on the diagram if they aren't used.

 

We assumed that you are mentioning about Fig 7 in Connector documentation section. That Image is used to represent the possible ways to set the Source and Target of the Connector.

A connector’s Source and Target can be defined in 3 possible ways

Point: (SourcePoint/ TargetPoint), a particular point with respect to Page.

Node: (SourceNode/ TargetNode), to connect to outer boundary/sides of a node.

Port: (SourcePort/ TargetPort), to connect to a specific point inside a node.

Note: The provided Code Snippet in Connector documentation section is used to represent the Connection between two nodes. For details about Port to Port Connection, please refer to the following online documentation link.

Link: http://help.syncfusion.com/UG/winrt/Documents/ports.htm

 

2.

If ports *aren't* used to specify how a connector joins two nodes together, does the library just pick the two nearest sides of the nodes, which is why you said I can't determine where the connector has joined up?

 

Yes, as already explained, a connector’s source and target can be a Point, Node or Port and the connected side/direction depends where the source and targets are placed(two nearest sides of the nodes). We have provided the image to represent the connector Source and target Points are updated automatically based on nearest sides of Nodes.

 Image 1:

Image 2:


 

3.

I want to put together a diagram that is pretty close to a directed-tree layout but the nodes aren't *entirely* in a unique root/child relationship. I need to be able to support some nodes that are shown to be drawn at the same level as, say, a manager and connected to that manager, e.g. a personal assistant. I was hoping I could do this by specifying the position on the node of the port and then specify the port for the connector.

 

The Directed Tree Layout Arranges the diagram based on the relationship between Nodes with Connector by directly or Ports.

Relationship:

Parent                - SourceNode of Connector

Child/Children  - TargetNode of Connector

  For further details about DirectedTree Layout, please refer to the following Online Documentation link

 Link: http://help.syncfusion.com/UG/winrt/Documents/automaticlayouts.htm

 Suggestion:

If DirectedTree Layout does not satisfy the requirement, a custom layout can be achieved by manually specifying the offset positions of a Node. If just some minor changes is required after applying the layout, those minor changes can be applied manually by modifying the offset positions.

 Please let us know if you have any concerns,
Regards,
Ramya

 

 


Loader.
Live Chat Icon For mobile
Up arrow icon