antvis/G6

layout为'gforce'时,会报错:layout failed undefined,同时布局也没有生效 #3167

Shirley-linxiaojia posted onGitHub

  • I have searched the issues of this repository and believe that this is not a duplicate.

Edit on CodeSandbox

Steps to reproduce

graph = new G6.Graph({ container: ReactDOM.findDOMNode(ref.current) as HTMLElement, plugins: [legend], fitView: true, fitViewPadding: 20, fitCenter: true, animate: true, modes: { default: ['drag-canvas', 'zoom-canvas', 'drag-node'], }, layout: { type: 'gforce', workerEnabled: true, gpuEnabled: true, onLayoutEnd: () => { // 可选 console.log('force layout done'); } }, defaultNode: { size: 20, style: { lineWidth: 2, }, }, defaultEdge: { size: 1, color: '#e2e2e2', style: { endArrow: { path: 'M 0,0 L 8,4 L 8,-4 Z', fill: '#e2e2e2', }, }, }, nodeStateStyles: { activeByLegend: { lineWidth: 5, strokeOpacity: 0.5, stroke: '#f00' }, inactiveByLegend: { opacity: 0.5 } }, edgeStateStyles: { activeByLegend: { lineWidth: 10, strokeOpacity: 0.5 }, inactiveByLegend: { opacity: 0.5 } }, });

Environment Info
g6 4.3.6
System mac os 11
Browser Chrome 92.0.4515.159

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


Fund this Issue

$0.00
Funded

Pull requests