MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / initGraph

Function initGraph

frontend/packages/systemRunning/src/pages/SystemRunning.tsx:289–375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287 }
288
289 const initGraph = () => {
290 return new G6.Graph({
291 container: graphContainerRef.current as HTMLDivElement,
292 groupByTypes: false,
293 // plugins: [tooltip],
294 fitCenter: true,
295 // fitView:true,
296 layout: {
297 type: 'comboForce',
298 // 稳定系数,初始动画的加载时长(稳定性)=节点数量/稳定系数
299 alphaDecay: 0.08,
300 // // 因为有分组的存在,整体布局需要往左偏移一点
301 // // center: [(graphContainerRef.current?.scrollWidth || 300) / 2 - 150,( graphContainerRef.current?.scrollHeight || 0) / 2],
302 preventOverlap: true,
303 preventNodeOverlap: true,
304 preventComboOverlap: true,
305 // nodeCollideStrength:1,
306 // collideStrength:1,
307 comboCollideStrength: 0.9,
308 nodeSize: 24,
309 padding: [20, 20, 20, 20],
310 // linkDistance: 30,
311 nodeStrength: -10,
312 edgeStrength: 0.1,
313 // nodeSpacing:40,
314 // comboSpacing:10,
315 comboPadding: 30,
316 clustering: true,
317 clusterNodeStrength: 1000,
318 clusterEdgeDistance: 50,
319 clusterNodeSize: 100
320 // clusterFociStrength: 1,
321 // charge: (d: nodeAny) => {
322 // return 100
323 // },
324 // linkStrength:()=>{
325 // return 100
326 // },
327 // nodeSpacing: (d: nodeAny,v:nodeAny) => {
328 // console.log(d, v)
329 // if (d.comboId=== 'none-combo' || d.cluster==="none") {
330 // return 40
331 // }
332 // return 50
333 // },
334 // onTick:()=>{console.log('ticking')},
335 // onLayoutEnd:()=>{console.log('layout end')}
336 },
337 modes: {
338 default: ['drag-combo', 'drag-canvas', 'drag-node', 'zoom-canvas', 'activate-relations']
339 },
340 defaultNode: {
341 size: [24, 24],
342 style: {
343 radius: 5,
344 stroke: '#69c0ff',
345 lineWidth: 1,
346 fillOpacity: 1

Callers 1

getGraphFunction · 0.70

Calls 1

$tFunction · 0.90

Tested by

no test coverage detected