I have three donut charts
var data = [ { institution: [53245, 28479, 19697, 24037, 40245] }, { institution: [45, 9, 127, 37, 11] }, { institution: [3245, 88479, 45697, 1037, 77245] } ]
var width = 100,
height = 100,
radius = Math.min(width, height) / 2;
var color = d3.scale.category20();
for (index = 0; index < data.length; ++index) {
var pie = d3.layout.pie()
.sort(null);
var arc = d3.svg.arc()
.innerRadius(radius - 30)
.outerRadius(radius - 5);
var svg = d3.select("body").append("svg:svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var path = svg.selectAll("path")
.data(pie(data[index].institution))
.enter().append("path")
.attr("fill", function(d, i) { return color(i); })
.attr("d", arc);
}
For each segment in each chart I need a short line and a label with the value, for example here
Is there any simple solution for this?