vis-network
vis-network copied to clipboard
Distance between nodes takes over
I'm having the problem that sometimes, when adding an edge (via user input), the distance between two nodes exaggerates.
When removing this edge, or adding another one to this right most node, the distance shrinks to its normal and supposed size.
It's also not possible to drag the node any closer to the other nodes when this behavior occurs.
Is this a bug or did I choose bad options?
I'm using this optionssetup:
const options: Options = {
locale: activeLanguageId,
configure: {
enabled: false,
showButton: true,
},
nodes: {
shape: 'dot',
size: 30,
font: { size: 25, color: 'white' },
borderWidth: 2,
shadow: true,
widthConstraint: {
maximum: 250,
},
},
edges: {
label: nextLabel,
arrows: { to: true },
smooth: {
enabled: true,
type: 'curvedCW',
roundness: 0.05,
},
},
physics: {
enabled: true,
solver: 'barnesHut',
barnesHut: {
gravitationalConstant: -24300,
springConstant: 0.115,
avoidOverlap: 1,
},
hierarchicalRepulsion: {
nodeDistance: 300,
},
},
interaction: { hover: true },
manipulation: {
enabled: true,
addNode: false,
deleteNode: false,
initiallyActive: true,
editEdge: {
editWithoutDrag: onEdgeEdit,
},
},
layout: {
hierarchical: {
direction: 'LR',
levelSeparation: 300,
nodeSpacing: 300,
treeSpacing: 300,
sortMethod: 'directed',
},
},
};
I'm facing the same issue at the moment.
I think it's caused by the sortMethod: 'directed'
, since I didn't encounter this without it. I also couldn't find any information on this issue besides this post so far. Hoping there's an easy fix for it! :)
I'm facing the same issue—strangely, the last node becomes isolated. Does anyone have any suggestions to solve this?