var text = vis.selectAll("text")
.data(words, function(d) { return d.text.toLowerCase(); });
text.enter().append("text")
.attr("text-anchor", "middle")
.attr("transform", function(d) {
return "translate(" + [d.x, d.y] + ")"})
.style("font-size", function(d) { return d.size + "px"; })
var bbox = text.node().getBBox();
如何使用getBBox()獲取每個文本的文本區域?使用getBBox()獲取文本區域
謝謝。這個答案幫助我找到更多關於stackoverflow的信息,並且我使用了text.each(function(d,i))來獲取我需要的所有信息。爲我節省了Google搜索時間:) –