Heena Aggarwal
Heena Aggarwal

Reputation: 1

Edge from node to another edge visjs Angular 4

I'm using Vis.js for drawing a graph with Angular4 and trying to draw an edge { from : node , to : edge , arrows : 'to'}. Giving nodeid and edgeid respectively. But it is not pointing to the edge. Its still pointing to node. How to make edge point to another edge? I want something like this:

Upvotes: 0

Views: 626

Answers (1)

YakovL
YakovL

Reputation: 8316

You can't do this directly, vis.js's model is straight-forward: edges connect nodes. However, you can create a hidden node like this:

var nodes = new vis.DataSet([
     {id:1,label:"from", x:0,  y:0}
    ,{id:2,x:0,  y:100, hidden:true}
    ,{id:3,label:"intercept", x:100,y:100}
    ,{id:4,label:"to", x:0,  y:200}
]);
var edges = new vis.DataSet([
     {from:1, to:2}
    ,{from:2, to:3, arrows:"from"}
    ,{from:2, to:4, arrows:"to"}
]);

to get this:

enter image description here

Upvotes: 4

Related Questions