2
我是d3.js
的新手。我想了解下面的代碼:d3.interpolate的顯示值
.tween("text", function(d) {
var i = d3.interpolate(this.textContent, d),
prec = (d + "").split("."),
round = (prec.length > 1) ? Math.pow(10, prec[1].length) : 1;
console.log(i);
return function(t) {
this.textContent = Math.round(i(t) * round)/round;
};
});
我想看到的var i
值,所以如果我做console.log(i)
,我得到了一些公式返回。我怎樣才能看到插值?