Nodes are not automatically arranged when there are 2 connectors between 2 nodes.

Hi Syncfusion Team,

I am trying to connect nodes base on a list of source and destination. I added DiagramNode and DiagramConnector programmatically. The nodes are arranged perfectly and automatically in a RadialTree Layout.

However, there is a possibility that Node A connect to Node B and Node B connect to Node A, the result would be a connector with arrow head and arrow tail. The nodes are then arranged to the center of the diagram. All nodes and connectors are stick together at one point.

The question here is how do I add connectors between two nodes without using port? 
Scenario provided as follow: 
A > B , B > A and A > C

Assume there are only Nodes A, B, C and no repeating nodes.

Thank You.


Attachment: Nodes_are_not_automatically_arranged_c7655ae2.zip

1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team April 15, 2021 02:02 PM UTC

Hi Khar Hui Chok, 
In radial tree layout, our layout algorithm by default indicate the connection flow from parent to child relationship (uni-directional)and don't support for child to parent to child (bi-directional) connector flow, but we add the arrow to head using sourceDecorator as Arrow and its seem like the connector has source decorator and target decorator(connector with head and tile). For your reference, we have prepared sample for your requirement and in the sample we have used ConnectorDefaults to change the connector.sourceDecorator.shape as Arrow if the node has the reporting person parent. For more information, please refer to below code snippet and sample link. 

code snippet:
 
function getConnectorDefaults(connector, diagram) { 
   connector.type = 'Straight'; var node = diagram.getObject(connector.sourceID);  
   if (node.data.ReportingPerson == "parent") {  
       connector.sourceDecorator.shape = 'Arrow'; 
      } 
  return connector;  
} 
 
Regards, 
Gowtham 


Marked as answer
Loader.
Up arrow icon