From 49505ba976cc3d04474bf653fba9eadc0df65c31 Mon Sep 17 00:00:00 2001 From: Tyler Wolf Date: Mon, 12 Nov 2012 18:23:01 -0500 Subject: [PATCH] UI-31 --- nv.d3.js | 5 ++++- nv.d3.min.js | 10 +++++----- src/models/cumulativeLineChart.js | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/nv.d3.js b/nv.d3.js index 0fd25ff..6ddccb0 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -1893,7 +1893,10 @@ nv.models.cumulativeLineChart = function() { xAxis .scale(x) - .ticks( availableWidth / 100 ) + //If the ticks cannot fit on the chart tastefully, put in subticks for the dates that don't show + .tickSubdivide( (data[0].values.length > (availableWidth/50)) ? true : false ) + //Suggest how many ticks based on the chart width and D3 should listen (50 is the optimal number for MM/DD/YY dates) + .ticks( Math.min(data[0].values.length,availableWidth/50) ) .tickSize(-availableHeight, 0); g.select('.nv-x.nv-axis') diff --git a/nv.d3.min.js b/nv.d3.min.js index 7f1dd35..8110ed2 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,5 +1,5 @@ -(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o1)while(o=document.body.scrollWidth?h:h-16;var g=function(e){var t=m;do isNaN(e.offsetTop)||(t+=e.offsetTop);while(e=e.offsetParent);return t},y=function(e){var t=v;do isNaN(e.offsetLeft)||(t+=e.offsetLeft);while(e=e.offsetParent);return t};switch(r){case"e":v=t[0]-l-i,m=t[1]-f/2;var b=y(u),w=g(u);bd?t[0]+i:d-b+v),wp+h&&(m=p+h-w+m-f);break;case"w":v=t[0]+i,m=t[1]-f/2,b+l>c&&(v=t[0]-l-i),wp+h&&(m=p-f-5);break;case"n":v=t[0]-l/2-5,m=t[1]+i;var b=y(u),w=g(u);bc&&(v=parseInt(a.offsetWidth)-l-5),w+f>p+h&&(m=p+h-w+m-f);break;case"s":v=t[0]-l/2,m=t[1]-f-i;var b=y(u),w=g(u);bc&&(v=parseInt(a.offsetWidth)-l-5),p>w&&(m=p)}return u.style.left=v+"px",u.style.top=m+"px",u.style.opacity=1,u.style.position="absolute",u.style.pointerEvents="none",u},t.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.models.axis=function(){function d(r){return r.each(function(r){var d=d3.select(this),v=d.selectAll("g.nv-wrap.nv-axis").data([r]),m=v.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),g=m.append("g"),y=v.select("g");h!==null?e.ticks(h):(e.orient()=="top"||e.orient()=="bottom")&&e.ticks(Math.abs(i.range()[1]-i.range()[0])/100),d3.transition(y).call(e),p=p||e.scale();var b=e.tickFormat();b==null&&(b=p.tickFormat());var w=y.selectAll("text.nv-axislabel").data([s||null]);w.exit().remove();switch(e.orient()){case"top":w.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var E=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);w.attr("x",E/2);if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text"),S.exit().remove(),S.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var x=36,T=30,N=y.selectAll("g").select("text");if(a%360){N.each(function(e,t){var n=this.getBBox().width;n>T&&(T=n)});var C=Math.abs(Math.sin(a*Math.PI/180)),x=(C?C*T:T)+30;N.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).attr("text-anchor",a%360>0?"start":"end")}w.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var E=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);w.attr("x",E/2);if(o){var S=v.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);S.enter().append("g").attr("class","nv-axisMaxMin").append("text"),S.exit().remove(),S.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).attr("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}l&&N.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":w.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)-12:-10),w.attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),S.exit().remove(),S.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).attr("text-anchor","start").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":w.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+12:-10),w.attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),S.exit().remove(),S.attr("transform",function(e,t){return"translate(0,"+p(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}}w.text(function(e){return e}),o&&(e.orient()==="left"||e.orient()==="right")&&(y.selectAll("g").each(function(e,t){if(i(e)i.range()[0]-10)e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),i.domain()[0]==i.domain()[1]&&i.domain()[0]==0&&v.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(o&&(e.orient()==="top"||e.orient()==="bottom")){var k=[];v.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?k.push(i(e)-this.getBBox().width-4):k.push(i(e)+this.getBBox().width+4)}catch(n){t?k.push(i(e)-4):k.push(i(e)+4)}}),y.selectAll("g").each(function(e,t){if(i(e)k[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}u&&y.selectAll("line.tick").filter(function(e){return!parseFloat(Math.round(e*1e5)/1e6)}).classed("zero",!0),p=i.copy()}),d}var e=d3.svg.axis(),t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=!0,u=!0,a=0,f=!0,l=!1,c=!1,h=null;e.scale(i).orient("bottom").tickFormat(function(e){return e});var p;return d.axis=e,d3.rebind(d,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(d,i,"domain","range","rangeBand","rangeBands"),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.ticks=function(e){return arguments.length?(h=e,d):h},d.height=function(e){return arguments.length?(r=e,d):r},d.axisLabel=function(e){return arguments.length?(s=e,d):s},d.showMaxMin=function(e){return arguments.length?(o=e,d):o},d.highlightZero=function(e){return arguments.length?(u=e,d):u},d.scale=function(t){return arguments.length?(i=t,e.scale(i),c=typeof i.rangeBands=="function",d3.rebind(d,i,"domain","range","rangeBand","rangeBands"),d):i},d.rotateYLabel=function(e){return arguments.length?(f=e,d):f},d.rotateLabels=function(e){return arguments.length?(a=e,d):a},d.staggerLabels=function(e){return arguments.length?(l=e,d):l},d},e.models.historicalBar=function(){function m(e){return e.each(function(e){var m=n-t.left-t.right,g=r-t.top-t.bottom,b=d3.select(this);s.domain(p||d3.extent(e[0].values.map(u).concat(f))).range([0,m]),o.domain(d||d3.extent(e[0].values.map(a).concat(l))).range([g,0]);if(s.domain()[0]===s.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;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])),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 w=b.selectAll("g.nv-wrap.nv-bar").data([e[0].values]),E=w.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),S=E.append("defs"),T=E.append("g"),N=w.select("g");T.append("g").attr("class","nv-bars"),w.attr("transform","translate("+t.left+","+t.top+")"),b.on("click",function(e,t){v.chartClick({data:e,index:t,pos:d3.event,id:i})}),S.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),w.select("#nv-chart-clip-path-"+i+" rect").attr("width",m).attr("height",g),N.attr("clip-path",c?"url(#nv-chart-clip-path-"+i+")":"");var C=w.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e});C.exit().remove();var k=C.enter().append("rect").attr("x",0).attr("y",function(e,t){return o(Math.max(0,a(e,t)))}).attr("height",function(e,t){return Math.abs(o(a(e,t))-o(0))}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),v.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),v.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){v.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){v.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});C.attr("fill",function(e,t){return h(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(t,n){return"translate("+(s(u(t,n))-m/e[0].values.length*.5)+",0)"}).attr("width",m/e[0].values.length*.9),d3.transition(C).attr("y",function(e,t){return a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t))}).attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)})}),m}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!0,h=e.utils.defaultColor(),p,d,v=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return m.dispatch=v,m.x=function(e){return arguments.length?(u=e,m):u},m.y=function(e){return arguments.length?(a=e,m):a},m.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,m):t},m.width=function(e){return arguments.length?(n=e,m):n},m.height=function(e){return arguments.length?(r=e,m):r},m.xScale=function(e){return arguments.length?(s=e,m):s},m.yScale=function(e){return arguments.length?(o=e,m):o},m.xDomain=function(e){return arguments.length?(p=e,m):p},m.yDomain=function(e){return arguments.length?(d=e,m):d},m.forceX=function(e){return arguments.length?(f=e,m):f},m.forceY=function(e){return arguments.length?(l=e,m):l},m.clipEdge=function(e){return arguments.length?(c=e,m):c},m.color=function(t){return arguments.length?(h=e.utils.getColor(t),m):h},m.id=function(e){return arguments.length?(i=e,m):i},m},e.models.bullet=function(){function p(e){return e.each(function(e,n){var u=a-t.left-t.right,l=f-t.top-t.bottom,p=d3.select(this),d=i.call(this,e,n).slice().sort(d3.descending),v=s.call(this,e,n).slice().sort(d3.descending),m=o.call(this,e,n).slice().sort(d3.descending),g=d3.scale.linear().domain([0,Math.max(d[0],v[0],m[0])]).range(r?[u,0]:[0,u]),y=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(g.range());this.__chart__=g;var b=p.selectAll("g.nv-wrap.nv-bullet").data([e]),w=b.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),E=w.append("g"),S=b.select("g");b.attr("transform","translate("+t.left+","+t.top+")");var x=function(e){return Math.abs(y(e)-y(0))},T=function(e){return Math.abs(g(e)-g(0))},N=S.selectAll("rect.nv-range").data(d);N.enter().append("rect").attr("class",function(e,t){return"nv-range nv-s"+t}).attr("width",x).attr("height",l).attr("x",r?y:0).on("mouseover",function(e,t){h.elementMouseover({value:e,label:t<=0?"Maximum":t>1?"Minimum":"Mean",pos:[g(e),l/2]})}).on("mouseout",function(e,t){h.elementMouseout({value:e,label:t<=0?"Minimum":t>=1?"Maximum":"Mean"})}),d3.transition(N).attr("x",r?g:0).attr("width",T).attr("height",l);var C=S.selectAll("rect.nv-measure").data(m);C.enter().append("rect").attr("class",function(e,t){return"nv-measure nv-s"+t}).style("fill",function(e,t){return c(e,t)}).attr("width",x).attr("height",l/3).attr("x",r?y:0).attr("y",l/3).on("mouseover",function(e){h.elementMouseover({value:e,label:"Current",pos:[g(e),l/2]})}).on("mouseout",function(e){h.elementMouseout({value:e,label:"Current"})}),d3.transition(C).attr("width",T).attr("height",l/3).attr("x",r?g:0).attr("y",l/3);var k=S.selectAll("path.nv-markerTriangle").data(v),L=l/6;k.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(e){return"translate("+y(e)+","+l/2+")"}).attr("d","M0,"+L+"L"+L+","+ -L+" "+ -L+","+ -L+"Z").on("mouseover",function(e,t){h.elementMouseover({value:e,label:"Previous",pos:[g(e),l/2]})}).on("mouseout",function(e,t){h.elementMouseout({value:e,label:"Previous"})}),d3.transition(k).attr("transform",function(e){return"translate("+g(e)+","+l/2+")"}),k.exit().remove()}),d3.timer.flush(),p}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=[0],a=380,f=30,l=null,c=e.utils.getColor(["#1f77b4"]),h=d3.dispatch("elementMouseover","elementMouseout");return p.dispatch=h,p.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",p):n},p.ranges=function(e){return arguments.length?(i=e,p):i},p.markers=function(e){return arguments.length?(s=e,p):s},p.measures=function(e){return arguments.length?(o=e,p):o},p.forceX=function(e){return arguments.length?(u=e,p):u},p.width=function(e){return arguments.length?(a=e,p):a},p.height=function(e){return arguments.length?(f=e,p):f},p.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,p):t},p.tickFormat=function(e){return arguments.length?(l=e,p):l},p.color=function(t){return arguments.length?(c=e.utils.getColor(t),p):c},p},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=data[0].title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"

"+t+"

"+"

"+n+"

"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function T(e,t){d3.select(k.container).style("cursor","ew-resize")}function N(e,t){e.x+=d3.event.dx,e.i=Math.round(w.invert(e.x)),d3.select(this).attr("transform","translate("+w(e.i)+",0)"),k.update()}function C(e,t){d3.select(k.container).style("cursor","auto"),k.update()}function k(e){return e.each(function(d){function I(){F.data([E]),k.update()}var T=d3.select(this).classed("nv-chart-"+g,!0),N=this,C=(a||parseInt(T.style("width"))||960)-o.left-o.right,A=(f||parseInt(T.style("height"))||400)-o.top-o.bottom;k.update=function(){k(e)},k.container=this;if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var O=T.selectAll(".nv-noData").data([y]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+C/2).attr("y",o.top+A/2).text(function(e){return e}),k}T.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();if(!p){var M=d.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),_=[d3.min(M,function(e){return e[0]}),d3.max(M,function(e){return e[1]})];t.yDomain(_)}else t.yDomain(null);w.domain([0,d[0].values.length-1]).range([0,C]).clamp(!0);var d=L(E.i,d),D=T.selectAll("g.nv-wrap.nv-cumulativeLine").data([d]),P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),H=D.select("g");P.append("g").attr("class","nv-x nv-axis"),P.append("g").attr("class","nv-y nv-axis"),P.append("g").attr("class","nv-background"),P.append("g").attr("class","nv-linesWrap"),P.append("g").attr("class","nv-legendWrap"),P.append("g").attr("class","nv-controlsWrap"),l&&(i.width(C),H.select(".nv-legendWrap").datum(d).call(i),o.top!=i.height()&&(o.top=i.height(),A=(f||parseInt(T.style("height"))||400)-o.top-o.bottom),H.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")"));if(h){var B=[{key:"Re-scale y-axis",disabled:!p}];s.width(140).color(["#444","#444","#444"]),H.select(".nv-controlsWrap").datum(B).attr("transform","translate(0,"+ -o.top+")").call(s)}D.attr("transform","translate("+o.left+","+o.top+")"),P.select(".nv-background").append("rect").attr("width",C).attr("height",A),t.y(function(e){return e.display.y}).width(C).height(A).color(d.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!d[t].disabled}));var j=H.select(".nv-linesWrap").datum(d.filter(function(e){return!e.disabled}));j.call(t);var F=j.selectAll(".nv-indexLine").data([E]);F.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(x),F.attr("transform",function(e){return"translate("+w(e.i)+",0)"}).attr("height",A),n.scale(v).ticks(C/100).tickSize(-A,0),H.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),d3.transition(H.select(".nv-x.nv-axis")).call(n),r.scale(m).ticks(A/36).tickSize(-C,0),d3.transition(H.select(".nv-y.nv-axis")).call(r),H.select(".nv-background rect").on("click",function(){E.x=d3.mouse(this)[0],E.i=Math.round(w.invert(E.x)),I()}),t.dispatch.on("elementClick",function(e){E.i=e.pointIndex,E.x=w(E.i),I()}),s.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,p=!t.disabled,e.call(k)}),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1),e}),e.call(k)}),b.on("tooltipShow",function(e){c&&S(e,N.parentNode)})}),k}function L(e,n){return n.map(function(n,r){var i=t.y()(n.values[e],e);return n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-i)/(1+i)},e}),n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:30,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!0,d=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},v,m,g=t.id(),y="No Data Available.",b=d3.dispatch("tooltipShow","tooltipHide");n.orient("bottom").tickPadding(7),r.orient("left");var w=d3.scale.linear(),E={i:0,x:0},S=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=d(i.series.key,a,f,i,k);e.tooltip.show([o,u],l,null,null,s)},x=d3.behavior.drag().on("dragstart",T).on("drag",N).on("dragend",C);return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],b.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){b.tooltipHide(e)}),b.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),k.dispatch=b,k.lines=t,k.legend=i,k.xAxis=n,k.yAxis=r,d3.rebind(k,t,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),k.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,k):o},k.width=function(e){return arguments.length?(a=e,k):a},k.height=function(e){return arguments.length?(f=e,k):f},k.color=function(t){return arguments.length?(u=e.utils.getColor(t),i.color(u),k):u},k.showControls=function(e){return arguments.length?(h=e,k):h},k.showLegend=function(e){return arguments.length?(l=e,k):l},k.tooltips=function(e){return arguments.length?(c=e,k):c},k.tooltipContent=function(e){return arguments.length?(d=e,k):d},k.noData=function(e){return arguments.length?(y=e,k):y},k},e.models.discreteBar=function(){function b(e){return e.each(function(e){var i=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var E=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(E).map(function(e){return e.x})).rangeBands([0,i],.1),o.domain(d||d3.extent(d3.merge(E).map(function(e){return e.y}).concat(f))),c?o.range([b-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range([b,0]),g=g||s,y=y||o.copy().range([o(0),o(0)]);var S=w.selectAll("g.nv-wrap.nv-discretebar").data([e]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),N=T.append("g"),C=S.select("g");N.append("g").attr("class","nv-groups"),S.attr("transform","translate("+t.left+","+t.top+")");var k=S.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});k.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(k.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),k.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),d3.transition(k).style("stroke-opacity",1).style("fill-opacity",.75);var L=k.selectAll("g.nv-bar").data(function(e){return e.values});L.exit().remove();var A=L.enter().append("g").attr("transform",function(e,t,n){return"translate("+s(u(e,t))+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),v.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),v.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){v.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){v.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()});A.append("rect").attr("height",0).attr("width",s.rangeBand()/e.length),c?(A.append("text").attr("text-anchor","middle"),L.select("text").attr("x",s.rangeBand()/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4}).text(function(e,t){return h(a(e,t))})):L.selectAll("text").remove(),L.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",m).attr("width",s.rangeBand()/e.length),d3.transition(L).attr("transform",function(e,t){var n=s(u(e,t)),r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0))||1)}),g=s.copy(),y=o.copy()}),b}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=d3.format(",.2f"),p,d,v=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),m="discreteBar",g,y;return b.dispatch=v,b.x=function(e){return arguments.length?(u=e,b):u},b.y=function(e){return arguments.length?(a=e,b):a},b.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,b):t},b.width=function(e){return arguments.length?(n=e,b):n},b.height=function(e){return arguments.length?(r=e,b):r},b.xScale=function(e){return arguments.length?(s=e,b):s},b.yScale=function(e){return arguments.length?(o=e,b):o},b.xDomain=function(e){return arguments.length?(p=e,b):p},b.yDomain=function(e){return arguments.length?(d=e,b):d},b.forceY=function(e){return arguments.length?(f=e,b):f},b.color=function(t){return arguments.length?(l=e.utils.getColor(t),b):l},b.id=function(e){return arguments.length?(i=e,b):i},b.showValues=function(e){return arguments.length?(c=e,b):c},b.valueFormat=function(e){return arguments.length?(h=e,b):h},b.rectClass=function(e){return arguments.length?(m=e,b):m},b},e.models.discreteBarChart=function(){function m(e){return e.each(function(u){var l=d3.select(this),g=this,b=(s||parseInt(l.style("width"))||960)-i.left-i.right,w=(o||parseInt(l.style("height"))||400)-i.top-i.bottom;m.update=function(){e.transition().call(m)},m.container=this;if(!u||!u.length||!u.filter(function(e){return e.values.length}).length){var E=l.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+b/2).attr("y",i.top+w/2).text(function(e){return e}),m}l.selectAll(".nv-noData").remove(),c=t.xScale(),h=t.yScale();var S=l.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([u]),T=S.enter().append -("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),N=T.append("defs"),C=S.select("g");T.append("g").attr("class","nv-x nv-axis"),T.append("g").attr("class","nv-y nv-axis"),T.append("g").attr("class","nv-barsWrap"),C.attr("transform","translate("+i.left+","+i.top+")"),t.width(b).height(w);var k=C.select(".nv-barsWrap").datum(u.filter(function(e){return!e.disabled}));d3.transition(k).call(t),N.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect"),C.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",c.rangeBand()*(a?2:1)).attr("height",16).attr("x",-c.rangeBand()/(a?1:2)),n.scale(c).ticks(b/100).tickSize(-w,0),C.select(".nv-x.nv-axis").attr("transform","translate(0,"+(h.range()[0]+(t.showValues()&&h.domain()[0]<0?16:0))+")"),C.select(".nv-x.nv-axis").transition().duration(0).call(n);var L=C.select(".nv-x.nv-axis").selectAll("g");a&&L.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"0":"12")+")"}),r.scale(h).ticks(w/36).tickSize(-b,0),d3.transition(C.select(".nv-y.nv-axis")).call(r),d.on("tooltipShow",function(e){f&&v(e,g.parentNode)})}),m}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis(),i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=!1,f=!0,l=function(e,t,n,r,i){return"

