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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

connect nodes using ports and mouse

Thread ID:





133071 Oct 7,2017 04:25 PM UTC Oct 12,2017 04:51 AM UTC Angular 6
Tags: ejDiagram
Julian Lyndon-Smith
Asked On October 7, 2017 04:25 PM UTC

Is there any way of allowing the user to connect 2 nodes together by just clicking on a source port and then "dragging" the connector to a target port ?

Shyam G [Syncfusion]
Replied On October 9, 2017 07:02 AM UTC

Hi Julian, 
Please set port constraints ConnectOnDrag which activates the connection Tool when mouse hover on the port and you can draw the connector and establish the connection between two nodes. Please refer to the code example, playground link and help documentation below. 
Code example: 
var nodes = 
                    name: "NewIdea", width: 150, height: 60, offsetX: 300, offsetY: 60, 
                    ports: [ 
                            name: "NewIdea_port1", 
                            //define the portconstraints connect and connectondrag  
                            constraints: ej.datavisualization.Diagram.PortConstraints.Connect | ej.datavisualization.Diagram.PortConstraints.ConnectOnDrag, 
Shyam G 

Julian Lyndon-Smith
Replied On October 9, 2017 08:26 AM UTC

thanks for the reply. I asked the question, because I had followed the documentation and was surprised that it wasn't working ;)

I am using the angular toolkit. My code looks like this

private portOut:Object = {
name: 'out',
offset: {
x: 1,
y: 0.5
shape: 'circle',
visibility: ej.datavisualization.Diagram.PortVisibility,
constraints: ej.datavisualization.Diagram.PortConstraints.Connect | ej.datavisualization.Diagram.PortConstraints.ConnectOnDrag,
fillColor: '#ffb74d'

and then I add the port like this

this.nodes = [
data: {foo: 'bar'},

ports: [Object.assign({},this.portOut)],

labels: [{ text: 'start', fontColor:'white', textAlign:'center' }]

however, when the diagram is drawn, nothing changes when I hover over the port. If I click on the port, the resize handles appear instead

Julian Lyndon-Smith
Replied On October 10, 2017 08:28 AM UTC

gentle *bump* - sorry but I really need to figure out what I'm doing wrong here. thanks ;)

Shyam G [Syncfusion]
Replied On October 10, 2017 11:04 AM UTC

Hi Julian, 
We have created an angular sample in which we have rendered nodes with ports. When you hover on the port, the connection Tool gets activated(cursor changes to crosshair) and you can draw the connector. Please refer to the sample and video below. 
Shyam G 

Julian Lyndon-Smith
Replied On October 11, 2017 09:18 AM UTC

thanks for the example - it showed where my problem was

I had

visibility:  ej.datavisualization.Diagram.PortVisibility,

instead of



Shyam G [Syncfusion]
Replied On October 12, 2017 04:51 AM UTC

Hi Julian, 
Please let us know if you need further assistance on this. 
Shyam G 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon