this.myGraph = ForceGraph3D({ controlType: 'trackball', // orbital沿2d轨道绕着拖动,fly固定不动 rendererConfig: { antialias: true, alpha: true } })(this.$refs.graph)
.backgroundColor('black') // 背景颜色,支持内置颜色和RGB
.width(this.$refs.graph.parentElement.offsetWidth) // 画布宽度(充满父级容器)
.height(this.$refs.graph.parentElement.offsetHeight) // 画布高度(充满父级容器)
.showNavInfo(false) // 是否显示底部导航提示信息
//.cooldownTicks(100)
this.myGraph
.onEngineStop(() => this.myGraph.zoomToFit(400)) //当引擎停止时适合画布
.nodeRelSize(4) // 节点大小(支持数值)
.nodeVal(node => {
return node.val * 0.05
}) // 节点大小(支持回调)
.nodeAutoColorBy('group')
.nodeColor(node => {
console.log(node, 'node')
return node.colorKey
})