From b5b36cbeb1e463569365203732dbfcb3e76114b3 Mon Sep 17 00:00:00 2001 From: Bob Monteverde Date: Fri, 27 Jul 2012 15:39:32 -0400 Subject: [PATCH] Minifying Pull Request #116 --- nv.d3.js | 13 +++++++++++++ nv.d3.min.js | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/nv.d3.js b/nv.d3.js index 5084a5a..75ac202 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -4382,6 +4382,7 @@ nv.models.multiBarChart = function() { showControls = true, showLegend = true, reduceXTicks = true, // if false a tick will show for every data point + rotateLabels = 0, tooltips = true, tooltip = function(key, x, y, e, graph) { return '

' + key + '

' + @@ -4518,6 +4519,12 @@ nv.models.multiBarChart = function() { .selectAll('text, line') .style('opacity', 0); + if(rotateLabels) + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' }) + .attr('text-transform', rotateLabels > 0 ? 'start' : 'end'); + yAxis .scale(y) .ticks( availableHeight / 36 ) @@ -4652,6 +4659,12 @@ nv.models.multiBarChart = function() { return chart; }; + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + chart.tooltips = function(_) { if (!arguments.length) return tooltips; tooltips = _; diff --git a/nv.d3.min.js b/nv.d3.min.js index 1ca994b..d5aa484 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,4 +1,4 @@ (function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(gn+m&&(q=n-j-5);break;case"w":p=b[0]+e,q=b[1]-j/2,p+k>l&&(p=b[0]-k-e),qn+m&&(q=n-j-5);break;case"n":p=b[0]-k/2,q=b[1]+e,pl&&(p=l-k-5),q+j>n+m&&(q=b[1]-j-e);break;case"s":p=b[0]-k/2,q=b[1]-j-e,pl&&(p=l-k-5),n>q&&(q=b[1]+20)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(a){return Object.prototype.toString.call(a)==="[object Array]"?function(b,c){return b.color||a[c%a.length]}:a},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return a[c%a.length]}},a.models.axis=function(){function j(b){b.each(function(b){var j=d3.select(this),k=j.selectAll("g.nv-wrap.nv-axis").data([b]),l=k.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),m=l.append("g"),n=k.select("g");(h.orient()=="top"||h.orient()=="bottom")&&h.ticks(Math.abs(c.range()[1]-c.range()[0])/100),d3.transition(n).call(h),i=i||h.scale();var o=n.selectAll("text.nv-axislabel").data([d||null]);o.exit().remove();switch(h.orient()){case"top":o.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var p=c.range().length==2?c.range()[1]:c.range()[c.range().length-1]+(c.range()[1]-c.range()[0]);o.attr("x",p/2);if(e){var q=k.selectAll("g.nv-axisMaxMin").data(c.domain());q.enter().append("g").attr("class","nv-axisMaxMin").append("text"),q.exit().remove(),q.attr("transform",function(a,b){return"translate("+c(a)+",0)"}).select("text").attr("dy","0em").attr("y",-h.tickPadding()).attr("text-anchor","middle").text(function(a,b){return(""+h.tickFormat()(a)).match("NaN")?"":h.tickFormat()(a)}),d3.transition(q).attr("transform",function(a,b){return"translate("+c.range()[b]+",0)"})}break;case"bottom":o.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",30);var p=c.range().length==2?c.range()[1]:c.range()[c.range().length-1]+(c.range()[1]-c.range()[0]);o.attr("x",p/2);if(e){var q=k.selectAll("g.nv-axisMaxMin").data(c.domain());q.enter().append("g").attr("class","nv-axisMaxMin").append("text"),q.exit().remove(),q.attr("transform",function(a,b){return"translate("+c(a)+",0)"}).select("text").attr("dy",".71em").attr("y",h.tickPadding()).attr("text-anchor","middle").text(function(a,b){return(""+h.tickFormat()(a)).match("NaN")?"":h.tickFormat()(a)}),d3.transition(q).attr("transform",function(a,b){return"translate("+c.range()[b]+",0)"})}break;case"right":o.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",g?"middle":"begin").attr("transform",g?"rotate(90)":"").attr("y",g?-Math.max(margin.right,a)-12:-10),o.attr("x",g?c.range()[0]/2:h.tickPadding());if(e){var q=k.selectAll("g.nv-axisMaxMin").data(c.domain());q.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),q.exit().remove(),q.attr("transform",function(a,b){return"translate(0,"+c(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",h.tickPadding()).attr("text-anchor","start").text(function(a,b){return(""+h.tickFormat()(a)).match("NaN")?"":h.tickFormat()(a)}),d3.transition(q).attr("transform",function(a,b){return"translate(0,"+c.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":o.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",g?"middle":"end").attr("transform",g?"rotate(-90)":"").attr("y",g?-Math.max(margin.left,a)+12:-10),o.attr("x",g?-c.range()[0]/2:-h.tickPadding());if(e){var q=k.selectAll("g.nv-axisMaxMin").data(c.domain());q.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),q.exit().remove(),q.attr("transform",function(a,b){return"translate(0,"+i(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-h.tickPadding()).attr("text-anchor","end").text(function(a,b){return(""+h.tickFormat()(a)).match("NaN")?"":h.tickFormat()(a)}),d3.transition(q).attr("transform",function(a,b){return"translate(0,"+c.range()[b]+")"}).select("text").style("opacity",1)}}o.text(function(a){return a}),e&&(h.orient()==="left"||h.orient()==="right")&&n.selectAll("g").each(function(a,b){if(c(a)c.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()});if(e&&(h.orient()==="top"||h.orient()==="bottom")){var r=[];k.selectAll("g.nv-axisMaxMin").each(function(a,b){b?r.push(c(a)-this.getBBox().width-4):r.push(c(a)+this.getBBox().width+4)}),n.selectAll("g").each(function(a,b){if(c(a)r[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}f&&n.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),i=c.copy()});return j}var a=60,b=60,c=d3.scale.linear(),d=null,e=!0,f=!0,g=!0;margin={top:0,right:0,bottom:0,left:0};var h=d3.svg.axis().scale(c).orient("bottom").tickFormat(function(a){return a}),i;d3.rebind(j,h,"orient","ticks","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(j,c,"domain","range","rangeBand","rangeBands"),j.width=function(b){if(!arguments.length)return a;a=b;return j},j.height=function(a){if(!arguments.length)return b;b=a;return j},j.axisLabel=function(a){if(!arguments.length)return d;d=a;return j},j.showMaxMin=function(a){if(!arguments.length)return e;e=a;return j},j.highlightZero=function(a){if(!arguments.length)return f;f=a;return j},j.scale=function(a){if(!arguments.length)return c;c=a,h.scale(c),d3.rebind(j,c,"domain","range","rangeBand","rangeBands");return j},j.rotateYLabel=function(a){if(!arguments.length)return g;g=a;return j},j.margin=function(a){if(!arguments.length)return margin;margin=a;return j};return j},a.models.historicalBar=function(){function s(a){a.each(function(a){var p=c-b.left-b.right,q=d-b.top-b.bottom;n.domain(l||d3.extent(a[0].values.map(f).concat(h))).range([0,p]),o.domain(m||d3.extent(a[0].values.map(g).concat(i))).range([q,0]);if(n.domain()[0]===n.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]-n.domain()[0]*.01,n.domain()[1]+n.domain()[1]*.01]):n.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var s=d3.select(this).on("click",function(a,b){r.chartClick({data:a,index:b,pos:d3.event,id:e})}),t=d3.select(this).selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("g");v.append("g").attr("class","nv-bars"),t.attr("width",c).attr("height",d);var w=t.select("g").attr("transform","translate("+b.left+","+b.top+")");u.append("defs").append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",p).attr("height",q),v.attr("clip-path",j?"url(#nv-chart-clip-path-"+e+")":"");var z=v.append("g").attr("class","nv-shiftWrap"),A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("class",function(a,b,c){return(g(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("fill",function(a,b){return k(a,b)}).attr("x",0).attr("y",function(a,b){return o(Math.max(0,g(a,b)))}).attr("height",function(a,b){return Math.abs(o(g(a,b))-o(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),r.elementMouseover({point:b,series:a[0],pos:[n(f(b,c)),o(g(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),r.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){r.elementClick({value:g(a,b),data:a,index:b,pos:[n(f(a,b)),o(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){r.elementDblClick({value:g(a,b),data:a,index:b,pos:[n(f(a,b)),o(g(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("class",function(a,b,c){return(g(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(n(f(b,c))-p/a[0].values.length*.5)+",0)"}).attr("width",p/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return o(Math.max(0,g(a,b)))}).attr("height",function(a,b){return Math.abs(o(g(a,b))-o(0))})});return s}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=function(a){return a.x},g=function(a){return a.y},h=[],i=[],j=!0,k=a.utils.defaultColor(),l,m,n=d3.scale.linear(),o=d3.scale.linear(),p=d3.svg.axis().scale(n).orient("bottom"),q=d3.svg.axis().scale(o).orient("left"),r=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");s.dispatch=r,s.x=function(a){if(!arguments.length)return f;f=a;return s},s.y=function(a){if(!arguments.length)return g;g=a;return s},s.margin=function(a){if(!arguments.length)return b;b=a;return s},s.width=function(a){if(!arguments.length)return c;c=a;return s},s.height=function(a){if(!arguments.length)return d;d=a;return s},s.xScale=function(a){if(!arguments.length)return n;n=a;return s},s.yScale=function(a){if(!arguments.length)return o;o=a;return s},s.xDomain=function(a){if(!arguments.length)return l;l=a;return s},s.yDomain=function(a){if(!arguments.length)return m;m=a;return s},s.forceX=function(a){if(!arguments.length)return h;h=a;return s},s.forceY=function(a){if(!arguments.length)return i;i=a;return s},s.clipEdge=function(a){if(!arguments.length)return j;j=a;return s},s.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return s},s.id=function(a){if(!arguments.length)return e;e=a;return s};return s},a.models.bullet=function(){function k(a){a.each(function(a,i){var k=g-c.left-c.right,l=h-c.top-c.bottom,m=d.call(this,a,i).slice().sort(d3.descending),n=e.call(this,a,i).slice().sort(d3.descending),o=f.call(this,a,i).slice().sort(d3.descending),p=d3.select(this).selectAll("g.nv-wrap.nv-bullet").data([a]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),r=q.append("g"),s=p.select("g");p.attr("transform","translate("+c.left+","+c.top+")");var t=d3.scale.linear().domain([0,Math.max(m[0],n[0],o[0])]).range(b?[k,0]:[0,k]),u=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(t.range());this.__chart__=t;var v=function(a){return Math.abs(u(a)-u(0))},w=function(a){return Math.abs(t(a)-t(0))},x=s.selectAll("rect.nv-range").data(m);x.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",v).attr("height",l).attr("x",b?u:0).on("mouseover",function(a,b){j.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[t(a),l/2]})}).on("mouseout",function(a,b){j.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(x).attr("x",b?t:0).attr("width",w).attr("height",l);var y=s.selectAll("rect.nv-measure").data(o);y.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).attr("width",v).attr("height",l/3).attr("x",b?u:0).attr("y",l/3).on("mouseover",function(a){j.elementMouseover({value:a,label:"Current",pos:[t(a),l/2]})}).on("mouseout",function(a){j.elementMouseout({value:a,label:"Current"})}),d3.transition(y).attr("width",w).attr("height",l/3).attr("x",b?t:0).attr("y",l/3);var z=s.selectAll("path.nv-markerTriangle").data(n),A=l/6;z.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+u(a)+","+l/2+")"}).attr("d","M0,"+A+"L"+A+","+ -A+" "+ -A+","+ -A+"Z").on("mouseover",function(a,b){j.elementMouseover({value:a,label:"Previous",pos:[t(a),l/2]})}).on("mouseout",function(a,b){j.elementMouseout({value:a,label:"Previous"})}),d3.transition(z).attr("transform",function(a){return"translate("+t(a)+","+l/2+")"}),z.exit().remove()}),d3.timer.flush()}var a="left",b=!1,c={top:0,right:0,bottom:0,left:0},d=function(a){return a.ranges},e=function(a){return a.markers},f=function(a){return a.measures},g=380,h=30,i=null,j=d3.dispatch("elementMouseover","elementMouseout");k.dispatch=j,k.orient=function(c){if(!arguments.length)return a;a=c,b=a=="right"||a=="bottom";return k},k.ranges=function(a){if(!arguments.length)return d;d=a;return k},k.markers=function(a){if(!arguments.length)return e;e=a;return k},k.measures=function(a){if(!arguments.length)return f;f=a;return k},k.width=function(a){if(!arguments.length)return g;g=a;return k},k.height=function(a){if(!arguments.length)return h;h=a;return k},k.margin=function(a){if(!arguments.length)return c;c=a;return k},k.tickFormat=function(a){if(!arguments.length)return i;i=a;return k};return k},a.models.bulletChart=function(){function p(b){b.each(function(b,l){var p=d3.select(this),q=(h||parseInt(p.style("width"))||960)-d.left-d.right,r=i-d.top-d.bottom,s=this,t=e.call(this,b,l).slice().sort(d3.descending),u=f.call(this,b,l).slice().sort(d3.descending),v=g.call(this,b,l).slice().sort(d3.descending),w=p.selectAll("g.nv-wrap.nv-bulletChart").data([b]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),y=x.append("g");y.append("g").attr("class","nv-bulletWrap"),y.append("g").attr("class","nv-titles");var z=w.select("g");w.attr("transform","translate("+d.left+","+d.top+")");var A=d3.scale.linear().domain([0,Math.max(t[0],u[0],v[0])]).range(c?[q,0]:[0,q]),B=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var C=function(a){return Math.abs(B(a)-B(0))},D=function(a){return Math.abs(A(a)-A(0))},E=z.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(i-d.top-d.bottom)/2+")");E.append("text").attr("class","nv-title").text(function(a){return a.title}),E.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),n.width(q).height(r);var F=z.select(".nv-bulletWrap");d3.transition(F).call(n);var G=j||A.tickFormat(8),H=z.selectAll("g.nv-tick").data(A.ticks(8),function(a){return this.textContent||G(a)}),I=H.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+B(a)+",0)"}).style("opacity",1e-6);I.append("line").attr("y1",r).attr("y2",r*7/6),I.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",r*7/6).text(G),d3.transition(I).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1);var J=d3.transition(H).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1);J.select("line").attr("y1",r).attr("y2",r*7/6),J.select("text").attr("y",r*7/6),d3.transition(H.exit()).attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1e-6).remove(),n.dispatch.on("elementMouseover.tooltip",function(a){m.tooltipShow(a)}),k&&m.on("tooltipShow",function(a){o(a,s.parentNode)}),n.dispatch.on("elementMouseout.tooltip",function(a){m.tooltipHide(a)}),k&&m.on("tooltipHide",a.tooltip.cleanup)}),d3.timer.flush()}var b="left",c=!1,d={top:5,right:40,bottom:20,left:120},e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=null,i=55,j=null,k=!0,l=function(a,b,c,d,e){return"

"+d.label+"

"+"

"+d.value+"

"},m=d3.dispatch("tooltipShow","tooltipHide"),n=a.models.bullet(),o=function(b,c){var c=document.getElementById("chart"),e=b.pos[0]+c.offsetLeft+d.left,f=b.pos[1]+c.offsetTop+d.top,g="

"+b.label+"

"+"

"+b.value+"

";a.tooltip.show([e,f],g,b.value<0?"e":"w")};p.dispatch=m,p.bullet=n,p.orient=function(a){if(!arguments.length)return b;b=a,c=b=="right"||b=="bottom";return p},p.ranges=function(a){if(!arguments.length)return e;e=a;return p},p.markers=function(a){if(!arguments.length)return f;f=a;return p},p.measures=function(a){if(!arguments.length)return g;g=a;return p},p.width=function(a){if(!arguments.length)return h;h=a;return p},p.height=function(a){if(!arguments.length)return i;i=a;return p},p.margin=function(a){if(!arguments.length)return d;d=a;return p},p.tickFormat=function(a){if(!arguments.length)return j;j=a;return p},p.tooltips=function(a){if(!arguments.length)return k;k=a;return p},p.tooltipContent=function(a){if(!arguments.length)return l;l=a;return p};return p},a.models.cumulativeLineChart=function(){function C(a,b){return b.map(function(b,c){var d=m.y()(b.values[a],a);b.values=b.values.map(function(a,b){a.display={y:(m.y()(a,b)-d)/(1+d)};return a});return b})}function B(a){a.each(function(j){var y=d3.select(this).classed("nv-chart-"+o,!0),z=this,A=(d||parseInt(y.style("width"))||960)-b.left-b.right,D=(e||parseInt(y.style("height"))||400)-b.top-b.bottom;k=m.xScale(),l=m.yScale(),n.domain([0,j[0].values.length-1]).range([0,A]).clamp(!0);var j=C(u.i,j),E=y.selectAll("g.nv-wrap.nv-cumulativeLine").data([j]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-linesWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap");var G=E.select("g");f&&(r.width(A),G.select(".nv-legendWrap").datum(j).call(r),b.top!=r.height()&&(b.top=r.height(),D=(e||parseInt(y.style("height"))||400)-b.top-b.bottom),G.select(".nv-legendWrap").attr("transform","translate(0,"+ -b.top+")")),h&&(s.width(140).color(["#444","#444","#444"]),G.select(".nv-controlsWrap").datum(v).attr("transform","translate(0,"+ -b.top+")").call(s)),m.y(function(a){return a.display.y}).width(A).height(D).color(j.map(function(a,b){return a.color||c(a,b)}).filter(function(a,b){return!j[b].disabled})),G.attr("transform","translate("+b.left+","+b.top+")");var H=G.select(".nv-linesWrap").datum(j.filter(function(a){return!a.disabled}));d3.transition(H).call(m);var I=H.selectAll(".nv-indexLine").data([u]);I.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(x),I.attr("transform",function(a){return"translate("+n(a.i)+",0)"}).attr("height",D),p.scale(k).ticks(A/100).tickSize(-D,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+l.range()[0]+")"),d3.transition(G.select(".nv-x.nv-axis")).call(p),q.scale(l).ticks(D/36).tickSize(-A,0),d3.transition(G.select(".nv-y.nv-axis")).call(q),s.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,i=!b.disabled,a.transition().call(B)}),r.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,j.filter(function(a){return!a.disabled}).length||j.map(function(a){a.disabled=!1,E.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(B)}),t.on("tooltipShow",function(a){g&&w(a,z.parentNode)})}),B.update=function(){B(a)},B.container=this;return B}function A(a,b){B.update()}function z(a,b){a.x+=d3.event.dx,a.i=Math.round(n.invert(a.x)),d3.select(this).attr("transform","translate("+n(a.i)+",0)")}function y(a,b){}var b={top:30,right:30,bottom:50,left:60},c=a.utils.getColor(),d=null,e=null,f=!0,g=!0,h=!1,i=!0,j=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

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

"+b+"

"+"

"+c+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+ -c+" on "+b+"

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

"+a+" - "+b+"

"+"

"+c+"

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

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

"+a+"

"+"

"+b+"

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

"+c+" on "+b+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+c+" at "+b+"

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

"+a+"

"+"

"+c+" on "+b+"

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

"+a+" - "+b+"

"+"

"+c+"

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

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

"+a+"

"+"

"+b+"

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

"+c+" on "+b+"

"},j,k,l=a.models.stackedArea(),m=a.models.axis().orient("bottom").tickPadding(5),n=a.models.axis().orient("left"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide"),r=[{key:"Stacked"},{key:"Stream",disabled:!0},{key:"Expanded",disabled:!0}],s=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(l.x()(b.point,b.pointIndex)),g=n.tickFormat()(l.y()(b.point,b.pointIndex)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")};l.dispatch.on("tooltipShow",function(a){if(!Math.round(l.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),l.dispatch.on("tooltipHide",function(a){q.tooltipHide(a)}),q.on("tooltipHide",function(){h&&a.tooltip.cleanup()}),t.dispatch=q,t.stacked=l,t.xAxis=m,t.yAxis=n,d3.rebind(t,l,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize"),t.margin=function(a){if(!arguments.length)return b;b=a;return t},t.width=function(a){if(!arguments.length)return getWidth;c=a;return t},t.height=function(a){if(!arguments.length)return getHeight;d=a;return t},t.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),o.color(e);return t},t.showControls=function(a){if(!arguments.length)return f;f=a;return t},t.showLegend=function(a){if(!arguments.length)return g;g=a;return t},t.tooltips=function(a){if(!arguments.length)return h;h=a;return t},t.tooltipContent=function(a){if(!arguments.length)return i;i=a;return t};return t}})() \ No newline at end of file