选择元素

  • d3.select():是选择所有指定元素的第一个
  • d3.selectAll():是选择指定元素的全部

 

插入元素

  • append():在选择集末尾插入元素
  • insert():在选择集前面插入元素

 

  例:

1   body.append("p")
2       .text("append p element");
1 body.insert("p","#myid")
2   .text("insert p element");

删除元素

1 var p = body.select("#myid");
2 p.remove();

 

posted on 2017-04-18 15:32  thelongmarch  阅读(565)  评论(0编辑  收藏  举报