"+d.value+"
"},m=d3.dispatch("tooltipShow","tooltipHide"),n=a.models.bullet(),o=function(b,c){var c=document.getElementById("chart"),e=b.pos[0]+c.offsetLeft+d.left,f=b.pos[1]+c.offsetTop+d.top,g=""+b.value+"
";a.tooltip.show([e,f],g,b.value<0?"e":"w")};return p.dispatch=m,p.bullet=n,p.orient=function(a){return arguments.length?(b=a,c=b=="right"||b=="bottom",p):b},p.ranges=function(a){return arguments.length?(e=a,p):e},p.markers=function(a){return arguments.length?(f=a,p):f},p.measures=function(a){return arguments.length?(g=a,p):g},p.width=function(a){return arguments.length?(h=a,p):h},p.height=function(a){return arguments.length?(i=a,p):i},p.margin=function(a){return arguments.length?(d=a,p):d},p.tickFormat=function(a){return arguments.length?(j=a,p):j},p.tooltips=function(a){return arguments.length?(k=a,p):k},p.tooltipContent=function(a){return arguments.length?(l=a,p):l},p},a.models.cumulativeLineChart=function(){function y(a,b){}function z(a,b){a.x+=d3.event.dx,a.i=Math.round(n.invert(a.x)),d3.select(this).attr("transform","translate("+n(a.i)+",0)")}function A(a,b){B.update()}function B(a){return a.each(function(j){var y=d3.select(this).classed("chart-"+o,!0),z=this,A=(d||parseInt(y.style("width"))||960)-b.left-b.right,D=(e||parseInt(y.style("height"))||400)-b.top-b.bottom;k=m.xScale(),l=m.yScale(),n.domain([0,j[0].values.length-1]).range([0,A]).clamp(!0);var j=C(u.i,j),E=y.selectAll("g.wrap.cumulativeLine").data([j]),F=E.enter().append("g").attr("class","wrap nvd3 cumulativeLine").append("g");F.append("g").attr("class","x axis"),F.append("g").attr("class","y axis"),F.append("g").attr("class","linesWrap"),F.append("g").attr("class","legendWrap"),F.append("g").attr("class","controlsWrap");var G=E.select("g");f&&(r.width(A),G.select(".legendWrap").datum(j).call(r),b.top!=r.height()&&(b.top=r.height(),D=(e||parseInt(y.style("height"))||400)-b.top-b.bottom),G.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),h&&(s.width(140).color(["#444","#444","#444"]),G.select(".controlsWrap").datum(v).attr("transform","translate(0,"+ -b.top+")").call(s)),m.y(function(a){return a.display.y}).width(A).height(D).color(j.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!j[b].disabled})),G.attr("transform","translate("+b.left+","+b.top+")");var H=G.select(".linesWrap").datum(j.filter(function(a){return!a.disabled}));d3.transition(H).call(m);var I=H.selectAll(".indexLine").data([u]);I.enter().append("rect").attr("class","indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(x),I.attr("transform",function(a){return"translate("+n(a.i)+",0)"}).attr("height",D),p.scale(k).ticks(A/100).tickSize(-D,0),G.select(".x.axis").attr("transform","translate(0,"+l.range()[0]+")"),d3.transition(G.select(".x.axis")).call(p),q.scale(l).ticks(D/36).tickSize(-A,0),d3.transition(G.select(".y.axis")).call(q),s.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,i=!b.disabled,a.transition().call(B)}),r.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,j.filter(function(a){return!a.disabled}).length||j.map(function(a){return a.disabled=!1,E.selectAll(".series").classed("disabled",!1),a}),a.transition().call(B)}),t.on("tooltipShow",function(a){g&&w(a,z.parentNode)})}),B.update=function(){B(a)},B.container=this,B}function C(a,b){return b.map(function(b,c){var d=m.y()(b.values[a],a);return b.values=b.values.map(function(a,b){return a.display={y:(m.y()(a,b)-d)/(1+d)},a}),b})}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=!1,i=!0,j=function(a,b,c,d,e){return""+c+" at "+b+"
"},k,l,m=a.models.line(),n=d3.scale.linear(),o=m.id(),p=a.models.axis().orient("bottom").tickPadding(5),q=a.models.axis().orient("left"),r=a.models.legend().height(30),s=a.models.legend().height(30),t=d3.dispatch("tooltipShow","tooltipHide"),u={i:0,x:0},v=[{key:"Re-scale y-axis"}],w=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=p.tickFormat()(m.x()(b.point)),g=q.tickFormat()(m.y()(b.point)),h=j(b.series.key,f,g,b,B);a.tooltip.show([d,e],h)},x=d3.behavior.drag().on("dragstart",y).on("drag",z).on("dragend",A);return m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),B.dispatch=t,B.legend=r,B.xAxis=p,B.yAxis=q,d3.rebind(B,m,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),B.margin=function(a){return arguments.length?(b=a,B):b},B.width=function(a){return arguments.length?(d=a,B):d},B.height=function(a){return arguments.length?(e=a,B):e},B.color=function(a){return arguments.length?(c=a,r.color(a),B):c},B.showLegend=function(a){return arguments.length?(f=a,B):f},B.tooltips=function(a){return arguments.length?(g=a,B):g},B.tooltipContent=function(a){return arguments.length?(j=a,B):j},B},a.models.discreteBar=function(){function r(d){return d.each(function(s){var t=b-a.left-a.right,u=c-a.top-a.bottom;s=s.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var v=m&&n?[]:s.map(function(a){return a.values.map(function(a,b){return{x:g(a,b),y:h(a,b),y0:a.y0}})});e.domain(m||d3.merge(v).map(function(a){return a.x})).rangeBands([0,t],.1),f.domain(n||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(i))),k?f.range([u-(f.domain()[0]<0?12:0),f.domain()[1]>0?12:0]):f.range([u,0]),p=p||e,q=q||f.copy().range([f(0),f(0)]);var w=d3.select(this).selectAll("g.wrap.discretebar").data([s]),z=w.enter().append("g").attr("class","wrap nvd3 discretebar"),A=z.append("g");A.append("g").attr("class","groups");var B=w.select("g");w.attr("transform","translate("+a.left+","+a.top+")");var C=w.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(C.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),C.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.75);var D=C.selectAll("g.bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+e(g(a,b))+", "+f(0)+")"}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({value:h(a,b),point:a,series:s[a.series],pos:[e(g(a,b))+e.rangeBand()*(a.series+.5)/s.length,f(h(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({value:h(a,b),point:a,series:s[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){o.elementClick({value:h(a,b),point:a,series:s[a.series],pos:[e(g(a,b))+e.rangeBand()*(a.series+.5)/s.length,f(h(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({value:h(a,b),point:a,series:s[a.series],pos:[e(g(a,b))+e.rangeBand()*(a.series+.5)/s.length,f(h(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",e.rangeBand()/s.length).style("fill",function(a,b){return a.color||j[b%j.length]}).style("stroke",function(a,b){return a.color||j[b%j.length]}),k?(E.append("text").attr("text-anchor","middle"),D.selectAll("text").attr("x",e.rangeBand()/2).attr("y",function(a,b){return h(a,b)<0?f(h(a,b))-f(0)+12:-4}).text(function(a,b){return l(h(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}).attr("transform",function(a,b){return"translate("+e(g(a,b))+", "+(h(a,b)<0?q(0):q(h(a,b)))+")"}).selectAll("rect").attr("width",e.rangeBand()/s.length),d3.transition(D).attr("transform",function(a,b){return"translate("+e(g(a,b))+", "+(h(a,b)<0?f(0):f(h(a,b)))+")"}).selectAll("rect").attr("height",function(a,b){return Math.abs(f(h(a,b))-f(0))}),r.update=function(){r(d)},p=e.copy(),q=f.copy()}),r}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=Math.floor(Math.random()*1e4),e=d3.scale.ordinal(),f=d3.scale.linear(),g=function(a){return a.x},h=function(a){return a.y},i=[0],j=d3.scale.category20().range(),k=!1,l=d3.format(",.2f"),m,n,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),p,q;return r.dispatch=o,r.x=function(a){return arguments.length?(g=a,r):g},r.y=function(a){return arguments.length?(h=a,r):h},r.margin=function(b){return arguments.length?(a=b,r):a},r.width=function(a){return arguments.length?(b=a,r):b},r.height=function(a){return arguments.length?(c=a,r):c},r.xScale=function(a){return arguments.length?(e=a,r):e},r.yScale=function(a){return arguments.length?(f=a,r):f},r.xDomain=function(a){return arguments.length?(m=a,r):m},r.yDomain=function(a){return arguments.length?(n=a,r):n},r.forceY=function(a){return arguments.length?(i=a,r):i},r.color=function(a){return arguments.length?(j=a,r):j},r.id=function(a){return arguments.length?(d=a,r):d},r.showValues=function(a){return arguments.length?(k=a,r):k},r.valueFormat=function(a){return arguments.length?(l=a,r):l},r},a.models.discreteBarChart=function(){function r(e){return e.each(function(i){var q=d3.select(this),s=this,t=(c||parseInt(q.style("width"))||960)-b.left-b.right,u=(d||parseInt(q.style("height"))||400)-b.top-b.bottom;j.width(t).height(u);var v=q.selectAll("g.wrap.discreteBarWithAxes").data([i]),w=v.enter().append("g").attr("class","wrap nvd3 discreteBarWithAxes").append("g"),z=w.append("defs");w.append("g").attr("class","x axis"),w.append("g").attr("class","y axis"),w.append("g").attr("class","barsWrap");var A=v.select("g");A.attr("transform","translate("+b.left+","+b.top+")");var B=A.select(".barsWrap").datum(i.filter(function(a){return!a.disabled}));d3.transition(B).call(j),z.append("clipPath").attr("id","x-label-clip-"+j.id()).append("rect"),A.select("#x-label-clip-"+j.id()+" rect").attr("width",k.rangeBand()*(f?2:1)).attr("height",16).attr("x",-k.rangeBand()/(f?1:2)),m.ticks(t/100).tickSize(-u,0),A.select(".x.axis").attr("transform","translate(0,"+(l.range()[0]+(j.showValues()&&l.domain()[0]<0?16:0))+")"),A.select(".x.axis").transition().duration(0).call(m);var C=A.select(".x.axis").selectAll("g");f&&C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"0":"12")+")"}),g&&C.selectAll("text").attr("transform",function(a,b,c){return"rotate("+g+" 0,0)"}).attr("text-anchor","end"),C.selectAll("text").attr("clip-path",function(a,b,c){return g?"":"url(#x-label-clip-"+j.id()+")"}),n.ticks(u/36).tickSize(-t,0),d3.transition(A.select(".y.axis")).call(n),j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],o.tooltipShow(a)}),h&&o.on("tooltipShow",function(a){p(a,s.parentNode)}),j.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),h&&o.on("tooltipHide",a.tooltip.cleanup),r.update=function(){e.transition().call(r)},r.container=this}),r}var b={top:10,right:10,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!1,g=0,h=!0,i=function(a,b,c,d,e){return""+c+"
"},j=a.models.discreteBar(),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("bottom").highlightZero(!1).showMaxMin(!1),n=a.models.axis().scale(l).orient("left"),o=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),h=i(b.series.key,f,g,b,r);a.tooltip.show([d,e],h,b.value<0?"n":"s")},q=[{key:"Grouped"},{key:"Stacked",disabled:!0}];return r.dispatch=o,r.discretebar=j,r.xAxis=m,r.yAxis=n,d3.rebind(r,j,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),r.margin=function(a){return arguments.length?(b=a,r):b},r.width=function(a){return arguments.length?(c=a,r):c},r.height=function(a){return arguments.length?(d=a,r):d},r.color=function(a){return arguments.length?(e=a,j.color(a),r):e},r.staggerLabels=function(a){return arguments.length?(f=a,r):f},r.rotateLabels=function(a){return arguments.length?(g=a,r):g},r.tooltips=function(a){return arguments.length?(h=a,r):h},r.tooltipContent=function(a){return arguments.length?(i=a,r):i},r},a.models.distribution=function(){function j(g){return g.each(function(g){var j=b-(d==="x"?a.left+a.right:a.top+a.bottom),k=d=="x"?"y":"x";i=i||h;var l=d3.select(this).selectAll("g.distribution").data([g]),m=l.enter().append("g").attr("class","nvd3 distribution"),n=m.append("g"),o=l.select("g");l.attr("transform","translate("+a.left+","+a.top+")");var p=o.selectAll("g.dist").data(function(a){return a},function(a){return a.key});p.enter().append("g"),p.attr("class",function(a,b){return"dist series-"+b}).style("stroke",function(a,b){return f[b%f.length]});var q=p.selectAll("line.dist"+d).data(function(a){return a.values});q.enter().append("line").attr(d+"1",function(a,b){return i(e(a,b))}).attr(d+"2",function(a,b){return i(e(a,b))}),d3.transition(p.exit().selectAll("line.dist"+d)).attr(d+"1",function(a,b){return h(e(a,b))}).attr(d+"2",function(a,b){return h(e(a,b))}).style("stroke-opacity",0).remove(),q.attr("class",function(a,b){return"dist"+d+" dist"+d+"-"+b}).attr(k+"1",0).attr(k+"2",c),d3.transition(q).attr(d+"1",function(a,b){return h(e(a,b))}).attr(d+"2",function(a,b){return h(e(a,b))}),i=h.copy()}),j}var a={top:0,right:0,bottom:0,left:0},b=400,c=8,d="x",e=function(a){return a[d]},f=d3.scale.category20().range(),g,h=d3.scale.linear(),i;return j.margin=function(b){return arguments.length?(a=b,j):a},j.width=function(a){return arguments.length?(b=a,j):b},j.axis=function(a){return arguments.length?(d=a,j):d},j.size=function(a){return arguments.length?(c=a,j):c},j.getData=function(a){return arguments.length?(e=d3.functor(a),j):e},j.scale=function(a){return arguments.length?(h=a,j):h},j.color=function(a){return arguments.length?(f=a,j):f},j},a.models.legend=function(){function h(i){return i.each(function(h){var i=b-a.left-a.right,j=d3.select(this).selectAll("g.legend").data([h]),l=j.enter().append("g").attr("class","nvd3 legend").append("g"),m=j.select("g").attr("transform","translate("+a.left+","+a.top+")"),n=m.selectAll(".series").data(function(a){return a}),o=n.enter().append("g").attr("class","series").on("mouseover",function(a,b){g.legendMouseover(a,b)}).on("mouseout",function(a,b){g.legendMouseout(a,b)}).on("click",function(a,b){g.legendClick(a,b)}).on("dblclick",function(a,b){g.legendDblclick(a,b)});o.append("circle").style("fill",function(a,b){return a.color||e[b%e.length]}).style("stroke",function(a,b){return a.color||e[b%e.length]}).style("stroke-width",2).attr("r",5),o.append("text").text(d).attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),n.classed("disabled",function(a){return a.disabled}),n.exit().remove();if(f){var p=[];n.each(function(a,b){p.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var q=0,r=0,s=[];while(ri&&q>1){s=[],q--;for(k=0;ky&&(y=x),"translate("+z+","+w+")"}),m.attr("transform","translate("+(b-a.right-y)+","+a.top+")"),c=a.top+a.bottom+w+15}}),h}var a={top:5,right:0,bottom:5,left:0},b=400,c=20,d=function(a){return a.key},e=d3.scale.category20().range(),f=!0,g=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");return h.dispatch=g,h.margin=function(b){return arguments.length?(a=b,h):a},h.width=function(a){return arguments.length?(b=a,h):b},h.height=function(a){return arguments.length?(c=a,h):c},h.key=function(a){return arguments.length?(d=a,h):d},h.color=function(a){return arguments.length?(e=a,h):e},h.align=function(a){return arguments.length?(f=a,h):f},h},a.models.line=function(){function q -(a){return a.each(function(a){var p=c-b.left-b.right,q=d-b.top-b.bottom,r=d3.select(this);j=m.xScale(),k=m.yScale(),n=n||j,o=o||k;var s=r.selectAll("g.wrap.line").data([a]),t=s.enter().append("g").attr("class","wrap nvd3 line"),u=t.append("defs"),v=t.append("g"),w=s.select("g");v.append("g").attr("class","groups"),v.append("g").attr("class","scatterWrap");var z=s.select(".scatterWrap");m.width(p).height(q),d3.transition(z).call(m),s.attr("transform","translate("+b.left+","+b.top+")"),u.append("clipPath").attr("id","edge-clip-"+f).append("rect"),s.select("#edge-clip-"+f+" rect").attr("width",p).attr("height",q),w.attr("clip-path",i?"url(#edge-clip-"+f+")":""),z.attr("clip-path",i?"url(#edge-clip-"+f+")":"");var A=s.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(A.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return e[b%e.length]}).style("stroke",function(a,b){return e[b%e.length]}),d3.transition(A).style("stroke-opacity",1).style("fill-opacity",.5);var B=A.selectAll("path").data(function(a,b){return[a.values]});B.enter().append("path").attr("class","line").attr("d",d3.svg.line().interpolate(l).x(function(a,b){return n(g(a,b))}).y(function(a,b){return o(h(a,b))})),d3.transition(A.exit().selectAll("path")).attr("d",d3.svg.line().interpolate(l).x(function(a,b){return j(g(a,b))}).y(function(a,b){return k(h(a,b))})),d3.transition(B).attr("d",d3.svg.line().interpolate(l).x(function(a,b){return j(g(a,b))}).y(function(a,b){return k(h(a,b))})),n=j.copy(),o=k.copy()}),q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.category20().range(),f=Math.floor(Math.random()*1e4),g=function(a){return a.x},h=function(a){return a.y},i=!1,j,k,l="linear",m=a.models.scatter().id(f).size(16).sizeDomain([16,256]),n,o,p;return q.dispatch=m.dispatch,d3.rebind(q,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){return arguments.length?(b=a,q):b},q.width=function(a){return arguments.length?(c=a,q):c},q.height=function(a){return arguments.length?(d=a,q):d},q.x=function(a){return arguments.length?(g=a,m.x(a),q):g},q.y=function(a){return arguments.length?(h=a,m.y(a),q):h},q.clipEdge=function(a){return arguments.length?(i=a,q):i},q.color=function(a){return arguments.length?(e=a,m.color(a),q):e},q.id=function(a){return arguments.length?(f=a,q):f},q.interpolate=function(a){return arguments.length?(l=a,q):l},q},a.models.indentedTree=function(){function i(d){return d.each(function(e){function y(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c)return d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&y(a,0,!0)}),!0;if(!B(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),i.update()}function z(a){return a._values&&a._values.length?iconOpen:a.values&&a.values.length?iconClose:""}function A(a){return a._values&&a._values.length}function B(a){var b=a.values||a._values;return b&&b.length}var j=b-a.left-a.right,k=c-a.top-a.bottom;i.update=function(){d.transition().call(i)};var l=0,m=1,n=d3.layout.tree().children(function(a){return a.values}).size([c,childIndent]);e[0].key||(e[0].key=g);var o=n.nodes(e[0]),p=d3.select(this).selectAll("div").data([[o]]),q=p.enter().append("div").attr("class","wrap nvd3 indentedtree"),r=q.append("table"),s=p.select("table").attr("width","100%").attr("class",tableClass);if(f){var t=r.append("thead"),u=t.append("tr");columns.forEach(function(a){u.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var v=s.selectAll("tbody").data(function(a){return a});v.enter().append("tbody"),m=d3.max(o,function(a){return a.depth}),n.size([c,m*childIndent]);var w=v.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++l});w.exit().remove(),w.select("img.treeicon").attr("src",z).classed("folded",A);var x=w.enter().append("tr");columns.forEach(function(a,b){var c=x.append("td").style("padding-left",function(a){return(b?0:a.depth*childIndent+12+(z(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("treeicon",!0).classed("folded",A).attr("src",z).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return z(a)?"inline-block":"none"}).on("click",y),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),w.order().on("click",function(a){h.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){h.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){h.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){h.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})}),i}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.category20().range(),e=Math.floor(Math.random()*1e4),f=!0,g="No Results found.";childIndent=20,columns=[{key:"key",label:"Name",type:"text"}],tableClass=null,iconOpen="images/grey-plus.png",iconClose="images/grey-minus.png";var h=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");return i.margin=function(b){return arguments.length?(a=b,i):a},i.width=function(a){return arguments.length?(b=a,i):b},i.height=function(a){return arguments.length?(c=a,i):c},i.color=function(a){return arguments.length?(d=a,scatter.color(a),i):d},i.id=function(a){return arguments.length?(e=a,i):e},i.header=function(a){return arguments.length?(f=a,i):f},i.noResultsText=function(a){return arguments.length?(g=a,i):g},i.columns=function(a){return arguments.length?(columns=a,i):columns},i.tableClass=function(a){return arguments.length?(tableClass=a,i):tableClass},i.iconOpen=function(a){return arguments.length?(iconOpen=a,i):iconOpen},i.iconClose=function(a){return arguments.length?(iconClose=a,i):iconClose},i},a.models.lineChart=function(){function q(a){return a.each(function(h){var r=d3.select(this),s=this,t=(d||parseInt(r.style("width"))||960)-b.left-b.right,u=(e||parseInt(r.style("height"))||400)-b.top-b.bottom;i=k.xScale(),j=k.yScale();var v=r.selectAll("g.wrap.lineChart").data([h]),w=v.enter().append("g").attr("class","wrap nvd3 lineChart").append("g");w.append("g").attr("class","x axis"),w.append("g").attr("class","y axis"),w.append("g").attr("class","linesWrap"),w.append("g").attr("class","legendWrap");var z=v.select("g");f&&(n.width(t),z.select(".legendWrap").datum(h).call(n),b.top!=n.height()&&(b.top=n.height(),u=(e||parseInt(r.style("height"))||400)-b.top-b.bottom),z.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),k.width(t).height(u).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled})),z.attr("transform","translate("+b.left+","+b.top+")");var A=z.select(".linesWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(A).call(k),l.scale(i).ticks(t/100).tickSize(-u,0),z.select(".x.axis").attr("transform","translate(0,"+j.range()[0]+")"),d3.transition(z.select(".x.axis")).call(l),m.scale(j).ticks(u/36).tickSize(-t,0),d3.transition(z.select(".y.axis")).call(m),n.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){return a.disabled=!1,v.selectAll(".series").classed("disabled",!1),a}),a.transition().call(q)}),o.on("tooltipShow",function(a){g&&p(a,s.parentNode)})}),q.update=function(){q(a)},q.container=this,q}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},i,j,k=a.models.line(),l=a.models.axis().orient("bottom").tickPadding(5),m=a.models.axis().orient("left"),n=a.models.legend().height(30),o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=l.tickFormat()(k.x()(b.point)),g=m.tickFormat()(k.y()(b.point)),i=h(b.series.key,f,g,b,q);a.tooltip.show([d,e],i)};return k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],o.tooltipShow(a)}),k.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),q.dispatch=o,q.legend=n,q.xAxis=l,q.yAxis=m,d3.rebind(q,k,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),q.margin=function(a){return arguments.length?(b=a,q):b},q.width=function(a){return arguments.length?(d=a,q):d},q.height=function(a){return arguments.length?(e=a,q):e},q.color=function(a){return arguments.length?(c=a,n.color(a),q):c},q.showLegend=function(a){return arguments.length?(f=a,q):f},q.tooltips=function(a){return arguments.length?(g=a,q):g},q.tooltipContent=function(a){return arguments.length?(h=a,q):h},q},a.models.linePlusBarChart=function(){function v(j){return j.each(function(o){var w=d3.select(this),y=this,z=(c||parseInt(w.style("width"))||960)-b.left-b.right,A=(d||parseInt(w.style("height"))||400)-b.top-b.bottom,B=o.filter(function(a){return!a.disabled&&a.bar}),C=o.filter(function(a){return!a.disabled&&!a.bar}),D=o.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:e(a,b),y:f(a,b)}})}),E=o.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:e(a,b),y:f(a,b)}})});m.domain(d3.extent(d3.merge(D.concat(E)),function(a){return a.x})).range([0,z]);var F=d3.select(this).selectAll("g.wrap.linePlusBar").data([o]),G=F.enter().append("g").attr("class","wrap nvd3 linePlusBar").append("g");G.append("g").attr("class","x axis"),G.append("g").attr("class","y1 axis"),G.append("g").attr("class","y2 axis"),G.append("g").attr("class","barsWrap"),G.append("g").attr("class","linesWrap"),G.append("g").attr("class","legendWrap");var H=F.select("g");h&&(s.width(z/2),H.select(".legendWrap").datum(o.map(function(a){return a.key=a.key+(a.bar?" (left axis)":" (right axis)"),a})).call(s),b.top!=s.height()&&(b.top=s.height(),A=(d||parseInt(w.style("height"))||400)-b.top-b.bottom),H.select(".legendWrap").attr("transform","translate("+z/2+","+ -b.top+")")),k.width(z).height(A).color(o.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!o[b].disabled&&!o[b].bar})),l.width(z).height(A).color(o.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!o[b].disabled&&o[b].bar}));var I=H.select(".barsWrap").datum(B.length?B:[{values:[]}]),J=H.select(".linesWrap").datum(C.length?C:[{values:[]}]);d3.transition(I).call(l),d3.transition(J).call(k),H.attr("transform","translate("+b.left+","+b.top+")"),p.ticks(z/100).tickSize(-A,0),H.select(".x.axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(H.select(".x.axis")).call(p),q.ticks(A/36).tickSize(-z,0),d3.transition(H.select(".y1.axis")).call(q),r.ticks(A/36).tickSize(B.length?0:-z,0),H.select(".y2.axis").attr("transform","translate("+m.range()[1]+",0)"),d3.transition(H.select(".y2.axis")).call(r),s.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){return a.disabled=!1,F.selectAll(".series").classed("disabled",!1),a}),j.transition().call(v)}),k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),i&&t.on("tooltipShow",function(a){u(a,y.parentNode)}),k.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),i&&t.on("tooltipHide",a.tooltip.cleanup),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),i&&t.on("tooltipShow",function(a){u(a,y.parentNode)}),l.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),i&&t.on("tooltipHide",a.tooltip.cleanup),v.update=function(){j.transition().call(v)},v.container=this}),v}var b={top:30,right:60,bottom:50,left:60},c=null,d=null,e=function(a){return a.x},f=function(a){return a.y},g=d3.scale.category20().range(),h=!0,i=!0,j=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},k=a.models.line(),l=a.models.historicalBar(),m=d3.scale.linear(),n=l.yScale(),o=k.yScale(),p=a.models.axis().scale(m).orient("bottom").tickPadding(5),q=a.models.axis().scale(n).orient("left"),r=a.models.axis().scale(o).orient("right"),s=a.models.legend().height(30),t=d3.dispatch("tooltipShow","tooltipHide"),u=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=p.tickFormat()(k.x()(b.point)),g=q.tickFormat()(k.y()(b.point)),h=j(b.series.key,f,g,b,v);a.tooltip.show([d,e],h,b.value<0?"n":"s")};return v.dispatch=t,v.legend=s,v.lines=k,v.bars=l,v.xAxis=p,v.yAxis1=q,v.yAxis2=r,d3.rebind(v,k,"size","clipVoronoi","interpolate"),v.x=function(a){return arguments.length?(e=a,k.x(a),l.x(a),v):e},v.y=function(a){return arguments.length?(f=a,k.y(a),l.y(a),v):f},v.margin=function(a){return arguments.length?(b=a,v):b},v.width=function(a){return arguments.length?(c=a,v):c},v.height=function(a){return arguments.length?(d=a,v):d},v.color=function(a){return arguments.length?(g=a,s.color(a),v):g},v.showLegend=function(a){return arguments.length?(h=a,v):h},v.tooltips=function(a){return arguments.length?(i=a,v):i},v.tooltipContent=function(a){return arguments.length?(j=a,v):j},v},a.models.lineWithFocusChart=function(){function y(j){return j.each(function(z){function M(a){var b=+(a=="e"),c=b?1:-1,d=E/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function N(){O(),K.call(k),J.select(".focus .x.axis").call(q),J.select(".focus .y.axis").call(r)}function O(){var a=w.empty()?p.domain():d3.extent(d3.merge(z.filter(function(a){return!a.disabled}).map(function(a){return a.values})).filter(function(a){return k.x()(a)>=w.extent()[0]&&k.x()(a)<=w.extent()[1]}),k.y());typeof a[0]=="undefined"&&(a=p.domain()),m.domain(w.empty()?o.domain():w.extent()),n.domain(a),k.xDomain(m.domain()),k.yDomain(n.domain())}var A=d3.select(this),B=this,C=(e||parseInt(A.style("width"))||960)-b.left-b.right,D=(f||parseInt(A.style("height"))||400)-b.top-b.bottom-g,E=g-c.top-c.bottom;w.on("brush",N);var F=A.selectAll("g.wrap.lineWithFocusChart").data([z]),G=F.enter().append("g").attr("class","wrap nvd3 lineWithFocusChart").append("g"),H=G.append("g").attr("class","focus");H.append("g").attr("class","x axis"),H.append("g").attr("class","y axis"),H.append("g").attr("class","linesWrap");var I=G.append("g").attr("class","context");I.append("g").attr("class","x axis"),I.append("g").attr("class","y axis"),I.append("g").attr("class","linesWrap"),I.append("g").attr("class","x brush"),G.append("g").attr("class","legendWrap");var J=F.select("g");h&&(u.width(C),J.select(".legendWrap").datum(z).call(u),b.top!=u.height()&&(b.top=u.height(),D=(f||parseInt(A.style("height"))||400)-b.top-b.bottom),J.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),k.width(C).height(D).color(z.map(function(a,b){return a.color||d[b%d.length]}).filter(function(a,b){return!z[b].disabled})),l.width(C).height(E).x(k.x()).y(k.y()).color(z.map(function(a,b){return a.color||d[b%d.length]}).filter(function(a,b){return!z[b].disabled})),J.attr("transform","translate("+b.left+","+b.top+")");var K=J.select(".focus .linesWrap").datum(z.filter(function(a){return!a.disabled}));d3.transition(K).call(k),q.ticks(C/100).tickSize(-D,0),J.select(".focus .x.axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(J.select(".focus .x.axis")).call(q),r.ticks(D/36).tickSize(-C,0),d3.transition(J.select(".focus .y.axis")).call(r),J.select(".context").attr("transform","translate(0,"+(D+b.bottom+c.top)+")");var L=J.select(".context .linesWrap").datum(z.filter(function(a){return!a.disabled}));d3.transition(L).call(l),gBrush=J.select(".x.brush").call(w),gBrush.selectAll("rect").attr("height",E),gBrush.selectAll(".resize").append("path").attr("d",M),s.tickFormat(q.tickFormat()).ticks(C/100).tickSize(-E,0),J.select(".context .x.axis").attr("transform","translate(0,"+p.range()[0]+")"),d3.transition(J.select(".context .x.axis")).call(s),t.tickFormat(r.tickFormat()).ticks(E/36).tickSize(-C,0),d3.transition(J.select(".context .y.axis")).call(t),O(),u.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,z.filter(function(a){return!a.disabled}).length||z.map(function(a){return a.disabled=!1,F.selectAll(".series").classed("disabled",!1),a}),j.transition().call(y)}),k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],v.tooltipShow(a)}),i&&v.on("tooltipShow",function(a){x(a,B.parentNode)}),k.dispatch.on("elementMouseout.tooltip",function(a){v.tooltipHide(a)}),i&&v.on("tooltipHide",a.tooltip.cleanup)}),y.update=function(){y(j)},y.container=this,y}var b={top:30,right:20,bottom:50,left:60},c={top:0,right:20,bottom:20,left:60},d=d3.scale.category20().range(),e=null,f=null,g=100,h=!0,i=!0,j=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},k=a.models.line().clipEdge(!0),l=a.models.line().interactive(!1),m=k.xScale(),n=k.yScale(),o=l.xScale(),p=l.yScale(),q=a.models.axis().scale(m).orient("bottom").tickPadding(5),r=a.models.axis().scale(n).orient("left"),s=a.models.axis().scale(m).orient("bottom").tickPadding(5),t=a.models.axis().scale(p).orient("left"),u=a.models.legend().height(30),v=d3.dispatch("tooltipShow","tooltipHide"),w=d3.svg.brush().x(o),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=q.tickFormat()(k.x()(b.point)),g=r.tickFormat()(k.y()(b.point)),h=j(b.series.key,f,g,b,y);a.tooltip.show([d,e],h)};return y.dispatch=v,y.legend=u,y.xAxis=q,y.yAxis=r,d3.rebind(y,k,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),y.margin=function(a){return arguments.length?(b=a,y):b},y.width=function(a){return arguments.length?(e=a,y):e},y.height=function(a){return arguments.length?(f=a,y):f},y.color=function(a){return arguments.length?(d=a,u.color(a),y):d},y.showLegend=function(a){return arguments.length?(h=a,y):h},y.tooltips=function(a){return arguments.length?(i=a,y):i},y.tooltipContent=function(a){return arguments.length?(j=a,y):j},y.interpolate=function(a){return arguments.length?(k.interpolate(a),l.interpolate(a),y):k.interpolate()},y},a.models.multiBar=function(){function s(t){return t.each(function(u){var v=b-a.left-a.right,w=c-a.top-a.bottom;q=q||d,r=r||e,k&&(u=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(h)(u)),u=u.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var z=n&&o?[]:u.map(function(a){return a.values.map(function(a,b){return{x:g(a,b),y:h(a,b),y0:a.y0}})});d.domain(d3.merge(z).map(function(a){return a.x})).rangeBands([0,v],.1),e.domain(o||d3.extent(d3.merge(z).map(function(a){return a.y+(k?a.y0:0)}).concat(i))).range([w,0]);var A=d3.select(this).selectAll("g.wrap.multibar").data([u]),B=A.enter().append("g").attr("class","wrap nvd3 multibar"),C=B.append("defs"),D=B.append("g");D.append("g").attr("class","groups");var E=A.select("g");A.attr("transform","translate("+a.left+","+a.top+")"),C.append("clipPath").attr("id","edge-clip-"+f).append("rect"),A.select("#edge-clip-"+f+" rect").attr("width",v).attr("height",w),E.attr("clip-path",j?"url(#edge-clip-"+f+")":"");var F=A.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});F.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(F.exit()).selectAll("rect.bar").delay(function(a,b){return b*m/u[0].values.length}).attr("y",function(a){return k?r(a.y0):r(0)}).attr("height",0).remove(),F.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return l[b%l.length]}).style("stroke",function(a,b){return l[b%l.length]}),d3.transition(F).style("stroke-opacity",1).style("fill-opacity",.75);var G=F.selectAll("rect.bar").data(function(a){return a.values});G.exit().remove();var H=G.enter().append("rect").attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}).attr("x",function(a,b,c){return k?0:c*d.rangeBand()/u.length}).attr("y",function(a){return r(k?a.y0:0)}).attr("height",0).attr("width",d.rangeBand()/(k?1:u.length)).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),p.elementMouseover({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),p.elementMouseout({value:h(a,b),point:a,series:u[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){p.elementClick({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});G.attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}).attr("transform",function(a,b){return"translate("+d(g(a,b))+",0)"}),k?d3.transition(G).delay(function(a,b){return b*m/u[0].values.length}).attr("y",function(a,b){return e(h(a,b)+(k?a.y0:0))}).attr("height",function(a,b){return Math.abs(e(a.y+(k?a.y0:0))-e(k?a.y0:0))}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(a,b){return k?0:a.series*d.rangeBand()/u.length}).attr("width",d.rangeBand()/(k?1:u.length))}):d3.transition(G).delay(function(a,b){return b*m/u[0].values.length}).attr("x",function(a,b){return a.series*d.rangeBand()/u.length}).attr("width",d.rangeBand()/u.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return h(a,b)<0?e(0):e(h(a,b))}).attr("height",function(a,b){return Math.abs(e(h(a,b))-e(0))})}),s.update=function(){s(t)},q=d.copy(),r=e.copy()}),s}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.ordinal(),e=d3.scale.linear(),f=Math.floor(Math.random()*1e4),g=function(a){return a.x},h=function(a){return a.y},i=[0],j=!0,k=!1,l=d3.scale.category20().range(),m=1200,n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q,r;return s.dispatch=p,s.x=function(a){return arguments.length?(g=a,s):g},s.y=function(a){return arguments.length?(h=a,s):h},s.margin=function(b){return arguments.length?(a=b,s):a},s.width=function(a){return arguments.length?(b=a,s):b},s.height=function(a){return arguments.length?(c=a,s):c},s.xScale=function(a){return arguments.length?(d=a,s):d},s.yScale=function(a){return arguments.length?(e=a,s):e},s.xDomain=function(a){return arguments.length?(n=a,s):n},s.yDomain=function(a){return arguments.length?(o=a,s):o},s.forceY=function(a){return arguments.length?(i=a,s):i},s.stacked=function(a){return arguments.length?(k=a,s):k},s.clipEdge=function(a){return arguments.length?(j=a,s):j},s.color=function(a){return arguments.length?(l=a,s):l},s.id=function(a){return arguments.length?(f=a,s):f},s.delay=function(a){return arguments.length?(m=a,s):m},s},a.models.multiBarChart=function(){function t(a){return a.each(function(i){var u=d3.select(this),v=this,w=(c||parseInt(u.style("width"))||960)-b.left-b.right,z=(d||parseInt(u.style("height"))||400)-b.top-b.bottom;j=l.xScale(),k=l.yScale();var A=u.selectAll("g.wrap.multiBarWithLegend").data([i]),B=A.enter().append("g").attr("class","wrap nvd3 multiBarWithLegend").append("g");B.append("g").attr("class","x axis"),B.append("g").attr("class","y axis"),B.append("g").attr("class","barsWrap"),B.append("g").attr("class","legendWrap"),B.append("g").attr("class","controlsWrap");var C=A.select("g");g&&(o.width(w/2),C.select(".legendWrap").datum(i).call(o),b.top!=o.height()&&(b.top=o.height(),z=(d||parseInt(u.style("height"))||400)-b.top-b.bottom),C.select(".legendWrap").attr("transform","translate("+w/2+","+ -b.top+")")),l.width(w).height(z).color(i.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!i[b].disabled})),f&&(p.width(180).color(["#444","#444","#444"]),C.select(".controlsWrap").datum(s).attr("transform","translate(0,"+ -b.top+")").call(p)),C.attr("transform","translate("+b.left+","+b.top+")");var D=C.select(".barsWrap").datum(i.filter(function(a){return!a.disabled}));d3.transition(D).call(l),m.scale(j).ticks(w/100).tickSize(-z,0),C.select(".x.axis").attr("transform","translate(0,"+k.range()[0]+")"),d3.transition(C.select(".x.axis")).call(m);var E=C.select(".x.axis").selectAll("g");E.selectAll("line, text").style("opacity",1),E.filter(function(a,b){return b%Math.ceil(i[0].values.length/(w/100))!==0}).style("opacity",0),n.scale(k).ticks(z/36).tickSize(-w,0),d3.transition(C.select(".y.axis")).call(n),o.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,i.filter(function(a){return!a.disabled}).length||i.map(function(a){return a.disabled=!1,A.selectAll(".series").classed("disabled",!1),a}),a.transition().call(t)}),p.dispatch.on("legendClick",function(b,c){if(!b.disabled)return;s=s.map(function(a){return a.disabled=!0,a}),b.disabled=!1;switch(b.key){case"Grouped":l.stacked(!1);break;case"Stacked":l.stacked(!0)}a.transition().call(t)}),q.on("tooltipShow",function(a){h&&r(a,v.parentNode)}),t.update=function(){a.transition().call(t)},t.container=this}),t}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+a+"
"+""+c+" on "+b+"
"},j,k,l=a.models.multiBar().stacked(!1),m=a.models.axis().orient("bottom").highlightZero(!1),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var r=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(l.x()(b.point)),g=n.tickFormat()(l.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")},s=[{key:"Grouped",disabled:l.stacked},{key:"Stacked",disabled:!l.stacked}];return l.dispatch.on("elementMouseover.tooltip2",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),l.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),q.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),t.dispatch=q,t.legend=o,t.xAxis=m,t.yAxis=n,d3.rebind(t,l,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t},a.models.multiBarHorizontal=function(){function v(d){return d.each(function(p){var w=b-a.left-a.right,z=c-a.top-a.bottom;l&&(p=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(h)(p)),p=p.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var A=q&&r?[]:p.map(function(a){return a.values.map(function(a,b){return{x:g(a,b),y:h(a,b),y0:a.y0}})});e.domain(q||d3.merge(A).map(function(a){return a.x})).rangeBands([0,z],.1),f.domain(r||d3.extent(d3.merge(A).map(function(a){return a.y+(l?a.y0:0)}).concat(i))),m&&!l?f.range([f.domain()[0]<0?n:0,w-(f.domain()[1]>0?n:0)]):f.range([0,w]),s=s||e,t=t||d3.scale.linear().domain(f.domain()).range([f(0),f(0)]);var B=d3.select(this).selectAll("g.wrap.multibarHorizontal").data([p]),C=B.enter().append("g").attr("class","wrap nvd3 multibarHorizontal"),D=C.append("defs"),E=C.append("g");E.append("g").attr("class","groups");var F=B.select("g");B.attr("transform","translate("+a.left+","+a.top+")");var G=B.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(G.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),G.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k[b%k.length]}).style("stroke",function(a,b){return k[b%k.length]}),d3.transition(G).style("stroke-opacity",1).style("fill-opacity",.75);var H=G.selectAll("g.bar").data(function(a){return a.values});H.exit().remove();var I=H.enter().append("g").attr("transform",function(a,b,c){return"translate("+t(l?a.y0:0)+","+(l?0:c*e.rangeBand()/p.length+e(g(a,b)))+")"}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),u.elementMouseover({value:h(a,b),point:a,series:p[a.series],pos:[f(h(a,b)+(l?a.y0:0)),e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),u.elementMouseout({value:h(a,b),point:a,series:p[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){u.elementClick({value:h(a,b),point:a,series:p[a.series],pos:[e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length,f(h(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){u.elementDblClick({value:h(a,b),point:a,series:p[a.series],pos:[e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length,f(h(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});I.append("rect").attr("width",0).attr("height",e.rangeBand()/(l?1:p.length)),m&&!l?(I.append("text").attr("text-anchor",function(a,b){return h(a,b)<0?"end":"start"}),H.selectAll("text").attr("y",e.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(h(a,b))}),d3.transition(H).selectAll("text").attr("x",function(a,b){return h(a,b)<0?-4:f(h(a,b))-f(0)+4})):H.selectAll("text").remove(),H.attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}),l?d3.transition(H).attr("transform",function(a,b){return"translate("+f(a.y0)+","+(l?0:j*e.rangeBand()/p.length)+")"}).selectAll("rect").attr("width",function(a,b){return Math.abs(f(h(a,b)+a.y0)-f(a.y0))}).attr("height",e.rangeBand()):d3.transition(H).attr("transform",function(a,b){return"translate("+(h(a,b)<0?f(h(a,b)):f(0))+","+(a.series*e.rangeBand()/p.length+e(g(a,b)))+")"}).selectAll("rect").attr("height",e.rangeBand()/p.length).attr("width",function(a,b){return Math.abs(f(h(a,b))-f(0))}),v.update=function(){d.transition().call(v)},s=e.copy(),t=f.copy()}),v}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=Math.floor(Math.random()*1e4),e=d3.scale.ordinal(),f=d3.scale.linear(),g=function(a){return a.x},h=function(a){return a.y},i=[0],k=d3.scale.category20().range(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s,t,u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return v.dispatch=u,v.x=function(a){return arguments.length?(g=a,v):g},v.y=function(a){return arguments.length?(h=a,v):h},v.margin=function(b){return arguments.length?(a=b,v):a},v.width=function(a){return arguments.length?(b=a,v):b},v.height=function(a){return arguments.length?(c=a,v):c},v.xScale=function(a){return arguments.length?(e=a,v):e},v.yScale=function(a){return arguments.length?(f=a,v):f},v.xDomain=function(a){return arguments.length?(q=a,v):q},v.yDomain=function(a){return arguments.length?(r=a,v):r},v.forceY=function(a){return arguments.length?(i=a,v):i},v.stacked=function(a){return arguments.length?(l=a,v):l},v.color=function(a){return arguments.length?(k=a,v):k},v.id=function(a){return arguments.length?(d=a,v):d},v.delay=function(a){return arguments.length?(p=a,v):p},v.showValues=function(a){return arguments.length?(m=a,v):m},v.valueFormat=function(a){return arguments -.length?(o=a,v):o},v.valuePadding=function(a){return arguments.length?(n=a,v):n},v},a.models.multiBarHorizontalChart=function(){function t(i){return i.each(function(k){var l=d3.select(this),u=this,v=(c||parseInt(l.style("width"))||960)-b.left-b.right,w=(d||parseInt(l.style("height"))||400)-b.top-b.bottom,x=l.selectAll("g.wrap.multiBarHorizontalChart").data([k]),y=x.enter().append("g").attr("class","wrap nvd3 multiBarHorizontalChart").append("g");y.append("g").attr("class","x axis"),y.append("g").attr("class","y axis"),y.append("g").attr("class","barsWrap"),y.append("g").attr("class","legendWrap"),y.append("g").attr("class","controlsWrap"),b.top=o.height();var z=x.select("g");g&&(o.width(v/2),z.select(".legendWrap").datum(k).call(o),b.top!=o.height()&&(b.top=o.height(),w=(d||parseInt(l.style("height"))||400)-b.top-b.bottom),z.select(".legendWrap").attr("transform","translate("+v/2+","+ -b.top+")")),j.width(v).height(w).color(k.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!k[b].disabled})),f&&(p.width(180).color(["#444","#444","#444"]),z.select(".controlsWrap").datum(s).attr("transform","translate(0,"+ -b.top+")").call(p)),z.attr("transform","translate("+b.left+","+b.top+")");var A=z.select(".barsWrap").datum(k.filter(function(a){return!a.disabled}));d3.transition(A).call(j),m.ticks(w/24).tickSize(-v,0),z.select(".x.axis").transition().duration(0).call(m);var B=z.select(".x.axis").selectAll("g");B.selectAll("line, text").style("opacity",1),n.ticks(v/100).tickSize(-w,0),z.select(".y.axis").attr("transform","translate(0,"+w+")"),d3.transition(z.select(".y.axis")).call(n),o.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){return a.disabled=!1,x.selectAll(".series").classed("disabled",!1),a}),i.transition().call(t)}),p.dispatch.on("legendClick",function(a,b){if(!a.disabled)return;s=s.map(function(a){return a.disabled=!0,a}),a.disabled=!1;switch(a.key){case"Grouped":j.stacked(!1);break;case"Stacked":j.stacked(!0)}i.transition().call(t)}),j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),h&&q.on("tooltipShow",function(a){r(a,u.parentNode)}),j.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),h&&q.on("tooltipHide",a.tooltip.cleanup),t.update=function(){i.transition().call(t)},t.container=this}),t}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+b+"
"+""+c+"
"},j=a.models.multiBarHorizontal().stacked(!1),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("left").highlightZero(!1).showMaxMin(!1),n=a.models.axis().scale(l).orient("bottom"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var r=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"e":"w")},s=[{key:"Grouped"},{key:"Stacked",disabled:!0}];return t.dispatch=q,t.multibar=j,t.legend=o,t.xAxis=m,t.yAxis=n,d3.rebind(t,j,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t},a.models.pie=function(){function n(i){return i.each(function(i){function A(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}function B(a){l||(a.innerRadius=0);var b=d3.interpolate(this._current,a);return this._current=b(0),function(a){return v(b(a))}}function C(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return v(b(a))}}var n=b-a.left-a.right,o=c-a.top-a.bottom,p=Math.min(n,o)/2,q=d3.select(this).on("click",function(a,b){m.chartClick({data:a,index:b,pos:d3.event,id:g})}),r=q.selectAll(".wrap.pie").data([d(i[0])]),s=r.enter().append("g").attr("class","wrap nvd3 pie chart-"+g),t=s.append("g"),u=r.select("g");t.append("g").attr("class","pie"),r.attr("transform","translate("+a.left+","+a.top+")"),u.select(".pie").attr("transform","translate("+n/2+","+o/2+")");var v=d3.svg.arc().outerRadius(p-p/5);l&&v.innerRadius(p/2);var w=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:f(a)}),x=r.select(".pie").selectAll(".slice").data(w);x.exit().remove();var y=x.enter().append("svg:g").attr("class","slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),m.elementMouseover({label:e(a.data),value:f(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:g})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),m.elementMouseout({label:e(a.data),value:f(a.data),point:a.data,index:b,id:g})}).on("click",function(a,b){m.elementClick({label:e(a.data),value:f(a.data),point:a.data,index:b,pos:d3.event,id:g}),d3.event.stopPropagation()}).on("dblclick",function(a,b){m.elementDblClick({label:e(a.data),value:f(a.data),point:a.data,index:b,pos:d3.event,id:g}),d3.event.stopPropagation()});x.attr("fill",function(a,b){return h[b]}).attr("stroke",function(a,b){return h[b]});var z=y.append("svg:path").each(function(a){this._current=a});d3.transition(x.select("path")).attr("d",v).attrTween("d",B),j&&(y.append("text").attr("transform",function(a){return a.outerRadius=p+10,a.innerRadius=p+15,"translate("+v.centroid(a)+")"}).style("text-anchor","middle").style("fill","#000"),d3.transition(x.select("text")).attr("transform",function(a){return a.outerRadius=p+10,a.innerRadius=p+15,"translate("+v.centroid(a)+")"}).text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>k?e(a.data):""}))}),n}var a={top:0,right:0,bottom:0,left:0},b=500,c=500,d=function(a){return a.values},e=function(a){return a.x},f=function(a){return a.y},g=Math.floor(Math.random()*1e4),h=d3.scale.category20().range(),i=d3.format(",.2f"),j=!0,k=.02,l=!1,m=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return n.dispatch=m,n.margin=function(b){return arguments.length?(a=b,n):a},n.width=function(a){return arguments.length?(b=a,n):b},n.height=function(a){return arguments.length?(c=a,n):c},n.values=function(a){return arguments.length?(d=a,n):d},n.x=function(a){return arguments.length?(e=a,n):e},n.y=function(a){return arguments.length?(f=d3.functor(a),n):f},n.showLabels=function(a){return arguments.length?(j=a,n):j},n.donut=function(a){return arguments.length?(l=a,n):l},n.id=function(a){return arguments.length?(g=a,n):g},n.color=function(a){return arguments.length?(h=a,n):h},n.valueFormat=function(a){return arguments.length?(i=a,n):i},n.labelThreshold=function(a){return arguments.length?(k=a,n):k},n},a.models.pieChart=function(){function m(f){return f.each(function(h){var n=d3.select(this),o=this,p=(c||parseInt(n.style("width"))||960)-b.left-b.right,q=(d||parseInt(n.style("height"))||400)-b.top-b.bottom,r=n.selectAll("g.wrap.pieChart").data([h]),s=r.enter().append("g").attr("class","wrap nvd3 pieChart").append("g");s.append("g").attr("class","pieWrap"),s.append("g").attr("class","legendWrap");var t=r.select("g");e&&(j.width(p).key(i.x()),r.select(".legendWrap").datum(i.values()(h[0])).call(j),b.top!=j.height()&&(b.top=j.height(),q=(d||parseInt(n.style("height"))||400)-b.top-b.bottom),r.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),i.width(p).height(q),t.attr("transform","translate("+b.left+","+b.top+")");var u=t.select(".pieWrap").datum(h);d3.transition(u).call(i),j.dispatch.on("legendClick",function(a,b,c){a.disabled=!a.disabled,i.values()(h[0]).filter(function(a){return!a.disabled}).length||i.values()(h[0]).map(function(a){return a.disabled=!1,r.selectAll(".series").classed("disabled",!1),a}),f.transition().call(m)}),i.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],k.tooltipShow(a)}),g&&k.on("tooltipShow",function(a){l(a)}),i.dispatch.on("elementMouseout.tooltip",function(a){k.tooltipHide(a)}),g&&k.on("tooltipHide",a.tooltip.cleanup),m.update=function(){f.transition().call(m)},m.container=this}),m}var b={top:30,right:20,bottom:20,left:20},c=null,d=null,e=!0,f=d3.scale.category20().range(),g=!0,h=function(a,b,c,d){return""+a+"
"+""+b+"
"},i=a.models.pie(),j=a.models.legend().height(30),k=d3.dispatch("tooltipShow","tooltipHide"),l=function(b,c){var d=b.pos[0]+(c&&c.offsetLeft||0),e=b.pos[1]+(c&&c.offsetTop||0),f=i.valueFormat()(i.y()(b.point)),g=h(i.x()(b.point),f,b,m);a.tooltip.show([d,e],g,b.value<0?"n":"s")};return m.dispatch=k,m.pie=i,d3.rebind(m,i,"values","x","y","id","showLabels","donut","labelThreshold"),m.margin=function(a){return arguments.length?(b=a,m):b},m.width=function(a){return arguments.length?(c=a,m):c},m.height=function(a){return arguments.length?(d=a,m):d},m.color=function(a){return arguments.length?(f=a,j.color(a),i.color(a),m):f},m.tooltips=function(a){return arguments.length?(g=a,m):g},m.tooltipContent=function(a){return arguments.length?(h=a,m):h},m},a.models.scatter=function(){function C(D){return D.each(function(C){function M(){if(!p)return!1;var b=d3.merge(C.map(function(a,b){return a.values.filter(q).map(function(a,c){return[f(i(a,c))*(Math.random()/1e12+1),g(j(a,c))*(Math.random()/1e12+1),b,c]})}));if(s){J.append("clipPath").attr("id","points-clip-"+e);var c=H.select("#points-clip-"+e).selectAll("circle").data(b);c.enter().append("circle").attr("r",t),c.exit().remove(),c.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),H.select(".point-paths").attr("clip-path","url(#points-clip-"+e+")")}var d=d3.geom.voronoi(b).map(function(a,c){return{data:a,series:b[c][2],point:b[c][3]}}),h=H.select(".point-paths").selectAll("path").data(d);h.enter().append("path").attr("class",function(a,b){return"path-"+b}),h.exit().remove(),h.attr("d",function(a){return"M"+a.data.join(",")+"Z"}).on("click",function(b){var c=C[b.series],d=c.values[b.point];x.elementClick({point:d,series:c,pos:[f(i(d,b.point))+a.left,g(j(d,b.point))+a.top],seriesIndex:b.series,pointIndex:b.point})}).on("mouseover",function(b){var c=C[b.series],d=c.values[b.point];x.elementMouseover({point:d,series:c,pos:[f(i(d,b.point))+a.left,g(j(d,b.point))+a.top],seriesIndex:b.series,pointIndex:b.point})}).on("mouseout",function(a,b){var c=C[a.series],d=c.values[a.point];x.elementMouseout({point:d,series:c,seriesIndex:a.series,pointIndex:a.point})})}var D=b-a.left-a.right,E=c-a.top-a.bottom,F=d3.select(this);C=C.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var G=u&&v&&w?[]:d3.merge(C.map(function(a){return a.values.map(function(a,b){return{x:i(a,b),y:j(a,b),size:k(a,b)}})}));f.domain(u||d3.extent(G.map(function(a){return a.x}).concat(m))).range([0,D]),g.domain(v||d3.extent(G.map(function(a){return a.y}).concat(n))).range([E,0]),h.domain(w||d3.extent(G.map(function(a){return a.size}).concat(o))).range([16,256]),y=y||f,z=z||g,A=A||h;var H=F.selectAll("g.wrap.scatter").data([C]),I=H.enter().append("g").attr("class","wrap nvd3 scatter chart-"+e),J=I.append("defs"),K=I.append("g"),L=H.select("g");K.append("g").attr("class","groups"),K.append("g").attr("class","point-paths"),H.attr("transform","translate("+a.left+","+a.top+")"),J.append("clipPath").attr("id","edge-clip-"+e).append("rect"),H.select("#edge-clip-"+e+" rect").attr("width",D).attr("height",E),L.attr("clip-path",r?"url(#edge-clip-"+e+")":"");var N=H.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});N.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(N.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),N.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(N).style("fill",function(a,b){return d[b%d.length]}).style("stroke",function(a,b){return d[b%d.length]}).style("stroke-opacity",1).style("fill-opacity",.5);var O=N.selectAll("path.point").data(function(a){return a.values});O.enter().append("path").attr("transform",function(a,b){return"translate("+y(i(a,b))+","+z(j(a,b))+")"}).attr("d",d3.svg.symbol().type(l).size(function(a,b){return h(k(a,b))})),d3.transition(N.exit().selectAll("path.point")).attr("transform",function(a,b){return"translate("+f(i(a,b))+","+g(j(a,b))+")"}).remove(),O.attr("class",function(a,b){return"point point-"+b}),d3.transition(O).attr("transform",function(a,b){return"translate("+f(i(a,b))+","+g(j(a,b))+")"}).attr("d",d3.svg.symbol().type(l).size(function(a,b){return h(k(a,b))})),clearTimeout(B),B=setTimeout(M,1e3),y=f.copy(),z=g.copy(),A=h.copy()}),C}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.category20().range(),e=Math.floor(Math.random()*1e5),f=d3.scale.linear(),g=d3.scale.linear(),h=d3.scale.linear(),i=function(a){return a.x},j=function(a){return a.y},k=function(a){return a.size},l=function(a){return a.shape||"circle"},m=[],n=[],o=[],p=!0,q=function(a){return!a.notActive},r=!1,s=!0,t=function(){return 25},u=null,v=null,w=null,x=d3.dispatch("elementClick","elementMouseover","elementMouseout"),y,z,A,B;return x.on("elementMouseover.point",function(a){p&&d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!0)}),x.on("elementMouseout.point",function(a){p&&d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!1)}),C.dispatch=x,C.x=function(a){return arguments.length?(i=d3.functor(a),C):i},C.y=function(a){return arguments.length?(j=d3.functor(a),C):j},C.size=function(a){return arguments.length?(k=d3.functor(a),C):k},C.margin=function(b){return arguments.length?(a=b,C):a},C.width=function(a){return arguments.length?(b=a,C):b},C.height=function(a){return arguments.length?(c=a,C):c},C.xScale=function(a){return arguments.length?(f=a,C):f},C.yScale=function(a){return arguments.length?(g=a,C):g},C.zScale=function(a){return arguments.length?(h=a,C):h},C.xDomain=function(a){return arguments.length?(u=a,C):u},C.yDomain=function(a){return arguments.length?(v=a,C):v},C.sizeDomain=function(a){return arguments.length?(w=a,C):w},C.forceX=function(a){return arguments.length?(m=a,C):m},C.forceY=function(a){return arguments.length?(n=a,C):n},C.forceSize=function(a){return arguments.length?(o=a,C):o},C.interactive=function(a){return arguments.length?(p=a,C):p},C.pointActive=function(a){return arguments.length?(q=a,C):q},C.clipEdge=function(a){return arguments.length?(r=a,C):r},C.clipVoronoi=function(a){return arguments.length?(s=a,C):s},C.clipRadius=function(a){return arguments.length?(t=a,C):t},C.color=function(a){return arguments.length?(d=a,C):d},C.shape=function(a){return arguments.length?(l=a,C):l},C.id=function(a){return arguments.length?(e=a,C):e},C},a.models.scatterChart=function(){function D(a){return a.each(function(h){function I(){if(m)return H.select(".point-paths").style("pointer-events","all"),!1;H.select(".point-paths").style("pointer-events","none");var a=d3.mouse(this);f.distortion(l).focus(a[0]),g.distortion(l).focus(a[1]),H.select(".scatterWrap").datum(h.filter(function(a){return!a.disabled})).call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t),H.select(".distributionX").datum(h.filter(function(a){return!a.disabled})).call(w),H.select(".distributionY").datum(h.filter(function(a){return!a.disabled})).call(x)}var i=d3.select(this),o=this,p=(c||parseInt(i.style("width"))||960)-b.left-b.right,q=(d||parseInt(i.style("height"))||400)-b.top-b.bottom;f=r.xScale(),g=r.yScale(),z=z||f,A=A||g;var E=i.selectAll("g.wrap.scatterChart").data([h]),F=E.enter().append("g").attr("class","wrap nvd3 scatterChart chart-"+r.id()),G=F.append("g"),H=E.select("g");G.append("rect").attr("class","nvd3 background"),G.append("g").attr("class","x axis"),G.append("g").attr("class","y axis"),G.append("g").attr("class","scatterWrap"),G.append("g").attr("class","distWrap"),G.append("g").attr("class","legendWrap"),G.append("g").attr("class","controlsWrap"),E.attr("transform","translate("+b.left+","+b.top+")"),j&&(u.width(p/2),E.select(".legendWrap").datum(h).call(u),b.top!=u.height()&&(b.top=u.height(),q=(d||parseInt(i.style("height"))||400)-b.top-b.bottom),E.select(".legendWrap").attr("transform","translate("+p/2+","+ -b.top+")")),k&&(v.width(180).color(["#444"]),H.select(".controlsWrap").datum(C).attr("transform","translate(0,"+ -b.top+")").call(v)),H.select(".background").attr("width",p).attr("height",q),r.width(p).height(q).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),E.select(".scatterWrap").datum(h.filter(function(a){return!a.disabled})).call(r),s.scale(f).ticks(p/100).tickSize(-q,0),H.select(".x.axis").attr("transform","translate(0,"+g.range()[0]+")").call(s),t.scale(g).ticks(q/36).tickSize(-p,0),H.select(".y.axis").call(t),w.scale(f).width(p).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionX").attr("transform","translate(0,"+g.range()[0]+")"),H.select(".distributionX").datum(h.filter(function(a){return!a.disabled})).call(w),x.scale(g).width(q).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionY").attr("transform","translate(-"+x.size()+",0)"),H.select(".distributionY").datum(h.filter(function(a){return!a.disabled})).call(x),H.select(".background").on("mousemove",I),H.select(".background").on("click",function(){m=!m}),H.select(".point-paths").on("click",function(){m=!m}),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l=b.disabled?0:2.5,H.select(".background").style("pointer-events",b.disabled?"none":"all"),H.select(".point-paths").style("pointer-events",b.disabled?"all":"none"),b.disabled?(f.distortion(l).focus(0),g.distortion(l).focus(0),H.select(".scatterWrap").call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t)):m=!1,D(a)}),u.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){return a.disabled=!1,E.selectAll(".series").classed("disabled",!1),a}),D(a)}),r.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .distx-"+a.pointIndex).attr("y1",a.pos[1]-q),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .disty-"+a.pointIndex).attr("x2",a.pos[0]+w.size()),a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){n&&B(a,o.parentNode)}),z=f.copy(),A=g.copy(),D.update=function(){D(a)},D.container=this}),D}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=d3.fisheye.scale(d3.scale.linear).distortion(0),g=d3.fisheye.scale(d3.scale.linear).distortion(0),h=!1,i=!1,j=!0,k=!0,l=0,m=!1,n=!0,o=function(a,b,c){return""+b+""},p=function(a,b,c){return""+c+""},q=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},r=a.models.scatter().xScale(f).yScale(g),s=a.models.axis().orient("bottom").tickPadding(10),t=a.models.axis().orient("left").tickPadding(10),u=a.models.legend().height(30),v=a.models.legend().height(30),w=a.models.distribution().axis("x"),x=a.models.distribution().axis("y"),y=d3.dispatch("tooltipShow","tooltipHide"),z,A,B=function(c,d){var e=c.pos[0]+(d.offsetLeft||0),h=g.range()[0]+b.top+(d.offsetTop||0),i=f.range()[0]+b.left+(d.offsetLeft||0),j=c.pos[1]+(d.offsetTop||0),k=s.tickFormat()(r.x()(c.point)),l=t.tickFormat()(r.y()(c.point)),m=o(c.series.key,k,l,c,D),n=p(c.series.key,k,l,c,D);a.tooltip.show([e,h],m,"n",1),a.tooltip.show([i,j],n,"e",1)},C=[{key:"Magnify",disabled:!0}];return r.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .distx-"+a.pointIndex).attr("y1",0),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .disty-"+a.pointIndex).attr("x2",x.size())}),y.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),D.dispatch=y,D.legend=u,D.controls=u,D.xAxis=s,D.yAxis=t,D.distX=w,D.distY=x,d3.rebind(D,r,"id","interactive","pointActive","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),D.margin=function(a){return arguments.length?(b=a,D):b},D.width=function(a){return arguments.length?(c=a,D):c},D.height=function(a){return arguments.length?(d=a,D):d},D.color=function(a){return arguments.length?(e=a,u.color(a),w.color(a),x.color(a),D):e},D.showDistX=function(a){return arguments.length?(h=a,D):h},D.showDistY=function(a){return arguments.length?(i=a,D):i},D.showControls=function(a){return arguments.length?(k=a,D):k},D.showLegend=function(a){return arguments.length?(j=a,D):j},D.fisheye=function(a){return arguments.length?(l=a,D):l},D.tooltips=function(a){return arguments.length?(n=a,D):n},D.tooltipContent=function(a){return arguments.length?(q=a,D):q},D.tooltipXContent=function(a){return arguments.length?(o=a,D):o},D.tooltipYContent=function(a){return arguments.length?(p=a,D):p},D},a.models.sparkline=function(){function l(d){return d.each(function(d){var l=b-a.left-a.right,m=c-a.top-a.bottom;j.domain(h||d3.extent(d,e)).range([0,l]),k.domain(i||d3.extent(d,f)).range([m,0]);var n=d3.select(this).selectAll("g.sparkline").data([d]),o=n.enter().append("g").attr("class","nvd3 sparkline");o.attr("transform","translate("+a.left+","+a.top+")").style("stroke",function(a,b){return a.color||g[b*g.length]});var p=o.selectAll("path").data(function(a){return[a]});p.enter().append("path"),p.exit().remove(),p.attr("d",d3.svg.line().x(function(a,b){return j(e(a,b))}).y(function(a,b){return k(f(a,b))}));var q=o.selectAll("circle.point").data(function(a){return a.filter(function(a,b){return k.domain().indexOf(f(a,b))!=-1||e(a,b)==j.domain()[1]})});q.enter().append("circle").attr("class","point"),q.exit().remove(),q.attr("cx",function(a,b){return j(e(a,b))}).attr("cy",function(a,b){return k(f(a,b))}).attr("r",2).style("stroke",function(a,b){return a.x==j.domain()[1]?"#444":a.y==k.domain()[0]?"#d62728":"#2ca02c"}).style("fill",function(a,b){return a.x==j.domain()[1]?"#444":a.y==k.domain()[0]?"#d62728":"#2ca02c"})}),l}var a={top:0,right:0,bottom:0,left:0},b=400,c=32,d=!0,e=function(a){return a.x},f=function(a){return a.y},g=d3.scale.category20().range(),h,i,j=d3.scale.linear(),k=d3.scale.linear();return l.margin=function(b){return arguments.length?(a=b,l):a},l.width=function(a){return arguments.length?(b=a,l):b},l.height=function(a){return arguments.length?(c=a,l):c},l.x=function(a){return arguments.length?(e=d3.functor(a),l):e},l.y=function(a){return arguments.length?(f=d3.functor(a),l):f},l.xDomain=function(a){return arguments.length?(h=a,l):h},l.yDomain=function(a){return arguments.length?(i=a,l):i},l.animate=function(a){return arguments.length?(d=a,l):d},l},a.models.sparklinePlus=function(){function o(a){return a.each(function(a){function w(){var c=d3.event.offsetX-b.left;t.attr("x1",c).attr("x2",c),u.attr("transform",function(a){return"translate("+(c-6)+","+ -b.top+")"}).text(j(Math.round(l.invert(c)))),v.attr("transform",function(a){return"translate("+(c+6)+","+ -b.top+")"}).text(k(g(a[Math.round(l.invert(c))])))}var e=c-b.left-b.right,i=d-b.top-b.bottom;l.domain(d3.extent(a,f)).range([0,e]),m.domain(d3.extent(a,g)).range([i,0]);var o=d3.select(this).selectAll("g.sparklineplus").data([a]),p=o.enter().append("g"),q=p.append("g").attr("class","nvd3 sparklineplus").attr("transform","translate("+b.left+","+b.top+")").style("stroke",function(a,b){return a.color||h[b%h.length]});n.xDomain(l.domain()).yDomain(m.domain()),q.call(n);var r=q.append("g").attr("class","hoverValue"),s=q.append("g").attr("class","hoverArea");r.attr("transform",function(a){return"translate("+l(a)+",0)"});var t=r.append("line").attr("x1",l.range()[1]).attr("y1",-b.top).attr("x2",l.range()[1]).attr("y2",d),u=r.append("text").attr("class","xValue").attr("text-anchor","end").attr("dy",".9em"),v=r.append("text").attr("class","yValue").attr("text-anchor","start").attr("dy",".9em");s.append("rect").attr("width",e).attr("height",i).on("mousemove",w)}),o}var b={top:15,right:40,bottom:3,left:40},c=400,d=50,e=!0,f=function(a){return a.x},g=function(a){return a.y},h=d3.scale.category20().range(),i=Math.floor(Math.random()*1e5),j=d3.format(",r"),k=d3.format(",.2f"),l=d3.scale.linear(),m=d3.scale.linear(),n=a.models.sparkline();return o.margin=function(a){return arguments.length?(b=a,o):b},o.width=function(a){return arguments.length?(c=a,n.width(a-b.left-b.right),o):c},o.height=function(a){return arguments.length?(d=a,n.height(a-b.top-b.bottom),o):d},o.x=function(a){return arguments.length?(f=d3.functor(a),n.x(a),o):f},o.y=function(a){return arguments.length?(g=d3.functor(a),n.y(a),o):g},o.id=function(a){return arguments.length?(i=a,o):i},o.animate=function(a){return arguments.length?(e=a,o):e},o},a.models.stackedArea=function(){function r(a){return a.each(function(a){var i=c-b.left-b.right,o=d-b.top-b.bottom;m=p.xScale(),n=p.yScale(),a=a.map(function(a,b){return a.values=a.values.map(function(b,c){return b.index=c,b.stackedY=a.disabled?0:h(b,c),b}),a}),a=d3.layout.stack().order(k).offset(j).values(function(a){return a.values}).x(g).y(function(a){return a.stackedY}).out(function(a,b,c){a.display={y:c,y0:b}})(a);var r=d3.select(this).selectAll("g.wrap.stackedarea").data([a]),s=r.enter().append("g").attr("class","wrap nvd3 stackedarea"),t=s.append("defs"),u=s.append("g"),v=r.select("g");u.append("g").attr("class","areaWrap"),p.width(i).height(o).x(g).y(function(a){return a.display.y+a.display.y0}).forceY([0]).color(a.map(function(a,b){return a.color||e[b%e.length]}).filter(function(b,c){return!a[c].disabled})),u.append("g").attr("class","scatterWrap");var w=v.select(".scatterWrap").datum(a.filter(function(a){return!a.disabled}));d3.transition(w).call(p),r.attr("transform","translate("+b.left+","+b.top+")"),t.append("clipPath").attr("id","edge-clip-"+f).append("rect"),r.select("#edge-clip-"+f+" rect").attr("width",i).attr("height",o),v.attr("clip-path",l?"url(#edge-clip-"+f+")":"");var z=d3.svg.area().x(function(a,b){return m(g(a,b))}).y0(function(a){return n(a.display.y0)}).y1(function(a){return n(a.display.y+a.display.y0)}),A=d3.svg.area().x(function(a,b){return m(g(a,b))}).y0(function(a){return n(a.display.y0)}).y1(function(a){return n(a.display.y0)}),B=v.select(".areaWrap").selectAll("path.area").data(function(a){return a});B.enter().append("path").attr("class",function(a,b){return"area area-"+b}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),q.areaMouseover({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),q.areaMouseout({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}).on("click",function(a,b){d3.select(this).classed("hover",!1),q.areaClick({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}),d3.transition(B.exit()).attr("d",function(a,b){return A(a.values,b)}).remove(),B.style("fill",function(a,b){return a.color||e[b%e.length]}).style("stroke",function(a,b){return a.color||e[b%e.length]}),d3.transition(B).attr("d",function(a,b){return z(a.values,b)}),p.dispatch.on("elementMouseover.area",function(a){v.select(".area-"+a.seriesIndex).classed("hover",!0)}),p.dispatch.on("elementMouseout.area",function(a){v.select(".area-"+a.seriesIndex).classed("hover",!1)})}),r}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.category20().range(),f=Math.floor(Math.random()*1e5),g=function(a){return a.x},h=function(a){return a.y},i="stack",j="zero",k="default",l=!1,m,n,o=d3.layout.stack().values(function(a){return a.values}).x(g).y(function(a){return a.stackedY}).out(function(a,b,c){a.display={y:c,y0:b}}),p=a.models.scatter().size(2.2).sizeDomain([2.5]),q=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return p.dispatch.on("elementClick.area",function(a){q.areaClick(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),r.dispatch=q,r.scatter=p,d3.rebind(r,p,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),r.x=function(a){return arguments.length?(g=d3.functor(a),r):g},r.y=function(a){return arguments.length?(h=d3.functor(a),r):h},r.margin=function(a){return arguments.length?(b=a,r):b},r.width=function(a){return arguments.length?(c=a,r):c},r.height=function(a){return arguments.length?(d=a,r):d},r.clipEdge=function(a){return arguments.length?(l=a,r):l},r.color=function(a){return arguments.length?(e=a,r):e},r.offset=function(a){return arguments.length?(j=a,r):j},r.order=function(a){return arguments.length?(k=a,r):k},r.style=function(a){if(!arguments.length)return i;i=a;switch(i){case"stack":r.offset("zero"),r.order("default");break;case"stream":r.offset("wiggle"),r.order("inside-out");break;case"expand":r.offset("expand"),r.order("default")}return r},r},a.models.stackedAreaChart=function(){function t(a){return a.each(function(e){var i=d3.select(this),u=this,v=(c||parseInt(i.style("width"))||960)-b.left-b.right,w=(d||parseInt(i.style("height"))||400)-b.top-b.bottom;j=l.xScale(),k=l.yScale();var z=i.selectAll("g.wrap.stackedAreaChart").data([e]),A=z.enter().append("g").attr("class","wrap nvd3 stackedAreaChart").append("g");A.append("g").attr("class","x axis"),A.append("g").attr("class","y axis"),A.append("g").attr("class","stackedWrap"),A.append("g").attr("class","legendWrap"),A.append("g").attr("class","controlsWrap");var B=z.select("g");g&&(o.width(v/2),B.select(".legendWrap").datum(e).call(o),b.top!=o.height()&&(b.top=o.height(),w=(d||parseInt(i.style("height"))||400)-b.top-b.bottom),B.select(".legendWrap").attr("transform","translate("+v/2+","+ -b.top+")")),l.width(v).height(w),f&&(p.width(280).color(["#444","#444","#444"]),B.select(".controlsWrap").datum(r).attr("transform","translate(0,"+ -b.top+")").call(p)),B.attr("transform","translate("+b.left+","+b.top+")");var C=B.select(".stackedWrap").datum(e);d3.transition(C).call(l),m.scale(j).ticks(v/100).tickSize(-w,0),B.select(".x.axis").attr("transform","translate(0,"+w+")"),d3.transition(B.select(".x.axis")).call(m),n.scale(k).ticks(l.offset()=="wiggle"?0:w/36).tickSize(-v,0).tickFormat(l.offset()=="expand"?d3.format("%"):d3.format(",.2f")),d3.transition(B.select(".y.axis")).call(n),l.dispatch.on("areaClick.toggle",function(b){e.filter(function(a){return!a.disabled}).length===1?e=e.map(function(a){return a.disabled=!1,a}):e=e.map(function(a,c){return a.disabled=c!=b.seriesIndex,a}),a.transition().call(t)}),o.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,e.filter(function(a){return!a.disabled}).length||e.map(function(a){return a.disabled=!1,a}),a.transition().call(t)}),p.dispatch.on("legendClick",function(b,c){if(!b.disabled)return;r=r.map(function(a){return a.disabled=!0,a}),b.disabled=!1;switch(b.key){case"Stacked":l.style("stack");break;case"Stream":l.style("stream");break;case"Expanded":l.style("expand")}a.transition().call(t)}),q.on("tooltipShow",function(a){h&&s(a,u.parentNode)})}),t.update=function(){a.transition().call(t)},t.container=this,t}var b={top:30,right:25,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+a+"
"+""+c+" on "+b+"
"},j,k,l=a.models.stackedArea(),m=a.models.axis().orient("bottom").tickPadding(5),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide"),r=[{key:"Stacked"},{key:"Stream",disabled:!0},{key:"Expanded",disabled:!0}],s=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(l.x()(b.point)),g=n.tickFormat()(l.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")};return l.dispatch.on("tooltipShow",function(a){if(!Math.round(l.y()(a.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;a.pos=[a.pos[0]+ -b.left,a.pos[1]+b.top],q.tooltipShow(a)}),l.dispatch.on("tooltipHide",function(a){q.tooltipHide(a)}),q.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),t.dispatch=q,t.stacked=l,t.xAxis=m,t.yAxis=n,d3.rebind(t,l,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):getWidth},t.height=function(a){return arguments.length?(d=a,t):getHeight},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t}})(); \ No newline at end of file +(a){return a.each(function(a){var p=c-b.left-b.right,q=d-b.top-b.bottom,r=d3.select(this);j=m.xScale(),k=m.yScale(),n=n||j,o=o||k;var s=r.selectAll("g.wrap.line").data([a]),t=s.enter().append("g").attr("class","wrap nvd3 line"),u=t.append("defs"),v=t.append("g"),w=s.select("g");v.append("g").attr("class","groups"),v.append("g").attr("class","scatterWrap");var z=s.select(".scatterWrap");m.width(p).height(q),d3.transition(z).call(m),s.attr("transform","translate("+b.left+","+b.top+")"),u.append("clipPath").attr("id","edge-clip-"+f).append("rect"),s.select("#edge-clip-"+f+" rect").attr("width",p).attr("height",q),w.attr("clip-path",i?"url(#edge-clip-"+f+")":""),z.attr("clip-path",i?"url(#edge-clip-"+f+")":"");var A=s.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(A.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return e[b%e.length]}).style("stroke",function(a,b){return e[b%e.length]}),d3.transition(A).style("stroke-opacity",1).style("fill-opacity",.5);var B=A.selectAll("path").data(function(a,b){return[a.values]});B.enter().append("path").attr("class","line").attr("d",d3.svg.line().interpolate(l).x(function(a,b){return n(g(a,b))}).y(function(a,b){return o(h(a,b))})),d3.transition(A.exit().selectAll("path")).attr("d",d3.svg.line().interpolate(l).x(function(a,b){return j(g(a,b))}).y(function(a,b){return k(h(a,b))})),d3.transition(B).attr("d",d3.svg.line().interpolate(l).x(function(a,b){return j(g(a,b))}).y(function(a,b){return k(h(a,b))})),n=j.copy(),o=k.copy()}),q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.category20().range(),f=Math.floor(Math.random()*1e4),g=function(a){return a.x},h=function(a){return a.y},i=!1,j,k,l="linear",m=a.models.scatter().id(f).size(16).sizeDomain([16,256]),n,o,p;return q.dispatch=m.dispatch,d3.rebind(q,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){return arguments.length?(b=a,q):b},q.width=function(a){return arguments.length?(c=a,q):c},q.height=function(a){return arguments.length?(d=a,q):d},q.x=function(a){return arguments.length?(g=a,m.x(a),q):g},q.y=function(a){return arguments.length?(h=a,m.y(a),q):h},q.clipEdge=function(a){return arguments.length?(i=a,q):i},q.color=function(a){return arguments.length?(e=a,m.color(a),q):e},q.id=function(a){return arguments.length?(f=a,q):f},q.interpolate=function(a){return arguments.length?(l=a,q):l},q},a.models.indentedTree=function(){function i(d){return d.each(function(e){function y(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c)return d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&y(a,0,!0)}),!0;if(!B(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),i.update()}function z(a){return a._values&&a._values.length?iconOpen:a.values&&a.values.length?iconClose:""}function A(a){return a._values&&a._values.length}function B(a){var b=a.values||a._values;return b&&b.length}var j=b-a.left-a.right,k=c-a.top-a.bottom;i.update=function(){d.transition().call(i)};var l=0,m=1,n=d3.layout.tree().children(function(a){return a.values}).size([c,childIndent]);e[0].key||(e[0].key=g);var o=n.nodes(e[0]),p=d3.select(this).selectAll("div").data([[o]]),q=p.enter().append("div").attr("class","wrap nvd3 indentedtree"),r=q.append("table"),s=p.select("table").attr("width","100%").attr("class",tableClass);if(f){var t=r.append("thead"),u=t.append("tr");columns.forEach(function(a){u.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var v=s.selectAll("tbody").data(function(a){return a});v.enter().append("tbody"),m=d3.max(o,function(a){return a.depth}),n.size([c,m*childIndent]);var w=v.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++l});w.exit().remove(),w.select("img.treeicon").attr("src",z).classed("folded",A);var x=w.enter().append("tr");columns.forEach(function(a,b){var c=x.append("td").style("padding-left",function(a){return(b?0:a.depth*childIndent+12+(z(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("treeicon",!0).classed("folded",A).attr("src",z).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return z(a)?"inline-block":"none"}).on("click",y),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),w.order().on("click",function(a){h.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){h.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){h.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){h.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})}),i}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.category20().range(),e=Math.floor(Math.random()*1e4),f=!0,g="No Results found.";childIndent=20,columns=[{key:"key",label:"Name",type:"text"}],tableClass=null,iconOpen="images/grey-plus.png",iconClose="images/grey-minus.png";var h=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");return i.margin=function(b){return arguments.length?(a=b,i):a},i.width=function(a){return arguments.length?(b=a,i):b},i.height=function(a){return arguments.length?(c=a,i):c},i.color=function(a){return arguments.length?(d=a,scatter.color(a),i):d},i.id=function(a){return arguments.length?(e=a,i):e},i.header=function(a){return arguments.length?(f=a,i):f},i.noResultsText=function(a){return arguments.length?(g=a,i):g},i.columns=function(a){return arguments.length?(columns=a,i):columns},i.tableClass=function(a){return arguments.length?(tableClass=a,i):tableClass},i.iconOpen=function(a){return arguments.length?(iconOpen=a,i):iconOpen},i.iconClose=function(a){return arguments.length?(iconClose=a,i):iconClose},i},a.models.lineChart=function(){function q(a){return a.each(function(h){var r=d3.select(this),s=this,t=(d||parseInt(r.style("width"))||960)-b.left-b.right,u=(e||parseInt(r.style("height"))||400)-b.top-b.bottom;i=k.xScale(),j=k.yScale();var v=r.selectAll("g.wrap.lineChart").data([h]),w=v.enter().append("g").attr("class","wrap nvd3 lineChart").append("g");w.append("g").attr("class","x axis"),w.append("g").attr("class","y axis"),w.append("g").attr("class","linesWrap"),w.append("g").attr("class","legendWrap");var z=v.select("g");f&&(n.width(t),z.select(".legendWrap").datum(h).call(n),b.top!=n.height()&&(b.top=n.height(),u=(e||parseInt(r.style("height"))||400)-b.top-b.bottom),z.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),k.width(t).height(u).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled})),z.attr("transform","translate("+b.left+","+b.top+")");var A=z.select(".linesWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(A).call(k),l.scale(i).ticks(t/100).tickSize(-u,0),z.select(".x.axis").attr("transform","translate(0,"+j.range()[0]+")"),d3.transition(z.select(".x.axis")).call(l),m.scale(j).ticks(u/36).tickSize(-t,0),d3.transition(z.select(".y.axis")).call(m),n.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){return a.disabled=!1,v.selectAll(".series").classed("disabled",!1),a}),a.transition().call(q)}),o.on("tooltipShow",function(a){g&&p(a,s.parentNode)})}),q.update=function(){q(a)},q.container=this,q}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},i,j,k=a.models.line(),l=a.models.axis().orient("bottom").tickPadding(5),m=a.models.axis().orient("left"),n=a.models.legend().height(30),o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=l.tickFormat()(k.x()(b.point)),g=m.tickFormat()(k.y()(b.point)),i=h(b.series.key,f,g,b,q);a.tooltip.show([d,e],i)};return k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],o.tooltipShow(a)}),k.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),q.dispatch=o,q.legend=n,q.xAxis=l,q.yAxis=m,d3.rebind(q,k,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),q.margin=function(a){return arguments.length?(b=a,q):b},q.width=function(a){return arguments.length?(d=a,q):d},q.height=function(a){return arguments.length?(e=a,q):e},q.color=function(a){return arguments.length?(c=a,n.color(a),q):c},q.showLegend=function(a){return arguments.length?(f=a,q):f},q.tooltips=function(a){return arguments.length?(g=a,q):g},q.tooltipContent=function(a){return arguments.length?(h=a,q):h},q},a.models.linePlusBarChart=function(){function v(j){return j.each(function(o){var w=d3.select(this),y=this,z=(c||parseInt(w.style("width"))||960)-b.left-b.right,A=(d||parseInt(w.style("height"))||400)-b.top-b.bottom,B=o.filter(function(a){return!a.disabled&&a.bar}),C=o.filter(function(a){return!a.disabled&&!a.bar}),D=o.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:e(a,b),y:f(a,b)}})}),E=o.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:e(a,b),y:f(a,b)}})});m.domain(d3.extent(d3.merge(D.concat(E)),function(a){return a.x})).range([0,z]);var F=d3.select(this).selectAll("g.wrap.linePlusBar").data([o]),G=F.enter().append("g").attr("class","wrap nvd3 linePlusBar").append("g");G.append("g").attr("class","x axis"),G.append("g").attr("class","y1 axis"),G.append("g").attr("class","y2 axis"),G.append("g").attr("class","barsWrap"),G.append("g").attr("class","linesWrap"),G.append("g").attr("class","legendWrap");var H=F.select("g");h&&(s.width(z/2),H.select(".legendWrap").datum(o.map(function(a){return a.key=a.key+(a.bar?" (left axis)":" (right axis)"),a})).call(s),b.top!=s.height()&&(b.top=s.height(),A=(d||parseInt(w.style("height"))||400)-b.top-b.bottom),H.select(".legendWrap").attr("transform","translate("+z/2+","+ -b.top+")")),k.width(z).height(A).color(o.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!o[b].disabled&&!o[b].bar})),l.width(z).height(A).color(o.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!o[b].disabled&&o[b].bar}));var I=H.select(".barsWrap").datum(B.length?B:[{values:[]}]),J=H.select(".linesWrap").datum(C.length?C:[{values:[]}]);d3.transition(I).call(l),d3.transition(J).call(k),H.attr("transform","translate("+b.left+","+b.top+")"),p.ticks(z/100).tickSize(-A,0),H.select(".x.axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(H.select(".x.axis")).call(p),q.ticks(A/36).tickSize(-z,0),d3.transition(H.select(".y1.axis")).call(q),r.ticks(A/36).tickSize(B.length?0:-z,0),H.select(".y2.axis").attr("transform","translate("+m.range()[1]+",0)"),d3.transition(H.select(".y2.axis")).call(r),s.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){return a.disabled=!1,F.selectAll(".series").classed("disabled",!1),a}),j.transition().call(v)}),k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),i&&t.on("tooltipShow",function(a){u(a,y.parentNode)}),k.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),i&&t.on("tooltipHide",a.tooltip.cleanup),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),i&&t.on("tooltipShow",function(a){u(a,y.parentNode)}),l.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),i&&t.on("tooltipHide",a.tooltip.cleanup),v.update=function(){j.transition().call(v)},v.container=this}),v}var b={top:30,right:60,bottom:50,left:60},c=null,d=null,e=function(a){return a.x},f=function(a){return a.y},g=d3.scale.category20().range(),h=!0,i=!0,j=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},k=a.models.line(),l=a.models.historicalBar(),m=d3.scale.linear(),n=l.yScale(),o=k.yScale(),p=a.models.axis().scale(m).orient("bottom").tickPadding(5),q=a.models.axis().scale(n).orient("left"),r=a.models.axis().scale(o).orient("right"),s=a.models.legend().height(30),t=d3.dispatch("tooltipShow","tooltipHide"),u=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=p.tickFormat()(k.x()(b.point)),g=q.tickFormat()(k.y()(b.point)),h=j(b.series.key,f,g,b,v);a.tooltip.show([d,e],h,b.value<0?"n":"s")};return v.dispatch=t,v.legend=s,v.lines=k,v.bars=l,v.xAxis=p,v.yAxis1=q,v.yAxis2=r,d3.rebind(v,k,"size","clipVoronoi","interpolate"),v.x=function(a){return arguments.length?(e=a,k.x(a),l.x(a),v):e},v.y=function(a){return arguments.length?(f=a,k.y(a),l.y(a),v):f},v.margin=function(a){return arguments.length?(b=a,v):b},v.width=function(a){return arguments.length?(c=a,v):c},v.height=function(a){return arguments.length?(d=a,v):d},v.color=function(a){return arguments.length?(g=a,s.color(a),v):g},v.showLegend=function(a){return arguments.length?(h=a,v):h},v.tooltips=function(a){return arguments.length?(i=a,v):i},v.tooltipContent=function(a){return arguments.length?(j=a,v):j},v},a.models.lineWithFocusChart=function(){function y(j){return j.each(function(z){function M(a){var b=+(a=="e"),c=b?1:-1,d=E/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function N(){O(),K.call(k),J.select(".focus .x.axis").call(q),J.select(".focus .y.axis").call(r)}function O(){var a=w.empty()?p.domain():d3.extent(d3.merge(z.filter(function(a){return!a.disabled}).map(function(a){return a.values})).filter(function(a){return k.x()(a)>=w.extent()[0]&&k.x()(a)<=w.extent()[1]}),k.y());typeof a[0]=="undefined"&&(a=p.domain()),m.domain(w.empty()?o.domain():w.extent()),n.domain(a),k.xDomain(m.domain()),k.yDomain(n.domain())}var A=d3.select(this),B=this,C=(e||parseInt(A.style("width"))||960)-b.left-b.right,D=(f||parseInt(A.style("height"))||400)-b.top-b.bottom-g,E=g-c.top-c.bottom;w.on("brush",N);var F=A.selectAll("g.wrap.lineWithFocusChart").data([z]),G=F.enter().append("g").attr("class","wrap nvd3 lineWithFocusChart").append("g"),H=G.append("g").attr("class","focus");H.append("g").attr("class","x axis"),H.append("g").attr("class","y axis"),H.append("g").attr("class","linesWrap");var I=G.append("g").attr("class","context");I.append("g").attr("class","x axis"),I.append("g").attr("class","y axis"),I.append("g").attr("class","linesWrap"),I.append("g").attr("class","x brush"),G.append("g").attr("class","legendWrap");var J=F.select("g");h&&(u.width(C),J.select(".legendWrap").datum(z).call(u),b.top!=u.height()&&(b.top=u.height(),D=(f||parseInt(A.style("height"))||400)-b.top-b.bottom),J.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),k.width(C).height(D).color(z.map(function(a,b){return a.color||d[b%d.length]}).filter(function(a,b){return!z[b].disabled})),l.width(C).height(E).x(k.x()).y(k.y()).color(z.map(function(a,b){return a.color||d[b%d.length]}).filter(function(a,b){return!z[b].disabled})),J.attr("transform","translate("+b.left+","+b.top+")");var K=J.select(".focus .linesWrap").datum(z.filter(function(a){return!a.disabled}));d3.transition(K).call(k),q.ticks(C/100).tickSize(-D,0),J.select(".focus .x.axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(J.select(".focus .x.axis")).call(q),r.ticks(D/36).tickSize(-C,0),d3.transition(J.select(".focus .y.axis")).call(r),J.select(".context").attr("transform","translate(0,"+(D+b.bottom+c.top)+")");var L=J.select(".context .linesWrap").datum(z.filter(function(a){return!a.disabled}));d3.transition(L).call(l),gBrush=J.select(".x.brush").call(w),gBrush.selectAll("rect").attr("height",E),gBrush.selectAll(".resize").append("path").attr("d",M),s.ticks(C/100).tickSize(-E,0),J.select(".context .x.axis").attr("transform","translate(0,"+p.range()[0]+")"),d3.transition(J.select(".context .x.axis")).call(s),t.ticks(E/36).tickSize(-C,0),d3.transition(J.select(".context .y.axis")).call(t),O(),u.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,z.filter(function(a){return!a.disabled}).length||z.map(function(a){return a.disabled=!1,F.selectAll(".series").classed("disabled",!1),a}),j.transition().call(y)}),k.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],v.tooltipShow(a)}),i&&v.on("tooltipShow",function(a){x(a,B.parentNode)}),k.dispatch.on("elementMouseout.tooltip",function(a){v.tooltipHide(a)}),i&&v.on("tooltipHide",a.tooltip.cleanup)}),y.update=function(){y(j)},y.container=this,y}var b={top:30,right:20,bottom:50,left:60},c={top:0,right:20,bottom:20,left:60},d=d3.scale.category20().range(),e=null,f=null,g=100,h=!0,i=!0,j=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},k=a.models.line().clipEdge(!0),l=a.models.line().interactive(!1),m=k.xScale(),n=k.yScale(),o=l.xScale(),p=l.yScale(),q=a.models.axis().scale(m).orient("bottom").tickPadding(5),r=a.models.axis().scale(n).orient("left"),s=a.models.axis().scale(m).orient("bottom").tickPadding(5),t=a.models.axis().scale(p).orient("left"),u=a.models.legend().height(30),v=d3.dispatch("tooltipShow","tooltipHide"),w=d3.svg.brush().x(o),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=q.tickFormat()(k.x()(b.point)),g=r.tickFormat()(k.y()(b.point)),h=j(b.series.key,f,g,b,y);a.tooltip.show([d,e],h)};return y.dispatch=v,y.legend=u,y.xAxis=q,y.yAxis=r,y.x2Axis=s,y.y2Axis=t,d3.rebind(y,k,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),y.margin=function(a){return arguments.length?(b=a,y):b},y.width=function(a){return arguments.length?(e=a,y):e},y.height=function(a){return arguments.length?(f=a,y):f},y.color=function(a){return arguments.length?(d=a,u.color(a),y):d},y.showLegend=function(a){return arguments.length?(h=a,y):h},y.tooltips=function(a){return arguments.length?(i=a,y):i},y.tooltipContent=function(a){return arguments.length?(j=a,y):j},y.interpolate=function(a){return arguments.length?(k.interpolate(a),l.interpolate(a),y):k.interpolate()},y},a.models.multiBar=function(){function s(t){return t.each(function(u){var v=b-a.left-a.right,w=c-a.top-a.bottom;q=q||d,r=r||e,k&&(u=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(h)(u)),u=u.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var z=n&&o?[]:u.map(function(a){return a.values.map(function(a,b){return{x:g(a,b),y:h(a,b),y0:a.y0}})});d.domain(d3.merge(z).map(function(a){return a.x})).rangeBands([0,v],.1),e.domain(o||d3.extent(d3.merge(z).map(function(a){return a.y+(k?a.y0:0)}).concat(i))).range([w,0]);var A=d3.select(this).selectAll("g.wrap.multibar").data([u]),B=A.enter().append("g").attr("class","wrap nvd3 multibar"),C=B.append("defs"),D=B.append("g");D.append("g").attr("class","groups");var E=A.select("g");A.attr("transform","translate("+a.left+","+a.top+")"),C.append("clipPath").attr("id","edge-clip-"+f).append("rect"),A.select("#edge-clip-"+f+" rect").attr("width",v).attr("height",w),E.attr("clip-path",j?"url(#edge-clip-"+f+")":"");var F=A.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});F.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(F.exit()).selectAll("rect.bar").delay(function(a,b){return b*m/u[0].values.length}).attr("y",function(a){return k?r(a.y0):r(0)}).attr("height",0).remove(),F.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return l[b%l.length]}).style("stroke",function(a,b){return l[b%l.length]}),d3.transition(F).style("stroke-opacity",1).style("fill-opacity",.75);var G=F.selectAll("rect.bar").data(function(a){return a.values});G.exit().remove();var H=G.enter().append("rect").attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}).attr("x",function(a,b,c){return k?0:c*d.rangeBand()/u.length}).attr("y",function(a){return r(k?a.y0:0)}).attr("height",0).attr("width",d.rangeBand()/(k?1:u.length)).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),p.elementMouseover({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),p.elementMouseout({value:h(a,b),point:a,series:u[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){p.elementClick({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:h(a,b),point:a,series:u[a.series],pos:[d(g(a,b))+d.rangeBand()*(k?u.length/2:a.series+.5)/u.length,e(h(a,b)+(k?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});G.attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}).attr("transform",function(a,b){return"translate("+d(g(a,b))+",0)"}),k?d3.transition(G).delay(function(a,b){return b*m/u[0].values.length}).attr("y",function(a,b){return e(h(a,b)+(k?a.y0:0))}).attr("height",function(a,b){return Math.abs(e(a.y+(k?a.y0:0))-e(k?a.y0:0))}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(a,b){return k?0:a.series*d.rangeBand()/u.length}).attr("width",d.rangeBand()/(k?1:u.length))}):d3.transition(G).delay(function(a,b){return b*m/u[0].values.length}).attr("x",function(a,b){return a.series*d.rangeBand()/u.length}).attr("width",d.rangeBand()/u.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return h(a,b)<0?e(0):e(h(a,b))}).attr("height",function(a,b){return Math.abs(e(h(a,b))-e(0))})}),s.update=function(){s(t)},q=d.copy(),r=e.copy()}),s}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.ordinal(),e=d3.scale.linear(),f=Math.floor(Math.random()*1e4),g=function(a){return a.x},h=function(a){return a.y},i=[0],j=!0,k=!1,l=d3.scale.category20().range(),m=1200,n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q,r;return s.dispatch=p,s.x=function(a){return arguments.length?(g=a,s):g},s.y=function(a){return arguments.length?(h=a,s):h},s.margin=function(b){return arguments.length?(a=b,s):a},s.width=function(a){return arguments.length?(b=a,s):b},s.height=function(a){return arguments.length?(c=a,s):c},s.xScale=function(a){return arguments.length?(d=a,s):d},s.yScale=function(a){return arguments.length?(e=a,s):e},s.xDomain=function(a){return arguments.length?(n=a,s):n},s.yDomain=function(a){return arguments.length?(o=a,s):o},s.forceY=function(a){return arguments.length?(i=a,s):i},s.stacked=function(a){return arguments.length?(k=a,s):k},s.clipEdge=function(a){return arguments.length?(j=a,s):j},s.color=function(a){return arguments.length?(l=a,s):l},s.id=function(a){return arguments.length?(f=a,s):f},s.delay=function(a){return arguments.length?(m=a,s):m},s},a.models.multiBarChart=function(){function t(a){return a.each(function(i){var u=d3.select(this),v=this,w=(c||parseInt(u.style("width"))||960)-b.left-b.right,z=(d||parseInt(u.style("height"))||400)-b.top-b.bottom;j=l.xScale(),k=l.yScale();var A=u.selectAll("g.wrap.multiBarWithLegend").data([i]),B=A.enter().append("g").attr("class","wrap nvd3 multiBarWithLegend").append("g");B.append("g").attr("class","x axis"),B.append("g").attr("class","y axis"),B.append("g").attr("class","barsWrap"),B.append("g").attr("class","legendWrap"),B.append("g").attr("class","controlsWrap");var C=A.select("g");g&&(o.width(w/2),C.select(".legendWrap").datum(i).call(o),b.top!=o.height()&&(b.top=o.height(),z=(d||parseInt(u.style("height"))||400)-b.top-b.bottom),C.select(".legendWrap").attr("transform","translate("+w/2+","+ -b.top+")")),l.width(w).height(z).color(i.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!i[b].disabled})),f&&(p.width(180).color(["#444","#444","#444"]),C.select(".controlsWrap").datum(s).attr("transform","translate(0,"+ -b.top+")").call(p)),C.attr("transform","translate("+b.left+","+b.top+")");var D=C.select(".barsWrap").datum(i.filter(function(a){return!a.disabled}));d3.transition(D).call(l),m.scale(j).ticks(w/100).tickSize(-z,0),C.select(".x.axis").attr("transform","translate(0,"+k.range()[0]+")"),d3.transition(C.select(".x.axis")).call(m);var E=C.select(".x.axis").selectAll("g");E.selectAll("line, text").style("opacity",1),E.filter(function(a,b){return b%Math.ceil(i[0].values.length/(w/100))!==0}).style("opacity",0),n.scale(k).ticks(z/36).tickSize(-w,0),d3.transition(C.select(".y.axis")).call(n),o.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,i.filter(function(a){return!a.disabled}).length||i.map(function(a){return a.disabled=!1,A.selectAll(".series").classed("disabled",!1),a}),a.transition().call(t)}),p.dispatch.on("legendClick",function(b,c){if(!b.disabled)return;s=s.map(function(a){return a.disabled=!0,a}),b.disabled=!1;switch(b.key){case"Grouped":l.stacked(!1);break;case"Stacked":l.stacked(!0)}a.transition().call(t)}),q.on("tooltipShow",function(a){h&&r(a,v.parentNode)}),t.update=function(){a.transition().call(t)},t.container=this}),t}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+a+"
"+""+c+" on "+b+"
"},j,k,l=a.models.multiBar().stacked(!1),m=a.models.axis().orient("bottom").highlightZero(!1),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var r=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(l.x()(b.point)),g=n.tickFormat()(l.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")},s=[{key:"Grouped",disabled:l.stacked},{key:"Stacked",disabled:!l.stacked}];return l.dispatch.on("elementMouseover.tooltip2",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),l.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),q.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),t.dispatch=q,t.legend=o,t.xAxis=m,t.yAxis=n,d3.rebind(t,l,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t},a.models.multiBarHorizontal=function(){function v(d){return d.each(function(p){var w=b-a.left-a.right,z=c-a.top-a.bottom;l&&(p=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(h)(p)),p=p.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var A=q&&r?[]:p.map(function(a){return a.values.map(function(a,b){return{x:g(a,b),y:h(a,b),y0:a.y0}})});e.domain(q||d3.merge(A).map(function(a){return a.x})).rangeBands([0,z],.1),f.domain(r||d3.extent(d3.merge(A).map(function(a){return a.y+(l?a.y0:0)}).concat(i))),m&&!l?f.range([f.domain()[0]<0?n:0,w-(f.domain()[1]>0?n:0)]):f.range([0,w]),s=s||e,t=t||d3.scale.linear().domain(f.domain()).range([f(0),f(0)]);var B=d3.select(this).selectAll("g.wrap.multibarHorizontal").data([p]),C=B.enter().append("g").attr("class","wrap nvd3 multibarHorizontal"),D=C.append("defs"),E=C.append("g");E.append("g").attr("class","groups");var F=B.select("g");B.attr("transform","translate("+a.left+","+a.top+")");var G=B.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(G.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),G.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k[b%k.length]}).style("stroke",function(a,b){return k[b%k.length]}),d3.transition(G).style("stroke-opacity",1).style("fill-opacity",.75);var H=G.selectAll("g.bar").data(function(a){return a.values});H.exit().remove();var I=H.enter().append("g").attr("transform",function(a,b,c){return"translate("+t(l?a.y0:0)+","+(l?0:c*e.rangeBand()/p.length+e(g(a,b)))+")"}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),u.elementMouseover({value:h(a,b),point:a,series:p[a.series],pos:[f(h(a,b)+(l?a.y0:0)),e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),u.elementMouseout({value:h(a,b),point:a,series:p[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){u.elementClick({value:h(a,b),point:a,series:p[a.series],pos:[e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length,f(h(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){u.elementDblClick({value:h(a,b),point:a,series:p[a.series],pos:[e(g(a,b))+e.rangeBand()*(l?p.length/2:a.series+.5)/p.length,f(h(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});I.append("rect").attr("width",0).attr("height",e.rangeBand()/(l?1:p.length)),m&&!l?(I.append("text").attr("text-anchor",function(a,b){return h(a,b)<0?"end":"start"}),H.selectAll("text").attr("y",e.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(h(a,b))}),d3.transition(H).selectAll("text").attr("x",function(a,b){return h(a,b)<0?-4:f(h(a,b))-f(0)+4})):H.selectAll("text").remove(),H.attr("class",function(a,b){return h(a,b)<0?"bar negative":"bar positive"}),l?d3.transition(H).attr("transform",function(a,b){return"translate("+f(a.y0)+","+(l?0:j*e.rangeBand()/p.length)+")"}).selectAll("rect").attr("width",function(a,b){return Math.abs(f(h(a,b)+a.y0)-f(a.y0))}).attr("height",e.rangeBand()):d3.transition(H).attr("transform",function(a,b){return"translate("+(h(a,b)<0?f(h(a,b)):f(0))+","+(a.series*e.rangeBand()/p.length+e(g(a,b)))+")"}).selectAll("rect").attr("height",e.rangeBand()/p.length).attr("width",function(a,b){return Math.abs(f(h(a,b))-f(0))}),v.update=function(){d.transition().call(v)},s=e.copy(),t=f.copy()}),v}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=Math.floor(Math.random()*1e4),e=d3.scale.ordinal(),f=d3.scale.linear(),g=function(a){return a.x},h=function(a){return a.y},i=[0],k=d3.scale.category20().range(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s,t,u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return v.dispatch=u,v.x=function(a){return arguments.length?(g=a,v):g},v.y=function(a){return arguments.length?(h=a,v):h},v.margin=function(b){return arguments.length?(a=b,v):a},v.width=function(a){return arguments.length?(b=a,v):b},v.height=function(a){return arguments.length?(c=a,v):c},v.xScale=function(a){return arguments.length?(e=a,v):e},v.yScale=function(a){return arguments.length?(f=a,v):f},v.xDomain=function(a){return arguments.length?(q=a,v):q},v.yDomain=function(a){return arguments.length?(r=a,v):r},v.forceY=function(a){return arguments.length?(i=a,v):i},v.stacked=function(a){return arguments.length?(l=a,v):l},v.color=function(a){return arguments.length?(k=a,v):k},v.id=function(a){return arguments.length?(d=a,v):d},v.delay=function(a){return arguments.length?(p=a,v):p},v.showValues=function(a){return arguments.length?(m=a,v):m},v.valueFormat=function(a){return arguments.length?(o=a,v):o},v.valuePadding= +function(a){return arguments.length?(n=a,v):n},v},a.models.multiBarHorizontalChart=function(){function t(i){return i.each(function(k){var l=d3.select(this),u=this,v=(c||parseInt(l.style("width"))||960)-b.left-b.right,w=(d||parseInt(l.style("height"))||400)-b.top-b.bottom,x=l.selectAll("g.wrap.multiBarHorizontalChart").data([k]),y=x.enter().append("g").attr("class","wrap nvd3 multiBarHorizontalChart").append("g");y.append("g").attr("class","x axis"),y.append("g").attr("class","y axis"),y.append("g").attr("class","barsWrap"),y.append("g").attr("class","legendWrap"),y.append("g").attr("class","controlsWrap"),b.top=o.height();var z=x.select("g");g&&(o.width(v/2),z.select(".legendWrap").datum(k).call(o),b.top!=o.height()&&(b.top=o.height(),w=(d||parseInt(l.style("height"))||400)-b.top-b.bottom),z.select(".legendWrap").attr("transform","translate("+v/2+","+ -b.top+")")),j.width(v).height(w).color(k.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!k[b].disabled})),f&&(p.width(180).color(["#444","#444","#444"]),z.select(".controlsWrap").datum(s).attr("transform","translate(0,"+ -b.top+")").call(p)),z.attr("transform","translate("+b.left+","+b.top+")");var A=z.select(".barsWrap").datum(k.filter(function(a){return!a.disabled}));d3.transition(A).call(j),m.ticks(w/24).tickSize(-v,0),z.select(".x.axis").transition().duration(0).call(m);var B=z.select(".x.axis").selectAll("g");B.selectAll("line, text").style("opacity",1),n.ticks(v/100).tickSize(-w,0),z.select(".y.axis").attr("transform","translate(0,"+w+")"),d3.transition(z.select(".y.axis")).call(n),o.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){return a.disabled=!1,x.selectAll(".series").classed("disabled",!1),a}),i.transition().call(t)}),p.dispatch.on("legendClick",function(a,b){if(!a.disabled)return;s=s.map(function(a){return a.disabled=!0,a}),a.disabled=!1;switch(a.key){case"Grouped":j.stacked(!1);break;case"Stacked":j.stacked(!0)}i.transition().call(t)}),j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),h&&q.on("tooltipShow",function(a){r(a,u.parentNode)}),j.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),h&&q.on("tooltipHide",a.tooltip.cleanup),t.update=function(){i.transition().call(t)},t.container=this}),t}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+b+"
"+""+c+"
"},j=a.models.multiBarHorizontal().stacked(!1),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("left").highlightZero(!1).showMaxMin(!1),n=a.models.axis().scale(l).orient("bottom"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var r=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"e":"w")},s=[{key:"Grouped"},{key:"Stacked",disabled:!0}];return t.dispatch=q,t.multibar=j,t.legend=o,t.xAxis=m,t.yAxis=n,d3.rebind(t,j,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t},a.models.pie=function(){function n(i){return i.each(function(i){function A(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}function B(a){l||(a.innerRadius=0);var b=d3.interpolate(this._current,a);return this._current=b(0),function(a){return v(b(a))}}function C(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return v(b(a))}}var n=b-a.left-a.right,o=c-a.top-a.bottom,p=Math.min(n,o)/2,q=d3.select(this).on("click",function(a,b){m.chartClick({data:a,index:b,pos:d3.event,id:g})}),r=q.selectAll(".wrap.pie").data([d(i[0])]),s=r.enter().append("g").attr("class","wrap nvd3 pie chart-"+g),t=s.append("g"),u=r.select("g");t.append("g").attr("class","pie"),r.attr("transform","translate("+a.left+","+a.top+")"),u.select(".pie").attr("transform","translate("+n/2+","+o/2+")");var v=d3.svg.arc().outerRadius(p-p/5);l&&v.innerRadius(p/2);var w=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:f(a)}),x=r.select(".pie").selectAll(".slice").data(w);x.exit().remove();var y=x.enter().append("svg:g").attr("class","slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),m.elementMouseover({label:e(a.data),value:f(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:g})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),m.elementMouseout({label:e(a.data),value:f(a.data),point:a.data,index:b,id:g})}).on("click",function(a,b){m.elementClick({label:e(a.data),value:f(a.data),point:a.data,index:b,pos:d3.event,id:g}),d3.event.stopPropagation()}).on("dblclick",function(a,b){m.elementDblClick({label:e(a.data),value:f(a.data),point:a.data,index:b,pos:d3.event,id:g}),d3.event.stopPropagation()});x.attr("fill",function(a,b){return h[b]}).attr("stroke",function(a,b){return h[b]});var z=y.append("svg:path").each(function(a){this._current=a});d3.transition(x.select("path")).attr("d",v).attrTween("d",B),j&&(y.append("text").attr("transform",function(a){return a.outerRadius=p+10,a.innerRadius=p+15,"translate("+v.centroid(a)+")"}).style("text-anchor","middle").style("fill","#000"),d3.transition(x.select("text")).attr("transform",function(a){return a.outerRadius=p+10,a.innerRadius=p+15,"translate("+v.centroid(a)+")"}).text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>k?e(a.data):""}))}),n}var a={top:0,right:0,bottom:0,left:0},b=500,c=500,d=function(a){return a.values},e=function(a){return a.x},f=function(a){return a.y},g=Math.floor(Math.random()*1e4),h=d3.scale.category20().range(),i=d3.format(",.2f"),j=!0,k=.02,l=!1,m=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return n.dispatch=m,n.margin=function(b){return arguments.length?(a=b,n):a},n.width=function(a){return arguments.length?(b=a,n):b},n.height=function(a){return arguments.length?(c=a,n):c},n.values=function(a){return arguments.length?(d=a,n):d},n.x=function(a){return arguments.length?(e=a,n):e},n.y=function(a){return arguments.length?(f=d3.functor(a),n):f},n.showLabels=function(a){return arguments.length?(j=a,n):j},n.donut=function(a){return arguments.length?(l=a,n):l},n.id=function(a){return arguments.length?(g=a,n):g},n.color=function(a){return arguments.length?(h=a,n):h},n.valueFormat=function(a){return arguments.length?(i=a,n):i},n.labelThreshold=function(a){return arguments.length?(k=a,n):k},n},a.models.pieChart=function(){function m(f){return f.each(function(h){var n=d3.select(this),o=this,p=(c||parseInt(n.style("width"))||960)-b.left-b.right,q=(d||parseInt(n.style("height"))||400)-b.top-b.bottom,r=n.selectAll("g.wrap.pieChart").data([h]),s=r.enter().append("g").attr("class","wrap nvd3 pieChart").append("g");s.append("g").attr("class","pieWrap"),s.append("g").attr("class","legendWrap");var t=r.select("g");e&&(j.width(p).key(i.x()),r.select(".legendWrap").datum(i.values()(h[0])).call(j),b.top!=j.height()&&(b.top=j.height(),q=(d||parseInt(n.style("height"))||400)-b.top-b.bottom),r.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),i.width(p).height(q),t.attr("transform","translate("+b.left+","+b.top+")");var u=t.select(".pieWrap").datum(h);d3.transition(u).call(i),j.dispatch.on("legendClick",function(a,b,c){a.disabled=!a.disabled,i.values()(h[0]).filter(function(a){return!a.disabled}).length||i.values()(h[0]).map(function(a){return a.disabled=!1,r.selectAll(".series").classed("disabled",!1),a}),f.transition().call(m)}),i.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],k.tooltipShow(a)}),g&&k.on("tooltipShow",function(a){l(a)}),i.dispatch.on("elementMouseout.tooltip",function(a){k.tooltipHide(a)}),g&&k.on("tooltipHide",a.tooltip.cleanup),m.update=function(){f.transition().call(m)},m.container=this}),m}var b={top:30,right:20,bottom:20,left:20},c=null,d=null,e=!0,f=d3.scale.category20().range(),g=!0,h=function(a,b,c,d){return""+a+"
"+""+b+"
"},i=a.models.pie(),j=a.models.legend().height(30),k=d3.dispatch("tooltipShow","tooltipHide"),l=function(b,c){var d=b.pos[0]+(c&&c.offsetLeft||0),e=b.pos[1]+(c&&c.offsetTop||0),f=i.valueFormat()(i.y()(b.point)),g=h(i.x()(b.point),f,b,m);a.tooltip.show([d,e],g,b.value<0?"n":"s")};return m.dispatch=k,m.pie=i,d3.rebind(m,i,"values","x","y","id","showLabels","donut","labelThreshold"),m.margin=function(a){return arguments.length?(b=a,m):b},m.width=function(a){return arguments.length?(c=a,m):c},m.height=function(a){return arguments.length?(d=a,m):d},m.color=function(a){return arguments.length?(f=a,j.color(a),i.color(a),m):f},m.tooltips=function(a){return arguments.length?(g=a,m):g},m.tooltipContent=function(a){return arguments.length?(h=a,m):h},m},a.models.scatter=function(){function C(D){return D.each(function(C){function M(){if(!p)return!1;var b=d3.merge(C.map(function(a,b){return a.values.filter(q).map(function(a,c){return[f(i(a,c))*(Math.random()/1e12+1),g(j(a,c))*(Math.random()/1e12+1),b,c]})}));if(s){J.append("clipPath").attr("id","points-clip-"+e);var c=H.select("#points-clip-"+e).selectAll("circle").data(b);c.enter().append("circle").attr("r",t),c.exit().remove(),c.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),H.select(".point-paths").attr("clip-path","url(#points-clip-"+e+")")}var d=d3.geom.voronoi(b).map(function(a,c){return{data:a,series:b[c][2],point:b[c][3]}}),h=H.select(".point-paths").selectAll("path").data(d);h.enter().append("path").attr("class",function(a,b){return"path-"+b}),h.exit().remove(),h.attr("d",function(a){return"M"+a.data.join(",")+"Z"}).on("click",function(b){var c=C[b.series],d=c.values[b.point];x.elementClick({point:d,series:c,pos:[f(i(d,b.point))+a.left,g(j(d,b.point))+a.top],seriesIndex:b.series,pointIndex:b.point})}).on("mouseover",function(b){var c=C[b.series],d=c.values[b.point];x.elementMouseover({point:d,series:c,pos:[f(i(d,b.point))+a.left,g(j(d,b.point))+a.top],seriesIndex:b.series,pointIndex:b.point})}).on("mouseout",function(a,b){var c=C[a.series],d=c.values[a.point];x.elementMouseout({point:d,series:c,seriesIndex:a.series,pointIndex:a.point})})}var D=b-a.left-a.right,E=c-a.top-a.bottom,F=d3.select(this);C=C.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var G=u&&v&&w?[]:d3.merge(C.map(function(a){return a.values.map(function(a,b){return{x:i(a,b),y:j(a,b),size:k(a,b)}})}));f.domain(u||d3.extent(G.map(function(a){return a.x}).concat(m))).range([0,D]),g.domain(v||d3.extent(G.map(function(a){return a.y}).concat(n))).range([E,0]),h.domain(w||d3.extent(G.map(function(a){return a.size}).concat(o))).range([16,256]),y=y||f,z=z||g,A=A||h;var H=F.selectAll("g.wrap.scatter").data([C]),I=H.enter().append("g").attr("class","wrap nvd3 scatter chart-"+e),J=I.append("defs"),K=I.append("g"),L=H.select("g");K.append("g").attr("class","groups"),K.append("g").attr("class","point-paths"),H.attr("transform","translate("+a.left+","+a.top+")"),J.append("clipPath").attr("id","edge-clip-"+e).append("rect"),H.select("#edge-clip-"+e+" rect").attr("width",D).attr("height",E),L.attr("clip-path",r?"url(#edge-clip-"+e+")":"");var N=H.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});N.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(N.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),N.attr("class",function(a,b){return"group series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(N).style("fill",function(a,b){return d[b%d.length]}).style("stroke",function(a,b){return d[b%d.length]}).style("stroke-opacity",1).style("fill-opacity",.5);var O=N.selectAll("path.point").data(function(a){return a.values});O.enter().append("path").attr("transform",function(a,b){return"translate("+y(i(a,b))+","+z(j(a,b))+")"}).attr("d",d3.svg.symbol().type(l).size(function(a,b){return h(k(a,b))})),d3.transition(N.exit().selectAll("path.point")).attr("transform",function(a,b){return"translate("+f(i(a,b))+","+g(j(a,b))+")"}).remove(),O.attr("class",function(a,b){return"point point-"+b}),d3.transition(O).attr("transform",function(a,b){return"translate("+f(i(a,b))+","+g(j(a,b))+")"}).attr("d",d3.svg.symbol().type(l).size(function(a,b){return h(k(a,b))})),clearTimeout(B),B=setTimeout(M,1e3),y=f.copy(),z=g.copy(),A=h.copy()}),C}var a={top:0,right:0,bottom:0,left:0},b=960,c=500,d=d3.scale.category20().range(),e=Math.floor(Math.random()*1e5),f=d3.scale.linear(),g=d3.scale.linear(),h=d3.scale.linear(),i=function(a){return a.x},j=function(a){return a.y},k=function(a){return a.size},l=function(a){return a.shape||"circle"},m=[],n=[],o=[],p=!0,q=function(a){return!a.notActive},r=!1,s=!0,t=function(){return 25},u=null,v=null,w=null,x=d3.dispatch("elementClick","elementMouseover","elementMouseout"),y,z,A,B;return x.on("elementMouseover.point",function(a){p&&d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!0)}),x.on("elementMouseout.point",function(a){p&&d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!1)}),C.dispatch=x,C.x=function(a){return arguments.length?(i=d3.functor(a),C):i},C.y=function(a){return arguments.length?(j=d3.functor(a),C):j},C.size=function(a){return arguments.length?(k=d3.functor(a),C):k},C.margin=function(b){return arguments.length?(a=b,C):a},C.width=function(a){return arguments.length?(b=a,C):b},C.height=function(a){return arguments.length?(c=a,C):c},C.xScale=function(a){return arguments.length?(f=a,C):f},C.yScale=function(a){return arguments.length?(g=a,C):g},C.zScale=function(a){return arguments.length?(h=a,C):h},C.xDomain=function(a){return arguments.length?(u=a,C):u},C.yDomain=function(a){return arguments.length?(v=a,C):v},C.sizeDomain=function(a){return arguments.length?(w=a,C):w},C.forceX=function(a){return arguments.length?(m=a,C):m},C.forceY=function(a){return arguments.length?(n=a,C):n},C.forceSize=function(a){return arguments.length?(o=a,C):o},C.interactive=function(a){return arguments.length?(p=a,C):p},C.pointActive=function(a){return arguments.length?(q=a,C):q},C.clipEdge=function(a){return arguments.length?(r=a,C):r},C.clipVoronoi=function(a){return arguments.length?(s=a,C):s},C.clipRadius=function(a){return arguments.length?(t=a,C):t},C.color=function(a){return arguments.length?(d=a,C):d},C.shape=function(a){return arguments.length?(l=a,C):l},C.id=function(a){return arguments.length?(e=a,C):e},C},a.models.scatterChart=function(){function D(a){return a.each(function(h){function I(){if(m)return H.select(".point-paths").style("pointer-events","all"),!1;H.select(".point-paths").style("pointer-events","none");var a=d3.mouse(this);f.distortion(l).focus(a[0]),g.distortion(l).focus(a[1]),H.select(".scatterWrap").datum(h.filter(function(a){return!a.disabled})).call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t),H.select(".distributionX").datum(h.filter(function(a){return!a.disabled})).call(w),H.select(".distributionY").datum(h.filter(function(a){return!a.disabled})).call(x)}var i=d3.select(this),o=this,p=(c||parseInt(i.style("width"))||960)-b.left-b.right,q=(d||parseInt(i.style("height"))||400)-b.top-b.bottom;f=r.xScale(),g=r.yScale(),z=z||f,A=A||g;var E=i.selectAll("g.wrap.scatterChart").data([h]),F=E.enter().append("g").attr("class","wrap nvd3 scatterChart chart-"+r.id()),G=F.append("g"),H=E.select("g");G.append("rect").attr("class","nvd3 background"),G.append("g").attr("class","x axis"),G.append("g").attr("class","y axis"),G.append("g").attr("class","scatterWrap"),G.append("g").attr("class","distWrap"),G.append("g").attr("class","legendWrap"),G.append("g").attr("class","controlsWrap"),E.attr("transform","translate("+b.left+","+b.top+")"),j&&(u.width(p/2),E.select(".legendWrap").datum(h).call(u),b.top!=u.height()&&(b.top=u.height(),q=(d||parseInt(i.style("height"))||400)-b.top-b.bottom),E.select(".legendWrap").attr("transform","translate("+p/2+","+ -b.top+")")),k&&(v.width(180).color(["#444"]),H.select(".controlsWrap").datum(C).attr("transform","translate(0,"+ -b.top+")").call(v)),H.select(".background").attr("width",p).attr("height",q),r.width(p).height(q).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),E.select(".scatterWrap").datum(h.filter(function(a){return!a.disabled})).call(r),s.scale(f).ticks(p/100).tickSize(-q,0),H.select(".x.axis").attr("transform","translate(0,"+g.range()[0]+")").call(s),t.scale(g).ticks(q/36).tickSize(-p,0),H.select(".y.axis").call(t),w.scale(f).width(p).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionX").attr("transform","translate(0,"+g.range()[0]+")"),H.select(".distributionX").datum(h.filter(function(a){return!a.disabled})).call(w),x.scale(g).width(q).color(h.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!h[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionY").attr("transform","translate(-"+x.size()+",0)"),H.select(".distributionY").datum(h.filter(function(a){return!a.disabled})).call(x),H.select(".background").on("mousemove",I),H.select(".background").on("click",function(){m=!m}),H.select(".point-paths").on("click",function(){m=!m}),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l=b.disabled?0:2.5,H.select(".background").style("pointer-events",b.disabled?"none":"all"),H.select(".point-paths").style("pointer-events",b.disabled?"all":"none"),b.disabled?(f.distortion(l).focus(0),g.distortion(l).focus(0),H.select(".scatterWrap").call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t)):m=!1,D(a)}),u.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){return a.disabled=!1,E.selectAll(".series").classed("disabled",!1),a}),D(a)}),r.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .distx-"+a.pointIndex).attr("y1",a.pos[1]-q),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .disty-"+a.pointIndex).attr("x2",a.pos[0]+w.size()),a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){n&&B(a,o.parentNode)}),z=f.copy(),A=g.copy(),D.update=function(){D(a)},D.container=this}),D}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=d3.fisheye.scale(d3.scale.linear).distortion(0),g=d3.fisheye.scale(d3.scale.linear).distortion(0),h=!1,i=!1,j=!0,k=!0,l=0,m=!1,n=!0,o=function(a,b,c){return""+b+""},p=function(a,b,c){return""+c+""},q=function(a,b,c,d,e){return""+a+"
"+""+c+" at "+b+"
"},r=a.models.scatter().xScale(f).yScale(g),s=a.models.axis().orient("bottom").tickPadding(10),t=a.models.axis().orient("left").tickPadding(10),u=a.models.legend().height(30),v=a.models.legend().height(30),w=a.models.distribution().axis("x"),x=a.models.distribution().axis("y"),y=d3.dispatch("tooltipShow","tooltipHide"),z,A,B=function(c,d){var e=c.pos[0]+(d.offsetLeft||0),h=g.range()[0]+b.top+(d.offsetTop||0),i=f.range()[0]+b.left+(d.offsetLeft||0),j=c.pos[1]+(d.offsetTop||0),k=s.tickFormat()(r.x()(c.point)),l=t.tickFormat()(r.y()(c.point)),m=o(c.series.key,k,l,c,D),n=p(c.series.key,k,l,c,D);a.tooltip.show([e,h],m,"n",1),a.tooltip.show([i,j],n,"e",1)},C=[{key:"Magnify",disabled:!0}];return r.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .distx-"+a.pointIndex).attr("y1",0),d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .disty-"+a.pointIndex).attr("x2",x.size())}),y.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),D.dispatch=y,D.legend=u,D.controls=u,D.xAxis=s,D.yAxis=t,D.distX=w,D.distY=x,d3.rebind(D,r,"id","interactive","pointActive","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),D.margin=function(a){return arguments.length?(b=a,D):b},D.width=function(a){return arguments.length?(c=a,D):c},D.height=function(a){return arguments.length?(d=a,D):d},D.color=function(a){return arguments.length?(e=a,u.color(a),w.color(a),x.color(a),D):e},D.showDistX=function(a){return arguments.length?(h=a,D):h},D.showDistY=function(a){return arguments.length?(i=a,D):i},D.showControls=function(a){return arguments.length?(k=a,D):k},D.showLegend=function(a){return arguments.length?(j=a,D):j},D.fisheye=function(a){return arguments.length?(l=a,D):l},D.tooltips=function(a){return arguments.length?(n=a,D):n},D.tooltipContent=function(a){return arguments.length?(q=a,D):q},D.tooltipXContent=function(a){return arguments.length?(o=a,D):o},D.tooltipYContent=function(a){return arguments.length?(p=a,D):p},D},a.models.sparkline=function(){function l(d){return d.each(function(d){var l=b-a.left-a.right,m=c-a.top-a.bottom;j.domain(h||d3.extent(d,e)).range([0,l]),k.domain(i||d3.extent(d,f)).range([m,0]);var n=d3.select(this).selectAll("g.sparkline").data([d]),o=n.enter().append("g").attr("class","nvd3 sparkline");o.attr("transform","translate("+a.left+","+a.top+")").style("stroke",function(a,b){return a.color||g[b*g.length]});var p=o.selectAll("path").data(function(a){return[a]});p.enter().append("path"),p.exit().remove(),p.attr("d",d3.svg.line().x(function(a,b){return j(e(a,b))}).y(function(a,b){return k(f(a,b))}));var q=o.selectAll("circle.point").data(function(a){return a.filter(function(a,b){return k.domain().indexOf(f(a,b))!=-1||e(a,b)==j.domain()[1]})});q.enter().append("circle").attr("class","point"),q.exit().remove(),q.attr("cx",function(a,b){return j(e(a,b))}).attr("cy",function(a,b){return k(f(a,b))}).attr("r",2).style("stroke",function(a,b){return a.x==j.domain()[1]?"#444":a.y==k.domain()[0]?"#d62728":"#2ca02c"}).style("fill",function(a,b){return a.x==j.domain()[1]?"#444":a.y==k.domain()[0]?"#d62728":"#2ca02c"})}),l}var a={top:0,right:0,bottom:0,left:0},b=400,c=32,d=!0,e=function(a){return a.x},f=function(a){return a.y},g=d3.scale.category20().range(),h,i,j=d3.scale.linear(),k=d3.scale.linear();return l.margin=function(b){return arguments.length?(a=b,l):a},l.width=function(a){return arguments.length?(b=a,l):b},l.height=function(a){return arguments.length?(c=a,l):c},l.x=function(a){return arguments.length?(e=d3.functor(a),l):e},l.y=function(a){return arguments.length?(f=d3.functor(a),l):f},l.xDomain=function(a){return arguments.length?(h=a,l):h},l.yDomain=function(a){return arguments.length?(i=a,l):i},l.animate=function(a){return arguments.length?(d=a,l):d},l},a.models.sparklinePlus=function(){function o(a){return a.each(function(a){function w(){var c=d3.event.offsetX-b.left;t.attr("x1",c).attr("x2",c),u.attr("transform",function(a){return"translate("+(c-6)+","+ -b.top+")"}).text(j(Math.round(l.invert(c)))),v.attr("transform",function(a){return"translate("+(c+6)+","+ -b.top+")"}).text(k(g(a[Math.round(l.invert(c))])))}var e=c-b.left-b.right,i=d-b.top-b.bottom;l.domain(d3.extent(a,f)).range([0,e]),m.domain(d3.extent(a,g)).range([i,0]);var o=d3.select(this).selectAll("g.sparklineplus").data([a]),p=o.enter().append("g"),q=p.append("g").attr("class","nvd3 sparklineplus").attr("transform","translate("+b.left+","+b.top+")").style("stroke",function(a,b){return a.color||h[b%h.length]});n.xDomain(l.domain()).yDomain(m.domain()),q.call(n);var r=q.append("g").attr("class","hoverValue"),s=q.append("g").attr("class","hoverArea");r.attr("transform",function(a){return"translate("+l(a)+",0)"});var t=r.append("line").attr("x1",l.range()[1]).attr("y1",-b.top).attr("x2",l.range()[1]).attr("y2",d),u=r.append("text").attr("class","xValue").attr("text-anchor","end").attr("dy",".9em"),v=r.append("text").attr("class","yValue").attr("text-anchor","start").attr("dy",".9em");s.append("rect").attr("width",e).attr("height",i).on("mousemove",w)}),o}var b={top:15,right:40,bottom:3,left:40},c=400,d=50,e=!0,f=function(a){return a.x},g=function(a){return a.y},h=d3.scale.category20().range(),i=Math.floor(Math.random()*1e5),j=d3.format(",r"),k=d3.format(",.2f"),l=d3.scale.linear(),m=d3.scale.linear(),n=a.models.sparkline();return o.margin=function(a){return arguments.length?(b=a,o):b},o.width=function(a){return arguments.length?(c=a,n.width(a-b.left-b.right),o):c},o.height=function(a){return arguments.length?(d=a,n.height(a-b.top-b.bottom),o):d},o.x=function(a){return arguments.length?(f=d3.functor(a),n.x(a),o):f},o.y=function(a){return arguments.length?(g=d3.functor(a),n.y(a),o):g},o.id=function(a){return arguments.length?(i=a,o):i},o.animate=function(a){return arguments.length?(e=a,o):e},o},a.models.stackedArea=function(){function r(a){return a.each(function(a){var i=c-b.left-b.right,o=d-b.top-b.bottom;m=p.xScale(),n=p.yScale(),a=a.map(function(a,b){return a.values=a.values.map(function(b,c){return b.index=c,b.stackedY=a.disabled?0:h(b,c),b}),a}),a=d3.layout.stack().order(k).offset(j).values(function(a){return a.values}).x(g).y(function(a){return a.stackedY}).out(function(a,b,c){a.display={y:c,y0:b}})(a);var r=d3.select(this).selectAll("g.wrap.stackedarea").data([a]),s=r.enter().append("g").attr("class","wrap nvd3 stackedarea"),t=s.append("defs"),u=s.append("g"),v=r.select("g");u.append("g").attr("class","areaWrap"),p.width(i).height(o).x(g).y(function(a){return a.display.y+a.display.y0}).forceY([0]).color(a.map(function(a,b){return a.color||e[b%e.length]}).filter(function(b,c){return!a[c].disabled})),u.append("g").attr("class","scatterWrap");var w=v.select(".scatterWrap").datum(a.filter(function(a){return!a.disabled}));d3.transition(w).call(p),r.attr("transform","translate("+b.left+","+b.top+")"),t.append("clipPath").attr("id","edge-clip-"+f).append("rect"),r.select("#edge-clip-"+f+" rect").attr("width",i).attr("height",o),v.attr("clip-path",l?"url(#edge-clip-"+f+")":"");var z=d3.svg.area().x(function(a,b){return m(g(a,b))}).y0(function(a){return n(a.display.y0)}).y1(function(a){return n(a.display.y+a.display.y0)}),A=d3.svg.area().x(function(a,b){return m(g(a,b))}).y0(function(a){return n(a.display.y0)}).y1(function(a){return n(a.display.y0)}),B=v.select(".areaWrap").selectAll("path.area").data(function(a){return a});B.enter().append("path").attr("class",function(a,b){return"area area-"+b}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),q.areaMouseover({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),q.areaMouseout({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}).on("click",function(a,b){d3.select(this).classed("hover",!1),q.areaClick({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:b})}),d3.transition(B.exit()).attr("d",function(a,b){return A(a.values,b)}).remove(),B.style("fill",function(a,b){return a.color||e[b%e.length]}).style("stroke",function(a,b){return a.color||e[b%e.length]}),d3.transition(B).attr("d",function(a,b){return z(a.values,b)}),p.dispatch.on("elementMouseover.area",function(a){v.select(".area-"+a.seriesIndex).classed("hover",!0)}),p.dispatch.on("elementMouseout.area",function(a){v.select(".area-"+a.seriesIndex).classed("hover",!1)})}),r}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.category20().range(),f=Math.floor(Math.random()*1e5),g=function(a){return a.x},h=function(a){return a.y},i="stack",j="zero",k="default",l=!1,m,n,o=d3.layout.stack().values(function(a){return a.values}).x(g).y(function(a){return a.stackedY}).out(function(a,b,c){a.display={y:c,y0:b}}),p=a.models.scatter().size(2.2).sizeDomain([2.5]),q=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return p.dispatch.on("elementClick.area",function(a){q.areaClick(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)}),r.dispatch=q,r.scatter=p,d3.rebind(r,p,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),r.x=function(a){return arguments.length?(g=d3.functor(a),r):g},r.y=function(a){return arguments.length?(h=d3.functor(a),r):h},r.margin=function(a){return arguments.length?(b=a,r):b},r.width=function(a){return arguments.length?(c=a,r):c},r.height=function(a){return arguments.length?(d=a,r):d},r.clipEdge=function(a){return arguments.length?(l=a,r):l},r.color=function(a){return arguments.length?(e=a,r):e},r.offset=function(a){return arguments.length?(j=a,r):j},r.order=function(a){return arguments.length?(k=a,r):k},r.style=function(a){if(!arguments.length)return i;i=a;switch(i){case"stack":r.offset("zero"),r.order("default");break;case"stream":r.offset("wiggle"),r.order("inside-out");break;case"expand":r.offset("expand"),r.order("default")}return r},r},a.models.stackedAreaChart=function(){function t(a){return a.each(function(e){var i=d3.select(this),u=this,v=(c||parseInt(i.style("width"))||960)-b.left-b.right,w=(d||parseInt(i.style("height"))||400)-b.top-b.bottom;j=l.xScale(),k=l.yScale();var z=i.selectAll("g.wrap.stackedAreaChart").data([e]),A=z.enter().append("g").attr("class","wrap nvd3 stackedAreaChart").append("g");A.append("g").attr("class","x axis"),A.append("g").attr("class","y axis"),A.append("g").attr("class","stackedWrap"),A.append("g").attr("class","legendWrap"),A.append("g").attr("class","controlsWrap");var B=z.select("g");g&&(o.width(v/2),B.select(".legendWrap").datum(e).call(o),b.top!=o.height()&&(b.top=o.height(),w=(d||parseInt(i.style("height"))||400)-b.top-b.bottom),B.select(".legendWrap").attr("transform","translate("+v/2+","+ -b.top+")")),l.width(v).height(w),f&&(p.width(280).color(["#444","#444","#444"]),B.select(".controlsWrap").datum(r).attr("transform","translate(0,"+ -b.top+")").call(p)),B.attr("transform","translate("+b.left+","+b.top+")");var C=B.select(".stackedWrap").datum(e);d3.transition(C).call(l),m.scale(j).ticks(v/100).tickSize(-w,0),B.select(".x.axis").attr("transform","translate(0,"+w+")"),d3.transition(B.select(".x.axis")).call(m),n.scale(k).ticks(l.offset()=="wiggle"?0:w/36).tickSize(-v,0).tickFormat(l.offset()=="expand"?d3.format("%"):d3.format(",.2f")),d3.transition(B.select(".y.axis")).call(n),l.dispatch.on("areaClick.toggle",function(b){e.filter(function(a){return!a.disabled}).length===1?e=e.map(function(a){return a.disabled=!1,a}):e=e.map(function(a,c){return a.disabled=c!=b.seriesIndex,a}),a.transition().call(t)}),o.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,e.filter(function(a){return!a.disabled}).length||e.map(function(a){return a.disabled=!1,a}),a.transition().call(t)}),p.dispatch.on("legendClick",function(b,c){if(!b.disabled)return;r=r.map(function(a){return a.disabled=!0,a}),b.disabled=!1;switch(b.key){case"Stacked":l.style("stack");break;case"Stream":l.style("stream");break;case"Expanded":l.style("expand")}a.transition().call(t)}),q.on("tooltipShow",function(a){h&&s(a,u.parentNode)})}),t.update=function(){a.transition().call(t)},t.container=this,t}var b={top:30,right:25,bottom:50,left:60},c=null,d=null,e=d3.scale.category20().range(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return""+a+"
"+""+c+" on "+b+"
"},j,k,l=a.models.stackedArea(),m=a.models.axis().orient("bottom").tickPadding(5),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide"),r=[{key:"Stacked"},{key:"Stream",disabled:!0},{key:"Expanded",disabled:!0}],s=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(l.x()(b.point)),g=n.tickFormat()(l.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")};return l.dispatch.on("tooltipShow",function(a){if(!Math.round(l.y()(a.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow +(a)}),l.dispatch.on("tooltipHide",function(a){q.tooltipHide(a)}),q.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),t.dispatch=q,t.stacked=l,t.xAxis=m,t.yAxis=n,d3.rebind(t,l,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize"),t.margin=function(a){return arguments.length?(b=a,t):b},t.width=function(a){return arguments.length?(c=a,t):getWidth},t.height=function(a){return arguments.length?(d=a,t):getHeight},t.color=function(a){return arguments.length?(e=a,o.color(a),t):e},t.showControls=function(a){return arguments.length?(f=a,t):f},t.showLegend=function(a){return arguments.length?(g=a,t):g},t.tooltips=function(a){return arguments.length?(h=a,t):h},t.tooltipContent=function(a){return arguments.length?(i=a,t):i},t}})(); \ No newline at end of file diff --git a/src/models/lineWithFocusChart.js b/src/models/lineWithFocusChart.js index 834188e..abf4421 100644 --- a/src/models/lineWithFocusChart.js +++ b/src/models/lineWithFocusChart.js @@ -158,7 +158,7 @@ nv.models.lineWithFocusChart = function() { x2Axis - .tickFormat(xAxis.tickFormat()) //TODO: make sure everythign set on the Axes is set on both x and x2, and y and y2 respectively + //.tickFormat(xAxis.tickFormat()) //exposing x2Axis so user can set differently .ticks( availableWidth / 100 ) .tickSize(-availableHeight2, 0); @@ -169,7 +169,7 @@ nv.models.lineWithFocusChart = function() { y2Axis - .tickFormat(yAxis.tickFormat()) + //.tickFormat(yAxis.tickFormat()) //exposing y2Axis so user can set differently .ticks( availableHeight2 / 36 ) .tickSize( -availableWidth, 0); @@ -289,6 +289,8 @@ nv.models.lineWithFocusChart = function() { chart.legend = legend; chart.xAxis = xAxis; chart.yAxis = yAxis; + chart.x2Axis = x2Axis; + chart.y2Axis = y2Axis; d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');