You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nvd3/nv.d3.min.js

4 lines
124 KiB
JavaScript

(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g<d&&b(g);if(f>1)while(g<e){var i=new Date(+g);c(i)%f===0&&h.push(i),b(g)}else while(g<e)h.push(new Date(+g)),b(g);return h}}function b(a,b){return(new Date(b,a+1,0)).getDate()}var a={version:"0.0.1a",dev:!0};window.nv=a,a.tooltip={},a.utils={},a.models={},a.charts={},a.graphs=[],a.logs={},a.dispatch=d3.dispatch("render_start","render_end"),a.dev&&(a.dispatch.on("render_start",function(b){a.logs.startTime=+(new Date)}),a.dispatch.on("render_end",function(b){a.logs.endTime=+(new Date),a.logs.totalTime=a.logs.endTime-a.logs.startTime,a.log("total",a.logs.totalTime)})),a.log=function(){a.dev&&console.log&&console.log.apply(console,arguments);return arguments[arguments.length-1]},a.render=function b(c){c=c||1,b.active=!0,a.dispatch.render_start(),setTimeout(function(){var d;for(var e=0;e<c&&(graph=b.queue[e]);e++)d=graph.generate(),typeof graph.callback==typeof Function&&graph.callback(d),a.graphs.push(d);b.queue.splice(0,e),b.queue.length?setTimeout(arguments.callee,0):(a.render.active=!1,a.dispatch.render_end())},0)},a.render.queue=[],a.addGraph=function(b){typeof arguments[0]==typeof Function&&(b={generate:arguments[0],callback:arguments[1]}),a.render.queue.push(b),a.render.active||a.render()},a.identity=function(a){return a},a.strip=function(a){return a.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(a){return new Date(a.getFullYear(),a.getMonth(),0)},d3.time.monthEnds=c(d3.time.monthEnd,function(a){a.setUTCDate(a.getUTCDate()+1),a.setDate(b(a.getMonth()+1,a.getFullYear()))},function(a){return a.getMonth()}),function(){var b=window.nv.tooltip={};b.show=function(b,c,d,e,f,g){var h=document.createElement("div");h.className="nvtooltip "+(g?g:"xy-tooltip"),d=d||"s",e=e||20;var i=f?f:document.getElementsByTagName("body")[0];h.innerHTML=c,h.style.left=0,h.style.top=0,h.style.opacity=0,i.appendChild(h);var j=parseInt(h.offsetHeight),k=parseInt(h.offsetWidth),l=a.utils.windowSize().width,m=a.utils.windowSize().height,n=i.scrollTop,o=i.scrollLeft,p,q;switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2,p<o&&(p=b[0]+e),q<n&&(q=n+5),q+j>n+m&&(q=n-j-5);break;case"w":p=b[0]+e,q=b[1]-j/2,p+k>l&&(p=b[0]-k-e),q<n&&(q=n+5),q+j>n+m&&(q=n-j-5);break;case"n":p=b[0]-k/2,q=b[1]+e,p<o&&(p=o+5),p+k>l&&(p=l-k-5),q+j>n+m&&(q=b[1]-j-e);break;case"s":p=b[0]-k/2,q=b[1]-j-e,p<o&&(p=o+5),p+k>l&&(p=l-k-5),n>q&&(q=b[1]+20)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(b){if(!arguments.length)return a.utils.defaultColor();return Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.pjax=function(b,c){function d(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})}d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.models.axis=function(){function m(b){b.each(function(b){var m=d3.select(this),n=m.selectAll("g.nv-wrap.nv-axis").data([b]),o=n.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),p=o.append("g"),q=n.select("g");j!==null?k.ticks(j):(k.orient()=="top"||k.orient()=="bottom")&&k.ticks(Math.abs(c.range()[1]-c.range()[0])/100),d3.transition(q).call(k),l=l||k.scale();var r=q.selectAll("text.nv-axislabel").data([d||null]);r.exit().remove();switch(k.orient()){case"top":r.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var s=c.range().length==2?c.range()[1]:c.range()[c.range().length-1]+(c.range()[1]-c.range()[0]);r.attr("x",s/2);if(e){var t=n.selectAll("g.nv-axisMaxMin").data(c.domain());t.enter().append("g").attr("class","nv-axisMaxMin").append("text"),t.exit().remove(),t.attr("transform",function(a,b){return"translate("+c(a)+",0)"}).select("text").attr("dy","0em").attr("y",-k.tickPadding()).attr("text-anchor","middle").text(function(a,b){return(""+k.tickFormat()(a)).match("NaN")?"":k.tickFormat()(a)}),d3.transition(t).attr("transform",function(a,b){return"translate("+c.range()[b]+",0)"})}break;case"bottom":var u=30,v=30;if(g%360){var w=q.selectAll("g").select("text");w.each(function(a,b){var c=this.getBBox().width;c>v&&(v=c)});var x=Math.abs(Math.sin(g*Math.PI/180)),u=(x?x*v:v)+30;w.attr("transform",function(a,b,c){return"rotate("+g+" 0,0)"}).attr("text-anchor",g%360>0?"start":"end")}r.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",u);var s=c.range().length==2?c.range()[1]:c.range()[c.range().length-1]+(c.range()[1]-c.range()[0]);r.attr("x",s/2);if(e){var t=n.selectAll("g.nv-axisMaxMin").data(c.domain());t.enter().append("g").attr("class","nv-axisMaxMin").append("text"),t.exit().remove(),t.attr("transform",function(a,b){return"translate("+c(a)+",0)"}).select("text").attr("dy",".71em").attr("y",k.tickPadding()).attr("transform",function(a,b,c){return"rotate("+g+" 0,0)"}).attr("text-anchor",g%360>0?"start":"end").text(function(a,b){return(""+k.tickFormat()(a)).match("NaN")?"":k.tickFormat()(a)}),d3.transition(t).attr("transform",function(a,b){return"translate("+c.range()[b]+",0)"})}break;case"right":r.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",h?"middle":"begin").attr("transform",h?"rotate(90)":"").attr("y",h?-Math.max(i.right,a)-12:-10),r.attr("x",h?c.range()[0]/2:k.tickPadding());if(e){var t=n.selectAll("g.nv-axisMaxMin").data(c.domain());t.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),t.exit().remove(),t.attr("transform",function(a,b){return"translate(0,"+c(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",k.tickPadding()).attr("text-anchor","start").text(function(a,b){return(""+k.tickFormat()(a)).match("NaN")?"":k.tickFormat()(a)}),d3.transition(t).attr("transform",function(a,b){return"translate(0,"+c.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":r.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",h?"middle":"end").attr("transform",h?"rotate(-90)":"").attr("y",h?-Math.max(i.left,a)+12:-10),r.attr("x",h?-c.range()[0]/2:-k.tickPadding());if(e){var t=n.selectAll("g.nv-axisMaxMin").data(c.domain());t.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),t.exit().remove(),t.attr("transform",function(a,b){return"translate(0,"+l(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-k.tickPadding()).attr("text-anchor","end").text(function(a,b){return(""+k.tickFormat()(a)).match("NaN")?"":k.tickFormat()(a)}),d3.transition(t).attr("transform",function(a,b){return"translate(0,"+c.range()[b]+")"}).select("text").style("opacity",1)}}r.text(function(a){return a}),e&&(k.orient()==="left"||k.orient()==="right")&&q.selectAll("g").each(function(a,b){if(c(a)<c.range()[1]+10||c(a)>c.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()});if(e&&(k.orient()==="top"||k.orient()==="bottom")){var y=[];n.selectAll("g.nv-axisMaxMin").each(function(a,b){b?y.push(c(a)-this.getBBox().width-4):y.push(c(a)+this.getBBox().width+4)}),q.selectAll("g").each(function(a,b){if(c(a)<y[0]||c(a)>y[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}f&&q.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),l=c.copy()});return m}var a=60,b=60,c=d3.scale.linear(),d=null,e=!0,f=!0,g=0,h=!0,i={top:0,right:0,bottom:0,left:0},j=null,k=d3.svg.axis().scale(c).orient("bottom").tickFormat(function(a){return a}),l;d3.rebind(m,k,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(m,c,"domain","range","rangeBand","rangeBands"),m.width=function(b){if(!arguments.length)return a;a=b;return m},m.ticks=function(a){if(!arguments.length)return j;j=a;return m},m.height=function(a){if(!arguments.length)return b;b=a;return m},m.axisLabel=function(a){if(!arguments.length)return d;d=a;return m},m.showMaxMin=function(a){if(!arguments.length)return e;e=a;return m},m.highlightZero=function(a){if(!arguments.length)return f;f=a;return m},m.scale=function(a){if(!arguments.length)return c;c=a,k.scale(c),d3.rebind(m,c,"domain","range","rangeBand","rangeBands");return m},m.rotateYLabel=function(a){if(!arguments.length)return h;h=a;return m},m.rotateLabels=function(a){if(!arguments.length)return g;g=a;return m},m.margin=function(a){if(!arguments.length)return i;i=a;return m};return m},a.models.historicalBar=function(){function s(a){a.each(function(a){var p=c-b.left-b.right,q=d-b.top-b.bottom;n.domain(l||d3.extent(a[0].values.map(f).concat(h))).range([0,p]),o.domain(m||d3.extent(a[0].values.map(g).concat(i))).range([q,0]);if(n.domain()[0]===n.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]-n.domain()[0]*.01,n.domain()[1]+n.domain()[1]*.01]):n.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var s=d3.select(this).on("click",function(a,b){r.chartClick({data:a,index:b,pos:d3.event,id:e})}),t=d3.select(this).selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("g");v.append("g").attr("class","nv-bars"),t.attr("width",c).attr("height",d);var w=t.select("g").attr("transform","translate("+b.left+","+b.top+")");u.append("defs").append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",p).attr("height",q),v.attr("clip-path",j?"url(#nv-chart-clip-path-"+e+")":"");var z=v.append("g").attr("class","nv-shiftWrap"),A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("class",function(a,b,c){return(g(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("fill",function(a,b){return k(a,b)}).attr("x",0).attr("y",function(a,b){return o(Math.max(0,g(a,b)))}).attr("height",function(a,b){return Math.abs(o(g(a,b))-o(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),r.elementMouseover({point:b,series:a[0],pos:[n(f(b,c)),o(g(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),r.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){r.elementClick({value:g(a,b),data:a,index:b,pos:[n(f(a,b)),o(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){r.elementDblClick({value:g(a,b),data:a,index:b,pos:[n(f(a,b)),o(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("class",function(a,b,c){return(g(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(n(f(b,c))-p/a[0].values.length*.5)+",0)"}).attr("width",p/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return o(Math.max(0,g(a,b)))}).attr("height",function(a,b){return Math.abs(o(g(a,b))-o(0))})});return s}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=function(a){return a.x},g=function(a){return a.y},h=[],i=[],j=!0,k=a.utils.defaultColor(),l,m,n=d3.scale.linear(),o=d3.scale.linear(),p=d3.svg.axis().scale(n).orient("bottom"),q=d3.svg.axis().scale(o).orient("left"),r=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");s.dispatch=r,s.x=function(a){if(!arguments.length)return f;f=a;return s},s.y=function(a){if(!arguments.length)return g;g=a;return s},s.margin=function(a){if(!arguments.length)return b;b=a;return s},s.width=function(a){if(!arguments.length)return c;c=a;return s},s.height=function(a){if(!arguments.length)return d;d=a;return s},s.xScale=function(a){if(!arguments.length)return n;n=a;return s},s.yScale=function(a){if(!arguments.length)return o;o=a;return s},s.xDomain=function(a){if(!arguments.length)return l;l=a;return s},s.yDomain=function(a){if(!arguments.length)return m;m=a;return s},s.forceX=function(a){if(!arguments.length)return h;h=a;return s},s.forceY=function(a){if(!arguments.length)return i;i=a;return s},s.clipEdge=function(a){if(!arguments.length)return j;j=a;return s},s.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return s},s.id=function(a){if(!arguments.length)return e;e=a;return s};return s},a.models.bullet=function(){function k(a){a.each(function(a,i){var k=g-c.left-c.right,l=h-c.top-c.bottom,m=d.call(this,a,i).slice().sort(d3.descending),n=e.call(this,a,i).slice().sort(d3.descending),o=f.call(this,a,i).slice().sort(d3.descending),p=d3.select(this).selectAll("g.nv-wrap.nv-bullet").data([a]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),r=q.append("g"),s=p.select("g");p.attr("transform","translate("+c.left+","+c.top+")");var t=d3.scale.linear().domain([0,Math.max(m[0],n[0],o[0])]).range(b?[k,0]:[0,k]),u=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(t.range());this.__chart__=t;var v=function(a){return Math.abs(u(a)-u(0))},w=function(a){return Math.abs(t(a)-t(0))},x=s.selectAll("rect.nv-range").data(m);x.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",v).attr("height",l).attr("x",b?u:0).on("mouseover",function(a,b){j.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[t(a),l/2]})}).on("mouseout",function(a,b){j.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(x).attr("x",b?t:0).attr("width",w).attr("height",l);var y=s.selectAll("rect.nv-measure").data(o);y.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).attr("width",v).attr("height",l/3).attr("x",b?u:0).attr("y",l/3).on("mouseover",function(a){j.elementMouseover({value:a,label:"Current",pos:[t(a),l/2]})}).on("mouseout",function(a){j.elementMouseout({value:a,label:"Current"})}),d3.transition(y).attr("width",w).attr("height",l/3).attr("x",b?t:0).attr("y",l/3);var z=s.selectAll("path.nv-markerTriangle").data(n),A=l/6;z.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+u(a)+","+l/2+")"}).attr("d","M0,"+A+"L"+A+","+ -A+" "+ -A+","+ -A+"Z").on("mouseover",function(a,b){j.elementMouseover({value:a,label:"Previous",pos:[t(a),l/2]})}).on("mouseout",function(a,b){j.elementMouseout({value:a,label:"Previous"})}),d3.transition(z).attr("transform",function(a){return"translate("+t(a)+","+l/2+")"}),z.exit().remove()}),d3.timer.flush()}var a="left",b=!1,c={top:0,right:0,bottom:0,left:0},d=function(a){return a.ranges},e=function(a){return a.markers},f=function(a){return a.measures},g=380,h=30,i=null,j=d3.dispatch("elementMouseover","elementMouseout");k.dispatch=j,k.orient=function(c){if(!arguments.length)return a;a=c,b=a=="right"||a=="bottom";return k},k.ranges=function(a){if(!arguments.length)return d;d=a;return k},k.markers=function(a){if(!arguments.length)return e;e=a;return k},k.measures=function(a){if(!arguments.length)return f;f=a;return k},k.width=function(a){if(!arguments.length)return g;g=a;return k},k.height=function(a){if(!arguments.length)return h;h=a;return k},k.margin=function(a){if(!arguments.length)return c;c=a;return k},k.tickFormat=function(a){if(!arguments.length)return i;i=a;return k};return k},a.models.bulletChart=function(){function q(b){b.each(function(b,l){var m=d3.select(this),q=(h||parseInt(m.style("width"))||960)-d.left-d.right,r=i-d.top-d.bottom,s=this,t=e.call(this,b,l).slice().sort(d3.descending),u=f.call(this,b,l).slice().sort(d3.descending),v=g.call(this,b,l).slice().sort(d3.descending),w=m.selectAll("g.nv-wrap.nv-bulletChart").data([b]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),y=x.append("g");y.append("g").attr("class","nv-bulletWrap"),y.append("g").attr("class","nv-titles");var z=w.select("g");w.attr("transform","translate("+d.left+","+d.top+")");var A=d3.scale.linear().domain([0,Math.max(t[0],u[0],v[0])]).range(c?[q,0]:[0,q]),B=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var C=function(a){return Math.abs(B(a)-B(0))},D=function(a){return Math.abs(A(a)-A(0))},E=z.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(i-d.top-d.bottom)/2+")");E.append("text").attr("class","nv-title").text(function(a){return a.title}),E.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),o.width(q).height(r);var F=z.select(".nv-bulletWrap");d3.transition(F).call(o);var G=j||A.tickFormat(8),H=z.selectAll("g.nv-tick").data(A.ticks(8),function(a){return this.textContent||G(a)}),I=H.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+B(a)+",0)"}).style("opacity",1e-6);I.append("line").attr("y1",r).attr("y2",r*7/6),I.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",r*7/6).text(G),d3.transition(I).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1);var J=d3.transition(H).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1);J.select("line").attr("y1",r).attr("y2",r*7/6),J.select("text").attr("y",r*7/6),d3.transition(H.exit()).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1e-6).remove(),o.dispatch.on("elementMouseover.tooltip",function(a){n.tooltipShow(a)}),k&&n.on("tooltipShow",function(a){p(a,s.parentNode)}),o.dispatch.on("elementMouseout.tooltip",function(a){n.tooltipHide(a)}),k&&n.on("tooltipHide",a.tooltip.cleanup)}),d3.timer.flush()}var b="left",c=!1,d={top:5,right:40,bottom:20,left:120},e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=null,i=55,j=null,k=!0,l=function(a,b,c,d,e){return"<h3>"+d.label+"</h3>"+"<p>"+d.value+"</p>"},m="No Data Available.",n=d3.dispatch("tooltipShow","tooltipHide"),o=a.models.bullet(),p=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="<h3>"+b.label+"</h3>"+"<p>"+b.value+"</p>";a.tooltip.show([e,f],g,b.value<0?"e":"w",null,c)};q.dispatch=n,q.bullet=o,q.orient=function(a){if(!arguments.length)return b;b=a,c=b=="right"||b=="bottom";return q},q.ranges=function(a){if(!arguments.length)return e;e=a;return q},q.markers=function(a){if(!arguments.length)return f;f=a;return q},q.measures=function(a){if(!arguments.length)return g;g=a;return q},q.width=function(a){if(!arguments.length)return h;h=a;return q},q.height=function(a){if(!arguments.length)return i;i=a;return q},q.margin=function(a){if(!arguments.length)return d;d=a;return q},q.tickFormat=function(a){if(!arguments.length)return j;j=a;return q},q.tooltips=function(a){if(!arguments.length)return k;k=a;return q},q.tooltipContent=function(a){if(!arguments.length)return l;l=a;return q},q.noData=function(a){if(!arguments.length)return m;m=a;return q};return q},a.models.cumulativeLineChart=function(){function D(a,b){return b.map(function(b,c){var d=n.y()(b.values[a],a);b.values=b.values.map(function(a,b){a.display={y:(n.y()(a,b)-d)/(1+d)};return a});return b})}function C(a){a.each(function(j){var z=d3.select(this).classed("nv-chart-"+p,!0),A=this,B=(d||parseInt(z.style("width"))||960)-b.left-b.right,E=(e||parseInt(z.style("height"))||400)-b.top-b.bottom;if(!j||!j.length||!j.filter(function(a){return a.values.length}).length){z.append("text").attr("class","nvd3 nv-noData").attr("x",B/2).attr("y",E/2).attr("dy","-.7em").style("text-anchor","middle").text(m);return C}z.select(".nv-noData").remove(),k=n.xScale(),l=n.yScale();if(!i){var F=j.filter(function(a){return!a.disabled}).map(function(a,b){var c=d3.extent(a.values,n.y());return[(c[0]-c[1])/(1+c[1]),(c[1]-c[0])/(1+c[0])]}),G=[d3.min(F,function(a){return a[0]}),d3.max(F,function(a){return a[1]})];n.yDomain(G)}else n.yDomain(null);o.domain([0,j[0].values.length-1]).range([0,B]).clamp(!0);var j=D(v.i,j),H=z.selectAll("g.nv-wrap.nv-cumulativeLine").data([j]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");I.append("g").attr("class","nv-x nv-axis"),I.append("g").attr("class","nv-y nv-axis"),I.append("g").attr("class","nv-linesWrap"),I.append("g").attr("class","nv-legendWrap"),I.append("g").attr("class","nv-controlsWrap");var J=H.select("g");f&&(s.width(B),J.select(".nv-legendWrap").datum(j).call(s),b.top!=s.height()&&(b.top=s.height(),E=(e||parseInt(z.style("height"))||400)-b.top-b.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -b.top+")")),h&&(t.width(140).color(["#444","#444","#444"]),J.select(".nv-controlsWrap").datum(w).attr("transform","translate(0,"+ -b.top+")").call(t)),n.y(function(a){return a.display.y}).width(B).height(E).color(j.map(function(a,b){return a.color||c(a,b)}).filter(function(a,b){return!j[b].disabled})),J.attr("transform","translate("+b.left+","+b.top+")");var K=J.select(".nv-linesWrap").datum(j.filter(function(a){return!a.disabled}));d3.transition(K).call(n);var L=K.selectAll(".nv-indexLine").data([v]);L.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(y),L.attr("transform",function(a){return"translate("+o(a.i)+",0)"}).attr("height",E),q.scale(k).ticks(B/100).tickSize(-E,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+l.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(q),r.scale(l).ticks(E/36).tickSize(-B,0),d3.transition(J.select(".nv-y.nv-axis")).call(r),t.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,i=!b.disabled,a.transition().call(C)}),s.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,j.filter(function(a){return!a.disabled}).length||j.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(C)}),u.on("tooltipShow",function(a){g&&x(a,A.parentNode)})}),C.update=function(){C(a)},C.container=this;return C}function B(a,b){C.update()}function A(a,b){a.x+=d3.event.dx,a.i=Math.round(o.invert(a.x)),d3.select(this).attr("transform","translate("+o(a.i)+",0)")}function z(a,b){}var b={top:30,right:30,bottom:50,left:60},c=a.utils.defaultColor(),d=null,e=null,f=!0,g=!0,h=!0,i=!0,j=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" at "+b+"</p>"},k,l,m="No Data Available.",n=a.models.line(),o=d3.scale.linear(),p=n.id(),q=a.models.axis().orient("bottom").tickPadding(5),r=a.models.axis().orient("left"),s=a.models.legend().height(30),t=a.models.legend().height(30),u=d3.dispatch("tooltipShow","tooltipHide"),v={i:0,x:0},w=[{key:"Re-scale y-axis"}],x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=q.tickFormat()(n.x()(b.point,b.pointIndex)),g=r.tickFormat()(n.y()(b.point,b.pointIndex)),h=j(b.series.key,f,g,b,C);a.tooltip.show([d,e],h,null,null,c)},y=d3.behavior.drag().on("dragstart",z).on("drag",A).on("dragend",B);n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],u.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),C.dispatch=u,C.legend=s,C.xAxis=q,C.yAxis=r,d3.rebind(C,n,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),C.margin=function(a){if(!arguments.length)return b;b=a;return C},C.width=function(a){if(!arguments.length)return d;d=a;return C},C.height=function(a){if(!arguments.length)return e;e=a;return C},C.color=function(b){if(!arguments.length)return c;c=a.utils.getColor(b),s.color(c);return C},C.showLegend=function(a){if(!arguments.length)return f;f=a;return C},C.tooltips=function(a){if(!arguments.length)return g;g=a;return C},C.tooltipContent=function(a){if(!arguments.length)return j;j=a;return C},C.noData=function(a){if(!arguments.length)return m;m=a;return C};return C},a.models.discreteBar=function(){function s(a){a.each(function(e){var t=c-b.left-b.right,u=d-b.top-b.bottom;e=e.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var v=n&&o?[]:e.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(n||d3.merge(v).map(function(a){return a.x})).rangeBands([0,t],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([u-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([u,0]),q=q||f,r=r||g.copy().range([g(0),g(0)]);var w=d3.select(this).selectAll("g.nv-wrap.nv-discretebar").data([e]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g");A.append("g").attr("class","nv-groups");var B=w.select("g");w.attr("transform","translate("+b.left+","+b.top+")");var C=w.select(".nv-groups").selectAll(".nv-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"nv-group nv-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.nv-bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+f(h(a,b))+", "+g(0)+")"}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(a,b),point:a,series:e[a.series],pos:[f(h(a,b))+f.rangeBand()*(a.series+.5)/e.length,g(i(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(a,b),point:a,series:e[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),point:a,series:e[a.series],pos:[f(h(a,b))+f.rangeBand()*(a.series+.5)/e.length,g(i(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),point:a,series:e[a.series],pos:[f(h(a,b))+f.rangeBand()*(a.series+.5)/e.length,g(i(a,b))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()/e.length).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}),l?(E.append("text").attr("text-anchor","middle"),D.selectAll("text").attr("x",f.rangeBand()/2).attr("y",function(a,b){return i(a,b)<0?g(i(a,b))-g(0)+12:-4}).text(function(a,b){return m(i(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+", "+(i(a,b)<0?r(0):r(i(a,b)))+")"}).selectAll("rect").attr("width",f.rangeBand()/e.length),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+", "+(i(a,b)<0?g(0):g(i(a,b)))+")"}).selectAll("rect").attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}),s.update=function(){s(a)},q=f.copy(),r=g.copy()});return s}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=d3.format(",.2f"),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q,r;s.dispatch=p,s.x=function(a){if(!arguments.length)return h;h=a;return s},s.y=function(a){if(!arguments.length)return i;i=a;return s},s.margin=function(a){if(!arguments.length)return b;b=a;return s},s.width=function(a){if(!arguments.length)return c;c=a;return s},s.height=function(a){if(!arguments.length)return d;d=a;return s},s.xScale=function(a){if(!arguments.length)return f;f=a;return s},s.yScale=function(a){if(!arguments.length)return g;g=a;return s},s.xDomain=function(a){if(!arguments.length)return n;n=a;return s},s.yDomain=function(a){if(!arguments.length)return o;o=a;return s},s.forceY=function(a){if(!arguments.length)return j;j=a;return s},s.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return s},s.id=function(a){if(!arguments.length)return e;e=a;return s},s.showValues=function(a){if(!arguments.length)return l;l=a;return s},s.valueFormat=function(a){if(!arguments.length)return m;m=a;return s};return s},a.models.discreteBarChart=function(){function r(e){e.each(function(h){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;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){q.append("text").attr("class","nvd3 nv-noData").attr("x",t/2).attr("y",u/2).attr("dy","-.7em").style("text-anchor","middle").text(i);return r}q.select(".nv-noData").remove(),j.width(t).height(u);var v=q.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),z=w.append("defs");w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis"),w.append("g").attr("class","nv-barsWrap");var A=v.select("g");A.attr("transform","translate("+b.left+","+b.top+")");var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(j),z.append("clipPath").attr("id","nv-x-label-clip-"+j.id()).append("rect"),A.select("#nv-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(".nv-x.nv-axis").attr("transform","translate(0,"+(l.range()[0]+(j.showValues()&&l.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(m);var C=A.select(".nv-x.nv-axis").selectAll("g");f&&C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"0":"12")+")"}),n.ticks(u/36).tickSize(-t,0),d3.transition(A.select(".nv-y.nv-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)}),g&&o.on("tooltipShow",function(a){p(a,s.parentNode)}),j.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),g&&o.on("tooltipHide",a.tooltip.cleanup),r.update=function(){e.transition().call(r)},r.container=this});return r}var b={top:10,right:10,bottom:50,left:60},c=null,d=null,e=a.utils.getColor(),f=!1,g=!0,h=function(a,b,c,d,e){return"<h3>"+b+"</h3>"+"<p>"+c+"</p>"},i="No Data Available.",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,b.pointIndex)),g=n.tickFormat()(j.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,r);a.tooltip.show([d,e],i,b.value<0?"n":"s",null,c)},q=[{key:"Grouped"},{key:"Stacked",disabled:!0}];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){if(!arguments.length)return b;b=a;return r},r.width=function(a){if(!arguments.length)return c;c=a;return r},r.height=function(a){if(!arguments.length)return d;d=a;return r},r.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),j.color(e);return r},r.staggerLabels=function(a){if(!arguments.length)return f;f=a;return r},r.tooltips=function(
a){if(!arguments.length)return g;g=a;return r},r.tooltipContent=function(a){if(!arguments.length)return h;h=a;return r},r.noData=function(a){if(!arguments.length)return i;i=a;return r};return r},a.models.distribution=function(){function k(a){a.each(function(a){var h=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x";j=j||i;var l=d3.select(this).selectAll("g.nv-distribution").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-distribution"),n=m.append("g"),o=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var p=o.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});p.enter().append("g"),p.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var q=p.selectAll("line.nv-dist"+e).data(function(a){return a.values});q.enter().append("line").attr(e+"1",function(a,b){return j(f(a,b))}).attr(e+"2",function(a,b){return j(f(a,b))}),d3.transition(p.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return i(f(a,b))}).attr(e+"2",function(a,b){return i(f(a,b))}).style("stroke-opacity",0).remove(),q.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(q).attr(e+"1",function(a,b){return i(f(a,b))}).attr(e+"2",function(a,b){return i(f(a,b))}),j=i.copy()});return k}var b={top:0,right:0,bottom:0,left:0},c=400,d=8,e="x",f=function(a){return a[e]},g=a.utils.defaultColor(),h,i=d3.scale.linear(),j;k.margin=function(a){if(!arguments.length)return b;b=a;return k},k.width=function(a){if(!arguments.length)return c;c=a;return k},k.axis=function(a){if(!arguments.length)return e;e=a;return k},k.size=function(a){if(!arguments.length)return d;d=a;return k},k.getData=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.scale=function(a){if(!arguments.length)return i;i=a;return k},k.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b);return k};return k},a.models.indentedTree=function(){function j(a){a.each(function(e){function B(a){var b=a.values||a._values;return b&&b.length}function A(a){return a._values&&a._values.length}function z(a){return a._values&&a._values.length?iconOpen:a.values&&a.values.length?iconClose:""}function y(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c){d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&y(a,0,!0)});return!0}if(!B(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),j.update()}var f=c-b.left-b.right,k=d-b.top-b.bottom;j.update=function(){a.transition().call(j)};var l=0,m=1,n=d3.layout.tree().children(function(a){return a.values}).size([d,childIndent]);e[0].key||(e[0].key=h);var o=n.nodes(e[0]),p=d3.select(this).selectAll("div").data([[o]]),q=p.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),r=q.append("table"),s=p.select("table").attr("width","100%").attr("class",tableClass);if(g){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([d,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.nv-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("nv-treeicon",!0).classed("nv-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","nv-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){i.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){i.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){i.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){i.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})});return j}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=!0,h="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 i=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");j.margin=function(a){if(!arguments.length)return b;b=a;return j},j.width=function(a){if(!arguments.length)return c;c=a;return j},j.height=function(a){if(!arguments.length)return d;d=a;return j},j.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),scatter.color(e);return j},j.id=function(a){if(!arguments.length)return f;f=a;return j},j.header=function(a){if(!arguments.length)return g;g=a;return j},j.noResultsText=function(a){if(!arguments.length)return h;h=a;return j},j.columns=function(a){if(!arguments.length)return columns;columns=a;return j},j.tableClass=function(a){if(!arguments.length)return tableClass;tableClass=a;return j},j.iconOpen=function(a){if(!arguments.length)return iconOpen;iconOpen=a;return j},j.iconClose=function(a){if(!arguments.length)return iconClose;iconClose=a;return j};return j},a.models.legend=function(){function i(a){a.each(function(a){var i=c-b.left-b.right,j=d3.select(this).selectAll("g.nv-legend").data([a]),l=j.enter().append("g").attr("class","nvd3 nv-legend").append("g"),m=j.select("g").attr("transform","translate("+b.left+","+b.top+")"),n=m.selectAll(".nv-series").data(function(a){return a}),o=n.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){h.legendMouseover(a,b)}).on("mouseout",function(a,b){h.legendMouseout(a,b)}).on("click",function(a,b){h.legendClick(a,b)}).on("dblclick",function(a,b){h.legendDblclick(a,b)});o.append("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}).style("stroke-width",2).attr("r",5),o.append("text").text(e).attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),n.classed("disabled",function(a){return a.disabled}),n.exit().remove();if(g){var p=[];n.each(function(a,b){p.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var q=0,r=0,s=[];while(r<i&&q<p.length)s[q]=p[q],r+=p[q++];while(r>i&&q>1){s=[],q--;for(k=0;k<p.length;k++)p[k]>(s[k%q]||0)&&(s[k%q]=p[k]);r=s.reduce(function(a,b,c,d){return a+b})}var t=[];for(var u=0,v=0;u<q;u++)t[u]=v,v+=s[u];n.attr("transform",function(a,b){return"translate("+t[b%q]+","+(5+Math.floor(b/q)*20)+")"}),m.attr("transform","translate("+(c-b.right-r)+","+b.top+")"),d=b.top+b.bottom+Math.ceil(p.length/q)*20}else{var w=5,x=5,y=0,z;n.attr("transform",function(a,d){var e=d3.select(this).select("text").node().getComputedTextLength()+28;z=x,c<b.left+b.right+z+e&&(x=z=5,w+=20),x+=e,x>y&&(y=x);return"translate("+z+","+w+")"}),m.attr("transform","translate("+(c-b.right-y)+","+b.top+")"),d=b.top+b.bottom+w+15}});return i}var b={top:5,right:0,bottom:5,left:0},c=400,d=20,e=function(a){return a.key},f=a.utils.defaultColor(),g=!0,h=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");i.dispatch=h,i.margin=function(a){if(!arguments.length)return b;b=a;return i},i.width=function(a){if(!arguments.length)return c;c=a;return i},i.height=function(a){if(!arguments.length)return d;d=a;return i},i.key=function(a){if(!arguments.length)return e;e=a;return i},i.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b);return i},i.align=function(a){if(!arguments.length)return g;g=a;return i};return i},a.models.line=function(){function s(a){a.each(function(a){var r=c-b.left-b.right,s=d-b.top-b.bottom,t=d3.select(this);l=o.xScale(),m=o.yScale(),p=p||l,q=q||m;var u=t.selectAll("g.nv-wrap.nv-line").data([a]),v=u.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),w=v.append("defs"),z=v.append("g"),A=u.select("g");z.append("g").attr("class","nv-groups"),z.append("g").attr("class","nv-scatterWrap");var B=u.select(".nv-scatterWrap");o.width(r).height(s),d3.transition(B).call(o),u.attr("transform","translate("+b.left+","+b.top+")"),w.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),u.select("#nv-edge-clip-"+f+" rect").attr("width",r).attr("height",s),A.attr("clip-path",k?"url(#nv-edge-clip-"+f+")":""),B.attr("clip-path",k?"url(#nv-edge-clip-"+f+")":"");var C=u.select(".nv-groups").selectAll(".nv-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"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.5);var D=C.selectAll("path.nv-area").data(function(a){return[a]});D.enter().append("path").filter(j).attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return p(g(a,b))}).y0(function(a,b){return q(h(a,b))}).y1(function(a,b){return q(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return p(g(a,b))}).y0(function(a,b){return q(h(a,b))}).y1(function(a,b){return q(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(D.filter(j)).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return p(g(a,b))}).y0(function(a,b){return q(h(a,b))}).y1(function(a,b){return q(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var E=C.selectAll("path.nv-line").data(function(a){return[a.values]});E.enter().append("path").attr("class",function(a){return"nv-line"}).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return p(g(a,b))}).y(function(a,b){return q(h(a,b))})),d3.transition(C.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),d3.transition(E).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),p=l.copy(),q=m.copy()});return s}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=function(a){return a.x},h=function(a){return a.y},i=function(a,b){return!isNaN(h(a,b))&&h(a,b)!==null},j=function(a){return a.area},k=!1,l,m,n="linear",o=a.models.scatter().id(f).size(16).sizeDomain([16,256]),p,q,r;s.dispatch=o.dispatch,d3.rebind(s,o,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),s.margin=function(a){if(!arguments.length)return b;b=a;return s},s.width=function(a){if(!arguments.length)return c;c=a;return s},s.height=function(a){if(!arguments.length)return d;d=a;return s},s.x=function(a){if(!arguments.length)return g;g=a,o.x(a);return s},s.y=function(a){if(!arguments.length)return h;h=a,o.y(a);return s},s.clipEdge=function(a){if(!arguments.length)return k;k=a;return s},s.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),o.color(e);return s},s.id=function(a){if(!arguments.length)return f;f=a;return s},s.interpolate=function(a){if(!arguments.length)return n;n=a;return s},s.defined=function(a){if(!arguments.length)return i;i=a;return s},s.isArea=function(a){if(!arguments.length)return j;j=d3.functor(a);return s};return s},a.models.lineChart=function(){function r(a){a.each(function(h){var s=d3.select(this),t=this,u=(d||parseInt(s.style("width"))||960)-b.left-b.right,v=(e||parseInt(s.style("height"))||400)-b.top-b.bottom;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){s.append("text").attr("class","nvd3 nv-noData").attr("x",u/2).attr("y",v/2).attr("dy","-.7em").style("text-anchor","middle").text(k);return r}s.select(".nv-noData").remove(),i=l.xScale(),j=l.yScale();var w=s.selectAll("g.nv-wrap.nv-lineChart").data([h]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-linesWrap"),z.append("g").attr("class","nv-legendWrap");var A=w.select("g");f&&(o.width(u),A.select(".nv-legendWrap").datum(h).call(o),b.top!=o.height()&&(b.top=o.height(),v=(e||parseInt(s.style("height"))||400)-b.top-b.bottom),A.select(".nv-legendWrap").attr("transform","translate(0,"+ -b.top+")")),l.width(u).height(v).color(h.map(function(a,b){return a.color||c(a,b)}).filter(function(a,b){return!h[b].disabled})),A.attr("transform","translate("+b.left+","+b.top+")");var B=A.select(".nv-linesWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(l),m.scale(i).ticks(u/100).tickSize(-v,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+j.range()[0]+")"),d3.transition(A.select(".nv-x.nv-axis")).call(m),n.scale(j).ticks(v/36).tickSize(-u,0),d3.transition(A.select(".nv-y.nv-axis")).call(n),o.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,w.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(r)}),p.on("tooltipShow",function(a){g&&q(a,t.parentNode)})}),r.update=function(){r(a)},r.container=this;return r}var b={top:30,right:20,bottom:50,left:60},c=a.utils.defaultColor(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" at "+b+"</p>"},i,j,k="No Data Available.",l=a.models.line(),m=a.models.axis().orient("bottom").tickPadding(5),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=d3.dispatch("tooltipShow","tooltipHide"),q=function(b,c){if(c){var d=d3.select(c).select("svg"),e=d.attr("viewBox");if(e){e=e.split(" ");var f=parseInt(d.style("width"))/e[2];b.pos[0]=b.pos[0]*f,b.pos[1]=b.pos[1]*f}}var g=b.pos[0]+(c.offsetLeft||0),i=b.pos[1]+(c.offsetTop||0),j=m.tickFormat()(l.x()(b.point,b.pointIndex)),k=n.tickFormat()(l.y()(b.point,b.pointIndex)),o=h(b.series.key,j,k,b,r);a.tooltip.show([g,i],o,null,null,c)};l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],p.tooltipShow(a)}),l.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),r.dispatch=p,r.legend=o,r.xAxis=m,r.yAxis=n,d3.rebind(r,l,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){if(!arguments.length)return b;b=a;return r},r.width=function(a){if(!arguments.length)return d;d=a;return r},r.height=function(a){if(!arguments.length)return e;e=a;return r},r.color=function(b){if(!arguments.length)return c;c=a.utils.getColor(b),o.color(c);return r},r.showLegend=function(a){if(!arguments.length)return f;f=a;return r},r.tooltips=function(a){if(!arguments.length)return g;g=a;return r},r.tooltipContent=function(a){if(!arguments.length)return h;h=a;return r},r.noData=function(a){if(!arguments.length)return k;k=a;return r};return r},a.models.linePlusBarChart=function(){function w(j){j.each(function(p){var y=d3.select(this),z=this,A=(c||parseInt(y.style("width"))||960)-b.left-b.right,B=(d||parseInt(y.style("height"))||400)-b.top-b.bottom;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){y.append("text").attr("class","nvd3 nv-noData").attr("x",A/2).attr("y",B/2).attr("dy","-.7em").style("text-anchor","middle").text(k);return w}y.select(".nv-noData").remove();var C=p.filter(function(a){return!a.disabled&&a.bar}),D=p.filter(function(a){return!a.disabled&&!a.bar}),E=p.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)}})}),F=p.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)}})});n.domain(d3.extent(d3.merge(E.concat(F)),function(a){return a.x})).range([0,A]);var G=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([p]),H=G.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y1 nv-axis"),H.append("g").attr("class","nv-y2 nv-axis"),H.append("g").attr("class","nv-barsWrap"),H.append("g").attr("class","nv-linesWrap"),H.append("g").attr("class","nv-legendWrap");var I=G.select("g");h&&(t.width(A/2),I.select(".nv-legendWrap").datum(p.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)");return a})).call(t),b.top!=t.height()&&(b.top=t.height(),B=(d||parseInt(y.style("height"))||400)-b.top-b.bottom),I.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),l.width(A).height(B).color(p.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!p[b].disabled&&!p[b].bar})),m.width(A).height(B).color(p.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!p[b].disabled&&p[b].bar}));var J=I.select(".nv-barsWrap").datum(C.length?C:[{values:[]}]),K=I.select(".nv-linesWrap").datum(D.length?D:[{values:[]}]);d3.transition(J).call(m),d3.transition(K).call(l),I.attr("transform","translate("+b.left+","+b.top+")"),q.ticks(A/100).tickSize(-B,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),d3.transition(I.select(".nv-x.nv-axis")).call(q),r.ticks(B/36).tickSize(-A,0),d3.transition(I.select(".nv-y1.nv-axis")).style("opacity",C.length?1:0).call(r),s.ticks(B/36).tickSize(C.length?0:-A,0),I.select(".nv-y2.nv-axis").style("opacity",D.length?1:0).attr("transform","translate("+n.range()[1]+",0)"),d3.transition(I.select(".nv-y2.nv-axis")).call(s),t.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){a.disabled=!1,G.selectAll(".nv-series").classed("disabled",!1);return a}),j.transition().call(w)}),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],u.tooltipShow(a)}),i&&u.on("tooltipShow",function(a){v(a,z.parentNode)}),l.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),i&&u.on("tooltipHide",a.tooltip.cleanup),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],u.tooltipShow(a)}),i&&u.on("tooltipShow",function(a){v(a,z.parentNode)}),m.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),i&&u.on("tooltipHide",a.tooltip.cleanup),w.update=function(){j.transition().call(w)},w.container=this});return w}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=a.utils.defaultColor(),h=!0,i=!0,j=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" at "+b+"</p>"},k="No Data Available.",l=a.models.line(),m=a.models.historicalBar(),n=d3.scale.linear(),o=m.yScale(),p=l.yScale(),q=a.models.axis().scale(n).orient("bottom").tickPadding(5),r=a.models.axis().scale(o).orient("left"),s=a.models.axis().scale(p).orient("right"),t=a.models.legend().height(30),u=d3.dispatch("tooltipShow","tooltipHide"),v=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=q.tickFormat()(l.x()(b.point,b.pointIndex)),g=(b.series.bar?r:s).tickFormat()(l.y()(b.point,b.pointIndex)),h=j(b.series.key,f,g,b,w);a.tooltip.show([d,e],h,b.value<0?"n":"s",null,c)};w.dispatch=u,w.legend=t,w.lines=l,w.bars=m,w.xAxis=q,w.yAxis1=r,w.yAxis2=s,d3.rebind(w,l,"defined","size","clipVoronoi","interpolate"),w.x=function(a){if(!arguments.length)return e;e=a,l.x(a),m.x(a);return w},w.y=function(a){if(!arguments.length)return f;f=a,l.y(a),m.y(a);return w},w.margin=function(a){if(!arguments.length)return b;b=a;return w},w.width=function(a){if(!arguments.length)return c;c=a;return w},w.height=function(a){if(!arguments.length)return d;d=a;return w},w.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b),t.color(g);return w},w.showLegend=function(a){if(!arguments.length)return h;h=a;return w},w.tooltips=function(a){if(!arguments.length)return i;i=a;return w},w.tooltipContent=function(a){if(!arguments.length)return j;j=a;return w},w.noData=function(a){if(!arguments.length)return k;k=a;return w};return w},a.models.lineWithFocusChart=function(){function A(k){k.each(function(B){function R(){i=y.empty()?null:y.extent(),extent=y.empty()?q.domain():y.extent(),P();var a=L.select(".nv-focus .nv-linesWrap").datum(B.filter(function(a){return!a.disabled}).map(function(a,b){return{key:a.key,values:a.values.filter(function(a,b){return m.x()(a,b)>=extent[0]&&m.x()(a,b)<=extent[1]})}}));d3.transition(a).call(m),d3.transition(L.select(".nv-focus .nv-x.nv-axis")).call(s),d3.transition(L.select(".nv-focus .nv-y.nv-axis")).call(t)}function Q(a){var b=+(a=="e"),c=b?1:-1,d=G/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 P(){y.empty()||y.extent(i),N.data([y.empty()?q.domain():i]).each(function(a,b){var c=q(a[0])-o.range()[0],d=o.range()[1]-q(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",q(a[1])).attr("width",d<0?0:d)})}var C=d3.select(this),D=this,E=(e||parseInt(C.style("width"))||960)-b.left-b.right,F=(f||parseInt(C.style("height"))||400)-b.top-b.bottom-g,G=g-c.top-c.bottom;if(!B||!B.length||!B.filter(function(a){return a.values.length}).length){C.append("text").attr("class","nvd3 nv-noData").attr("x",E/2).attr("y",F/2).attr("dy","-.7em").style("text-anchor","middle").text(l);return A}C.select(".nv-noData").remove(),y.on("brush",R);var H=C.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([B]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");I.append("g").attr("class","nv-legendWrap");var J=I.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y nv-axis"),J.append("g").attr("class","nv-linesWrap");var K=I.append("g").attr("class","nv-context");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-linesWrap"),K.append("g").attr("class","nv-brushBackground"),K.append("g").attr("class","nv-x nv-brush");var L=H.select("g");h&&(w.width(E),L.select(".nv-legendWrap").datum(B).call(w),b.top!=w.height()&&(b.top=w.height(),F=(f||parseInt(C.style("height"))||400)-b.top-b.bottom-g),L.select(".nv-legendWrap").attr("transform","translate(0,"+ -b.top+")")),m.width(E).height(F).color(B.map(function(a,b){return a.color||d(a,b)}).filter(function(a,b){return!B[b].disabled})),n.defined(m.defined()).width(E).height(G).color(B.map(function(a,b){return a.color||d(a,b)}).filter(function(a,b){return!B[b].disabled})),L.attr("transform","translate("+b.left+","+b.top+")"),s.ticks(E/100).tickSize(-F,0),t.ticks(F/36).tickSize(-E,0),L.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")"),L.select(".nv-context").attr("transform","translate(0,"+(F+b.bottom+c.top)+")");var M=L.select(".nv-context .nv-linesWrap").datum(B.filter(function(a){return!a.disabled}));d3.transition(M).call(n),i&&y.extent(i);var N=L.select(".nv-brushBackground").selectAll("g").data([i||y.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",G),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",G),gBrush=L.select(".nv-x.nv-brush").call(y),gBrush.selectAll("rect").attr("height",G),gBrush.selectAll(".resize").append("path").attr("d",Q),R(),u.ticks(E/100).tickSize(-G,0),L.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(L.select(".nv-context .nv-x.nv-axis")).call(u),v.ticks(G/36).tickSize(-E,0),d3.transition(L.select(".nv-context .nv-y.nv-axis")).call(v),L.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")"),L.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),w.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,B.filter(function(a){return!a.disabled}).length||B.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),k.transition().call(A)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],x.tooltipShow(a)}),j&&x.on("tooltipShow",function(a){z(a,D.parentNode)}),m.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),j&&x.on("tooltipHide",a.tooltip.cleanup)}),A.update=function(){A(k)},A.container=this;return A}var b={top:30,right:30,bottom:30,left:60},c={top:0,right:30,bottom:20,left:60},d=a.utils.defaultColor(),e=null,f=null,g=100,h=!0,i=null,j=!0,k=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" at "+b+"</p>"},l="No Data Available.",m=a.models.line().clipEdge(!0),n=a.models.line().interactive(!1),o=m.xScale(),p=m.yScale(),q=n.xScale(),r=n.yScale(),s=a.models.axis().scale(o).orient("bottom").tickPadding(5),t=a.models.axis().scale(p).orient("left"),u=a.models.axis().scale(q).orient("bottom").tickPadding(5),v=a.models.axis().scale(r).orient("left"),w=a.models.legend().height(30),x=d3.dispatch("tooltipShow","tooltipHide"),y=d3.svg.brush().x(q),z=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=t.tickFormat()(m.y()(b.point,b.pointIndex)),h=k(b.series.key,f,g,b,A);a.tooltip.show([d,e],h,null,null,c)};A.dispatch=x,A.legend=w,A.lines=m,A.lines2=n,A.xAxis=s,A.yAxis=t,A.x2Axis=u,A.y2Axis=v,d3.rebind(A,m,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){if(!arguments.length)return m.x;m.x(a),n.x(a);return A},A.y=function(a){if(!arguments.length)return m.y;m.y(a),n.y(a);return A},A.margin=function(a){if(!arguments.length)return b;b=a;return A},A.margin2=function(a){if(!arguments.length)return c;c=a;return A},A.width=function(a){if(!arguments.length)return e;e=a;return A},A.height=function(a){if(!arguments.length)return f;f=a;return A},A.color=function(b){if(!arguments.length)return d;d=a.utils.getColor(b),w.color(d);return A},A.showLegend=function(a){if(!arguments.length)return h;h=a;return A},A.tooltips=function(a){if(!arguments.length)return j;j=a;return A},A.tooltipContent=function(a){if(!arguments.length)return k;k=a;return A},A.interpolate=function(a){if(!arguments.length)return m.interpolate();m.interpolate(a),n.interpolate(a);return A},A.noData=function(a){if(!arguments.length)return l;l=a;return A},A.xTickFormat=function(a){if(!arguments.length)return s.tickFormat();s.tickFormat(a),u.tickFormat(a);return A},A.yTickFormat=function(a){if(!arguments.length)return t.tickFormat();t.tickFormat(a),v.tickFormat(a);return A};return A},a.models.multiBar=function(){function t(a){a.each(function(u){var v=c-b.left-b.right,w=d-b.top-b.bottom;l&&(u=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(u)),u=u.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var z=o&&p?[]:u.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});e.domain(d3.merge(z).map(function(a){return a.x})).rangeBands([0,v],.1),f.domain(p||d3.extent(d3.merge(z).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([w,0]);if(e.domain()[0]===e.domain()[1]||f.domain()[0]===f.domain()[1])singlePoint=!0;e.domain()[0]===e.domain()[1]&&(e.domain()[0]?e.domain([e.domain()[0]-e.domain()[0]*.01,e.domain()[1]+e.domain()[1]*.01]):e.domain([-1,1])),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]+f.domain()[0]*.01,f.domain()[1]-f.domain()[1]*.01]):f.domain([-1,1])),r=r||e,s=s||f;var A=d3.select(this).selectAll("g.nv-wrap.nv-multibar").data([u]),B=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),C=B.append("defs"),D=B.append("g");D.append("g").attr("class","nv-groups");var E=A.select("g");A.attr("transform","translate("+b.left+","+b.top+")"),C.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),A.select("#nv-edge-clip-"+g+" rect").attr("width",v).attr("height",w),E.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var F=A.select(".nv-groups").selectAll(".nv-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.nv-bar").delay(function(a,b){return b*n/u[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),F.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return m(a,b)}).style("stroke",function(a,b){return m(a,b)}),d3.transition(F).style("stroke-opacity",1).style("fill-opacity",.75);var G=F.selectAll("rect.nv-bar").data(function(a){return a.values});G.exit().remove();var H=G.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(a,b,c){return l?0:c*e.rangeBand()/u.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:u.length));G.on("mouseover",function(a,b){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(a,b),point:a,series:u[a.series],pos:[e(h(a,b))+e.rangeBand()*(l?u.length/2:a.series+.5)/u.length,f(i(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(a,b),point:a,series:u[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){q.elementClick({value:i(a,b),point:a,series:u[a.series],pos:[e(h(a,b))+e.rangeBand()*(l?u.length/2:a.series+.5)/u.length,f(i(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){q.elementDblClick({value:i(a,b),point:a,series:u[a.series],pos:[e(h(a,b))+e.rangeBand()*(l?u.length/2:a.series+.5)/u.length,f(i(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}),G.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+e(h(a,b))+",0)"}),l?d3.transition(G).delay(function(a,b){return b*n/u[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0))}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(a,b){return l?0:a.series*e.rangeBand()/u.length}).attr("width",e.rangeBand()/(l?1:u.length))}):d3.transition(G).delay(function(a,b){return b*n/u[0].values.length}).attr("x",function(a,b){return a.series*e.rangeBand()/u.length}).attr("width",e.rangeBand()/u.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(i(a,b))}).attr("height",function(a,b){return Math.abs(f(i(a,b))-f(0))})}),t.update=function(){t(a)},r=e.copy(),s=f.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.ordinal(),f=d3.scale.linear(),g=Math.floor(Math.random()*1e4),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=!0,l=!1,m=a.utils.defaultColor(),n=1200,o,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),r,s;t.dispatch=q,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b=a;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return e;e=a;return t},t.yScale=function(a){if(!arguments.length)return f;f=a;return t},t.xDomain=
function(a){if(!arguments.length)return o;o=a;return t},t.yDomain=function(a){if(!arguments.length)return p;p=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.stacked=function(a){if(!arguments.length)return l;l=a;return t},t.clipEdge=function(a){if(!arguments.length)return k;k=a;return t},t.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return g;g=a;return t},t.delay=function(a){if(!arguments.length)return n;n=a;return t};return t},a.models.multiBarChart=function(){function v(a){a.each(function(k){var w=d3.select(this),z=this,A=(c||parseInt(w.style("width"))||960)-b.left-b.right,B=(d||parseInt(w.style("height"))||400)-b.top-b.bottom;if(!k||!k.length||!k.filter(function(a){return a.values.length}).length){w.append("text").attr("class","nvd3 nv-noData").attr("x",A/2).attr("y",B/2).attr("dy","-.7em").style("text-anchor","middle").text(n);return v}w.select(".nv-noData").remove(),l=o.xScale(),m=o.yScale();var C=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([k]),D=C.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");D.append("g").attr("class","nv-x nv-axis"),D.append("g").attr("class","nv-y nv-axis"),D.append("g").attr("class","nv-barsWrap"),D.append("g").attr("class","nv-legendWrap"),D.append("g").attr("class","nv-controlsWrap");var E=C.select("g");g&&(r.width(A/2),E.select(".nv-legendWrap").datum(k).call(r),b.top!=r.height()&&(b.top=r.height(),B=(d||parseInt(w.style("height"))||400)-b.top-b.bottom),E.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),o.width(A).height(B).color(k.map(function(a,b){return a.color||e(a,b)}).filter(function(a,b){return!k[b].disabled}));if(f){var F=[{key:"Grouped",disabled:o.stacked()},{key:"Stacked",disabled:!o.stacked()}];s.width(180).color(["#444","#444","#444"]),E.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -b.top+")").call(s)}E.attr("transform","translate("+b.left+","+b.top+")");var G=E.select(".nv-barsWrap").datum(k.filter(function(a){return!a.disabled}));d3.transition(G).call(o),p.scale(l).ticks(A/100).tickSize(-B,0),E.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),d3.transition(E.select(".nv-x.nv-axis")).call(p);var H=E.select(".nv-x.nv-axis > g").selectAll("g");H.selectAll("line, text").style("opacity",1),h&&H.filter(function(a,b){return b%Math.ceil(k[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),i&&H.selectAll("text").attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-transform",i>0?"start":"end"),q.scale(m).ticks(B/36).tickSize(-A,0),d3.transition(E.select(".nv-y.nv-axis")).call(q),r.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){a.disabled=!1,C.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(v)}),s.dispatch.on("legendClick",function(b,c){if(!!b.disabled){F=F.map(function(a){a.disabled=!0;return a}),b.disabled=!1;switch(b.key){case"Grouped":o.stacked(!1);break;case"Stacked":o.stacked(!0)}a.transition().call(v)}}),t.on("tooltipShow",function(a){j&&u(a,z.parentNode)}),v.update=function(){a.transition().call(v)},v.container=this});return v}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=a.utils.defaultColor(),f=!0,g=!0,h=!0,i=0,j=!0,k=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" on "+b+"</p>"},l,m,n="No Data Available.",o=a.models.multiBar().stacked(!1),p=a.models.axis().orient("bottom").highlightZero(!1).showMaxMin(!1),q=a.models.axis().orient("left"),r=a.models.legend().height(30),s=a.models.legend().height(30),t=d3.dispatch("tooltipShow","tooltipHide");p.tickFormat(function(a){return a}),q.tickFormat(d3.format(",.1f"));var u=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=p.tickFormat()(o.x()(b.point,b.pointIndex)),g=q.tickFormat()(o.y()(b.point,b.pointIndex)),h=k(b.series.key,f,g,b,v);a.tooltip.show([d,e],h,b.value<0?"n":"s",null,c)};o.dispatch.on("elementMouseover.tooltip2",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],t.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),v.dispatch=t,v.legend=r,v.xAxis=p,v.yAxis=q,d3.rebind(v,o,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){if(!arguments.length)return b;b=a;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),r.color(e);return v},v.showControls=function(a){if(!arguments.length)return f;f=a;return v},v.showLegend=function(a){if(!arguments.length)return g;g=a;return v},v.reduceXTicks=function(a){if(!arguments.length)return h;h=a;return v},v.rotateLabels=function(a){if(!arguments.length)return i;i=a;return v},v.tooltip=function(a){if(!arguments.length)return k;k=a;return v},v.tooltips=function(a){if(!arguments.length)return j;j=a;return v},v.tooltipContent=function(a){if(!arguments.length)return k;k=a;return v},v.noData=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontal=function(){function v(a){a.each(function(e){var p=c-b.left-b.right,w=d-b.top-b.bottom;l&&(e=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(e)),e=e.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var z=q&&r?[]:e.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(q||d3.merge(z).map(function(a){return a.x})).rangeBands([0,w],.1),g.domain(r||d3.extent(d3.merge(z).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,p-(g.domain()[1]>0?n:0)]):g.range([0,p]),s=s||f,t=t||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var A=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),B=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),C=B.append("defs"),D=B.append("g");D.append("g").attr("class","nv-groups");var E=A.select("g");A.attr("transform","translate("+b.left+","+b.top+")");var F=A.select(".nv-groups").selectAll(".nv-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()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),F.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),d3.transition(F).style("stroke-opacity",1).style("fill-opacity",.75);var G=F.selectAll("g.nv-bar").data(function(a){return a.values});G.exit().remove();var H=G.enter().append("g").attr("transform",function(a,b,c){return"translate("+t(l?a.y0:0)+","+(l?0:c*f.rangeBand()/e.length+f(h(a,b)))+")"});H.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:e.length)),G.on("mouseover",function(a,b){d3.select(this).classed("hover",!0),u.elementMouseover({value:i(a,b),point:a,series:e[a.series],pos:[g(i(a,b)+(l?a.y0:0)),f(h(a,b))+f.rangeBand()*(l?e.length/2:a.series+.5)/e.length],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),u.elementMouseout({value:i(a,b),point:a,series:e[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){u.elementClick({value:i(a,b),point:a,series:e[a.series],pos:[f(h(a,b))+f.rangeBand()*(l?e.length/2:a.series+.5)/e.length,g(i(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:i(a,b),point:a,series:e[a.series],pos:[f(h(a,b))+f.rangeBand()*(l?e.length/2:a.series+.5)/e.length,g(i(a,b)+(l?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(H.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),G.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(G).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):G.selectAll("text").remove(),G.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(G).attr("transform",function(a,b){return"translate("+g(a.y0)+","+f(h(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(g(i(a,b)+a.y0)-g(a.y0))}).attr("height",f.rangeBand()):d3.transition(G).attr("transform",function(a,b){return"translate("+(i(a,b)<0?g(i(a,b)):g(0))+","+(a.series*f.rangeBand()/e.length+f(h(a,b)))+")"}).select("rect").attr("height",f.rangeBand()/e.length).attr("width",function(a,b){return Math.abs(g(i(a,b))-g(0))}),v.update=function(){a.transition().call(v)},s=f.copy(),t=g.copy()});return v}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s,t,u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");v.dispatch=u,v.x=function(a){if(!arguments.length)return h;h=a;return v},v.y=function(a){if(!arguments.length)return i;i=a;return v},v.margin=function(a){if(!arguments.length)return b;b=a;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.xScale=function(a){if(!arguments.length)return f;f=a;return v},v.yScale=function(a){if(!arguments.length)return g;g=a;return v},v.xDomain=function(a){if(!arguments.length)return q;q=a;return v},v.yDomain=function(a){if(!arguments.length)return r;r=a;return v},v.forceY=function(a){if(!arguments.length)return j;j=a;return v},v.stacked=function(a){if(!arguments.length)return l;l=a;return v},v.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return v},v.id=function(a){if(!arguments.length)return e;e=a;return v},v.delay=function(a){if(!arguments.length)return p;p=a;return v},v.showValues=function(a){if(!arguments.length)return m;m=a;return v},v.valueFormat=function(a){if(!arguments.length)return o;o=a;return v},v.valuePadding=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontalChart=function(){function v(h){h.each(function(j){var m=d3.select(this),n=this,w=(c||parseInt(m.style("width"))||960)-b.left-b.right,x=(d||parseInt(m.style("height"))||400)-b.top-b.bottom;if(!j||!j.length||!j.filter(function(a){return a.values.length}).length){m.append("text").attr("class","nvd3 nv-noData").attr("x",w/2).attr("y",x/2).attr("dy","-.7em").style("text-anchor","middle").text(k);return v}m.select(".nv-noData").remove();var y=m.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([j]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-barsWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap"),b.top=q.height();var A=y.select("g");g&&(q.width(w/2),A.select(".nv-legendWrap").datum(j).call(q),b.top!=q.height()&&(b.top=q.height(),x=(d||parseInt(m.style("height"))||400)-b.top-b.bottom),A.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -b.top+")")),l.width(w).height(x).color(j.map(function(a,b){return a.color||e(a,b)}).filter(function(a,b){return!j[b].disabled})),f&&(r.width(180).color(["#444","#444","#444"]),A.select(".nv-controlsWrap").datum(u).attr("transform","translate(0,"+ -b.top+")").call(r)),A.attr("transform","translate("+b.left+","+b.top+")");var B=A.select(".nv-barsWrap").datum(j.filter(function(a){return!a.disabled}));d3.transition(B).call(l),o.ticks(x/24).tickSize(-w,0),A.select(".nv-x.nv-axis").transition().duration(0).call(o);var C=A.select(".nv-x.nv-axis").selectAll("g");C.selectAll("line, text").style("opacity",1),p.ticks(w/100).tickSize(-x,0),A.select(".nv-y.nv-axis").attr("transform","translate(0,"+x+")"),d3.transition(A.select(".nv-y.nv-axis")).call(p),q.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,j.filter(function(a){return!a.disabled}).length||j.map(function(a){a.disabled=!1,y.selectAll(".nv-series").classed("disabled",!1);return a}),h.transition().call(v)}),r.dispatch.on("legendClick",function(a,b){if(!!a.disabled){u=u.map(function(a){a.disabled=!0;return a}),a.disabled=!1;switch(a.key){case"Grouped":l.stacked(!1);break;case"Stacked":l.stacked(!0)}h.transition().call(v)}}),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],s.tooltipShow(a)}),i&&s.on("tooltipShow",function(a){t(a,n.parentNode)}),l.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),i&&s.on("tooltipHide",a.tooltip.cleanup),v.update=function(){h.transition().call(v)},v.container=this});return v}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=a.utils.defaultColor(),f=!0,g=!0,h=!1,i=!0,j=function(a,b,c,d,e){return"<h3>"+a+" - "+b+"</h3>"+"<p>"+c+"</p>"},k="No Data Available.",l=a.models.multiBarHorizontal().stacked(h),m=l.xScale(),n=l.yScale(),o=a.models.axis().scale(m).orient("left").highlightZero(!1).showMaxMin(!1),p=a.models.axis().scale(n).orient("bottom"),q=a.models.legend().height(30),r=a.models.legend().height(30),s=d3.dispatch("tooltipShow","tooltipHide");o.tickFormat(function(a){return a}),p.tickFormat(d3.format(",.1f"));var t=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=o.tickFormat()(l.x()(b.point,b.pointIndex)),g=p.tickFormat()(l.y()(b.point,b.pointIndex)),h=j(b.series.key,f,g,b,v);a.tooltip.show([d,e],h,b.value<0?"e":"w",null,c)},u=[{key:"Grouped"},{key:"Stacked",disabled:!0}];v.dispatch=s,v.multibar=l,v.legend=q,v.xAxis=o,v.yAxis=p,d3.rebind(v,l,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),v.margin=function(a){if(!arguments.length)return b;b=a;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),q.color(e);return v},v.showControls=function(a){if(!arguments.length)return f;f=a;return v},v.showLegend=function(a){if(!arguments.length)return g;g=a;return v},v.tooltip=function(a){if(!arguments.length)return j;j=a;return v},v.tooltips=function(a){if(!arguments.length)return i;i=a;return v},v.tooltipContent=function(a){if(!arguments.length)return j;j=a;return v},v.noData=function(a){if(!arguments.length)return k;k=a;return v};return v},a.models.multiChart=function(){function y(a){a.each(function(h){var j=d3.select(this),z=this,A=(d||parseInt(j.style("width"))||960)-b.left-b.right,B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom,C=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==1}),D=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==2}),E=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==1}),F=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==2}),G=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==1}),H=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==2}),I=h.filter(function(a){return!a.disabled&&a.yAxis==1}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),J=h.filter(function(a){return!a.disabled&&a.yAxis==2}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});i.domain(d3.extent(d3.merge(I.concat(J)),function(a){return a.x})).range([0,A]);var K=j.selectAll("g.wrap.multiChart").data([h]),L=K.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");L.append("g").attr("class","x axis"),L.append("g").attr("class","y1 axis"),L.append("g").attr("class","y2 axis"),L.append("g").attr("class","lines1Wrap"),L.append("g").attr("class","lines2Wrap"),L.append("g").attr("class","bars1Wrap"),L.append("g").attr("class","bars2Wrap"),L.append("g").attr("class","stack1Wrap"),L.append("g").attr("class","stack2Wrap"),L.append("g").attr("class","legendWrap");var M=K.select("g");f&&(v.width(A/2),M.select(".legendWrap").datum(h.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)");return a})).call(v),b.top!=v.height()&&(b.top=v.height(),B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom),M.select(".legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),m.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="line"})),n.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="line"})),o.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="bar"})),p.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="bar"})),q.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="area"})),r.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="area"})),M.attr("transform","translate("+b.left+","+b.top+")");var N=M.select(".lines1Wrap").datum(C),O=M.select(".bars1Wrap").datum(E),P=M.select(".stack1Wrap").datum(G),Q=M.select(".lines2Wrap").datum(D),R=M.select(".bars2Wrap").datum(F),S=M.select(".stack2Wrap").datum(H),T=G.length?G.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];k.domain(d3.extent(d3.merge(I).concat(T),function(a){return a.y})).range([0,B]),l.domain(d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,B]),m.yDomain(k.domain()),o.yDomain(k.domain()),q.yDomain(k.domain()),n.yDomain(l.domain()),p.yDomain(l.domain()),r.yDomain(l.domain()),G.length&&d3.transition(P).call(q),H.length&&d3.transition(S).call(r),E.length&&d3.transition(O).call(o),F.length&&d3.transition(R).call(p),C.length&&d3.transition(N).call(m),D.length&&d3.transition(Q).call(n),s.ticks(A/100).tickSize(-B,0),M.select(".x.axis").attr("transform","translate(0,"+B+")"),d3.transition(M.select(".x.axis")).call(s),t.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y1.axis")).call(t),u.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y2.axis")).call(u),M.select(".y2.axis").style("opacity",J.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,K.selectAll(".series").classed("disabled",!1);return a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this;return y}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"<h3>"+a+"</h3>"+"<p>"+c+" at "+b+"</p>"},i,j,i=d3.scale.linear(),k=d3.scale.linear(),l=d3.scale.linear(),m=a.models.line().yScale(k),n=a.models.line().yScale(l),o=a.models.multiBar().stacked(!1).yScale(k),p=a.models.multiBar().stacked(!1).yScale(l),q=a.models.stackedArea().yScale(k),r=a.models.stackedArea().yScale(l),s=a.models.axis().scale(i).orient("bottom").tickPadding(5),t=a.models.axis().scale(k).orient("left"),u=a.models.axis().scale(l).orient("right"),v=a.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=(b.series.bar?t:u).tickFormat()(m.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,y);a.tooltip.show([d,e],i,undefined,undefined,c.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),q.dispatch.on("tooltipShow",function(a){if(!Math.round(q.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),q.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),r.dispatch.on("tooltipShow",function(a){if(!Math.round(r.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),r.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),w.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),y.dispatch=w,y.lines1=m,y.lines2=n,y.bars1=o,y.bars2=p,y.stack1=q,y.stack2=r,y.xAxis=s,y.yAxis1=t,y.yAxis2=u,y.x=function(a){if(!arguments.length)return getX;getX=a,m.x(a),o.x(a);return y},y.y=function(a){if(!arguments.length)return getY;getY=a,m.y(a),o.y(a);return y},y.margin=function(a){if(!arguments.length)return b;b=a;return y},y.width=function(a){if(!arguments.length)return d;d=a;return y},y.height=function(a){if(!arguments.length)return e;e=a;return y},y.color=function(a){if(!arguments.length)return c;c=a,v.color(a);return y},y.showLegend=function(a){if(!arguments.length)return f;f=a;return y},y.tooltips=function(a){if(!arguments.length)return g;g=a;return y},y.tooltipContent=function(a){if(!arguments.length)return h;h=a;return y};return y},a.models.ohlcBar=function(){function w(a){a.each(function(a){var o=c-b.left-b.right,t=d-b.top-b.bottom;r.domain(p||d3.extent(a[0].values.map(f).concat(l))).range([0,o]),s.domain(q||[d3.min(a[0].values.map(k).concat(m)),d3.max(a[0].values.map(j).concat(m))]).range([t,0]);if(r.domain()[0]===r.domain()[1]||s.domain()[0]===s.domain()[1])singlePoint=!0;r.domain()[0]===r.domain()[1]&&(r.domain()[0]?r.domain([r.domain()[0]-r.domain()[0]*.01,r.domain()[1]+r.domain()[1]*.01]):r.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]));var u=d3.select(this).on("click",function(a,b){v.chartClick({data:a,index:b,pos:d3.event,id:e})}),w=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),A=z.append("g");A.append("g").attr("class","nv-ticks"),w.attr("width",c).attr("height",d);var B=w.select("g").attr("transform","translate("+b.left+","+b.top+")");z.append("defs").append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",o).attr("height",t),A.attr("clip-path",n?"url(#nv-chart-clip-path-"+e+")":"");var C=A.append("g").attr("class","nv-shiftWrap"),D=w.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});D.exit().remove();var E=D.enter().append("path").attr("class",function(a,b,c){return(h(a,b)>i(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=o/a[0].values.length*.9;return"m0,0l0,"+(s(h(b,c))-s(j(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(s(k(b,c))-s(h(b,c)))+"l0,"+(s(i(b,c))-s(k(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+r(f(a,b))+","+s(j(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),v.elementMouseover({point:b,series:a[0],pos:[r(f(b,c)),s(g(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),v.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){v.elementClick({value:g(a,b),data:a,index:b,pos:[r(f(a,b)),s(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){v.elementDblClick({value:g(a,b),data:a,index:b,pos:[r(f(a,b)),s(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(h(a,b)>i(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+r(f(a,b))+","+s(j(a,b))+")"}).attr("d",function(b,c){var d=o/a[0].values.length*.9;return"m0,0l0,"+(s(h(b,c))-s(j(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(s(k(b,c))-s(h(b,c)))+"l0,"+(s(i(b,c))-s(k(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})});return w}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=function(a){return a.x},g=function(a){return a.y},h=function(a){return a.open},i=function(a){return a.close},j=function(a){return a.high},k=function(a){return a.low},l=[],m=[],n=!0,o=a.utils.defaultColor(),p,q,r=d3.scale.linear(),s=d3.scale.linear(),t=d3.svg.axis().scale(r).orient("bottom"),u=d3.svg.axis().scale(s).orient("left"),v=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");w.dispatch=v,w.x=function(a){if(!arguments.length)return f;f=a;return w},w.y=function(a){if(!arguments.length)return g;g=a;return w},w.open=function(a){if(!arguments.length)return h;h=a;return w},w.close=function(a){if(!arguments.length)return i;i=a;return w},w.high=function(a){if(!arguments.length)return j;j=a;return w},w.low=function(a){if(!arguments.length)return k;k=a;return w},w.margin=function(a){if(!arguments.length)return b;b=a;return w},w.width=function(a){if(!arguments.length)return c;c=a;return w},w.height=function(a){if(!arguments.length)return d;d=a;return w},w.xScale=function(a){if(!arguments.length)return r;r=a;return w},w.yScale=function(a){if(!arguments.length)return s;s=a;return w},w.xDomain=function(a){if(!arguments.length)return p;p=a;return w},w.yDomain=function(a){if(!arguments.length)return q;q=a;return w},w.forceX=function(a){if(!arguments.length)return l;l=a;return w},w.forceY=function(a){if(!arguments.length)return m;m=a;return w},w.clipEdge=function(a){if(!arguments.length)return n;n=a;return w},w.color=function(b){if(!arguments.length)return o;o=a.utils.getColor(b);return w},w.id=function(a){if(!arguments.length)return e;e=a;return w};return w},a.models.pie=function(){function p(a){a.each(function(a){function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);this._current=b(0);return function(a){return w(b(a))}}function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this).on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})}),s=r.selectAll(".nv-wrap.nv-pie").data([e(a[0])]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+h),u=t.append("g"),v=s.select("g");u.append("g").attr("class","nv-pie"),s.attr("transform","translate("+b.left+","+b.top+")"),v.select(".nv-pie").attr("transform","translate("+j/2+","+p/2+")");var w=d3.svg.arc().outerRadius(q-q/5);n&&w.innerRadius(q/2);var x=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:g(a)}),y=s.select(".nv-pie").selectAll(".nv-slice").data(x);y.exit().remove();var z=y.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:f(a.data),value:g(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:h})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:f(a.data),value:g(a.data),point:a.data,index:b,id:h})}).on("click",function(a,b){o.elementClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()});y.attr("fill",function(a,b){return i(a,b)}).attr("stroke",function(a,b){return i(a,b)});var A=z.append("path").each(function(a){this._current=a});d3.transition(y.select("path")).attr("d",w).attrTween("d",D);if(k){var B=w;l&&(B=d3.svg.arc().outerRadius(w.outerRadius())),z.append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor","middle").style("fill","#000")}),y.select(".nv-label").transition().attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),y.each(function(a,b){var c=d3.select(this);c.select(".nv-label text").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>m?f(a.data):""});var d=c.select("text").node().getBBox();c.select(".nv-label rect").attr("width",d.width+10).attr("height",d.height+10).attr("transform",function(){return"translate("+[d.x-5,d.y-5]+")"})})}});return p}var b={top:0,right:0,bottom:0,left:0},c=500,d=500,e=function(a){return a.values},f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(Math.random()*1e4),i=a.utils.defaultColor(),j=d3.format(",.2f"),k=!0,l=!1,m=.02,n=!1,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");p.dispatch=o,p.margin=function(a){if(!arguments.length)return b;b=a;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.values=function(a){if(!arguments.length)return e;e=a;return p},p.x=function(a){if(!arguments.length)return f;f=a;return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return p},p.showLabels=function(a){if(!arguments.length)return k;k=a;return p},p.donutLabelsOutside=function(a){if(!arguments.length)return l;l=a;return p},p.donut=function(a){if(!arguments.length)return n;n=a;return p},p.id=function(a){if(!arguments.length)return h;h=a;return p},p.color=function(b){if(!arguments.length)return i;i=a.utils.getColor(b);return p},p.valueFormat=function(a){if(!arguments.length)return j;j=a;return p},p.labelThreshold=function(a){if(!arguments.length)return m;m=a;return p};return p},a.models.pieChart=function(){function n(f){f.each(function(h){var o=d3.select(this),p=this,q=(c||parseInt(o.style("width"))||960)-b.left-b.right,r=(d||parseInt(o.style("height"))||400)-b.top-b.bottom;if(!h||!h.length){o.append("text").attr("class","nvd3 nv-noData").attr("x",q/2).attr("y",r/2).attr("dy","-.7em").style("text-anchor","middle").text(i);return n}o.select(".nv-noData").remove();var s=o.selectAll("g.nv-wrap.nv-pieChart").data([h]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");t.append("g").attr("class","nv-pieWrap"),t.append("g").attr("class","nv-legendWrap");var u=s.select("g");e&&(k.width(q).key(j.x()),s.select(".nv-legendWrap").datum(j.values()(h[0])).call(k),b.top!=k.height()&&(b.top=k.height(),r=(d||parseInt(o.style("height"))||400)-b.top-b.bottom),s.select(".nv-legendWrap").attr("transform","translate(0,"+ -b.top+")")),j.width(q).height(r),u.attr("transform","translate("+b.left+","+b.top+")");var v=u.select(".nv-pieWrap").datum(h);d3.transition(v).call(j),k.dispatch.on("legendClick",function(a,b,c){a.disabled=!a.disabled,j.values()(h[0]).filter(function(a){return!a.disabled}).length||j.values()(h[0]).map(function(a){a.disabled=!1,s.selectAll(".nv-series"
).classed("disabled",!1);return a}),f.transition().call(n)}),j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],l.tooltipShow(a)}),g&&l.on("tooltipShow",function(a){m(a)}),j.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)}),g&&l.on("tooltipHide",a.tooltip.cleanup),n.update=function(){f.transition().call(n)},n.container=this});return n}var b={top:30,right:20,bottom:20,left:20},c=null,d=null,e=!0,f=a.utils.defaultColor(),g=!0,h=function(a,b,c,d){return"<h3>"+a+"</h3>"+"<p>"+b+"</p>"},i="No Data Available.",j=a.models.pie(),k=a.models.legend().height(30),l=d3.dispatch("tooltipShow","tooltipHide"),m=function(b,c){var d=b.pos[0]+(c&&c.offsetLeft||0),e=b.pos[1]+(c&&c.offsetTop||0),f=j.valueFormat()(j.y()(b.point)),g=h(j.x()(b.point),f,b,n);a.tooltip.show([d,e],g,b.value<0?"n":"s",null,c)};n.dispatch=l,n.pie=j,d3.rebind(n,j,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){if(!arguments.length)return b;b=a;return n},n.width=function(a){if(!arguments.length)return c;c=a;return n},n.height=function(a){if(!arguments.length)return d;d=a;return n},n.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b),k.color(f),j.color(f);return n},n.showLegend=function(a){if(!arguments.length)return e;e=a;return n},n.tooltips=function(a){if(!arguments.length)return g;g=a;return n},n.tooltipContent=function(a){if(!arguments.length)return h;h=a;return n},n.noData=function(a){if(!arguments.length)return i;i=a;return n};return n},a.models.scatter=function(){function G(a){a.each(function(a){function P(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.filter(r).map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c]})}));if(t){M.append("clipPath").attr("id","nv-points-clip-"+f);var e=K.select("#nv-points-clip-"+f).selectAll("circle").data(d);e.enter().append("circle").attr("r",u),e.exit().remove(),e.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),K.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=K.select(".nv-point-paths").selectAll("path").data(i);l.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),l.exit().remove(),l.attr("d",function(a){return"M"+a.data.join(",")+"Z"}),c=l}else{var m=d.map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}});c=K.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){var d=a[c.series],e=d.values[c.point];A.elementClick({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseover",function(c){var d=a[c.series],e=d.values[c.point];A.elementMouseover({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseout",function(b,c){var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})})}var G=c-b.left-b.right,H=d-b.top-b.bottom,I=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var J=v&&w&&x?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:j(a,b),y:k(a,b),size:l(a,b)}})}));g.domain(v||d3.extent(J.map(function(a){return a.x}).concat(n))).range([0,G]),h.domain(w||d3.extent(J.map(function(a){return a.y}).concat(o))).range([H,0]),i.domain(x||d3.extent(J.map(function(a){return a.size}).concat(p))).range(y||[16,256]);if(g.domain()[0]===g.domain()[1]||h.domain()[0]===h.domain()[1])z=!0;g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-g.domain()[0]*.01,g.domain()[1]+g.domain()[1]*.01]):g.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*.01,h.domain()[1]-h.domain()[1]*.01]):h.domain([-1,1])),C=C||g,D=D||h,E=E||i;var K=I.selectAll("g.nv-wrap.nv-scatter").data([a]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),M=L.append("defs"),N=L.append("g"),O=K.select("g");N.append("g").attr("class","nv-groups"),N.append("g").attr("class","nv-point-paths"),K.attr("transform","translate("+b.left+","+b.top+")"),M.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),K.select("#nv-edge-clip-"+f+" rect").attr("width",G).attr("height",H),O.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":"");var Q=K.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});Q.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(Q.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),Q.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(Q).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var R=Q.selectAll("path.nv-point").data(function(a){return a.values});R.enter().append("path").attr("transform",function(a,b){return"translate("+C(j(a,b))+","+D(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),R.exit().remove(),d3.transition(Q.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),R.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(R).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),clearTimeout(F),F=setTimeout(P,1e3),C=g.copy(),D=h.copy(),E=i.copy()});return G}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e5),g=d3.scale.linear(),h=d3.scale.linear(),i=d3.scale.linear(),j=function(a){return a.x},k=function(a){return a.y},l=function(a){return a.size},m=function(a){return a.shape||"circle"},n=[],o=[],p=[],q=!0,r=function(a){return!a.notActive},s=!1,t=!0,u=function(){return 25},v=null,w=null,x=null,y=null,z=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),B=!0,C,D,E,F;A.on("elementMouseover.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!1)}),G.dispatch=A,G.x=function(a){if(!arguments.length)return j;j=d3.functor(a);return G},G.y=function(a){if(!arguments.length)return k;k=d3.functor(a);return G},G.size=function(a){if(!arguments.length)return l;l=d3.functor(a);return G},G.margin=function(a){if(!arguments.length)return b;b=a;return G},G.width=function(a){if(!arguments.length)return c;c=a;return G},G.height=function(a){if(!arguments.length)return d;d=a;return G},G.xScale=function(a){if(!arguments.length)return g;g=a;return G},G.yScale=function(a){if(!arguments.length)return h;h=a;return G},G.zScale=function(a){if(!arguments.length)return i;i=a;return G},G.xDomain=function(a){if(!arguments.length)return v;v=a;return G},G.yDomain=function(a){if(!arguments.length)return w;w=a;return G},G.sizeDomain=function(a){if(!arguments.length)return x;x=a;return G},G.sizeRange=function(a){if(!arguments.length)return y;y=a;return G},G.forceX=function(a){if(!arguments.length)return n;n=a;return G},G.forceY=function(a){if(!arguments.length)return o;o=a;return G},G.forceSize=function(a){if(!arguments.length)return p;p=a;return G},G.interactive=function(a){if(!arguments.length)return q;q=a;return G},G.pointActive=function(a){if(!arguments.length)return r;r=a;return G},G.clipEdge=function(a){if(!arguments.length)return s;s=a;return G},G.clipVoronoi=function(a){if(!arguments.length)return t;t=a;return G},G.useVoronoi=function(a){if(!arguments.length)return B;B=a,B===!1&&(t=!1);return G},G.clipRadius=function(a){if(!arguments.length)return u;u=a;return G},G.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return G},G.shape=function(a){if(!arguments.length)return m;m=a;return G},G.id=function(a){if(!arguments.length)return f;f=a;return G},G.singlePoint=function(a){if(!arguments.length)return z;z=a;return G};return G},a.models.scatterChart=function(){function E(a){a.each(function(o){function L(){if(m){K.select(".nv-point-paths").style("pointer-events","all");return!1}K.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);f.distortion(l).focus(a[0]),g.distortion(l).focus(a[1]),K.select(".nv-scatterWrap").datum(o.filter(function(a){return!a.disabled})).call(r),K.select(".nv-x.nv-axis").call(s),K.select(".nv-y.nv-axis").call(t),K.select(".nv-distributionX").datum(o.filter(function(a){return!a.disabled})).call(w),K.select(".nv-distributionY").datum(o.filter(function(a){return!a.disabled})).call(x)}var p=d3.select(this),q=this,F=(c||parseInt(p.style("width"))||960)-b.left-b.right,G=(d||parseInt(p.style("height"))||400)-b.top-b.bottom;if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){p.append("text").attr("class","nvd3 nv-noData").attr("x",F/2).attr("y",G/2).attr("dy","-.7em").style("text-anchor","middle").text(z);return E}p.select(".nv-noData").remove(),f=r.xScale(),g=r.yScale(),A=A||f,B=B||g;var H=p.selectAll("g.nv-wrap.nv-scatterChart").data([o]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+r.id()),J=I.append("g"),K=H.select("g");J.append("rect").attr("class","nvd3 nv-background"),J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y nv-axis"),J.append("g").attr("class","nv-scatterWrap"),J.append("g").attr("class","nv-distWrap"),J.append("g").attr("class","nv-legendWrap"),J.append("g").attr("class","nv-controlsWrap"),H.attr("transform","translate("+b.left+","+b.top+")"),j&&(u.width(F/2),H.select(".nv-legendWrap").datum(o).call(u),b.top!=u.height()&&(b.top=u.height(),G=(d||parseInt(p.style("height"))||400)-b.top-b.bottom),H.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -b.top+")")),k&&(v.width(180).color(["#444"]),K.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -b.top+")").call(v)),K.select(".nv-background").attr("width",F).attr("height",G),r.width(F).height(G).color(o.map(function(a,b){return a.color||e(a,b)}).filter(function(a,b){return!o[b].disabled})),H.select(".nv-scatterWrap").datum(o.filter(function(a){return!a.disabled})).call(r),s.scale(f).ticks(s.ticks()?s.ticks():F/100).tickSize(-G,0),K.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")").call(s),t.scale(g).ticks(t.ticks()?t.ticks():G/36).tickSize(-F,0),K.select(".nv-y.nv-axis").call(t),h&&(w.getData(r.x()).scale(f).width(F).color(o.map(function(a,b){return a.color||e(a,b)}).filter(function(a,b){return!o[b].disabled})),J.select(".nv-distWrap").append("g").attr("class","nv-distributionX").attr("transform","translate(0,"+g.range()[0]+")"),K.select(".nv-distributionX").datum(o.filter(function(a){return!a.disabled})).call(w)),i&&(x.getData(r.y()).scale(g).width(G).color(o.map(function(a,b){return a.color||e(a,b)}).filter(function(a,b){return!o[b].disabled})),J.select(".nv-distWrap").append("g").attr("class","nv-distributionY").attr("transform","translate(-"+x.size()+",0)"),K.select(".nv-distributionY").datum(o.filter(function(a){return!a.disabled})).call(x)),K.select(".nv-background").on("mousemove",L),K.select(".nv-background").on("click",function(){m=!m}),r.dispatch.on("elementClick.freezeFisheye",function(){m=!m}),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l=b.disabled?0:2.5,K.select(".nv-background").style("pointer-events",b.disabled?"none":"all"),K.select(".nv-point-paths").style("pointer-events",b.disabled?"all":"none"),b.disabled?(f.distortion(l).focus(0),g.distortion(l).focus(0),K.select(".nv-scatterWrap").call(r),K.select(".nv-x.nv-axis").call(s),K.select(".nv-y.nv-axis").call(t)):m=!1,E(a)}),u.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),E(a)}),r.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+r.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+r.id()+" .nv-series-"+a.seriesIndex+" .nv-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&&C(a,q.parentNode)}),A=f.copy(),B=g.copy(),E.update=function(){E(a)},E.container=this});return E}var b={top:30,right:20,bottom:50,left:60},c=null,d=null,e=a.utils.defaultColor(),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"<strong>"+b+"</strong>"},p=function(a,b,c){return"<strong>"+c+"</strong>"},q=null,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="No Data Available.",A,B,C=function(c,d){var e=c.pos[0]+(d.offsetLeft||0),h=c.pos[1]+(d.offsetTop||0),i=c.pos[0]+(d.offsetLeft||0),j=g.range()[0]+b.top+(d.offsetTop||0),k=f.range()[0]+b.left+(d.offsetLeft||0),l=c.pos[1]+(d.offsetTop||0),m=s.tickFormat()(r.x()(c.point,c.pointIndex)),n=t.tickFormat()(r.y()(c.point,c.pointIndex));o!=null&&a.tooltip.show([i,j],o(c.series.key,m,n,c,E),"n",1,d,"x-nvtooltip"),p!=null&&a.tooltip.show([k,l],p(c.series.key,m,n,c,E),"e",1,d,"y-nvtooltip"),q!=null&&a.tooltip.show([e,h],q(c.series.key,m,n,c,E),c.value<0?"n":"s",null,d)},D=[{key:"Magnify",disabled:!0}];r.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+r.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+r.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",x.size())}),y.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),E.dispatch=y,E.legend=u,E.controls=u,E.xAxis=s,E.yAxis=t,E.distX=w,E.distY=x,d3.rebind(E,r,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){if(!arguments.length)return b;b=a;return E},E.width=function(a){if(!arguments.length)return c;c=a;return E},E.height=function(a){if(!arguments.length)return d;d=a;return E},E.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),u.color(e),w.color(e),x.color(e);return E},E.showDistX=function(a){if(!arguments.length)return h;h=a;return E},E.showDistY=function(a){if(!arguments.length)return i;i=a;return E},E.showControls=function(a){if(!arguments.length)return k;k=a;return E},E.showLegend=function(a){if(!arguments.length)return j;j=a;return E},E.fisheye=function(a){if(!arguments.length)return l;l=a;return E},E.tooltips=function(a){if(!arguments.length)return n;n=a;return E},E.tooltipContent=function(a){if(!arguments.length)return q;q=a;return E},E.tooltipXContent=function(a){if(!arguments.length)return o;o=a;return E},E.tooltipYContent=function(a){if(!arguments.length)return p;p=a;return E},E.noData=function(a){if(!arguments.length)return z;z=a;return E};return E},a.models.sparkline=function(){function m(a){a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom;k.domain(i||d3.extent(a,f)).range([0,e]),l.domain(j||d3.extent(a,g)).range([m,0]);var n=d3.select(this).selectAll("g.nv-wrap.nv-sparkline").data([a]),o=n.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");o.attr("transform","translate("+b.left+","+b.top+")").style("stroke",function(a,b){return a.color||h(a,b)});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 k(f(a,b))}).y(function(a,b){return l(g(a,b))}));var q=o.selectAll("circle.nv-point").data(function(a){return a.filter(function(a,b){return l.domain().indexOf(g(a,b))!=-1||f(a,b)==k.domain()[1]})});q.enter().append("circle").attr("class","nv-point"),q.exit().remove(),q.attr("cx",function(a,b){return k(f(a,b))}).attr("cy",function(a,b){return l(g(a,b))}).attr("r",2).style("stroke",function(a,b){return a.x==k.domain()[1]?"#444":a.y==l.domain()[0]?"#d62728":"#2ca02c"}).style("fill",function(a,b){return a.x==k.domain()[1]?"#444":a.y==l.domain()[0]?"#d62728":"#2ca02c"})});return m}var b={top:0,right:0,bottom:0,left:0},c=400,d=32,e=!0,f=function(a){return a.x},g=function(a){return a.y},h=a.utils.defaultColor(),i,j,k=d3.scale.linear(),l=d3.scale.linear();m.margin=function(a){if(!arguments.length)return b;b=a;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.x=function(a){if(!arguments.length)return f;f=d3.functor(a);return m},m.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return m},m.xDomain=function(a){if(!arguments.length)return i;i=a;return m},m.yDomain=function(a){if(!arguments.length)return j;j=a;return m},m.animate=function(a){if(!arguments.length)return e;e=a;return m};return m},a.models.sparklinePlus=function(){function p(a){a.each(function(a){function A(){var c=d3.event.offsetX-b.left;v.attr("x1",c).attr("x2",c),w.attr("transform",function(a){return"translate("+(c-6)+","+ -b.top+")"}).text(j(Math.round(m.invert(c))));var d=function(a,b){var c=Math.abs(f(a[0])-b),d=0;for(var e=0;e<a.length;e++)Math.abs(f(a[e])-b)<c&&(c=Math.abs(f(a[e])-b),d=e);return d};z.attr("transform",function(a){return"translate("+(c+6)+","+ -b.top+")"}).text(k(g(a[d(a,Math.round(m.invert(c)))])))}var e=c-b.left-b.right,i=d-b.top-b.bottom;if(!a||!a.length||!a.filter(function(a){return a.values.length}).length){container.append("text").attr("class","nvd3 nv-noData").attr("x",e/2).attr("y",i/2).attr("dy","-.7em").style("text-anchor","middle").text(l);return p}container.select(".nv-noData").remove(),m.domain(d3.extent(a,f)).range([0,e]),n.domain(d3.extent(a,g)).range([i,0]);var q=d3.select(this).selectAll("g.nv-wrap.nv-sparklineplus").data([a]),r=q.enter().append("g"),s=r.append("g").attr("class","nvd3 nv-wrap nv-sparklineplus").attr("transform","translate("+b.left+","+b.top+")").style("stroke",function(a,b){return a.color||h(a,b)});o.xDomain(m.domain()).yDomain(n.domain()),s.call(o);var t=s.append("g").attr("class","nv-hoverValue"),u=s.append("g").attr("class","nv-hoverArea");t.attr("transform",function(a){return"translate("+m(a)+",0)"});var v=t.append("line").attr("x1",m.range()[1]).attr("y1",-b.top).attr("x2",m.range()[1]).attr("y2",d),w=t.append("text").attr("class","nv-xValue").attr("text-anchor","end").attr("dy",".9em"),z=t.append("text").attr("class","nv-yValue").attr("text-anchor","start").attr("dy",".9em");u.append("rect").attr("width",e).attr("height",i).on("mousemove",A)});return p}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=a.utils.defaultColor(),i=Math.floor(Math.random()*1e5),j=d3.format(",r"),k=d3.format(",.2f"),l="No Data Available.",m=d3.scale.linear(),n=d3.scale.linear(),o=a.models.sparkline();p.margin=function(a){if(!arguments.length)return b;b=a;return p},p.width=function(a){if(!arguments.length)return c;c=a,o.width(a-b.left-b.right);return p},p.height=function(a){if(!arguments.length)return d;d=a,o.height(a-b.top-b.bottom);return p},p.x=function(a){if(!arguments.length)return f;f=d3.functor(a),o.x(a);return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a),o.y(a);return p},p.id=function(a){if(!arguments.length)return i;i=a;return p},p.animate=function(a){if(!arguments.length)return e;e=a;return p},p.noData=function(a){if(!arguments.length)return l;l=a;return p};return p},a.models.stackedArea=function(){function r(a){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){a.values=a.values.map(function(b,c){b.index=c,b.stackedY=a.disabled?0:h(b,c);return b});return 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.nv-wrap.nv-stackedarea").data([a]),s=r.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),t=s.append("defs"),u=s.append("g"),v=r.select("g");u.append("g").attr("class","nv-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(a,b)}).filter(function(b,c){return!a[c].disabled})),u.append("g").attr("class","nv-scatterWrap");var w=v.select(".nv-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","nv-edge-clip-"+f).append("rect"),r.select("#nv-edge-clip-"+f+" rect").attr("width",i).attr("height",o),v.attr("clip-path",l?"url(#nv-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(".nv-areaWrap").selectAll("path.nv-area").data(function(a){return a});B.enter().append("path").attr("class",function(a,b){return"nv-area nv-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(a,b)}).style("stroke",function(a,b){return a.color||e(a,b)}),d3.transition(B).attr("d",function(a,b){return z(a.values,b)}),p.dispatch.on("elementMouseover.area",function(a){v.select(".nv-chart-"+f+" .nv-area-"+a.seriesIndex).classed("hover",!0)}),p.dispatch.on("elementMouseout.area",function(a){v.select(".nv-chart-"+f+" .nv-area-"+a.seriesIndex).classed("hover",!1)})});return r}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),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");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){if(!arguments.length)return g;g=d3.functor(a);return r},r.y=function(a){if(!arguments.length)return h;h=d3.functor(a);return r},r.margin=function(a){if(!arguments.length)return b;b=a;return r},r.width=function(a){if(!arguments.length)return c;c=a;return r},r.height=function(a){if(!arguments.length)return d;d=a;return r},r.clipEdge=function(a){if(!arguments.length)return l;l=a;return r},r.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return r},r.offset=function(a){if(!arguments.length)return j;j=a;return r},r.order=function(a){if(!arguments.length)return k;k=a;return r},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};return r},a.models.stackedAreaChart=function(){function v(a){a.each(function(e){var i=d3.select(this),w=this,z=(c||parseInt(i.style("width"))||960)-b.left-b.right,A=(d||parseInt(i.style("height"))||400)-b.top-b.bottom;if(!e||!e.length||!e.filter(function(a){return a.values.length}).length){i.append("text").attr("class","nvd3 nv-noData").attr("x",z/2).attr("y",A/2).attr("dy","-.7em").style("text-anchor","middle").text(l);return v}i.select(".nv-noData").remove(),j=m.xScale(),k=m.yScale();var B=i.selectAll("g.nv-wrap.nv-stackedAreaChart").data([e]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");C.append("g").attr("class","nv-x nv-axis"),C.append("g").attr("class","nv-y nv-axis"),C.append("g").attr("class","nv-stackedWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap");var D=B.select("g");g&&(q.width(z/2),D.select(".nv-legendWrap").datum(e).call(q),b.top!=q.height()&&(b.top=q.height(),A=(d||parseInt(i.style("height"))||400)-b.top-b.bottom),D.select(".nv-legendWrap").attr("transform","translate("+z/2+","+ -b.top+")")),m.width(z).height(A),f&&(r.width(280).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(t).attr("transform","translate(0,"+ -b.top+")").call(r)),D.attr("transform","translate("+b.left+","+b.top+")");var E=D.select(".nv-stackedWrap").datum(e);d3.transition(E).call(m),n.scale(j).ticks(z/100).tickSize(-A,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+A+")"),d3.transition(D.select(".nv-x.nv-axis")).call(n),o.scale(k).ticks(m.offset()=="wiggle"?0:A/36).tickSize(-z,0).setTickFormat(m.offset()=="expand"?d3.format("%"):p),d3.transition(D.select(".nv-y.nv-axis")).call(o),m.dispatch.on("areaClick.toggle",function(b){e.filter(function(a){return!a.disabled}).length===1?e=e.map(function(a){a.disabled=!1;return a}):e=e.map(function(a,c){a.disabled=c!=b.seriesIndex;return a}),a.transition().call(v)}),q.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,e.filter(function(a){return!a.disabled}).length||e.map(function(a){a.disabled=!1;return a}),a.transition().call(v)}),r.dispatch.on("legendClick",function(b,c){if(!!b.disabled){t=t.map(function(a){a.disabled=!0;return a}),b.disabled=!1;switch(b.key){case"Stacked":m.style("stack");break;case"Stream":m.style("stream");break;case"Expanded":m.style("expand")}a.transition().call(v)}}),s.on("tooltipShow",function(a){h&&u(a,w.parentNode)})}),v.update=function(){a.transition().call(v)},v.container=this;return v}var b={top:30,right:25,bottom:50,left:60},c=null,d=null,e=a.utils.defaultColor(),f=!0,g=!0,h=!0,i=function(a,b,c,d,e){return"<h3>"+a+"</h3>"+"<p>"+c+" on "+b+"</p>"},j,k,l="No Data Available.",m=a.models.stackedArea(),n=a.models.axis().orient("bottom").tickPadding(5),o=a.models.axis().orient("left"),p=d3.format(",.2f"),q=a.models.legend().height(30),r=a.models.legend().height(30),s=d3.dispatch("tooltipShow","tooltipHide"),t=[{key:"Stacked"},{key:"Stream",disabled:!0},{key:"Expanded",disabled:!0}],u=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=n.tickFormat()(m.x()(b.point,b.pointIndex)),g=o.tickFormat()(m.y()(b.point,b.pointIndex)),h=i(b.series.key,f,g,b,v);a.tooltip.show([d,e],h,b.value<0?"n":"s",null,c)};m.dispatch.on("tooltipShow",function(a){if(!Math.round(m.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],s.tooltipShow(a)}),m.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),v.dispatch=s,v.stacked=m,v.xAxis=n,v.yAxis=o,d3.rebind(v,m,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize"),v.margin=function(a){if(!arguments.length)return b;b=a;return v},v.width=function(a){if(!arguments.length)return getWidth;c=a;return v},v.height=function(a){if(!arguments.length)return getHeight;d=a;return v},v.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),q.color(e),m.color(e);return v},v.showControls=function(a){if(!arguments.length)return f;f=a;return v},v.showLegend=function(a){if(!arguments.length)return g;g=a;return v},v.tooltips=function(a){if(!arguments.length)return h;h=a;return v},v.tooltipContent=function(a){if(!arguments.length)return i;i=a;return v},v.noData=function(a){if(!arguments.length)return l;l=a;return v},o.setTickFormat=o.tickFormat,o.tickFormat=function(a){if(!arguments.length)return p;p=a;return o};return v}})()