Skip to content Skip to sidebar Skip to footer

Unable To Fix Position Of Two Nodes In Vis.js

I am trying to fix the position of two nodes. They should be on top of each other, 400px apart in the y-dimension. var edges = [{ id:'1', fixed: {x:true, y:true}, x:0,y

Solution 1:

Maybe this workaround will work for you:

1) store nodes and edges in dataSets

2) set node positions on afterDrawing and update the dataSet

  network.on('afterDrawing', function(){
    let data = [{id: 1, x: 0, y:-200}, {id:2, x:0, y:200}];
    nodesObj.update(data);
  });

fiddle: http://jsfiddle.net/7juye694/

Post a Comment for "Unable To Fix Position Of Two Nodes In Vis.js"