作者:PHP先锋官 | 来源:互联网 | 2023-02-03 14:07
1> Andrew Reid..:
.remove()
不带任何参数,它只是一种可以用于任何d3选择的方法.
要删除功能,您必须先选择它们,然后将其删除:
d3.selectAll('g').remove(); // removes all 'g' elements from the DOM.
d3.selectAll('.point').remove(); // removes all elements with the class 'point'
为了说明,以下代码绘制了一个圆圈:
var svg = d3.select('body').append('svg');
var circle = svg.append('circle')
.attr('cx',40)
.attr('cy',40)
.attr('r',10);