d3--selection選擇集的理解

選擇集裏面只有group是能夠直接接selection的方法

selection.fn

data=[
      [60,200],[200,200],[340,200]
    ]
    let g=this.svg.selectAll('.circle').data(data).join(enter=>{
      enter.append('circle')
             .attr('r',50)
                 .attr('cx',d=>d[0])
                 .attr('cy',d=>d[1])

    })
    g.attr('r',50)
                 .attr('cx',60)
                 .attr('cy',200)
    console.log(g);
_enter: [Array(3)]
_exit: [Array(1)]
_groups: [Array(3)]
_parents: [svg]
相關文章
相關標籤/搜索