我正在使用出色的Cytoscape.js进行绘图。
我以前一直使用Cola选项,因为它使用力方向。
但是,我现在想可视化多个没有连接的图形,并意识到fCose在执行此操作方面要好得多。
我现在面临的问题是,当我已经有了坐标时,现在无法设置节点位置。
我可以通过使用Cola
在布局选项中执行以下操作来实现此目的-
name: 'cola',padding: layoutPadding,nodeSpacing: 40,edgeLengthVal: 20,animate: false,// setting this to false
randomize: false,// and this to false allowed me to manually set the node position coordinates
maxSimulationTime: maxLayoutDuration,boundingBox: {
x1: 0,y1: 0,x2: 10000,y2: 10000
},edgeLength: function (e) {
let w = e.data('weight');
return w;
}
还将Cola
的默认值positions
设置为undefined
,我认为这意味着如果传递了坐标,则会对其进行相应的设置。
但是我的问题是fCose
是,无论我做什么,传递节点中的节点的坐标时,渲染时的影响都为零。
在fCose
的默认设置中,我看到三个变量,我认为如果我进行了更改,将会产生效果-
quality: "default",// Use random node positions at beginning of layout
// if this is set to false,then quality option must be "proof"
randomize: true,// Whether or not to animate the layout
animate: true,
因此,我将quality
设置为“证明”,并将randomize
和animate
都设置为false
。
我也尝试添加positions: undefined
,但是以上更改均未对节点定位产生任何影响。我如何用fCose
做到这一点?