javascript - D3 : Unable to get property 'weight' of undefined or null reference -


d3 svg graph stops working when assign link.source , link.target integer values retrieved db. if assign index starting 0 graph works fine, fails above error when assign link.source , .target identifier values retrieved db.

var edges = []; json.links.foreach(function(e) {   var sourcenode = json.nodes.filter(function(n) {         return n.id === e.source;       })[0],       targetnode = json.nodes.filter(function(n) {         return n.id === e.target;       })[0];    edges.push({     source: sourcenode,     target: targetnode,     value: e.value   }); });  force   .nodes(json.nodes)   .links(edges)   .start();  var link = svg.selectall(".link")    .data(edges) 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -