我面临着一个“奇怪的”问题,我无法解决查看vis.js文档。
我创建了一个具有固定层次结构的网络,为每个节点定义了一个特定级别。
节点总数51。其结果是:

如果我在网络方案的底部添加另一个节点(总共52),布局发生变化,节点的空间配置将完全移动,试图填充空白,如您所见:

我尝试了几种选择,但都没有成功。
以下是我目前正在使用的选项:
options = {
layout: {
improvedLayout: false,
hierarchical: {
enabled: true,
levelSeparation: 150,
nodeSpacing: 110,
treeSpacing: 200,
blockShifting: false,
edgeMinimization: true,
parentCentralization: true,
direction: "LR",
sortMethod: "directed",
shakeTowards: "roots"
}
},
interaction:{
tooltipDelay: 100
},
edges: {
font: {
size: 0
}
},
nodes: {
shape: 'circle'
},
physics: false
};
我希望你能给我一些建议。
谢谢!
发布于 2020-02-05 19:36:27
您可以尝试将randonSeed添加到options对象中的布局中。
layout: {
randomSeed: 1,
improvedLayout: false,
hierarchical: {
enabled: true,
levelSeparation: 150,
nodeSpacing: 110,
treeSpacing: 200,
blockShifting: false,
edgeMinimization: true,
parentCentralization: true,
direction: "LR",
sortMethod: "directed",
shakeTowards: "roots"
}
}您可以更改数字(randomSeed:1),直到得到所请求的布局为止。希望能帮上忙。
https://stackoverflow.com/questions/60080433
复制相似问题