I just asked a similar question before, but now I decided to change it a little bit into a new question.
I use d3.js. The array called A
stores 3 colors and I want to go through a loop that fills my element link. Unfortunately this loop is so fast, only the very last element gets visible on screen, and that means only the color green.
How can I delay this process? That means turn the links blue, wait 2 seconds, turn them red, wait another 2 seconds and at last turn them green?
Here's my code...
var A = ["blue", "red", "green"]
for (var i = 0; i < A.length; i++){
link.style("stroke", function(d){
return A[i];
})
};