这是我的代码,我花了很多时间在我创建的2个数据之间进行转换:dataset1和dataset2?
var dataset1 = [3,3,7,10];
var dataset2 = [8,7,5,20];
var sel1 = d3.select("body")
.append("svg")
.attr("width","100%")
.attr("height","100%")
var sel2 = sel1.selectAll("rect")
.data(dataset1)
.enter()
.append("rect")
.attr("width",function(d,i){return 40})
.attr("height",function(d,i){return d*10})
.attr("x",function(d,i){return ((i*40)+i)+30})
.attr("y",function(d,i){return 400-(d*10)})
sel1.selectAll("rect")
.data(dataset2)
.tansition()
.duration(300)
.attr("height",function(d,i){return d*10})
.attr("y",function(d,i){return 400-(d*10)})
谁能帮助我更好地使代码变白,非常感谢