]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/static/js/nv.d3.min.js
Allow overriding the line chart tooltip() function.
[xonotic/xonstat.git] / xonstat / static / js / nv.d3.min.js
1 (function(){var c=window.nv||{};c.version="1.1.10b";c.dev=true;window.nv=c;c.tooltip={};c.utils={};c.models={};c.charts={};c.graphs=[];c.logs={};c.dispatch=d3.dispatch("render_start","render_end");if(c.dev){c.dispatch.on("render_start",function(f){c.logs.startTime=+new Date()});c.dispatch.on("render_end",function(f){c.logs.endTime=+new Date();c.logs.totalTime=c.logs.endTime-c.logs.startTime;c.log("total",c.logs.totalTime)})}c.log=function(){if(c.dev&&console.log&&console.log.apply){console.log.apply(console,arguments)}else{if(c.dev&&typeof console.log=="function"&&Function.prototype.bind){var e=Function.prototype.bind.call(console.log,console);e.apply(console,arguments)}}return arguments[arguments.length-1]};c.render=function d(e){e=e||1;c.render.active=true;c.dispatch.render_start();setTimeout(function(){var g,h;for(var f=0;f<e&&(h=c.render.queue[f]);f++){g=h.generate();if(typeof h.callback==typeof(Function)){h.callback(g)}c.graphs.push(g)}c.render.queue.splice(0,f);if(c.render.queue.length){setTimeout(arguments.callee,0)}else{c.render.active=false;c.dispatch.render_end()}},0)};c.render.active=false;c.render.queue=[];c.addGraph=function(e){if(typeof arguments[0]===typeof(Function)){e={generate:arguments[0],callback:arguments[1]}}c.render.queue.push(e);if(!c.render.active){c.render()}};c.identity=function(e){return e};c.strip=function(e){return e.replace(/(\s|&)/g,"")};function b(f,e){return(new Date(e,f+1,0)).getDate()}function a(g,f,e){return function(k,j,i){var l=g(k),m=[];if(l<k){f(l)}if(i>1){while(l<j){var h=new Date(+l);if((e(h)%i===0)){m.push(h)}f(l)}}else{while(l<j){m.push(new Date(+l));f(l)}}return m}}d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)};d3.time.monthEnds=a(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1);e.setDate(b(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()});c.interactiveGuideline=function(){var o=c.models.tooltip();var e=null,n=null,g={left:0,top:0},m=d3.scale.linear(),f=d3.scale.linear(),j=d3.dispatch("elementMousemove","elementMouseout"),k=true,i=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;function h(p){p.each(function(t){var q=d3.select(this);var s=(e||960),v=(n||400);var r=q.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([t]);var w=r.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");w.append("g").attr("class","nv-interactiveGuideLine");if(!i){return}function u(){var A=d3.mouse(this);var z=A[0];var y=A[1];var B=true;var C=false;if(l){z=d3.event.offsetX;y=d3.event.offsetY;if(d3.event.target.tagName!=="svg"){B=false}if(d3.event.target.className.baseVal.match("nv-legend")){C=true}}if(B){z-=g.left;y-=g.top}if(z<0||y<0||z>s||y>v||(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined)||C){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(o.nvPointerEventsClass)){return}}j.elementMouseout({mouseX:z,mouseY:y});h.renderGuideLine(null);return}var x=m.invert(z);j.elementMousemove({mouseX:z,mouseY:y,pointXValue:x})}i.on("mousemove",u,true).on("mouseout",u,true);h.renderGuideLine=function(y){if(!k){return}var z=r.select(".nv-interactiveGuideLine").selectAll("line").data((y!=null)?[c.utils.NaNtoZero(y)]:[],String);z.enter().append("line").attr("class","nv-guideline").attr("x1",function(x){return x}).attr("x2",function(x){return x}).attr("y1",v).attr("y2",0);z.exit().remove()}})}h.dispatch=j;h.tooltip=o;h.margin=function(p){if(!arguments.length){return g}g.top=typeof p.top!="undefined"?p.top:g.top;g.left=typeof p.left!="undefined"?p.left:g.left;return h};h.width=function(p){if(!arguments.length){return e}e=p;return h};h.height=function(p){if(!arguments.length){return n}n=p;return h};h.xScale=function(p){if(!arguments.length){return m}m=p;return h};h.showGuideLine=function(p){if(!arguments.length){return k}k=p;return h};h.svgContainer=function(p){if(!arguments.length){return i}i=p;return h};return h};c.interactiveBisect=function(g,f,k){if(!g instanceof Array){return null}if(typeof k!=="function"){k=function(n,m){return n.x}}var l=d3.bisector(k).left;var h=d3.max([0,l(g,f)-1]);var j=k(g[h],h);if(typeof j==="undefined"){j=h}if(j===f){return h}var e=d3.min([h+1,g.length-1]);var i=k(g[e],e);if(typeof i==="undefined"){i=e}if(Math.abs(i-f)>=Math.abs(j-f)){return h}else{return e}};(function(){window.nv.tooltip={};window.nv.models.tooltip=function(){var r=null,w=null,i="w",h=50,o=25,f=null,t=null,s=null,v={left:null,top:null},l=true,p="nvtooltip-"+Math.floor(Math.random()*100000);var k="nv-pointer-events-none";var e=function(y,x){return y};var q=function(x){return x};var g=function(y){if(r!=null){return r}if(y==null){return""}var x="<table><thead><tr><td colspan='3'><strong class='x-value'>"+q(y.value)+"</strong></td></tr></thead><tbody>";if(y.series instanceof Array){y.series.forEach(function(A,z){x+="<tr>";x+="<td class='legend-color-guide'><div style='background-color: "+A.color+";'></div></td>";x+="<td class='key'>"+A.key+":</td>";x+="<td class='value'>"+e(A.value,z)+"</td></tr>"})}x+="</tbody></table>";return x};var j=function(x){if(x&&x.series&&x.series.length>0){return true}return false};function m(){if(s){var x=d3.select(s);if(x.node().tagName!=="svg"){x=x.select("svg")}var z=(x.node())?x.attr("viewBox"):null;if(z){z=z.split(" ");var y=parseInt(x.style("width"))/z[2];v.left=v.left*y;v.top=v.top*y}}}function u(z){var x;if(s){x=d3.select(s)}else{x=d3.select("body")}var y=x.select(".nvtooltip");if(y.node()===null){y=x.append("div").attr("class","nvtooltip "+(t?t:"xy-tooltip")).attr("id",p)}y.node().innerHTML=z;y.style("top",0).style("left",0).style("opacity",0);y.selectAll("div, table, td, tr").classed(k,true);y.classed(k,true);return y.node()}function n(){if(!l){return}if(!j(w)){return}m();var D=v.left;var C=(f!=null)?f:v.top;var x=u(g(w));if(s){var A=s.getElementsByTagName("svg")[0];var z=(A)?A.getBoundingClientRect():s.getBoundingClientRect();var E={left:0,top:0};if(A){var y=A.getBoundingClientRect();var B=s.getBoundingClientRect();E.top=Math.abs(y.top-B.top);E.left=Math.abs(y.left-B.left)}D+=s.offsetLeft+E.left-2*s.scrollLeft;C+=s.offsetTop+E.top-2*s.scrollTop}if(o&&o>0){C=Math.floor(C/o)*o}c.tooltip.calcTooltipPosition([D,C],i,h,x);return n}n.nvPointerEventsClass=k;n.content=function(x){if(!arguments.length){return r}r=x;return n};n.contentGenerator=function(x){if(!arguments.length){return g}if(typeof x==="function"){g=x}return n};n.data=function(x){if(!arguments.length){return w}w=x;return n};n.gravity=function(x){if(!arguments.length){return i}i=x;return n};n.distance=function(x){if(!arguments.length){return h}h=x;return n};n.snapDistance=function(x){if(!arguments.length){return o}o=x;return n};n.classes=function(x){if(!arguments.length){return t}t=x;return n};n.chartContainer=function(x){if(!arguments.length){return s}s=x;return n};n.position=function(x){if(!arguments.length){return v}v.left=(typeof x.left!=="undefined")?x.left:v.left;v.top=(typeof x.top!=="undefined")?x.top:v.top;return n};n.fixedTop=function(x){if(!arguments.length){return f}f=x;return n};n.enabled=function(x){if(!arguments.length){return l}l=x;return n};n.valueFormatter=function(x){if(!arguments.length){return e}if(typeof x==="function"){e=x}return n};n.headerFormatter=function(x){if(!arguments.length){return q}if(typeof x==="function"){q=x}return n};n.id=function(){return p};return n};c.tooltip.show=function(l,h,k,j,i,g){var f=document.createElement("div");f.className="nvtooltip "+(g?g:"xy-tooltip");var e=i;if(!i||i.tagName.match(/g|svg/i)){e=document.getElementsByTagName("body")[0]}f.style.left=0;f.style.top=0;f.style.opacity=0;f.innerHTML=h;e.appendChild(f);if(i){l[0]=l[0]-i.scrollLeft;l[1]=l[1]-i.scrollTop}c.tooltip.calcTooltipPosition(l,k,j,f)};c.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};c.tooltip.findTotalOffsetTop=function(e,g){var f=g;do{if(!isNaN(e.offsetTop)){f+=(e.offsetTop)}}while(e=e.offsetParent);return f};c.tooltip.findTotalOffsetLeft=function(f,e){var g=e;do{if(!isNaN(f.offsetLeft)){g+=(f.offsetLeft)}}while(f=f.offsetParent);return g};c.tooltip.calcTooltipPosition=function(q,t,o,f){var s=parseInt(f.offsetHeight),g=parseInt(f.offsetWidth),i=c.utils.windowSize().width,e=c.utils.windowSize().height,h=window.pageYOffset,k=window.pageXOffset,j,p;e=window.innerWidth>=document.body.scrollWidth?e:e-16;i=window.innerHeight>=document.body.scrollHeight?i:i-16;t=t||"s";o=o||20;var l=function(u){return c.tooltip.findTotalOffsetTop(u,p)};var r=function(u){return c.tooltip.findTotalOffsetLeft(u,j)};switch(t){case"e":j=q[0]-g-o;p=q[1]-(s/2);var n=r(f);var m=l(f);if(n<k){j=q[0]+o>k?q[0]+o:k-n+j}if(m<h){p=h-m+p}if(m+s>h+e){p=h+e-m+p-s}break;case"w":j=q[0]+o;p=q[1]-(s/2);var n=r(f);var m=l(f);if(n+g>i){j=q[0]-g-o}if(m<h){p=h+5}if(m+s>h+e){p=h+e-m+p-s}break;case"n":j=q[0]-(g/2)-5;p=q[1]+o;var n=r(f);var m=l(f);if(n<k){j=k+5}if(n+g>i){j=j-g/2+5}if(m+s>h+e){p=h+e-m+p-s}break;case"s":j=q[0]-(g/2);p=q[1]-s-o;var n=r(f);var m=l(f);if(n<k){j=k+5}if(n+g>i){j=j-g/2+5}if(h>m){p=h}break;case"none":j=q[0];p=q[1]-o;var n=r(f);var m=l(f);break}f.style.left=j+"px";f.style.top=p+"px";f.style.opacity=1;f.style.position="absolute";return f};c.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var f=[];while(e.length){f.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(f.length){var g=f.pop();g.parentNode.removeChild(g)}},500)}})();c.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return(e)};c.utils.windowResize=function(e){if(e===undefined){return}var f=window.onresize;window.onresize=function(g){if(typeof f=="function"){f(g)}e(g)}};c.utils.getColor=function(e){if(!arguments.length){return c.utils.defaultColor()}if(Object.prototype.toString.call(e)==="[object Array]"){return function(g,f){return g.color||e[f%e.length]}}else{return e}};c.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(g,f){return g.color||e[f%e.length]}};c.utils.customTheme=function(h,f,g){f=f||function(i){return i.key};g=g||d3.scale.category20().range();var e=g.length;return function(k,i){var j=f(k);if(!e){e=g.length}if(typeof h[j]!=="undefined"){return(typeof h[j]==="function")?h[j]():h[j]}else{return g[--e]}}};c.utils.pjax=function(e,f){d3.selectAll(e).on("click",function(){history.pushState(this.href,this.textContent,this.href);g(this.href);d3.event.preventDefault()});function g(h){d3.html(h,function(i){var j=d3.select(f).node();j.parentNode.replaceChild(d3.select(i).select(f).node(),j);c.utils.pjax(e,f)})}d3.select(window).on("popstate",function(){if(d3.event.state){g(d3.event.state)}})};c.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var g=parseInt(e.style("font-size").replace("px",""));var f=e.text().length;return f*g*0.5}return 0};c.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity){return 0}return e};c.utils.optionsFunc=function(e){if(e){d3.map(e).forEach((function(f,g){if(typeof this[f]==="function"){this[f](g)}}).bind(this))}return this};c.models.axis=function(){var j=d3.svg.axis();var m={top:0,right:0,bottom:0,left:0},g=75,s=60,l=d3.scale.linear(),n=null,i=true,k=true,f=0,h=true,o=false,e=false,r=null;j.scale(l).orient("bottom").tickFormat(function(t){return t});var p;function q(t){t.each(function(F){var v=d3.select(this);var y=v.selectAll("g.nv-wrap.nv-axis").data([F]);var B=y.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var u=B.append("g");var H=y.select("g");if(r!==null){j.ticks(r)}else{if(j.orient()=="top"||j.orient()=="bottom"){j.ticks(Math.abs(l.range()[1]-l.range()[0])/100)}}H.transition().call(j);p=p||j.scale();var A=j.tickFormat();if(A==null){A=p.tickFormat()}var z=H.selectAll("text.nv-axislabel").data([n||null]);z.exit().remove();switch(j.orient()){case"top":z.enter().append("text").attr("class","nv-axislabel");var J=(l.range().length==2)?l.range()[1]:(l.range()[l.range().length-1]+(l.range()[1]-l.range()[0]));z.attr("text-anchor","middle").attr("y",0).attr("x",J/2);if(i){var G=y.selectAll("g.nv-axisMaxMin").data(l.domain());G.enter().append("g").attr("class","nv-axisMaxMin").append("text");G.exit().remove();G.attr("transform",function(K,w){return"translate("+l(K)+",0)"}).select("text").attr("dy","0em").attr("y",-j.tickPadding()).attr("text-anchor","middle").text(function(L,K){var w=A(L);return(""+w).match("NaN")?"":w});G.transition().attr("transform",function(K,w){return"translate("+l.range()[w]+",0)"})}break;case"bottom":var E=36;var x=30;var C=H.selectAll("g").select("text");if(f%360){C.each(function(L,w){var K=this.getBBox().width;if(K>x){x=K}});var I=Math.abs(Math.sin(f*Math.PI/180));var E=(I?I*x:x)+30;C.attr("transform",function(L,K,w){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}z.enter().append("text").attr("class","nv-axislabel");var J=(l.range().length==2)?l.range()[1]:(l.range()[l.range().length-1]+(l.range()[1]-l.range()[0]));z.attr("text-anchor","middle").attr("y",E).attr("x",J/2);if(i){var G=y.selectAll("g.nv-axisMaxMin").data([l.domain()[0],l.domain()[l.domain().length-1]]);G.enter().append("g").attr("class","nv-axisMaxMin").append("text");G.exit().remove();G.attr("transform",function(K,w){return"translate("+(l(K)+(e?l.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",j.tickPadding()).attr("transform",function(L,K,w){return"rotate("+f+" 0,0)"}).style("text-anchor",f?(f%360>0?"start":"end"):"middle").text(function(L,K){var w=A(L);return(""+w).match("NaN")?"":w});G.transition().attr("transform",function(K,w){return"translate("+(l(K)+(e?l.rangeBand()/2:0))+",0)"})}if(o){C.attr("transform",function(K,w){return"translate(0,"+(w%2==0?"0":"12")+")"})}break;case"right":z.enter().append("text").attr("class","nv-axislabel");z.style("text-anchor",h?"middle":"begin").attr("transform",h?"rotate(90)":"").attr("y",h?(-Math.max(m.right,g)+12):-10).attr("x",h?(l.range()[0]/2):j.tickPadding());if(i){var G=y.selectAll("g.nv-axisMaxMin").data(l.domain());G.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);G.exit().remove();G.attr("transform",function(K,w){return"translate(0,"+l(K)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",j.tickPadding()).style("text-anchor","start").text(function(L,K){var w=A(L);return(""+w).match("NaN")?"":w});G.transition().attr("transform",function(K,w){return"translate(0,"+l.range()[w]+")"}).select("text").style("opacity",1)}break;case"left":z.enter().append("text").attr("class","nv-axislabel");z.style("text-anchor",h?"middle":"end").attr("transform",h?"rotate(-90)":"").attr("y",h?(-Math.max(m.left,g)+12):-10).attr("x",h?(-l.range()[0]/2):-j.tickPadding());if(i){var G=y.selectAll("g.nv-axisMaxMin").data(l.domain());G.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);G.exit().remove();G.attr("transform",function(K,w){return"translate(0,"+p(K)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-j.tickPadding()).attr("text-anchor","end").text(function(L,K){var w=A(L);return(""+w).match("NaN")?"":w});G.transition().attr("transform",function(K,w){return"translate(0,"+l.range()[w]+")"}).select("text").style("opacity",1)}break}z.text(function(w){return w});if(i&&(j.orient()==="left"||j.orient()==="right")){H.selectAll("g").each(function(K,w){d3.select(this).select("text").attr("opacity",1);if(l(K)<l.range()[1]+10||l(K)>l.range()[0]-10){if(K>1e-10||K<-1e-10){d3.select(this).attr("opacity",0)}d3.select(this).select("text").attr("opacity",0)}});if(l.domain()[0]==l.domain()[1]&&l.domain()[0]==0){y.selectAll("g.nv-axisMaxMin").style("opacity",function(K,w){return !w?1:0})}}if(i&&(j.orient()==="top"||j.orient()==="bottom")){var D=[];y.selectAll("g.nv-axisMaxMin").each(function(L,w){try{if(w){D.push(l(L)-this.getBBox().width-4)}else{D.push(l(L)+this.getBBox().width+4)}}catch(K){if(w){D.push(l(L)-4)}else{D.push(l(L)+4)}}});H.selectAll("g").each(function(K,w){if(l(K)<D[0]||l(K)>D[1]){if(K>1e-10||K<-1e-10){d3.select(this).remove()}else{d3.select(this).select("text").remove()}}})}if(k){H.selectAll(".tick").filter(function(w){return !parseFloat(Math.round(w.__data__*100000)/1000000)&&(w.__data__!==undefined)}).classed("zero",true)}p=l.copy()});return q}q.axis=j;d3.rebind(q,j,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(q,l,"domain","range","rangeBand","rangeBands");q.options=c.utils.optionsFunc.bind(q);q.margin=function(t){if(!arguments.length){return m}m.top=typeof t.top!="undefined"?t.top:m.top;m.right=typeof t.right!="undefined"?t.right:m.right;m.bottom=typeof t.bottom!="undefined"?t.bottom:m.bottom;m.left=typeof t.left!="undefined"?t.left:m.left;return q};q.width=function(t){if(!arguments.length){return g}g=t;return q};q.ticks=function(t){if(!arguments.length){return r}r=t;return q};q.height=function(t){if(!arguments.length){return s}s=t;return q};q.axisLabel=function(t){if(!arguments.length){return n}n=t;return q};q.showMaxMin=function(t){if(!arguments.length){return i}i=t;return q};q.highlightZero=function(t){if(!arguments.length){return k}k=t;return q};q.scale=function(t){if(!arguments.length){return l}l=t;j.scale(l);e=typeof l.rangeBands==="function";d3.rebind(q,l,"domain","range","rangeBand","rangeBands");return q};q.rotateYLabel=function(t){if(!arguments.length){return h}h=t;return q};q.rotateLabels=function(t){if(!arguments.length){return f}f=t;return q};q.staggerLabels=function(t){if(!arguments.length){return o}o=t;return q};return q};c.models.bullet=function(){var k={top:0,right:0,bottom:0,left:0},m="left",q=false,f=function(u){return u.ranges},l=function(u){return u.markers},e=function(u){return u.measures},o=function(u){return u.rangeLabels?u.rangeLabels:[]},s=function(u){return u.markerLabels?u.markerLabels:[]},h=function(u){return u.measureLabels?u.measureLabels:[]},n=[0],g=380,t=30,i=null,j=c.utils.getColor(["#1f77b4"]),p=d3.dispatch("elementMouseover","elementMouseout");function r(u){u.each(function(S,N){var v=g-k.left-k.right,w=t-k.top-k.bottom,K=d3.select(this);var T=f.call(this,S,N).slice().sort(d3.descending),L=l.call(this,S,N).slice().sort(d3.descending),I=e.call(this,S,N).slice().sort(d3.descending),J=o.call(this,S,N).slice(),A=s.call(this,S,N).slice(),Q=h.call(this,S,N).slice();var P=d3.scale.linear().domain(d3.extent(d3.merge([n,T]))).range(q?[v,0]:[0,v]);var R=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(P.range());this.__chart__=P;var y=d3.min(T),B=d3.max(T),x=T[1];var D=K.selectAll("g.nv-wrap.nv-bullet").data([S]);var z=D.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=z.append("g");var O=D.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");D.attr("transform","translate("+k.left+","+k.top+")");var H=function(U){return Math.abs(R(U)-R(0))},F=function(U){return Math.abs(P(U)-P(0))};var G=function(U){return U<0?R(U):R(0)},E=function(U){return U<0?P(U):P(0)};O.select("rect.nv-rangeMax").attr("height",w).attr("width",F(B>0?B:y)).attr("x",E(B>0?B:y)).datum(B>0?B:y);O.select("rect.nv-rangeAvg").attr("height",w).attr("width",F(x)).attr("x",E(x)).datum(x);O.select("rect.nv-rangeMin").attr("height",w).attr("width",F(B)).attr("x",E(B)).attr("width",F(B>0?y:B)).attr("x",E(B>0?y:B)).datum(B>0?y:B);O.select("rect.nv-measure").style("fill",j).attr("height",w/3).attr("y",w/3).attr("width",I<0?P(0)-P(I[0]):P(I[0])-P(0)).attr("x",E(I)).on("mouseover",function(){p.elementMouseover({value:I[0],label:Q[0]||"Current",pos:[P(I[0]),w/2]})}).on("mouseout",function(){p.elementMouseout({value:I[0],label:Q[0]||"Current"})});var C=w/6;if(L[0]){O.selectAll("path.nv-markerTriangle").attr("transform",function(U){return"translate("+P(L[0])+","+(w/2)+")"}).attr("d","M0,"+C+"L"+C+","+(-C)+" "+(-C)+","+(-C)+"Z").on("mouseover",function(){p.elementMouseover({value:L[0],label:A[0]||"Previous",pos:[P(L[0]),w/2]})}).on("mouseout",function(){p.elementMouseout({value:L[0],label:A[0]||"Previous"})})}else{O.selectAll("path.nv-markerTriangle").remove()}D.selectAll(".nv-range").on("mouseover",function(W,V){var U=J[V]||(!V?"Maximum":V==1?"Mean":"Minimum");p.elementMouseover({value:W,label:U,pos:[P(W),w/2]})}).on("mouseout",function(W,V){var U=J[V]||(!V?"Maximum":V==1?"Mean":"Minimum");p.elementMouseout({value:W,label:U})})});return r}r.dispatch=p;r.options=c.utils.optionsFunc.bind(r);r.orient=function(u){if(!arguments.length){return m}m=u;q=m=="right"||m=="bottom";return r};r.ranges=function(u){if(!arguments.length){return f}f=u;return r};r.markers=function(u){if(!arguments.length){return l}l=u;return r};r.measures=function(u){if(!arguments.length){return e}e=u;return r};r.forceX=function(u){if(!arguments.length){return n}n=u;return r};r.width=function(u){if(!arguments.length){return g}g=u;return r};r.height=function(u){if(!arguments.length){return t}t=u;return r};r.margin=function(u){if(!arguments.length){return k}k.top=typeof u.top!="undefined"?u.top:k.top;k.right=typeof u.right!="undefined"?u.right:k.right;k.bottom=typeof u.bottom!="undefined"?u.bottom:k.bottom;k.left=typeof u.left!="undefined"?u.left:k.left;return r};r.tickFormat=function(u){if(!arguments.length){return i}i=u;return r};r.color=function(u){if(!arguments.length){return j}j=c.utils.getColor(u);return r};return r};c.models.bulletChart=function(){var e=c.models.bullet();var l="left",n=false,j={top:5,right:40,bottom:20,left:120},g=function(u){return u.ranges},k=function(u){return u.markers},f=function(u){return u.measures},h=null,s=55,i=null,p=true,t=function(v,u,A,z,w){return"<h3>"+u+"</h3><p>"+A+"</p>"},r="No Data Available.",m=d3.dispatch("tooltipShow","tooltipHide");var q=function(y,u){var x=y.pos[0]+(u.offsetLeft||0)+j.left,w=y.pos[1]+(u.offsetTop||0)+j.top,v=t(y.key,y.label,y.value,y,o);c.tooltip.show([x,w],v,y.value<0?"e":"w",null,u)};function o(u){u.each(function(P,J){var F=d3.select(this);var v=(h||parseInt(F.style("width"))||960)-j.left-j.right,w=s-j.top-j.bottom,z=this;o.update=function(){o(u)};o.container=this;if(!P||!g.call(this,P,J)){var B=F.selectAll(".nv-noData").data([r]);B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");B.attr("x",j.left+v/2).attr("y",18+j.top+w/2).text(function(T){return T});return o}else{F.selectAll(".nv-noData").remove()}var S=g.call(this,P,J).slice().sort(d3.descending),H=k.call(this,P,J).slice().sort(d3.descending),D=f.call(this,P,J).slice().sort(d3.descending);var A=F.selectAll("g.nv-wrap.nv-bulletChart").data([P]);var x=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var I=x.append("g");var M=A.select("g");I.append("g").attr("class","nv-bulletWrap");I.append("g").attr("class","nv-titles");A.attr("transform","translate("+j.left+","+j.top+")");var N=d3.scale.linear().domain([0,Math.max(S[0],H[0],D[0])]).range(n?[v,0]:[0,v]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(N.range());this.__chart__=N;var E=function(T){return Math.abs(O(T)-O(0))},C=function(T){return Math.abs(N(T)-N(0))};var R=I.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(s-j.top-j.bottom)/2+")");R.append("text").attr("class","nv-title").text(function(T){return T.title});R.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(T){return T.subtitle});e.width(v).height(w);var Q=M.select(".nv-bulletWrap");d3.transition(Q).call(e);var L=i||N.tickFormat(v/100);var K=M.selectAll("g.nv-tick").data(N.ticks(v/50),function(T){return this.textContent||L(T)});var G=K.enter().append("g").attr("class","nv-tick").attr("transform",function(T){return"translate("+O(T)+",0)"}).style("opacity",0.000001);G.append("line").attr("y1",w).attr("y2",w*7/6);G.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",w*7/6).text(L);var y=d3.transition(K).attr("transform",function(T){return"translate("+N(T)+",0)"}).style("opacity",1);y.select("line").attr("y1",w).attr("y2",w*7/6);y.select("text").attr("y",w*7/6);d3.transition(K.exit()).attr("transform",function(T){return"translate("+N(T)+",0)"}).style("opacity",0.000001).remove();m.on("tooltipShow",function(T){T.key=P.title;if(p){q(T,z.parentNode)}})});d3.timer.flush();return o}e.dispatch.on("elementMouseover.tooltip",function(u){m.tooltipShow(u)});e.dispatch.on("elementMouseout.tooltip",function(u){m.tooltipHide(u)});m.on("tooltipHide",function(){if(p){c.tooltip.cleanup()}});o.dispatch=m;o.bullet=e;d3.rebind(o,e,"color");o.options=c.utils.optionsFunc.bind(o);o.orient=function(u){if(!arguments.length){return l}l=u;n=l=="right"||l=="bottom";return o};o.ranges=function(u){if(!arguments.length){return g}g=u;return o};o.markers=function(u){if(!arguments.length){return k}k=u;return o};o.measures=function(u){if(!arguments.length){return f}f=u;return o};o.width=function(u){if(!arguments.length){return h}h=u;return o};o.height=function(u){if(!arguments.length){return s}s=u;return o};o.margin=function(u){if(!arguments.length){return j}j.top=typeof u.top!="undefined"?u.top:j.top;j.right=typeof u.right!="undefined"?u.right:j.right;j.bottom=typeof u.bottom!="undefined"?u.bottom:j.bottom;j.left=typeof u.left!="undefined"?u.left:j.left;return o};o.tickFormat=function(u){if(!arguments.length){return i}i=u;return o};o.tooltips=function(u){if(!arguments.length){return p}p=u;return o};o.tooltipContent=function(u){if(!arguments.length){return t}t=u;return o};o.noData=function(u){if(!arguments.length){return r}r=u;return o};return o};c.models.cumulativeLineChart=function(){var f=c.models.line(),r=c.models.axis(),e=c.models.axis(),h=c.models.legend(),A=c.models.legend(),F=c.interactiveGuideline();var C={top:30,right:30,bottom:50,left:60},H=c.utils.defaultColor(),G=null,D=null,I=true,J=true,v=true,q=false,g=true,K=true,u=false,p=true,m=function(O,N,R,Q,P){return"<h3>"+O+"</h3><p>"+R+" at "+N+"</p>"},t,s,E=f.id(),l={index:0,rescaleY:p},n=null,k="No Data Available.",i=function(x){return x.average},M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),z=250;r.orient("bottom").tickPadding(7);e.orient((q)?"right":"left");A.updateState(false);var w=d3.scale.linear(),o={i:0,x:0};var j=function(S,O){var R=S.pos[0]+(O.offsetLeft||0),Q=S.pos[1]+(O.offsetTop||0),N=r.tickFormat()(f.x()(S.point,S.pointIndex)),T=e.tickFormat()(f.y()(S.point,S.pointIndex)),P=m(S.series.key,N,T,S,B);c.tooltip.show([R,Q],P,null,null,O)};function B(x){x.each(function(aj){var W=d3.select(this).classed("nv-chart-"+E,true),T=this;var N=(G||parseInt(W.style("width"))||960)-C.left-C.right,P=(D||parseInt(W.style("height"))||400)-C.top-C.bottom;B.update=function(){W.transition().duration(z).call(B)};B.container=this;l.disabled=aj.map(function(al){return !!al.disabled});if(!n){var ak;n={};for(ak in l){if(l[ak] instanceof Array){n[ak]=l[ak].slice(0)}else{n[ak]=l[ak]}}}var ai=d3.behavior.drag().on("dragstart",ag).on("drag",ah).on("dragend",ab);function ag(am,al){d3.select(B.container).style("cursor","ew-resize")}function ah(am,al){o.x=d3.event.x;o.i=Math.round(w.invert(o.x));Z()}function ab(am,al){d3.select(B.container).style("cursor","auto");l.index=o.i;M.stateChange(l)}if(!aj||!aj.length||!aj.filter(function(al){return al.values.length}).length){var V=W.selectAll(".nv-noData").data([k]);V.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");V.attr("x",C.left+N/2).attr("y",C.top+P/2).text(function(al){return al});return B}else{W.selectAll(".nv-noData").remove()}t=f.xScale();s=f.yScale();if(!p){var O=aj.filter(function(al){return !al.disabled}).map(function(an,am){var al=d3.extent(an.values,f.y());if(al[0]<-0.95){al[0]=-0.95}return[(al[0]-al[1])/(1+al[1]),(al[1]-al[0])/(1+al[0])]});var Q=[d3.min(O,function(al){return al[0]}),d3.max(O,function(al){return al[1]})];f.yDomain(Q)}else{f.yDomain(null)}w.domain([0,aj[0].values.length-1]).range([0,N]).clamp(true);var aj=L(o.i,aj);var ae=(u)?"none":"all";var U=W.selectAll("g.nv-wrap.nv-cumulativeLine").data([aj]);var Y=U.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var af=U.select("g");Y.append("g").attr("class","nv-interactive");Y.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");Y.append("g").attr("class","nv-y nv-axis");Y.append("g").attr("class","nv-background");Y.append("g").attr("class","nv-linesWrap").style("pointer-events",ae);Y.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");Y.append("g").attr("class","nv-legendWrap");Y.append("g").attr("class","nv-controlsWrap");if(I){h.width(N);af.select(".nv-legendWrap").datum(aj).call(h);if(C.top!=h.height()){C.top=h.height();P=(D||parseInt(W.style("height"))||400)-C.top-C.bottom}af.select(".nv-legendWrap").attr("transform","translate(0,"+(-C.top)+")")}if(K){var S=[{key:"Re-scale y-axis",disabled:!p}];A.width(140).color(["#444","#444","#444"]);af.select(".nv-controlsWrap").datum(S).attr("transform","translate(0,"+(-C.top)+")").call(A)}U.attr("transform","translate("+C.left+","+C.top+")");if(q){af.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)")}var y=aj.filter(function(al){return al.tempDisabled});U.select(".tempDisabled").remove();if(y.length){U.append("text").attr("class","tempDisabled").attr("x",N/2).attr("y","-.71em").style("text-anchor","end").text(y.map(function(al){return al.key}).join(", ")+" values cannot be calculated for this time period.")}if(u){F.width(N).height(P).margin({left:C.left,top:C.top}).svgContainer(W).xScale(t);U.select(".nv-interactive").call(F)}Y.select(".nv-background").append("rect");af.select(".nv-background rect").attr("width",N).attr("height",P);f.y(function(al){return al.display.y}).width(N).height(P).color(aj.map(function(am,al){return am.color||H(am,al)}).filter(function(am,al){return !aj[al].disabled&&!aj[al].tempDisabled}));var aa=af.select(".nv-linesWrap").datum(aj.filter(function(al){return !al.disabled&&!al.tempDisabled}));aa.call(f);aj.forEach(function(am,al){am.seriesIndex=al});var ad=aj.filter(function(al){return !al.disabled&&!!i(al)});var ac=af.select(".nv-avgLinesWrap").selectAll("line").data(ad,function(al){return al.key});var R=function(am){var al=s(i(am));if(al<0){return 0}if(al>P){return P}return al};ac.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(am,al){return f.color()(am,am.seriesIndex)}).attr("x1",0).attr("x2",N).attr("y1",R).attr("y2",R);ac.style("stroke-opacity",function(am){var al=s(i(am));if(al<0||al>P){return 0}return 1}).attr("x1",0).attr("x2",N).attr("y1",R).attr("y2",R);ac.exit().remove();var X=aa.selectAll(".nv-indexLine").data([o]);X.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",0.5).style("pointer-events","all").call(ai);X.attr("transform",function(al){return"translate("+w(al.i)+",0)"}).attr("height",P);if(J){r.scale(t).ticks(Math.min(aj[0].values.length,N/70)).tickSize(-P,0);af.select(".nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")");d3.transition(af.select(".nv-x.nv-axis")).call(r)}if(v){e.scale(s).ticks(P/36).tickSize(-N,0);d3.transition(af.select(".nv-y.nv-axis")).call(e)}function Z(){X.data([o]);var al=B.transitionDuration();B.transitionDuration(0);B.update();B.transitionDuration(al)}af.select(".nv-background rect").on("click",function(){o.x=d3.mouse(this)[0];o.i=Math.round(w.invert(o.x));l.index=o.i;M.stateChange(l);Z()});f.dispatch.on("elementClick",function(al){o.i=al.pointIndex;o.x=w(o.i);l.index=o.i;M.stateChange(l);Z()});A.dispatch.on("legendClick",function(am,al){am.disabled=!am.disabled;p=!am.disabled;l.rescaleY=p;M.stateChange(l);B.update()});h.dispatch.on("stateChange",function(al){l.disabled=al.disabled;M.stateChange(l);B.update()});F.dispatch.on("elementMousemove",function(aq){f.clearHighlights();var ap,ao,al,an=[];aj.filter(function(at,ar){at.seriesIndex=ar;return !at.disabled}).forEach(function(au,at){ao=c.interactiveBisect(au.values,aq.pointXValue,B.x());f.highlightPoint(at,ao,true);var ar=au.values[ao];if(typeof ar==="undefined"){return}if(typeof ap==="undefined"){ap=ar}if(typeof al==="undefined"){al=B.xScale()(B.x()(ar,ao))}an.push({key:au.key,value:B.y()(ar,ao),color:H(au,au.seriesIndex)})});var am=r.tickFormat()(B.x()(ap,ao));F.tooltip.position({left:al+C.left,top:aq.mouseY+C.top}).chartContainer(T.parentNode).enabled(g).valueFormatter(function(at,ar){return e.tickFormat()(at)}).data({value:am,series:an})();F.renderGuideLine(al)});F.dispatch.on("elementMouseout",function(al){M.tooltipHide();f.clearHighlights()});M.on("tooltipShow",function(al){if(g){j(al,T.parentNode)}});M.on("changeState",function(al){if(typeof al.disabled!=="undefined"){aj.forEach(function(an,am){an.disabled=al.disabled[am]});l.disabled=al.disabled}if(typeof al.index!=="undefined"){o.i=al.index;o.x=w(o.i);l.index=al.index;X.data([o])}if(typeof al.rescaleY!=="undefined"){p=al.rescaleY}B.update()})});return B}f.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+C.left,x.pos[1]+C.top];M.tooltipShow(x)});f.dispatch.on("elementMouseout.tooltip",function(x){M.tooltipHide(x)});M.on("tooltipHide",function(){if(g){c.tooltip.cleanup()}});B.dispatch=M;B.lines=f;B.legend=h;B.xAxis=r;B.yAxis=e;B.interactiveLayer=F;d3.rebind(B,f,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");B.options=c.utils.optionsFunc.bind(B);B.margin=function(x){if(!arguments.length){return C}C.top=typeof x.top!="undefined"?x.top:C.top;C.right=typeof x.right!="undefined"?x.right:C.right;C.bottom=typeof x.bottom!="undefined"?x.bottom:C.bottom;C.left=typeof x.left!="undefined"?x.left:C.left;return B};B.width=function(x){if(!arguments.length){return G}G=x;return B};B.height=function(x){if(!arguments.length){return D}D=x;return B};B.color=function(x){if(!arguments.length){return H}H=c.utils.getColor(x);h.color(H);return B};B.rescaleY=function(x){if(!arguments.length){return p}p=x;return p};B.showControls=function(x){if(!arguments.length){return K}K=x;return B};B.useInteractiveGuideline=function(x){if(!arguments.length){return u}u=x;if(x===true){B.interactive(false);B.useVoronoi(false)}return B};B.showLegend=function(x){if(!arguments.length){return I}I=x;return B};B.showXAxis=function(x){if(!arguments.length){return J}J=x;return B};B.showYAxis=function(x){if(!arguments.length){return v}v=x;return B};B.rightAlignYAxis=function(x){if(!arguments.length){return q}q=x;e.orient((x)?"right":"left");return B};B.tooltips=function(x){if(!arguments.length){return g}g=x;return B};B.tooltipContent=function(x){if(!arguments.length){return m}m=x;return B};B.state=function(x){if(!arguments.length){return l}l=x;return B};B.defaultState=function(x){if(!arguments.length){return n}n=x;return B};B.noData=function(x){if(!arguments.length){return k}k=x;return B};B.average=function(x){if(!arguments.length){return i}i=x;return B};B.transitionDuration=function(x){if(!arguments.length){return z}z=x;return B};function L(x,y){return y.map(function(N,P){if(!N.values){return N}var O=f.y()(N.values[x],x);if(O<-0.95){N.tempDisabled=true;return N}N.tempDisabled=false;N.values=N.values.map(function(Q,R){Q.display={y:(f.y()(Q,R)-O)/(1+O)};return Q});return N})}return B};c.models.discreteBar=function(){var k={top:0,right:0,bottom:0,left:0},o=960,m=500,n=Math.floor(Math.random()*10000),i=d3.scale.ordinal(),h=d3.scale.linear(),v=function(x){return x.x},t=function(x){return x.y},f=[0],s=c.utils.defaultColor(),w=false,g=d3.format(",.2f"),q,p,l,r,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),z="discreteBar";var u,e;function j(x){x.each(function(I){var L=o-k.left-k.right,E=m-k.top-k.bottom,B=d3.select(this);I=I.map(function(N,M){N.values=N.values.map(function(O){O.series=M;return O});return N});var D=(q&&p)?[]:I.map(function(M){return M.values.map(function(O,N){return{x:v(O,N),y:t(O,N),y0:O.y0}})});i.domain(q||d3.merge(D).map(function(M){return M.x})).rangeBands(l||[0,L],0.1);h.domain(p||d3.extent(d3.merge(D).map(function(M){return M.y}).concat(f)));if(w){h.range(r||[E-(h.domain()[0]<0?12:0),h.domain()[1]>0?12:0])}else{h.range(r||[E,0])}u=u||i;e=e||h.copy().range([h(0),h(0)]);var C=B.selectAll("g.nv-wrap.nv-discretebar").data([I]);var G=C.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var y=G.append("g");var J=C.select("g");y.append("g").attr("class","nv-groups");C.attr("transform","translate("+k.left+","+k.top+")");var F=C.select(".nv-groups").selectAll(".nv-group").data(function(M){return M},function(M){return M.key});F.enter().append("g").style("stroke-opacity",0.000001).style("fill-opacity",0.000001);F.exit().transition().style("stroke-opacity",0.000001).style("fill-opacity",0.000001).remove();F.attr("class",function(N,M){return"nv-group nv-series-"+M}).classed("hover",function(M){return M.hover});F.transition().style("stroke-opacity",1).style("fill-opacity",0.75);var K=F.selectAll("g.nv-bar").data(function(M){return M.values});K.exit().remove();var H=K.enter().append("g").attr("transform",function(O,N,M){return"translate("+(i(v(O,N))+i.rangeBand()*0.05)+", "+h(0)+")"}).on("mouseover",function(N,M){d3.select(this).classed("hover",true);A.elementMouseover({value:t(N,M),point:N,series:I[N.series],pos:[i(v(N,M))+(i.rangeBand()*(N.series+0.5)/I.length),h(t(N,M))],pointIndex:M,seriesIndex:N.series,e:d3.event})}).on("mouseout",function(N,M){d3.select(this).classed("hover",false);A.elementMouseout({value:t(N,M),point:N,series:I[N.series],pointIndex:M,seriesIndex:N.series,e:d3.event})}).on("click",function(N,M){A.elementClick({value:t(N,M),point:N,series:I[N.series],pos:[i(v(N,M))+(i.rangeBand()*(N.series+0.5)/I.length),h(t(N,M))],pointIndex:M,seriesIndex:N.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(N,M){A.elementDblClick({value:t(N,M),point:N,series:I[N.series],pos:[i(v(N,M))+(i.rangeBand()*(N.series+0.5)/I.length),h(t(N,M))],pointIndex:M,seriesIndex:N.series,e:d3.event});d3.event.stopPropagation()});H.append("rect").attr("height",0).attr("width",i.rangeBand()*0.9/I.length);if(w){H.append("text").attr("text-anchor","middle");K.select("text").text(function(N,M){return g(t(N,M))}).transition().attr("x",i.rangeBand()*0.9/2).attr("y",function(N,M){return t(N,M)<0?h(t(N,M))-h(0)+12:-4})}else{K.selectAll("text").remove()}K.attr("class",function(N,M){return t(N,M)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(N,M){return N.color||s(N,M)}).style("stroke",function(N,M){return N.color||s(N,M)}).select("rect").attr("class",z).transition().attr("width",i.rangeBand()*0.9/I.length);K.transition().attr("transform",function(P,M){var O=i(v(P,M))+i.rangeBand()*0.05,N=t(P,M)<0?h(0):h(0)-h(t(P,M))<1?h(0)-1:h(t(P,M));return"translate("+O+", "+N+")"}).select("rect").attr("height",function(N,M){return Math.max(Math.abs(h(t(N,M))-h((p&&p[0])||0))||1)});u=i.copy();e=h.copy()});return j}j.dispatch=A;j.options=c.utils.optionsFunc.bind(j);j.x=function(x){if(!arguments.length){return v}v=x;return j};j.y=function(x){if(!arguments.length){return t}t=x;return j};j.margin=function(x){if(!arguments.length){return k}k.top=typeof x.top!="undefined"?x.top:k.top;k.right=typeof x.right!="undefined"?x.right:k.right;k.bottom=typeof x.bottom!="undefined"?x.bottom:k.bottom;k.left=typeof x.left!="undefined"?x.left:k.left;return j};j.width=function(x){if(!arguments.length){return o}o=x;return j};j.height=function(x){if(!arguments.length){return m}m=x;return j};j.xScale=function(x){if(!arguments.length){return i}i=x;return j};j.yScale=function(x){if(!arguments.length){return h}h=x;return j};j.xDomain=function(x){if(!arguments.length){return q}q=x;return j};j.yDomain=function(x){if(!arguments.length){return p}p=x;return j};j.xRange=function(x){if(!arguments.length){return l}l=x;return j};j.yRange=function(x){if(!arguments.length){return r}r=x;return j};j.forceY=function(x){if(!arguments.length){return f}f=x;return j};j.color=function(x){if(!arguments.length){return s}s=c.utils.getColor(x);return j};j.id=function(x){if(!arguments.length){return n}n=x;return j};j.showValues=function(x){if(!arguments.length){return w}w=x;return j};j.valueFormat=function(x){if(!arguments.length){return g}g=x;return j};j.rectClass=function(x){if(!arguments.length){return z}z=x;return j};return j};c.models.discreteBarChart=function(){var w=c.models.discreteBar(),l=c.models.axis(),e=c.models.axis();var r={top:15,right:10,bottom:50,left:60},t=null,s=null,u=c.utils.getColor(),v=true,o=true,k=false,g=false,f=true,j=function(B,A,E,D,C){return"<h3>"+A+"</h3><p>"+E+"</p>"},n,m,i="No Data Available.",z=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),p=250;l.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(x){return x});e.orient((k)?"right":"left").tickFormat(d3.format(",.1f"));var h=function(F,B){var E=F.pos[0]+(B.offsetLeft||0),D=F.pos[1]+(B.offsetTop||0),A=l.tickFormat()(w.x()(F.point,F.pointIndex)),G=e.tickFormat()(w.y()(F.point,F.pointIndex)),C=j(F.series.key,A,G,F,q);c.tooltip.show([E,D],C,F.value<0?"n":"s",null,B)};function q(x){x.each(function(G){var A=d3.select(this),J=this;var K=(t||parseInt(A.style("width"))||960)-r.left-r.right,E=(s||parseInt(A.style("height"))||400)-r.top-r.bottom;q.update=function(){z.beforeUpdate();A.transition().duration(p).call(q)};q.container=this;if(!G||!G.length||!G.filter(function(L){return L.values.length}).length){var B=A.selectAll(".nv-noData").data([i]);B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");B.attr("x",r.left+K/2).attr("y",r.top+E/2).text(function(L){return L});return q}else{A.selectAll(".nv-noData").remove()}n=w.xScale();m=w.yScale().clamp(true);var C=A.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([G]);var y=C.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var D=y.append("defs");var H=C.select("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");H.attr("transform","translate("+r.left+","+r.top+")");if(k){H.select(".nv-y.nv-axis").attr("transform","translate("+K+",0)")}w.width(K).height(E);var I=H.select(".nv-barsWrap").datum(G.filter(function(L){return !L.disabled}));I.transition().call(w);D.append("clipPath").attr("id","nv-x-label-clip-"+w.id()).append("rect");H.select("#nv-x-label-clip-"+w.id()+" rect").attr("width",n.rangeBand()*(g?2:1)).attr("height",16).attr("x",-n.rangeBand()/(g?1:2));if(v){l.scale(n).ticks(K/100).tickSize(-E,0);H.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+((w.showValues()&&m.domain()[0]<0)?16:0))+")");H.select(".nv-x.nv-axis").transition().call(l);var F=H.select(".nv-x.nv-axis").selectAll("g");if(g){F.selectAll("text").attr("transform",function(N,M,L){return"translate(0,"+(L%2==0?"5":"17")+")"})}}if(o){e.scale(m).ticks(E/36).tickSize(-K,0);H.select(".nv-y.nv-axis").transition().call(e)}z.on("tooltipShow",function(L){if(f){h(L,J.parentNode)}})});return q}w.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+r.left,x.pos[1]+r.top];z.tooltipShow(x)});w.dispatch.on("elementMouseout.tooltip",function(x){z.tooltipHide(x)});z.on("tooltipHide",function(){if(f){c.tooltip.cleanup()}});q.dispatch=z;q.discretebar=w;q.xAxis=l;q.yAxis=e;d3.rebind(q,w,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");q.options=c.utils.optionsFunc.bind(q);q.margin=function(x){if(!arguments.length){return r}r.top=typeof x.top!="undefined"?x.top:r.top;r.right=typeof x.right!="undefined"?x.right:r.right;r.bottom=typeof x.bottom!="undefined"?x.bottom:r.bottom;r.left=typeof x.left!="undefined"?x.left:r.left;return q};q.width=function(x){if(!arguments.length){return t}t=x;return q};q.height=function(x){if(!arguments.length){return s}s=x;return q};q.color=function(x){if(!arguments.length){return u}u=c.utils.getColor(x);w.color(u);return q};q.showXAxis=function(x){if(!arguments.length){return v}v=x;return q};q.showYAxis=function(x){if(!arguments.length){return o}o=x;return q};q.rightAlignYAxis=function(x){if(!arguments.length){return k}k=x;e.orient((x)?"right":"left");return q};q.staggerLabels=function(x){if(!arguments.length){return g}g=x;return q};q.tooltips=function(x){if(!arguments.length){return f}f=x;return q};q.tooltipContent=function(x){if(!arguments.length){return j}j=x;return q};q.noData=function(x){if(!arguments.length){return i}i=x;return q};q.transitionDuration=function(x){if(!arguments.length){return p}p=x;return q};return q};c.models.distribution=function(){var h={top:0,right:0,bottom:0,left:0},e=400,n=8,f="x",k=function(o){return o[f]},i=c.utils.defaultColor(),g=d3.scale.linear(),j;var l;function m(o){o.each(function(t){var u=e-(f==="x"?h.left+h.right:h.top+h.bottom),x=f=="x"?"y":"x",q=d3.select(this);l=l||g;var r=q.selectAll("g.nv-distribution").data([t]);var s=r.enter().append("g").attr("class","nvd3 nv-distribution");var p=s.append("g");var v=r.select("g");r.attr("transform","translate("+h.left+","+h.top+")");var y=v.selectAll("g.nv-dist").data(function(z){return z},function(z){return z.key});y.enter().append("g");y.attr("class",function(A,z){return"nv-dist nv-series-"+z}).style("stroke",function(A,z){return i(A,z)});var w=y.selectAll("line.nv-dist"+f).data(function(z){return z.values});w.enter().append("line").attr(f+"1",function(A,z){return l(k(A,z))}).attr(f+"2",function(A,z){return l(k(A,z))});y.exit().selectAll("line.nv-dist"+f).transition().attr(f+"1",function(A,z){return g(k(A,z))}).attr(f+"2",function(A,z){return g(k(A,z))}).style("stroke-opacity",0).remove();w.attr("class",function(A,z){return"nv-dist"+f+" nv-dist"+f+"-"+z}).attr(x+"1",0).attr(x+"2",n);w.transition().attr(f+"1",function(A,z){return g(k(A,z))}).attr(f+"2",function(A,z){return g(k(A,z))});l=g.copy()});return m}m.options=c.utils.optionsFunc.bind(m);m.margin=function(o){if(!arguments.length){return h}h.top=typeof o.top!="undefined"?o.top:h.top;h.right=typeof o.right!="undefined"?o.right:h.right;h.bottom=typeof o.bottom!="undefined"?o.bottom:h.bottom;h.left=typeof o.left!="undefined"?o.left:h.left;return m};m.width=function(o){if(!arguments.length){return e}e=o;return m};m.axis=function(o){if(!arguments.length){return f}f=o;return m};m.size=function(o){if(!arguments.length){return n}n=o;return m};m.getData=function(o){if(!arguments.length){return k}k=d3.functor(o);return m};m.scale=function(o){if(!arguments.length){return g}g=o;return m};m.color=function(o){if(!arguments.length){return i}i=c.utils.getColor(o);return m};return m};c.models.historicalBar=function(){var k={top:0,right:0,bottom:0,left:0},o=960,m=500,n=Math.floor(Math.random()*10000),h=d3.scale.linear(),g=d3.scale.linear(),u=function(x){return x.x},t=function(x){return x.y},f=[],e=[0],i=false,w=true,s=c.utils.defaultColor(),q,p,l,r,z=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),v=true;function j(x){x.each(function(G){var J=o-k.left-k.right,C=m-k.top-k.bottom,A=d3.select(this);h.domain(q||d3.extent(G[0].values.map(u).concat(f)));if(i){h.range(l||[J*0.5/G[0].values.length,J*(G[0].values.length-0.5)/G[0].values.length])}else{h.range(l||[0,J])}g.domain(p||d3.extent(G[0].values.map(t).concat(e))).range(r||[C,0]);if(h.domain()[0]===h.domain()[1]){h.domain()[0]?h.domain([h.domain()[0]-h.domain()[0]*0.01,h.domain()[1]+h.domain()[1]*0.01]):h.domain([-1,1])}if(g.domain()[0]===g.domain()[1]){g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*0.01,g.domain()[1]-g.domain()[1]*0.01]):g.domain([-1,1])}var B=A.selectAll("g.nv-wrap.nv-historicalBar-"+n).data([G[0].values]);var E=B.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+n);var D=E.append("defs");var y=E.append("g");var H=B.select("g");y.append("g").attr("class","nv-bars");B.attr("transform","translate("+k.left+","+k.top+")");A.on("click",function(L,K){z.chartClick({data:L,index:K,pos:d3.event,id:n})});D.append("clipPath").attr("id","nv-chart-clip-path-"+n).append("rect");B.select("#nv-chart-clip-path-"+n+" rect").attr("width",J).attr("height",C);H.attr("clip-path",w?"url(#nv-chart-clip-path-"+n+")":"");var I=B.select(".nv-bars").selectAll(".nv-bar").data(function(K){return K},function(L,K){return u(L,K)});I.exit().remove();var F=I.enter().append("rect").attr("x",0).attr("y",function(L,K){return c.utils.NaNtoZero(g(Math.max(0,t(L,K))))}).attr("height",function(L,K){return c.utils.NaNtoZero(Math.abs(g(t(L,K))-g(0)))}).attr("transform",function(L,K){return"translate("+(h(u(L,K))-J/G[0].values.length*0.45)+",0)"}).on("mouseover",function(L,K){if(!v){return}d3.select(this).classed("hover",true);z.elementMouseover({point:L,series:G[0],pos:[h(u(L,K)),g(t(L,K))],pointIndex:K,seriesIndex:0,e:d3.event})}).on("mouseout",function(L,K){if(!v){return}d3.select(this).classed("hover",false);z.elementMouseout({point:L,series:G[0],pointIndex:K,seriesIndex:0,e:d3.event})}).on("click",function(L,K){if(!v){return}z.elementClick({value:t(L,K),data:L,index:K,pos:[h(u(L,K)),g(t(L,K))],e:d3.event,id:n});d3.event.stopPropagation()}).on("dblclick",function(L,K){if(!v){return}z.elementDblClick({value:t(L,K),data:L,index:K,pos:[h(u(L,K)),g(t(L,K))],e:d3.event,id:n});d3.event.stopPropagation()});I.attr("fill",function(L,K){return s(L,K)}).attr("class",function(M,L,K){return(t(M,L)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+K+"-"+L}).transition().attr("transform",function(L,K){return"translate("+(h(u(L,K))-J/G[0].values.length*0.45)+",0)"}).attr("width",(J/G[0].values.length)*0.9);I.transition().attr("y",function(M,K){var L=t(M,K)<0?g(0):g(0)-g(t(M,K))<1?g(0)-1:g(t(M,K));return c.utils.NaNtoZero(L)}).attr("height",function(L,K){return c.utils.NaNtoZero(Math.max(Math.abs(g(t(L,K))-g(0)),1))})});return j}j.highlightPoint=function(y,x){d3.select(".nv-historicalBar-"+n).select(".nv-bars .nv-bar-0-"+y).classed("hover",x)};j.clearHighlights=function(){d3.select(".nv-historicalBar-"+n).select(".nv-bars .nv-bar.hover").classed("hover",false)};j.dispatch=z;j.options=c.utils.optionsFunc.bind(j);j.x=function(x){if(!arguments.length){return u}u=x;return j};j.y=function(x){if(!arguments.length){return t}t=x;return j};j.margin=function(x){if(!arguments.length){return k}k.top=typeof x.top!="undefined"?x.top:k.top;k.right=typeof x.right!="undefined"?x.right:k.right;k.bottom=typeof x.bottom!="undefined"?x.bottom:k.bottom;k.left=typeof x.left!="undefined"?x.left:k.left;return j};j.width=function(x){if(!arguments.length){return o}o=x;return j};j.height=function(x){if(!arguments.length){return m}m=x;return j};j.xScale=function(x){if(!arguments.length){return h}h=x;return j};j.yScale=function(x){if(!arguments.length){return g}g=x;return j};j.xDomain=function(x){if(!arguments.length){return q}q=x;return j};j.yDomain=function(x){if(!arguments.length){return p}p=x;return j};j.xRange=function(x){if(!arguments.length){return l}l=x;return j};j.yRange=function(x){if(!arguments.length){return r}r=x;return j};j.forceX=function(x){if(!arguments.length){return f}f=x;return j};j.forceY=function(x){if(!arguments.length){return e}e=x;return j};j.padData=function(x){if(!arguments.length){return i}i=x;return j};j.clipEdge=function(x){if(!arguments.length){return w}w=x;return j};j.color=function(x){if(!arguments.length){return s}s=c.utils.getColor(x);return j};j.id=function(x){if(!arguments.length){return n}n=x;return j};j.interactive=function(x){if(!arguments.length){return v}v=false;return j};return j};c.models.historicalBarChart=function(){var v=c.models.historicalBar(),n=c.models.axis(),e=c.models.axis(),g=c.models.legend();var t={top:30,right:90,bottom:50,left:90},z=c.utils.defaultColor(),w=null,u=null,A=false,B=true,q=true,m=false,f=true,j=function(E,D,H,G,F){return"<h3>"+E+"</h3><p>"+H+" at "+D+"</p>"},p,o,k={},l=null,i="No Data Available.",C=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),r=250;n.orient("bottom").tickPadding(7);e.orient((m)?"right":"left");var h=function(G,L){if(L){var E=d3.select(L).select("svg");var M=(E.node())?E.attr("viewBox"):null;if(M){M=M.split(" ");var H=parseInt(E.style("width"))/M[2];G.pos[0]=G.pos[0]*H;G.pos[1]=G.pos[1]*H}}var D=G.pos[0]+(L.offsetLeft||0),J=G.pos[1]+(L.offsetTop||0),K=n.tickFormat()(v.x()(G.point,G.pointIndex)),I=e.tickFormat()(v.y()(G.point,G.pointIndex)),F=j(G.series.key,K,I,G,s);c.tooltip.show([D,J],F,null,null,L)};function s(x){x.each(function(H){var D=d3.select(this),K=this;var M=(w||parseInt(D.style("width"))||960)-t.left-t.right,G=(u||parseInt(D.style("height"))||400)-t.top-t.bottom;s.update=function(){D.transition().duration(r).call(s)};s.container=this;k.disabled=H.map(function(N){return !!N.disabled});if(!l){var L;l={};for(L in k){if(k[L] instanceof Array){l[L]=k[L].slice(0)}else{l[L]=k[L]}}}if(!H||!H.length||!H.filter(function(N){return N.values.length}).length){var E=D.selectAll(".nv-noData").data([i]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",t.left+M/2).attr("y",t.top+G/2).text(function(N){return N});return s}else{D.selectAll(".nv-noData").remove()}p=v.xScale();o=v.yScale();var F=D.selectAll("g.nv-wrap.nv-historicalBarChart").data([H]);var y=F.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var I=F.select("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");if(A){g.width(M);I.select(".nv-legendWrap").datum(H).call(g);if(t.top!=g.height()){t.top=g.height();G=(u||parseInt(D.style("height"))||400)-t.top-t.bottom}F.select(".nv-legendWrap").attr("transform","translate(0,"+(-t.top)+")")}F.attr("transform","translate("+t.left+","+t.top+")");if(m){I.select(".nv-y.nv-axis").attr("transform","translate("+M+",0)")}v.width(M).height(G).color(H.map(function(O,N){return O.color||z(O,N)}).filter(function(O,N){return !H[N].disabled}));var J=I.select(".nv-barsWrap").datum(H.filter(function(N){return !N.disabled}));J.transition().call(v);if(B){n.scale(p).tickSize(-G,0);I.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")");I.select(".nv-x.nv-axis").transition().call(n)}if(q){e.scale(o).ticks(G/36).tickSize(-M,0);I.select(".nv-y.nv-axis").transition().call(e)}g.dispatch.on("legendClick",function(O,N){O.disabled=!O.disabled;if(!H.filter(function(P){return !P.disabled}).length){H.map(function(P){P.disabled=false;F.selectAll(".nv-series").classed("disabled",false);return P})}k.disabled=H.map(function(P){return !!P.disabled});C.stateChange(k);x.transition().call(s)});g.dispatch.on("legendDblclick",function(N){H.forEach(function(O){O.disabled=true});N.disabled=false;k.disabled=H.map(function(O){return !!O.disabled});C.stateChange(k);s.update()});C.on("tooltipShow",function(N){if(f){h(N,K.parentNode)}});C.on("changeState",function(N){if(typeof N.disabled!=="undefined"){H.forEach(function(P,O){P.disabled=N.disabled[O]});k.disabled=N.disabled}x.call(s)})});return s}v.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+t.left,x.pos[1]+t.top];C.tooltipShow(x)});v.dispatch.on("elementMouseout.tooltip",function(x){C.tooltipHide(x)});C.on("tooltipHide",function(){if(f){c.tooltip.cleanup()}});s.dispatch=C;s.bars=v;s.legend=g;s.xAxis=n;s.yAxis=e;d3.rebind(s,v,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");s.options=c.utils.optionsFunc.bind(s);s.margin=function(x){if(!arguments.length){return t}t.top=typeof x.top!="undefined"?x.top:t.top;t.right=typeof x.right!="undefined"?x.right:t.right;t.bottom=typeof x.bottom!="undefined"?x.bottom:t.bottom;t.left=typeof x.left!="undefined"?x.left:t.left;return s};s.width=function(x){if(!arguments.length){return w}w=x;return s};s.height=function(x){if(!arguments.length){return u}u=x;return s};s.color=function(x){if(!arguments.length){return z}z=c.utils.getColor(x);g.color(z);return s};s.showLegend=function(x){if(!arguments.length){return A}A=x;return s};s.showXAxis=function(x){if(!arguments.length){return B}B=x;return s};s.showYAxis=function(x){if(!arguments.length){return q}q=x;return s};s.rightAlignYAxis=function(x){if(!arguments.length){return m}m=x;e.orient((x)?"right":"left");return s};s.tooltips=function(x){if(!arguments.length){return f}f=x;return s};s.tooltipContent=function(x){if(!arguments.length){return j}j=x;return s};s.state=function(x){if(!arguments.length){return k}k=x;return s};s.defaultState=function(x){if(!arguments.length){return l}l=x;return s};s.noData=function(x){if(!arguments.length){return i}i=x;return s};s.transitionDuration=function(x){if(!arguments.length){return r}r=x;return s};return s};c.models.indentedTree=function(){var i={top:0,right:0,bottom:0,left:0},g=960,t=500,j=c.utils.defaultColor(),f=Math.floor(Math.random()*10000),l=true,u=false,s="No Data Available.",m=20,h=[{key:"key",label:"Name",type:"text"}],q=null,e="images/grey-plus.png",k="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),p=function(v){return v.url};var r=0;function o(v){v.each(function(L){var M=1,A=d3.select(this);var B=d3.layout.tree().children(function(O){return O.values}).size([t,m]);o.update=function(){A.transition().duration(600).call(o)};if(!L[0]){L[0]={key:s}}var D=B.nodes(L[0]);var z=d3.select(this).selectAll("div").data([[D]]);var x=z.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var N=x.append("table");var I=z.select("table").attr("width","100%").attr("class",q);if(l){var H=N.append("thead");var K=H.append("tr");h.forEach(function(O){K.append("th").attr("width",O.width?O.width:"10%").style("text-align",O.type=="numeric"?"right":"left").append("span").text(O.label)})}var w=I.selectAll("tbody").data(function(O){return O});w.enter().append("tbody");M=d3.max(D,function(O){return O.depth});B.size([t,M*m]);var F=w.selectAll("tr").data(function(O){return O.filter(function(P){return(u&&!P.children)?u(P):true})},function(P,O){return P.id||(P.id||++r)});F.exit().remove();F.select("img.nv-treeicon").attr("src",J).classed("folded",C);var y=F.enter().append("tr");h.forEach(function(P,O){var Q=y.append("td").style("padding-left",function(R){return(O?0:R.depth*m+12+(J(R)?0:16))+"px"},"important").style("text-align",P.type=="numeric"?"right":"left");if(O==0){Q.append("img").classed("nv-treeicon",true).classed("nv-folded",C).attr("src",J).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(R){return J(R)?"inline-block":"none"}).on("click",E)}Q.each(function(R){if(!O&&p(R)){d3.select(this).append("a").attr("href",p).attr("class",d3.functor(P.classes)).append("span")}else{d3.select(this).append("span")}d3.select(this).select("span").attr("class",d3.functor(P.classes)).text(function(S){return P.format?P.format(S):(S[P.key]||"-")})});if(P.showCount){Q.append("span").attr("class","nv-childrenCount");F.selectAll("span.nv-childrenCount").text(function(R){return((R.values&&R.values.length)||(R._values&&R._values.length))?"("+((R.values&&(R.values.filter(function(S){return u?u(S):true}).length))||(R._values&&R._values.filter(function(S){return u?u(S):true}).length)||0)+")":""})}});F.order().on("click",function(O){n.elementClick({row:this,data:O,pos:[O.x,O.y]})}).on("dblclick",function(O){n.elementDblclick({row:this,data:O,pos:[O.x,O.y]})}).on("mouseover",function(O){n.elementMouseover({row:this,data:O,pos:[O.x,O.y]})}).on("mouseout",function(O){n.elementMouseout({row:this,data:O,pos:[O.x,O.y]})});function E(Q,P,O){d3.event.stopPropagation();if(d3.event.shiftKey&&!O){d3.event.shiftKey=false;Q.values&&Q.values.forEach(function(R){if(R.values||R._values){E(R,0,true)}});return true}if(!G(Q)){return true}if(Q.values){Q._values=Q.values;Q.values=null}else{Q.values=Q._values;Q._values=null}o.update()}function J(O){return(O._values&&O._values.length)?e:(O.values&&O.values.length)?k:""}function C(O){return(O._values&&O._values.length)}function G(P){var O=P.values||P._values;return(O&&O.length)}});return o}o.options=c.utils.optionsFunc.bind(o);o.margin=function(v){if(!arguments.length){return i}i.top=typeof v.top!="undefined"?v.top:i.top;i.right=typeof v.right!="undefined"?v.right:i.right;i.bottom=typeof v.bottom!="undefined"?v.bottom:i.bottom;i.left=typeof v.left!="undefined"?v.left:i.left;return o};o.width=function(v){if(!arguments.length){return g}g=v;return o};o.height=function(v){if(!arguments.length){return t}t=v;return o};o.color=function(v){if(!arguments.length){return j}j=c.utils.getColor(v);scatter.color(j);return o};o.id=function(v){if(!arguments.length){return f}f=v;return o};o.header=function(v){if(!arguments.length){return l}l=v;return o};o.noData=function(v){if(!arguments.length){return s}s=v;return o};o.filterZero=function(v){if(!arguments.length){return u}u=v;return o};o.columns=function(v){if(!arguments.length){return h}h=v;return o};o.tableClass=function(v){if(!arguments.length){return q}q=v;return o};o.iconOpen=function(v){if(!arguments.length){return e}e=v;return o};o.iconClose=function(v){if(!arguments.length){return k}k=v;return o};o.getUrl=function(v){if(!arguments.length){return p}p=v;return o};return o};c.models.legend=function(){var h={top:5,right:0,bottom:5,left:0},f=400,n=20,j=function(p){return p.key},i=c.utils.defaultColor(),l=true,g=true,o=true,e=false,k=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");function m(p){p.each(function(J){var q=f-h.left-h.right,B=d3.select(this);var z=B.selectAll("g.nv-legend").data([J]);var F=z.enter().append("g").attr("class","nvd3 nv-legend").append("g");var I=z.select("g");z.attr("transform","translate("+h.left+","+h.top+")");var A=I.selectAll(".nv-series").data(function(K){return K});var u=A.enter().append("g").attr("class","nv-series").on("mouseover",function(L,K){k.legendMouseover(L,K)}).on("mouseout",function(L,K){k.legendMouseout(L,K)}).on("click",function(L,K){k.legendClick(L,K);if(o){if(e){J.forEach(function(M){M.disabled=true});L.disabled=false}else{L.disabled=!L.disabled;if(J.every(function(M){return M.disabled})){J.forEach(function(M){M.disabled=false})}}k.stateChange({disabled:J.map(function(M){return !!M.disabled})})}}).on("dblclick",function(L,K){k.legendDblclick(L,K);if(o){J.forEach(function(M){M.disabled=true});L.disabled=false;k.stateChange({disabled:J.map(function(M){return !!M.disabled})})}});u.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);u.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");A.classed("disabled",function(K){return K.disabled});A.exit().remove();A.select("circle").style("fill",function(L,K){return L.color||i(L,K)}).style("stroke",function(L,K){return L.color||i(L,K)});A.select("text").text(j);if(l){var t=[];A.each(function(O,M){var L=d3.select(this).select("text");var K;try{K=L.node().getComputedTextLength()}catch(N){K=c.utils.calcApproxTextWidth(L)}t.push(K+28)});var x=0;var E=0;var C=[];while(E<q&&x<t.length){C[x]=t[x];E+=t[x++]}if(x===0){x=1}while(E>q&&x>1){C=[];x--;for(var G=0;G<t.length;G++){if(t[G]>(C[G%x]||0)){C[G%x]=t[G]}}E=C.reduce(function(L,M,K,N){return L+M})}var r=[];for(var H=0,y=0;H<x;H++){r[H]=y;y+=C[H]}A.attr("transform",function(L,K){return"translate("+r[K%x]+","+(5+Math.floor(K/x)*20)+")"});if(g){I.attr("transform","translate("+(f-h.right-E)+","+h.top+")")}else{I.attr("transform","translate(0,"+h.top+")")}n=h.top+h.bottom+(Math.ceil(t.length/x)*20)}else{var v=5,w=5,D=0,s;A.attr("transform",function(M,K){var L=d3.select(this).select("text").node().getComputedTextLength()+28;s=w;if(f<h.left+h.right+s+L){w=s=5;v+=20}w+=L;if(w>D){D=w}return"translate("+s+","+v+")"});I.attr("transform","translate("+(f-h.right-D)+","+h.top+")");n=h.top+h.bottom+v+15}});return m}m.dispatch=k;m.options=c.utils.optionsFunc.bind(m);m.margin=function(p){if(!arguments.length){return h}h.top=typeof p.top!="undefined"?p.top:h.top;h.right=typeof p.right!="undefined"?p.right:h.right;h.bottom=typeof p.bottom!="undefined"?p.bottom:h.bottom;h.left=typeof p.left!="undefined"?p.left:h.left;return m};m.width=function(p){if(!arguments.length){return f}f=p;return m};m.height=function(p){if(!arguments.length){return n}n=p;return m};m.key=function(p){if(!arguments.length){return j}j=p;return m};m.color=function(p){if(!arguments.length){return i}i=c.utils.getColor(p);return m};m.align=function(p){if(!arguments.length){return l}l=p;return m};m.rightAlign=function(p){if(!arguments.length){return g}g=p;return m};m.updateState=function(p){if(!arguments.length){return o}o=p;return m};m.radioButtonMode=function(p){if(!arguments.length){return e}e=p;return m};return m};c.models.line=function(){var e=c.models.scatter();var i={top:0,right:0,bottom:0,left:0},f=960,t=500,j=c.utils.defaultColor(),s=function(u){return u.x},r=function(u){return u.y},h=function(v,u){return !isNaN(r(v,u))&&r(v,u)!==null},m=function(u){return u.area},q=false,o,n,k="linear";e.size(16).sizeDomain([16,256]);var g,p;function l(u){u.each(function(E){var H=f-i.left-i.right,z=t-i.top-i.bottom,w=d3.select(this);o=e.xScale();n=e.yScale();g=g||o;p=p||n;var x=w.selectAll("g.nv-wrap.nv-line").data([E]);var C=x.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var A=C.append("defs");var v=C.append("g");var F=x.select("g");v.append("g").attr("class","nv-groups");v.append("g").attr("class","nv-scatterWrap");x.attr("transform","translate("+i.left+","+i.top+")");e.width(H).height(z);var y=x.select(".nv-scatterWrap");y.transition().call(e);A.append("clipPath").attr("id","nv-edge-clip-"+e.id()).append("rect");x.select("#nv-edge-clip-"+e.id()+" rect").attr("width",H).attr("height",z);F.attr("clip-path",q?"url(#nv-edge-clip-"+e.id()+")":"");y.attr("clip-path",q?"url(#nv-edge-clip-"+e.id()+")":"");var B=x.select(".nv-groups").selectAll(".nv-group").data(function(I){return I},function(I){return I.key});B.enter().append("g").style("stroke-opacity",0.000001).style("fill-opacity",0.000001);B.exit().transition().style("stroke-opacity",0.000001).style("fill-opacity",0.000001).remove();B.attr("class",function(J,I){return"nv-group nv-series-"+I}).classed("hover",function(I){return I.hover}).style("fill",function(J,I){return j(J,I)}).style("stroke",function(J,I){return j(J,I)});B.transition().style("stroke-opacity",1).style("fill-opacity",0.5);var G=B.selectAll("path.nv-area").data(function(I){return m(I)?[I]:[]});G.enter().append("path").attr("class","nv-area").attr("d",function(I){return d3.svg.area().interpolate(k).defined(h).x(function(K,J){return c.utils.NaNtoZero(g(s(K,J)))}).y0(function(K,J){return c.utils.NaNtoZero(p(r(K,J)))}).y1(function(K,J){return p(n.domain()[0]<=0?n.domain()[1]>=0?0:n.domain()[1]:n.domain()[0])}).apply(this,[I.values])});B.exit().selectAll("path.nv-area").remove();G.transition().attr("d",function(I){return d3.svg.area().interpolate(k).defined(h).x(function(K,J){return c.utils.NaNtoZero(o(s(K,J)))}).y0(function(K,J){return c.utils.NaNtoZero(n(r(K,J)))}).y1(function(K,J){return n(n.domain()[0]<=0?n.domain()[1]>=0?0:n.domain()[1]:n.domain()[0])}).apply(this,[I.values])});var D=B.selectAll("path.nv-line").data(function(I){return[I.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(k).defined(h).x(function(J,I){return c.utils.NaNtoZero(g(s(J,I)))}).y(function(J,I){return c.utils.NaNtoZero(p(r(J,I)))}));B.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(k).defined(h).x(function(J,I){return c.utils.NaNtoZero(o(s(J,I)))}).y(function(J,I){return c.utils.NaNtoZero(n(r(J,I)))}));D.transition().attr("d",d3.svg.line().interpolate(k).defined(h).x(function(J,I){return c.utils.NaNtoZero(o(s(J,I)))}).y(function(J,I){return c.utils.NaNtoZero(n(r(J,I)))}));g=o.copy();p=n.copy()});return l}l.dispatch=e.dispatch;l.scatter=e;d3.rebind(l,e,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");l.options=c.utils.optionsFunc.bind(l);l.margin=function(u){if(!arguments.length){return i}i.top=typeof u.top!="undefined"?u.top:i.top;i.right=typeof u.right!="undefined"?u.right:i.right;i.bottom=typeof u.bottom!="undefined"?u.bottom:i.bottom;i.left=typeof u.left!="undefined"?u.left:i.left;return l};l.width=function(u){if(!arguments.length){return f}f=u;return l};l.height=function(u){if(!arguments.length){return t}t=u;return l};l.x=function(u){if(!arguments.length){return s}s=u;e.x(u);return l};l.y=function(u){if(!arguments.length){return r}r=u;e.y(u);return l};l.clipEdge=function(u){if(!arguments.length){return q}q=u;return l};l.color=function(u){if(!arguments.length){return j}j=c.utils.getColor(u);e.color(j);return l};l.interpolate=function(u){if(!arguments.length){return k}k=u;return l};l.defined=function(u){if(!arguments.length){return h}h=u;return l};l.isArea=function(u){if(!arguments.length){return m}m=d3.functor(u);return l};return l};c.models.lineChart=function(){var f=c.models.line(),o=c.models.axis(),e=c.models.axis(),h=c.models.legend(),z=c.interactiveGuideline();var v={top:30,right:20,bottom:50,left:60},B=c.utils.defaultColor(),A=null,w=null,C=true,D=true,s=true,n=false,r=false,g=true,l=function(G,F,J,I,H){return"<h3>"+G+"</h3><p>"+J+" at "+F+"</p>"},q,p,k={},m=null,j="No Data Available.",E=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),t=250;o.orient("bottom").tickPadding(7);e.orient((n)?"right":"left");var i=function(K,G){var J=K.pos[0]+(G.offsetLeft||0),I=K.pos[1]+(G.offsetTop||0),F=o.tickFormat()(f.x()(K.point,K.pointIndex)),L=e.tickFormat()(f.y()(K.point,K.pointIndex)),H=l(K.series.key,F,L,K,u);c.tooltip.show([J,I],H,null,null,G)};function u(x){x.each(function(K){var G=d3.select(this),M=this;var O=(A||parseInt(G.style("width"))||960)-v.left-v.right,J=(w||parseInt(G.style("height"))||400)-v.top-v.bottom;u.update=function(){G.transition().duration(t).call(u)};u.container=this;k.disabled=K.map(function(P){return !!P.disabled});if(!m){var N;m={};for(N in k){if(k[N] instanceof Array){m[N]=k[N].slice(0)}else{m[N]=k[N]}}}if(!K||!K.length||!K.filter(function(P){return P.values.length}).length){var H=G.selectAll(".nv-noData").data([j]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",v.left+O/2).attr("y",v.top+J/2).text(function(P){return P});return u}else{G.selectAll(".nv-noData").remove()}q=f.xScale();p=f.yScale();var I=G.selectAll("g.nv-wrap.nv-lineChart").data([K]);var y=I.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var L=I.select("g");y.append("rect").style("opacity",0);y.append("g").attr("class","nv-x nv-axis");y.append("g").attr("class","nv-y nv-axis");y.append("g").attr("class","nv-linesWrap");y.append("g").attr("class","nv-legendWrap");y.append("g").attr("class","nv-interactive");L.select("rect").attr("width",O).attr("height",J);if(C){h.width(O);L.select(".nv-legendWrap").datum(K).call(h);if(v.top!=h.height()){v.top=h.height();J=(w||parseInt(G.style("height"))||400)-v.top-v.bottom}I.select(".nv-legendWrap").attr("transform","translate(0,"+(-v.top)+")")}I.attr("transform","translate("+v.left+","+v.top+")");if(n){L.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)")}if(r){z.width(O).height(J).margin({left:v.left,top:v.top}).svgContainer(G).xScale(q);I.select(".nv-interactive").call(z)}f.width(O).height(J).color(K.map(function(Q,P){return Q.color||B(Q,P)}).filter(function(Q,P){return !K[P].disabled}));var F=L.select(".nv-linesWrap").datum(K.filter(function(P){return !P.disabled}));F.transition().call(f);if(D){o.scale(q).ticks(O/100).tickSize(-J,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")");L.select(".nv-x.nv-axis").transition().call(o)}if(s){e.scale(p).ticks(J/36).tickSize(-O,0);L.select(".nv-y.nv-axis").transition().call(e)}h.dispatch.on("stateChange",function(P){k=P;E.stateChange(k);u.update()});z.dispatch.on("elementMousemove",function(U){f.clearHighlights();var T,S,P,R=[];K.filter(function(W,V){W.seriesIndex=V;return !W.disabled}).forEach(function(X,W){S=c.interactiveBisect(X.values,U.pointXValue,u.x());f.highlightPoint(W,S,true);var V=X.values[S];if(typeof V==="undefined"){return}if(typeof T==="undefined"){T=V}if(typeof P==="undefined"){P=u.xScale()(u.x()(V,S))}R.push({key:X.key,value:u.y()(V,S),color:B(X,X.seriesIndex)})});var Q=o.tickFormat()(u.x()(T,S));z.tooltip.position({left:P+v.left,top:U.mouseY+v.top}).chartContainer(M.parentNode).enabled(g).valueFormatter(function(W,V){return e.tickFormat()(W)}).data({value:Q,series:R})();z.renderGuideLine(P)});z.dispatch.on("elementMouseout",function(P){E.tooltipHide();f.clearHighlights()});E.on("tooltipShow",function(P){if(g){i(P,M.parentNode)}});E.on("changeState",function(P){if(typeof P.disabled!=="undefined"){K.forEach(function(R,Q){R.disabled=P.disabled[Q]});k.disabled=P.disabled}u.update()})});return u}f.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+v.left,x.pos[1]+v.top];E.tooltipShow(x)});f.dispatch.on("elementMouseout.tooltip",function(x){E.tooltipHide(x)});E.on("tooltipHide",function(){if(g){c.tooltip.cleanup()}});u.dispatch=E;u.lines=f;u.legend=h;u.xAxis=o;u.yAxis=e;u.interactiveLayer=z;d3.rebind(u,f,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");u.options=c.utils.optionsFunc.bind(u);u.margin=function(x){if(!arguments.length){return v}v.top=typeof x.top!="undefined"?x.top:v.top;v.right=typeof x.right!="undefined"?x.right:v.right;v.bottom=typeof x.bottom!="undefined"?x.bottom:v.bottom;v.left=typeof x.left!="undefined"?x.left:v.left;return u};u.width=function(x){if(!arguments.length){return A}A=x;return u};u.height=function(x){if(!arguments.length){return w}w=x;return u};u.color=function(x){if(!arguments.length){return B}B=c.utils.getColor(x);h.color(B);return u};u.showLegend=function(x){if(!arguments.length){return C}C=x;return u};u.showXAxis=function(x){if(!arguments.length){return D}D=x;return u};u.showYAxis=function(x){if(!arguments.length){return s}s=x;return u};u.rightAlignYAxis=function(x){if(!arguments.length){return n}n=x;e.orient((x)?"right":"left");return u};u.useInteractiveGuideline=function(x){if(!arguments.length){return r}r=x;if(x===true){u.interactive(false);u.useVoronoi(false)}return u};u.tooltip=function(x){if(!arguments.length){return l}l=x;return u};u.tooltips=function(x){if(!arguments.length){return g}g=x;return u};u.tooltipContent=function(x){if(!arguments.length){return l}l=x;return u};u.state=function(x){if(!arguments.length){return k}k=x;return u};u.defaultState=function(x){if(!arguments.length){return m}m=x;return u};u.noData=function(x){if(!arguments.length){return j}j=x;return u};u.transitionDuration=function(x){if(!arguments.length){return t}t=x;return u};return u};c.models.linePlusBarChart=function(){var e=c.models.line(),v=c.models.historicalBar(),p=c.models.axis(),r=c.models.axis(),h=c.models.axis(),g=c.models.legend();var t={top:30,right:60,bottom:50,left:60},w=null,u=null,A=function(x){return x.x},z=function(x){return x.y},y=c.utils.defaultColor(),B=true,f=true,n=function(E,D,H,G,F){return"<h3>"+E+"</h3><p>"+H+" at "+D+"</p>"},q,j,i,m={},o=null,l="No Data Available.",C=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");v.padData(true);e.clipEdge(false).padData(true);p.orient("bottom").tickPadding(7).highlightZero(false);r.orient("left");h.orient("right");var k=function(I,E){var H=I.pos[0]+(E.offsetLeft||0),G=I.pos[1]+(E.offsetTop||0),D=p.tickFormat()(e.x()(I.point,I.pointIndex)),J=(I.series.bar?r:h).tickFormat()(e.y()(I.point,I.pointIndex)),F=n(I.series.key,D,J,I,s);c.tooltip.show([H,G],F,I.value<0?"n":"s",null,E)};function s(x){x.each(function(K){var F=d3.select(this),N=this;var P=(w||parseInt(F.style("width"))||960)-t.left-t.right,I=(u||parseInt(F.style("height"))||400)-t.top-t.bottom;s.update=function(){F.transition().call(s)};m.disabled=K.map(function(R){return !!R.disabled});if(!o){var O;o={};for(O in m){if(m[O] instanceof Array){o[O]=m[O].slice(0)}else{o[O]=m[O]}}}if(!K||!K.length||!K.filter(function(R){return R.values.length}).length){var G=F.selectAll(".nv-noData").data([l]);G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");G.attr("x",t.left+P/2).attr("y",t.top+I/2).text(function(R){return R});return s}else{F.selectAll(".nv-noData").remove()}var Q=K.filter(function(R){return !R.disabled&&R.bar});var J=K.filter(function(R){return !R.bar});q=J.filter(function(R){return !R.disabled}).length&&J.filter(function(R){return !R.disabled})[0].values.length?e.xScale():v.xScale();j=v.yScale();i=e.yScale();var H=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([K]);var D=H.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var L=H.select("g");D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y1 nv-axis");D.append("g").attr("class","nv-y2 nv-axis");D.append("g").attr("class","nv-barsWrap");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");if(B){g.width(P/2);L.select(".nv-legendWrap").datum(K.map(function(R){R.originalKey=R.originalKey===undefined?R.key:R.originalKey;R.key=R.originalKey+(R.bar?" (left axis)":" (right axis)");return R})).call(g);if(t.top!=g.height()){t.top=g.height();I=(u||parseInt(F.style("height"))||400)-t.top-t.bottom}L.select(".nv-legendWrap").attr("transform","translate("+(P/2)+","+(-t.top)+")")}H.attr("transform","translate("+t.left+","+t.top+")");e.width(P).height(I).color(K.map(function(S,R){return S.color||y(S,R)}).filter(function(S,R){return !K[R].disabled&&!K[R].bar}));v.width(P).height(I).color(K.map(function(S,R){return S.color||y(S,R)}).filter(function(S,R){return !K[R].disabled&&K[R].bar}));var M=L.select(".nv-barsWrap").datum(Q.length?Q:[{values:[]}]);var E=L.select(".nv-linesWrap").datum(J[0]&&!J[0].disabled?J:[{values:[]}]);d3.transition(M).call(v);d3.transition(E).call(e);p.scale(q).ticks(P/100).tickSize(-I,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+j.range()[0]+")");d3.transition(L.select(".nv-x.nv-axis")).call(p);r.scale(j).ticks(I/36).tickSize(-P,0);d3.transition(L.select(".nv-y1.nv-axis")).style("opacity",Q.length?1:0).call(r);h.scale(i).ticks(I/36).tickSize(Q.length?0:-P,0);L.select(".nv-y2.nv-axis").style("opacity",J.length?1:0).attr("transform","translate("+P+",0)");d3.transition(L.select(".nv-y2.nv-axis")).call(h);g.dispatch.on("stateChange",function(R){m=R;C.stateChange(m);s.update()});C.on("tooltipShow",function(R){if(f){k(R,N.parentNode)}});C.on("changeState",function(R){if(typeof R.disabled!=="undefined"){K.forEach(function(T,S){T.disabled=R.disabled[S]});m.disabled=R.disabled}s.update()})});return s}e.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+t.left,x.pos[1]+t.top];C.tooltipShow(x)});e.dispatch.on("elementMouseout.tooltip",function(x){C.tooltipHide(x)});v.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+t.left,x.pos[1]+t.top];C.tooltipShow(x)});v.dispatch.on("elementMouseout.tooltip",function(x){C.tooltipHide(x)});C.on("tooltipHide",function(){if(f){c.tooltip.cleanup()}});s.dispatch=C;s.legend=g;s.lines=e;s.bars=v;s.xAxis=p;s.y1Axis=r;s.y2Axis=h;d3.rebind(s,e,"defined","size","clipVoronoi","interpolate");s.options=c.utils.optionsFunc.bind(s);s.x=function(x){if(!arguments.length){return A}A=x;e.x(x);v.x(x);return s};s.y=function(x){if(!arguments.length){return z}z=x;e.y(x);v.y(x);return s};s.margin=function(x){if(!arguments.length){return t}t.top=typeof x.top!="undefined"?x.top:t.top;t.right=typeof x.right!="undefined"?x.right:t.right;t.bottom=typeof x.bottom!="undefined"?x.bottom:t.bottom;t.left=typeof x.left!="undefined"?x.left:t.left;return s};s.width=function(x){if(!arguments.length){return w}w=x;return s};s.height=function(x){if(!arguments.length){return u}u=x;return s};s.color=function(x){if(!arguments.length){return y}y=c.utils.getColor(x);g.color(y);return s};s.showLegend=function(x){if(!arguments.length){return B}B=x;return s};s.tooltips=function(x){if(!arguments.length){return f}f=x;return s};s.tooltipContent=function(x){if(!arguments.length){return n}n=x;return s};s.state=function(x){if(!arguments.length){return m}m=x;return s};s.defaultState=function(x){if(!arguments.length){return o}o=x;return s};s.noData=function(x){if(!arguments.length){return l}l=x;return s};return s};c.models.lineWithFocusChart=function(){var g=c.models.line(),p=c.models.line(),q=c.models.axis(),e=c.models.axis(),G=c.models.axis(),j=c.models.axis(),h=c.models.legend(),i=d3.svg.brush();var z={top:30,right:30,bottom:30,left:60},t={top:0,right:30,bottom:20,left:60},C=c.utils.defaultColor(),B=null,A=null,n=100,s,r,D,k,E=true,v=null,f=true,o=function(I,H,L,K,J){return"<h3>"+I+"</h3><p>"+L+" at "+H+"</p>"},m="No Data Available.",F=d3.dispatch("tooltipShow","tooltipHide","brush"),u=250;g.clipEdge(true);p.interactive(false);q.orient("bottom").tickPadding(5);e.orient("left");G.orient("bottom").tickPadding(5);j.orient("left");var l=function(M,I){var L=M.pos[0]+(I.offsetLeft||0),K=M.pos[1]+(I.offsetTop||0),H=q.tickFormat()(g.x()(M.point,M.pointIndex)),N=e.tickFormat()(g.y()(M.point,M.pointIndex)),J=o(M.series.key,H,N,M,w);c.tooltip.show([L,K],J,null,null,I)};function w(x){x.each(function(Y){var P=d3.select(this),L=this;var y=(B||parseInt(P.style("width"))||960)-z.left-z.right,M=(A||parseInt(P.style("height"))||400)-z.top-z.bottom-n,K=n-t.top-t.bottom;w.update=function(){P.transition().duration(u).call(w)};w.container=this;if(!Y||!Y.length||!Y.filter(function(Z){return Z.values.length}).length){var O=P.selectAll(".nv-noData").data([m]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",z.left+y/2).attr("y",z.top+M/2).text(function(Z){return Z});return w}else{P.selectAll(".nv-noData").remove()}s=g.xScale();r=g.yScale();D=p.xScale();k=p.yScale();var N=P.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([Y]);var S=N.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var U=N.select("g");S.append("g").attr("class","nv-legendWrap");var J=S.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-linesWrap");var H=S.append("g").attr("class","nv-context");H.append("g").attr("class","nv-x nv-axis");H.append("g").attr("class","nv-y nv-axis");H.append("g").attr("class","nv-linesWrap");H.append("g").attr("class","nv-brushBackground");H.append("g").attr("class","nv-x nv-brush");if(E){h.width(y);U.select(".nv-legendWrap").datum(Y).call(h);if(z.top!=h.height()){z.top=h.height();M=(A||parseInt(P.style("height"))||400)-z.top-z.bottom-n}U.select(".nv-legendWrap").attr("transform","translate(0,"+(-z.top)+")")}N.attr("transform","translate("+z.left+","+z.top+")");g.width(y).height(M).color(Y.map(function(aa,Z){return aa.color||C(aa,Z)}).filter(function(aa,Z){return !Y[Z].disabled}));p.defined(g.defined()).width(y).height(K).color(Y.map(function(aa,Z){return aa.color||C(aa,Z)}).filter(function(aa,Z){return !Y[Z].disabled}));U.select(".nv-context").attr("transform","translate(0,"+(M+z.bottom+t.top)+")");var I=U.select(".nv-context .nv-linesWrap").datum(Y.filter(function(Z){return !Z.disabled}));d3.transition(I).call(p);q.scale(s).ticks(y/100).tickSize(-M,0);e.scale(r).ticks(M/36).tickSize(-y,0);U.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+M+")");i.x(D).on("brush",function(){var Z=w.transitionDuration();w.transitionDuration(0);R();w.transitionDuration(Z)});if(v){i.extent(v)}var W=U.select(".nv-brushBackground").selectAll("g").data([v||i.extent()]);var V=W.enter().append("g");V.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",K);V.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",K);var X=U.select(".nv-x.nv-brush").call(i);X.selectAll("rect").attr("height",K);X.selectAll(".resize").append("path").attr("d",Q);R();G.scale(D).ticks(y/100).tickSize(-K,0);U.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+k.range()[0]+")");d3.transition(U.select(".nv-context .nv-x.nv-axis")).call(G);j.scale(k).ticks(K/36).tickSize(-y,0);d3.transition(U.select(".nv-context .nv-y.nv-axis")).call(j);U.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+k.range()[0]+")");h.dispatch.on("stateChange",function(Z){w.update()});F.on("tooltipShow",function(Z){if(f){l(Z,L.parentNode)}});function Q(ab){var aa=+(ab=="e"),Z=aa?1:-1,ac=K/3;return"M"+(0.5*Z)+","+ac+"A6,6 0 0 "+aa+" "+(6.5*Z)+","+(ac+6)+"V"+(2*ac-6)+"A6,6 0 0 "+aa+" "+(0.5*Z)+","+(2*ac)+"ZM"+(2.5*Z)+","+(ac+8)+"V"+(2*ac-8)+"M"+(4.5*Z)+","+(ac+8)+"V"+(2*ac-8)}function T(){if(!i.empty()){i.extent(v)}W.data([i.empty()?D.domain():v]).each(function(ac,Z){var aa=D(ac[0])-s.range()[0],ab=s.range()[1]-D(ac[1]);d3.select(this).select(".left").attr("width",aa<0?0:aa);d3.select(this).select(".right").attr("x",D(ac[1])).attr("width",ab<0?0:ab)})}function R(){v=i.empty()?null:i.extent();var aa=i.empty()?D.domain():i.extent();if(Math.abs(aa[0]-aa[1])<=1){return}F.brush({extent:aa,brush:i});T();var Z=U.select(".nv-focus .nv-linesWrap").datum(Y.filter(function(ab){return !ab.disabled}).map(function(ac,ab){return{key:ac.key,values:ac.values.filter(function(ae,ad){return g.x()(ae,ad)>=aa[0]&&g.x()(ae,ad)<=aa[1]})}}));Z.transition().duration(u).call(g);U.select(".nv-focus .nv-x.nv-axis").transition().duration(u).call(q);U.select(".nv-focus .nv-y.nv-axis").transition().duration(u).call(e)}});return w}g.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+z.left,x.pos[1]+z.top];F.tooltipShow(x)});g.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});F.on("tooltipHide",function(){if(f){c.tooltip.cleanup()}});w.dispatch=F;w.legend=h;w.lines=g;w.lines2=p;w.xAxis=q;w.yAxis=e;w.x2Axis=G;w.y2Axis=j;d3.rebind(w,g,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");w.options=c.utils.optionsFunc.bind(w);w.x=function(x){if(!arguments.length){return g.x}g.x(x);p.x(x);return w};w.y=function(x){if(!arguments.length){return g.y}g.y(x);p.y(x);return w};w.margin=function(x){if(!arguments.length){return z}z.top=typeof x.top!="undefined"?x.top:z.top;z.right=typeof x.right!="undefined"?x.right:z.right;z.bottom=typeof x.bottom!="undefined"?x.bottom:z.bottom;z.left=typeof x.left!="undefined"?x.left:z.left;return w};w.margin2=function(x){if(!arguments.length){return t}t=x;return w};w.width=function(x){if(!arguments.length){return B}B=x;return w};w.height=function(x){if(!arguments.length){return A}A=x;return w};w.height2=function(x){if(!arguments.length){return n}n=x;return w};w.color=function(x){if(!arguments.length){return C}C=c.utils.getColor(x);h.color(C);return w};w.showLegend=function(x){if(!arguments.length){return E}E=x;return w};w.tooltips=function(x){if(!arguments.length){return f}f=x;return w};w.tooltipContent=function(x){if(!arguments.length){return o}o=x;return w};w.interpolate=function(x){if(!arguments.length){return g.interpolate()}g.interpolate(x);p.interpolate(x);return w};w.noData=function(x){if(!arguments.length){return m}m=x;return w};w.xTickFormat=function(x){if(!arguments.length){return q.tickFormat()}q.tickFormat(x);G.tickFormat(x);return w};w.yTickFormat=function(x){if(!arguments.length){return e.tickFormat()}e.tickFormat(x);j.tickFormat(x);return w};w.brushExtent=function(x){if(!arguments.length){return v}v=x;return w};w.transitionDuration=function(x){if(!arguments.length){return u}u=x;return w};return w};c.models.linePlusBarWithFocusChart=function(){var v=c.models.line(),o=c.models.line(),u=c.models.historicalBar(),A=c.models.historicalBar(),p=c.models.axis(),t=c.models.axis(),m=c.models.axis(),g=c.models.axis(),E=c.models.axis(),r=c.models.axis(),z=c.models.legend(),G=d3.svg.brush();var i={top:30,right:30,bottom:30,left:60},H={top:0,right:30,bottom:20,left:60},e=null,f=null,q=100,F=function(x){return x.x},D=function(x){return x.y},s=c.utils.defaultColor(),n=true,h,j=null,C=true,w=function(Q,P,T,S,R){return"<h3>"+Q+"</h3><p>"+T+" at "+P+"</p>"},y,l,O,M,L,K,k="No Data Available.",B=d3.dispatch("tooltipShow","tooltipHide","brush"),I=0;v.clipEdge(true);o.interactive(false);p.orient("bottom").tickPadding(5);m.orient("left");g.orient("right");t.orient("bottom").tickPadding(5);E.orient("left");r.orient("right");var N=function(U,Q){if(h){U.pointIndex+=Math.ceil(h[0])}var T=U.pos[0]+(Q.offsetLeft||0),S=U.pos[1]+(Q.offsetTop||0),P=p.tickFormat()(v.x()(U.point,U.pointIndex)),V=(U.series.bar?m:g).tickFormat()(v.y()(U.point,U.pointIndex)),R=w(U.series.key,P,V,U,J);c.tooltip.show([T,S],R,U.value<0?"n":"s",null,Q)};function J(x){x.each(function(am){var aa=d3.select(this),U=this;var P=(e||parseInt(aa.style("width"))||960)-i.left-i.right,V=(f||parseInt(aa.style("height"))||400)-i.top-i.bottom-q,T=q-H.top-H.bottom;J.update=function(){aa.transition().duration(I).call(J)};J.container=this;if(!am||!am.length||!am.filter(function(an){return an.values.length}).length){var Z=aa.selectAll(".nv-noData").data([k]);Z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");Z.attr("x",i.left+P/2).attr("y",i.top+V/2).text(function(an){return an});return J}else{aa.selectAll(".nv-noData").remove()}var Q=am.filter(function(an){return !an.disabled&&an.bar});var ag=am.filter(function(an){return !an.bar});y=u.xScale();l=t.scale();O=u.yScale();M=v.yScale();L=A.yScale();K=o.yScale();var X=am.filter(function(an){return !an.disabled&&an.bar}).map(function(an){return an.values.map(function(ap,ao){return{x:F(ap,ao),y:D(ap,ao)}})});var W=am.filter(function(an){return !an.disabled&&!an.bar}).map(function(an){return an.values.map(function(ap,ao){return{x:F(ap,ao),y:D(ap,ao)}})});y.range([0,P]);l.domain(d3.extent(d3.merge(X.concat(W)),function(an){return an.x})).range([0,P]);var Y=aa.selectAll("g.nv-wrap.nv-linePlusBar").data([am]);var ad=Y.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var ah=Y.select("g");ad.append("g").attr("class","nv-legendWrap");var S=ad.append("g").attr("class","nv-focus");S.append("g").attr("class","nv-x nv-axis");S.append("g").attr("class","nv-y1 nv-axis");S.append("g").attr("class","nv-y2 nv-axis");S.append("g").attr("class","nv-barsWrap");S.append("g").attr("class","nv-linesWrap");var R=ad.append("g").attr("class","nv-context");R.append("g").attr("class","nv-x nv-axis");R.append("g").attr("class","nv-y1 nv-axis");R.append("g").attr("class","nv-y2 nv-axis");R.append("g").attr("class","nv-barsWrap");R.append("g").attr("class","nv-linesWrap");R.append("g").attr("class","nv-brushBackground");R.append("g").attr("class","nv-x nv-brush");if(n){z.width(P/2);ah.select(".nv-legendWrap").datum(am.map(function(an){an.originalKey=an.originalKey===undefined?an.key:an.originalKey;an.key=an.originalKey+(an.bar?" (left axis)":" (right axis)");return an})).call(z);if(i.top!=z.height()){i.top=z.height();V=(f||parseInt(aa.style("height"))||400)-i.top-i.bottom-q}ah.select(".nv-legendWrap").attr("transform","translate("+(P/2)+","+(-i.top)+")")}Y.attr("transform","translate("+i.left+","+i.top+")");A.width(P).height(T).color(am.map(function(ao,an){return ao.color||s(ao,an)}).filter(function(ao,an){return !am[an].disabled&&am[an].bar}));o.width(P).height(T).color(am.map(function(ao,an){return ao.color||s(ao,an)}).filter(function(ao,an){return !am[an].disabled&&!am[an].bar}));var ai=ah.select(".nv-context .nv-barsWrap").datum(Q.length?Q:[{values:[]}]);var af=ah.select(".nv-context .nv-linesWrap").datum(!ag[0].disabled?ag:[{values:[]}]);ah.select(".nv-context").attr("transform","translate(0,"+(V+i.bottom+H.top)+")");ai.transition().call(A);af.transition().call(o);G.x(l).on("brush",ac);if(j){G.extent(j)}var al=ah.select(".nv-brushBackground").selectAll("g").data([j||G.extent()]);var aj=al.enter().append("g");aj.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",T);aj.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",T);var ak=ah.select(".nv-x.nv-brush").call(G);ak.selectAll("rect").attr("height",T);ak.selectAll(".resize").append("path").attr("d",ab);t.ticks(P/100).tickSize(-T,0);ah.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");ah.select(".nv-context .nv-x.nv-axis").transition().call(t);E.scale(L).ticks(T/36).tickSize(-P,0);ah.select(".nv-context .nv-y1.nv-axis").style("opacity",Q.length?1:0).attr("transform","translate(0,"+l.range()[0]+")");ah.select(".nv-context .nv-y1.nv-axis").transition().call(E);r.scale(K).ticks(T/36).tickSize(Q.length?0:-P,0);ah.select(".nv-context .nv-y2.nv-axis").style("opacity",ag.length?1:0).attr("transform","translate("+l.range()[1]+",0)");ah.select(".nv-context .nv-y2.nv-axis").transition().call(r);z.dispatch.on("stateChange",function(an){J.update()});B.on("tooltipShow",function(an){if(C){N(an,U.parentNode)}});function ab(ap){var ao=+(ap=="e"),an=ao?1:-1,aq=T/3;return"M"+(0.5*an)+","+aq+"A6,6 0 0 "+ao+" "+(6.5*an)+","+(aq+6)+"V"+(2*aq-6)+"A6,6 0 0 "+ao+" "+(0.5*an)+","+(2*aq)+"ZM"+(2.5*an)+","+(aq+8)+"V"+(2*aq-8)+"M"+(4.5*an)+","+(aq+8)+"V"+(2*aq-8)}function ae(){if(!G.empty()){G.extent(j)}al.data([G.empty()?l.domain():j]).each(function(aq,an){var ao=l(aq[0])-l.range()[0],ap=l.range()[1]-l(aq[1]);d3.select(this).select(".left").attr("width",ao<0?0:ao);d3.select(this).select(".right").attr("x",l(aq[1])).attr("width",ap<0?0:ap)})}function ac(){j=G.empty()?null:G.extent();h=G.empty()?l.domain():G.extent();B.brush({extent:h,brush:G});ae();u.width(P).height(V).color(am.map(function(aq,ap){return aq.color||s(aq,ap)}).filter(function(aq,ap){return !am[ap].disabled&&am[ap].bar}));v.width(P).height(V).color(am.map(function(aq,ap){return aq.color||s(aq,ap)}).filter(function(aq,ap){return !am[ap].disabled&&!am[ap].bar}));var ao=ah.select(".nv-focus .nv-barsWrap").datum(!Q.length?[{values:[]}]:Q.map(function(aq,ap){return{key:aq.key,values:aq.values.filter(function(at,ar){return u.x()(at,ar)>=h[0]&&u.x()(at,ar)<=h[1]})}}));var an=ah.select(".nv-focus .nv-linesWrap").datum(ag[0].disabled?[{values:[]}]:ag.map(function(aq,ap){return{key:aq.key,values:aq.values.filter(function(at,ar){return v.x()(at,ar)>=h[0]&&v.x()(at,ar)<=h[1]})}}));if(Q.length){y=u.xScale()}else{y=v.xScale()}p.scale(y).ticks(P/100).tickSize(-V,0);p.domain([Math.ceil(h[0]),Math.floor(h[1])]);ah.select(".nv-x.nv-axis").transition().duration(I).call(p);ao.transition().duration(I).call(u);an.transition().duration(I).call(v);ah.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");m.scale(O).ticks(V/36).tickSize(-P,0);ah.select(".nv-focus .nv-y1.nv-axis").style("opacity",Q.length?1:0);g.scale(M).ticks(V/36).tickSize(Q.length?0:-P,0);ah.select(".nv-focus .nv-y2.nv-axis").style("opacity",ag.length?1:0).attr("transform","translate("+y.range()[1]+",0)");ah.select(".nv-focus .nv-y1.nv-axis").transition().duration(I).call(m);ah.select(".nv-focus .nv-y2.nv-axis").transition().duration(I).call(g)}ac()});return J}v.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+i.left,x.pos[1]+i.top];B.tooltipShow(x)});v.dispatch.on("elementMouseout.tooltip",function(x){B.tooltipHide(x)});u.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+i.left,x.pos[1]+i.top];B.tooltipShow(x)});u.dispatch.on("elementMouseout.tooltip",function(x){B.tooltipHide(x)});B.on("tooltipHide",function(){if(C){c.tooltip.cleanup()}});J.dispatch=B;J.legend=z;J.lines=v;J.lines2=o;J.bars=u;J.bars2=A;J.xAxis=p;J.x2Axis=t;J.y1Axis=m;J.y2Axis=g;J.y3Axis=E;J.y4Axis=r;d3.rebind(J,v,"defined","size","clipVoronoi","interpolate");J.options=c.utils.optionsFunc.bind(J);J.x=function(x){if(!arguments.length){return F}F=x;v.x(x);u.x(x);return J};J.y=function(x){if(!arguments.length){return D}D=x;v.y(x);u.y(x);return J};J.margin=function(x){if(!arguments.length){return i}i.top=typeof x.top!="undefined"?x.top:i.top;i.right=typeof x.right!="undefined"?x.right:i.right;i.bottom=typeof x.bottom!="undefined"?x.bottom:i.bottom;i.left=typeof x.left!="undefined"?x.left:i.left;return J};J.width=function(x){if(!arguments.length){return e}e=x;return J};J.height=function(x){if(!arguments.length){return f}f=x;return J};J.color=function(x){if(!arguments.length){return s}s=c.utils.getColor(x);z.color(s);return J};J.showLegend=function(x){if(!arguments.length){return n}n=x;return J};J.tooltips=function(x){if(!arguments.length){return C}C=x;return J};J.tooltipContent=function(x){if(!arguments.length){return w}w=x;return J};J.noData=function(x){if(!arguments.length){return k}k=x;return J};J.brushExtent=function(x){if(!arguments.length){return j}j=x;return J};return J};c.models.multiBar=function(){var l={top:0,right:0,bottom:0,left:0},q=960,m=500,i=d3.scale.ordinal(),h=d3.scale.linear(),n=Math.floor(Math.random()*10000),w=function(x){return x.x},u=function(x){return x.y},f=[0],A=true,z=false,t=c.utils.defaultColor(),C=false,o=null,g,B=1200,s,p,k,r,E=0.1,D=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var v,e;function j(x){x.each(function(N){var Q=q-l.left-l.right,I=m-l.top-l.bottom,F=d3.select(this);if(C&&N.length){C=[{values:N[0].values.map(function(R){return{x:R.x,y:0,series:R.series,size:0.01}})}]}if(z){N=d3.layout.stack().offset("zero").values(function(R){return R.values}).y(u)(!N.length&&C?C:N)}N=N.map(function(S,R){S.values=S.values.map(function(T){T.series=R;return T});return S});if(z){N[0].values.map(function(T,R){var U=0,S=0;N.map(function(W){var V=W.values[R];V.size=Math.abs(V.y);if(V.y<0){V.y1=S;S=S-V.size}else{V.y1=V.size+U;U=U+V.size}})})}var H=(s&&p)?[]:N.map(function(R){return R.values.map(function(T,S){return{x:w(T,S),y:u(T,S),y0:T.y0,y1:T.y1}})});i.domain(s||d3.merge(H).map(function(R){return R.x})).rangeBands(k||[0,Q],E);h.domain(p||d3.extent(d3.merge(H).map(function(R){return z?(R.y>0?R.y1:R.y1+R.y):R.y}).concat(f))).range(r||[I,0]);if(i.domain()[0]===i.domain()[1]){i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*0.01,i.domain()[1]+i.domain()[1]*0.01]):i.domain([-1,1])}if(h.domain()[0]===h.domain()[1]){h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*0.01,h.domain()[1]-h.domain()[1]*0.01]):h.domain([-1,1])}v=v||i;e=e||h;var G=F.selectAll("g.nv-wrap.nv-multibar").data([N]);var L=G.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var J=L.append("defs");var y=L.append("g");var O=G.select("g");y.append("g").attr("class","nv-groups");G.attr("transform","translate("+l.left+","+l.top+")");J.append("clipPath").attr("id","nv-edge-clip-"+n).append("rect");G.select("#nv-edge-clip-"+n+" rect").attr("width",Q).attr("height",I);O.attr("clip-path",A?"url(#nv-edge-clip-"+n+")":"");var K=G.select(".nv-groups").selectAll(".nv-group").data(function(R){return R},function(S,R){return R});K.enter().append("g").style("stroke-opacity",0.000001).style("fill-opacity",0.000001);K.exit().transition().selectAll("rect.nv-bar").delay(function(S,R){return R*B/N[0].values.length}).attr("y",function(R){return z?e(R.y0):e(0)}).attr("height",0).remove();K.attr("class",function(S,R){return"nv-group nv-series-"+R}).classed("hover",function(R){return R.hover}).style("fill",function(S,R){return t(S,R)}).style("stroke",function(S,R){return t(S,R)});K.transition().style("stroke-opacity",1).style("fill-opacity",0.75);var P=K.selectAll("rect.nv-bar").data(function(R){return(C&&!N.length)?C.values:R.values});P.exit().remove();var M=P.enter().append("rect").attr("class",function(S,R){return u(S,R)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(T,S,R){return z?0:(R*i.rangeBand()/N.length)}).attr("y",function(R){return e(z?R.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(z?1:N.length)).attr("transform",function(S,R){return"translate("+i(w(S,R))+",0)"});P.style("fill",function(T,S,R){return t(T,R,S)}).style("stroke",function(T,S,R){return t(T,R,S)}).on("mouseover",function(S,R){d3.select(this).classed("hover",true);D.elementMouseover({value:u(S,R),point:S,series:N[S.series],pos:[i(w(S,R))+(i.rangeBand()*(z?N.length/2:S.series+0.5)/N.length),h(u(S,R)+(z?S.y0:0))],pointIndex:R,seriesIndex:S.series,e:d3.event})}).on("mouseout",function(S,R){d3.select(this).classed("hover",false);D.elementMouseout({value:u(S,R),point:S,series:N[S.series],pointIndex:R,seriesIndex:S.series,e:d3.event})}).on("click",function(S,R){D.elementClick({value:u(S,R),point:S,series:N[S.series],pos:[i(w(S,R))+(i.rangeBand()*(z?N.length/2:S.series+0.5)/N.length),h(u(S,R)+(z?S.y0:0))],pointIndex:R,seriesIndex:S.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(S,R){D.elementDblClick({value:u(S,R),point:S,series:N[S.series],pos:[i(w(S,R))+(i.rangeBand()*(z?N.length/2:S.series+0.5)/N.length),h(u(S,R)+(z?S.y0:0))],pointIndex:R,seriesIndex:S.series,e:d3.event});d3.event.stopPropagation()});P.attr("class",function(S,R){return u(S,R)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(S,R){return"translate("+i(w(S,R))+",0)"});if(o){if(!g){g=N.map(function(){return true})}P.style("fill",function(T,S,R){return d3.rgb(o(T,S)).darker(g.map(function(V,U){return U}).filter(function(V,U){return !g[U]})[R]).toString()}).style("stroke",function(T,S,R){return d3.rgb(o(T,S)).darker(g.map(function(V,U){return U}).filter(function(V,U){return !g[U]})[R]).toString()})}if(z){P.transition().delay(function(S,R){return R*B/N[0].values.length}).attr("y",function(S,R){return h((z?S.y1:0))}).attr("height",function(S,R){return Math.max(Math.abs(h(S.y+(z?S.y0:0))-h((z?S.y0:0))),1)}).attr("x",function(S,R){return z?0:(S.series*i.rangeBand()/N.length)}).attr("width",i.rangeBand()/(z?1:N.length))}else{P.transition().delay(function(S,R){return R*B/N[0].values.length}).attr("x",function(S,R){return S.series*i.rangeBand()/N.length}).attr("width",i.rangeBand()/N.length).attr("y",function(S,R){return u(S,R)<0?h(0):h(0)-h(u(S,R))<1?h(0)-1:h(u(S,R))||0}).attr("height",function(S,R){return Math.max(Math.abs(h(u(S,R))-h(0)),1)||0})}v=i.copy();e=h.copy()});return j}j.dispatch=D;j.options=c.utils.optionsFunc.bind(j);j.x=function(x){if(!arguments.length){return w}w=x;return j};j.y=function(x){if(!arguments.length){return u}u=x;return j};j.margin=function(x){if(!arguments.length){return l}l.top=typeof x.top!="undefined"?x.top:l.top;l.right=typeof x.right!="undefined"?x.right:l.right;l.bottom=typeof x.bottom!="undefined"?x.bottom:l.bottom;l.left=typeof x.left!="undefined"?x.left:l.left;return j};j.width=function(x){if(!arguments.length){return q}q=x;return j};j.height=function(x){if(!arguments.length){return m}m=x;return j};j.xScale=function(x){if(!arguments.length){return i}i=x;return j};j.yScale=function(x){if(!arguments.length){return h}h=x;return j};j.xDomain=function(x){if(!arguments.length){return s}s=x;return j};j.yDomain=function(x){if(!arguments.length){return p}p=x;return j};j.xRange=function(x){if(!arguments.length){return k}k=x;return j};j.yRange=function(x){if(!arguments.length){return r}r=x;return j};j.forceY=function(x){if(!arguments.length){return f}f=x;return j};j.stacked=function(x){if(!arguments.length){return z}z=x;return j};j.clipEdge=function(x){if(!arguments.length){return A}A=x;return j};j.color=function(x){if(!arguments.length){return t}t=c.utils.getColor(x);return j};j.barColor=function(x){if(!arguments.length){return o}o=c.utils.getColor(x);return j};j.disabled=function(x){if(!arguments.length){return g}g=x;return j};j.id=function(x){if(!arguments.length){return n}n=x;return j};j.hideable=function(x){if(!arguments.length){return C}C=x;return j};j.delay=function(x){if(!arguments.length){return B}B=x;return j};j.groupSpacing=function(x){if(!arguments.length){return E}E=x;return j};return j};c.models.multiBarChart=function(){var j=c.models.multiBar(),r=c.models.axis(),f=c.models.axis(),i=c.models.legend(),z=c.models.legend();var B={top:30,right:20,bottom:50,left:60},D=null,C=null,E=c.utils.defaultColor(),H=true,F=true,G=true,u=true,q=false,w=true,h=false,k=0,g=true,o=function(K,J,N,M,L){return"<h3>"+K+"</h3><p>"+N+" on "+J+"</p>"},t,s,n={stacked:false},p=null,m="No Data Available.",I=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),e=function(){return H?180:0},v=250;j.stacked(false);r.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(x){return x});f.orient((q)?"right":"left").tickFormat(d3.format(",.1f"));z.updateState(false);var l=function(O,K){var N=O.pos[0]+(K.offsetLeft||0),M=O.pos[1]+(K.offsetTop||0),J=r.tickFormat()(j.x()(O.point,O.pointIndex)),P=f.tickFormat()(j.y()(O.point,O.pointIndex)),L=o(O.series.key,J,P,O,A);c.tooltip.show([N,M],L,O.value<0?"n":"s",null,K)};function A(x){x.each(function(R){var K=d3.select(this),U=this;var Y=(D||parseInt(K.style("width"))||960)-B.left-B.right,N=(C||parseInt(K.style("height"))||400)-B.top-B.bottom;A.update=function(){K.transition().duration(v).call(A)};A.container=this;n.disabled=R.map(function(Z){return !!Z.disabled});if(!p){var X;p={};for(X in n){if(n[X] instanceof Array){p[X]=n[X].slice(0)}else{p[X]=n[X]}}}if(!R||!R.length||!R.filter(function(Z){return Z.values.length}).length){var L=K.selectAll(".nv-noData").data([m]);L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");L.attr("x",B.left+Y/2).attr("y",B.top+N/2).text(function(Z){return Z});return A}else{K.selectAll(".nv-noData").remove()}t=j.xScale();s=j.yScale();var M=K.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([R]);var y=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var S=M.select("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");if(F){i.width(Y-e());if(j.barColor()){R.forEach(function(aa,Z){aa.color=d3.rgb("#ccc").darker(Z*1.5).toString()})}S.select(".nv-legendWrap").datum(R).call(i);if(B.top!=i.height()){B.top=i.height();N=(C||parseInt(K.style("height"))||400)-B.top-B.bottom}S.select(".nv-legendWrap").attr("transform","translate("+e()+","+(-B.top)+")")}if(H){var V=[{key:"Grouped",disabled:j.stacked()},{key:"Stacked",disabled:!j.stacked()}];z.width(e()).color(["#444","#444","#444"]);S.select(".nv-controlsWrap").datum(V).attr("transform","translate(0,"+(-B.top)+")").call(z)}M.attr("transform","translate("+B.left+","+B.top+")");if(q){S.select(".nv-y.nv-axis").attr("transform","translate("+Y+",0)")}j.disabled(R.map(function(Z){return Z.disabled})).width(Y).height(N).color(R.map(function(aa,Z){return aa.color||E(aa,Z)}).filter(function(aa,Z){return !R[Z].disabled}));var T=S.select(".nv-barsWrap").datum(R.filter(function(Z){return !Z.disabled}));T.transition().call(j);if(G){r.scale(t).ticks(Y/100).tickSize(-N,0);S.select(".nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")");S.select(".nv-x.nv-axis").transition().call(r);var Q=S.select(".nv-x.nv-axis > g").selectAll("g");Q.selectAll("line, text").style("opacity",1);if(h){var W=function(Z,aa){return"translate("+Z+","+aa+")"};var J=5,P=17;Q.selectAll("text").attr("transform",function(ab,aa,Z){return W(0,(Z%2==0?J:P))});var O=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;S.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(aa,Z){return W(0,(Z===0||O%2!==0)?P:J)})}if(w){Q.filter(function(aa,Z){return Z%Math.ceil(R[0].values.length/(Y/100))!==0}).selectAll("text, line").style("opacity",0)}if(k){Q.selectAll(".tick text").attr("transform","rotate("+k+" 0,0)").style("text-anchor",k>0?"start":"end")}S.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(u){f.scale(s).ticks(N/36).tickSize(-Y,0);S.select(".nv-y.nv-axis").transition().call(f)}i.dispatch.on("stateChange",function(Z){n=Z;I.stateChange(n);A.update()});z.dispatch.on("legendClick",function(aa,Z){if(!aa.disabled){return}V=V.map(function(ab){ab.disabled=true;return ab});aa.disabled=false;switch(aa.key){case"Grouped":j.stacked(false);break;case"Stacked":j.stacked(true);break}n.stacked=j.stacked();I.stateChange(n);A.update()});I.on("tooltipShow",function(Z){if(g){l(Z,U.parentNode)}});I.on("changeState",function(Z){if(typeof Z.disabled!=="undefined"){R.forEach(function(ab,aa){ab.disabled=Z.disabled[aa]});n.disabled=Z.disabled}if(typeof Z.stacked!=="undefined"){j.stacked(Z.stacked);n.stacked=Z.stacked}A.update()})});return A}j.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+B.left,x.pos[1]+B.top];I.tooltipShow(x)});j.dispatch.on("elementMouseout.tooltip",function(x){I.tooltipHide(x)});I.on("tooltipHide",function(){if(g){c.tooltip.cleanup()}});A.dispatch=I;A.multibar=j;A.legend=i;A.xAxis=r;A.yAxis=f;d3.rebind(A,j,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","delay","barColor","groupSpacing");A.options=c.utils.optionsFunc.bind(A);A.margin=function(x){if(!arguments.length){return B}B.top=typeof x.top!="undefined"?x.top:B.top;B.right=typeof x.right!="undefined"?x.right:B.right;B.bottom=typeof x.bottom!="undefined"?x.bottom:B.bottom;B.left=typeof x.left!="undefined"?x.left:B.left;return A};A.width=function(x){if(!arguments.length){return D}D=x;return A};A.height=function(x){if(!arguments.length){return C}C=x;return A};A.color=function(x){if(!arguments.length){return E}E=c.utils.getColor(x);i.color(E);return A};A.showControls=function(x){if(!arguments.length){return H}H=x;return A};A.showLegend=function(x){if(!arguments.length){return F}F=x;return A};A.showXAxis=function(x){if(!arguments.length){return G}G=x;return A};A.showYAxis=function(x){if(!arguments.length){return u}u=x;return A};A.rightAlignYAxis=function(x){if(!arguments.length){return q}q=x;f.orient((x)?"right":"left");return A};A.reduceXTicks=function(x){if(!arguments.length){return w}w=x;return A};A.rotateLabels=function(x){if(!arguments.length){return k}k=x;return A};A.staggerLabels=function(x){if(!arguments.length){return h}h=x;return A};A.tooltip=function(x){if(!arguments.length){return o}o=x;return A};A.tooltips=function(x){if(!arguments.length){return g}g=x;return A};A.tooltipContent=function(x){if(!arguments.length){return o}o=x;return A};A.state=function(x){if(!arguments.length){return n}n=x;return A};A.defaultState=function(x){if(!arguments.length){return p}p=x;return A};A.noData=function(x){if(!arguments.length){return m}m=x;return A};A.transitionDuration=function(x){if(!arguments.length){return v}v=x;return A};return A};c.models.multiBarHorizontal=function(){var n={top:0,right:0,bottom:0,left:0},s=960,o=500,p=Math.floor(Math.random()*10000),j=d3.scale.ordinal(),i=d3.scale.linear(),A=function(x){return x.x},w=function(x){return x.y},f=[0],v=c.utils.defaultColor(),q=null,g,C=false,B=false,k=60,h=d3.format(",.2f"),D=1200,u,r,m,t,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var z,e;function l(x){x.each(function(N){var Q=s-n.left-n.right,I=o-n.top-n.bottom,F=d3.select(this);if(C){N=d3.layout.stack().offset("zero").values(function(R){return R.values}).y(w)(N)}N=N.map(function(S,R){S.values=S.values.map(function(T){T.series=R;return T});return S});if(C){N[0].values.map(function(T,R){var U=0,S=0;N.map(function(W){var V=W.values[R];V.size=Math.abs(V.y);if(V.y<0){V.y1=S-V.size;S=S-V.size}else{V.y1=U;U=U+V.size}})})}var H=(u&&r)?[]:N.map(function(R){return R.values.map(function(T,S){return{x:A(T,S),y:w(T,S),y0:T.y0,y1:T.y1}})});j.domain(u||d3.merge(H).map(function(R){return R.x})).rangeBands(m||[0,I],0.1);i.domain(r||d3.extent(d3.merge(H).map(function(R){return C?(R.y>0?R.y1+R.y:R.y1):R.y}).concat(f)));if(B&&!C){i.range(t||[(i.domain()[0]<0?k:0),Q-(i.domain()[1]>0?k:0)])}else{i.range(t||[0,Q])}z=z||j;e=e||d3.scale.linear().domain(i.domain()).range([i(0),i(0)]);var G=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([N]);var L=G.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var J=L.append("defs");var y=L.append("g");var O=G.select("g");y.append("g").attr("class","nv-groups");G.attr("transform","translate("+n.left+","+n.top+")");var K=G.select(".nv-groups").selectAll(".nv-group").data(function(R){return R},function(S,R){return R});K.enter().append("g").style("stroke-opacity",0.000001).style("fill-opacity",0.000001);K.exit().transition().style("stroke-opacity",0.000001).style("fill-opacity",0.000001).remove();K.attr("class",function(S,R){return"nv-group nv-series-"+R}).classed("hover",function(R){return R.hover}).style("fill",function(S,R){return v(S,R)}).style("stroke",function(S,R){return v(S,R)});K.transition().style("stroke-opacity",1).style("fill-opacity",0.75);var P=K.selectAll("g.nv-bar").data(function(R){return R.values});P.exit().remove();var M=P.enter().append("g").attr("transform",function(T,S,R){return"translate("+e(C?T.y0:0)+","+(C?0:(R*j.rangeBand()/N.length)+j(A(T,S)))+")"});M.append("rect").attr("width",0).attr("height",j.rangeBand()/(C?1:N.length));P.on("mouseover",function(S,R){d3.select(this).classed("hover",true);E.elementMouseover({value:w(S,R),point:S,series:N[S.series],pos:[i(w(S,R)+(C?S.y0:0)),j(A(S,R))+(j.rangeBand()*(C?N.length/2:S.series+0.5)/N.length)],pointIndex:R,seriesIndex:S.series,e:d3.event})}).on("mouseout",function(S,R){d3.select(this).classed("hover",false);E.elementMouseout({value:w(S,R),point:S,series:N[S.series],pointIndex:R,seriesIndex:S.series,e:d3.event})}).on("click",function(S,R){E.elementClick({value:w(S,R),point:S,series:N[S.series],pos:[j(A(S,R))+(j.rangeBand()*(C?N.length/2:S.series+0.5)/N.length),i(w(S,R)+(C?S.y0:0))],pointIndex:R,seriesIndex:S.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(S,R){E.elementDblClick({value:w(S,R),point:S,series:N[S.series],pos:[j(A(S,R))+(j.rangeBand()*(C?N.length/2:S.series+0.5)/N.length),i(w(S,R)+(C?S.y0:0))],pointIndex:R,seriesIndex:S.series,e:d3.event});d3.event.stopPropagation()});M.append("text");if(B&&!C){P.select("text").attr("text-anchor",function(S,R){return w(S,R)<0?"end":"start"}).attr("y",j.rangeBand()/(N.length*2)).attr("dy",".32em").text(function(S,R){return h(w(S,R))});P.transition().select("text").attr("x",function(S,R){return w(S,R)<0?-4:i(w(S,R))-i(0)+4})}else{P.selectAll("text").text("")}P.attr("class",function(S,R){return w(S,R)<0?"nv-bar negative":"nv-bar positive"});if(q){if(!g){g=N.map(function(){return true})}P.style("fill",function(T,S,R){return d3.rgb(q(T,S)).darker(g.map(function(V,U){return U}).filter(function(V,U){return !g[U]})[R]).toString()}).style("stroke",function(T,S,R){return d3.rgb(q(T,S)).darker(g.map(function(V,U){return U}).filter(function(V,U){return !g[U]})[R]).toString()})}if(C){P.transition().attr("transform",function(S,R){return"translate("+i(S.y1)+","+j(A(S,R))+")"}).select("rect").attr("width",function(S,R){return Math.abs(i(w(S,R)+S.y0)-i(S.y0))}).attr("height",j.rangeBand())}else{P.transition().attr("transform",function(S,R){return"translate("+(w(S,R)<0?i(w(S,R)):i(0))+","+(S.series*j.rangeBand()/N.length+j(A(S,R)))+")"}).select("rect").attr("height",j.rangeBand()/N.length).attr("width",function(S,R){return Math.max(Math.abs(i(w(S,R))-i(0)),1)})}z=j.copy();e=i.copy()});return l}l.dispatch=E;l.options=c.utils.optionsFunc.bind(l);l.x=function(x){if(!arguments.length){return A}A=x;return l};l.y=function(x){if(!arguments.length){return w}w=x;return l};l.margin=function(x){if(!arguments.length){return n}n.top=typeof x.top!="undefined"?x.top:n.top;n.right=typeof x.right!="undefined"?x.right:n.right;n.bottom=typeof x.bottom!="undefined"?x.bottom:n.bottom;n.left=typeof x.left!="undefined"?x.left:n.left;return l};l.width=function(x){if(!arguments.length){return s}s=x;return l};l.height=function(x){if(!arguments.length){return o}o=x;return l};l.xScale=function(x){if(!arguments.length){return j}j=x;return l};l.yScale=function(x){if(!arguments.length){return i}i=x;return l};l.xDomain=function(x){if(!arguments.length){return u}u=x;return l};l.yDomain=function(x){if(!arguments.length){return r}r=x;return l};l.xRange=function(x){if(!arguments.length){return m}m=x;return l};l.yRange=function(x){if(!arguments.length){return t}t=x;return l};l.forceY=function(x){if(!arguments.length){return f}f=x;return l};l.stacked=function(x){if(!arguments.length){return C}C=x;return l};l.color=function(x){if(!arguments.length){return v}v=c.utils.getColor(x);return l};l.barColor=function(x){if(!arguments.length){return q}q=c.utils.getColor(x);return l};l.disabled=function(x){if(!arguments.length){return g}g=x;return l};l.id=function(x){if(!arguments.length){return p}p=x;return l};l.delay=function(x){if(!arguments.length){return D}D=x;return l};l.showValues=function(x){if(!arguments.length){return B}B=x;return l};l.valueFormat=function(x){if(!arguments.length){return h}h=x;return l};l.valuePadding=function(x){if(!arguments.length){return k}k=x;return l};return l};c.models.multiBarHorizontalChart=function(){var i=c.models.multiBarHorizontal(),o=c.models.axis(),f=c.models.axis(),h=c.models.legend().height(30),s=c.models.legend().height(30);var u={top:30,right:20,bottom:50,left:60},w=null,v=null,z=c.utils.defaultColor(),C=true,A=true,B=false,g=true,l=function(F,E,I,H,G){return"<h3>"+F+" - "+E+"</h3><p>"+I+"</p>"},q,p,m={stacked:B},n=null,k="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),e=function(){return C?180:0},r=250;i.stacked(B);o.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(x){return x});f.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var j=function(J,F){var I=J.pos[0]+(F.offsetLeft||0),H=J.pos[1]+(F.offsetTop||0),E=o.tickFormat()(i.x()(J.point,J.pointIndex)),K=f.tickFormat()(i.y()(J.point,J.pointIndex)),G=l(J.series.key,E,K,J,t);c.tooltip.show([I,H],G,J.value<0?"e":"w",null,F)};function t(x){x.each(function(J){var E=d3.select(this),M=this;var P=(w||parseInt(E.style("width"))||960)-u.left-u.right,H=(v||parseInt(E.style("height"))||400)-u.top-u.bottom;t.update=function(){E.transition().duration(r).call(t)};t.container=this;m.disabled=J.map(function(Q){return !!Q.disabled});if(!n){var O;n={};for(O in m){if(m[O] instanceof Array){n[O]=m[O].slice(0)}else{n[O]=m[O]}}}if(!J||!J.length||!J.filter(function(Q){return Q.values.length}).length){var F=E.selectAll(".nv-noData").data([k]);F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");F.attr("x",u.left+P/2).attr("y",u.top+H/2).text(function(Q){return Q});return t}else{E.selectAll(".nv-noData").remove()}q=i.xScale();p=i.yScale();var G=E.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([J]);var y=G.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var K=G.select("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");if(A){h.width(P-e());if(i.barColor()){J.forEach(function(R,Q){R.color=d3.rgb("#ccc").darker(Q*1.5).toString()})}K.select(".nv-legendWrap").datum(J).call(h);if(u.top!=h.height()){u.top=h.height();H=(v||parseInt(E.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate("+e()+","+(-u.top)+")")}if(C){var N=[{key:"Grouped",disabled:i.stacked()},{key:"Stacked",disabled:!i.stacked()}];s.width(e()).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(N).attr("transform","translate(0,"+(-u.top)+")").call(s)}G.attr("transform","translate("+u.left+","+u.top+")");i.disabled(J.map(function(Q){return Q.disabled})).width(P).height(H).color(J.map(function(R,Q){return R.color||z(R,Q)}).filter(function(R,Q){return !J[Q].disabled}));var L=K.select(".nv-barsWrap").datum(J.filter(function(Q){return !Q.disabled}));L.transition().call(i);o.scale(q).ticks(H/24).tickSize(-P,0);K.select(".nv-x.nv-axis").transition().call(o);var I=K.select(".nv-x.nv-axis").selectAll("g");I.selectAll("line, text").style("opacity",1);f.scale(p).ticks(P/100).tickSize(-H,0);K.select(".nv-y.nv-axis").attr("transform","translate(0,"+H+")");K.select(".nv-y.nv-axis").transition().call(f);h.dispatch.on("stateChange",function(Q){m=Q;D.stateChange(m);t.update()});s.dispatch.on("legendClick",function(R,Q){if(!R.disabled){return}N=N.map(function(S){S.disabled=true;return S});R.disabled=false;switch(R.key){case"Grouped":i.stacked(false);break;case"Stacked":i.stacked(true);break}m.stacked=i.stacked();D.stateChange(m);t.update()});D.on("tooltipShow",function(Q){if(g){j(Q,M.parentNode)}});D.on("changeState",function(Q){if(typeof Q.disabled!=="undefined"){J.forEach(function(S,R){S.disabled=Q.disabled[R]});m.disabled=Q.disabled}if(typeof Q.stacked!=="undefined"){i.stacked(Q.stacked);m.stacked=Q.stacked}x.call(t)})});return t}i.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+u.left,x.pos[1]+u.top];D.tooltipShow(x)});i.dispatch.on("elementMouseout.tooltip",function(x){D.tooltipHide(x)});D.on("tooltipHide",function(){if(g){c.tooltip.cleanup()}});t.dispatch=D;t.multibar=i;t.legend=h;t.xAxis=o;t.yAxis=f;d3.rebind(t,i,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");t.options=c.utils.optionsFunc.bind(t);t.margin=function(x){if(!arguments.length){return u}u.top=typeof x.top!="undefined"?x.top:u.top;u.right=typeof x.right!="undefined"?x.right:u.right;u.bottom=typeof x.bottom!="undefined"?x.bottom:u.bottom;u.left=typeof x.left!="undefined"?x.left:u.left;return t};t.width=function(x){if(!arguments.length){return w}w=x;return t};t.height=function(x){if(!arguments.length){return v}v=x;return t};t.color=function(x){if(!arguments.length){return z}z=c.utils.getColor(x);h.color(z);return t};t.showControls=function(x){if(!arguments.length){return C}C=x;return t};t.showLegend=function(x){if(!arguments.length){return A}A=x;return t};t.tooltip=function(x){if(!arguments.length){return l}l=x;return t};t.tooltips=function(x){if(!arguments.length){return g}g=x;return t};t.tooltipContent=function(x){if(!arguments.length){return l}l=x;return t};t.state=function(x){if(!arguments.length){return m}m=x;return t};t.defaultState=function(x){if(!arguments.length){return n}n=x;return t};t.noData=function(x){if(!arguments.length){return k}k=x;return t};t.transitionDuration=function(x){if(!arguments.length){return r}r=x;return t};return t};c.models.multiChart=function(){var w={top:30,right:20,bottom:50,left:60},B=d3.scale.category20().range(),A=null,z=null,C=true,h=true,l=function(H,G,K,J,I){return"<h3>"+H+"</h3><p>"+K+" at "+G+"</p>"},u,t,p,o;var u=d3.scale.linear(),E=d3.scale.linear(),D=d3.scale.linear(),r=c.models.line().yScale(E),q=c.models.line().yScale(D),j=c.models.multiBar().stacked(false).yScale(E),g=c.models.multiBar().stacked(false).yScale(D),n=c.models.stackedArea().yScale(E),m=c.models.stackedArea().yScale(D),s=c.models.axis().scale(u).orient("bottom").tickPadding(5),f=c.models.axis().scale(E).orient("left"),e=c.models.axis().scale(D).orient("right"),i=c.models.legend().height(30),F=d3.dispatch("tooltipShow","tooltipHide");var k=function(L,H){var K=L.pos[0]+(H.offsetLeft||0),J=L.pos[1]+(H.offsetTop||0),G=s.tickFormat()(r.x()(L.point,L.pointIndex)),M=((L.series.yAxis==2)?e:f).tickFormat()(r.y()(L.point,L.pointIndex)),I=l(L.series.key,G,M,L,v);c.tooltip.show([K,J],I,undefined,undefined,H.offsetParent)};function v(x){x.each(function(ac){var R=d3.select(this),J=this;v.update=function(){R.transition().call(v)};v.container=this;var y=(A||parseInt(R.style("width"))||960)-w.left-w.right,H=(z||parseInt(R.style("height"))||400)-w.top-w.bottom;var U=ac.filter(function(ad){return !ad.disabled&&ad.type=="line"&&ad.yAxis==1});var T=ac.filter(function(ad){return !ad.disabled&&ad.type=="line"&&ad.yAxis==2});var Y=ac.filter(function(ad){return !ad.disabled&&ad.type=="bar"&&ad.yAxis==1});var X=ac.filter(function(ad){return !ad.disabled&&ad.type=="bar"&&ad.yAxis==2});var Q=ac.filter(function(ad){return !ad.disabled&&ad.type=="area"&&ad.yAxis==1});var O=ac.filter(function(ad){return !ad.disabled&&ad.type=="area"&&ad.yAxis==2});var L=ac.filter(function(ad){return !ad.disabled&&ad.yAxis==1}).map(function(ad){return ad.values.map(function(af,ae){return{x:af.x,y:af.y}})});var K=ac.filter(function(ad){return !ad.disabled&&ad.yAxis==2}).map(function(ad){return ad.values.map(function(af,ae){return{x:af.x,y:af.y}})});u.domain(d3.extent(d3.merge(L.concat(K)),function(ad){return ad.x})).range([0,y]);var M=R.selectAll("g.wrap.multiChart").data([ac]);var V=M.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");V.append("g").attr("class","x axis");V.append("g").attr("class","y1 axis");V.append("g").attr("class","y2 axis");V.append("g").attr("class","lines1Wrap");V.append("g").attr("class","lines2Wrap");V.append("g").attr("class","bars1Wrap");V.append("g").attr("class","bars2Wrap");V.append("g").attr("class","stack1Wrap");V.append("g").attr("class","stack2Wrap");V.append("g").attr("class","legendWrap");var Z=M.select("g");if(C){i.width(y/2);Z.select(".legendWrap").datum(ac.map(function(ad){ad.originalKey=ad.originalKey===undefined?ad.key:ad.originalKey;ad.key=ad.originalKey+(ad.yAxis==1?"":" (right axis)");return ad})).call(i);if(w.top!=i.height()){w.top=i.height();H=(z||parseInt(R.style("height"))||400)-w.top-w.bottom}Z.select(".legendWrap").attr("transform","translate("+(y/2)+","+(-w.top)+")")}r.width(y).height(H).interpolate("monotone").color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==1&&ac[ad].type=="line"}));q.width(y).height(H).interpolate("monotone").color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==2&&ac[ad].type=="line"}));j.width(y).height(H).color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==1&&ac[ad].type=="bar"}));g.width(y).height(H).color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==2&&ac[ad].type=="bar"}));n.width(y).height(H).color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==1&&ac[ad].type=="area"}));m.width(y).height(H).color(ac.map(function(ae,ad){return ae.color||B[ad%B.length]}).filter(function(ae,ad){return !ac[ad].disabled&&ac[ad].yAxis==2&&ac[ad].type=="area"}));Z.attr("transform","translate("+w.left+","+w.top+")");var G=Z.select(".lines1Wrap").datum(U);var I=Z.select(".bars1Wrap").datum(Y);var ab=Z.select(".stack1Wrap").datum(Q);var W=Z.select(".lines2Wrap").datum(T);var aa=Z.select(".bars2Wrap").datum(X);var S=Z.select(".stack2Wrap").datum(O);var P=Q.length?Q.map(function(ad){return ad.values}).reduce(function(ae,ad){return ae.map(function(af,ag){return{x:af.x,y:af.y+ad[ag].y}})}).concat([{x:0,y:0}]):[];var N=O.length?O.map(function(ad){return ad.values}).reduce(function(ae,ad){return ae.map(function(af,ag){return{x:af.x,y:af.y+ad[ag].y}})}).concat([{x:0,y:0}]):[];E.domain(p||d3.extent(d3.merge(L).concat(P),function(ad){return ad.y})).range([0,H]);D.domain(o||d3.extent(d3.merge(K).concat(N),function(ad){return ad.y})).range([0,H]);r.yDomain(E.domain());j.yDomain(E.domain());n.yDomain(E.domain());q.yDomain(D.domain());g.yDomain(D.domain());m.yDomain(D.domain());if(Q.length){d3.transition(ab).call(n)}if(O.length){d3.transition(S).call(m)}if(Y.length){d3.transition(I).call(j)}if(X.length){d3.transition(aa).call(g)}if(U.length){d3.transition(G).call(r)}if(T.length){d3.transition(W).call(q)}s.ticks(y/100).tickSize(-H,0);Z.select(".x.axis").attr("transform","translate(0,"+H+")");d3.transition(Z.select(".x.axis")).call(s);f.ticks(H/36).tickSize(-y,0);d3.transition(Z.select(".y1.axis")).call(f);e.ticks(H/36).tickSize(-y,0);d3.transition(Z.select(".y2.axis")).call(e);Z.select(".y2.axis").style("opacity",K.length?1:0).attr("transform","translate("+u.range()[1]+",0)");i.dispatch.on("stateChange",function(ad){v.update()});F.on("tooltipShow",function(ad){if(h){k(ad,J.parentNode)}})});return v}r.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});r.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});q.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});q.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});j.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});j.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});g.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});g.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});n.dispatch.on("tooltipShow",function(x){if(!Math.round(n.y()(x.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}x.pos=[x.pos[0]+w.left,x.pos[1]+w.top],F.tooltipShow(x)});n.dispatch.on("tooltipHide",function(x){F.tooltipHide(x)});m.dispatch.on("tooltipShow",function(x){if(!Math.round(m.y()(x.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}x.pos=[x.pos[0]+w.left,x.pos[1]+w.top],F.tooltipShow(x)});m.dispatch.on("tooltipHide",function(x){F.tooltipHide(x)});r.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});r.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});q.dispatch.on("elementMouseover.tooltip",function(x){x.pos=[x.pos[0]+w.left,x.pos[1]+w.top];F.tooltipShow(x)});q.dispatch.on("elementMouseout.tooltip",function(x){F.tooltipHide(x)});F.on("tooltipHide",function(){if(h){c.tooltip.cleanup()}});v.dispatch=F;v.lines1=r;v.lines2=q;v.bars1=j;v.bars2=g;v.stack1=n;v.stack2=m;v.xAxis=s;v.yAxis1=f;v.yAxis2=e;v.options=c.utils.optionsFunc.bind(v);v.x=function(x){if(!arguments.length){return getX}getX=x;r.x(x);j.x(x);return v};v.y=function(x){if(!arguments.length){return getY}getY=x;r.y(x);j.y(x);return v};v.yDomain1=function(x){if(!arguments.length){return p}p=x;return v};v.yDomain2=function(x){if(!arguments.length){return o}o=x;return v};v.margin=function(x){if(!arguments.length){return w}w=x;return v};v.width=function(x){if(!arguments.length){return A}A=x;return v};v.height=function(x){if(!arguments.length){return z}z=x;return v};v.color=function(x){if(!arguments.length){return B}B=x;i.color(x);return v};v.showLegend=function(x){if(!arguments.length){return C}C=x;return v};v.tooltips=function(x){if(!arguments.length){return h}h=x;return v};v.tooltipContent=function(x){if(!arguments.length){return l}l=x;return v};return v};c.models.ohlcBar=function(){var o={top:0,right:0,bottom:0,left:0},s=960,p=500,q=Math.floor(Math.random()*10000),j=d3.scale.linear(),i=d3.scale.linear(),z=function(x){return x.x},w=function(x){return x.y},f=function(x){return x.open},e=function(x){return x.close},B=function(x){return x.high},k=function(x){return x.low},h=[],g=[],l=false,A=true,v=c.utils.defaultColor(),u,r,n,t,C=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");function m(x){x.each(function(J){var M=s-o.left-o.right,G=p-o.top-o.bottom,D=d3.select(this);j.domain(u||d3.extent(J[0].values.map(z).concat(h)));if(l){j.range(n||[M*0.5/J[0].values.length,M*(J[0].values.length-0.5)/J[0].values.length])}else{j.range(n||[0,M])}i.domain(r||[d3.min(J[0].values.map(k).concat(g)),d3.max(J[0].values.map(B).concat(g))]).range(t||[G,0]);if(j.domain()[0]===j.domain()[1]||i.domain()[0]===i.domain()[1]){singlePoint=true}if(j.domain()[0]===j.domain()[1]){j.domain()[0]?j.domain([j.domain()[0]-j.domain()[0]*0.01,j.domain()[1]+j.domain()[1]*0.01]):j.domain([-1,1])}if(i.domain()[0]===i.domain()[1]){i.domain()[0]?i.domain([i.domain()[0]+i.domain()[0]*0.01,i.domain()[1]-i.domain()[1]*0.01]):i.domain([-1,1])}var E=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([J[0].values]);var I=E.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var H=I.append("defs");var y=I.append("g");var K=E.select("g");y.append("g").attr("class","nv-ticks");E.attr("transform","translate("+o.left+","+o.top+")");D.on("click",function(O,N){C.chartClick({data:O,index:N,pos:d3.event,id:q})});H.append("clipPath").attr("id","nv-chart-clip-path-"+q).append("rect");E.select("#nv-chart-clip-path-"+q+" rect").attr("width",M).attr("height",G);K.attr("clip-path",A?"url(#nv-chart-clip-path-"+q+")":"");var L=E.select(".nv-ticks").selectAll(".nv-tick").data(function(N){return N});L.exit().remove();var F=L.enter().append("path").attr("class",function(P,O,N){return(f(P,O)>e(P,O)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+N+"-"+O}).attr("d",function(P,O){var N=(M/J[0].values.length)*0.9;return"m0,0l0,"+(i(f(P,O))-i(B(P,O)))+"l"+(-N/2)+",0l"+(N/2)+",0l0,"+(i(k(P,O))-i(f(P,O)))+"l0,"+(i(e(P,O))-i(k(P,O)))+"l"+(N/2)+",0l"+(-N/2)+",0z"}).attr("transform",function(O,N){return"translate("+j(z(O,N))+","+i(B(O,N))+")"}).on("mouseover",function(O,N){d3.select(this).classed("hover",true);C.elementMouseover({point:O,series:J[0],pos:[j(z(O,N)),i(w(O,N))],pointIndex:N,seriesIndex:0,e:d3.event})}).on("mouseout",function(O,N){d3.select(this).classed("hover",false);C.elementMouseout({point:O,series:J[0],pointIndex:N,seriesIndex:0,e:d3.event})}).on("click",function(O,N){C.elementClick({value:w(O,N),data:O,index:N,pos:[j(z(O,N)),i(w(O,N))],e:d3.event,id:q});d3.event.stopPropagation()}).on("dblclick",function(O,N){C.elementDblClick({value:w(O,N),data:O,index:N,pos:[j(z(O,N)),i(w(O,N))],e:d3.event,id:q});d3.event.stopPropagation()});L.attr("class",function(P,O,N){return(f(P,O)>e(P,O)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+N+"-"+O});d3.transition(L).attr("transform",function(O,N){return"translate("+j(z(O,N))+","+i(B(O,N))+")"}).attr("d",function(P,O){var N=(M/J[0].values.length)*0.9;return"m0,0l0,"+(i(f(P,O))-i(B(P,O)))+"l"+(-N/2)+",0l"+(N/2)+",0l0,"+(i(k(P,O))-i(f(P,O)))+"l0,"+(i(e(P,O))-i(k(P,O)))+"l"+(N/2)+",0l"+(-N/2)+",0z"})});return m}m.dispatch=C;m.options=c.utils.optionsFunc.bind(m);m.x=function(x){if(!arguments.length){return z}z=x;return m};m.y=function(x){if(!arguments.length){return w}w=x;return m};m.open=function(x){if(!arguments.length){return f}f=x;return m};m.close=function(x){if(!arguments.length){return e}e=x;return m};m.high=function(x){if(!arguments.length){return B}B=x;return m};m.low=function(x){if(!arguments.length){return k}k=x;return m};m.margin=function(x){if(!arguments.length){return o}o.top=typeof x.top!="undefined"?x.top:o.top;o.right=typeof x.right!="undefined"?x.right:o.right;o.bottom=typeof x.bottom!="undefined"?x.bottom:o.bottom;o.left=typeof x.left!="undefined"?x.left:o.left;return m};m.width=function(x){if(!arguments.length){return s}s=x;return m};m.height=function(x){if(!arguments.length){return p}p=x;return m};m.xScale=function(x){if(!arguments.length){return j}j=x;return m};m.yScale=function(x){if(!arguments.length){return i}i=x;return m};m.xDomain=function(x){if(!arguments.length){return u}u=x;return m};m.yDomain=function(x){if(!arguments.length){return r}r=x;return m};m.xRange=function(x){if(!arguments.length){return n}n=x;return m};m.yRange=function(x){if(!arguments.length){return t}t=x;return m};m.forceX=function(x){if(!arguments.length){return h}h=x;return m};m.forceY=function(x){if(!arguments.length){return g}g=x;return m};m.padData=function(x){if(!arguments.length){return l}l=x;return m};m.clipEdge=function(x){if(!arguments.length){return A}A=x;return m};m.color=function(x){if(!arguments.length){return v}v=c.utils.getColor(x);return m};m.id=function(x){if(!arguments.length){return q}q=x;return m};return m};c.models.pie=function(){var l={top:0,right:0,bottom:0,left:0},q=500,m=500,w=function(z){return z.x},v=function(z){return z.y},h=function(z){return z.description},o=Math.floor(Math.random()*10000),s=c.utils.defaultColor(),f=d3.format(",.2f"),n=true,g=true,r=false,y="key",t=0.02,i=false,e=false,u=false,p=false,j=0.5,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");function k(z){z.each(function(S){var A=q-l.left-l.right,D=m-l.top-l.bottom,E=Math.min(A,D)/2,H=E-(E/5),K=d3.select(this);var J=K.selectAll(".nv-wrap.nv-pie").data(S);var F=J.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+o);var O=F.append("g");var P=J.select("g");O.append("g").attr("class","nv-pie");J.attr("transform","translate("+l.left+","+l.top+")");P.select(".nv-pie").attr("transform","translate("+A/2+","+D/2+")");K.on("click",function(U,T){x.chartClick({data:U,index:T,pos:d3.event,id:o})});var I=d3.svg.arc().outerRadius(H);if(u){I.startAngle(u)}if(p){I.endAngle(p)}if(i){I.innerRadius(E*j)}var L=d3.layout.pie().sort(null).value(function(T){return T.disabled?0:v(T)});var B=J.select(".nv-pie").selectAll(".nv-slice").data(L);B.exit().remove();var R=B.enter().append("g").attr("class","nv-slice").on("mouseover",function(U,T){d3.select(this).classed("hover",true);x.elementMouseover({label:w(U.data),value:v(U.data),point:U.data,pointIndex:T,pos:[d3.event.pageX,d3.event.pageY],id:o})}).on("mouseout",function(U,T){d3.select(this).classed("hover",false);x.elementMouseout({label:w(U.data),value:v(U.data),point:U.data,index:T,id:o})}).on("click",function(U,T){x.elementClick({label:w(U.data),value:v(U.data),point:U.data,index:T,pos:d3.event,id:o});d3.event.stopPropagation()}).on("dblclick",function(U,T){x.elementDblClick({label:w(U.data),value:v(U.data),point:U.data,index:T,pos:d3.event,id:o});d3.event.stopPropagation()});B.attr("fill",function(U,T){return s(U,T)}).attr("stroke",function(U,T){return s(U,T)});var N=R.append("path").each(function(T){this._current=T});d3.transition(B.select("path")).attr("d",I).attrTween("d",C);if(n){var G=d3.svg.arc().innerRadius(0);if(g){G=I}if(r){G=d3.svg.arc().outerRadius(I.outerRadius())}R.append("g").classed("nv-label",true).each(function(V,T){var U=d3.select(this);U.attr("transform",function(X){if(e){X.outerRadius=H+10;X.innerRadius=H+15;var W=(X.startAngle+X.endAngle)/2*(180/Math.PI);if((X.startAngle+X.endAngle)/2<Math.PI){W-=90}else{W+=90}return"translate("+G.centroid(X)+") rotate("+W+")"}else{X.outerRadius=E+10;X.innerRadius=E+15;return"translate("+G.centroid(X)+")"}});U.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3);U.append("text").style("text-anchor",e?((V.startAngle+V.endAngle)/2<Math.PI?"start":"end"):"middle").style("fill","#000")});B.select(".nv-label").transition().attr("transform",function(U){if(e){U.outerRadius=H+10;U.innerRadius=H+15;var T=(U.startAngle+U.endAngle)/2*(180/Math.PI);if((U.startAngle+U.endAngle)/2<Math.PI){T-=90}else{T+=90}return"translate("+G.centroid(U)+") rotate("+T+")"}else{U.outerRadius=E+10;U.innerRadius=E+15;return"translate("+G.centroid(U)+")"}});B.each(function(W,T){var V=d3.select(this);V.select(".nv-label text").style("text-anchor",e?((W.startAngle+W.endAngle)/2<Math.PI?"start":"end"):"middle").text(function(Z,X){var Y=(Z.endAngle-Z.startAngle)/(2*Math.PI);var aa={key:w(Z.data),value:v(Z.data),percent:d3.format("%")(Y)};return(Z.value&&Y>t)?aa[y]:""});var U=V.select("text").node().getBBox();V.select(".nv-label rect").attr("width",U.width+10).attr("height",U.height+10).attr("transform",function(){return"translate("+[U.x-5,U.y-5]+")"})})}function Q(U){var T=(U.startAngle+U.endAngle)*90/Math.PI-90;return T>90?T-180:T}function C(T){T.endAngle=isNaN(T.endAngle)?0:T.endAngle;T.startAngle=isNaN(T.startAngle)?0:T.startAngle;if(!i){T.innerRadius=0}var U=d3.interpolate(this._current,T);this._current=U(0);return function(V){return I(U(V))}}function M(T){T.innerRadius=0;var U=d3.interpolate({startAngle:0,endAngle:0},T);return function(V){return I(U(V))}}});return k}k.dispatch=x;k.options=c.utils.optionsFunc.bind(k);k.margin=function(z){if(!arguments.length){return l}l.top=typeof z.top!="undefined"?z.top:l.top;l.right=typeof z.right!="undefined"?z.right:l.right;l.bottom=typeof z.bottom!="undefined"?z.bottom:l.bottom;l.left=typeof z.left!="undefined"?z.left:l.left;return k};k.width=function(z){if(!arguments.length){return q}q=z;return k};k.height=function(z){if(!arguments.length){return m}m=z;return k};k.values=function(z){c.log("pie.values() is no longer supported.");return k};k.x=function(z){if(!arguments.length){return w}w=z;return k};k.y=function(z){if(!arguments.length){return v}v=d3.functor(z);return k};k.description=function(z){if(!arguments.length){return h}h=z;return k};k.showLabels=function(z){if(!arguments.length){return n}n=z;return k};k.labelSunbeamLayout=function(z){if(!arguments.length){return e}e=z;return k};k.donutLabelsOutside=function(z){if(!arguments.length){return r}r=z;return k};k.pieLabelsOutside=function(z){if(!arguments.length){return g}g=z;return k};k.labelType=function(z){if(!arguments.length){return y}y=z;y=y||"key";return k};k.donut=function(z){if(!arguments.length){return i}i=z;return k};k.donutRatio=function(z){if(!arguments.length){return j}j=z;return k};k.startAngle=function(z){if(!arguments.length){return u}u=z;return k};k.endAngle=function(z){if(!arguments.length){return p}p=z;return k};k.id=function(z){if(!arguments.length){return o}o=z;return k};k.color=function(z){if(!arguments.length){return s}s=c.utils.getColor(z);return k};k.valueFormat=function(z){if(!arguments.length){return f}f=z;return k};k.labelThreshold=function(z){if(!arguments.length){return t}t=z;return k};return k};c.models.pieChart=function(){var i=c.models.pie(),m=c.models.legend();var g={top:30,right:20,bottom:20,left:20},f=null,q=null,p=true,h=c.utils.defaultColor(),l=true,s=function(t,w,v,u){return"<h3>"+t+"</h3><p>"+w+"</p>"},e={},r=null,o="No Data Available.",j=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var n=function(z,t){var u=i.description()(z.point)||i.x()(z.point);var x=z.pos[0]+((t&&t.offsetLeft)||0),w=z.pos[1]+((t&&t.offsetTop)||0),A=i.valueFormat()(i.y()(z.point)),v=s(u,A,z,k);c.tooltip.show([x,w],v,z.value<0?"n":"s",null,t)};function k(t){t.each(function(z){var v=d3.select(this),B=this;var E=(f||parseInt(v.style("width"))||960)-g.left-g.right,y=(q||parseInt(v.style("height"))||400)-g.top-g.bottom;k.update=function(){v.transition().call(k)};k.container=this;e.disabled=z.map(function(F){return !!F.disabled});if(!r){var D;r={};for(D in e){if(e[D] instanceof Array){r[D]=e[D].slice(0)}else{r[D]=e[D]}}}if(!z||!z.length){var w=v.selectAll(".nv-noData").data([o]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");w.attr("x",g.left+E/2).attr("y",g.top+y/2).text(function(F){return F});return k}else{v.selectAll(".nv-noData").remove()}var x=v.selectAll("g.nv-wrap.nv-pieChart").data([z]);var u=x.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var A=x.select("g");u.append("g").attr("class","nv-pieWrap");u.append("g").attr("class","nv-legendWrap");if(p){m.width(E).key(i.x());x.select(".nv-legendWrap").datum(z).call(m);if(g.top!=m.height()){g.top=m.height();y=(q||parseInt(v.style("height"))||400)-g.top-g.bottom}x.select(".nv-legendWrap").attr("transform","translate(0,"+(-g.top)+")")}x.attr("transform","translate("+g.left+","+g.top+")");i.width(E).height(y);var C=A.select(".nv-pieWrap").datum([z]);d3.transition(C).call(i);m.dispatch.on("stateChange",function(F){e=F;j.stateChange(e);k.update()});i.dispatch.on("elementMouseout.tooltip",function(F){j.tooltipHide(F)});j.on("changeState",function(F){if(typeof F.disabled!=="undefined"){z.forEach(function(H,G){H.disabled=F.disabled[G]});e.disabled=F.disabled}k.update()})});return k}i.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+g.left,t.pos[1]+g.top];j.tooltipShow(t)});j.on("tooltipShow",function(t){if(l){n(t)}});j.on("tooltipHide",function(){if(l){c.tooltip.cleanup()}});k.legend=m;k.dispatch=j;k.pie=i;d3.rebind(k,i,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");k.options=c.utils.optionsFunc.bind(k);k.margin=function(t){if(!arguments.length){return g}g.top=typeof t.top!="undefined"?t.top:g.top;g.right=typeof t.right!="undefined"?t.right:g.right;g.bottom=typeof t.bottom!="undefined"?t.bottom:g.bottom;g.left=typeof t.left!="undefined"?t.left:g.left;return k};k.width=function(t){if(!arguments.length){return f}f=t;return k};k.height=function(t){if(!arguments.length){return q}q=t;return k};k.color=function(t){if(!arguments.length){return h}h=c.utils.getColor(t);m.color(h);i.color(h);return k};k.showLegend=function(t){if(!arguments.length){return p}p=t;return k};k.tooltips=function(t){if(!arguments.length){return l}l=t;return k};k.tooltipContent=function(t){if(!arguments.length){return s}s=t;return k};k.state=function(t){if(!arguments.length){return e}e=t;return k};k.defaultState=function(t){if(!arguments.length){return r}r=t;return k};k.noData=function(t){if(!arguments.length){return o}o=t;return k};return k};c.models.scatter=function(){var k={top:0,right:0,bottom:0,left:0},e=960,g=500,s=c.utils.defaultColor(),A=Math.floor(Math.random()*100000),G=d3.scale.linear(),E=d3.scale.linear(),C=d3.scale.linear(),L=function(x){return x.x},K=function(x){return x.y},v=function(x){return x.size||1},o=function(x){return x.shape||"circle"},P=true,D=[],B=[],O=[],j=true,M=null,Q=function(x){return !x.notActive},I=false,m=0.1,u=false,S=true,q=function(){return 25},i=null,h=null,N=null,r=null,l=null,t=null,H=false,J=d3.dispatch("elementClick","elementMouseover","elementMouseout"),T=true;var p,f,w,F,n=false;function R(x){x.each(function(aa){var ae=e-k.left-k.right,W=g-k.top-k.bottom,z=d3.select(this);aa=aa.map(function(ag,af){ag.values=ag.values.map(function(ah){ah.series=af;return ah});return ag});var V=(i&&h&&l)?[]:d3.merge(aa.map(function(af){return af.values.map(function(ah,ag){return{x:L(ah,ag),y:K(ah,ag),size:v(ah,ag)}})}));G.domain(i||d3.extent(V.map(function(af){return af.x}).concat(D)));if(I&&aa[0]){G.range(N||[(ae*m+ae)/(2*aa[0].values.length),ae-ae*(1+m)/(2*aa[0].values.length)])}else{G.range(N||[0,ae])}E.domain(h||d3.extent(V.map(function(af){return af.y}).concat(B))).range(r||[W,0]);C.domain(l||d3.extent(V.map(function(af){return af.size}).concat(O))).range(t||[16,256]);if(G.domain()[0]===G.domain()[1]||E.domain()[0]===E.domain()[1]){H=true}if(G.domain()[0]===G.domain()[1]){G.domain()[0]?G.domain([G.domain()[0]-G.domain()[0]*0.01,G.domain()[1]+G.domain()[1]*0.01]):G.domain([-1,1])}if(E.domain()[0]===E.domain()[1]){E.domain()[0]?E.domain([E.domain()[0]-E.domain()[0]*0.01,E.domain()[1]+E.domain()[1]*0.01]):E.domain([-1,1])}if(isNaN(G.domain()[0])){G.domain([-1,1])}if(isNaN(E.domain()[0])){E.domain([-1,1])}p=p||G;f=f||E;w=w||C;var U=z.selectAll("g.nv-wrap.nv-scatter").data([aa]);var Z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+A+(H?" nv-single-point":""));var X=Z.append("defs");var y=Z.append("g");var ab=U.select("g");y.append("g").attr("class","nv-groups");y.append("g").attr("class","nv-point-paths");U.attr("transform","translate("+k.left+","+k.top+")");X.append("clipPath").attr("id","nv-edge-clip-"+A).append("rect");U.select("#nv-edge-clip-"+A+" rect").attr("width",ae).attr("height",W);ab.attr("clip-path",u?"url(#nv-edge-clip-"+A+")":"");function ac(){if(!j){return false}var ai;var ag=d3.merge(aa.map(function(ao,an){return ao.values.map(function(ap,at){var ar=L(ap,at);var aq=K(ap,at);return[G(ar)+Math.random()*1e-7,E(aq)+Math.random()*1e-7,an,at,ap]}).filter(function(ap,aq){return Q(ap[4],aq)})}));if(T===true){if(S){var al=U.select("defs").selectAll(".nv-point-clips").data([A]).enter();al.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+A);var aj=U.select("#nv-points-clip-"+A).selectAll("circle").data(ag);aj.enter().append("circle").attr("r",q);aj.exit().remove();aj.attr("cx",function(an){return an[0]}).attr("cy",function(an){return an[1]});U.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+A+")")}if(ag.length){ag.push([G.range()[0]-20,E.range()[0]-20,null,null]);ag.push([G.range()[1]+20,E.range()[1]+20,null,null]);ag.push([G.range()[0]-20,E.range()[0]+20,null,null]);ag.push([G.range()[1]+20,E.range()[1]-20,null,null])}var ak=d3.geom.polygon([[-10,-10],[-10,g+10],[e+10,g+10],[e+10,-10]]);var am=d3.geom.voronoi(ag).map(function(ao,an){return{data:ak.clip(ao),series:ag[an][2],point:ag[an][3]}});var af=U.select(".nv-point-paths").selectAll("path").data(am);af.enter().append("path").attr("class",function(ao,an){return"nv-path-"+an});af.exit().remove();af.attr("d",function(an){if(an.data.length===0){return"M 0 0"}else{return"M"+an.data.join("L")+"Z"}});var ah=function(aq,ap){if(n){return 0}var ao=aa[aq.series];if(typeof ao==="undefined"){return}var an=ao.values[aq.point];ap({point:an,series:ao,pos:[G(L(an,aq.point))+k.left,E(K(an,aq.point))+k.top],seriesIndex:aq.series,pointIndex:aq.point})};af.on("click",function(an){ah(an,J.elementClick)}).on("mouseover",function(an){ah(an,J.elementMouseover)}).on("mouseout",function(ao,an){ah(ao,J.elementMouseout)})}else{U.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(aq,ap){if(n||!aa[aq.series]){return 0}var ao=aa[aq.series],an=ao.values[ap];J.elementClick({point:an,series:ao,pos:[G(L(an,ap))+k.left,E(K(an,ap))+k.top],seriesIndex:aq.series,pointIndex:ap})}).on("mouseover",function(aq,ap){if(n||!aa[aq.series]){return 0}var ao=aa[aq.series],an=ao.values[ap];J.elementMouseover({point:an,series:ao,pos:[G(L(an,ap))+k.left,E(K(an,ap))+k.top],seriesIndex:aq.series,pointIndex:ap})}).on("mouseout",function(aq,ap){if(n||!aa[aq.series]){return 0}var ao=aa[aq.series],an=ao.values[ap];J.elementMouseout({point:an,series:ao,seriesIndex:aq.series,pointIndex:ap})})}n=false}n=true;var Y=U.select(".nv-groups").selectAll(".nv-group").data(function(af){return af},function(af){return af.key});Y.enter().append("g").style("stroke-opacity",0.000001).style("fill-opacity",0.000001);Y.exit().remove();Y.attr("class",function(ag,af){return"nv-group nv-series-"+af}).classed("hover",function(af){return af.hover});Y.transition().style("fill",function(ag,af){return s(ag,af)}).style("stroke",function(ag,af){return s(ag,af)}).style("stroke-opacity",1).style("fill-opacity",0.5);if(P){var ad=Y.selectAll("circle.nv-point").data(function(af){return af.values},M);ad.enter().append("circle").style("fill",function(ag,af){return ag.color}).style("stroke",function(ag,af){return ag.color}).attr("cx",function(ag,af){return c.utils.NaNtoZero(p(L(ag,af)))}).attr("cy",function(ag,af){return c.utils.NaNtoZero(f(K(ag,af)))}).attr("r",function(ag,af){return Math.sqrt(C(v(ag,af))/Math.PI)});ad.exit().remove();Y.exit().selectAll("path.nv-point").transition().attr("cx",function(ag,af){return c.utils.NaNtoZero(G(L(ag,af)))}).attr("cy",function(ag,af){return c.utils.NaNtoZero(E(K(ag,af)))}).remove();ad.each(function(ag,af){d3.select(this).classed("nv-point",true).classed("nv-point-"+af,true).classed("hover",false)});ad.transition().attr("cx",function(ag,af){return c.utils.NaNtoZero(G(L(ag,af)))}).attr("cy",function(ag,af){return c.utils.NaNtoZero(E(K(ag,af)))}).attr("r",function(ag,af){return Math.sqrt(C(v(ag,af))/Math.PI)})}else{var ad=Y.selectAll("path.nv-point").data(function(af){return af.values});ad.enter().append("path").style("fill",function(ag,af){return ag.color}).style("stroke",function(ag,af){return ag.color}).attr("transform",function(ag,af){return"translate("+p(L(ag,af))+","+f(K(ag,af))+")"}).attr("d",d3.svg.symbol().type(o).size(function(ag,af){return C(v(ag,af))}));ad.exit().remove();Y.exit().selectAll("path.nv-point").transition().attr("transform",function(ag,af){return"translate("+G(L(ag,af))+","+E(K(ag,af))+")"}).remove();ad.each(function(ag,af){d3.select(this).classed("nv-point",true).classed("nv-point-"+af,true).classed("hover",false)});ad.transition().attr("transform",function(ag,af){return"translate("+G(L(ag,af))+","+E(K(ag,af))+")"}).attr("d",d3.svg.symbol().type(o).size(function(ag,af){return C(v(ag,af))}))}clearTimeout(F);F=setTimeout(ac,300);p=G.copy();f=E.copy();w=C.copy()});return R}R.clearHighlights=function(){d3.selectAll(".nv-chart-"+A+" .nv-point.hover").classed("hover",false)};R.highlightPoint=function(y,z,x){d3.select(".nv-chart-"+A+" .nv-series-"+y+" .nv-point-"+z).classed("hover",x)};J.on("elementMouseover.point",function(x){if(j){R.highlightPoint(x.seriesIndex,x.pointIndex,true)}});J.on("elementMouseout.point",function(x){if(j){R.highlightPoint(x.seriesIndex,x.pointIndex,false)}});R.dispatch=J;R.options=c.utils.optionsFunc.bind(R);R.x=function(x){if(!arguments.length){return L}L=d3.functor(x);return R};R.y=function(x){if(!arguments.length){return K}K=d3.functor(x);return R};R.size=function(x){if(!arguments.length){return v}v=d3.functor(x);return R};R.margin=function(x){if(!arguments.length){return k}k.top=typeof x.top!="undefined"?x.top:k.top;k.right=typeof x.right!="undefined"?x.right:k.right;k.bottom=typeof x.bottom!="undefined"?x.bottom:k.bottom;k.left=typeof x.left!="undefined"?x.left:k.left;return R};R.width=function(x){if(!arguments.length){return e}e=x;return R};R.height=function(x){if(!arguments.length){return g}g=x;return R};R.xScale=function(x){if(!arguments.length){return G}G=x;return R};R.yScale=function(x){if(!arguments.length){return E}E=x;return R};R.zScale=function(x){if(!arguments.length){return C}C=x;return R};R.xDomain=function(x){if(!arguments.length){return i}i=x;return R};R.yDomain=function(x){if(!arguments.length){return h}h=x;return R};R.sizeDomain=function(x){if(!arguments.length){return l}l=x;return R};R.xRange=function(x){if(!arguments.length){return N}N=x;return R};R.yRange=function(x){if(!arguments.length){return r}r=x;return R};R.sizeRange=function(x){if(!arguments.length){return t}t=x;return R};R.forceX=function(x){if(!arguments.length){return D}D=x;return R};R.forceY=function(x){if(!arguments.length){return B}B=x;return R};R.forceSize=function(x){if(!arguments.length){return O}O=x;return R};R.interactive=function(x){if(!arguments.length){return j}j=x;return R};R.pointKey=function(x){if(!arguments.length){return M}M=x;return R};R.pointActive=function(x){if(!arguments.length){return Q}Q=x;return R};R.padData=function(x){if(!arguments.length){return I}I=x;return R};R.padDataOuter=function(x){if(!arguments.length){return m}m=x;return R};R.clipEdge=function(x){if(!arguments.length){return u}u=x;return R};R.clipVoronoi=function(x){if(!arguments.length){return S}S=x;return R};R.useVoronoi=function(x){if(!arguments.length){return T}T=x;if(T===false){S=false}return R};R.clipRadius=function(x){if(!arguments.length){return q}q=x;return R};R.color=function(x){if(!arguments.length){return s}s=c.utils.getColor(x);return R};R.shape=function(x){if(!arguments.length){return o}o=x;return R};R.onlyCircles=function(x){if(!arguments.length){return P}P=x;return R};R.id=function(x){if(!arguments.length){return A}A=x;return R};R.singlePoint=function(x){if(!arguments.length){return H}H=x;return R};return R};c.models.scatterChart=function(){var M=c.models.scatter(),z=c.models.axis(),o=c.models.axis(),I=c.models.legend(),A=c.models.legend(),E=c.models.distribution(),D=c.models.distribution();var k={top:30,right:20,bottom:50,left:75},e=null,g=null,C=c.utils.defaultColor(),H=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):M.xScale(),G=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):M.yScale(),m=0,s=0,r=false,p=false,v=true,i=true,L=true,O=false,l=!!d3.fisheye,w=0,q=false,K=true,j=function(T,S,U){return"<strong>"+S+"</strong>"},h=function(T,S,U){return"<strong>"+U+"</strong>"},F=null,R={},B=null,J=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),n="No Data Available.",N=250;M.xScale(H).yScale(G);z.orient("bottom").tickPadding(10);o.orient((O)?"right":"left").tickPadding(10);E.axis("x");D.axis("y");A.updateState(false);var t,f;var Q=function(V,Y){var T=V.pos[0]+(Y.offsetLeft||0),X=V.pos[1]+(Y.offsetTop||0),U=V.pos[0]+(Y.offsetLeft||0),y=G.range()[0]+k.top+(Y.offsetTop||0),S=H.range()[0]+k.left+(Y.offsetLeft||0),x=V.pos[1]+(Y.offsetTop||0),Z=z.tickFormat()(M.x()(V.point,V.pointIndex)),W=o.tickFormat()(M.y()(V.point,V.pointIndex));if(j!=null){c.tooltip.show([U,y],j(V.series.key,Z,W,V,P),"n",1,Y,"x-nvtooltip")}if(h!=null){c.tooltip.show([S,x],h(V.series.key,Z,W,V,P),"e",1,Y,"y-nvtooltip")}if(F!=null){c.tooltip.show([T,X],F(V.series.key,Z,W,V,P),V.value<0?"n":"s",null,Y)}};var u=[{key:"Magnify",disabled:true}];function P(x){x.each(function(aa){var U=d3.select(this),ac=this;var af=(e||parseInt(U.style("width"))||960)-k.left-k.right,X=(g||parseInt(U.style("height"))||400)-k.top-k.bottom;P.update=function(){U.transition().duration(N).call(P)};P.container=this;R.disabled=aa.map(function(ag){return !!ag.disabled});if(!B){var ad;B={};for(ad in R){if(R[ad] instanceof Array){B[ad]=R[ad].slice(0)}else{B[ad]=R[ad]}}}if(!aa||!aa.length||!aa.filter(function(ag){return ag.values.length}).length){var V=U.selectAll(".nv-noData").data([n]);V.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");V.attr("x",k.left+af/2).attr("y",k.top+X/2).text(function(ag){return ag});return P}else{U.selectAll(".nv-noData").remove()}t=t||H;f=f||G;var W=U.selectAll("g.nv-wrap.nv-scatterChart").data([aa]);var Y=W.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+M.id());var S=Y.append("g");var ab=W.select("g");S.append("rect").attr("class","nvd3 nv-background");S.append("g").attr("class","nv-x nv-axis");S.append("g").attr("class","nv-y nv-axis");S.append("g").attr("class","nv-scatterWrap");S.append("g").attr("class","nv-distWrap");S.append("g").attr("class","nv-legendWrap");S.append("g").attr("class","nv-controlsWrap");if(v){var ae=(l)?af/2:af;I.width(ae);W.select(".nv-legendWrap").datum(aa).call(I);if(k.top!=I.height()){k.top=I.height();X=(g||parseInt(U.style("height"))||400)-k.top-k.bottom}W.select(".nv-legendWrap").attr("transform","translate("+(af-ae)+","+(-k.top)+")")}if(l){A.width(180).color(["#444"]);ab.select(".nv-controlsWrap").datum(u).attr("transform","translate(0,"+(-k.top)+")").call(A)}W.attr("transform","translate("+k.left+","+k.top+")");if(O){ab.select(".nv-y.nv-axis").attr("transform","translate("+af+",0)")}M.width(af).height(X).color(aa.map(function(ah,ag){return ah.color||C(ah,ag)}).filter(function(ah,ag){return !aa[ag].disabled}));if(m!==0){M.xDomain(null)}if(s!==0){M.yDomain(null)}W.select(".nv-scatterWrap").datum(aa.filter(function(ag){return !ag.disabled})).call(M);if(m!==0){var y=H.domain()[1]-H.domain()[0];M.xDomain([H.domain()[0]-(m*y),H.domain()[1]+(m*y)])}if(s!==0){var Z=G.domain()[1]-G.domain()[0];M.yDomain([G.domain()[0]-(s*Z),G.domain()[1]+(s*Z)])}if(s!==0||m!==0){W.select(".nv-scatterWrap").datum(aa.filter(function(ag){return !ag.disabled})).call(M)}if(i){z.scale(H).ticks(z.ticks()&&z.ticks().length?z.ticks():af/100).tickSize(-X,0);ab.select(".nv-x.nv-axis").attr("transform","translate(0,"+G.range()[0]+")").call(z)}if(L){o.scale(G).ticks(o.ticks()&&o.ticks().length?o.ticks():X/36).tickSize(-af,0);ab.select(".nv-y.nv-axis").call(o)}if(r){E.getData(M.x()).scale(H).width(af).color(aa.map(function(ah,ag){return ah.color||C(ah,ag)}).filter(function(ah,ag){return !aa[ag].disabled}));S.select(".nv-distWrap").append("g").attr("class","nv-distributionX");ab.select(".nv-distributionX").attr("transform","translate(0,"+G.range()[0]+")").datum(aa.filter(function(ag){return !ag.disabled})).call(E)}if(p){D.getData(M.y()).scale(G).width(X).color(aa.map(function(ah,ag){return ah.color||C(ah,ag)}).filter(function(ah,ag){return !aa[ag].disabled}));S.select(".nv-distWrap").append("g").attr("class","nv-distributionY");ab.select(".nv-distributionY").attr("transform","translate("+(O?af:-D.size())+",0)").datum(aa.filter(function(ag){return !ag.disabled})).call(D)}if(d3.fisheye){ab.select(".nv-background").attr("width",af).attr("height",X);ab.select(".nv-background").on("mousemove",T);ab.select(".nv-background").on("click",function(){q=!q});M.dispatch.on("elementClick.freezeFisheye",function(){q=!q})}function T(){if(q){ab.select(".nv-point-paths").style("pointer-events","all");return false}ab.select(".nv-point-paths").style("pointer-events","none");var ag=d3.mouse(this);H.distortion(w).focus(ag[0]);G.distortion(w).focus(ag[1]);ab.select(".nv-scatterWrap").call(M);if(i){ab.select(".nv-x.nv-axis").call(z)}if(L){ab.select(".nv-y.nv-axis").call(o)}ab.select(".nv-distributionX").datum(aa.filter(function(ah){return !ah.disabled})).call(E);ab.select(".nv-distributionY").datum(aa.filter(function(ah){return !ah.disabled})).call(D)}A.dispatch.on("legendClick",function(ah,ag){ah.disabled=!ah.disabled;w=ah.disabled?0:2.5;ab.select(".nv-background").style("pointer-events",ah.disabled?"none":"all");ab.select(".nv-point-paths").style("pointer-events",ah.disabled?"all":"none");if(ah.disabled){H.distortion(w).focus(0);G.distortion(w).focus(0);ab.select(".nv-scatterWrap").call(M);ab.select(".nv-x.nv-axis").call(z);ab.select(".nv-y.nv-axis").call(o)}else{q=false}P.update()});I.dispatch.on("stateChange",function(ag){R.disabled=ag.disabled;J.stateChange(R);P.update()});M.dispatch.on("elementMouseover.tooltip",function(ag){d3.select(".nv-chart-"+M.id()+" .nv-series-"+ag.seriesIndex+" .nv-distx-"+ag.pointIndex).attr("y1",function(ai,ah){return ag.pos[1]-X});d3.select(".nv-chart-"+M.id()+" .nv-series-"+ag.seriesIndex+" .nv-disty-"+ag.pointIndex).attr("x2",ag.pos[0]+E.size());ag.pos=[ag.pos[0]+k.left,ag.pos[1]+k.top];J.tooltipShow(ag)});J.on("tooltipShow",function(ag){if(K){Q(ag,ac.parentNode)}});J.on("changeState",function(ag){if(typeof ag.disabled!=="undefined"){aa.forEach(function(ai,ah){ai.disabled=ag.disabled[ah]});R.disabled=ag.disabled}P.update()});t=H.copy();f=G.copy()});return P}M.dispatch.on("elementMouseout.tooltip",function(x){J.tooltipHide(x);d3.select(".nv-chart-"+M.id()+" .nv-series-"+x.seriesIndex+" .nv-distx-"+x.pointIndex).attr("y1",0);d3.select(".nv-chart-"+M.id()+" .nv-series-"+x.seriesIndex+" .nv-disty-"+x.pointIndex).attr("x2",D.size())});J.on("tooltipHide",function(){if(K){c.tooltip.cleanup()}});P.dispatch=J;P.scatter=M;P.legend=I;P.controls=A;P.xAxis=z;P.yAxis=o;P.distX=E;P.distY=D;d3.rebind(P,M,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");P.options=c.utils.optionsFunc.bind(P);P.margin=function(x){if(!arguments.length){return k}k.top=typeof x.top!="undefined"?x.top:k.top;k.right=typeof x.right!="undefined"?x.right:k.right;k.bottom=typeof x.bottom!="undefined"?x.bottom:k.bottom;k.left=typeof x.left!="undefined"?x.left:k.left;return P};P.width=function(x){if(!arguments.length){return e}e=x;return P};P.height=function(x){if(!arguments.length){return g}g=x;return P};P.color=function(x){if(!arguments.length){return C}C=c.utils.getColor(x);I.color(C);E.color(C);D.color(C);return P};P.showDistX=function(x){if(!arguments.length){return r}r=x;return P};P.showDistY=function(x){if(!arguments.length){return p}p=x;return P};P.showControls=function(x){if(!arguments.length){return l}l=x;return P};P.showLegend=function(x){if(!arguments.length){return v}v=x;return P};P.showXAxis=function(x){if(!arguments.length){return i}i=x;return P};P.showYAxis=function(x){if(!arguments.length){return L}L=x;return P};P.rightAlignYAxis=function(x){if(!arguments.length){return O}O=x;o.orient((x)?"right":"left");return P};P.fisheye=function(x){if(!arguments.length){return w}w=x;return P};P.xPadding=function(x){if(!arguments.length){return m}m=x;return P};P.yPadding=function(x){if(!arguments.length){return s}s=x;return P};P.tooltips=function(x){if(!arguments.length){return K}K=x;return P};P.tooltipContent=function(x){if(!arguments.length){return F}F=x;return P};P.tooltipXContent=function(x){if(!arguments.length){return j}j=x;return P};P.tooltipYContent=function(x){if(!arguments.length){return h}h=x;return P};P.state=function(x){if(!arguments.length){return R}R=x;return P};P.defaultState=function(x){if(!arguments.length){return B}B=x;return P};P.noData=function(x){if(!arguments.length){return n}n=x;return P};P.transitionDuration=function(x){if(!arguments.length){return N}N=x;return P};return P};c.models.scatterPlusLineChart=function(){var K=c.models.scatter(),v=c.models.axis(),n=c.models.axis(),G=c.models.legend(),w=c.models.legend(),C=c.models.distribution(),B=c.models.distribution();var k={top:30,right:20,bottom:50,left:75},e=null,g=null,A=c.utils.defaultColor(),F=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):K.xScale(),E=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):K.yScale(),q=false,o=false,t=true,i=true,J=true,M=false,l=!!d3.fisheye,u=0,p=false,I=true,j=function(R,Q,S){return"<strong>"+Q+"</strong>"},h=function(R,Q,S){return"<strong>"+S+"</strong>"},D=function(S,Q,T,R){return"<h3>"+S+"</h3><p>"+R+"</p>"},O={},z=null,H=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),m="No Data Available.",L=250;K.xScale(F).yScale(E);v.orient("bottom").tickPadding(10);n.orient((M)?"right":"left").tickPadding(10);C.axis("x");B.axis("y");w.updateState(false);var r,f;var P=function(T,W){var R=T.pos[0]+(W.offsetLeft||0),V=T.pos[1]+(W.offsetTop||0),S=T.pos[0]+(W.offsetLeft||0),y=E.range()[0]+k.top+(W.offsetTop||0),Q=F.range()[0]+k.left+(W.offsetLeft||0),x=T.pos[1]+(W.offsetTop||0),X=v.tickFormat()(K.x()(T.point,T.pointIndex)),U=n.tickFormat()(K.y()(T.point,T.pointIndex));if(j!=null){c.tooltip.show([S,y],j(T.series.key,X,U,T,N),"n",1,W,"x-nvtooltip")}if(h!=null){c.tooltip.show([Q,x],h(T.series.key,X,U,T,N),"e",1,W,"y-nvtooltip")}if(D!=null){c.tooltip.show([R,V],D(T.series.key,X,U,T.point.tooltip,T,N),T.value<0?"n":"s",null,W)}};var s=[{key:"Magnify",disabled:true}];function N(x){x.each(function(Y){var R=d3.select(this),aa=this;var ad=(e||parseInt(R.style("width"))||960)-k.left-k.right,U=(g||parseInt(R.style("height"))||400)-k.top-k.bottom;N.update=function(){R.transition().duration(L).call(N)};N.container=this;O.disabled=Y.map(function(ae){return !!ae.disabled});if(!z){var ac;z={};for(ac in O){if(O[ac] instanceof Array){z[ac]=O[ac].slice(0)}else{z[ac]=O[ac]}}}if(!Y||!Y.length||!Y.filter(function(ae){return ae.values.length}).length){var S=R.selectAll(".nv-noData").data([m]);S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");S.attr("x",k.left+ad/2).attr("y",k.top+U/2).text(function(ae){return ae});return N}else{R.selectAll(".nv-noData").remove()}F=K.xScale();E=K.yScale();r=r||F;f=f||E;var T=R.selectAll("g.nv-wrap.nv-scatterChart").data([Y]);var W=T.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+K.id());var y=W.append("g");var Z=T.select("g");y.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");y.append("g").attr("class","nv-x nv-axis");y.append("g").attr("class","nv-y nv-axis");y.append("g").attr("class","nv-scatterWrap");y.append("g").attr("class","nv-regressionLinesWrap");y.append("g").attr("class","nv-distWrap");y.append("g").attr("class","nv-legendWrap");y.append("g").attr("class","nv-controlsWrap");T.attr("transform","translate("+k.left+","+k.top+")");if(M){Z.select(".nv-y.nv-axis").attr("transform","translate("+ad+",0)")}if(t){G.width(ad/2);T.select(".nv-legendWrap").datum(Y).call(G);if(k.top!=G.height()){k.top=G.height();U=(g||parseInt(R.style("height"))||400)-k.top-k.bottom}T.select(".nv-legendWrap").attr("transform","translate("+(ad/2)+","+(-k.top)+")")}if(l){w.width(180).color(["#444"]);Z.select(".nv-controlsWrap").datum(s).attr("transform","translate(0,"+(-k.top)+")").call(w)}K.width(ad).height(U).color(Y.map(function(af,ae){return af.color||A(af,ae)}).filter(function(af,ae){return !Y[ae].disabled}));T.select(".nv-scatterWrap").datum(Y.filter(function(ae){return !ae.disabled})).call(K);T.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+K.id()+")");var X=T.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(ae){return ae});X.enter().append("g").attr("class","nv-regLines");var V=X.selectAll(".nv-regLine").data(function(ae){return[ae]});var ab=V.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);V.transition().attr("x1",F.range()[0]).attr("x2",F.range()[1]).attr("y1",function(af,ae){return E(F.domain()[0]*af.slope+af.intercept)}).attr("y2",function(af,ae){return E(F.domain()[1]*af.slope+af.intercept)}).style("stroke",function(ag,af,ae){return A(ag,ae)}).style("stroke-opacity",function(af,ae){return(af.disabled||typeof af.slope==="undefined"||typeof af.intercept==="undefined")?0:1});if(i){v.scale(F).ticks(v.ticks()?v.ticks():ad/100).tickSize(-U,0);Z.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")").call(v)}if(J){n.scale(E).ticks(n.ticks()?n.ticks():U/36).tickSize(-ad,0);Z.select(".nv-y.nv-axis").call(n)}if(q){C.getData(K.x()).scale(F).width(ad).color(Y.map(function(af,ae){return af.color||A(af,ae)}).filter(function(af,ae){return !Y[ae].disabled}));y.select(".nv-distWrap").append("g").attr("class","nv-distributionX");Z.select(".nv-distributionX").attr("transform","translate(0,"+E.range()[0]+")").datum(Y.filter(function(ae){return !ae.disabled})).call(C)}if(o){B.getData(K.y()).scale(E).width(U).color(Y.map(function(af,ae){return af.color||A(af,ae)}).filter(function(af,ae){return !Y[ae].disabled}));y.select(".nv-distWrap").append("g").attr("class","nv-distributionY");Z.select(".nv-distributionY").attr("transform","translate("+(M?ad:-B.size())+",0)").datum(Y.filter(function(ae){return !ae.disabled})).call(B)}if(d3.fisheye){Z.select(".nv-background").attr("width",ad).attr("height",U);Z.select(".nv-background").on("mousemove",Q);Z.select(".nv-background").on("click",function(){p=!p});K.dispatch.on("elementClick.freezeFisheye",function(){p=!p})}function Q(){if(p){Z.select(".nv-point-paths").style("pointer-events","all");return false}Z.select(".nv-point-paths").style("pointer-events","none");var ae=d3.mouse(this);F.distortion(u).focus(ae[0]);E.distortion(u).focus(ae[1]);Z.select(".nv-scatterWrap").datum(Y.filter(function(af){return !af.disabled})).call(K);if(i){Z.select(".nv-x.nv-axis").call(v)}if(J){Z.select(".nv-y.nv-axis").call(n)}Z.select(".nv-distributionX").datum(Y.filter(function(af){return !af.disabled})).call(C);Z.select(".nv-distributionY").datum(Y.filter(function(af){return !af.disabled})).call(B)}w.dispatch.on("legendClick",function(af,ae){af.disabled=!af.disabled;u=af.disabled?0:2.5;Z.select(".nv-background").style("pointer-events",af.disabled?"none":"all");Z.select(".nv-point-paths").style("pointer-events",af.disabled?"all":"none");if(af.disabled){F.distortion(u).focus(0);E.distortion(u).focus(0);Z.select(".nv-scatterWrap").call(K);Z.select(".nv-x.nv-axis").call(v);Z.select(".nv-y.nv-axis").call(n)}else{p=false}N.update()});G.dispatch.on("stateChange",function(ae){O=ae;H.stateChange(O);N.update()});K.dispatch.on("elementMouseover.tooltip",function(ae){d3.select(".nv-chart-"+K.id()+" .nv-series-"+ae.seriesIndex+" .nv-distx-"+ae.pointIndex).attr("y1",ae.pos[1]-U);d3.select(".nv-chart-"+K.id()+" .nv-series-"+ae.seriesIndex+" .nv-disty-"+ae.pointIndex).attr("x2",ae.pos[0]+C.size());ae.pos=[ae.pos[0]+k.left,ae.pos[1]+k.top];H.tooltipShow(ae)});H.on("tooltipShow",function(ae){if(I){P(ae,aa.parentNode)}});H.on("changeState",function(ae){if(typeof ae.disabled!=="undefined"){Y.forEach(function(ag,af){ag.disabled=ae.disabled[af]});O.disabled=ae.disabled}N.update()});r=F.copy();f=E.copy()});return N}K.dispatch.on("elementMouseout.tooltip",function(x){H.tooltipHide(x);d3.select(".nv-chart-"+K.id()+" .nv-series-"+x.seriesIndex+" .nv-distx-"+x.pointIndex).attr("y1",0);d3.select(".nv-chart-"+K.id()+" .nv-series-"+x.seriesIndex+" .nv-disty-"+x.pointIndex).attr("x2",B.size())});H.on("tooltipHide",function(){if(I){c.tooltip.cleanup()}});N.dispatch=H;N.scatter=K;N.legend=G;N.controls=w;N.xAxis=v;N.yAxis=n;N.distX=C;N.distY=B;d3.rebind(N,K,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");N.options=c.utils.optionsFunc.bind(N);N.margin=function(x){if(!arguments.length){return k}k.top=typeof x.top!="undefined"?x.top:k.top;k.right=typeof x.right!="undefined"?x.right:k.right;k.bottom=typeof x.bottom!="undefined"?x.bottom:k.bottom;k.left=typeof x.left!="undefined"?x.left:k.left;return N};N.width=function(x){if(!arguments.length){return e}e=x;return N};N.height=function(x){if(!arguments.length){return g}g=x;return N};N.color=function(x){if(!arguments.length){return A}A=c.utils.getColor(x);G.color(A);C.color(A);B.color(A);return N};N.showDistX=function(x){if(!arguments.length){return q}q=x;return N};N.showDistY=function(x){if(!arguments.length){return o}o=x;return N};N.showControls=function(x){if(!arguments.length){return l}l=x;return N};N.showLegend=function(x){if(!arguments.length){return t}t=x;return N};N.showXAxis=function(x){if(!arguments.length){return i}i=x;return N};N.showYAxis=function(x){if(!arguments.length){return J}J=x;return N};N.rightAlignYAxis=function(x){if(!arguments.length){return M}M=x;n.orient((x)?"right":"left");return N};N.fisheye=function(x){if(!arguments.length){return u}u=x;return N};N.tooltips=function(x){if(!arguments.length){return I}I=x;return N};N.tooltipContent=function(x){if(!arguments.length){return D}D=x;return N};N.tooltipXContent=function(x){if(!arguments.length){return j}j=x;return N};N.tooltipYContent=function(x){if(!arguments.length){return h}h=x;return N};N.state=function(x){if(!arguments.length){return O}O=x;return N};N.defaultState=function(x){if(!arguments.length){return z}z=x;return N};N.noData=function(x){if(!arguments.length){return m}m=x;return N};N.transitionDuration=function(x){if(!arguments.length){return L}L=x;return N};return N};c.models.sparkline=function(){var k={top:2,right:0,bottom:2,left:0},g=400,r=32,h=true,o=d3.scale.linear(),n=d3.scale.linear(),q=function(s){return s.x},p=function(s){return s.y},j=c.utils.getColor(["#000"]),l,f,e,i;function m(s){s.each(function(y){var B=g-k.left-k.right,w=r-k.top-k.bottom,u=d3.select(this);o.domain(l||d3.extent(y,q)).range(e||[0,B]);n.domain(f||d3.extent(y,p)).range(i||[w,0]);var v=u.selectAll("g.nv-wrap.nv-sparkline").data([y]);var x=v.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var t=x.append("g");var z=v.select("g");v.attr("transform","translate("+k.left+","+k.top+")");var C=v.selectAll("path").data(function(D){return[D]});C.enter().append("path");C.exit().remove();C.style("stroke",function(E,D){return E.color||j(E,D)}).attr("d",d3.svg.line().x(function(E,D){return o(q(E,D))}).y(function(E,D){return n(p(E,D))}));var A=v.selectAll("circle.nv-point").data(function(H){var F=H.map(function(K,J){return p(K,J)});function G(K){if(K!=-1){var J=H[K];J.pointIndex=K;return J}else{return null}}var E=G(F.lastIndexOf(n.domain()[1])),D=G(F.indexOf(n.domain()[0])),I=G(F.length-1);return[D,E,I].filter(function(J){return J!=null})});A.enter().append("circle");A.exit().remove();A.attr("cx",function(E,D){return o(q(E,E.pointIndex))}).attr("cy",function(E,D){return n(p(E,E.pointIndex))}).attr("r",2).attr("class",function(E,D){return q(E,E.pointIndex)==o.domain()[1]?"nv-point nv-currentValue":p(E,E.pointIndex)==n.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return m}m.options=c.utils.optionsFunc.bind(m);m.margin=function(s){if(!arguments.length){return k}k.top=typeof s.top!="undefined"?s.top:k.top;k.right=typeof s.right!="undefined"?s.right:k.right;k.bottom=typeof s.bottom!="undefined"?s.bottom:k.bottom;k.left=typeof s.left!="undefined"?s.left:k.left;return m};m.width=function(s){if(!arguments.length){return g}g=s;return m};m.height=function(s){if(!arguments.length){return r}r=s;return m};m.x=function(s){if(!arguments.length){return q}q=d3.functor(s);return m};m.y=function(s){if(!arguments.length){return p}p=d3.functor(s);return m};m.xScale=function(s){if(!arguments.length){return o}o=s;return m};m.yScale=function(s){if(!arguments.length){return n}n=s;return m};m.xDomain=function(s){if(!arguments.length){return l}l=s;return m};m.yDomain=function(s){if(!arguments.length){return f}f=s;return m};m.xRange=function(s){if(!arguments.length){return e}e=s;return m};m.yRange=function(s){if(!arguments.length){return i}i=s;return m};m.animate=function(s){if(!arguments.length){return h}h=s;return m};m.color=function(s){if(!arguments.length){return j}j=c.utils.getColor(s);return m};return m};c.models.sparklinePlus=function(){var p=c.models.sparkline();var f={top:15,right:100,bottom:10,left:50},e=null,r=null,m,l,j=[],q=false,o=d3.format(",r"),i=d3.format(",.2f"),h=true,s=true,g=false,n="No Data Available.";function k(t){t.each(function(B){var v=d3.select(this);var I=(e||parseInt(v.style("width"))||960)-f.left-f.right,y=(r||parseInt(v.style("height"))||400)-f.top-f.bottom;k.update=function(){k(t)};k.container=this;if(!B||!B.length){var w=v.selectAll(".nv-noData").data([n]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");w.attr("x",f.left+I/2).attr("y",f.top+y/2).text(function(J){return J});return k}else{v.selectAll(".nv-noData").remove()}var H=p.y()(B[B.length-1],B.length-1);m=p.xScale();l=p.yScale();var x=v.selectAll("g.nv-wrap.nv-sparklineplus").data([B]);var z=x.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var u=z.append("g");var C=x.select("g");u.append("g").attr("class","nv-sparklineWrap");u.append("g").attr("class","nv-valueWrap");u.append("g").attr("class","nv-hoverArea");x.attr("transform","translate("+f.left+","+f.top+")");var D=C.select(".nv-sparklineWrap");p.width(I).height(y);D.call(p);var F=C.select(".nv-valueWrap");var G=F.selectAll(".nv-currentValue").data([H]);G.enter().append("text").attr("class","nv-currentValue").attr("dx",g?-8:8).attr("dy",".9em").style("text-anchor",g?"end":"start");G.attr("x",I+(g?f.right:0)).attr("y",s?function(J){return l(J)}:0).style("fill",p.color()(B[B.length-1],B.length-1)).text(i(H));u.select(".nv-hoverArea").append("rect").on("mousemove",A).on("click",function(){q=!q}).on("mouseout",function(){j=[];E()});C.select(".nv-hoverArea rect").attr("transform",function(J){return"translate("+-f.left+","+-f.top+")"}).attr("width",I+f.left+f.right).attr("height",y+f.top);function E(){if(q){return}var K=C.selectAll(".nv-hoverValue").data(j);var J=K.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);K.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();K.attr("transform",function(L){return"translate("+m(p.x()(B[L],L))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!j.length){return}J.append("line").attr("x1",0).attr("y1",-f.top).attr("x2",0).attr("y2",y);J.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-f.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(o(p.x()(B[j[0]],j[0])));J.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-f.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(i(p.y()(B[j[0]],j[0])))}function A(){if(q){return}var K=d3.mouse(this)[0]-f.left;function J(O,L){var P=Math.abs(p.x()(O[0],0)-L);var N=0;for(var M=0;M<O.length;M++){if(Math.abs(p.x()(O[M],M)-L)<P){P=Math.abs(p.x()(O[M],M)-L);N=M}}return N}j=[J(B,Math.round(m.invert(K)))];E()}});return k}k.sparkline=p;d3.rebind(k,p,"x","y","xScale","yScale","color");k.options=c.utils.optionsFunc.bind(k);k.margin=function(t){if(!arguments.length){return f}f.top=typeof t.top!="undefined"?t.top:f.top;f.right=typeof t.right!="undefined"?t.right:f.right;f.bottom=typeof t.bottom!="undefined"?t.bottom:f.bottom;f.left=typeof t.left!="undefined"?t.left:f.left;return k};k.width=function(t){if(!arguments.length){return e}e=t;return k};k.height=function(t){if(!arguments.length){return r}r=t;return k};k.xTickFormat=function(t){if(!arguments.length){return o}o=t;return k};k.yTickFormat=function(t){if(!arguments.length){return i}i=t;return k};k.showValue=function(t){if(!arguments.length){return h}h=t;return k};k.alignValue=function(t){if(!arguments.length){return s}s=t;return k};k.rightAlignValue=function(t){if(!arguments.length){return g}g=t;return k};k.noData=function(t){if(!arguments.length){return n}n=t;return k};return k};c.models.stackedArea=function(){var j={top:0,right:0,bottom:0,left:0},h=960,u=500,k=c.utils.defaultColor(),g=Math.floor(Math.random()*100000),t=function(v){return v.x},s=function(v){return v.y},f="stack",l="zero",i="default",n="linear",r=false,q,p,e=c.models.scatter(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");e.size(2.2).sizeDomain([2.2,2.2]);function o(v){v.each(function(F){var I=h-j.left-j.right,B=u-j.top-j.bottom,x=d3.select(this);q=e.xScale();p=e.yScale();F=F.map(function(K,L){K.seriesIndex=L;K.values=K.values.map(function(N,M){N.index=M;N.seriesIndex=L;return N});return K});var D=F.filter(function(K){return !K.disabled});F=d3.layout.stack().order(i).offset(l).values(function(K){return K.values}).x(t).y(s).out(function(M,L,N){var K=(s(M)===0)?0:N;M.display={y:K,y0:L}})(D);var z=x.selectAll("g.nv-wrap.nv-stackedarea").data([F]);var E=z.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea");var C=E.append("defs");var w=E.append("g");var G=z.select("g");w.append("g").attr("class","nv-areaWrap");w.append("g").attr("class","nv-scatterWrap");z.attr("transform","translate("+j.left+","+j.top+")");e.width(I).height(B).x(t).y(function(K){return K.display.y+K.display.y0}).forceY([0]).color(F.map(function(L,K){return L.color||k(L,L.seriesIndex)}));var A=G.select(".nv-scatterWrap").datum(F);A.call(e);C.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect");z.select("#nv-edge-clip-"+g+" rect").attr("width",I).attr("height",B);G.attr("clip-path",r?"url(#nv-edge-clip-"+g+")":"");var y=d3.svg.area().x(function(L,K){return q(t(L,K))}).y0(function(K){return p(K.display.y0)}).y1(function(K){return p(K.display.y+K.display.y0)}).interpolate(n);var H=d3.svg.area().x(function(L,K){return q(t(L,K))}).y0(function(K){return p(K.display.y0)}).y1(function(K){return p(K.display.y0)});var J=G.select(".nv-areaWrap").selectAll("path.nv-area").data(function(K){return K});J.enter().append("path").attr("class",function(L,K){return"nv-area nv-area-"+K}).attr("d",function(L,K){return H(L.values,L.seriesIndex)}).on("mouseover",function(L,K){d3.select(this).classed("hover",true);m.areaMouseover({point:L,series:L.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:K})}).on("mouseout",function(L,K){d3.select(this).classed("hover",false);m.areaMouseout({point:L,series:L.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:K})}).on("click",function(L,K){d3.select(this).classed("hover",false);m.areaClick({point:L,series:L.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:K})});J.exit().transition().attr("d",function(L,K){return H(L.values,K)}).remove();J.style("fill",function(L,K){return L.color||k(L,L.seriesIndex)}).style("stroke",function(L,K){return L.color||k(L,L.seriesIndex)});J.transition().attr("d",function(L,K){return y(L.values,K)});e.dispatch.on("elementMouseover.area",function(K){G.select(".nv-chart-"+g+" .nv-area-"+K.seriesIndex).classed("hover",true)});e.dispatch.on("elementMouseout.area",function(K){G.select(".nv-chart-"+g+" .nv-area-"+K.seriesIndex).classed("hover",false)})});return o}e.dispatch.on("elementClick.area",function(v){m.areaClick(v)});e.dispatch.on("elementMouseover.tooltip",function(v){v.pos=[v.pos[0]+j.left,v.pos[1]+j.top],m.tooltipShow(v)});e.dispatch.on("elementMouseout.tooltip",function(v){m.tooltipHide(v)});o.dispatch=m;o.scatter=e;d3.rebind(o,e,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights");o.options=c.utils.optionsFunc.bind(o);o.x=function(v){if(!arguments.length){return t}t=d3.functor(v);return o};o.y=function(v){if(!arguments.length){return s}s=d3.functor(v);return o};o.margin=function(v){if(!arguments.length){return j}j.top=typeof v.top!="undefined"?v.top:j.top;j.right=typeof v.right!="undefined"?v.right:j.right;j.bottom=typeof v.bottom!="undefined"?v.bottom:j.bottom;j.left=typeof v.left!="undefined"?v.left:j.left;return o};o.width=function(v){if(!arguments.length){return h}h=v;return o};o.height=function(v){if(!arguments.length){return u}u=v;return o};o.clipEdge=function(v){if(!arguments.length){return r}r=v;return o};o.color=function(v){if(!arguments.length){return k}k=c.utils.getColor(v);return o};o.offset=function(v){if(!arguments.length){return l}l=v;return o};o.order=function(v){if(!arguments.length){return i}i=v;return o};o.style=function(v){if(!arguments.length){return f}f=v;switch(f){case"stack":o.offset("zero");o.order("default");break;case"stream":o.offset("wiggle");o.order("inside-out");break;case"stream-center":o.offset("silhouette");o.order("inside-out");break;case"expand":o.offset("expand");o.order("default");break}return o};o.interpolate=function(v){if(!arguments.length){return n}n=v;return o};return o};c.models.stackedAreaChart=function(){var H=c.models.stackedArea(),q=c.models.axis(),f=c.models.axis(),h=c.models.legend(),w=c.models.legend(),C=c.interactiveGuideline();var A={top:30,right:25,bottom:50,left:60},D=null,B=null,E=c.utils.defaultColor(),I=true,F=true,G=true,u=true,p=false,t=false,g=true,m=function(L,K,O,N,M){return"<h3>"+L+"</h3><p>"+O+" on "+K+"</p>"},s,r,k=d3.format(",.2f"),l={style:H.style()},n=null,j="No Data Available.",J=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),e=250,o=["Stacked","Stream","Expanded"],v=250;q.orient("bottom").tickPadding(7);f.orient((p)?"right":"left");w.updateState(false);var i=function(P,L){var O=P.pos[0]+(L.offsetLeft||0),N=P.pos[1]+(L.offsetTop||0),K=q.tickFormat()(H.x()(P.point,P.pointIndex)),Q=f.tickFormat()(H.y()(P.point,P.pointIndex)),M=m(P.series.key,K,Q,P,z);c.tooltip.show([O,N],M,P.value<0?"n":"s",null,L)};function z(x){x.each(function(O){var K=d3.select(this),R=this;var V=(D||parseInt(K.style("width"))||960)-A.left-A.right,N=(B||parseInt(K.style("height"))||400)-A.top-A.bottom;z.update=function(){K.transition().duration(v).call(z)};z.container=this;l.disabled=O.map(function(W){return !!W.disabled});if(!n){var T;n={};for(T in l){if(l[T] instanceof Array){n[T]=l[T].slice(0)}else{n[T]=l[T]}}}if(!O||!O.length||!O.filter(function(W){return W.values.length}).length){var L=K.selectAll(".nv-noData").data([j]);L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");L.attr("x",A.left+V/2).attr("y",A.top+N/2).text(function(W){return W});return z}else{K.selectAll(".nv-noData").remove()}s=H.xScale();r=H.yScale();var M=K.selectAll("g.nv-wrap.nv-stackedAreaChart").data([O]);var y=M.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var P=M.select("g");y.append("rect").style("opacity",0);y.append("g").attr("class","nv-x nv-axis");y.append("g").attr("class","nv-y nv-axis");y.append("g").attr("class","nv-stackedWrap");y.append("g").attr("class","nv-legendWrap");y.append("g").attr("class","nv-controlsWrap");y.append("g").attr("class","nv-interactive");P.select("rect").attr("width",V).attr("height",N);if(F){var U=(I)?V-e:V;h.width(U);P.select(".nv-legendWrap").datum(O).call(h);if(A.top!=h.height()){A.top=h.height();N=(B||parseInt(K.style("height"))||400)-A.top-A.bottom}P.select(".nv-legendWrap").attr("transform","translate("+(V-U)+","+(-A.top)+")")}if(I){var S=[{key:"Stacked",disabled:H.offset()!="zero"},{key:"Stream",disabled:H.offset()!="wiggle"},{key:"Expanded",disabled:H.offset()!="expand"}];e=(o.length/3)*260;S=S.filter(function(W){return o.indexOf(W.key)>-1});w.width(e).color(["#444","#444","#444"]);P.select(".nv-controlsWrap").datum(S).call(w);if(A.top!=Math.max(w.height(),h.height())){A.top=Math.max(w.height(),h.height());N=(B||parseInt(K.style("height"))||400)-A.top-A.bottom}P.select(".nv-controlsWrap").attr("transform","translate(0,"+(-A.top)+")")}M.attr("transform","translate("+A.left+","+A.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+V+",0)")}if(t){C.width(V).height(N).margin({left:A.left,top:A.top}).svgContainer(K).xScale(s);M.select(".nv-interactive").call(C)}H.width(V).height(N);var Q=P.select(".nv-stackedWrap").datum(O);Q.transition().call(H);if(G){q.scale(s).ticks(V/100).tickSize(-N,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+N+")");P.select(".nv-x.nv-axis").transition().duration(0).call(q)}if(u){f.scale(r).ticks(H.offset()=="wiggle"?0:N/36).tickSize(-V,0).setTickFormat(H.offset()=="expand"?d3.format("%"):k);P.select(".nv-y.nv-axis").transition().duration(0).call(f)}H.dispatch.on("areaClick.toggle",function(W){if(O.filter(function(X){return !X.disabled}).length===1){O=O.map(function(X){X.disabled=false;return X})}else{O=O.map(function(Y,X){Y.disabled=(X!=W.seriesIndex);return Y})}l.disabled=O.map(function(X){return !!X.disabled});J.stateChange(l);z.update()});h.dispatch.on("stateChange",function(W){l.disabled=W.disabled;J.stateChange(l);z.update()});w.dispatch.on("legendClick",function(X,W){if(!X.disabled){return}S=S.map(function(Y){Y.disabled=true;return Y});X.disabled=false;switch(X.key){case"Stacked":H.style("stack");break;case"Stream":H.style("stream");break;case"Expanded":H.style("expand");break}l.style=H.style();J.stateChange(l);z.update()});C.dispatch.on("elementMousemove",function(ab){H.clearHighlights();var aa,Z,W,Y=[];O.filter(function(ad,ac){ad.seriesIndex=ac;return !ad.disabled}).forEach(function(ae,ad){Z=c.interactiveBisect(ae.values,ab.pointXValue,z.x());H.highlightPoint(ad,Z,true);var ac=ae.values[Z];if(typeof ac==="undefined"){return}if(typeof aa==="undefined"){aa=ac}if(typeof W==="undefined"){W=z.xScale()(z.x()(ac,Z))}Y.push({key:ae.key,value:z.y()(ac,Z),color:E(ae,ae.seriesIndex)})});var X=q.tickFormat()(z.x()(aa,Z));C.tooltip.position({left:W+A.left,top:ab.mouseY+A.top}).chartContainer(R.parentNode).enabled(g).valueFormatter(function(ad,ac){return f.tickFormat()(ad)}).data({value:X,series:Y})();C.renderGuideLine(W)});C.dispatch.on("elementMouseout",function(W){J.tooltipHide();H.clearHighlights()});J.on("tooltipShow",function(W){if(g){i(W,R.parentNode)}});J.on("changeState",function(W){if(typeof W.disabled!=="undefined"){O.forEach(function(Y,X){Y.disabled=W.disabled[X]});l.disabled=W.disabled}if(typeof W.style!=="undefined"){H.style(W.style)}z.update()})});return z}H.dispatch.on("tooltipShow",function(x){x.pos=[x.pos[0]+A.left,x.pos[1]+A.top],J.tooltipShow(x)});H.dispatch.on("tooltipHide",function(x){J.tooltipHide(x)});J.on("tooltipHide",function(){if(g){c.tooltip.cleanup()}});z.dispatch=J;z.stacked=H;z.legend=h;z.controls=w;z.xAxis=q;z.yAxis=f;z.interactiveLayer=C;d3.rebind(z,H,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");z.options=c.utils.optionsFunc.bind(z);z.margin=function(x){if(!arguments.length){return A}A.top=typeof x.top!="undefined"?x.top:A.top;A.right=typeof x.right!="undefined"?x.right:A.right;A.bottom=typeof x.bottom!="undefined"?x.bottom:A.bottom;A.left=typeof x.left!="undefined"?x.left:A.left;return z};z.width=function(x){if(!arguments.length){return D}D=x;return z};z.height=function(x){if(!arguments.length){return B}B=x;return z};z.color=function(x){if(!arguments.length){return E}E=c.utils.getColor(x);h.color(E);H.color(E);return z};z.showControls=function(x){if(!arguments.length){return I}I=x;return z};z.showLegend=function(x){if(!arguments.length){return F}F=x;return z};z.showXAxis=function(x){if(!arguments.length){return G}G=x;return z};z.showYAxis=function(x){if(!arguments.length){return u}u=x;return z};z.rightAlignYAxis=function(x){if(!arguments.length){return p}p=x;f.orient((x)?"right":"left");return z};z.useInteractiveGuideline=function(x){if(!arguments.length){return t}t=x;if(x===true){z.interactive(false);z.useVoronoi(false)}return z};z.tooltip=function(x){if(!arguments.length){return m}m=x;return z};z.tooltips=function(x){if(!arguments.length){return g}g=x;return z};z.tooltipContent=function(x){if(!arguments.length){return m}m=x;return z};z.state=function(x){if(!arguments.length){return l}l=x;return z};z.defaultState=function(x){if(!arguments.length){return n}n=x;return z};z.noData=function(x){if(!arguments.length){return j}j=x;return z};z.transitionDuration=function(x){if(!arguments.length){return v}v=x;return z};z.controlsData=function(x){if(!arguments.length){return o}o=x;return z};f.setTickFormat=f.tickFormat;f.tickFormat=function(x){if(!arguments.length){return k}k=x;return f};return z}})();