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
Post a Comment