nvd3/nv.d3.min.js

4 lines
101 KiB
JavaScript

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