vis.jsvis.js-network

In vis-network, how to align nodes on the same vertical position?


This problem is driving me crazy

My requirement is simple, I want to put node x and y on the same vertical position. I've looked at this and this question, the answer seem to suggest manually setting the x position. However I don't really want to do that, is there a better way?

https://jsfiddle.net/laike9m/dg8Lzt7c/31/

The following graph is what I currently have:

enter image description here

Ideally, I want the left part unchanged, but y is placed on the same vertical position with x:

enter image description here


Solution

  • Join them with a transparent edge:

    {
      "from": "x",
      "to": "y",
      "color": "rgba(0, 0, 0, 0)"
    }