d3.js: “Cannot read property 'weight' of undefined” when manually defining both nodes and links for force layout

前端 未结 6 628
旧时难觅i
旧时难觅i 2020-12-09 16:31

I tried setting both nodes and links at the same time this way:

var force = d3.layout.force()
    .size([w, h])
    .nodes(nodes)
    .links(connections)
            


        
6条回答
  •  囚心锁ツ
    2020-12-09 17:32

    I encounter same problem before, it is due to there is null values in source/target of links. print out nodes and links information might help to debug

提交回复
热议问题