Graph 为什么这个五体网络不断旋转?
我不明白为什么这个简单的网络配置一直围绕着节点2旋转,除非在一些轻推之后,然后它重新开始旋转。安装程序使用带有的visjs网络模块 网络构造函数的我的选项参数如下所示:Graph 为什么这个五体网络不断旋转?,graph,data-visualization,physics,vis.js,graph-visualization,Graph,Data Visualization,Physics,Vis.js,Graph Visualization,我不明白为什么这个简单的网络配置一直围绕着节点2旋转,除非在一些轻推之后,然后它重新开始旋转。安装程序使用带有的visjs网络模块 网络构造函数的我的选项参数如下所示: get options(): Options { return ( this.optionS || { nodes: { shape: 'dot', size: 30, font: { size: 32 }, borderWidth: 2,
get options(): Options {
return (
this.optionS || {
nodes: {
shape: 'dot',
size: 30,
font: {
size: 32
},
borderWidth: 2,
shadow: true
},
edges: {
width: 2,
shadow: true,
smooth: {
enabled: true,
roundness: 0.5,
type: 'cubicBezier',
forceDirection: 'vertical'
}
},
physics: {
forceAtlas2Based: {
avoidOverlap: 0.25,
gravitationalConstant: -95,
centralGravity: 0.01,
springLength: 100,
springConstant: 0.19,
nodeDistance: 175,
damping: 0.11
},
minVelocity: 0.75,
solver: 'forceAtlas2Based'
}
}
);
}
this.network = new Network(
this.el.nativeElement,
this.graphData,
this.options
);
主体角度组件提供以下5个节点:
const nodes = new DataSet([
{ id: 1, label: 'Node 1' },
{ id: 2, label: 'Node 2' },
{ id: 3, label: 'Node 3' },
{ id: 4, label: 'Node 4' },
{ id: 5, label: 'Node 5' }
]);
const edges = new DataSet([
{ from: 1, to: 3 },
{ from: 1, to: 2 },
{ from: 2, to: 4 },
{ from: 2, to: 5 }
]);
this.graphData = { nodes, edges };
network指令只是将网络实例化如下:
get options(): Options {
return (
this.optionS || {
nodes: {
shape: 'dot',
size: 30,
font: {
size: 32
},
borderWidth: 2,
shadow: true
},
edges: {
width: 2,
shadow: true,
smooth: {
enabled: true,
roundness: 0.5,
type: 'cubicBezier',
forceDirection: 'vertical'
}
},
physics: {
forceAtlas2Based: {
avoidOverlap: 0.25,
gravitationalConstant: -95,
centralGravity: 0.01,
springLength: 100,
springConstant: 0.19,
nodeDistance: 175,
damping: 0.11
},
minVelocity: 0.75,
solver: 'forceAtlas2Based'
}
}
);
}
this.network = new Network(
this.el.nativeElement,
this.graphData,
this.options
);
任何关于为什么会发生这种常年运动的洞察都将不胜感激。我需要了解在生成“稳定”节点时需要考虑哪些因素,以便用户不必一直追逐节点/边来单击/交互。增加最小速度或阻尼以停止此操作 按照您配置它的方式,物理实际上从未停止移动节点。节点1、2、4和5通过中心引力保持星形排列。节点3然后将节点1推开,但由于所有节点都已连接,因此最终会移动所有节点。由于节点1和3之间的边缘,力在一个方向上比在另一个方向上更强。然后,对整个布置施加无休止的力,最终使其围绕节点2缓慢旋转
更快的微调器:这是一个31秒的剪辑,它具有不同的缩放,可以更好地查看所有5个节点: