Single node error in Arbor.JS

When creating a trivial JS Arbor graph with a single node, node trembles around everywhere and no additional nodes can be added.

The problem is also reported here by another user:

https://github.com/samizdatco/arbor/issues/12

Thank your help with fix / workaround

+5
source share
5 answers

Using d3.js library instead of Arbor solved my problem :-)

+2
source

This is not a fix, but I am counting the number of nodes and, if less than the value, I set the friction to 1.0

if (nodeCount == 1) {
   //Stop single nodes bouncing all over the place
   sys.parameters({ friction: '1.0' });
}
+2
source

. , , , .

, , . , , . node , .

, node. , - , node. -, : http://www.graphthinker.com. , , , () node.

This hidden node balancing can be removed when it is no longer needed, say when another node is added or when only the visible node is removed.

+2
source

Another option is to replace the file physics.jswith this one . It has several fixes to compensate for the problems associated with the presence of one node (including problems with adding a second).

+1
source

try it

if (nodeCount == 1) {
            sys.parameters({ repulsion: 10, gravity: false, dt: 0.035 })
        }
        else if (nodeCount > 1 && nodeCount < 30) {
            sys.parameters({ repulsion: 1000, gravity: false, dt: 0.35 })
        }
        else {
            sys.parameters({ friction: .1, stiffness: 0.1, repulsion: 1, gravity: false, dt: 0.035 })
        }
Run codeHide result
0
source

All Articles