"+t+"

"+"

"+n+"

"},c,h,p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");n.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("left").tickFormat(d3.format(",.1f"));var v=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=l(i.series.key,a,f,i,m);e.tooltip.show([o,u],c,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top],d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){f&&e.tooltip.cleanup()}),m.dispatch=d,m.discretebar=t,m.xAxis=n,m.yAxis=r,d3.rebind(m,t,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.width=function(e){return arguments.length?(s=e,m):s},m.height=function(e){return arguments.length?(o=e,m):o},m.color=function(n){return arguments.length?(u=e.utils.getColor(n),t.color(u),m):u},m.staggerLabels=function(e){return arguments.length?(a=e,m):a},m.tooltips=function(e){return arguments.length?(f=e,m):f},m.tooltipContent=function(e){return arguments.length?(l=e,m):l},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.distribution=function(){function l(e){return e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]),p=h.enter().append("g").attr("class","nvd3 nv-distribution"),d=p.append("g"),v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g"),m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))}),d3.transition(m.exit().selectAll("line.nv-dist"+i)).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove(),g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r),d3.transition(g).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}),f=u.copy()}),l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a,f;return l.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,l):t},l.width=function(e){return arguments.length?(n=e,l):n},l.axis=function(e){return arguments.length?(i=e,l):i},l.size=function(e){return arguments.length?(r=e,l):r},l.getData=function(e){return arguments.length?(s=d3.functor(e),l):s},l.scale=function(e){return arguments.length?(u=e,l):u},l.color=function(t){return arguments.length?(o=e.utils.getColor(t),l):o},l},e.models.indentedTree=function(){function d(e){return e.each(function(t){function N(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n)return d3.event.shiftKey=!1,e.values&&e.values.forEach(function(e){(e.values||e._values)&&N(e,0,!0)}),!0;if(!L(e))return!0;e.values?(e._values=e.values,e.values=null):(e.values=e._values,e._values=null),d.update()}function C(e){return e._values&&e._values.length?c:e.values&&e.values.length?h:""}function k(e){return e._values&&e._values.length}function L(e){var t=e.values||e._values;return t&&t.length}var n=0,i=1,s=d3.layout.tree().children(function(e){return e.values}).size([r,a]);d.update=function(){e.transition().call(d)},d.container=this,t[0]||(t[0]={key:u});var v=s.nodes(t[0]),m=d3.select(this).selectAll("div").data([[v]]),g=m.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),y=g.append("table"),b=m.select("table").attr("width","100%").attr("class",l);if(o){var w=y.append("thead"),E=w.append("tr");f.forEach(function(e){E.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var S=b.selectAll("tbody").data(function(e){return e});S.enter().append("tbody"),i=d3.max(v,function(e){return e.depth}),s.size([r,i*a]);var x=S.selectAll("tr").data(function(e){return e},function(e){return e.id||e.id==++n});x.exit().remove(),x.select("img.nv-treeicon").attr("src",C).classed("folded",k);var T=x.enter().append("tr");f.forEach(function(e,t){var n=T.append("td").style("padding-left",function(e){return(t?0:e.depth*a+12+(C(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");t==0&&n.append("img").classed("nv-treeicon",!0).classed("nv-folded",k).attr("src",C).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return C(e)?"inline-block":"none"}).on("click",N),n.append("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"}),e.showCount&&n.append("span").attr("class","nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.length||e._values&&e._values.length)+")":""}),e.click&&n.select("span").on("click",e.click)}),x.order().on("click",function(e){p.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){p.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){p.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){p.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})}),d}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=!0,u="No Data Available.",a=20,f=[{key:"key",label:"Name",type:"text"}],l=null,c="images/grey-plus.png",h="images/grey-minus.png",p=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");return d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.height=function(e){return arguments.length?(r=e,d):r},d.color=function(t){return arguments.length?(i=e.utils.getColor(t),scatter.color(i),d):i},d.id=function(e){return arguments.length?(s=e,d):s},d.header=function(e){return arguments.length?(o=e,d):o},d.noData=function(e){return arguments.length?(u=e,d):u},d.columns=function(e){return arguments.length?(f=e,d):f},d.tableClass=function(e){return arguments.length?(l=e,d):l},d.iconOpen=function(e){return arguments.length?(c=e,d):c},d.iconClose=function(e){return arguments.length?(h=e,d):h},d},e.models.legend=function(){function a(e){return e.each(function(e){var a=n-t.left-t.right,f=d3.select(this),l=f.selectAll("g.nv-legend").data([e]),c=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),h=l.select("g");l.attr("transform","translate("+t.left+","+t.top+")");var p=h.selectAll(".nv-series").data(function(e){return e}),d=p.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){u.legendMouseover(e,t)}).on("mouseout",function(e,t){u.legendMouseout(e,t)}).on("click",function(e,t){u.legendClick(e,t)}).on("dblclick",function(e,t){u.legendDblclick(e,t)});d.append("circle").style("stroke-width",2).attr("r",5),d.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),p.classed("disabled",function(e){return e.disabled}),p.exit().remove(),p.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)}),p.select("text").text(i);if(o){var v=[];p.each(function(e,t){v.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var m=0,g=0,y=[];while(ga&&m>1){y=[],m--;for(k=0;k(y[k%m]||0)&&(y[k%m]=v[k]);g=y.reduce(function(e,t,n,r){return e+t})}var b=[];for(var w=0,E=0;wT&&(T=x),"translate("+N+","+S+")"}),h.attr("transform","translate("+(n-t.right-T)+","+t.top+")"),r=t.top+t.bottom+S+15}}),a}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=!0,u=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");return a.dispatch=u,a.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,a):t},a.width=function(e){return arguments.length?(n=e,a):n},a.height=function(e){return arguments.length?(r=e,a):r},a.key=function(e){return arguments.length?(i=e,a):i},a.color=function(t){return arguments.length?(s=e.utils.getColor(t),a):s},a.align=function(e){return arguments.length?(o=e,a):o},a},e.models.line=function(){function m(e){return e.each(function(e){var m=r-n.left-n.right,g=i-n.top-n.bottom,b=d3.select(this);c=t.xScale(),h=t.yScale(),d=d||c,v=v||h;var w=b.selectAll("g.nv-wrap.nv-line").data([e]),E=w.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),S=E.append("defs"),T=E.append("g"),N=w.select("g");T.append("g").attr("class","nv-groups"),T.append("g").attr("class","nv-scatterWrap"),w.attr("transform","translate("+n.left+","+n.top+")"),t.width(m).height(g);var C=w.select(".nv-scatterWrap");d3.transition(C).call(t),S.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect"),w.select("#nv-edge-clip-"+t.id()+" rect").attr("width",m).attr("height",g),N.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":""),C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var k=w.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});k.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(k.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),k.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)}),d3.transition(k).style("stroke-opacity",1).style("fill-opacity",.5);var L=k.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});L.enter().append("path").attr("class","nv-area").attr("d",function(e){return d3.svg.area().interpolate(p).defined(a).x(function(e,t){return d(o(e,t))}).y0(function(e,t){return v(u(e,t))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[e.values])}),d3.transition(k.exit().selectAll("path.nv-area")).attr("d",function(e){return d3.svg.area().interpolate(p).defined(a).x(function(e,t){return d(o(e,t))}).y0(function(e,t){return v(u(e,t))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[e.values])}),d3.transition(L).attr("d",function(e){return d3.svg.area().interpolate(p).defined(a).x(function(e,t){return d(o(e,t))}).y0(function(e,t){return v(u(e,t))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[e.values])});var A=k.selectAll("path.nv-line").data(function(e){return[e.values]});A.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(e,t){return d(o(e,t))}).y(function(e,t){return v(u(e,t))})),d3.transition(k.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(p).defined(a).x(function(e,t){return c(o(e,t))}).y(function(e,t){return h(u(e,t))})),d3.transition(A).attr("d",d3.svg.line().interpolate(p).defined(a).x(function(e,t){return c(o(e,t))}).y(function(e,t){return h(u(e,t))})),d=c.copy(),v=h.copy()}),m}var t=e.models.scatter(),n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=!1,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;return m.dispatch=t.dispatch,m.scatter=t,d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.height=function(e){return arguments.length?(i=e,m):i},m.x=function(e){return arguments.length?(o=e,t.x(e),m):o},m.y=function(e){return arguments.length?(u=e,t.y(e),m):u},m.clipEdge=function(e){return arguments.length?(l=e,m):l},m.color=function(n){return arguments.length?(s=e.utils.getColor(n),t.color(s),m):s},m.interpolate=function(e){return arguments.length?(p=e,m):p},m.defined=function(e){return arguments.length?(a=e,m):a},m.isArea=function(e){return arguments.length?(f=d3.functor(e),m):f},m},e.models.lineChart=function(){function g(e){return e.each(function(c){var b=d3.select(this),w=this,E=(u||parseInt(b.style("width"))||960)-s.left-s.right,S=(a||parseInt(b.style("height"))||400)-s.top-s.bottom;g.update=function(){g(e)},g.container=this;if(!c||!c.length||!c.filter(function(e){return e.values.length}).length){var T=b.selectAll(".nv-noData").data([d]);return T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),T.attr("x",s.left+E/2).attr("y",s.top+S/2).text(function(e){return e}),g}b.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale();var N=b.selectAll("g.nv-wrap.nv-lineChart").data([c]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),k=N.select("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-linesWrap"),C.append("g").attr("class","nv-legendWrap"),f&&(i.width(E),k.select(".nv-legendWrap").datum(c).call(i),s.top!=i.height()&&(s.top=i.height(),S=(a||parseInt(b.style("height"))||400)-s.top-s.bottom),N.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")),N.attr("transform","translate("+s.left+","+s.top+")"),t.width(E).height(S).color(c.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!c[t].disabled}));var L=k.select(".nv-linesWrap").datum(c.filter(function(e){return!e.disabled}));d3.transition(L).call(t),n.scale(h).ticks(E/100).tickSize(-S,0),k.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")"),d3.transition(k.select(".nv-x.nv-axis")).call(n),r.scale(p).ticks(S/36).tickSize(-E,0),d3.transition(k.select(".nv-y.nv-axis")).call(r),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,c.filter(function(e){return!e.disabled}).length||c.map(function(e){return e.disabled=!1,N.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(g)}),v.on("tooltipShow",function(e){l&&m(e,w.parentNode)})}),g}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s={top:30,right:20,bottom:50,left:60},o=e.utils.defaultColor(),u=null,a=null,f=!0,l=!0,c=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},h,p,d="No Data Available.",v=d3.dispatch("tooltipShow","tooltipHide");n.orient("bottom").tickPadding(7),r.orient("left");var m=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.attr("viewBox");if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),h=n.tickFormat()(t.x()(i.point,i.pointIndex)),p=r.tickFormat()(t.y()(i.point,i.pointIndex)),d=c(i.series.key,h,p,i,g);e.tooltip.show([f,l],d,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],v.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){v.tooltipHide(e)}),v.on("tooltipHide",function(){l&&e.tooltip.cleanup()}),g.dispatch=v,g.lines=t,g.legend=i,g.xAxis=n,g.yAxis=r,d3.rebind(g,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),g.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,g):s},g.width=function(e){return arguments.length?(u=e,g):u},g.height=function(e){return arguments.length?(a=e,g):a},g.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),g):o},g.showLegend=function(e){return arguments.length?(f=e,g):f},g.tooltips=function(e){return arguments.length?(l=e,g):l},g.tooltipContent=function(e){return arguments.length?(c=e,g):c},g.noData=function(e){return arguments.length?(d=e,g):d},g},e.models.linePlusBarChart=function(){function S(e){return e.each(function(v){var T=d3.select(this),N=this,C=(a||parseInt(T.style("width"))||960)-u.left-u.right,k=(f||parseInt(T.style("height"))||400)-u.top-u.bottom;S.update=function(){S(e)},S.container=this;if(!v||!v.length||!v.filter(function(e){return e.values.length}).length){var L=T.selectAll(".nv-noData").data([b]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",u.left+C/2).attr("y",u.top+k/2).text(function(e){return e}),S}T.selectAll(".nv-noData").remove(),m=r.scale(),g=n.yScale(),y=t.yScale();var A=v.filter(function(e){return!e.disabled&&e.bar}),O=v.filter(function(e){return!e.bar}),M=v.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:l(e,t),y:c(e,t)}})}),_=v.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:l(e,t),y:c(e,t)}})});m.domain(d3.extent(d3.merge(M.concat(_)),function(e){return e.x})).range([0,C]);var D=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([v]),P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),H=D.select("g");P.append("g").attr("class","nv-x nv-axis"),P.append("g").attr("class","nv-y1 nv-axis"),P.append("g").attr("class","nv-y2 nv-axis"),P.append("g").attr("class","nv-barsWrap"),P.append("g").attr("class","nv-linesWrap"),P.append("g").attr("class","nv-legendWrap"),p&&(o.width(C/2),H.select(".nv-legendWrap").datum(v.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),k=(f||parseInt(T.style("height"))||400)-u.top-u.bottom),H.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -u.top+")")),D.attr("transform","translate("+u.left+","+u.top+")"),t.width(C).height(k).color(v.map(function(e,t){return e.color||h(e,t)}).filter(function(e,t){return!v[t].disabled&&!v[t].bar})),n.width(C).height(k).color(v.map(function(e,t){return e.color||h(e,t)}).filter(function(e,t){return!v[t].disabled&&v[t].bar}));var B=H.select(".nv-barsWrap").datum(A.length?A:[{values:[]}]),j=H.select(".nv-linesWrap").datum(O[0].disabled?[{values:[]}]:O);d3.transition(B).call(n),d3.transition(j).call(t),r.ticks(C/100).tickSize(-k,0),H.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(H.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(k/36).tickSize(-C,0),d3.transition(H.select(".nv-y1.nv-axis")).style("opacity",A.length?1:0).call(i),s.scale(y).ticks(k/36).tickSize(A.length?0:-C,0),H.select(".nv-y2.nv-axis").style("opacity",O.length?1:0).attr("transform","translate("+m.range()[1]+",0)"),d3.transition(H.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,v.filter(function(e){return!e.disabled}).length||v.map(function(e){return e.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(S)}),w.on("tooltipShow",function(e){d&&E(e,N.parentNode)})}),S}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},m,g,y,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide");t.clipEdge(!1),r.orient("bottom").tickPadding(7),i.orient("left"),s.orient("right");var E=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,S);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],w.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),S.dispatch=w,S.legend=o,S.lines=t,S.bars=n,S.xAxis=r,S.y1Axis=i,S.y2Axis=s,d3.rebind(S,t,"defined","size","clipVoronoi","interpolate"),S.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),S):l},S.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),S):c},S.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,S):u},S.width=function(e){return arguments.length?(a=e,S):a},S.height=function(e){return arguments.length?(f=e,S):f},S.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),S):h},S.showLegend=function(e){return arguments.length?(p=e,S):p},S.tooltips=function(e){return arguments.length?(d=e,S):d},S.tooltipContent=function(e){return arguments.length?(v=e,S):v},S.noData=function(e){return arguments.length?(b=e,S):b},S},e.models.lineWithFocusChart=function(){function C(e){return e.each(function(S){function R(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent(),extent=a.empty()?g.domain():a.extent(),T.brush({extent:extent,brush:a}),U();var e=H.select(".nv-focus .nv-linesWrap").datum(S.filter(function(e){return!e.disabled}).map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=extent[0]&&t.x()(e,n)<=extent[1]})}}));d3.transition(e).call(t),d3.transition(H.select(".nv-focus .nv-x.nv-axis")).call(r),d3.transition(H.select(".nv-focus .nv-y.nv-axis")).call(i)}var k=d3.select(this),L=this,A=(h||parseInt(k.style("width"))||960)-f.left-f.right,O=(p||parseInt(k.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;C.update=function(){C(e)},C.container=this;if(!S||!S.length||!S.filter(function(e){return e.values.length}).length){var _=k.selectAll(".nv-noData").data([x]);return _.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e}),C}k.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var D=k.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([S]),P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");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"),j.append("g").attr("class","nv-brushBackground"),j.append("g").attr("class","nv-x nv-brush"),b&&(u.width(A),H.select(".nv-legendWrap").datum(S).call(u),f.top!=u.height()&&(f.top=u.height(),O=(p||parseInt(k.style("height"))||400)-f.top-f.bottom-d),H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),D.attr("transform","translate("+f.left+","+f.top+")"),t.width(A).height(O).color(S.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!S[t].disabled})),n.defined(t.defined()).width(A).height(M).color(S.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!S[t].disabled})),H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(S.filter(function(e){return!e.disabled}));d3.transition(F).call(n),r.scale(v).ticks(A/100).tickSize(-O,0),i.scale(m).ticks(O/36).tickSize(-A,0),H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")"),a.x(g).on("brush",z),w&&a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M),q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M),gBrush=H.select(".nv-x.nv-brush").call(a),gBrush.selectAll("rect").attr("height",M),gBrush.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(A/100).tickSize(-M,0),H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(M/36).tickSize(-A,0),d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o),H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,S.filter(function(e){return!e.disabled}).length||S.map(function(e){return e.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(C)}),T.on("tooltipShow",function(e){E&&N(e,L.parentNode)})}),C}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush");t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var N=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,C);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),C.dispatch=T,C.legend=u,C.lines=t,C.lines2=n,C.xAxis=r,C.yAxis=i,C.x2Axis=s,C.y2Axis=o,d3.rebind(C,t,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),C.x=function(e){return arguments.length?(t.x(e),n.x(e),C):t.x},C.y=function(e){return arguments.length?(t.y(e),n.y(e),C):t.y},C.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,C):f},C.margin2=function(e){return arguments.length?(l=e,C):l},C.width=function(e){return arguments.length?(h=e,C):h},C.height=function(e){return arguments.length?(p=e,C):p},C.height2=function(e){return arguments.length?(d=e,C):d},C.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),C):c},C.showLegend=function(e){return arguments.length?(b=e,C):b},C.tooltips=function(e){return arguments.length?(E=e,C):E},C.tooltipContent=function(e){return arguments.length?(S=e,C):S},C.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),C):t.interpolate()},C.noData=function(e){return arguments.length?(x=e,C):x},C.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),C):r.tickFormat()},C.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),C):i.tickFormat()},C},e.models.multiBar=function(){function b(e){return e.each(function(e){var b=n-t.left-t.right,w=r-t.top-t.bottom,E=d3.select(this);c&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var S=d&&v?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});i.domain(d3.merge(S).map(function(e){return e.x})).rangeBands([0,b],.1),s.domain(v||d3.extent(d3.merge(S).map(function(e){return e.y+(c?e.y0:0)}).concat(f))).range([w,0]);if(i.domain()[0]===i.domain()[1]||s.domain()[0]===s.domain()[1])singlePoint=!0;i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.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])),g=g||i,y=y||s;var T=E.selectAll("g.nv-wrap.nv-multibar").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-groups"),T.attr("transform","translate("+t.left+","+t.top+")"),C.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),T.select("#nv-edge-clip-"+o+" rect").attr("width",b).attr("height",w),L.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var A=T.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(A.exit()).selectAll("rect.nv-bar" -).delay(function(t,n){return n*p/e[0].values.length}).attr("y",function(e){return c?y(e.y0):y(0)}).attr("height",0).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return h(e,t)}).style("stroke",function(e,t){return h(e,t)}),d3.transition(A).style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("rect.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return y(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length));O.style("fill",function(e,t,n){return h(e,n,t)}).style("stroke",function(e,t,n){return h(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),m.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),m.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){m.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){m.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),c?d3.transition(O).delay(function(t,n){return n*p/e[0].values.length}).attr("y",function(e,t){return s(a(e,t)+(c?e.y0:0))}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length))}):d3.transition(O).delay(function(t,n){return n*p/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)})}),g=i.copy(),y=s.copy()}),b}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h=e.utils.defaultColor(),p=1200,d,v,m=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),g,y;return b.dispatch=m,b.x=function(e){return arguments.length?(u=e,b):u},b.y=function(e){return arguments.length?(a=e,b):a},b.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,b):t},b.width=function(e){return arguments.length?(n=e,b):n},b.height=function(e){return arguments.length?(r=e,b):r},b.xScale=function(e){return arguments.length?(i=e,b):i},b.yScale=function(e){return arguments.length?(s=e,b):s},b.xDomain=function(e){return arguments.length?(d=e,b):d},b.yDomain=function(e){return arguments.length?(v=e,b):v},b.forceY=function(e){return arguments.length?(f=e,b):f},b.stacked=function(e){return arguments.length?(c=e,b):c},b.clipEdge=function(e){return arguments.length?(l=e,b):l},b.color=function(t){return arguments.length?(h=e.utils.getColor(t),b):h},b.id=function(e){return arguments.length?(o=e,b):o},b.delay=function(e){return arguments.length?(p=e,b):p},b},e.models.multiBarChart=function(){function E(e){return e.each(function(v){var S=d3.select(this),T=this,N=(u||parseInt(S.style("width"))||960)-o.left-o.right,C=(a||parseInt(S.style("height"))||400)-o.top-o.bottom;E.update=function(){e.transition().call(E)},E.container=this;if(!v||!v.length||!v.filter(function(e){return e.values.length}).length){var k=S.selectAll(".nv-noData").data([y]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",o.left+N/2).attr("y",o.top+C/2).text(function(e){return e}),E}S.selectAll(".nv-noData").remove(),m=t.xScale(),g=t.yScale();var L=S.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([v]),A=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),O=L.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-barsWrap"),A.append("g").attr("class","nv-legendWrap"),A.append("g").attr("class","nv-controlsWrap"),c&&(i.width(N/2),O.select(".nv-legendWrap").datum(v).call(i),o.top!=i.height()&&(o.top=i.height(),C=(a||parseInt(S.style("height"))||400)-o.top-o.bottom),O.select(".nv-legendWrap").attr("transform","translate("+N/2+","+ -o.top+")"));if(l){var M=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(180).color(["#444","#444","#444"]),O.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+ -o.top+")").call(s)}L.attr("transform","translate("+o.left+","+o.top+")"),t.width(N).height(C).color(v.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!v[t].disabled}));var _=O.select(".nv-barsWrap").datum(v.filter(function(e){return!e.disabled}));d3.transition(_).call(t),n.scale(m).ticks(N/100).tickSize(-C,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(O.select(".nv-x.nv-axis")).call(n);var D=O.select(".nv-x.nv-axis > g").selectAll("g");D.selectAll("line, text").style("opacity",1),h&&D.filter(function(e,t){return t%Math.ceil(v[0].values.length/(N/100))!==0}).selectAll("text, line").style("opacity",0),p&&D.selectAll("text").attr("transform",function(e,t,n){return"rotate("+p+" 0,0)"}).attr("text-transform",p>0?"start":"end"),O.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),r.scale(g).ticks(C/36).tickSize(-N,0),d3.transition(O.select(".nv-y.nv-axis")).call(r),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,v.filter(function(e){return!e.disabled}).length||v.map(function(e){return e.disabled=!1,L.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(E)}),s.dispatch.on("legendClick",function(n,r){if(!n.disabled)return;M=M.map(function(e){return e.disabled=!0,e}),n.disabled=!1;switch(n.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}e.transition().call(E)}),b.on("tooltipShow",function(e){d&&w(e,T.parentNode)})}),E}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:30,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=0,d=!0,v=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" on "+t+"

