'How to change the color of a node based on changed data in d3?
nodes = g.append("g")
.attr("class", "net_node")
.selectAll("circle")
.data(data).enter()
.append("circle")
.attr("fill", function(d) {
return color.palette(d.group);
})
The nodes are defined as follows.
In the pallete, colors are assigned according to the group number.
I do not know the current method, so when other data is input, I delete the svg and run it again.
svg.remove();
view(new_data);
How to change nodes.data and change color
I've read a lot of posts and tried a lot but still can't figure out the answer
thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
