D3删除节点

function deleteNode(d){

    var deletelinks = links.select(function(x) {
        return x['source'].id==d.id||x['target'].id==d.id?this:null;
    })

    deletelinks.remove();

    var deletenode = nodes.select(function(x){
        return x.id==d.id?this:null;
    })

    deletenode.remove();

}

function highlightNode(current, currentD){
    currentD.highlightFlag = true;
    current.select(".circles1").transition()                
        .attr("r", function(d){return get_circle_r(d)})
        .attr("fill", function(d){return get_circle_fill(d)});
}

 

posted @ 2023-02-09 17:22  徐钏  阅读(100)  评论(0)    收藏  举报