"},m,g,y="No Data Available.",b=d3.dispatch("tooltipShow","tooltipHide");t.stacked(!1),n.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("left").tickFormat(d3.format(",.1f"));var w=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=v(i.series.key,a,f,i,E);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],b.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){b.tooltipHide(e)}),b.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),E.dispatch=b,E.multibar=t,E.legend=i,E.xAxis=n,E.yAxis=r,d3.rebind(E,t,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),E.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,E):o},E.width=function(e){return arguments.length?(u=e,E):u},E.height=function(e){return arguments.length?(a=e,E):a},E.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),E):f},E.showControls=function(e){return arguments.length?(l=e,E):l},E.showLegend=function(e){return arguments.length?(c=e,E):c},E.reduceXTicks=function(e){return arguments.length?(h=e,E):h},E.rotateLabels=function(e){return arguments.length?(p=e,E):p},E.tooltip=function(e){return arguments.length?(v=e,E):v},E.tooltips=function(e){return arguments.length?(d=e,E):d},E.tooltipContent=function(e){return arguments.length?(v=e,E):v},E.noData=function(e){return arguments.length?(y=e,E):y},E},e.models.multiBarHorizontal=function(){function E(e){return e.each(function(e){var i=n-t.left-t.right,v=r-t.top-t.bottom,E=d3.select(this);c&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var S=m&&g?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(m||d3.merge(S).map(function(e){return e.x})).rangeBands([0,v],.1),o.domain(g||d3.extent(d3.merge(S).map(function(e){return e.y+(c?e.y0:0)}).concat(f))),h&&!c?o.range([o.domain()[0]<0?p:0,i-(o.domain()[1]>0?p:0)]):o.range([0,i]),b=b||s,w=w||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var T=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-groups"),T.attr("transform","translate("+t.left+","+t.top+")");var A=T.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(A.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)}),d3.transition(A).style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(t,n,r){return"translate("+w(c?t.y0:0)+","+(c?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});M.append("rect").attr("width",0).attr("height",s.rangeBand()/(c?1:e.length)),O.on("mouseover",function(t,n){d3.select(this).classed("hover",!0),y.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(c?t.y0:0)),s(u(t,n))+s.rangeBand()*(c?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),y.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){y.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(c?e.length/2:t.series+.5)/e.length,o(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){y.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(c?e.length/2:t.series+.5)/e.length,o(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),h&&!c?(M.append("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}),O.select("text").attr("y",s.rangeBand()/2).attr("dy","-.32em").text(function(e,t){return d(a(e,t))}),d3.transition(O).select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})):O.selectAll("text").remove(),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}),c?d3.transition(O).attr("transform",function(e,t){return"translate("+o(e.y0)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand()):d3.transition(O).attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)}),b=s.copy(),w=o.copy()}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=!1,p=60,d=d3.format(",.2f"),v=1200,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b,w;return E.dispatch=y,E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(m=e,E):m},E.yDomain=function(e){return arguments.length?(g=e,E):g},E.forceY=function(e){return arguments.length?(f=e,E):f},E.stacked=function(e){return arguments.length?(c=e,E):c},E.color=function(t){return arguments.length?(l=e.utils.getColor(t),E):l},E.id=function(e){return arguments.length?(i=e,E):i},E.delay=function(e){return arguments.length?(v=e,E):v},E.showValues=function(e){return arguments.length?(h=e,E):h},E.valueFormat=function(e){return arguments.length?(d=e,E):d},E.valuePadding=function(e){return arguments.length?(p=e,E):p},E},e.models.multiBarHorizontalChart=function(){function w(e){return e.each(function(h){var d=d3.select(this),E=this,S=(u||parseInt(d.style("width"))||960)-o.left-o.right,T=(a||parseInt(d.style("height"))||400)-o.top-o.bottom;w.update=function(){e.transition().call(w)},w.container=this;if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var N=d.selectAll(".nv-noData").data([g]);return N.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),N.attr("x",o.left+S/2).attr("y",o.top+T/2).text(function(e){return e}),w}d.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();var C=d.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]),k=C.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),L=C.select("g");k.append("g").attr("class","nv-x nv-axis"),k.append("g").attr("class","nv-y nv-axis"),k.append("g").attr("class","nv-barsWrap"),k.append("g").attr("class","nv-legendWrap"),k.append("g").attr("class","nv-controlsWrap"),c&&(i.width(S/2),L.select(".nv-legendWrap").datum(h).call(i),o.top!=i.height()&&(o.top=i.height(),T=(a||parseInt(d.style("height"))||400)-o.top-o.bottom),L.select(".nv-legendWrap").attr("transform","translate("+S/2+","+ -o.top+")"));if(l){var A=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(180).color(["#444","#444","#444"]),L.select(".nv-controlsWrap").datum(A).attr("transform","translate(0,"+ -o.top+")").call(s)}C.attr("transform","translate("+o.left+","+o.top+")"),t.width(S).height(T).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var O=L.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));d3.transition(O).call(t),n.scale(v).ticks(T/24).tickSize(-S,0),d3.transition(L.select(".nv-x.nv-axis")).call(n);var M=L.select(".nv-x.nv-axis").selectAll("g");M.selectAll("line, text").style("opacity",1),r.scale(m).ticks(S/100).tickSize(-T,0),L.select(".nv-y.nv-axis").attr("transform","translate(0,"+T+")"),d3.transition(L.select(".nv-y.nv-axis")).call(r),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,h.filter(function(e){return!e.disabled}).length||h.map(function(e){return e.disabled=!1,C.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(w)}),s.dispatch.on("legendClick",function(n,r){if(!n.disabled)return;A=A.map(function(e){return e.disabled=!0,e}),n.disabled=!1;switch(n.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}e.transition().call(w)}),y.on("tooltipShow",function(e){p&&b(e,E.parentNode)})}),w}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!1,p=!0,d=function(e,t,n,r,i){return"

"+e+" - "+t+"

"+"

"+n+"

"},v,m,g="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide");t.stacked(h),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=d(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],y.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){y.tooltipHide(e)}),y.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),w.dispatch=y,w.multibar=t,w.legend=i,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),w.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,w):o},w.width=function(e){return arguments.length?(u=e,w):u},w.height=function(e){return arguments.length?(a=e,w):a},w.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),w):f},w.showControls=function(e){return arguments.length?(l=e,w):l},w.showLegend=function(e){return arguments.length?(c=e,w):c},w.tooltip=function(e){return arguments.length?(d=e,w):d},w.tooltips=function(e){return arguments.length?(p=e,w):p},w.tooltipContent=function(e){return arguments.length?(d=e,w):d},w.noData=function(e){return arguments.length?(g=e,w):g},w},e.models.multiChart=function(){function T(e){return e.each(function(u){var f=d3.select(this),N=this,C=(r||parseInt(f.style("width"))||960)-t.left-t.right,k=(i||parseInt(f.style("height"))||400)-t.top-t.bottom,L=u.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),A=u.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),O=u.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),M=u.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),_=u.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),D=u.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),P=u.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),H=u.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(P.concat(H)),function(e){return e.x})).range([0,C]);var B=f.selectAll("g.wrap.multiChart").data([u]),j=B.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");j.append("g").attr("class","x axis"),j.append("g").attr("class","y1 axis"),j.append("g").attr("class","y2 axis"),j.append("g").attr("class","lines1Wrap"),j.append("g").attr("class","lines2Wrap"),j.append("g").attr("class","bars1Wrap"),j.append("g").attr("class","bars2Wrap"),j.append("g").attr("class","stack1Wrap"),j.append("g").attr("class","stack2Wrap"),j.append("g").attr("class","legendWrap");var F=B.select("g");s&&(E.width(C/2),F.select(".legendWrap").datum(u.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(E),t.top!=E.height()&&(t.top=E.height(),k=(i||parseInt(f.style("height"))||400)-t.top-t.bottom),F.select(".legendWrap").attr("transform","translate("+C/2+","+ -t.top+")")),h.width(C).height(k).interpolate("monotone").color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="line"})),p.width(C).height(k).interpolate("monotone").color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="line"})),d.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="bar"})),v.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="bar"})),m.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="area"})),g.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="area"})),F.attr("transform","translate("+t.left+","+t.top+")");var I=F.select(".lines1Wrap").datum(L),q=F.select(".bars1Wrap").datum(O),R=F.select(".stack1Wrap").datum(_),U=F.select(".lines2Wrap").datum(A),z=F.select(".bars2Wrap").datum(M),W=F.select(".stack2Wrap").datum(D),X=_.length?_.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];l.domain(d3.extent(d3.merge(P).concat(X),function(e){return e.y})).range([0,k]),c.domain(d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,k]),h.yDomain(l.domain()),d.yDomain(l.domain()),m.yDomain(l.domain()),p.yDomain(c.domain()),v.yDomain(c.domain()),g.yDomain(c.domain()),_.length&&d3.transition(R).call(m),D.length&&d3.transition(W).call(g),O.length&&d3.transition(q).call(d),M.length&&d3.transition(z).call(v),L.length&&d3.transition(I).call(h),A.length&&d3.transition(U).call(p),y.ticks(C/100).tickSize(-k,0),F.select(".x.axis").attr("transform","translate(0,"+k+")"),d3.transition(F.select(".x.axis")).call(y),b.ticks(k/36).tickSize(-C,0),d3.transition(F.select(".y1.axis")).call(b),w.ticks(k/36).tickSize(-C,0),d3.transition(F.select(".y2.axis")).call(w),F.select(".y2.axis").style("opacity",H.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),E.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,u.filter(function(e){return!e.disabled}).length||u.map(function(e){return e.disabled=!1,B.selectAll(".series").classed("disabled",!1),e}),e.transition().call(T)}),S.on("tooltipShow",function(e){o&&x(e,N.parentNode)})}),T.update=function(){T(e)},T.container=this,T}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},a,f,a=d3.scale.linear(),l=d3.scale.linear(),c=d3.scale.linear(),h=e.models.line().yScale(l),p=e.models.line().yScale(c),d=e.models.multiBar().stacked(!1).yScale(l),v=e.models.multiBar().stacked(!1).yScale(c),m=e.models.stackedArea().yScale(l),g=e.models.stackedArea().yScale(c),y=e.models.axis().scale(a).orient("bottom").tickPadding(5),b=e.models.axis().scale(l).orient("left"),w=e.models.axis().scale(c).orient("right"),E=e.models.legend().height(30),S=d3.dispatch("tooltipShow","tooltipHide"),x=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=y.tickFormat()(h.x()(t.point,t.pointIndex)),o=(t.series.bar?b:w).tickFormat()(h.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,T);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return h.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),h.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),p.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),p.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),m.dispatch.on("tooltipShow",function(e){if(!Math.round(m.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),m.dispatch.on("tooltipHide",function(e){S.tooltipHide(e)}),g.dispatch.on("tooltipShow",function(e){if(!Math.round(g.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),g.dispatch.on("tooltipHide",function(e){S.tooltipHide(e)}),h.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),h.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),p.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),p.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),T.dispatch=S,T.lines1=h,T.lines2=p,T.bars1=d,T.bars2=v,T.stack1=m,T.stack2=g,T.xAxis=y,T.yAxis1=b,T.yAxis2=w,T.x=function(e){return arguments.length?(getX=e,h.x(e),d.x(e),T):getX},T.y=function(e){return arguments.length?(getY=e,h.y(e),d.y(e),T):getY},T.margin=function(e){return arguments.length?(t=e,T):t},T.width=function(e){return arguments.length?(r=e,T):r},T.height=function(e){return arguments.length?(i=e,T):i},T.color=function(e){return arguments.length?(n=e,E.color(e),T):n},T.showLegend=function(e){return arguments.length?(s=e,T):s},T.tooltips=function(e){return arguments.length?(o=e,T):o},T.tooltipContent=function(e){return arguments.length?(u=e,T):u},T},e.models.ohlcBar=function(){function w(e){return e.each(function(e){var m=n-t.left-t.right,w=r-t.top-t.bottom,E=d3.select(this);s.domain(g||d3.extent(e[0].values.map(u).concat(p))).range([0,m]),o.domain(y||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range([w,0]);if(s.domain()[0]===s.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;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])),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).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),N=T.append("defs"),C=T.append("g"),k=S.select("g");C.append("g").attr("class","nv-ticks"),S.attr("transform","translate("+t.left+","+t.top+")"),E.on("click",function(e,t){b.chartClick({data:e,index:t,pos:d3.event,id:i})}),N.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),S.select("#nv-chart-clip-path-"+i+" rect").attr("width",m).attr("height",w),k.attr("clip-path",v?"url(#nv-chart-clip-path-"+i+")":"");var L=S.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});L.exit().remove();var A=L.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=m/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),b.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),b.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){b.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){b.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});L.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(L).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=m/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!0,m=e.utils.defaultColor(),g,y,b=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return w.dispatch=b,w.x=function(e){return arguments.length?(u=e,w):u},w.y=function(e){return arguments.length?(a=e,w):a},w.open=function(e){return arguments.length?(f=e,w):f},w.close=function(e){return arguments.length?(l=e,w):l},w.high=function(e){return arguments.length?(c=e,w):c},w.low=function(e){return arguments.length?(h=e,w):h},w.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,w):t},w.width=function(e){return arguments.length?(n=e,w):n},w.height=function(e){return arguments.length?(r=e,w):r},w.xScale=function(e){return arguments.length?(s=e,w):s},w.yScale=function(e){return arguments.length?(o=e,w):o},w.xDomain=function(e){return arguments.length?(g=e,w):g},w.yDomain=function(e){return arguments.length?(y=e,w):y},w.forceX=function(e){return arguments.length?(p=e,w):p},w.forceY=function(e){return arguments.length?(d=e,w):d},w.clipEdge=function(e){return arguments.length?(v=e,w):v},w.color=function(t){return arguments.length?(m=e.utils.getColor(t),w):m},w.id=function(e){return arguments.length?(i=e,w):i},w},e.models.pie=function(){function v(e){return e.each(function(e){function L(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function A(e){p||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return S(t(e))}}function O(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return S(t(e))}}var f=n-t.left-t.right,v=r-t.top-t.bottom,m=Math.min(f,v)/2,g=d3.select(this),y=g.selectAll(".nv-wrap.nv-pie").data([i(e[0])]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),w=b.append("g"),E=y.select("g");w.append("g").attr("class","nv-pie"),y.attr("transform","translate("+t.left+","+t.top+")"),E.select(".nv-pie").attr("transform","translate("+f/2+","+v/2+")"),g.on("click",function(e,t){d.chartClick({data:e,index:t,pos:d3.event,id:u})});var S=d3.svg.arc().outerRadius(m-m/5);p&&S.innerRadius(m/2);var x=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:o(e)}),T=y.select(".nv-pie").selectAll(".nv-slice").data(x);T.exit().remove();var N=T.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),d.elementMouseover({label:s(e.data),value:o(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),d.elementMouseout({label:s(e.data),value:o(e.data) -,point:e.data,index:t,id:u})}).on("click",function(e,t){d.elementClick({label:s(e.data),value:o(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(e,t){d.elementDblClick({label:s(e.data),value:o(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()});T.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var C=N.append("path").each(function(e){this._current=e});d3.transition(T.select("path")).attr("d",S).attrTween("d",A);if(l){var k=S;c&&(k=d3.svg.arc().outerRadius(S.outerRadius())),N.append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){return e.outerRadius=m+10,e.innerRadius=m+15,"translate("+k.centroid(e)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor","middle").style("fill","#000")}),T.select(".nv-label").transition().attr("transform",function(e){return e.outerRadius=m+10,e.innerRadius=m+15,"translate("+k.centroid(e)+")"}),T.each(function(e,t){var n=d3.select(this);n.select(".nv-label text").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI);return e.value&&n>h?s(e.data):""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}}),v}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.values},s=function(e){return e.x},o=function(e){return e.y},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=!0,c=!1,h=.02,p=!1,d=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return v.dispatch=d,v.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,v):t},v.width=function(e){return arguments.length?(n=e,v):n},v.height=function(e){return arguments.length?(r=e,v):r},v.values=function(e){return arguments.length?(i=e,v):i},v.x=function(e){return arguments.length?(s=e,v):s},v.y=function(e){return arguments.length?(o=d3.functor(e),v):o},v.showLabels=function(e){return arguments.length?(l=e,v):l},v.donutLabelsOutside=function(e){return arguments.length?(c=e,v):c},v.donut=function(e){return arguments.length?(p=e,v):p},v.id=function(e){return arguments.length?(u=e,v):u},v.color=function(t){return arguments.length?(a=e.utils.getColor(t),v):a},v.valueFormat=function(e){return arguments.length?(f=e,v):f},v.labelThreshold=function(e){return arguments.length?(h=e,v):h},v},e.models.pieChart=function(){function p(e){return e.each(function(u){var a=d3.select(this),f=this,h=(i||parseInt(a.style("width"))||960)-r.left-r.right,d=(s||parseInt(a.style("height"))||400)-r.top-r.bottom;p.update=function(){p(e)},p.container=this;if(!u||!u.length){var v=a.selectAll(".nv-noData").data([l]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",r.left+h/2).attr("y",r.top+d/2).text(function(e){return e}),p}a.selectAll(".nv-noData").remove();var m=a.selectAll("g.nv-wrap.nv-pieChart").data([u]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),y=m.select("g");g.append("g").attr("class","nv-pieWrap"),g.append("g").attr("class","nv-legendWrap"),o&&(n.width(h).key(t.x()),m.select(".nv-legendWrap").datum(t.values()(u[0])).call(n),r.top!=n.height()&&(r.top=n.height(),d=(s||parseInt(a.style("height"))||400)-r.top-r.bottom),m.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),m.attr("transform","translate("+r.left+","+r.top+")"),t.width(h).height(d);var b=y.select(".nv-pieWrap").datum(u);d3.transition(b).call(t),n.dispatch.on("legendClick",function(n,r,i){n.disabled=!n.disabled,t.values()(u[0]).filter(function(e){return!e.disabled}).length||t.values()(u[0]).map(function(e){return e.disabled=!1,m.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(p)}),t.dispatch.on("elementMouseout.tooltip",function(e){c.tooltipHide(e)})}),p}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"

"+e+"

"+"

"+t+"

"},l="No Data Available.",c=d3.dispatch("tooltipShow","tooltipHide"),h=function(n,r){var i=n.pos[0]+(r&&r.offsetLeft||0),s=n.pos[1]+(r&&r.offsetTop||0),o=t.valueFormat()(t.y()(n.point)),u=f(t.x()(n.point),o,n,p);e.tooltip.show([i,s],u,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],c.tooltipShow(e)}),c.on("tooltipShow",function(e){a&&h(e)}),c.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),p.dispatch=c,p.pie=t,d3.rebind(p,t,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),p.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,p):r},p.width=function(e){return arguments.length?(i=e,p):i},p.height=function(e){return arguments.length?(s=e,p):s},p.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),p):u},p.showLegend=function(e){return arguments.length?(o=e,p):o},p.tooltips=function(e){return arguments.length?(a=e,p):a},p.tooltipContent=function(e){return arguments.length?(f=e,p):f},p.noData=function(e){return arguments.length?(l=e,p):l},p},e.models.scatter=function(){function D(e){return e.each(function(e){function U(){if(!m)return!1;var n,r=d3.merge(e.map(function(e,t){return e.values.map(function(e,n){return[o(f(e,n))*(Math.random()/1e12+1),u(l(e,n))*(Math.random()/1e12+1),t,n,e]}).filter(function(e,t){return g(e[4],t)})}));if(b){I.append("clipPath").attr("id","nv-points-clip-"+s);var i=j.select("#nv-points-clip-"+s).selectAll("circle").data(r);i.enter().append("circle").attr("r",w),i.exit().remove(),i.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),j.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(k===!0){r.length<3&&(r.push([o.range()[0]-20,u.range()[0]-20,null,null]),r.push([o.range()[1]+20,u.range()[1]+20,null,null]));var a=d3.geom.voronoi(r).map(function(e,t){return{data:e,series:r[t][2],point:r[t][3]}}),c=j.select(".nv-point-paths").selectAll("path").data(a);c.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),c.exit().remove(),c.attr("d",function(e){return"M"+e.data.join(",")+"Z"}),n=c}else{var h=r.map(function(e,t){return{data:e,series:r[t][2],point:r[t][3]}});n=j.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(h).style("pointer-events","auto")}n.on("click",function(n){if(_)return 0;var r=e[n.series],i=r.values[n.point];C.elementClick({point:i,series:r,pos:[o(f(i,n.point))+t.left,u(l(i,n.point))+t.top],seriesIndex:n.series,pointIndex:n.point})}).on("mouseover",function(n){if(_)return 0;var r=e[n.series],i=r.values[n.point];C.elementMouseover({point:i,series:r,pos:[o(f(i,n.point))+t.left,u(l(i,n.point))+t.top],seriesIndex:n.series,pointIndex:n.point})}).on("mouseout",function(t,n){if(_)return 0;var r=e[t.series],i=r.values[t.point];C.elementMouseout({point:i,series:r,seriesIndex:t.series,pointIndex:t.point})}),_=!1}var D=n-t.left-t.right,P=r-t.top-t.bottom,H=d3.select(this);e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var B=E&&S&&x?[]:d3.merge(e.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(E||d3.extent(B.map(function(e){return e.x}).concat(p))).range([0,D]),u.domain(S||d3.extent(B.map(function(e){return e.y}).concat(d))).range([P,0]),a.domain(x||d3.extent(B.map(function(e){return e.size}).concat(v))).range(T||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])N=!0;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])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]+u.domain()[0]*.01,u.domain()[1]-u.domain()[1]*.01]):u.domain([-1,1])),L=L||o,A=A||u,O=O||a;var j=H.selectAll("g.nv-wrap.nv-scatter").data([e]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(N?" nv-single-point":"")),I=F.append("defs"),q=F.append("g"),R=j.select("g");q.append("g").attr("class","nv-groups"),q.append("g").attr("class","nv-point-paths"),j.attr("transform","translate("+t.left+","+t.top+")"),I.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),j.select("#nv-edge-clip-"+s+" rect").attr("width",D).attr("height",P),R.attr("clip-path",y?"url(#nv-edge-clip-"+s+")":""),_=!0;var W=j.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});W.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(W.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),W.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),d3.transition(W).style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);var X=W.selectAll("path.nv-point").data(function(e){return e.values});X.enter().append("path").attr("transform",function(e,t){return"translate("+L(f(e,t))+","+A(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),X.exit().remove(),d3.transition(W.exit().selectAll("path.nv-point")).attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),X.attr("class",function(e,t){return"nv-point nv-point-"+t}),d3.transition(X).attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),clearTimeout(M),M=setTimeout(U,1e3),L=o.copy(),A=u.copy(),O=a.copy()}),D}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=[],d=[],v=[],m=!0,g=function(e){return!e.notActive},y=!1,b=!0,w=function(){return 25},E=null,S=null,x=null,T=null,N=!1,C=d3.dispatch("elementClick","elementMouseover","elementMouseout"),k=!0,L,A,O,M,_=!1;return C.on("elementMouseover.point",function(e){m&&d3.select(".nv-chart-"+s+" .nv-series-"+e.seriesIndex+" .nv-point-"+e.pointIndex).classed("hover",!0)}),C.on("elementMouseout.point",function(e){m&&d3.select(".nv-chart-"+s+" .nv-series-"+e.seriesIndex+" .nv-point-"+e.pointIndex).classed("hover",!1)}),D.dispatch=C,D.x=function(e){return arguments.length?(f=d3.functor(e),D):f},D.y=function(e){return arguments.length?(l=d3.functor(e),D):l},D.size=function(e){return arguments.length?(c=d3.functor(e),D):c},D.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,D):t},D.width=function(e){return arguments.length?(n=e,D):n},D.height=function(e){return arguments.length?(r=e,D):r},D.xScale=function(e){return arguments.length?(o=e,D):o},D.yScale=function(e){return arguments.length?(u=e,D):u},D.zScale=function(e){return arguments.length?(a=e,D):a},D.xDomain=function(e){return arguments.length?(E=e,D):E},D.yDomain=function(e){return arguments.length?(S=e,D):S},D.sizeDomain=function(e){return arguments.length?(x=e,D):x},D.sizeRange=function(e){return arguments.length?(T=e,D):T},D.forceX=function(e){return arguments.length?(p=e,D):p},D.forceY=function(e){return arguments.length?(d=e,D):d},D.forceSize=function(e){return arguments.length?(v=e,D):v},D.interactive=function(e){return arguments.length?(m=e,D):m},D.pointActive=function(e){return arguments.length?(g=e,D):g},D.clipEdge=function(e){return arguments.length?(y=e,D):y},D.clipVoronoi=function(e){return arguments.length?(b=e,D):b},D.useVoronoi=function(e){return arguments.length?(k=e,k===!1&&(b=!1),D):k},D.clipRadius=function(e){return arguments.length?(w=e,D):w},D.color=function(t){return arguments.length?(i=e.utils.getColor(t),D):i},D.shape=function(e){return arguments.length?(h=e,D):h},D.id=function(e){return arguments.length?(s=e,D):s},D.singlePoint=function(e){return arguments.length?(N=e,D):N},D},e.models.scatterChart=function(){function _(e){return e.each(function(x){function U(){if(E)return I.select(".nv-point-paths").style("pointer-events","all"),!1;I.select(".nv-point-paths").style("pointer-events","none");var e=d3.mouse(this);h.distortion(w).focus(e[0]),p.distortion(w).focus(e[1]),I.select(".nv-scatterWrap").call(t),I.select(".nv-x.nv-axis").call(n),I.select(".nv-y.nv-axis").call(r),I.select(".nv-distributionX").datum(x.filter(function(e){return!e.disabled})).call(o),I.select(".nv-distributionY").datum(x.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,D=(f||parseInt(T.style("width"))||960)-a.left-a.right,P=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;_.update=function(){_(e)},_.container=this;if(!x||!x.length||!x.filter(function(e){return e.values.length}).length){var H=T.selectAll(".nv-noData").data([k]);return H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",a.left+D/2).attr("y",a.top+P/2).text(function(e){return e}),_}T.selectAll(".nv-noData").remove(),L=L||h,A=A||p;var B=T.selectAll("g.nv-wrap.nv-scatterChart").data([x]),j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),F=j.append("g"),I=B.select("g");F.append("rect").attr("class","nvd3 nv-background"),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-scatterWrap"),F.append("g").attr("class","nv-distWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap"),y&&(i.width(D/2),B.select(".nv-legendWrap").datum(x).call(i),a.top!=i.height()&&(a.top=i.height(),P=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),B.select(".nv-legendWrap").attr("transform","translate("+D/2+","+ -a.top+")")),b&&(s.width(180).color(["#444"]),I.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+ -a.top+")").call(s)),B.attr("transform","translate("+a.left+","+a.top+")"),t.width(D).height(P).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),B.select(".nv-scatterWrap").datum(x.filter(function(e){return!e.disabled})).call(t);if(d){var q=h.domain()[1]-h.domain()[0];h.domain([h.domain()[0]-d*q,h.domain()[1]+d*q])}if(v){var R=p.domain()[1]-p.domain()[0];p.domain([p.domain()[0]-v*R,p.domain()[1]+v*R])}n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():D/100).tickSize(-P,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n),r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():P/36).tickSize(-D,0),I.select(".nv-y.nv-axis").call(r),m&&(o.getData(t.x()).scale(h).width(D).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),F.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),I.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(x.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(P).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),F.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),I.select(".nv-distributionY").attr("transform","translate(-"+u.size()+",0)").datum(x.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(I.select(".nv-background").attr("width",D).attr("height",P),I.select(".nv-background").on("mousemove",U),I.select(".nv-background").on("click",function(){E=!E}),t.dispatch.on("elementClick.freezeFisheye",function(){E=!E})),s.dispatch.on("legendClick",function(i,s){i.disabled=!i.disabled,w=i.disabled?0:2.5,I.select(".nv-background").style("pointer-events",i.disabled?"none":"all"),I.select(".nv-point-paths").style("pointer-events",i.disabled?"all":"none"),i.disabled?(h.distortion(w).focus(0),p.distortion(w).focus(0),I.select(".nv-scatterWrap").call(t),I.select(".nv-x.nv-axis").call(n),I.select(".nv-y.nv-axis").call(r)):E=!1,_(e)}),i.dispatch.on("legendClick",function(t,n,r){t.disabled=!t.disabled,x.filter(function(e){return!e.disabled}).length||x.map(function(e){return e.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1),e}),_(e)}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-P),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],C.tooltipShow(e)}),C.on("tooltipShow",function(e){S&&O(e,N.parentNode)}),L=h.copy(),A=p.copy()}),_}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!!d3.fisheye,w=0,E=!1,S=!0,x=function(e,t,n){return""+t+""},T=function(e,t,n){return""+n+""},N=null,C=d3.dispatch("tooltipShow","tooltipHide"),k="No Data Available.";t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient("left").tickPadding(10),o.axis("x"),u.axis("y");var L,A,O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));x!=null&&e.tooltip.show([f,l],x(i.series.key,v,m,i,_),"n",1,s,"x-nvtooltip"),T!=null&&e.tooltip.show([c,d],T(i.series.key,v,m,i,_),"e",1,s,"y-nvtooltip"),N!=null&&e.tooltip.show([o,u],N(i.series.key,v,m,i,_),i.value<0?"n":"s",null,s)},M=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),C.on("tooltipHide",function(){S&&e.tooltip.cleanup()}),_.dispatch=C,_.scatter=t,_.legend=i,_.controls=s,_.xAxis=n,_.yAxis=r,_.distX=o,_.distY=u,d3.rebind(_,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),_.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,_):a},_.width=function(e){return arguments.length?(f=e,_):f},_.height=function(e){return arguments.length?(l=e,_):l},_.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),_):c},_.showDistX=function(e){return arguments.length?(m=e,_):m},_.showDistY=function(e){return arguments.length?(g=e,_):g},_.showControls=function(e){return arguments.length?(b=e,_):b},_.showLegend=function(e){return arguments.length?(y=e,_):y},_.fisheye=function(e){return arguments.length?(w=e,_):w},_.xPadding=function(e){return arguments.length?(d=e,_):d},_.yPadding=function(e){return arguments.length?(v=e,_):v},_.tooltips=function(e){return arguments.length?(S=e,_):S},_.tooltipContent=function(e){return arguments.length?(N=e,_):N},_.tooltipXContent=function(e){return arguments.length?(x=e,_):x},_.tooltipYContent=function(e){return arguments.length?(T=e,_):T},_.noData=function(e){return arguments.length?(k=e,_):k},_},e.models.scatterPlusLineChart=function(){function O(e){return e.each(function(E){function q(){if(b)return j.select(".nv-point-paths").style("pointer-events","all"),!1;j.select(".nv-point-paths").style("pointer-events","none");var e=d3.mouse(this);h.distortion(y).focus(e[0]),p.distortion(y).focus(e[1]),j.select(".nv-scatterWrap").datum(E.filter(function(e){return!e.disabled})).call(t),j.select(".nv-x.nv-axis").call(n),j.select(".nv-y.nv-axis").call(r),j.select(".nv-distributionX").datum(E.filter(function(e){return!e.disabled})).call(o),j.select(".nv-distributionY").datum(E.filter(function(e){return!e.disabled})).call(u)}var S=d3.select(this),x=this,M=(f||parseInt(S.style("width"))||960)-a.left-a.right,_=(l||parseInt(S.style("height"))||400)-a.top-a.bottom;O.update=function(){O(e)},O.container=this;if(!E||!E.length||!E.filter(function(e){return e.values.length}).length){var D=S.selectAll(".nv-noData").data([N]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",a.left+M/2).attr("y",a.top+_/2).text(function(e){return e}),O}S.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),C=C||h,k=k||p;var P=S.selectAll("g.nv-wrap.nv-scatterChart").data([E]),H=P.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),B=H.append("g"),j=P.select("g");B.append("rect").attr("class","nvd3 nv-background"),B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-scatterWrap"),B.append("g").attr("class","nv-regressionLinesWrap"),B.append("g").attr("class","nv-distWrap"),B.append("g").attr("class","nv-legendWrap"),B.append("g").attr("class","nv-controlsWrap"),P.attr("transform","translate("+a.left+","+a.top+")"),m&&(i.width(M/2),P.select(".nv-legendWrap").datum(E).call(i),a.top!=i.height()&&(a.top=i.height(),_=(l||parseInt(S.style("height"))||400)-a.top-a.bottom),P.select(".nv-legendWrap").attr("transform","translate("+M/2+","+ -a.top+")")),g&&(s.width(180).color(["#444"]),j.select(".nv-controlsWrap").datum(A).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(M).height(_).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),P.select(".nv-scatterWrap").datum(E.filter(function(e){return!e.disabled})).call(t),P.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var F=P.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e}),I=F.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);F.selectAll(".nv-regLines line").attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),n.scale(h).ticks(n.ticks()?n.ticks():M/100).tickSize(-_,0),j.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n),r.scale(p).ticks(r.ticks()?r.ticks():_/36).tickSize(-M,0),j.select(".nv-y.nv-axis").call(r),d&&(o.getData(t.x()).scale(h).width(M).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),B.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),j.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(E.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(_).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),B.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),j.select(".nv-distributionY").attr("transform","translate(-"+u.size()+",0)").datum(E.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(j.select(".nv-background").attr("width",M).attr("height",_),j.select(".nv-background").on("mousemove",q),j.select(".nv-background").on("click",function(){b=!b}),t.dispatch.on("elementClick.freezeFisheye",function(){b=!b})),s.dispatch.on("legendClick",function(i,s){i.disabled=!i.disabled,y=i.disabled?0:2.5,j.select(".nv-background").style("pointer-events",i.disabled?"none":"all"),j.select(".nv-point-paths").style("pointer-events",i.disabled?"all":"none"),i.disabled?(h.distortion(y).focus(0),p.distortion(y).focus(0),j.select(".nv-scatterWrap").call(t),j.select(".nv-x.nv-axis").call(n),j.select(".nv-y.nv-axis").call(r)):b=!1,O(e)}),i.dispatch.on("legendClick",function(t,n,r){t.disabled=!t.disabled,E.filter(function(e){return!e.disabled}).length||E.map(function(e){return e.disabled=!1,P.selectAll(".nv-series").classed("disabled",!1),e}),O(e)}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-_),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],T.tooltipShow(e)}),T.on("tooltipShow",function(e){w&&L(e,x.parentNode)}),C=h.copy(),k=p.copy()}),O}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!!d3.fisheye,y=0,b=!1,w=!0,E=function(e,t,n){return""+t+""},S=function(e,t,n){return""+n+""},x=null,T=d3.dispatch("tooltipShow","tooltipHide"),N="No Data Available.";t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient("left").tickPadding(10),o.axis("x"),u.axis("y");var C,k,L=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));E!=null&&e.tooltip.show([f,l],E(i.series.key,v,m,i,O),"n",1,s,"x-nvtooltip"),S!=null&&e.tooltip.show([c,d],S(i.series.key,v,m,i,O),"e",1,s,"y-nvtooltip"),x!=null&&e.tooltip.show([o,u],x(i.series.key,v,m,i,O),i.value<0?"n":"s",null,s)},A=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),T.on("tooltipHide",function(){w&&e.tooltip.cleanup()}),O.dispatch=T,O.scatter=t,O.legend=i,O.controls=s,O.xAxis=n,O.yAxis=r,O.distX=o,O.distY=u,d3.rebind(O,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),O.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,O):a},O.width=function(e){return arguments.length?(f=e,O):f},O.height=function(e){return arguments.length?(l=e,O):l},O.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),O):c},O.showDistX=function(e){return arguments.length?(d=e,O):d},O.showDistY=function(e){return arguments.length?(v=e,O):v},O.showControls=function(e){return arguments.length?(g=e,O):g},O.showLegend=function(e){return arguments.length?(m=e,O):m},O.fisheye=function(e){return arguments.length?(y=e,O):y},O.tooltips=function(e){return arguments.length?(w=e,O):w},O.tooltipContent=function(e){return arguments.length?(x=e,O):x},O.tooltipXContent=function(e){return arguments.length?(E=e,O):E},O.tooltipYContent=function(e){return arguments.length?(S=e,O):S},O.noData=function(e){return arguments.length?(N=e,O):N},O},e.models.sparkline=function(){function h(e){return e.each(function(e){var i=n-t.left-t.right,h=r-t.top-t.bottom,p=d3.select(this);s.domain(l||d3.extent(e,u)).range([0,i]),o.domain(c||d3.extent(e,a)).range([h,0]);var d=p.selectAll("g.nv-wrap.nv-sparkline").data([e]),v=d.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),m=v.append("g"),g=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var b=d.selectAll("path").data(function(e){return[e]});b.enter().append("path"),b.exit().remove(),b.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var w=d.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});w.enter().append("circle"),w.exit().remove(),w.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),h}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c;return h.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,h):t},h.width=function(e){return arguments.length?(n=e,h):n},h.height=function(e){return arguments.length?(r=e,h):r},h.x=function(e){return arguments.length?(u=d3.functor(e),h):u},h.y=function(e){return arguments.length?(a=d3.functor(e),h):a},h.xScale=function(e){return arguments.length?(s=e,h):s},h.yScale=function(e){return arguments.length?(o=e,h):o},h.xDomain=function(e){return arguments.length?(l=e,h):l},h.yDomain=function(e){return arguments.length?(c=e,h):c},h.animate=function(e){return arguments.length?(i=e,h):i},h.color=function(t){return arguments.length?(f=e.utils.getColor(t),h):f},h},e.models.sparklinePlus=function(){function p(e){return e.each(function(c){function L(){if(a)return;var e=T.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",m),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),T.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),T.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function A(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s"+e+""+"

"+n+" on "+t+"

"},d,v,m=d3.format(",.2f"),g="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide");n.orient("bottom").tickPadding(7),r.orient("left"),t.scatter.pointActive(function(e){return!!Math.round(t.y()(e)*100)});var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],y.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){y.tooltipHide(e)}),y.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),w.dispatch=y,w.stacked=t,w.legend=i,w.controls=s,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),w.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,w):o},w.width=function(e){return arguments.length?(u=e,w):getWidth},w.height=function(e){return arguments.length?(a=e,w):getHeight},w.color=function(n){return arguments.length?(f=e.utils.getColor(n),i.color(f),t.color(f),w):f},w.showControls=function(e){return arguments.length?(l=e,w):l},w.showLegend=function(e){return arguments.length?(c=e,w):c},w.tooltip=function(e){return arguments.length?(p=e,w):p},w.tooltips=function(e){return arguments.length?(h=e,w):h},w.tooltipContent=function(e){return arguments.length?(p=e,w):p},w.noData=function(e){return arguments.length?(g=e,w):g},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(m=e,r):m},w}})(); \ No newline at end of file +(function(){function b(a,b){return(new Date(b,a+1,0)).getDate()}function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(g=document.body.scrollWidth?m:m-16;var r=function(a){var b=q;do isNaN(a.offsetTop)||(b+=a.offsetTop);while(a=a.offsetParent);return b},s=function(a){var b=p;do isNaN(a.offsetLeft)||(b+=a.offsetLeft);while(a=a.offsetParent);return b};switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2;var t=s(h),u=r(h);to?b[0]+e:o-t+p),un+m&&(q=n+m-u+q-j);break;case"w":p=b[0]+e,q=b[1]-j/2,t+k>l&&(p=b[0]-k-e),un+m&&(q=n-j-5);break;case"n":p=b[0]-k/2-5,q=b[1]+e;var t=s(h),u=r(h);tl&&(p=parseInt(i.offsetWidth)-k-5),u+j>n+m&&(q=n+m-u+q-j);break;case"s":p=b[0]-k/2,q=b[1]-j-e;var t=s(h),u=r(h);tl&&(p=parseInt(i.offsetWidth)-k-5),n>u&&(q=n)}return h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none",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};return 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),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){return arguments.length?Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b:a.utils.defaultColor()},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);return d||(d=c.length),typeof a[g]!="undefined"?typeof a[g]=="function"?a[g]():a[g]:c[--d]}},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 o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),r=q.append("g"),s=p.select("g");m!==null?a.ticks(m):(a.orient()=="top"||a.orient()=="bottom")&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();t==null&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);u.exit().remove();switch(a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)-12:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"end").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+12:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+n(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}u.text(function(a){return a}),g&&(a.orient()==="left"||a.orient()==="right")&&(s.selectAll("g").each(function(a,b){if(e(a)e.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),e.domain()[0]==e.domain()[1]&&e.domain()[0]==0&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1}));if(g&&(a.orient()==="top"||a.orient()==="bottom")){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a,b){if(e(a)B[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!0,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l=typeof e.rangeBands=="function",d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o},a.models.historicalBar=function(){function q(a){return a.each(function(a){var q=c-b.left-b.right,r=d-b.top-b.bottom,s=d3.select(this);f.domain(n||d3.extent(a[0].values.map(h).concat(j))).range([0,q]),g.domain(o||d3.extent(a[0].values.map(i).concat(k))).range([r,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;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])),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]));var t=s.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("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-bars"),t.attr("transform","translate("+b.left+","+b.top+")"),s.on("click",function(a,b){p.chartClick({data:a,index:b,pos:d3.event,id:e})}),v.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",r),z.attr("clip-path",l?"url(#nv-chart-clip-path-"+e+")":"");var A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("x",0).attr("y",function(a,b){return g(Math.max(0,i(a,b)))}).attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("fill",function(a,b){return m(a,b)}).attr("class",function(a,b,c){return(i(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(f(h(b,c))-q/a[0].values.length*.5)+",0)"}).attr("width",q/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)})}),q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[],k=[0],l=!0,m=a.utils.defaultColor(),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return q.dispatch=p,q.x=function(a){return arguments.length?(h=a,q):h},q.y=function(a){return arguments.length?(i=a,q):i},q.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,q):b},q.width=function(a){return arguments.length?(c=a,q):c},q.height=function(a){return arguments.length?(d=a,q):d},q.xScale=function(a){return arguments.length?(f=a,q):f},q.yScale=function(a){return arguments.length?(g=a,q):g},q.xDomain=function(a){return arguments.length?(n=a,q):n},q.yDomain=function(a){return arguments.length?(o=a,q):o},q.forceX=function(a){return arguments.length?(j=a,q):j},q.forceY=function(a){return arguments.length?(k=a,q):k},q.clipEdge=function(a){return arguments.length?(l=a,q):l},q.color=function(b){return arguments.length?(m=a.utils.getColor(b),q):m},q.id=function(a){return arguments.length?(e=a,q):e},q},a.models.bullet=function(){function n(a){return a.each(function(a,c){var h=i-b.left-b.right,k=j-b.top-b.bottom,n=d3.select(this),o=e.call(this,a,c).slice().sort(d3.descending),p=f.call(this,a,c).slice().sort(d3.descending),q=g.call(this,a,c).slice().sort(d3.descending),r=d3.scale.linear().domain([0,Math.max(o[0],p[0],q[0])]).range(d?[h,0]:[0,h]),s=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(r.range());this.__chart__=r;var t=n.selectAll("g.nv-wrap.nv-bullet").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),v=u.append("g"),w=t.select("g");t.attr("transform","translate("+b.left+","+b.top+")");var x=function(a){return Math.abs(s(a)-s(0))},y=function(a){return Math.abs(r(a)-r(0))},z=w.selectAll("rect.nv-range").data(o);z.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",x).attr("height",k).attr("x",d?s:0).on("mouseover",function(a,b){m.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(z).attr("x",d?r:0).attr("width",y).attr("height",k);var A=w.selectAll("rect.nv-measure").data(q);A.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).style("fill",function(a,b){return l(a,b)}).attr("width",x).attr("height",k/3).attr("x",d?s:0).attr("y",k/3).on("mouseover",function(a){m.elementMouseover({value:a,label:"Current",pos:[r(a),k/2]})}).on("mouseout",function(a){m.elementMouseout({value:a,label:"Current"})}),d3.transition(A).attr("width",y).attr("height",k/3).attr("x",d?r:0).attr("y",k/3);var B=w.selectAll("path.nv-markerTriangle").data(p),C=k/6;B.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+s(a)+","+k/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(a,b){m.elementMouseover({value:a,label:"Previous",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:"Previous"})}),d3.transition(B).attr("transform",function(a){return"translate("+r(a)+","+k/2+")"}),B.exit().remove()}),d3.timer.flush(),n}var b={top:0,right:0,bottom:0,left:0},c="left",d=!1,e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=[0],i=380,j=30,k=null,l=a.utils.getColor(["#1f77b4"]),m=d3.dispatch("elementMouseover","elementMouseout");return n.dispatch=m,n.orient=function(a){return arguments.length?(c=a,d=c=="right"||c=="bottom",n):c},n.ranges=function(a){return arguments.length?(e=a,n):e},n.markers=function(a){return arguments.length?(f=a,n):f},n.measures=function(a){return arguments.length?(g=a,n):g},n.forceX=function(a){return arguments.length?(h=a,n):h},n.width=function(a){return arguments.length?(i=a,n):i},n.height=function(a){return arguments.length?(j=a,n):j},n.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,n):b},n.tickFormat=function(a){return arguments.length?(k=a,n):k},n.color=function(b){return arguments.length?(l=a.utils.getColor(b),n):l},n},a.models.bulletChart=function(){function q(a){return a.each(function(c,m){var r=d3.select(this),s=(i||parseInt(r.style("width"))||960)-e.left-e.right,t=j-e.top-e.bottom,u=this;q.update=function(){q(a)},q.container=this;if(!c||!f.call(this,c,m)){var v=r.selectAll(".nv-noData").data([n]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",e.left+s/2).attr("y",18+e.top+t/2).text(function(a){return a}),q}r.selectAll(".nv-noData").remove();var w=f.call(this,c,m).slice().sort(d3.descending),x=g.call(this,c,m).slice().sort(d3.descending),y=h.call(this,c,m).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([c]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+e.left+","+e.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(d?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(D.range());this.__chart__=D;var F=function(a){return Math.abs(E(a)-E(0))},G=function(a){return Math.abs(D(a)-D(0))},H=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(j-e.top-e.bottom)/2+")");H.append("text").attr("class","nv-title").text(function(a){return a.title}),H.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var I=C.select(".nv-bulletWrap");d3.transition(I).call(b);var J=k||D.tickFormat(s/100),K=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||J(a)}),L=K.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",t).attr("y2",t*7/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",t*7/6).text(J);var M=d3.transition(K).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);M.select("line").attr("y1",t).attr("y2",t*7/6),M.select("text").attr("y",t*7/6),d3.transition(K.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),o.on("tooltipShow",function(a){a.key=data[0].title,l&&p(a,u.parentNode)})}),d3.timer.flush(),q}var b=a.models.bullet(),c="left",d=!1,e={top:5,right:40,bottom:20,left:120},f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=null,j=55,k=null,l=!0,m=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0)+e.left,f=b.pos[1]+(c.offsetTop||0)+e.top,g=m(b.key,b.label,b.value,b,q);a.tooltip.show([d,f],g,b.value<0?"e":"w",null,c)};return b.dispatch.on("elementMouseover.tooltip",function(a){o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),q.dispatch=o,q.bullet=b,d3.rebind(q,b,"color"),q.orient=function(a){return arguments.length?(c=a,d=c=="right"||c=="bottom",q):c},q.ranges=function(a){return arguments.length?(f=a,q):f},q.markers=function(a){return arguments.length?(g=a,q):g},q.measures=function(a){return arguments.length?(h=a,q):h},q.width=function(a){return arguments.length?(i=a,q):i},q.height=function(a){return arguments.length?(j=a,q):j},q.margin=function(a){return arguments.length?(e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left,q):e},q.tickFormat=function(a){return arguments.length?(k=a,q):k},q.tooltips=function(a){return arguments.length?(l=a,q):l},q.tooltipContent=function(a){return arguments.length?(m=a,q):m},q.noData=function(a){return arguments.length?(n=a,q):n},q},a.models.cumulativeLineChart=function(){function y(a,b){d3.select(B.container).style("cursor","ew-resize")}function z(a,b){a.x+=d3.event.dx,a.i=Math.round(u.invert(a.x)),d3.select(this).attr("transform","translate("+u(a.i)+",0)"),B.update()}function A(a,b){d3.select(B.container).style("cursor","auto"),B.update()}function B(a){return a.each(function(o){function N(){M.data([v]),B.update()}var y=d3.select(this).classed("nv-chart-"+r,!0),z=this,A=(i||parseInt(y.style("width"))||960)-g.left-g.right,D=(j||parseInt(y.style("height"))||400)-g.top-g.bottom;B.update=function(){B(a)},B.container=this;if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){var E=y.selectAll(".nv-noData").data([s]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",g.left+A/2).attr("y",g.top+D/2).text(function(a){return a}),B}y.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();if(!n){var F=o.filter(function(a){return!a.disabled}).map(function(a,c){var d=d3.extent(a.values,b.y());return[(d[0]-d[1])/(1+d[1]),(d[1]-d[0])/(1+d[0])]}),G=[d3.min(F,function(a){return a[0]}),d3.max(F,function(a){return a[1]})];b.yDomain(G)}else b.yDomain(null);u.domain([0,o[0].values.length-1]).range([0,A]).clamp(!0);var o=C(v.i,o),H=y.selectAll("g.nv-wrap.nv-cumulativeLine").data([o]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),J=H.select("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-background"),I.append("g").attr("class","nv-linesWrap"),I.append("g").attr("class","nv-legendWrap"),I.append("g").attr("class","nv-controlsWrap"),k&&(e.width(A),J.select(".nv-legendWrap").datum(o).call(e),g.top!=e.height()&&(g.top=e.height(),D=(j||parseInt(y.style("height"))||400)-g.top-g.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -g.top+")"));if(m){var K=[{key:"Re-scale y-axis",disabled:!n}];f.width(140).color(["#444","#444","#444"]),J.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+ -g.top+")").call(f)}H.attr("transform","translate("+g.left+","+g.top+")"),I.select(".nv-background").append("rect").attr("width",A).attr("height",D),b.y(function(a){return a.display.y}).width(A).height(D).color(o.map(function(a,b){return a.color||h(a,b)}).filter(function(a,b){return!o[b].disabled}));var L=J.select(".nv-linesWrap").datum(o.filter(function(a){return!a.disabled}));L.call(b);var M=L.selectAll(".nv-indexLine").data([v]);M.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(x),M.attr("transform",function(a){return"translate("+u(a.i)+",0)"}).attr("height",D),c.scale(p).tickSubdivide(o[0].values.length>A/50?!0:!1).ticks(Math.min(o[0].values.length,A/50)).tickSize(-D,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(c),d.scale(q).ticks(D/36).tickSize(-A,0),d3.transition(J.select(".nv-y.nv-axis")).call(d),J.select(".nv-background rect").on("click",function(){v.x=d3.mouse(this)[0],v.i=Math.round(u.invert(v.x)),N()}),b.dispatch.on("elementClick",function(a){v.i=a.pointIndex,v.x=u(v.i),N()}),f.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,n=!b.disabled,a.call(B)}),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){return a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1),a}),a.call(B)}),t.on("tooltipShow",function(a){l&&w(a,z.parentNode)})}),B}function C(a,c){return c.map(function(c,d){var e=b.y()(c.values[a],a);return c.values=c.values.map(function(a,c){return a.display={y:(b.y()(a,c)-e)/(1+e)},a}),c})}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:30,bottom:50,left:60},h=a.utils.defaultColor(),i=null,j=null,k=!0,l=!0,m=!0,n=!0,o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p,q,r=b.id(),s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var u=d3.scale.linear(),v={i:0,x:0},w=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,B);a.tooltip.show([g,h],k,null,null,f)},x=d3.behavior.drag().on("dragstart",y).on("drag",z).on("dragend",A);return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),B.dispatch=t,B.lines=b,B.legend=e,B.xAxis=c,B.yAxis=d,d3.rebind(B,b,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),B.margin=function(a){return arguments.length?(g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left,B):g},B.width=function(a){return arguments.length?(i=a,B):i},B.height=function(a){return arguments.length?(j=a,B):j},B.color=function(b){return arguments.length?(h=a.utils.getColor(b),e.color(h),B):h},B.showControls=function(a){return arguments.length?(m=a,B):m},B.showLegend=function(a){return arguments.length?(k=a,B):k},B.tooltips=function(a){return arguments.length?(l=a,B):l},B.tooltipContent=function(a){return arguments.length?(o=a,B):o},B.noData=function(a){return arguments.length?(s=a,B):s},B},a.models.discreteBar=function(){function t(a){return a.each(function(a){var e=c-b.left-b.right,t=d-b.top-b.bottom,u=d3.select(this);a=a.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var v=n&&o?[]:a.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,e],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([t-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([t,0]),r=r||f,s=s||g.copy().range([g(0),g(0)]);var w=u.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g"),B=w.select("g");A.append("g").attr("class","nv-groups"),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(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){p.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){p.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()/a.length),l?(E.append("text").attr("text-anchor","middle"),D.select("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"}).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}).select("rect").attr("class",q).attr("width",f.rangeBand()/a.length),d3.transition(D).attr("transform",function(a,b){var c=f(h(a,b)),d=i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0))||1)}),r=f.copy(),s=g.copy()}),t}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="discreteBar",r,s;return t.dispatch=p,t.x=function(a){return arguments.length?(h=a,t):h},t.y=function(a){return arguments.length?(i=a,t):i},t.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.xScale=function(a){return arguments.length?(f=a,t):f},t.yScale=function(a){return arguments.length?(g=a,t):g},t.xDomain=function(a){return arguments.length?(n=a,t):n},t.yDomain=function(a){return arguments.length?(o=a,t):o},t.forceY=function(a){return arguments.length?(j=a,t):j},t.color=function(b){return arguments.length?(k=a.utils.getColor(b),t):k},t.id=function(a){return arguments.length?(e=a,t):e},t.showValues=function(a){return arguments.length?(l=a,t):l},t.valueFormat=function(a){return arguments.length?(m=a,t):m},t.rectClass=function(a){return arguments.length?(q=a,t):q},t},a.models.discreteBarChart=function(){function q(a){return a.each(function(h){var k=d3.select(this),r=this,s=(f||parseInt(k.style("width"))||960)-e.left-e.right,t=(g||parseInt(k.style("height"))||400)-e.top-e.bottom;q.update=function(){a.transition().call(q)},q.container=this;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){var u=k.selectAll(".nv-noData").data([n]);return u.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),u.attr("x",e.left+s/2).attr("y",e.top+t/2).text(function(a){return a}),q}k.selectAll(".nv-noData").remove(),l=b.xScale(),m=b.yScale();var v=k +.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"),A=v.select("g");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"),A.attr("transform","translate("+e.left+","+e.top+")"),b.width(s).height(t);var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(b),z.append("clipPath").attr("id","nv-x-label-clip-"+b.id()).append("rect"),A.select("#nv-x-label-clip-"+b.id()+" rect").attr("width",l.rangeBand()*(i?2:1)).attr("height",16).attr("x",-l.rangeBand()/(i?1:2)),c.scale(l).ticks(s/100).tickSize(-t,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+(b.showValues()&&m.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(c);var C=A.select(".nv-x.nv-axis").selectAll("g");i&&C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"0":"12")+")"}),d.scale(m).ticks(t/36).tickSize(-s,0),d3.transition(A.select(".nv-y.nv-axis")).call(d),o.on("tooltipShow",function(a){j&&p(a,r.parentNode)})}),q}var b=a.models.discreteBar(),c=a.models.axis(),d=a.models.axis(),e={top:15,right:10,bottom:50,left:60},f=null,g=null,h=a.utils.getColor(),i=!1,j=!0,k=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},l,m,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var p=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),l=k(e.series.key,i,j,e,q);a.tooltip.show([g,h],l,e.value<0?"n":"s",null,f)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),q.dispatch=o,q.discretebar=b,q.xAxis=c,q.yAxis=d,d3.rebind(q,b,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),q.margin=function(a){return arguments.length?(e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left,q):e},q.width=function(a){return arguments.length?(f=a,q):f},q.height=function(a){return arguments.length?(g=a,q):g},q.color=function(c){return arguments.length?(h=a.utils.getColor(c),b.color(h),q):h},q.staggerLabels=function(a){return arguments.length?(i=a,q):i},q.tooltips=function(a){return arguments.length?(j=a,q):j},q.tooltipContent=function(a){return arguments.length?(k=a,q):k},q.noData=function(a){return arguments.length?(n=a,q):n},q},a.models.distribution=function(){function k(a){return a.each(function(a){var i=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x",l=d3.select(this);j=j||h;var m=l.selectAll("g.nv-distribution").data([a]),n=m.enter().append("g").attr("class","nvd3 nv-distribution"),o=n.append("g"),p=m.select("g");m.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var r=q.selectAll("line.nv-dist"+e).data(function(a){return a.values});r.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(q.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(r).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}),j=h.copy()}),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=d3.scale.linear(),i,j;return k.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,k):b},k.width=function(a){return arguments.length?(c=a,k):c},k.axis=function(a){return arguments.length?(e=a,k):e},k.size=function(a){return arguments.length?(d=a,k):d},k.getData=function(a){return arguments.length?(f=d3.functor(a),k):f},k.scale=function(a){return arguments.length?(h=a,k):h},k.color=function(b){return arguments.length?(g=a.utils.getColor(b),k):g},k},a.models.indentedTree=function(){function o(a){return a.each(function(b){function z(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c)return d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&z(a,0,!0)}),!0;if(!C(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),o.update()}function A(a){return a._values&&a._values.length?l:a.values&&a.values.length?m:""}function B(a){return a._values&&a._values.length}function C(a){var b=a.values||a._values;return b&&b.length}var c=0,e=1,f=d3.layout.tree().children(function(a){return a.values}).size([d,i]);o.update=function(){a.transition().call(o)},o.container=this,b[0]||(b[0]={key:h});var p=f.nodes(b[0]),q=d3.select(this).selectAll("div").data([[p]]),r=q.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),s=r.append("table"),t=q.select("table").attr("width","100%").attr("class",k);if(g){var u=s.append("thead"),v=u.append("tr");j.forEach(function(a){v.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var w=t.selectAll("tbody").data(function(a){return a});w.enter().append("tbody"),e=d3.max(p,function(a){return a.depth}),f.size([d,e*i]);var x=w.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++c});x.exit().remove(),x.select("img.nv-treeicon").attr("src",A).classed("folded",B);var y=x.enter().append("tr");j.forEach(function(a,b){var c=y.append("td").style("padding-left",function(a){return(b?0:a.depth*i+12+(A(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",B).attr("src",A).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return A(a)?"inline-block":"none"}).on("click",z),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)}),x.order().on("click",function(a){n.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){n.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){n.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){n.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})}),o}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 Data Available.",i=20,j=[{key:"key",label:"Name",type:"text"}],k=null,l="images/grey-plus.png",m="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");return o.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.height=function(a){return arguments.length?(d=a,o):d},o.color=function(b){return arguments.length?(e=a.utils.getColor(b),scatter.color(e),o):e},o.id=function(a){return arguments.length?(f=a,o):f},o.header=function(a){return arguments.length?(g=a,o):g},o.noData=function(a){return arguments.length?(h=a,o):h},o.columns=function(a){return arguments.length?(j=a,o):j},o.tableClass=function(a){return arguments.length?(k=a,o):k},o.iconOpen=function(a){return arguments.length?(l=a,o):l},o.iconClose=function(a){return arguments.length?(m=a,o):m},o},a.models.legend=function(){function i(a){return a.each(function(a){var i=c-b.left-b.right,j=d3.select(this),l=j.selectAll("g.nv-legend").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),n=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var o=n.selectAll(".nv-series").data(function(a){return a}),p=o.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)});p.append("circle").style("stroke-width",2).attr("r",5),p.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),o.classed("disabled",function(a){return a.disabled}),o.exit().remove(),o.select("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}),o.select("text").text(e);if(g){var q=[];o.each(function(a,b){q.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var r=0,s=0,t=[];while(si&&r>1){t=[],r--;for(k=0;k(t[k%r]||0)&&(t[k%r]=q[k]);s=t.reduce(function(a,b,c,d){return a+b})}var u=[];for(var v=0,w=0;vz&&(z=y),"translate("+A+","+x+")"}),n.attr("transform","translate("+(c-b.right-z)+","+b.top+")"),d=b.top+b.bottom+x+15}}),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");return i.dispatch=h,i.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,i):b},i.width=function(a){return arguments.length?(c=a,i):c},i.height=function(a){return arguments.length?(d=a,i):d},i.key=function(a){return arguments.length?(e=a,i):e},i.color=function(b){return arguments.length?(f=a.utils.getColor(b),i):f},i.align=function(a){return arguments.length?(g=a,i):g},i},a.models.line=function(){function q(a){return a.each(function(a){var q=d-c.left-c.right,r=e-c.top-c.bottom,s=d3.select(this);l=b.xScale(),m=b.yScale(),o=o||l,p=p||m;var t=s.selectAll("g.nv-wrap.nv-line").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-groups"),w.append("g").attr("class","nv-scatterWrap"),t.attr("transform","translate("+c.left+","+c.top+")"),b.width(q).height(r);var A=t.select(".nv-scatterWrap");d3.transition(A).call(b),v.append("clipPath").attr("id","nv-edge-clip-"+b.id()).append("rect"),t.select("#nv-edge-clip-"+b.id()+" rect").attr("width",q).attr("height",r),z.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":""),A.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":"");var B=t.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return f(a,b)}).style("stroke",function(a,b){return f(a,b)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.5);var C=B.selectAll("path.nv-area").data(function(a){return j(a)?[a]:[]});C.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(B.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var D=B.selectAll("path.nv-line").data(function(a){return[a.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y(function(a,b){return p(h(a,b))})),d3.transition(B.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(D).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))})),o=l.copy(),p=m.copy()}),q}var b=a.models.scatter(),c={top:0,right:0,bottom:0,left:0},d=960,e=500,f=a.utils.defaultColor(),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";b.size(16).sizeDomain([16,256]);var o,p;return q.dispatch=b.dispatch,q.scatter=b,d3.rebind(q,b,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){return arguments.length?(c.top=typeof a.top!="undefined"?a.top:c.top,c.right=typeof a.right!="undefined"?a.right:c.right,c.bottom=typeof a.bottom!="undefined"?a.bottom:c.bottom,c.left=typeof a.left!="undefined"?a.left:c.left,q):c},q.width=function(a){return arguments.length?(d=a,q):d},q.height=function(a){return arguments.length?(e=a,q):e},q.x=function(a){return arguments.length?(g=a,b.x(a),q):g},q.y=function(a){return arguments.length?(h=a,b.y(a),q):h},q.clipEdge=function(a){return arguments.length?(k=a,q):k},q.color=function(c){return arguments.length?(f=a.utils.getColor(c),b.color(f),q):f},q.interpolate=function(a){return arguments.length?(n=a,q):n},q.defined=function(a){return arguments.length?(i=a,q):i},q.isArea=function(a){return arguments.length?(j=d3.functor(a),q):j},q},a.models.lineChart=function(){function r(a){return a.each(function(l){var s=d3.select(this),t=this,u=(h||parseInt(s.style("width"))||960)-f.left-f.right,v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom;r.update=function(){r(a)},r.container=this;if(!l||!l.length||!l.filter(function(a){return a.values.length}).length){var w=s.selectAll(".nv-noData").data([o]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",f.left+u/2).attr("y",f.top+v/2).text(function(a){return a}),r}s.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale();var z=s.selectAll("g.nv-wrap.nv-lineChart").data([l]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),B=z.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-linesWrap"),A.append("g").attr("class","nv-legendWrap"),j&&(e.width(u),B.select(".nv-legendWrap").datum(l).call(e),f.top!=e.height()&&(f.top=e.height(),v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom),z.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),z.attr("transform","translate("+f.left+","+f.top+")"),b.width(u).height(v).color(l.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!l[b].disabled}));var C=B.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled}));d3.transition(C).call(b),c.scale(m).ticks(u/100).tickSize(-v,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(B.select(".nv-x.nv-axis")).call(c),d.scale(n).ticks(v/36).tickSize(-u,0),d3.transition(B.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l.filter(function(a){return!a.disabled}).length||l.map(function(a){return a.disabled=!1,z.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(r)}),p.on("tooltipShow",function(a){k&&q(a,t.parentNode)})}),r}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f={top:30,right:20,bottom:50,left:60},g=a.utils.defaultColor(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},m,n,o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var q=function(e,f){if(f){var g=d3.select(f).select("svg"),h=g.attr("viewBox");if(h){h=h.split(" ");var i=parseInt(g.style("width"))/h[2];e.pos[0]=e.pos[0]*i,e.pos[1]=e.pos[1]*i}}var j=e.pos[0]+(f.offsetLeft||0),k=e.pos[1]+(f.offsetTop||0),m=c.tickFormat()(b.x()(e.point,e.pointIndex)),n=d.tickFormat()(b.y()(e.point,e.pointIndex)),o=l(e.series.key,m,n,e,r);a.tooltip.show([j,k],o,null,null,f)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){k&&a.tooltip.cleanup()}),r.dispatch=p,r.lines=b,r.legend=e,r.xAxis=c,r.yAxis=d,d3.rebind(r,b,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){return arguments.length?(f.top=typeof a.top!="undefined"?a.top:f.top,f.right=typeof a.right!="undefined"?a.right:f.right,f.bottom=typeof a.bottom!="undefined"?a.bottom:f.bottom,f.left=typeof a.left!="undefined"?a.left:f.left,r):f},r.width=function(a){return arguments.length?(h=a,r):h},r.height=function(a){return arguments.length?(i=a,r):i},r.color=function(b){return arguments.length?(g=a.utils.getColor(b),e.color(g),r):g},r.showLegend=function(a){return arguments.length?(j=a,r):j},r.tooltips=function(a){return arguments.length?(k=a,r):k},r.tooltipContent=function(a){return arguments.length?(l=a,r):l},r.noData=function(a){return arguments.length?(o=a,r):o},r},a.models.linePlusBarChart=function(){function w(a){return a.each(function(p){var y=d3.select(this),z=this,A=(i||parseInt(y.style("width"))||960)-h.left-h.right,B=(j||parseInt(y.style("height"))||400)-h.top-h.bottom;w.update=function(){w(a)},w.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=y.selectAll(".nv-noData").data([t]);return C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",h.left+A/2).attr("y",h.top+B/2).text(function(a){return a}),w}y.selectAll(".nv-noData").remove(),q=d.scale(),r=c.yScale(),s=b.yScale();var D=p.filter(function(a){return!a.disabled&&a.bar}),E=p.filter(function(a){return!a.bar}),F=p.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:k(a,b),y:l(a,b)}})}),G=p.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:k(a,b),y:l(a,b)}})});q.domain(d3.extent(d3.merge(F.concat(G)),function(a){return a.x})).range([0,A]);var H=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([p]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),J=H.select("g");I.append("g").attr("class","nv-x nv-axis"),I.append("g").attr("class","nv-y1 nv-axis"),I.append("g").attr("class","nv-y2 nv-axis"),I.append("g").attr("class","nv-barsWrap"),I.append("g").attr("class","nv-linesWrap"),I.append("g").attr("class","nv-legendWrap"),n&&(g.width(A/2),J.select(".nv-legendWrap").datum(p.map(function(a){return a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)"),a})).call(g),h.top!=g.height()&&(h.top=g.height(),B=(j||parseInt(y.style("height"))||400)-h.top-h.bottom),J.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -h.top+")")),H.attr("transform","translate("+h.left+","+h.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!p[b].disabled&&!p[b].bar})),c.width(A).height(B).color(p.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!p[b].disabled&&p[b].bar}));var K=J.select(".nv-barsWrap").datum(D.length?D:[{values:[]}]),L=J.select(".nv-linesWrap").datum(E[0].disabled?[{values:[]}]:E);d3.transition(K).call(c),d3.transition(L).call(b),d.ticks(A/100).tickSize(-B,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(d),e.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(J.select(".nv-y1.nv-axis")).style("opacity",D.length?1:0).call(e),f.scale(s).ticks(B/36).tickSize(D.length?0:-A,0),J.select(".nv-y2.nv-axis").style("opacity",E.length?1:0).attr("transform","translate("+q.range()[1]+",0)"),d3.transition(J.select(".nv-y2.nv-axis")).call(f),g.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){return a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(w)}),u.on("tooltipShow",function(a){o&&v(a,z.parentNode)})}),w}var b=a.models.line(),c=a.models.historicalBar(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.legend(),h={top:30,right:60,bottom:50,left:60},i=null,j=null,k=function(a){return a.x},l=function(a){return a.y},m=a.utils.defaultColor(),n=!0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},q,r,s,t="No Data Available.",u=d3.dispatch("tooltipShow","tooltipHide");b.clipEdge(!1),d.orient("bottom").tickPadding(7),e.orient("left"),f.orient("right");var v=function(c,g){var h=c.pos[0]+(g.offsetLeft||0),i=c.pos[1]+(g.offsetTop||0),j=d.tickFormat()(b.x()(c.point,c.pointIndex)),k=(c.series.bar?e:f).tickFormat()(b.y()(c.point,c.pointIndex)),l=p(c.series.key,j,k,c,w);a.tooltip.show([h,i],l,c.value<0?"n":"s",null,g)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),c.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),c.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),w.dispatch=u,w.legend=g,w.lines=b,w.bars=c,w.xAxis=d,w.y1Axis=e,w.y2Axis=f,d3.rebind(w,b,"defined","size","clipVoronoi","interpolate"),w.x=function(a){return arguments.length?(k=a,b.x(a),c.x(a),w):k},w.y=function(a){return arguments.length?(l=a,b.y(a),c.y(a),w):l},w.margin=function(a){return arguments.length?(h.top=typeof a.top!="undefined"?a.top:h.top,h.right=typeof a.right!="undefined"?a.right:h.right,h.bottom=typeof a.bottom!="undefined"?a.bottom:h.bottom,h.left=typeof a.left!="undefined"?a.left:h.left,w):h},w.width=function(a){return arguments.length?(i=a,w):i},w.height=function(a){return arguments.length?(j=a,w):j},w.color=function(b){return arguments.length?(m=a.utils.getColor(b),g.color(m),w):m},w.showLegend=function(a){return arguments.length?(n=a,w):n},w.tooltips=function(a){return arguments.length?(o=a,w):o},w.tooltipContent=function(a){return arguments.length?(p=a,w):p},w.noData=function(a){return arguments.length?(t=a,w):t},w},a.models.lineWithFocusChart=function(){function A(a){return a.each(function(w){function P(a){var b=+(a=="e"),c=b?1:-1,d=F/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 Q(){i.empty()||i.extent(u),N.data([i.empty()?r.domain():u]).each(function(a,b){var c=r(a[0])-p.range()[0],d=p.range()[1]-r(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",r(a[1])).attr("width",d<0?0:d)})}function R(){u=i.empty()?null:i.extent(),extent=i.empty()?r.domain():i.extent(),y.brush({extent:extent,brush:i}),Q();var a=J.select(".nv-focus .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}).map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return b.x()(a,c)>=extent[0]&&b.x()(a,c)<=extent[1]})}}));d3.transition(a).call(b),d3.transition(J.select(".nv-focus .nv-x.nv-axis")).call(d),d3.transition(J.select(".nv-focus .nv-y.nv-axis")).call(e)}var B=d3.select(this),C=this,D=(m||parseInt(B.style("width"))||960)-j.left-j.right,E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o,F=o-k.top-k.bottom;A.update=function(){A(a)},A.container=this;if(!w||!w.length||!w.filter(function(a){return a.values.length}).length){var G=B.selectAll(".nv-noData").data([x]);return G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),G.attr("x",j.left+D/2).attr("y",j.top+E/2).text(function(a){return a}),A}B.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale(),r=c.xScale(),s=c.yScale();var H=B.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([w]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),J=H.select("g");I.append("g").attr("class","nv-legendWrap");var K=I.append("g").attr("class","nv-focus");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");var L=I.append("g").attr("class","nv-context");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-brushBackground"),L.append("g").attr("class","nv-x nv-brush"),t&&(h.width(D),J.select(".nv-legendWrap").datum(w).call(h),j.top!=h.height()&&(j.top=h.height(),E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -j.top+")")),H.attr("transform","translate("+j.left+","+j.top+")"),b.width(D).height(E).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),c.defined(b.defined()).width(D).height(F).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),J.select(".nv-context").attr("transform","translate(0,"+(E+j.bottom+k.top)+")");var M=J.select(".nv-context .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}));d3.transition(M).call(c),d.scale(p).ticks(D/100).tickSize(-E,0),e.scale(q).ticks(E/36).tickSize(-D,0),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+E+")"),i.x(r).on("brush",R),u&&i.extent(u);var N=J.select(".nv-brushBackground").selectAll("g").data([u||i.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=J.select(".nv-x.nv-brush").call(i),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",P),R(),f.scale(r).ticks(D/100).tickSize(-F,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(f),g.scale(s).ticks(F/36).tickSize(-D,0),d3.transition(J.select(".nv-context .nv-y.nv-axis")).call(g),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),h.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w.filter(function(a){return!a.disabled}).length||w.map(function(a){return a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(A)}),y.on("tooltipShow",function(a){v&&z(a,C.parentNode)})}),A}var b=a.models.line(),c=a.models.line(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=d3.svg.brush(),j={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},l=a.utils.defaultColor(),m=null,n=null,o=100,p,q,r,s,t=!0,u=null,v=!0,w=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},x="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide","brush");b.clipEdge(!0),c.interactive(!1),d.orient("bottom").tickPadding(5),e.orient("left"),f.orient("bottom").tickPadding(5),g.orient("left");var z=function(c,f){var g=c.pos[0]+(f.offsetLeft||0),h=c.pos[1]+(f.offsetTop||0),i=d.tickFormat()(b.x()(c.point,c.pointIndex)),j=e.tickFormat()(b.y()(c.point,c.pointIndex)),k=w(c.series.key,i,j,c,A);a.tooltip.show([g,h],k,null,null,f)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],y.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){v&&a.tooltip.cleanup()}),A.dispatch=y,A.legend=h,A.lines=b,A.lines2=c,A.xAxis=d,A.yAxis=e,A.x2Axis=f,A.y2Axis=g,d3.rebind(A,b,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){return arguments.length?(b.x(a),c.x(a),A):b.x},A.y=function(a){return arguments.length?(b.y(a),c.y(a),A):b.y},A.margin=function(a){return arguments.length?(j.top=typeof a.top!="undefined"?a.top:j.top,j.right=typeof a.right!="undefined"?a.right:j.right,j.bottom=typeof a.bottom!="undefined"?a.bottom:j.bottom,j.left=typeof a.left!="undefined"?a.left:j.left,A):j},A.margin2=function(a){return arguments.length?(k=a,A):k},A.width=function(a){return arguments.length?(m=a,A):m},A.height=function(a){return arguments.length?(n=a,A):n},A.height2=function(a){return arguments.length?(o=a,A):o},A.color=function(b){return arguments.length?(l=a.utils.getColor(b),h.color(l),A):l},A.showLegend=function(a){return arguments.length?(t=a,A):t},A.tooltips=function(a){return arguments.length?(v=a,A):v},A.tooltipContent=function(a){return arguments.length?(w=a,A):w},A.interpolate=function(a){return arguments.length?(b.interpolate(a),c.interpolate(a),A):b.interpolate()},A.noData=function(a){return arguments.length?(x=a,A):x},A.xTickFormat=function(a){return arguments.length?(d.tickFormat(a),f.tickFormat(a),A):d.tickFormat()},A.yTickFormat=function(a){return arguments.length?(e.tickFormat(a),g.tickFormat(a),A):e.tickFormat()},A},a.models.multiBar=function(){function t(a){return a.each(function(a){var t=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var w=o&&p?[]:a.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(w).map(function(a){return a.x})).rangeBands([0,t],.1),f.domain(p||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([u,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 z=v.selectAll("g.nv-wrap.nv-multibar").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")"),B.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),z.select("#nv-edge-clip-"+g+" rect").attr("width",t).attr("height",u),D.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6 +).style("fill-opacity",1e-6),d3.transition(E.exit()).selectAll("rect.nv-bar").delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),E.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(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("rect.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return l?0:d*e.rangeBand()/a.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:a.length));F.style("fill",function(a,b,c){return m(a,c,b)}).style("stroke",function(a,b,c){return m(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){q.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){q.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),F.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(F).delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.max(Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(b,c){return l?0:b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/(l?1:a.length))}):d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("x",function(b,c){return b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/a.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(0)-f(i(a,b))<1?f(0)-1:f(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(f(i(a,b))-f(0)),1)})}),r=e.copy(),s=f.copy()}),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;return t.dispatch=q,t.x=function(a){return arguments.length?(h=a,t):h},t.y=function(a){return arguments.length?(i=a,t):i},t.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,t):b},t.width=function(a){return arguments.length?(c=a,t):c},t.height=function(a){return arguments.length?(d=a,t):d},t.xScale=function(a){return arguments.length?(e=a,t):e},t.yScale=function(a){return arguments.length?(f=a,t):f},t.xDomain=function(a){return arguments.length?(o=a,t):o},t.yDomain=function(a){return arguments.length?(p=a,t):p},t.forceY=function(a){return arguments.length?(j=a,t):j},t.stacked=function(a){return arguments.length?(l=a,t):l},t.clipEdge=function(a){return arguments.length?(k=a,t):k},t.color=function(b){return arguments.length?(m=a.utils.getColor(b),t):m},t.id=function(a){return arguments.length?(g=a,t):g},t.delay=function(a){return arguments.length?(n=a,t):n},t},a.models.multiBarChart=function(){function v(a){return a.each(function(p){var w=d3.select(this),z=this,A=(h||parseInt(w.style("width"))||960)-g.left-g.right,B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom;v.update=function(){a.transition().call(v)},v.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=w.selectAll(".nv-noData").data([s]);return C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",g.left+A/2).attr("y",g.top+B/2).text(function(a){return a}),v}w.selectAll(".nv-noData").remove(),q=b.xScale(),r=b.yScale();var D=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([p]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-controlsWrap"),l&&(e.width(A/2),F.select(".nv-legendWrap").datum(p).call(e),g.top!=e.height()&&(g.top=e.height(),B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom),F.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -g.top+")"));if(k){var G=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),F.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+ -g.top+")").call(f)}D.attr("transform","translate("+g.left+","+g.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!p[b].disabled}));var H=F.select(".nv-barsWrap").datum(p.filter(function(a){return!a.disabled}));d3.transition(H).call(b),c.scale(q).ticks(A/100).tickSize(-B,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(c);var I=F.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1),m&&I.filter(function(a,b){return b%Math.ceil(p[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),n&&I.selectAll("text").attr("transform",function(a,b,c){return"rotate("+n+" 0,0)"}).attr("text-transform",n>0?"start":"end"),F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),d.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(F.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){return a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(v)}),f.dispatch.on("legendClick",function(c,d){if(!c.disabled)return;G=G.map(function(a){return a.disabled=!0,a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(v)}),t.on("tooltipShow",function(a){o&&u(a,z.parentNode)})}),v}var b=a.models.multiBar(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:20,bottom:30,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!0,n=0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" on "+b+"

"},q,r,s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");b.stacked(!1),c.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var u=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=p(e.series.key,i,j,e,v);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),v.dispatch=t,v.multibar=b,v.legend=e,v.xAxis=c,v.yAxis=d,d3.rebind(v,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){return arguments.length?(g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left,v):g},v.width=function(a){return arguments.length?(h=a,v):h},v.height=function(a){return arguments.length?(i=a,v):i},v.color=function(b){return arguments.length?(j=a.utils.getColor(b),e.color(j),v):j},v.showControls=function(a){return arguments.length?(k=a,v):k},v.showLegend=function(a){return arguments.length?(l=a,v):l},v.reduceXTicks=function(a){return arguments.length?(m=a,v):m},v.rotateLabels=function(a){return arguments.length?(n=a,v):n},v.tooltip=function(a){return arguments.length?(p=a,v):p},v.tooltips=function(a){return arguments.length?(o=a,v):o},v.tooltipContent=function(a){return arguments.length?(p=a,v):p},v.noData=function(a){return arguments.length?(s=a,v):s},v},a.models.multiBarHorizontal=function(){function v(a){return a.each(function(a){var e=c-b.left-b.right,p=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var w=q&&r?[]:a.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(w).map(function(a){return a.x})).rangeBands([0,p],.1),g.domain(r||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,e-(g.domain()[1]>0?n:0)]):g.range([0,e]),t=t||f,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var z=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.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(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+u(l?b.y0:0)+","+(l?0:d*f.rangeBand()/a.length+f(h(b,c)))+")"});G.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),s.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[g(i(b,c)+(l?b.y0:0)),f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),s.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){s.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){s.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(G.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),F.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(F).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):F.selectAll("text").remove(),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(F).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(F).attr("transform",function(b,c){return"translate("+(i(b,c)<0?g(i(b,c)):g(0))+","+(b.series*f.rangeBand()/a.length+f(h(b,c)))+")"}).select("rect").attr("height",f.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)}),t=f.copy(),u=g.copy()}),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=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),t,u;return v.dispatch=s,v.x=function(a){return arguments.length?(h=a,v):h},v.y=function(a){return arguments.length?(i=a,v):i},v.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,v):b},v.width=function(a){return arguments.length?(c=a,v):c},v.height=function(a){return arguments.length?(d=a,v):d},v.xScale=function(a){return arguments.length?(f=a,v):f},v.yScale=function(a){return arguments.length?(g=a,v):g},v.xDomain=function(a){return arguments.length?(q=a,v):q},v.yDomain=function(a){return arguments.length?(r=a,v):r},v.forceY=function(a){return arguments.length?(j=a,v):j},v.stacked=function(a){return arguments.length?(l=a,v):l},v.color=function(b){return arguments.length?(k=a.utils.getColor(b),v):k},v.id=function(a){return arguments.length?(e=a,v):e},v.delay=function(a){return arguments.length?(p=a,v):p},v.showValues=function(a){return arguments.length?(m=a,v):m},v.valueFormat=function(a){return arguments.length?(o=a,v):o},v.valuePadding=function(a){return arguments.length?(n=a,v):n},v},a.models.multiBarHorizontalChart=function(){function u(a){return a.each(function(m){var o=d3.select(this),v=this,w=(h||parseInt(o.style("width"))||960)-g.left-g.right,z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom;u.update=function(){a.transition().call(u)},u.container=this;if(!m||!m.length||!m.filter(function(a){return a.values.length}).length){var A=o.selectAll(".nv-noData").data([r]);return A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",g.left+w/2).attr("y",g.top+z/2).text(function(a){return a}),u}o.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();var B=o.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([m]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),D=B.select("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-barsWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap"),l&&(e.width(w/2),D.select(".nv-legendWrap").datum(m).call(e),g.top!=e.height()&&(g.top=e.height(),z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom),D.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -g.top+")"));if(k){var E=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(E).attr("transform","translate(0,"+ -g.top+")").call(f)}B.attr("transform","translate("+g.left+","+g.top+")"),b.width(w).height(z).color(m.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!m[b].disabled}));var F=D.select(".nv-barsWrap").datum(m.filter(function(a){return!a.disabled}));d3.transition(F).call(b),c.scale(p).ticks(z/24).tickSize(-w,0),d3.transition(D.select(".nv-x.nv-axis")).call(c);var G=D.select(".nv-x.nv-axis").selectAll("g");G.selectAll("line, text").style("opacity",1),d.scale(q).ticks(w/100).tickSize(-z,0),D.select(".nv-y.nv-axis").attr("transform","translate(0,"+z+")"),d3.transition(D.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,m.filter(function(a){return!a.disabled}).length||m.map(function(a){return a.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(u)}),f.dispatch.on("legendClick",function(c,d){if(!c.disabled)return;E=E.map(function(a){return a.disabled=!0,a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(u)}),s.on("tooltipShow",function(a){n&&t(a,v.parentNode)})}),u}var b=a.models.multiBarHorizontal(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend().height(30),f=a.models.legend().height(30),g={top:30,right:20,bottom:50,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!1,n=!0,o=function(a,b,c,d,e){return"

"+a+" - "+b+"

"+"

"+c+"

"},p,q,r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");b.stacked(m),c.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("bottom").tickFormat(d3.format(",.1f"));var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"e":"w",null,f)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),u.dispatch=s,u.multibar=b,u.legend=e,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),u.margin=function(a){return arguments.length?(g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left,u):g},u.width=function(a){return arguments.length?(h=a,u):h},u.height=function(a){return arguments.length?(i=a,u):i},u.color=function(b){return arguments.length?(j=a.utils.getColor(b),e.color(j),u):j},u.showControls=function(a){return arguments.length?(k=a,u):k},u.showLegend=function(a){return arguments.length?(l=a,u):l},u.tooltip=function(a){return arguments.length?(o=a,u):o},u.tooltips=function(a){return arguments.length?(n=a,u):n},u.tooltipContent=function(a){return arguments.length?(o=a,u):o},u.noData=function(a){return arguments.length?(r=a,u):r},u},a.models.multiChart=function(){function y(a){return 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){return a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)"),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){return a.disabled=!1,K.selectAll(".series").classed("disabled",!1),a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this,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"

"+a+"

"+"

"+c+" at "+b+"

"},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)};return 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))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!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))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!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){return arguments.length?(getX=a,m.x(a),o.x(a),y):getX},y.y=function(a){return arguments.length?(getY=a,m.y(a),o.y(a),y):getY},y.margin=function(a){return arguments.length?(b=a,y):b},y.width=function(a){return arguments.length?(d=a,y):d},y.height=function(a){return arguments.length?(e=a,y):e},y.color=function(a){return arguments.length?(c=a,v.color(a),y):c},y.showLegend=function(a){return arguments.length?(f=a,y):f},y.tooltips=function(a){return arguments.length?(g=a,y):g},y.tooltipContent=function(a){return arguments.length?(h=a,y):h},y},a.models.ohlcBar=function(){function u(a){return a.each(function(a){var q=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);f.domain(r||d3.extent(a[0].values.map(h).concat(n))).range([0,q]),g.domain(s||[d3.min(a[0].values.map(m).concat(o)),d3.max(a[0].values.map(l).concat(o))]).range([u,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;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])),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]));var 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("defs"),B=z.append("g"),C=w.select("g");B.append("g").attr("class","nv-ticks"),w.attr("transform","translate("+b.left+","+b.top+")"),v.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:e})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",u),C.attr("clip-path",p?"url(#nv-chart-clip-path-"+e+")":"");var 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(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){t.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){t.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})}),u}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=function(a){return a.open},k=function(a){return a.close},l=function(a){return a.high},m=function(a){return a.low},n=[],o=[],p=!0,q=a.utils.defaultColor(),r,s,t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return u.dispatch=t,u.x=function(a){return arguments.length?(h=a,u):h},u.y=function(a){return arguments.length?(i=a,u):i},u.open=function(a){return arguments.length?(j=a,u):j},u.close=function(a){return arguments.length?(k=a,u):k},u.high=function(a){return arguments.length?(l=a,u):l},u.low=function(a){return arguments.length?(m=a,u):m},u.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,u):b},u.width=function(a){return arguments.length?(c=a,u):c},u.height=function(a){return arguments.length?(d=a,u):d},u.xScale=function(a){return arguments.length?(f=a,u):f},u.yScale=function(a){return arguments.length?(g=a,u):g},u.xDomain=function(a){return arguments.length?(r=a,u):r},u.yDomain=function(a){return arguments.length?(s=a,u):s},u.forceX=function(a){return arguments.length?(n=a,u):n},u.forceY=function(a){return arguments.length?(o=a,u):o},u.clipEdge=function(a){return arguments.length?(p=a,u):p},u.color=function(b){return arguments.length?(q=a.utils.getColor(b),u):q},u.id=function(a){return arguments.length?(e=a,u):e},u},a.models.pie=function(){function p(a){return a.each(function(a){function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);return this._current=b(0),function(a){return w(b(a))}}function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this),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+")"),r.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})});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){return a.outerRadius=q+10,a.innerRadius=q+15,"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){return a.outerRadius=q+10,a.innerRadius=q+15,"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]+")"})})}}),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");return p.dispatch=o,p.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,p):b},p.width=function(a){return arguments.length?(c=a,p):c},p.height=function(a){return arguments.length?(d=a,p):d},p.values=function(a){return arguments.length?(e=a,p):e},p.x=function(a){return arguments.length?(f=a,p):f},p.y=function(a){return arguments.length?(g=d3.functor(a),p):g},p.showLabels=function(a){return arguments.length?(k=a,p):k},p.donutLabelsOutside=function(a){return arguments.length?(l=a,p):l},p.donut=function(a){return arguments.length?(n=a,p):n},p.id=function(a){return arguments.length?(h=a,p):h},p.color=function(b){return arguments.length?(i=a.utils.getColor(b),p):i},p.valueFormat=function(a){return arguments.length?(j=a,p):j},p.labelThreshold=function(a){return arguments.length?(m=a,p):m},p},a.models.pieChart=function(){function n(a){return a.each(function(h){var i=d3.select(this),j=this,m=(e||parseInt(i.style("width"))||960)-d.left-d.right,o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom;n.update=function(){n(a)},n.container=this;if(!h||!h.length){var p=i.selectAll(".nv-noData").data([k]);return p.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),p.attr("x",d.left+m/2).attr("y",d.top+o/2).text(function(a){return a}),n}i.selectAll(".nv-noData").remove();var q=i.selectAll("g.nv-wrap.nv-pieChart").data([h]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),s=q.select("g");r.append("g").attr("class","nv-pieWrap"),r.append("g").attr("class","nv-legendWrap"),g&&(c.width(m).key(b.x()),q.select(".nv-legendWrap").datum(b.values()(h[0])).call(c),d.top!=c.height()&&(d.top=c.height(),o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom),q.select(".nv-legendWrap").attr("transform","translate(0,"+ -d.top+")")),q.attr("transform","translate("+d.left+","+d.top+")"),b.width(m).height(o);var t=s.select(".nv-pieWrap").datum(h);d3.transition(t).call(b),c.dispatch.on("legendClick",function(c,d,e){c.disabled=!c.disabled,b.values()(h[0]).filter(function(a){return!a.disabled}).length||b.values()(h[0]).map(function(a){return a.disabled=!1,q.selectAll(".nv-series").classed("disabled",!1),a}),a.transition().call(n)}),b.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)})}),n}var b=a.models.pie(),c=a.models.legend(),d={top:30,right:20,bottom:20,left:20},e=null,f=null,g=!0,h=a.utils.defaultColor(),i=!0,j=function(a,b,c,d){return"

