1 回答

TA貢獻1797條經驗 獲得超4個贊
我已經解決了這個問題。React Cytoscape 的文檔沒有告知布局工作需要其他道具。所以我從 Cytoscape 官方文檔中得到了一個例子。
const layout = {
name: 'cose',
ready: function(){},
stop: function(){},
animate: true,
animationEasing: undefined,
animationDuration: undefined,
animateFilter: function ( node, i ){ return true; },
animationThreshold: 250,
refresh: 20,
fit: true,
padding: 30,
boundingBox: undefined,
nodeDimensionsIncludeLabels: false,
randomize: false,
componentSpacing: 40,
nodeRepulsion: function( node ){ return 2048; },
nodeOverlap: 4,
edgeElasticity: function( edge ){ return 32; },
nestingFactor: 1.2,
gravity: 1,
numIter: 1000,
initialTemp: 1000,
coolingFactor: 0.99,
minTemp: 1.0
};
添加回答
舉報