text: function sunburstDraw(t,e){function n(t){var e=d3.csv.parseRows(t),n=h(e);a(),r(n)}function a(){P.selectAll(".nodePath").remove(),_.selectAll("g").remove()}function r(t){s(t),l()}function i(t){return A(t.name)}function s(t){var e=E.nodes(t).filter(function(t){return t.dx>.005}),n=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t.name)&&e.push(t.name)}),e}(e);A.domain(n);var a=P.data([t]).selectAll("path").data(e).enter().append("path").classed("nodePath",!0).attr("display",function(t){return t.depth?null:"none"}).attr("d",k).attr("fill",i).attr("opacity",1).attr("stroke","white").on("mouseover",o);M.on("click",d),z=a.node().__data__.value}function l(){var t=A.domain().splice(1,A.domain().length),e=_.selectAll("g").data(t).enter().append("g").attr("transform",function(t,e){return"translate(0,"+e*(m.h+m.s)+")"});e.append("rect").classed("legend-pills",!0).attr("rx",m.r).attr("ry",m.r).attr("width",m.w).attr("height",m.h).style("fill",function(t){return A(t)}),e.append("text").classed("legend-text",!0).attr("x",m.w/2).attr("y",m.h/2).attr("dy","0.35em").attr("text-anchor","middle").attr("fill","white").attr("font-size","10px").attr("font-weight",600).text(function(t){return t})}function o(t){var e=(100*t.value/z).toPrecision(3),n=e+"%";1>e&&(n="< 1.0%");var a=p(t);u(a,n),P.selectAll("path").attr("opacity",.3),P.selectAll("path").filter(function(t){return a.indexOf(t)>=0}).attr("opacity",1),q.html("Stage: "+t.depth+"<br /><span class='percentage'>"+n+"</span><br />"+t.value+" of "+z+"<br />"),q.style("visibility",""),O.style("visibility","")}function d(t){P.selectAll("path").on("mouseover",null),P.selectAll("path").transition().duration(1e3).attr("opacity",1).each("end",function(){d3.select(this).on("mouseover",o)}),O.style("visibility","hidden"),q.style("visibility","hidden")}function p(t){for(var e=[],n=t;n.parent;)e.unshift(n),n=n.parent;return e}function c(t,e){var n=[];return n.push("0,0"),n.push(x.w+",0"),n.push(x.w+x.t+","+x.h/2),n.push(x.w+","+x.h),n.push("0,"+x.h),e>0&&n.push(x.t+","+x.h/2),n.join(" ")}function u(t,e){var n=O.selectAll("g").data(t,function(t){return t.name+t.depth}),a=n.enter().append("g");a.append("polygon").classed("breadcrumbs-shape",!0).attr("points",c).attr("fill",i),a.append("text").classed("breadcrumbs-text",!0).attr("x",(x.w+x.t)/2).attr("y",x.h/2).attr("dy","0.35em").attr("font-size","10px").attr("text-anchor","middle").text(function(t){return t.name}),n.attr("transform",function(t,e){return"translate("+e*(x.w+x.s)+", 0)"}),n.exit().remove(),R.attr("x",(t.length+.5)*(x.w+x.s)).attr("y",x.h/2).attr("dy","0.35em").attr("text-anchor","middle").attr("fill","black").attr("font-weight",600).text(e)}function h(t){var e=f(t),n={name:"root",children:[]};return e.forEach(function(t){for(var e=t.nodes,a=parseInt(t.size),r=n,i=0;i<e.length;i++){var s=r.children,l=e[i],o;if(i+1<e.length){for(var d=!1,p=0;p<s.length;p++)if(s[p].name==l){o=s[p],d=!0;break}d||(o={name:l,children:[]},s.push(o)),r=o}else o={name:l,size:a},s.push(o)}}),n}function f(t){var e=[],n=[];return t.sort(function(t,e){return t[2]===e[2]?d3.ascending(t[0],e[0]):d3.ascending(t[1],e[1])}),t.forEach(function(t){var e=t[0];n.indexOf(e)<0&&n.push(e)}),n.forEach(function(n){var a={nodes:[],size:0};t.forEach(function(t){var e=t[2],r=t[3];n===t[0]&&(a.nodes.push(e),a.size=r)}),e.push(a)}),e}t.$watch("data",function(){var e=t.data;n(e)});var y=500,v=350,g=Math.min(y,v)/2,x={w:120,h:30,s:3,t:10},m={w:120,h:25,s:3,r:3},w={top:g,bottom:50,left:g,right:0},b={top:2*g+x.h,bottom:0,left:0,right:g/2},A=d3.scale.category10(),z=0,E=d3.layout.partition().size([2*Math.PI,g*g]).value(function(t){return t.size}),k=d3.svg.arc().startAngle(function(t){return t.x}).endAngle(function(t){return t.x+t.dx}).innerRadius(function(t){return Math.sqrt(t.y)}).outerRadius(function(t){return Math.sqrt(t.y+t.dy)}),M=d3.select(e[0]).append("div").classed("vis-continer",!0).style("position","relative").style("margin-top","20px").style("margin-bottom","20px").style("left","50px").style("height",v+2*x.h+"px"),P=M.append("div").classed("sunburst-container",!0).style("position","absolute").style("left",b.left+"px").append("svg").attr("width",y).attr("height",v).append("g").attr("transform","translate("+w.left+","+w.top+")"),_=M.append("div").classed("legend-container",!0).style("position","absolute").style("top","0px").style("left",2*g+b.right+"px").style("width","50px").style("height","50px").append("svg").attr("width",m.w).attr("height",v),O=M.append("div").classed("breadcrumbs-container",!0).style("position","absolute").style("top",b.top+"px").append("svg").attr("width",y).attr("height",x.h).attr("fill","white").attr("font-weight",600),R=O.append("text").classed("lastCrumb",!0),q=M.append("div").classed("summary-container",!0).style("position","absolute").style("top",.8*g+"px").style("left",b.left+g/2+"px").style("width",g+"px").style("height",g+"px").style("text-align","center").style("font-size","11px").style("color","#666").style("z-index","-1")}