"+a+"

"+"

"+b+"

"},k="No Data Available.",l=d3.dispatch("tooltipShow","tooltipHide"),m=function(c,d){var e=c.pos[0]+(d&&d.offsetLeft||0),f=c.pos[1]+(d&&d.offsetTop||0),g=b.valueFormat()(b.y()(c.point)),h=j(b.x()(c.point),g,c,n);a.tooltip.show([e,f],h,c.value<0?"n":"s",null,d)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+d.left,a.pos[1]+d.top],l.tooltipShow(a)}),l.on("tooltipShow",function(a){i&&m(a)}),l.on("tooltipHide",function(){i&&a.tooltip.cleanup()}),n.dispatch=l,n.pie=b,d3.rebind(n,b,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){return arguments.length?(d.top=typeof a.top!="undefined"?a.top:d.top,d.right=typeof a.right!="undefined"?a.right:d.right,d.bottom=typeof a.bottom!="undefined"?a.bottom:d.bottom,d.left=typeof a.left!="undefined"?a.left:d.left,n):d},n.width=function(a){return arguments.length?(e=a,n):e},n.height=function(a){return arguments.length?(f=a,n):f},n.color=function(d){return arguments.length?(h=a.utils.getColor(d),c.color(h),b.color(h),n):h},n.showLegend=function(a){return arguments.length?(g=a,n):g},n.tooltips=function(a){return arguments.length?(i=a,n):i},n.tooltipContent=function(a){return arguments.length?(j=a,n):j},n.noData=function(a){return arguments.length?(k=a,n):k},n},a.models.scatter=function(){function H(a){return a.each(function(a){function Q(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c,a]}).filter(function(a,b){return r(a[4],b)})}));if(t){N.append("clipPath").attr("id","nv-points-clip-"+f);var e=L.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]}),L.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){d.length<3&&(d.push([g.range()[0]-20,h.range()[0]-20,null,null]),d.push([g.range()[1]+20,h.range()[1]+20,null,null]));var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=L.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=L.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){if(G)return 0;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){if(G)return 0;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){if(G)return 0;var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})}),G=!1}var H=c-b.left-b.right,I=d-b.top-b.bottom,J=d3.select(this);a=a.map(function(a,b){return a.values=a.values.map(function(a){return a.series=b,a}),a});var K=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(K.map(function(a){return a.x}).concat(n))).range([0,H]),h.domain(w||d3.extent(K.map(function(a){return a.y}).concat(o))).range([I,0]),i.domain(x||d3.extent(K.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 L=J.selectAll("g.nv-wrap.nv-scatter").data([a]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),O.append("g").attr("class","nv-point-paths"),L.attr("transform","translate("+b.left+","+b.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),L.select("#nv-edge-clip-"+f+" rect").attr("width",H).attr("height",I),P.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":""),G=!0;var R=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(R.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),R.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(R).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 S=R.selectAll("path.nv-point").data(function(a){return a.values});S.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))})),S.exit().remove(),d3.transition(R.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),S.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(S).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(Q,1e3),C=g.copy(),D=h.copy(),E=i.copy()}),H}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||1},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,G=!1;return 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)}),H.dispatch=A,H.x=function(a){return arguments.length?(j=d3.functor(a),H):j},H.y=function(a){return arguments.length?(k=d3.functor(a),H):k},H.size=function(a){return arguments.length?(l=d3.functor(a),H):l},H.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,H):b},H.width=function(a){return arguments.length?(c=a,H):c},H.height=function(a){return arguments.length?(d=a,H):d},H.xScale=function(a){return arguments.length?(g=a,H):g},H.yScale=function(a){return arguments.length?(h=a,H):h},H.zScale=function(a){return arguments.length?(i=a,H):i},H.xDomain=function(a){return arguments.length?(v=a,H):v},H.yDomain=function(a){return arguments.length?(w=a,H):w},H.sizeDomain=function(a){return arguments.length?(x=a,H):x},H.sizeRange=function(a){return arguments.length?(y=a,H):y},H.forceX=function(a){return arguments.length?(n=a,H):n},H.forceY=function(a){return arguments.length?(o=a,H):o},H.forceSize=function(a){return arguments.length?(p=a,H):p},H.interactive=function(a){return arguments.length?(q=a,H):q},H.pointActive=function(a){return arguments.length?(r=a,H):r},H.clipEdge=function(a){return arguments.length?(s=a,H):s},H.clipVoronoi=function(a){return arguments.length?(t=a,H):t},H.useVoronoi=function(a){return arguments.length?(B=a,B===!1&&(t=!1),H):B},H.clipRadius=function(a){return arguments.length?(u=a,H):u},H.color=function(b){return arguments.length?(e=a.utils.getColor(b),H):e},H.shape=function(a){return arguments.length?(m=a,H):m},H.id=function(a){return arguments.length?(f=a,H):f},H.singlePoint=function(a){return arguments.length?(z=a,H):z},H},a.models.scatterChart=function(){function G(a){return a.each(function(x){function Q(){if(v)return N.select(".nv-point-paths").style("pointer-events","all"),!1;N.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(u).focus(a[0]),n.distortion(u).focus(a[1]),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d),N.select(".nv-distributionX").datum(x.filter(function(a){return!a.disabled})).call(g),N.select(".nv-distributionY").datum(x.filter(function(a){return!a.disabled})).call(h)}var y=d3.select(this),z=this,H=(j||parseInt(y.style("width"))||960)-i.left-i.right,I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom;G.update=function(){G(a)},G.container=this;if(!x||!x.length||!x.filter(function(a){return a.values.length}).length){var J=y.selectAll(".nv-noData").data([B]);return J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",i.left+H/2).attr("y",i.top+I/2).text(function(a){return a}),G}y.selectAll(".nv-noData").remove(),C=C||m,D=D||n;var K=y.selectAll("g.nv-wrap.nv-scatterChart").data([x]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),M=L.append("g"),N=K.select("g");M.append("rect").attr("class","nvd3 nv-background"),M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis"),M.append("g").attr("class","nv-scatterWrap"),M.append("g").attr("class","nv-distWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),s&&(e.width(H/2),K.select(".nv-legendWrap").datum(x).call(e),i.top!=e.height()&&(i.top=e.height(),I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom),K.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -i.top+")")),t&&(f.width(180).color(["#444"]),N.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -i.top+")").call(f)),K.attr("transform","translate("+i.left+","+i.top+")"),b.width(H).height(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),K.select(".nv-scatterWrap").datum(x.filter(function(a){return!a.disabled})).call(b);if(o){var O=m.domain()[1]-m.domain()[0];m.domain([m.domain()[0]-o*O,m.domain()[1]+o*O])}if(p){var P=n.domain()[1]-n.domain()[0];n.domain([n.domain()[0]-p*P,n.domain()[1]+p*P])}c.scale(m).ticks(c.ticks()&&c.ticks().length?c.ticks():H/100).tickSize(-I,0),N.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():I/36).tickSize(-H,0),N.select(".nv-y.nv-axis").call(d),q&&(g.getData(b.x()).scale(m).width(H).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),N.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(x.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(b.y()).scale(n).width(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),N.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(x.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(N.select(".nv-background").attr("width",H).attr("height",I),N.select(".nv-background").on("mousemove",Q),N.select(".nv-background").on("click",function(){v=!v}),b.dispatch.on("elementClick.freezeFisheye",function(){v=!v})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,u=e.disabled?0:2.5,N.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),N.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(u).focus(0),n.distortion(u).focus(0),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d)):v=!1,G(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,x.filter(function(a){return!a.disabled}).length||x.map(function(a){return a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1),a}),G(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-I),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],A.tooltipShow(a)}),A.on("tooltipShow",function(a){w&&E(a,z.parentNode)}),C=m.copy(),D=n.copy()}),G}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=0,p=0,q=!1,r=!1,s=!0,t=!!d3.fisheye,u=0,v=!1,w=!0,x=function(a,b,c){return""+b+""},y=function(a,b,c){return""+c+""},z=null,A=d3.dispatch("tooltipShow","tooltipHide"),B="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var C,D,E=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));x!=null&&a.tooltip.show([j,k],x(e.series.key,p,q,e,G),"n",1,f,"x-nvtooltip"),y!=null&&a.tooltip.show([l,o],y(e.series.key,p,q,e,G),"e",1,f,"y-nvtooltip"),z!=null&&a.tooltip.show([g,h],z(e.series.key,p,q,e,G),e.value<0?"n":"s",null,f)},F=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),A.on("tooltipHide",function(){w&&a.tooltip.cleanup()}),G.dispatch=A,G.scatter=b,G.legend=e,G.controls=f,G.xAxis=c,G.yAxis=d,G.distX=g,G.distY=h,d3.rebind(G,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),G.margin=function(a){return arguments.length?(i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left,G):i},G.width=function(a){return arguments.length?(j=a,G):j},G.height=function(a){return arguments.length?(k=a,G):k},G.color=function(b){return arguments.length?(l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l),G):l},G.showDistX=function(a){return arguments.length?(q=a,G):q},G.showDistY=function(a){return arguments.length?(r=a,G):r},G.showControls=function(a){return arguments.length?(t=a,G):t},G.showLegend=function(a){return arguments.length?(s=a,G):s},G.fisheye=function(a){return arguments.length?(u=a,G):u},G.xPadding=function(a){return arguments.length?(o=a,G):o},G.yPadding=function(a){return arguments.length?(p=a,G):p},G.tooltips=function(a){return arguments.length?(w=a,G):w},G.tooltipContent=function(a){return arguments.length?(z=a,G):z},G.tooltipXContent=function(a){return arguments.length?(x=a,G):x},G.tooltipYContent=function(a){return arguments.length?(y=a,G):y},G.noData=function(a){return arguments.length?(B=a,G):B},G},a.models.scatterPlusLineChart=function(){function E(a){return a.each(function(v){function O(){if(t)return L.select(".nv-point-paths").style("pointer-events","all"),!1;L.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(s).focus(a[0]),n.distortion(s).focus(a[1]),L.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d),L.select(".nv-distributionX").datum(v.filter(function(a){return!a.disabled})).call(g),L.select(".nv-distributionY").datum(v.filter(function(a){return!a.disabled})).call(h)}var w=d3.select(this),x=this,F=(j||parseInt(w.style("width"))||960)-i.left-i.right,G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom;E.update=function(){E(a)},E.container=this;if(!v||!v.length||!v.filter(function(a){return a.values.length}).length){var H=w.selectAll(".nv-noData").data([z]);return H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",i.left+F/2).attr("y",i.top+G/2).text(function(a){return a}),E}w.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale(),A=A||m,B=B||n;var I=w.selectAll("g.nv-wrap.nv-scatterChart").data([v]),J=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),K=J.append("g"),L=I.select("g");K.append("rect").attr("class","nvd3 nv-background"),K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-scatterWrap"),K.append("g").attr("class","nv-regressionLinesWrap"),K.append("g").attr("class","nv-distWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+i.left+","+i.top+")"),q&&(e.width(F/2),I.select(".nv-legendWrap").datum(v).call(e),i.top!=e.height()&&(i.top=e.height(),G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom),I.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -i.top+")")),r&&(f.width(180).color(["#444"]),L.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -i.top+")").call(f)),b.width(F).height(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),I.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var M=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a}),N=M.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);M.selectAll(".nv-regLines line").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(a,b){return n(m.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return n(m.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return l(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||typeof a.slope=="undefined"||typeof a.intercept=="undefined"?0:1}),c.scale(m).ticks(c.ticks()?c.ticks():F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()?d.ticks():G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").call(d),o&&(g.getData(b.x()).scale(m).width(F).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),L.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(v.filter(function(a){return!a.disabled})).call(g)),p&&(h.getData(b.y()).scale(n).width(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),L.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(v.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(L.select(".nv-background").attr("width",F).attr("height",G),L.select(".nv-background").on("mousemove",O),L.select(".nv-background").on("click",function(){t=!t}),b.dispatch.on("elementClick.freezeFisheye",function(){t=!t})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,s=e.disabled?0:2.5,L.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),L.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(s).focus(0),n.distortion(s).focus(0),L.select(".nv-scatterWrap").call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d)):t=!1,E(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,v.filter(function(a){return!a.disabled}).length||v.map(function(a){return a.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1),a}),E(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){u&&C(a,x.parentNode)}),A=m.copy(),B=n.copy()}),E}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=!1,p=!1,q=!0,r=!!d3.fisheye,s=0,t=!1,u=!0,v=function(a,b,c){return""+b+""},w=function(a,b,c){return""+c+""},x=null,y=d3.dispatch("tooltipShow","tooltipHide"),z="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var A,B,C=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));v!=null&&a.tooltip.show([j,k],v(e.series.key,p,q,e,E),"n",1,f,"x-nvtooltip"),w!=null&&a.tooltip.show([l,o],w(e.series.key,p,q,e,E),"e",1,f,"y-nvtooltip"),x!=null&&a.tooltip.show([g,h],x(e.series.key,p,q,e,E),e.value<0?"n":"s",null,f)},D=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),y.on("tooltipHide",function(){u&&a.tooltip.cleanup()}),E.dispatch=y,E.scatter=b,E.legend=e,E.controls=f,E.xAxis=c,E.yAxis=d,E.distX=g,E.distY=h,d3.rebind(E,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){return arguments.length?(i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left,E):i},E.width=function(a){return arguments.length?(j=a,E):j},E.height=function(a){return arguments.length?(k=a,E):k},E.color=function(b){return arguments.length?(l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l),E):l},E.showDistX=function(a){return arguments.length?(o=a,E):o},E.showDistY=function(a){return arguments.length?(p=a,E):p},E.showControls=function(a){return arguments.length?(r=a,E):r},E.showLegend=function(a){return arguments.length?(q=a,E):q},E.fisheye=function(a){return arguments.length?(s=a,E):s},E.tooltips=function(a){return arguments.length?(u=a,E):u},E.tooltipContent=function(a){return arguments.length?(x=a,E):x},E.tooltipXContent=function(a){return arguments.length?(v=a,E):v},E.tooltipYContent=function(a){return arguments.length?(w=a,E):w},E.noData=function(a){return arguments.length?(z=a,E):z},E},a.models.sparkline=function(){function m(a){return a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom,n=d3.select(this);f.domain(k||d3.extent(a,h)).range([0,e]),g.domain(l||d3.extent(a,i)).range([m,0]);var o=n.selectAll("g.nv-wrap.nv-sparkline").data([a]),p=o.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),q=p.append("g"),r=o.select("g");o.attr("transform","translate("+b.left+","+b.top+")");var s=o.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||j(a,b)}).attr("d",d3.svg.line().x(function(a,b){return f(h(a,b))}).y(function(a,b){return g(i(a,b))}));var t=o.selectAll("circle.nv-point").data(function(a){function c(b){if(b!=-1){var c=a[b];return c.pointIndex=b,c}return null}var b=a.map(function(a,b){return i(a,b)}),d=c(b.lastIndexOf(g.domain()[1])),e=c(b.indexOf(g.domain()[0])),f=c(b.length-1);return[e,d,f].filter(function(a){return a!=null})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return f(h(a,a.pointIndex))}).attr("cy",function(a,b){return g(i(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return h(a,a.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":i(a,a.pointIndex)==g.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),m}var b={top:2,right:0,bottom:2,left:0},c=400,d=32,e=!0,f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=a.utils.getColor(["#000"]),k,l;return m.margin=function(a){return arguments.length?(b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left,m):b},m.width=function(a){return arguments.length?(c=a,m):c},m.height=function(a){return arguments.length?(d=a,m):d},m.x=function(a){return arguments.length?(h=d3.functor(a),m):h},m.y=function(a){return arguments.length?(i=d3.functor(a),m):i},m.xScale=function(a){return arguments.length?(f=a,m):f},m.yScale=function(a){return arguments.length?(g=a,m):g},m.xDomain=function(a){return arguments.length?(k=a,m):k},m.yDomain=function(a){return arguments.length?(l=a,m):l},m.animate=function(a){return arguments.length?(e=a,m):e},m.color=function(b){return arguments.length?(j=a.utils.getColor(b),m):j},m},a.models.sparklinePlus=function(){function n(a){return a.each(function(l){function C(){if(i)return;var a=w.selectAll(".nv-hoverValue").data(h),d=a.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);a.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),a.attr("transform",function(a){return"translate("+f(b.x()(l[a],a))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!h.length)return;d.append("line").attr("x1",0).attr("y1",-c.top).attr("x2",0).attr("y2",q),d.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-c.top).attr("text-anchor","end").attr("dy",".9em"),w.select(".nv-hoverValue .nv-xValue").text(j(b.x()(l[h[0]],h[0]))),d.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-c.top).attr("text-anchor","start").attr("dy",".9em"),w.select(".nv-hoverValue .nv-yValue").text(k(b.y()(l[h[0]],h[0])))}function D(){function d(a,c){var d=Math.abs(b.x()(a[0],0)-c),e=0;for(var f=0;f"+a+""+"

"+c+" on "+b+"

"},o,p,q=d3.format(",.2f"),r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left"),b.scatter.pointActive(function(a){return!!Math.round(b.y()(a)*100)});var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=n(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};return b.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){m&&a.tooltip.cleanup()}),u.dispatch=s,u.stacked=b,u.legend=e,u.controls=f,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),u.margin=function(a){return arguments.length?(g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left,u):g},u.width=function(a){return arguments.length?(h=a,u):getWidth},u.height=function(a){return arguments.length?(i=a,u):getHeight},u.color=function(c){return arguments.length?(j=a.utils.getColor(c),e.color(j),b.color(j),u):j},u.showControls=function(a){return arguments.length?(k=a,u):k},u.showLegend=function(a){return arguments.length?(l=a,u):l},u.tooltip=function(a){return arguments.length?(n=a,u):n},u.tooltips=function(a){return arguments.length?(m=a,u):m},u.tooltipContent=function(a){return arguments.length?(n=a,u):n},u.noData=function(a){return arguments.length?(r=a,u):r},d.setTickFormat=d.tickFormat,d.tickFormat=function(a){return arguments.length?(q=a,d):q},u}})(); \ No newline at end of file diff --git a/src/models/cumulativeLineChart.js b/src/models/cumulativeLineChart.js index cda8503..4813868 100644 --- a/src/models/cumulativeLineChart.js +++ b/src/models/cumulativeLineChart.js @@ -275,7 +275,10 @@ nv.models.cumulativeLineChart = function() { xAxis .scale(x) - .ticks( availableWidth / 100 ) + //If the ticks cannot fit on the chart tastefully, put in subticks for the dates that don't show + .tickSubdivide( (data[0].values.length > (availableWidth/50)) ? true : false ) + //Suggest how many ticks based on the chart width and D3 should listen (50 is the optimal number for MM/DD/YY dates) + .ticks( Math.min(data[0].values.length,availableWidth/50) ) .tickSize(-availableHeight, 0); g.select('.nv-x.nv-axis')