$(window).on("load",(function(){var t=d3.select("#nested-pie"),e={top:20,right:10,bottom:20,left:10};radius=(Math.min(300,300)-2*e)/2;var r=d3.scale.ordinal().range(["#99B898","#FECEA8","#FF847C","#E84A5F","#F8B195","#F67280","#C06C84"]);d3.csv("../../../app-assets/data/d3/pie/flights.csv",(function(n){var a=d3.nest().key((function(t){return t.origin})).entries(n),i=t.selectAll("svg").data(a).enter().append("svg").attr("width",2*(radius+e.left+e.right)).attr("height",2*(radius+e.left+e.right+e.top)).append("g").attr("transform","translate("+(radius+e.left+e.right)+","+(radius+e.left+e.right+e.top)+")"),d=d3.svg.arc().innerRadius(0).outerRadius(radius),s=d3.layout.pie().value((function(t){return+t.count})).sort((function(t,e){return e.count-t.count}));i.append("text").attr("dy",".35em").attr("y",-150).style("text-anchor","middle").style("font-weight",500).text((function(t){return t.key}));var l=i.selectAll("g").data((function(t){return s(t.values)})).enter().append("g").attr("class","d3-arc");l.append("path").attr("d",d).style("stroke","#fff").style("fill",(function(t){return r(t.data.carrier)})).append("title").text((function(t){return t.data.carrier+": "+t.data.count})),l.filter((function(t){return t.endAngle-t.startAngle>.2})).append("text").attr("dy",".35em").attr("transform",(function(t){return"translate("+d.centroid(t)+")rotate("+function(t){var e=90*(t.startAngle+t.endAngle)/Math.PI-90;return e>90?e-180:e}(t)+")"})).style("fill","#fff").style("font-size",12).style("text-anchor","middle").text((function(t){return t.data.carrier}))}))}));