in default/home/static/chart.js [85:167]
function pieChart(a) {
var w = 710;
var h = 500;
var radius = 250;
if ('color' in a && 'domain' in a.color && 'range' in a.color && a.color.domain.length > 0) {
a.color = d3.scale.ordinal()
.domain(a.color.domain)
.range(a.color.range);
} else {
a.color = d3.scale.category20();
}
d3.json(a.href, function (error, data) {
if (error) {
showError(a, error);
return;
}
var arc = d3.svg.arc()
.outerRadius(radius - 10)
.innerRadius(76);
var pie = d3.layout.pie()
//.sort(a.sortX)
.value(function (d) { return d.t; });
var svgPie = d3.select(a.div).append("svg")
.attr("id", a.ID)
// .attr("width", "100%")
// .attr("height", "90%")
.attr("viewBox", "0 0 710 500")
.attr("class", "chart")
.append("g")
.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")");
var total = 0;
data.forEach(function (d) { total += d.t });
svgPie.append("a")
.attr("xlink:href", a.list)
.append("text")
.text(function (d) { return total })
.attr("y", 0).attr("x", 0)
.attr("class", "sum")
.attr("text-anchor", "middle")
.attr("alignment-baseline", "central");
var g = svgPie.selectAll(".arc")
.data(pie(data))
.enter().append("g")
.attr("class", "arc");
g.append("svg:title")
.text(function (d) { return (d.data._id ? d.data._id : 'null') + ' = ' + d.data.t });
g.append("a")
.attr("xlink:href", function (d) {
return a.list + "&" + a.key + "=" + (d.data._id ? d.data._id : 'null');
})
.append("path")
.attr("d", arc)
.attr("class", function (d) { return 'icn ' + d.data._id; })
.style("fill", function (d) { return a.color(d.data._id); });
g.filter(function (d) { return d.endAngle - d.startAngle > .2; })
.append("a")
.attr("xlink:href", function (d) {
return a.list + "&" + a.key + "=" + (d.data._id ? d.data._id : 'null');
})
.append("text")
.attr("transform", function (d) {
arc.innerRadius(radius / 2) // Set Outer Coordinate
return "translate(" + arc.centroid(d) + ")";
})
.attr("class", function (d) { return 'icn ' + d.data._id; })
.attr("dy", "1em")
.style("text-anchor", "middle")
.text(function (d) {
return d.data.t + ' ' + d.data._id;
})
});
};