この例ではhttp://bl.ocks.org/danielatkin/57ea2f55b79ae686dfc7を使用していますが、円にテキストを追加しようとしています。d3 circleにテキストを追加する
これは、円が作成される方法であると
var nodes = svg.selectAll("circle")
.data(data);
nodes.enter().append("circle")
.attr("class", function (d, i) { return "circle_"+d.sentiment+" circle_"+i})
.attr("cx", function (d) { return d.x; })
.attr("cy", function (d) { return d.x; })
.attr("r", function (d) { return d.radius; })
.style("fill", function (d, i) { return colors['default']; })
.on("mouseover", function (d) { showPopover.call(this, d); })
.on("mouseout", function (d) { removePopovers(this, true); })
.call(pulse, function(d){ return d.radius+4; }, function(d){return d.radius; });
を置いしかし、私はこれらの円にテキストを追加する方法についての手掛かりを得ていないのです。
私はすでにthisとthisと答えていますが、成功できませんでした。問題は、上記の回答に続いて、私の円が対角線に詰まっていることです。
これを行う方法を教えてもらえますか?
私の場合よりもはるかに優れています:) – Cyril
意味がたくさんあります。私がそれを手助けできるかどうか質問したいと思います。私は複数の場所でこれらの泡を作りたいので、泡を作り直すために再利用できるモジュラーコンポーネント/メソッドがどれか分かりたいですか? – void