mam taki kod generujacy wykres kołowy:
Kod
var width = 200,
height = 200,
radius = Math.min(width, height) / 2;
var color = d3.scale.ordinal()
.range(["#3075CA", "#406A9D", "#ABBBD9"]);
var arc = d3.svg.arc()
.outerRadius(radius - 10)
.innerRadius(0);
var pie = d3.layout.pie()
.sort(null)
.value(function(d) { return d.ilosc; });
var svg = d3.select("#chart").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
d3.csv("data.php", function(error, data) {
var total = d3.sum(data, function(d){return d.ilosc;});
data.forEach(function(d) {
d.ilosc = +d.ilosc;
});
var g = svg.selectAll(".arc")
.data(pie(data))
.enter().append("g")
.attr("render-order", "-1")
.attr("class", "arc");
g.append("path")
.attr("d", arc)
.style("fill", function(d) { return color(d.data.narzedzie); });
g.append("text")
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; })
.attr("dy", ".35em")
.style("text-anchor", "middle")
.attr("render-order", "1")
.text(function(d) { return d.data.ilosc + "; " + d3.round(100* d.data.ilosc / total, 0) + "%"; });
});
height = 200,
radius = Math.min(width, height) / 2;
var color = d3.scale.ordinal()
.range(["#3075CA", "#406A9D", "#ABBBD9"]);
var arc = d3.svg.arc()
.outerRadius(radius - 10)
.innerRadius(0);
var pie = d3.layout.pie()
.sort(null)
.value(function(d) { return d.ilosc; });
var svg = d3.select("#chart").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
d3.csv("data.php", function(error, data) {
var total = d3.sum(data, function(d){return d.ilosc;});
data.forEach(function(d) {
d.ilosc = +d.ilosc;
});
var g = svg.selectAll(".arc")
.data(pie(data))
.enter().append("g")
.attr("render-order", "-1")
.attr("class", "arc");
g.append("path")
.attr("d", arc)
.style("fill", function(d) { return color(d.data.narzedzie); });
g.append("text")
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; })
.attr("dy", ".35em")
.style("text-anchor", "middle")
.attr("render-order", "1")
.text(function(d) { return d.data.ilosc + "; " + d3.round(100* d.data.ilosc / total, 0) + "%"; });
});
Niestety pomimo użycia "render-order" nie wyświetla mi tekstu na wierzchu, co daje mi taki efekt (jedna liczba jest zupełnie nieczytelna):

Proszę o pomoc w wyświetleniu tekstu na wierzchu