{"size": 3039, "ext": "js", "max_stars_repo_path": "public/app-assets/js/scripts/charts/d3/bar/stacked-to-multiples.min.js", "max_stars_repo_name": "bipinm25/crm", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/app-assets/js/scripts/charts/d3/bar/stacked-to-multiples.min.js", "max_issues_repo_name": "bipinm25/crm", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/app-assets/js/scripts/charts/d3/bar/stacked-to-multiples.min.js", "max_forks_repo_name": "bipinm25/crm", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 3039.0, "max_line_length": 3039, "alphanum_fraction": 0.6702862784}
$(window).on("load",function(){var t=d3.select("#stacked-to-multiples"),a=20,e=20,n=30,r=60,u=t.node().getBoundingClientRect().width-r-e,l=500-a-n,o=d3.time.format("%Y-%m").parse,d=d3.format("02d"),i=d3.scale.ordinal().rangeRoundBands([l,0],.2),s=d3.scale.linear(),c=d3.scale.ordinal().rangeRoundBands([0,u],.1,0),f=d3.svg.axis().scale(c).orient("bottom").tickFormat(function(t){return"Q"+(1+(t.getMonth()/3|0))+d(t.getFullYear()%100)}),g=d3.nest().key(function(t){return t.group}),p=d3.layout.stack().values(function(t){return t.values}).x(function(t){return t.date}).y(function(t){return t.value}).out(function(t,a){t.valueOffset=a}),v=d3.scale.ordinal().range(["#99B898","#FECEA8","#FF847C","#E84A5F"]),m=t.append("svg"),h=m.attr("width",u+r+e).attr("height",l+a+n).append("g").attr("transform","translate("+r+","+a+")");function y(){u=t.node().getBoundingClientRect().width-r-e,m.attr("width",u+r+e),h.attr("width",u+r+e),c.rangeRoundBands([0,u],.1,0),h.selectAll(".d3-xaxis").call(f),h.selectAll(".d3-bar").attr("x",function(t){return c(t.date)}).attr("width",c.rangeBand())}d3.tsv("app-assets/data/d3/bar/stacked-to-multiples.tsv",function(t,a){if(t)throw t;a.forEach(function(t){t.date=o(t.date),t.value=+t.value});var e=g.entries(a);p(e),c.domain(e[0].values.map(function(t){return t.date})),i.domain(e.map(function(t){return t.key})),s.domain([0,d3.max(a,function(t){return t.value})]).range([i.rangeBand(),0]);var n=h.selectAll(".d3-bar-group").data(e).enter().append("g").attr("class","d3-bar-group").attr("transform",function(t){return"translate(0,"+i(t.key)+")"});n.append("text").attr("class","d3-group-label").attr("x",-60).attr("y",function(t){return s(t.values[0].value/2)}).attr("dy",".35em").text(function(t){return"Group "+t.key}),n.selectAll(".d3-bar").data(function(t){return t.values}).enter().append("rect").attr("class","d3-bar").style("fill",function(t){return v(t.group)}).attr("x",function(t){return c(t.date)}).attr("y",function(t){return s(t.value)}).attr("width",c.rangeBand()).attr("height",function(t){return i.rangeBand()-s(t.value)}),n.filter(function(t,a){return!a}).append("g").attr("class","d3-axis d3-xaxis").attr("transform","translate(0,"+i.rangeBand()+")").call(f),d3.selectAll(".smradio").on("change",u);var r=setTimeout(function(){d3.select('input[value="stacked"]').property("checked",!0).each(u)},2e3);function u(){var t,a;clearTimeout(r),"multiples"===this.value?((a=h.transition().duration(750).selectAll(".d3-bar-group").attr("transform",function(t){return"translate(0,"+i(t.key)+")"})).selectAll(".d3-bar").attr("y",function(t){return s(t.value)}),a.select(".d3-group-label").attr("y",function(t){return s(t.values[0].value/2)})):((t=h.transition().duration(750).selectAll(".d3-bar-group").attr("transform","translate(0,"+i(i.domain()[0])+")")).selectAll(".d3-bar").attr("y",function(t){return s(t.value+t.valueOffset)}),t.select(".d3-group-label").attr("y",function(t){return s(t.values[0].value/2+t.values[0].valueOffset)}))}}),$(window).on("resize",y),$(".menu-toggle").on("click",y)});