0
我有三個圓環圖圓環圖與刻度標記線(D3)
VAR數據= [ { 機構:[53245,28479,19697,24037,40245] }, { 機構:[ 45,9,127,37,11]} , { 機構:[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);
}
對於每一個圖表,我需要一個短線和標籤與值每個段,例如這裏
對此有任何簡單的解決方案?
正如[這裏](http://blog.stephenboak.com/2011/08/07/easy-as-a-pie.html)? – 2013-05-08 13:37:18
是的...我在這裏找到了帶有勾線的部分(http://blog.stephenboak.com/js/pie-random.js),但對我不起作用:( – cupakob 2013-05-08 13:52:33
它是如何工作的? – 2013-05-08 14:04:42