d3.js - Set different diameters to graph nodes in javascript d3 -


how can set different diameters graph nodes, depend on 'grade' (by grade mean root or children)? example, have 1 source node , want set diameter value. children have value.

this i've tried now:

here build links array:

reply.foreach(function (targetnode) {             links.push({                 source: sourcenode, // source string                 target: targetnode // target array of strings             }); }); 

and here tried give different diameters:

.attr("r", function (d) {                   links.foreach(function (link) {                       if (d === link.source) {                           return 15;                       } else return 6;                   })             }) 

the result graph links, nodes disappeared. ideas how can resolve this?

i fixed it. if anyone, leave code here:

function setdiameter() {             links.foreach(function (link) {                 svg.selectall("circle")                     .attr("r", function (d) {                       if (d === link.source) {                           return 15;                       } else return 6;                 })             });         } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -