Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Problem with creating node with multiple inport / outport

$
0
0

@sillyMredul wrote:

Hello,
I am creating a graph where each node can have multiple inport / outport. I am using same mechanism to create each type of node. But only outport is not creating for one type of node (Data) where other two type (Workflow, Service) is working fine.

var outport = 0;
var inport = 0;
var listOfInputPorts = [];
var listOfOutputPorts = [];

//create nodes using model data
self.nodes.forEach(function(node) {
	label = node.label;
	name = node.name;
	
	switch(label) {
  	  case "Workflow":
  		color = 'CadetBlue';
  	    break;
  	  case "Data":
  		color = 'SteelBlue';
  	    break;
  	case "Service":
  		color = 'Teal';
  		break;
  	default:
  		color = 'SteelBlue';
  	}
	
	self.linkDataArray.forEach(function(link) {
  		//output port definition
  			if(node.id == link.from){
  				outport++;
  				outport_lable = 'OUT ' + outport;
  				link.frompid = outport_lable;
  				var aNewOutputPort = makePort(outport_lable,false);
                listOfOutputPorts.push(aNewOutputPort);
  			}
  		});
	self.linkDataArray.forEach(function(link) {
  		//input port definition
  			if(node.id == link.to){
				inport++;
				inport_lable = 'IN ' + inport;
  					link.topid = inport_lable;
  					var aNewInputPort = makePort(inport_lable,true);
  	                listOfInputPorts.push(aNewInputPort);
  				}
      		});
  		
  		makeTemplate(label, color,
  				listOfInputPorts,
                listOfOutputPorts);
  		
  		listOfInputPorts = [];
        listOfOutputPorts = [];
  		outport = 0; 
  		inport = 0;
  });

What am I doing inappropriate?
Thanks for your time.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles