我无法使reduce
方法的工作ID为D3 v4。我收到reduce is not a function
错误。怎么了?
var svg = d3.select('svg');
var dataSet = [10, 20, 30, 40];
var circle = svg.selectAll('circle')
.data(dataSet)
.enter()
.append('circle')
.attr("r",function(d){ return d })
.attr("cx", function(d, i){ return i * 100 + 50 })
.attr("cy",50)
.attr("fill",'red')
;
var t=circle.reduce((total, circle) => total + circle.cx);
console.log(t)