i got a question in D3.js. I am able to click on circles and interact with them. To realise that, i defined a array named
var array123
inside the function to click on of the circle. Now with this array i am able to save settings in it, for example to change sizes or colors of higher numbers of circles. The function looks like this:
circle.on("click", function (d) {
var array123 = start && start.path(d) || []
link.style("stroke", function(d)
{
return array123.includes(d.source) && array123.includes(d.target) ? "red" : "green";
});
start = d
.....}
My problem is now, that these settings are saved, once clicked on a circle and gets updated when click again on other circles.
The question is, how can i reset the memory of the array from outside? For example i could create a rectangle and when i click on it, it resets all the memory of array123
? I tried to do it with an array with the exact name (array123
) but i wont overwrite the first one.