I am facing problem while drawing the custom pie chart. Please can somebody help me how can I plot following custom pie chart with d3 js.
Here is my code before setting outer radius randomly.
data = [{"label":"1", "value":17},
{"label":"2", "value":18},
{"label":"3", "value":20},
{"label":"4", "value":21}];
var r = 200;
var arc = d3.svg.arc().outerRadius(r).innerRadius(0);
And for displaying text I used :
var arcs = vis.selectAll("g.slice")
.data(pie)
.enter()
.append("svg:g")
.attr("class", "slice");
arcs.append("svg:text")
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")";})
.attr("text-anchor", "middle")
.text(function(d, index) { return data[index].label; });
But after changing the outer radius with
function modifiedRadius(d, index) {
return (data[index].value) * 5;
}
var arc = d3.svg.arc().outerRadius(modifiedRadius).innerRadius(0);
and same code for text then my pie graph is looking like :
"Text disappear !"
please help.