2

My problem is same this, please see this fiddle.

I remove a node, and add a new node in d3 graph, but I still can see the removed node in graph.

The "ios" is added but dont see in the "svg". What's wrong?

function dynamicAddNodes() {        
    var updatedata = {
        "name":"ios",
        "NumOccurrences":"500",
        "color":"green",
        "x":0,
        "y":1
    }

    data.nodes.pop();                    
    data.nodes.push(updatedata);
    restart();
}
4

1 回答 1

3

是的!我解决它:

circles = circles.data(data.nodes,function (d) {
     return d.id; 
  });

jsfiddle.net/MoHSenMHS/5r62N/

于 2013-10-31T16:39:06.977 回答