javascript - Something wrong with this for-loop? -


i got array p stores nodes. in code below, possible set style of links , works totally right. checks source property of links (d.source) , target property (d.target) , compares elements p[0] , p[1].

link.style("stroke-width", function(d) {   return p[0] == d.source && p[1] == d.target ? "111px" : "1px"; }); 

now, want not compare p[0] , p[1]. want go through complete array p. set loop below , compare p[i] , p[i+1]. unfortunally not work. can maybe give me hint?

for (i = 0; < p.length; i++) {   link.style("stroke-width", function(d) {     return p[i] == d.source && p[i+1] == d.target ? "111px" : "1px";       })  } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -