Reputation: 83
I am trying to create split bubble chart.In this i need to show city names on each bubble.So far I am pretty much able achieve this,there is only one problem that I am not able to get radius of the circles when I am adding text.
Here is the complete working fiddle
I am adding text to circles with following code-
circles1.append("text")
.attr("text-anchor", "middle")
.attr("class", "gFontFamily")
.style("font-size", '11px')
.text(function(d, i) {
return d.year;
});
How to get radius of circles?
Upvotes: 1
Views: 556
Reputation: 32327
The radius is already a part of the data, you can get it like this:
circles1.append("text")
.attr("text-anchor", "middle")
.attr("class", "gFontFamily")
.style("font-size", '11px')
.text(function(d, i) {
console.log(d.radius, d.year);
return d.year;
});
working code here
Upvotes: 1