vis.jsvis.js-network

In vis-network, how is horizontal order determined in hierarchical layout?


In this example, "level" is used to control the vertical position a node is put at (assuming hierarchical.direction is up-down).

enter image description here

However, I didn't find how to set the horizontal order for nodes on the same hierarchy. For example, if I want to put node 6 in front of node 1, is there a way to do it?

My understanding is that the horizontal order is purely determined by node insertion order, is it correct?


Solution

  • According to https://github.com/visjs/vis-network/issues/926, the order is non-deterministic. Quote:

    Q: I didn't find how to set the horizontal order for nodes on the same hierarchy. For example, if I want to put node 6 in front of node 1, is there a way to do it?

    A: As far as the public API goes: No, the order is not guaranteed in any way, do not rely on it, it may change with any new release or between browsers.

    Q: My understanding is that the horizontal order is purely determined by node insertion order, is it correct?

    A: As far as the CURRENT implementation and decent browsers go: Yes.