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

前端 未结 6 684
旧时难觅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:31

    I think you might have null values in your source and target. I had this bug too and fixed it by filtering out the null values.

提交回复
热议问题