From a04cc0fa07b9cd01aee9e9f12453acfb725bc6e4 Mon Sep 17 00:00:00 2001 From: Philip Roberts Date: Thu, 5 Jul 2012 13:04:10 +0100 Subject: [PATCH] Fix accidental semicolon in var list causing variables afterwards to be globals in multiBarChart. Fixes #35. --- nv.d3.js | 2 +- nv.d3.min.js | 8 ++++---- src/models/multiBarChart.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nv.d3.js b/nv.d3.js index 74b573f..ee67bcd 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -4055,7 +4055,7 @@ nv.models.multiBarChart = function() { var multibar = nv.models.multiBar().stacked(false), x = multibar.xScale(), y = multibar.yScale(), - xAxis = nv.models.axis().scale(x).orient('bottom').highlightZero(false); //.showMaxMin(false), //TODO: see why showMaxMin(false) causes no ticks to be shown on x axis + xAxis = nv.models.axis().scale(x).orient('bottom').highlightZero(false), //.showMaxMin(false), //TODO: see why showMaxMin(false) causes no ticks to be shown on x axis yAxis = nv.models.axis().scale(y).orient('left'), legend = nv.models.legend().height(30), controls = nv.models.legend().height(30), diff --git a/nv.d3.min.js b/nv.d3.min.js index f138e18..1e49790 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,4 +1,4 @@ -(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(gl+k&&(o=l-h-5);break;case"w":n=b[0]+e,o=b[1]-h/2,n+i>j&&(n=b[0]-i-e),ol+k&&(o=l-h-5);break;case"n":n=b[0]-i/2,o=b[1]+e,nj&&(n=j-i-5),o+h>l+k&&(o=b[1]-h-e);break;case"s":n=b[0]-i/2,o=b[1]-h-e,nj&&(n=j-i-5),l>o&&(o=b[1]+20)}f.style.left=n+"px",f.style.top=o+"px",f.style.opacity=1,f.style.position="absolute",f.style.pointerEvents="none";return f},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("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("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()[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[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(g){g.each(function(g){var h=b-a.left-a.right,o=c-a.top-a.bottom;m.domain(k||d3.extent(g[0].values,e)).range([0,h]),n.domain(l||d3.extent(g[0].values,f)).range([o,0]);var p=d3.select(this).on("click",function(a,b){q.chartClick({data:a,index:b,pos:d3.event,id:d})}),r=d3.select(this).selectAll("g.wrap.bar").data([g[0].values]),s=r.enter().append("g").attr("class","wrap nvd3 bar"),t=s.append("g");t.append("g").attr("class","bars"),r.attr("width",b).attr("height",c);var u=r.select("g").attr("transform","translate("+a.left+","+a.top+")");s.append("defs").append("clipPath").attr("id","chart-clip-path-"+d).append("rect"),r.select("#chart-clip-path-"+d+" rect").attr("width",h).attr("height",o),t.attr("clip-path",i?"url(#chart-clip-path-"+d+")":"");var v=t.append("g").attr("class","shiftWrap"),w=r.select(".bars").selectAll(".bar").data(function(a){return a});w.exit().remove();var z=w.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:g[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:g[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()});w.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))-m(.5))+",0)"}).attr("width",m(.9)),d3.transition(w).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"

"+d.label+"

"+"

"+d.value+"

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

"+b.label+"

"+"

"+b.value+"

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

"+a+"

"+"

"+c+" at "+b+"

"};var j=a.models.line(),k=j.xScale(),l=j.yScale(),m=d3.scale.linear(),n=j.id(),o=a.models.axis().scale(k).orient("bottom").tickPadding(5),p=a.models.axis().scale(l).orient("left"),q=a.models.legend().height(30),r=a.models.legend().height(30),s=d3.dispatch("tooltipShow","tooltipHide"),t={i:0,x:0},u=[{key:"Re-scale y-axis"}],v=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=o.tickFormat()(j.x()(b.point)),g=p.tickFormat()(j.y()(b.point)),h=tooltip(b.series.key,f,g,b,A);a.tooltip.show([d,e],h)},w=d3.behavior.drag().on("dragstart",x).on("drag",y).on("dragend",z);A.dispatch=s,A.legend=q,A.xAxis=o,A.yAxis=p,d3.rebind(A,j,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.margin=function(a){if(!arguments.length)return b;b=a;return A},A.width=function(a){if(!arguments.length)return d;d=a;return A},A.height=function(a){if(!arguments.length)return e;e=a;return A},A.color=function(a){if(!arguments.length)return c;c=a,q.color(a);return A},A.showLegend=function(a){if(!arguments.length)return f;f=a;return A},A.tooltips=function(a){if(!arguments.length)return g;g=a;return A},A.tooltipContent=function(a){if(!arguments.length)return tooltip;tooltip=a;return A};return A},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]),o=o||e,p=p||d3.scale.linear().domain(f.domain()).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),q.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),q.elementMouseout({value:h(a,b),point:a,series:s[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){q.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){q.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?p(0):p(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(){d.transition().call(r)},o=e.copy(),p=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,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");r.dispatch=q,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","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"

"+b+"

"+"

"+c+"

"},j=a.models.discreteBar(),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("bottom").highlightZero(!1).showMaxMin(!1),n=a.models.axis().scale(l).orient("left"),o=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),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(ri&&q>1){s=[],q--;for(k=0;k(s[k%q]||0)&&(s[k%q]=p[k]);r=s.reduce(function(a,b,c,d){return a+b})}var t=[];for(var u=0,v=0;uy&&(y=x);return"translate("+z+","+w+")"}),m.attr("transform","translate("+(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 p(a){a.each(function(a){var o=c-b.left-b.right,p=d-b.top-b.bottom;k=k||j.xScale(),l=l||j.yScale(),m=m||k,n=n||l;var q=d3.select(this).selectAll("g.wrap.line").data([a]),r=q.enter().append("g").attr("class","wrap nvd3 line"),s=r.append("defs"),t=r.append("g"),u=q.select("g");t.append("g").attr("class","groups"),t.append("g").attr("class","scatterWrap");var v=q.select(".scatterWrap");j.width(o).height(p),d3.transition(v).call(j),q.attr("transform","translate("+b.left+","+b.top+")"),s.append("clipPath").attr("id","edge-clip-"+f).append("rect"),q.select("#edge-clip-"+f+" rect").attr("width",o).attr("height",p),u.attr("clip-path",i?"url(#edge-clip-"+f+")":""),v.attr("clip-path",i?"url(#edge-clip-"+f+")":"");var w=q.select(".groups").selectAll(".group").data(function(a){return a},function(a){return a.key});w.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(w.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),w.attr("class",function(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(w).style("stroke-opacity",1).style("fill-opacity",.5);var z=w.selectAll("path").data(function(a,b){return[a.values]});z.enter().append("path").attr("class","line").attr("d",d3.svg.line().x(function(a,b){return m(g(a,b))}).y(function(a,b){return n(h(a,b))})),d3.transition(w.exit().selectAll("path")).attr("d",d3.svg.line().x(function(a,b){return k(g(a,b))}).y(function(a,b){return l(h(a,b))})),d3.transition(z).attr("d",d3.svg.line().x(function(a,b){return k(g(a,b))}).y(function(a,b){return l(h(a,b))})),m=k.copy(),n=l.copy()});return p}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=!1,j=a.models.scatter().id(f).size(16).sizeDomain([16,256]),k,l,m,n,o;p.dispatch=j.dispatch,d3.rebind(p,j,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),p.margin=function(a){if(!arguments.length)return b;b=a;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.x=function(a){if(!arguments.length)return g;g=a,j.x(a);return p},p.y=function(a){if(!arguments.length)return h;h=a,j.y(a);return p},p.clipEdge=function(a){if(!arguments.length)return i;i=a;return p},p.color=function(a){if(!arguments.length)return e;e=a,j.color(a);return p},p.id=function(a){if(!arguments.length)return f;f=a;return p};return p},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(h){h.each(function(j){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,v=r.selectAll("g.wrap.lineChart").data([j]),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 x=v.select("g");f&&(n.width(t),x.select(".legendWrap").datum(j).call(n),b.top!=n.height()&&(b.top=n.height(),u=(e||parseInt(r.style("height"))||400)-b.top-b.bottom),x.select(".legendWrap").attr("transform","translate(0,"+ -b.top+")")),i.width(t).height(u).color(j.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!j[b].disabled})),x.attr("transform","translate("+b.left+","+b.top+")");var z=x.select(".linesWrap").datum(j.filter(function(a){return!a.disabled}));d3.transition(z).call(i),l.ticks(t/100).tickSize(-u,0),x.select(".x.axis").attr("transform","translate(0,"+k.range()[0]+")"),d3.transition(x.select(".x.axis")).call(l),m.ticks(u/36).tickSize(-t,0),d3.transition(x.select(".y.axis")).call(m),n.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,j.filter(function(a){return!a.disabled}).length||j.map(function(a){a.disabled=!1,v.selectAll(".series").classed("disabled",!1);return a}),h.transition().call(q)}),i.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],o.tooltipShow(a)}),g&&o.on("tooltipShow",function(a){p(a,s.parentNode)}),i.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),g&&o.on("tooltipHide",a.tooltip.cleanup)}),q.update=function(){q(h)},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"

"+a+"

"+"

"+c+" at "+b+"

"},i=a.models.line(),j=i.xScale(),k=i.yScale(),l=a.models.axis().scale(j).orient("bottom").tickPadding(5),m=a.models.axis().scale(k).orient("left"),n=a.models.legend().height(30),o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=l.tickFormat()(i.x()(b.point)),g=m.tickFormat()(i.y()(b.point)),j=h(b.series.key,f,g,b,q);a.tooltip.show([d,e],j)};q.dispatch=o,q.legend=n,q.xAxis=l,q.yAxis=m,d3.rebind(q,i,"x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),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]),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 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),H.select(".legendWrap").datum(o.map(function(a){a.key=a.key+(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(0,"+ -b.top+")"));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"

"+a+"

"+"

"+c+" at "+b+"

"},k=a.models.line(),l=a.models.historicalBar(),m=d3.scale.linear(),n=l.yScale(),o=k.yScale(),p=a.models.axis().scale(m).orient("bottom").tickPadding(5),q=a.models.axis().scale(n).orient("left"),r=a.models.axis().scale(o).orient("right"),s=a.models.legend().height(30),t=d3.dispatch("tooltipShow","tooltipHide"),u=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=p.tickFormat()(k.x()(b.point)),g=q.tickFormat()(k.y()(b.point)),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,"size","clipVoronoi"),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.width(C).height(E).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.tickFormat(q.tickFormat()).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.tickFormat(r.tickFormat()).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"

"+a+"

"+"

"+c+" at "+b+"

"},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)),g=r.tickFormat()(k.y()(b.point)),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,d3.rebind(y,k,"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};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;n=n||p,o=o||q,i&&(u=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(f)(u)),u=u.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var z=l&&m?[]:u.map(function(a){return a.values.map(function(a,b){return{x:e(a,b),y:f(a,b),y0:a.y0}})});p.domain(d3.merge(z).map(function(a){return a.x})).rangeBands([0,v],.1),q.domain(m||d3.extent(d3.merge(z).map(function(a){return a.y+(i?a.y0:0)}).concat(g))).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-"+d).append("rect"),A.select("#edge-clip-"+d+" rect").attr("width",v).attr("height",w),E.attr("clip-path",h?"url(#edge-clip-"+d+")":"");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*k/u[0].values.length}).attr("y",function(a){return i?o(a.y0):o(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 j[b%j.length]}).style("stroke",function(a,b){return j[b%j.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 f(a,b)<0?"bar negative":"bar positive"}).attr("x",function(a,b,c){return i?0:c*p.rangeBand()/u.length}).attr("y",function(a){return o(i?a.y0:0)}).attr("height",0).attr("width",p.rangeBand()/(i?1:u.length)).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),r.elementMouseover({value:f(a,b),point:a,series:u[a.series],pos:[p(e(a,b))+p.rangeBand()*(i?u.length/2:a.series+.5)/u.length,q(f(a,b)+(i?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),r.elementMouseout({value:f(a,b),point:a,series:u[a.series],pointIndex:b,seriesIndex:a.series,e:d3.event})}).on("click",function(a,b){r.elementClick({value:f(a,b),point:a,series:u[a.series],pos:[p(e(a,b))+p.rangeBand()*(i?u.length/2:a.series+.5)/u.length,q(f(a,b)+(i?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(a,b){r.elementDblClick({value:f(a,b),point:a,series:u[a.series],pos:[p(e(a,b))+p.rangeBand()*(i?u.length/2:a.series+.5)/u.length,q(f(a,b)+(i?a.y0:0))],pointIndex:b,seriesIndex:a.series,e:d3.event}),d3.event.stopPropagation()});G.attr("class",function(a,b){return f(a,b)<0?"bar negative":"bar positive"}).attr("transform",function(a,b){return"translate("+p(e(a,b))+",0)"}),i?d3.transition(G).delay(function(a,b){return b*k/u[0].values.length}).attr("y",function(a,b){return q(f(a,b)+(i?a.y0:0))}).attr("height",function(a,b){return Math.abs(q(a.y+(i?a.y0:0))-q(i?a.y0:0))}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(a,b){return i?0:a.series*p.rangeBand()/u.length}).attr("width",p.rangeBand()/(i?1:u.length))}):d3.transition(G).delay(function(a,b){return b*k/u[0].values.length}).attr("x",function(a,b){return a.series*p.rangeBand()/u.length}).attr("width",p.rangeBand()/u.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return f(a,b)<0?q(0):q(f(a,b))}).attr("height",function(a,b){return Math.abs(q(f(a,b))-q(0))})}),s.update=function(){t.transition().call(s)},n=p.copy(),o=q.copy()});return s}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=[0],h=!0,i=!1,j=d3.scale.category20().range(),k=1200,l,m,n,o,p=d3.scale.ordinal(),q=d3.scale.linear(),r=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");s.dispatch=r,s.x=function(a){if(!arguments.length)return e;e=a;return s},s.y=function(a){if(!arguments.length)return f;f=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 p;p=a;return s},s.yScale=function(a){if(!arguments.length)return q;q=a;return s},s.xDomain=function(a){if(!arguments.length)return l;l=a;return s},s.yDomain=function(a){if(!arguments.length)return m;m=a;return s},s.forceY=function(a){if(!arguments.length)return g;g=a;return s},s.stacked=function(a){if(!arguments.length)return i;i=a;return s},s.clipEdge=function(a){if(!arguments.length)return h;h=a;return s},s.color=function(a){if(!arguments.length)return j;j=a;return s},s.id=function(a){if(!arguments.length)return d;d=a;return s},s.delay=function(a){if(!arguments.length)return k;k=a;return s};return s},a.models.multiBarChart=function(){function p(i){i.each(function(k){var q=d3.select(this),r=this,s=(c||parseInt(q.style("width"))||960)-b.left-b.right,t=(d||parseInt(q.style("height"))||400)-b.top-b.bottom,u=q.selectAll("g.wrap.multiBarWithLegend").data([k]),v=u.enter().append("g").attr("class","wrap nvd3 multiBarWithLegend").append("g");v.append("g").attr("class","x axis"),v.append("g").attr("class","y axis"),v.append("g").attr("class","barsWrap"),v.append("g").attr("class","legendWrap"),v.append("g").attr("class","controlsWrap");var w=u.select("g");g&&(legend.width(s/2),w.select(".legendWrap").datum(k).call(legend),b.top!=legend.height()&&(b.top=legend.height(),t=(d||parseInt(q.style("height"))||400)-b.top-b.bottom),w.select(".legendWrap").attr("transform","translate("+s/2+","+ -b.top+")")),j.width(s).height(t).color(k.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!k[b].disabled})),f&&(controls.width(180).color(["#444","#444","#444"]),w.select(".controlsWrap").datum(o).attr("transform","translate(0,"+ -b.top+")").call(controls)),w.attr("transform","translate("+b.left+","+b.top+")");var x=w.select(".barsWrap").datum(k.filter(function(a){return!a.disabled}));d3.transition(x).call(j),m.ticks(s/100).tickSize(-t,0),w.select(".x.axis").attr("transform","translate(0,"+l.range()[0]+")"),d3.transition(w.select(".x.axis")).call(m);var z=w.select(".x.axis").selectAll("g");z.selectAll("line, text").style("opacity",1),z.filter(function(a,b){return b%Math.ceil(k[0].values.length/(s/100))!==0}).style("opacity",0),yAxis.ticks(t/36).tickSize(-s,0),d3.transition(w.select(".y.axis")).call(yAxis),legend.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,u.selectAll(".series").classed("disabled",!1);return a}),i.transition().call(p)}),controls.dispatch.on("legendClick",function(a,b){if(!!a.disabled){o=o.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(p)}}),j.dispatch.on("elementMouseover.tooltip2",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],dispatch.tooltipShow(a)}),h&&dispatch.on("tooltipShow",function(a){n(a,r.parentNode)}),j.dispatch.on("elementMouseout.tooltip",function(a){dispatch.tooltipHide(a)}),h&&dispatch.on("tooltipHide",a.tooltip.cleanup),p.update=function(){i.transition().call(p)},p.container=this});return p}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"

"+a+"

"+"

"+c+" on "+b+"

"},j=a.models.multiBar().stacked(!1),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("bottom").highlightZero(!1);yAxis=a.models.axis().scale(l).orient("left"),legend=a.models.legend().height(30),controls=a.models.legend().height(30),dispatch=d3.dispatch("tooltipShow","tooltipHide"),m.tickFormat(function(a){return a}),yAxis.tickFormat(d3.format(",.1f"));var n=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)),g=yAxis.tickFormat()(j.y()(b.point)),h=i(b.series.key,f,g,b,p);a.tooltip.show([d,e],h,b.value<0?"n":"s")},o=[{key:"Grouped"},{key:"Stacked",disabled:!0}];p.dispatch=dispatch,p.legend=legend,p.xAxis=m,p.yAxis=yAxis,d3.rebind(p,j,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked"),p.margin=function(a){if(!arguments.length)return b;b=a;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.color=function(a){if(!arguments.length)return e;e=a,legend.color(a);return p},p.showControls=function(a){if(!arguments.length)return f;f=a;return p},p.showLegend=function(a){if(!arguments.length)return g;g=a;return p};return p},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)))+")"}).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()});I.append("rect").attr("width",0).attr("height",e.rangeBand()/(l?1:p.length)),m&&!l?(I.append("text").attr("text-anchor",function(a,b){return h(a,b)<0?"end":"start"}),H.selectAll("text").attr("y",e.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(h(a,b))}),d3.transition(H).selectAll("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)+")"}).selectAll("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)))+")"}).selectAll("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"

"+b+"

"+"

"+c+"

"},j=a.models.multiBarHorizontal().stacked(!1),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("left").highlightZero(!1).showMaxMin(!1),n=a.models.axis().scale(l).orient("bottom"),o=a.models.legend().height(30),p=a.models.legend().height(30),q=d3.dispatch("tooltipShow","tooltipHide");m.tickFormat(function(a){return a}),n.tickFormat(d3.format(",.1f"));var r=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=m.tickFormat()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),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"

"+a+"

"+"

"+b+"

"},i=a.models.pie(),j=a.models.legend().height(30),k=d3.dispatch("tooltipShow","tooltipHide"),l=function(b,c){var d=b.pos[0]+(c&&c.offsetLeft||0),e=b.pos[1]+(c&&c.offsetTop||0),f=i.valueFormat()(i.y()(b.point)),g=h(i.x()(b.point),f,b,m);a.tooltip.show([d,e],g,b.value<0?"n":"s")};m.dispatch=k,m.pie=i,d3.rebind(m,i,"values","x","y","id","showLabels","donut","labelThreshold"),m.margin=function(a){if(!arguments.length)return b;b=a;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.color=function(a){if(!arguments.length)return f;f=a,j.color(a),i.color(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;J.append("g").attr("class","point-paths");var b=d3.merge(B.map(function(a,b){return a.values.map(function(a,c){return[f(i(a,c))*(Math.random()/1e12+1),g(j(a,c))*(Math.random()/1e12+1),b,c]})}));if(r){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",s),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];w.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];w.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){w.elementMouseout({point:B[a.series].values[a.point],series:B[a.series],seriesIndex:a.series,pointIndex:a.point})}),w.on("elementMouseover.point",function(a){d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!0)}),w.on("elementMouseout.point",function(a){d3.select(".chart-"+e+" .series-"+a.seriesIndex+" .point-"+a.pointIndex).classed("hover",!1)})}var C=b-a.left-a.right,D=c-a.top-a.bottom,E=d3.select(this);x=x||f,y=y||g,z=z||h,B=B.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var F=t&&u&&v?[]: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(t||d3.extent(d3.merge(F).map(function(a){return a.x}).concat(m))).range([0,C]),g.domain(u||d3.extent(d3.merge(F).map(function(a){return a.y}).concat(n))).range([D,0]),h.domain(v||d3.extent(d3.merge(F).map(function(a){return a.size}).concat(o))).range([16,256]);var G=E.selectAll("g.wrap.scatter").data([B]),H=G.enter().append("g").attr("class","wrap nvd3 scatter chart-"+e),I=H.append("defs"),J=H.append("g"),K=G.select("g");J.append("g").attr("class","groups"),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",q?"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=!1,r=!0,s=function(){return 25},t,u,v,w=d3.dispatch("elementClick","elementMouseover","elementMouseout"),x,y,z,A;B.dispatch=w,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 t;t=a;return B},B.yDomain=function(a){if(!arguments.length)return u;u=a;return B},B.sizeDomain=function(a){if(!arguments.length)return v;v=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.clipEdge=function(a){if(!arguments.length)return q;q=a;return B},B.clipVoronoi=function(a){if(!arguments.length)return r;r=a;return B},B.clipRadius=function(a){if(!arguments.length)return s;s=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};return B},a.models.scatterChart=function(){function D(f){f.each(function(g){function J(){if(k){H.select(".point-paths").style("pointer-events","all");return!1}H.select(".background").style("pointer-events","all"),H.select(".point-paths").style("pointer-events","none");var a=d3.mouse(this);p.distortion(j).focus(a[0]),q.distortion(j).focus(a[1]),I.call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t),H.select(".distributionX").datum(g.filter(function(a){return!a.disabled})).call(w),H.select(".distributionY").datum(g.filter(function(a){return!a.disabled})).call(x)}var m=d3.select(this),n=this,o=(c||parseInt(m.style("width"))||960)-b.left-b.right,E=(d||parseInt(m.style("height"))||400)-b.top-b.bottom;z=z||r.xScale(),A=A||r.yScale();var F=m.selectAll("g.wrap.scatterChart").data([g]),G=F.enter().append("g").attr("class","wrap nvd3 scatterChart chart-"+r.id()).append("g");G.append("rect").attr("class","nvd3 background").attr("width",o).attr("height",E),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");var H=F.select("g");h&&(u.width(o/2),F.select(".legendWrap").datum(g).call(u),b.top!=u.height()&&(b.top=u.height(),E=(d||parseInt(m.style("height"))||400)-b.top-b.bottom),F.select(".legendWrap").attr("transform","translate("+o/2+","+ -b.top+")")),i&&(v.width(180).color(["#444"]),H.select(".controlsWrap").datum(C).attr("transform","translate(0,"+ -b.top+")").call(v)),r.width(o).height(E).color(g.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!g[b].disabled})),H.attr("transform","translate("+b.left+","+b.top+")");var I=F.select(".scatterWrap").datum(g.filter(function(a){return!a.disabled}));d3.transition(I).call(r),s.ticks(o/100).tickSize(-E,0),H.select(".x.axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(H.select(".x.axis")).call(s),t.ticks(E/36).tickSize(-o,0),d3.transition(H.select(".y.axis")).call(t),w.width(o).color(g.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!g[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionX").attr("transform","translate(0,"+q.range()[0]+")"),H.select(".distributionX").datum(g.filter(function(a){return!a.disabled})).call(w),x.width(E).color(g.map(function(a,b){return a.color||e[b%e.length]}).filter(function(a,b){return!g[b].disabled})),G.select(".distWrap").append("g").attr("class","distributionY").attr("transform","translate(-"+x.size()+",0)"),H.select(".distributionY").datum(g.filter(function(a){return!a.disabled})).call(x),H.select(".background").on("mousemove",J),H.select(".background").on("click",function(){k=!k}),v.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,j=a.disabled?0:2.5,H.select(".background").style("pointer-events",a.disabled?"none":"all"),H.select(".point-paths").style("pointer-events",a.disabled?"all":"none"),a.disabled?(p.distortion(j).focus(0),q.distortion(j).focus(0),I.call(r),H.select(".x.axis").call(s),H.select(".y.axis").call(t)):k=!1,f.transition().call(D)}),u.dispatch.on("legendClick",function(a,b,c){a.disabled=!a.disabled,g.filter(function(a){return!a.disabled}).length||g.map(function(a){a.disabled=!1,F.selectAll(".series").classed("disabled",!1);return a}),f.transition().call(D)}),r.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".chart-"+r.id()+" .series-"+a.seriesIndex+" .distx-"+a.pointIndex).attr("y1",a.pos[1]-E),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)}),l&&y.on("tooltipShow",function(a){B(a,n.parentNode)}),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())}),l&&y.on("tooltipHide",a.tooltip.cleanup),z=p.copy(),A=q.copy(),D.update=function(){f.transition().call(D)},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=!1,g=!1,h=!0,i=!0,j=0,k=!1,l=!0,m=function(a,b,c){return""+b+""},n=function(a,b,c){return""+c+""},o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p=d3.fisheye.scale(d3.scale.linear).distortion(0),q=d3.fisheye.scale(d3.scale.linear).distortion(0),r=a.models.scatter().xScale(p).yScale(q),s=a.models.axis().orient("bottom").scale(p).tickPadding(10),t=a.models.axis().orient("left").scale(q).tickPadding(10),u=a.models.legend().height(30),v=a.models.legend().height(30),w=a.models.distribution().axis("x").scale(p),x=a.models.distribution().axis("y").scale(q),y=d3.dispatch("tooltipShow","tooltipHide"),z,A,B=function(c,d){var e=c.pos[0]+(d.offsetLeft||0),f=q.range()[0]+b.top+(d.offsetTop||0),g=p.range()[0]+b.left+(d.offsetLeft||0),h=c.pos[1]+(d.offsetTop||0),i=s.tickFormat()(r.x()(c.point)),j=t.tickFormat()(r.y()(c.point)),k=m(c.series.key,i,j,c,D),l=n(c.series.key,i,j,c,D);a.tooltip.show([e,f],k,"n",1),a.tooltip.show([g,h],l,"e",1)},C=[{key:"Magnify",disabled:!0}];D.dispatch=y,D.legend=u,D.xAxis=s,D.yAxis=t,d3.rebind(D,r,"interactive","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius","fisheye","fisheyeRadius"),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 f;f=a;return D},D.showDistY=function(a){if(!arguments.length)return g;g=a;return D},D.showControls=function(a){if(!arguments.length)return i;i=a;return D},D.showLegend=function(a){if(!arguments.length)return h;h=a;return D},D.fisheye=function(a){if(!arguments.length)return j;j=a;return D},D.tooltips=function(a){if(!arguments.length)return l;l=a;return D},D.tooltipContent=function(a){if(!arguments.length)return o;o=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,m=d-b.top-b.bottom;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"),n.width(i).height(m).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(n),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",m),v.attr("clip-path",l?"url(#edge-clip-"+f+")":"");var z=d3.svg.area().x(function(a,b){return o(g(a,b))}).y0(function(a){return p(a.display.y0)}).y1(function(a){return p(a.display.y+a.display.y0)}),A=d3.svg.area().x(function(a,b){return o(g(a,b))}).y0(function(a){return p(a.display.y0)}).y1(function(a){return p(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)}),n.dispatch.on("elementClick.area",function(a){q.areaClick(a)}),n.dispatch.on("elementMouseover.area",function(a){v.select(".area-"+a.seriesIndex).classed("hover",!0)}),n.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=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}}),n=a.models.scatter().size(2.2).sizeDomain([2.5]),o=n.xScale(),p=n.yScale(),q=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");r.dispatch=q,r.scatter=n,d3.rebind(r,n,"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},n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],q.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){q.tooltipHide(a)});return r},a.models.stackedAreaChart=function(){function t(e){e.each(function(i){var k=d3.select(this),l=this,u=(c||parseInt(k.style("width"))||960)-b.left-b.right,v=(d||parseInt(k.style("height"))||400)-b.top-b.bottom,w=k.selectAll("g.wrap.stackedAreaChart").data([i]),x=w.enter().append("g").attr("class","wrap nvd3 stackedAreaChart").append("g");x.append("g").attr("class","x axis"),x.append("g").attr("class","y axis"),x.append("g").attr("class","stackedWrap"),x.append("g").attr("class","legendWrap"),x.append("g").attr("class","controlsWrap");var y=w.select("g");g&&(o.width(u/2),y.select(".legendWrap").datum(i).call(o),b.top!=o.height()&&(b.top=o.height(),v=(d||parseInt(k.style("height"))||400)-b.top-b.bottom),y.select(".legendWrap").attr("transform","translate("+(u/2-b.left)+","+ -b.top+")")),j.width(u).height(v),f&&(p.width(280).color(["#444","#444","#444"]),y.select(".controlsWrap").datum(r).attr("transform","translate(0,"+ -b.top+")").call(p)),y.attr("transform","translate("+b.left+","+b.top+")");var z=y.select(".stackedWrap").datum(i);d3.transition(z).call(j),m.ticks(u/100).tickSize(-v,0),y.select(".x.axis").attr("transform","translate(0,"+v+")"),d3.transition(y.select(".x.axis")).call(m),n.ticks(j.offset()=="wiggle"?0:v/36).tickSize(-u,0).tickFormat(j.offset()=="expand"?d3.format("%"):d3.format(",.2f")),d3.transition(y.select(".y.axis")).call(n),j.dispatch.on("areaClick.toggle",function(a){i.filter(function( -a){return!a.disabled}).length===1?i=i.map(function(a){a.disabled=!1;return a}):i=i.map(function(b,c){b.disabled=c!=a.seriesIndex;return b}),e.transition().call(t)}),o.dispatch.on("legendClick",function(a,b){a.disabled=!a.disabled,i.filter(function(a){return!a.disabled}).length||i.map(function(a){a.disabled=!1;return a}),e.transition().call(t)}),p.dispatch.on("legendClick",function(a,b){if(!!a.disabled){r=r.map(function(a){a.disabled=!0;return a}),a.disabled=!1;switch(a.key){case"Stacked":j.style("stack");break;case"Stream":j.style("stream");break;case"Expanded":j.style("expand")}e.transition().call(t)}}),j.dispatch.on("tooltipShow",function(a){if(!Math.round(j.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)}),h&&q.on("tooltipShow",function(a){s(a,l.parentNode)}),j.dispatch.on("tooltipHide",function(a){q.tooltipHide(a)}),h&&q.on("tooltipHide",a.tooltip.cleanup),t.update=function(){e.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"

"+a+"

"+"

"+c+" on "+b+"

"},j=a.models.stackedArea(),k=j.xScale(),l=j.yScale(),m=a.models.axis().scale(k).orient("bottom").tickPadding(5),n=a.models.axis().scale(l).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()(j.x()(b.point)),g=n.tickFormat()(j.y()(b.point)),h=i(b.series.key,f,g,b,t);a.tooltip.show([d,e],h,b.value<0?"n":"s")};t.dispatch=q,t.stacked=j,t.xAxis=m,t.yAxis=n,d3.rebind(t,j,"x","y","interactive","offset","order","style","clipEdge","size","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}})() \ No newline at end of file +(function(){function t(e,t){var n=[31,28,31,30,31,30,31,31,30,31,30,31];return e!=2?n[e-1]:t%4!=0?n[1]:t%100==0&&t%400!=0?n[1]:n[1]+1}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o1)while(oc+l&&(d=c-u-5);break;case"w":p=t[0]+i,d=t[1]-u/2,p+a>f&&(p=t[0]-a-i),dc+l&&(d=c-u-5);break;case"n":p=t[0]-a/2,d=t[1]+i,pf&&(p=f-a-5),d+u>c+l&&(d=t[1]-u-i);break;case"s":p=t[0]-a/2,d=t[1]-u-i,pf&&(p=f-a-5),c>d&&(d=t[1]+20)}return s.style.left=p+"px",s.style.top=d+"px",s.style.opacity=1,s.style.position="absolute",s.style.pointerEvents="none",s},t.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.models.axis=function(){function o(u){return u.each(function(o){var u=d3.select(this),a=u.selectAll("g.wrap.axis").data([o]),f=a.enter().append("g").attr("class","wrap axis"),l=f.append("g"),c=a.select("g");(i.orient()=="top"||i.orient()=="bottom")&&i.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(c).call(i),s=s||i.scale();var h=c.selectAll("text.axislabel").data([t||null]);h.exit().remove();switch(i.orient()){case"top":h.enter().append("text").attr("class","axislabel").attr("text-anchor","middle").attr("y",0),h.attr("x",e.range()[1]/2);if(n){var p=a.selectAll("g.axisMaxMin").data(e.domain());p.enter().append("g").attr("class","axisMaxMin").append("text"),p.exit().remove(),p.attr("transform",function(t,n){return"translate("+e(t)+",0)"}).select("text").attr("dy","0em").attr("y",-i.tickPadding()).attr("text-anchor","middle").text(function(e,t){return(""+i.tickFormat()(e)).match("NaN")?"":i.tickFormat()(e)}),d3.transition(p).attr("transform",function(t,n){return"translate("+e.range()[n]+",0)"})}break;case"bottom":h.enter().append("text").attr("class","axislabel").attr("text-anchor","middle").attr("y",25),h.attr("x",e.range()[1]/2);if(n){var p=a.selectAll("g.axisMaxMin").data(e.domain());p.enter().append("g").attr("class","axisMaxMin").append("text"),p.exit().remove(),p.attr("transform",function(t,n){return"translate("+e(t)+",0)"}).select("text").attr("dy",".71em").attr("y",i.tickPadding()).attr("text-anchor","middle").text(function(e,t){return(""+i.tickFormat()(e)).match("NaN")?"":i.tickFormat()(e)}),d3.transition(p).attr("transform",function(t,n){return"translate("+e.range()[n]+",0)"})}break;case"right":h.enter().append("text").attr("class","axislabel").attr("transform","rotate(90)").attr("y",-40),h.attr("x",-e.range()[0]/2);if(n){var p=a.selectAll("g.axisMaxMin").data(e.domain());p.enter().append("g").attr("class","axisMaxMin").append("text").style("opacity",0),p.exit().remove(),p.attr("transform",function(t,n){return"translate(0,"+e(t)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",i.tickPadding()).attr("text-anchor","start").text(function(e,t){return(""+i.tickFormat()(e)).match("NaN")?"":i.tickFormat()(e)}),d3.transition(p).attr("transform",function(t,n){return"translate(0,"+e.range()[n]+")"}).select("text").style("opacity",1)}break;case"left":h.enter().append("text").attr("class","axislabel").attr("transform","rotate(-90)").attr("y",-40),h.attr("x",-e.range()[0]/2);if(n){var p=a.selectAll("g.axisMaxMin").data(e.domain());p.enter().append("g").attr("class","axisMaxMin").append("text").style("opacity",0),p.exit().remove(),p.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-i.tickPadding()).attr("text-anchor","end").text(function(e,t){return(""+i.tickFormat()(e)).match("NaN")?"":i.tickFormat()(e)}),d3.transition(p).attr("transform",function(t,n){return"translate(0,"+e.range()[n]+")"}).select("text").style("opacity",1)}}h.text(function(e){return e}),n&&(i.orient()==="left"||i.orient()==="right")&&c.selectAll("g").each(function(t,n){if(e(t)e.range()[0]-10)t>1e-10||t<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()});if(n&&(i.orient()==="top"||i.orient()==="bottom")){var d=[];a.selectAll("g.axisMaxMin").each(function(t,n){n?d.push(e(t)-this.getBBox().width-4):d.push(e(t)+this.getBBox().width+4)}),c.selectAll("g").each(function(t,n){if(e(t)d[1])t>1e-10||t<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}r&&c.selectAll("line.tick").filter(function(e){return!parseFloat(Math.round(e*1e5)/1e6)}).classed("zero",!0),s=e.copy()}),o}var e=d3.scale.linear(),t=null,n=!0,r=!0,i=d3.svg.axis().scale(e).orient("bottom").tickFormat(function(e){return e}),s;return d3.rebind(o,i,"orient","ticks","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.axisLabel=function(e){return arguments.length?(t=e,o):t},o.showMaxMin=function(e){return arguments.length?(n=e,o):n},o.highlightZero=function(e){return arguments.length?(r=e,o):r},o.scale=function(t){return arguments.length?(e=t,i.scale(e),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o},e.models.historicalBar=function(){function g(o){return o.each(function(o){var u=t-e.left-e.right,d=n-e.top-e.bottom;h.domain(l||d3.extent(o[0].values,i)).range([0,u]),p.domain(c||d3.extent(o[0].values,s)).range([d,0]);var v=d3.select(this).on("click",function(e,t){m.chartClick({data:e,index:t,pos:d3.event,id:r})}),g=d3.select(this).selectAll("g.wrap.bar").data([o[0].values]),b=g.enter().append("g").attr("class","wrap nvd3 bar"),w=b.append("g");w.append("g").attr("class","bars"),g.attr("width",t).attr("height",n);var E=g.select("g").attr("transform","translate("+e.left+","+e.top+")");b.append("defs").append("clipPath").attr("id","chart-clip-path-"+r).append("rect"),g.select("#chart-clip-path-"+r+" rect").attr("width",u).attr("height",d),w.attr("clip-path",a?"url(#chart-clip-path-"+r+")":"");var S=w.append("g").attr("class","shiftWrap"),T=g.select(".bars").selectAll(".bar").data(function(e){return e});T.exit().remove();var N=T.enter().append("svg:rect").attr("class",function(e,t){return s(e,t)<0?"bar negative":"bar positive"}).attr("fill",function(e,t){return f[0]}).attr("x",0).attr("y",function(e,t){return p(Math.max(0,s(e,t)))}).attr("height",function(e,t){return Math.abs(p(s(e,t))-p(0))}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.elementMouseover({point:e,series:o[0],pos:[h(i(e,t)),p(s(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.elementMouseout({point:e,series:o[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){m.elementClick({value:s(e,t),data:e,index:t,pos:[h(i(e,t)),p(s(e,t))],e:d3.event,id:r}),d3.event.stopPropagation()}).on("dblclick",function(e,t){m.elementDblClick({value:s(e,t),data:e,index:t,pos:[h(i(e,t)),p(s(e,t))],e:d3.event,id:r}),d3.event.stopPropagation()});T.attr("class",function(e,t){return s(e,t)<0?"bar negative":"bar positive"}).attr("transform",function(e,t){return"translate("+(h(i(e,t))-h(.5))+",0)"}).attr("width",h(.9)),d3.transition(T).attr("y",function(e,t){return p(Math.max(0,s(e,t)))}).attr("height",function(e,t){return Math.abs(p(s(e,t))-p(0))})}),g}var e={top:0,right:0,bottom:0,left:0},t=960,n=500,r=Math.floor(Math.random()*1e4),i=function(e){return e.x},s=function(e){return e.y},o=[],u=[],a=!0,f=d3.scale.category20().range(),l,c,h=d3.scale.linear(),p=d3.scale.linear(),d=d3.svg.axis().scale(h).orient("bottom"),v=d3.svg.axis().scale(p).orient("left"),m=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return g.dispatch=m,g.x=function(e){return arguments.length?(i=e,g):i},g.y=function(e){return arguments.length?(s=e,g):s},g.margin=function(t){return arguments.length?(e=t,g):e},g.width=function(e){return arguments.length?(t=e,g):t},g.height=function(e){return arguments.length?(n=e,g):n},g.xScale=function(e){return arguments.length?(h=e,g):h},g.yScale=function(e){return arguments.length?(p=e,g):p},g.xDomain=function(e){return arguments.length?(l=e,g):l},g.yDomain=function(e){return arguments.length?(c=e,g):c},g.forceX=function(e){return arguments.length?(o=e,g):o},g.forceY=function(e){return arguments.length?(u=e,g):u},g.clipEdge=function(e){return arguments.length?(a=e,g):a},g.color=function(e){return arguments.length?(f=e,g):f},g.id=function(e){return arguments.length?(r=e,g):r},g},e.models.bullet=function(){function l(e){e.each(function(e,a){var l=o-n.left-n.right,c=u-n.top-n.bottom,h=r.call(this,e,a).slice().sort(d3.descending),p=i.call(this,e,a).slice().sort(d3.descending),d=s.call(this,e,a).slice().sort(d3.descending),v=d3.select(this).selectAll("g.wrap.bullet").data([e]),m=v.enter().append("g").attr("class","wrap nvd3 bullet"),g=m.append("g"),y=v.select("g");v.attr("transform","translate("+n.left+","+n.top+")");var b=d3.scale.linear().domain([0,Math.max(h[0],p[0],d[0])]).range(t?[l,0]:[0,l]),w=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(b.range());this.__chart__=b;var E=function(e){return Math.abs(w(e)-w(0))},S=function(e){return Math.abs(b(e)-b(0))},x=y.selectAll("rect.range").data(h);x.enter().append("rect").attr("class",function(e,t){return"range s"+t}).attr("width",E).attr("height",c).attr("x",t?w:0).on("mouseover",function(e,t){f.elementMouseover({value:e,label:t<=0?"Maximum":t>1?"Minimum":"Mean",pos:[b(e),c/2]})}).on("mouseout",function(e,t){f.elementMouseout({value:e,label:t<=0?"Minimum":t>=1?"Maximum":"Mean"})}),d3.transition(x).attr("x",t?b:0).attr("width",S).attr("height",c);var T=y.selectAll("rect.measure").data(d);T.enter().append("rect").attr("class",function(e,t){return"measure s"+t}).attr("width",E).attr("height",c/3).attr("x",t?w:0).attr("y",c/3).on("mouseover",function(e){f.elementMouseover({value:e,label:"Current",pos:[b(e),c/2]})}).on("mouseout",function(e){f.elementMouseout({value:e,label:"Current"})}),d3.transition(T).attr("width",S).attr("height",c/3).attr("x",t?b:0).attr("y",c/3);var N=y.selectAll("path.markerTriangle").data(p),C=c/6;N.enter().append("path").attr("class","markerTriangle").attr("transform",function(e){return"translate("+w(e)+","+c/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(e,t){f.elementMouseover({value:e,label:"Previous",pos:[b(e),c/2]})}).on("mouseout",function(e,t){f.elementMouseout({value:e,label:"Previous"})}),d3.transition(N).attr("transform",function(e){return"translate("+b(e)+","+c/2+")"}),N.exit().remove()}),d3.timer.flush()}var e="left",t=!1,n={top:0,right:0,bottom:0,left:0},r=function(e){return e.ranges},i=function(e){return e.markers},s=function(e){return e.measures},o=380,u=30,a=null,f=d3.dispatch("elementMouseover","elementMouseout");return l.dispatch=f,l.orient=function(n){return arguments.length?(e=n,t=e=="right"||e=="bottom",l):e},l.ranges=function(e){return arguments.length?(r=e,l):r},l.markers=function(e){return arguments.length?(i=e,l):i},l.measures=function(e){return arguments.length?(s=e,l):s},l.width=function(e){return arguments.length?(o=e,l):o},l.height=function(e){return arguments.length?(u=e,l):u},l.margin=function(e){return arguments.length?(n=e,l):n},l.tickFormat=function(e){return arguments.length?(a=e,l):a},l},e.models.bulletChart=function(){function v(t){t.each(function(t,c){var v=d3.select(this),m=(u||parseInt(v.style("width"))||960)-r.left-r.right,g=a-r.top-r.bottom,y=this,b=i.call(this,t,c).slice().sort(d3.descending),w=s.call(this,t,c).slice().sort(d3.descending),E=o.call(this,t,c).slice().sort(d3.descending),S=v.selectAll("g.wrap.bulletChart").data([t]),x=S.enter().append("g").attr("class","wrap nvd3 bulletChart"),T=x.append("g");T.append("g").attr("class","bulletWrap"),T.append("g").attr("class","titles");var N=S.select("g");S.attr("transform","translate("+r.left+","+r.top+")");var C=d3.scale.linear().domain([0,Math.max(b[0],w[0],E[0])]).range(n?[m,0]:[0,m]),k=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(C.range());this.__chart__=C;var L=function(e){return Math.abs(k(e)-k(0))},A=function(e){return Math.abs(C(e)-C(0))},O=N.select(".titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(a-r.top-r.bottom)/2+")");O.append("text").attr("class","title").text(function(e){return e.title}),O.append("text").attr("class","subtitle").attr("dy","1em").text(function(e){return e.subtitle}),p.width(m).height(g);var M=N.select(".bulletWrap");d3.transition(M).call(p);var _=f||C.tickFormat(8),D=N.selectAll("g.tick").data(C.ticks(8),function(e){return this.textContent||_(e)}),P=D.enter().append("g").attr("class","tick").attr("transform",function(e){return"translate("+k(e)+",0)"}).style("opacity",1e-6);P.append("line").attr("y1",g).attr("y2",g*7/6),P.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",g*7/6).text(_),d3.transition(P).attr("transform",function(e){return"translate("+C(e)+",0)"}).style("opacity",1);var H=d3.transition(D).attr("transform",function(e){return"translate("+C(e)+",0)"}).style("opacity",1);H.select("line").attr("y1",g).attr("y2",g*7/6),H.select("text").attr("y",g*7/6),d3.transition(D.exit()).attr("transform",function(e){return"translate("+C(e)+",0)"}).style("opacity",1e-6).remove(),p.dispatch.on("elementMouseover.tooltip",function(e){h.tooltipShow(e)}),l&&h.on("tooltipShow",function(e){d(e,y.parentNode)}),p.dispatch.on("elementMouseout.tooltip",function(e){h.tooltipHide(e)}),l&&h.on("tooltipHide",e.tooltip.cleanup)}),d3.timer.flush()}var t="left",n=!1,r={top:5,right:40,bottom:20,left:120},i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=null,a=55,f=null,l=!0,c=function(e,t,n,r,i){return"

"+r.label+"

"+"

"+r.value+"

"},h=d3.dispatch("tooltipShow","tooltipHide"),p=e.models.bullet(),d=function(t,n){var n=document.getElementById("chart"),i=t.pos[0]+n.offsetLeft+r.left,s=t.pos[1]+n.offsetTop+r.top,o="

"+t.label+"

"+"

"+t.value+"

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

"+e+"

"+"

"+n+" at "+t+"

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

"+t+"

"+"

"+n+"

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

"+e+"

"+"

"+n+" at "+t+"

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

"+e+"

"+"

"+n+" at "+t+"

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

"+e+"

"+"

"+n+" at "+t+"

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

"+e+"

"+"

"+n+" on "+t+"

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

"+t+"

"+"

"+n+"

"},f=e.models.multiBarHorizontal().stacked(!1),l=f.xScale(),c=f.yScale(),h=e.models.axis().scale(l).orient("left").highlightZero(!1).showMaxMin(!1),p=e.models.axis().scale(c).orient("bottom"),d=e.models.legend().height(30),v=e.models.legend().height(30),m=d3.dispatch("tooltipShow","tooltipHide");h.tickFormat(function(e){return e}),p.tickFormat(d3.format(",.1f"));var g=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=h.tickFormat()(f.x()(t.point)),o=p.tickFormat()(f.y()(t.point)),u=a(t.series.key,s,o,t,b);e.tooltip.show([r,i],u,t.value<0?"e":"w")},y=[{key:"Grouped"},{key:"Stacked",disabled:!0}];return b.dispatch=m,b.multibar=f,b.legend=d,b.xAxis=h,b.yAxis=p,d3.rebind(b,f,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat"),b.margin=function(e){return arguments.length?(t=e,b):t},b.width=function(e){return arguments.length?(n=e,b):n},b.height=function(e){return arguments.length?(r=e,b):r},b.color=function(e){return arguments.length?(i=e,d.color(e),b):i},b.showControls=function(e){return arguments.length?(s=e,b):s},b.showLegend=function(e){return arguments.length?(o=e,b):o},b.tooltips=function(e){return arguments.length?(u=e,b):u},b.tooltipContent=function(e){return arguments.length?(a=e,b):a},b},e.models.pie=function(){function p(a){return a.each(function(a){function C(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function k(e){c||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return E(t(e))}}function L(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return E(t(e))}}var p=t-e.left-e.right,d=n-e.top-e.bottom,v=Math.min(p,d)/2,m=d3.select(this).on("click",function(e,t){h.chartClick({data:e,index:t,pos:d3.event,id:o})}),g=m.selectAll(".wrap.pie").data([r(a[0])]),y=g.enter().append("g").attr("class","wrap nvd3 pie chart-"+o),b=y.append("g"),w=g.select("g");b.append("g").attr("class","pie"),g.attr("transform","translate("+e.left+","+e.top+")"),w.select(".pie").attr("transform","translate("+p/2+","+d/2+")");var E=d3.svg.arc().outerRadius(v-v/5);c&&E.innerRadius(v/2);var S=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)}),x=g.select(".pie").selectAll(".slice").data(S);x.exit().remove();var T=x.enter().append("svg:g").attr("class","slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),h.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:o})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),h.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:o})}).on("click",function(e,t){h.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:o}),d3.event.stopPropagation()}).on("dblclick",function(e,t){h.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:o}),d3.event.stopPropagation()});x.attr("fill",function(e,t){return u[t]}).attr("stroke",function(e,t){return u[t]});var N=T.append("svg:path").each(function(e){this._current=e});d3.transition(x.select("path")).attr("d",E).attrTween("d",k),f&&(T.append("text").attr("transform",function(e){return e.outerRadius=v+10,e.innerRadius=v+15,"translate("+E.centroid(e)+")"}).style("text-anchor","middle").style("fill","#000"),d3.transition(x.select("text")).attr("transform",function(e){return e.outerRadius=v+10,e.innerRadius=v+15,"translate("+E.centroid(e)+")"}).text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI);return e.value&&n>l?i(e.data):""}))}),p}var e={top:0,right:0,bottom:0,left:0},t=500,n=500,r=function(e){return e.values},i=function(e){return e.x},s=function(e){return e.y},o=Math.floor(Math.random()*1e4),u=d3.scale.category20().range(),a=d3.format(",.2f"),f=!0,l=.02,c=!1,h=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return p.dispatch=h,p.margin=function(t){return arguments.length?(e=t,p):e},p.width=function(e){return arguments.length?(t=e,p):t},p.height=function(e){return arguments.length?(n=e,p):n},p.values=function(e){return arguments.length?(r=e,p):r},p.x=function(e){return arguments.length?(i=e,p):i},p.y=function(e){return arguments.length?(s=d3.functor(e),p):s},p.showLabels=function(e){return arguments.length?(f=e,p):f},p.donut=function(e){return arguments.length?(c=e,p):c},p.id=function(e){return arguments.length?(o=e,p):o},p.color=function(e){return arguments.length?(u=e,p):u},p.valueFormat=function(e){return arguments.length?(a=e,p):a},p.labelThreshold=function(e){return arguments.length?(l=e,p):l},p},e.models.pieChart=function(){function h(s){return s.each(function(u){var p=d3.select(this),d=this,v=(n||parseInt(p.style("width"))||960)-t.left-t.right,m=(r||parseInt(p.style("height"))||400)-t.top-t.bottom,g=p.selectAll("g.wrap.pieChart").data([u]),y=g.enter().append("g").attr("class","wrap nvd3 pieChart").append("g");y.append("g").attr("class","pieWrap"),y.append("g").attr("class","legendWrap");var b=g.select("g");i&&(f.width(v).key(a.x()),g.select(".legendWrap").datum(a.values()(u[0])).call(f),t.top!=f.height()&&(t.top=f.height(),m=(r||parseInt(p.style("height"))||400)-t.top-t.bottom),g.select(".legendWrap").attr("transform","translate(0,"+ -t.top+")")),a.width(v).height(m),b.attr("transform","translate("+t.left+","+t.top+")");var w=b.select(".pieWrap").datum(u);d3.transition(w).call(a),f.dispatch.on("legendClick",function(e,t,n){e.disabled=!e.disabled,a.values()(u[0]).filter(function(e){return!e.disabled}).length||a.values()(u[0]).map(function(e){return e.disabled=!1,g.selectAll(".series").classed("disabled",!1),e}),s.transition().call(h)}),a.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],l.tooltipShow(e)}),o&&l.on("tooltipShow",function(e){c(e)}),a.dispatch.on("elementMouseout.tooltip",function(e){l.tooltipHide(e)}),o&&l.on("tooltipHide",e.tooltip.cleanup),h.update=function(){s.transition().call(h)},h.container=this}),h}var t={top:30,right:20,bottom:20,left:20},n=null,r=null,i=!0,s=d3.scale.category20().range(),o=!0,u=function(e,t,n,r){return"

"+e+"

"+"

"+t+"

"},a=e.models.pie(),f=e.models.legend().height(30),l=d3.dispatch("tooltipShow","tooltipHide"),c=function(t,n){var r=t.pos[0]+(n&&n.offsetLeft||0),i=t.pos[1]+(n&&n.offsetTop||0),s=a.valueFormat()(a.y()(t.point)),o=u(a.x()(t.point),s,t,h);e.tooltip.show([r,i],o,t.value<0?"n":"s")};return h.dispatch=l,h.pie=a,d3.rebind(h,a,"values","x","y","id","showLabels","donut","labelThreshold"),h.margin=function(e){return arguments.length?(t=e,h):t},h.width=function(e){return arguments.length?(n=e,h):n},h.height=function(e){return arguments.length?(r=e,h):r},h.color=function(e){return arguments.length?(s=e,f.color(e),a.color(e),h):s},h.tooltips=function(e){return arguments.length?(o=e,h):o},h.tooltipContent=function(e){return arguments.length?(u=e,h):u},h},e.models.scatter=function(){function k(L){return L.each(function(k){function j(){if(!v)return!1;H.append("g").attr("class","point-paths");var t=d3.merge(k.map(function(e,t){return e.values.map(function(e,n){return[s(a(e,n))*(Math.random()/1e12+1),o(f(e,n))*(Math.random()/1e12+1),t,n]})}));if(g){P.append("clipPath").attr("id","points-clip-"+i);var n=_.select("#points-clip-"+i).selectAll("circle").data(t);n.enter().append("circle").attr("r",y),n.exit().remove(),n.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),_.select(".point-paths").attr("clip-path","url(#points-clip-"+i+")")}var r=d3.geom.voronoi(t).map(function(e,n){return{data:e,series:t[n][2],point:t[n][3]}}),u=_.select(".point-paths").selectAll("path").data(r);u.enter().append("path").attr("class",function(e,t){return"path-"+t}),u.exit().remove(),u.attr("d",function(e){return"M"+e.data.join(",")+"Z"}).on("click",function(t){var n=k[t.series],r=n.values[t.point];S.elementClick({point:r,series:n,pos:[s(a(r,t.point))+e.left,o(f(r,t.point))+e.top],seriesIndex:t.series,pointIndex:t.point})}).on("mouseover",function(t){var n=k[t.series],r=n.values[t.point];S.elementMouseover({point:r,series:n,pos:[s(a(r,t.point))+e.left,o(f(r,t.point))+e.top],seriesIndex:t.series,pointIndex:t.point})}).on("mouseout",function(e,t){S.elementMouseout({point:k[e.series].values[e.point],series:k[e.series],seriesIndex:e.series,pointIndex:e.point})}),S.on("elementMouseover.point",function(e){d3.select(".chart-"+i+" .series-"+e.seriesIndex+" .point-"+e.pointIndex).classed("hover",!0)}),S.on("elementMouseout.point",function(e){d3.select(".chart-"+i+" .series-"+e.seriesIndex+" .point-"+e.pointIndex).classed("hover",!1)})}var L=t-e.left-e.right,A=n-e.top-e.bottom,O=d3.select(this);x=x||s,T=T||o,N=N||u,k=k.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var M=b&&w&&E?[]:k.map(function(e){return e.values.map(function(e,t){return{x:a(e,t),y:f(e,t),size:l(e,t)}})});s.domain(b||d3.extent(d3.merge(M).map(function(e){return e.x}).concat(h))).range([0,L]),o.domain(w||d3.extent(d3.merge(M).map(function(e){return e.y}).concat(p))).range([A,0]),u.domain(E||d3.extent(d3.merge(M).map(function(e){return e.size}).concat(d))).range([16,256]);var _=O.selectAll("g.wrap.scatter").data([k]),D=_.enter().append("g").attr("class","wrap nvd3 scatter chart-"+i),P=D.append("defs"),H=D.append("g"),B=_.select("g");H.append("g").attr("class","groups"),_.attr("transform","translate("+e.left+","+e.top+")"),P.append("clipPath").attr("id","edge-clip-"+i).append("rect"),_.select("#edge-clip-"+i+" rect").attr("width",L).attr("height",A),B.attr("clip-path",m?"url(#edge-clip-"+i+")":"");var F=_.select(".groups").selectAll(".group").data(function(e){return e},function(e){return e.key});F.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(F.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),F.attr("class",function(e,t){return"group series-"+t}).classed("hover",function(e){return e.hover}),d3.transition(F).style("fill",function(e,t){return r[t%r.length]}).style("stroke",function(e,t){return r[t%r.length]}).style("stroke-opacity",1).style("fill-opacity",.5);var I=F.selectAll("path.point").data(function(e){return e.values});I.enter().append("path").attr("transform",function(e,t){return"translate("+x(a(e,t))+","+T(f(e,t))+")"}).attr("d",d3.svg.symbol().type(c).size(function(e,t){return u(l(e,t))})),d3.transition(F.exit().selectAll("path.point")).attr("transform",function(e,t){return"translate("+s(a(e,t))+","+o(f(e,t))+")"}).remove(),I.attr("class",function(e,t){return"point point-"+t}),d3.transition(I).attr("transform",function(e,t){return"translate("+s(a(e,t))+","+o(f(e,t))+")"}).attr("d",d3.svg.symbol().type(c).size(function(e,t){return u(l(e,t))})),clearTimeout(C),C=setTimeout(j,1e3),x=s.copy(),T=o.copy(),N=u.copy()}),k}var e={top:0,right:0,bottom:0,left:0},t=960,n=500,r=d3.scale.category20().range(),i=Math.floor(Math.random()*1e5),s=d3.scale.linear(),o=d3.scale.linear(),u=d3.scale.linear(),a=function(e){return e.x},f=function(e){return e.y},l=function(e){return e.size},c=function(e){return e.shape||"circle"},h=[],p=[],d=[],v=!0,m=!1,g=!0,y=function(){return 25},b,w,E,S=d3.dispatch("elementClick","elementMouseover","elementMouseout"),x,T,N,C;return k.dispatch=S,k.x=function(e){return arguments.length?(a=d3.functor(e),k):a},k.y=function(e){return arguments.length?(f=d3.functor(e),k):f},k.size=function(e){return arguments.length?(l=d3.functor(e),k):l},k.margin=function(t){return arguments.length?(e=t,k):e},k.width=function(e){return arguments.length?(t=e,k):t},k.height=function(e){return arguments.length?(n=e,k):n},k.xScale=function(e){return arguments.length?(s=e,k):s},k.yScale=function(e){return arguments.length?(o=e,k):o},k.zScale=function(e){return arguments.length?(u=e,k):u},k.xDomain=function(e){return arguments.length?(b=e,k):b},k.yDomain=function(e){return arguments.length?(w=e,k):w},k.sizeDomain=function(e){return arguments.length?(E=e,k):E},k.forceX=function(e){return arguments.length?(h=e,k):h},k.forceY=function(e){return arguments.length?(p=e,k):p},k.forceSize=function(e){return arguments.length?(d=e,k):d},k.interactive=function(e){return arguments.length?(v=e,k):v},k.clipEdge=function(e){return arguments.length?(m=e,k):m},k.clipVoronoi=function(e){return arguments.length?(g=e,k):g},k.clipRadius=function(e){return arguments.length?(y=e,k):y},k.color=function(e){return arguments.length?(r=e,k):r},k.shape=function(e){return arguments.length?(c=e,k):c},k.id=function(e){return arguments.length?(i=e,k):i},k},e.models.scatterChart=function(){function A(s){return s.each(function(o){function H(){if(l)return D.select(".point-paths").style("pointer-events","all"),!1;D.select(".background").style("pointer-events","all"),D.select(".point-paths").style("pointer-events","none");var e=d3.mouse(this);v.distortion(f).focus(e[0]),m.distortion(f).focus(e[1]),P.call(g),D.select(".x.axis").call(y),D.select(".y.axis").call(b),D.select(".distributionX").datum(o.filter(function(e){return!e.disabled})).call(S),D.select(".distributionY").datum(o.filter(function(e){return!e.disabled})).call(x)}var h=d3.select(this),p=this,d=(n||parseInt(h.style("width"))||960)-t.left-t.right,O=(r||parseInt(h.style("height"))||400)-t.top-t.bottom;N=N||g.xScale(),C=C||g.yScale();var M=h.selectAll("g.wrap.scatterChart").data([o]),_=M.enter().append("g").attr("class","wrap nvd3 scatterChart chart-"+g.id()).append("g");_.append("rect").attr("class","nvd3 background").attr("width",d).attr("height",O),_.append("g").attr("class","x axis"),_.append("g").attr("class","y axis"),_.append("g").attr("class","scatterWrap"),_.append("g").attr("class","distWrap"),_.append("g").attr("class","legendWrap"),_.append("g").attr("class","controlsWrap");var D=M.select("g");u&&(w.width(d/2),M.select(".legendWrap").datum(o).call(w),t.top!=w.height()&&(t.top=w.height(),O=(r||parseInt(h.style("height"))||400)-t.top-t.bottom),M.select(".legendWrap").attr("transform","translate("+d/2+","+ -t.top+")")),a&&(E.width(180).color(["#444"]),D.select(".controlsWrap").datum(L).attr("transform","translate(0,"+ -t.top+")").call(E)),g.width(d).height(O).color(o.map(function(e,t){return e.color||i[t%i.length]}).filter(function(e,t){return!o[t].disabled})),D.attr("transform","translate("+t.left+","+t.top+")");var P=M.select(".scatterWrap").datum(o.filter(function(e){return!e.disabled}));d3.transition(P).call(g),y.ticks(d/100).tickSize(-O,0),D.select(".x.axis").attr("transform","translate(0,"+m.range()[0]+")"),d3.transition(D.select(".x.axis")).call(y),b.ticks(O/36).tickSize(-d,0),d3.transition(D.select(".y.axis")).call(b),S.width(d).color(o.map(function(e,t){return e.color||i[t%i.length]}).filter(function(e,t){return!o[t].disabled})),_.select(".distWrap").append("g").attr("class","distributionX").attr("transform","translate(0,"+m.range()[0]+")"),D.select(".distributionX").datum(o.filter(function(e){return!e.disabled})).call(S),x.width(O).color(o.map(function(e,t){return e.color||i[t%i.length]}).filter(function(e,t){return!o[t].disabled})),_.select(".distWrap").append("g").attr("class","distributionY").attr("transform","translate(-"+x.size()+",0)"),D.select(".distributionY").datum(o.filter(function(e){return!e.disabled})).call(x),D.select(".background").on("mousemove",H),D.select(".background").on("click",function(){l=!l}),E.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,f=e.disabled?0:2.5,D.select(".background").style("pointer-events",e.disabled?"none":"all"),D.select(".point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(v.distortion(f).focus(0),m.distortion(f).focus(0),P.call(g),D.select(".x.axis").call(y),D.select(".y.axis").call(b)):l=!1,s.transition().call(A)}),w.dispatch.on("legendClick",function(e,t,n){e.disabled=!e.disabled,o.filter(function(e){return!e.disabled}).length||o.map(function(e){return e.disabled=!1,M.selectAll(".series").classed("disabled",!1),e}),s.transition().call(A)}),g.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".chart-"+g.id()+" .series-"+e.seriesIndex+" .distx-"+e.pointIndex).attr("y1",e.pos[1]-O),d3.select(".chart-"+g.id()+" .series-"+e.seriesIndex+" .disty-"+e.pointIndex).attr("x2",e.pos[0]+S.size()),e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),c&&T.on("tooltipShow",function(e){k(e,p.parentNode)}),g.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e),d3.select(".chart-"+g.id()+" .series-"+e.seriesIndex+" .distx-"+e.pointIndex).attr("y1",0),d3.select(".chart-"+g.id()+" .series-"+e.seriesIndex+" .disty-"+e.pointIndex).attr("x2",x.size())}),c&&T.on("tooltipHide",e.tooltip.cleanup),N=v.copy(),C=m.copy(),A.update=function(){s.transition().call(A)},A.container=this}),A}var t={top:30,right:20,bottom:50,left:60},n=null,r=null,i=d3.scale.category20().range(),s=!1,o=!1,u=!0,a=!0,f=0,l=!1,c=!0,h=function(e,t,n){return""+t+""},p=function(e,t,n){return""+n+""},d=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},v=d3.fisheye.scale(d3.scale.linear).distortion(0),m=d3.fisheye.scale(d3.scale.linear).distortion(0),g=e.models.scatter().xScale(v).yScale(m),y=e.models.axis().orient("bottom").scale(v).tickPadding(10),b=e.models.axis().orient("left").scale(m).tickPadding(10),w=e.models.legend().height(30),E=e.models.legend().height(30),S=e.models.distribution().axis("x").scale(v),x=e.models.distribution().axis("y").scale(m),T=d3.dispatch("tooltipShow","tooltipHide"),N,C,k=function(n,r){var i=n.pos[0]+(r.offsetLeft||0),s=m.range()[0]+t.top+(r.offsetTop||0),o=v.range()[0]+t.left+(r.offsetLeft||0),u=n.pos[1]+(r.offsetTop||0),a=y.tickFormat()(g.x()(n.point)),f=b.tickFormat()(g.y()(n.point)),l=h(n.series.key,a,f,n,A),c=p(n.series.key,a,f,n,A);e.tooltip.show([i,s],l,"n",1),e.tooltip.show([o,u],c,"e",1)},L=[{key:"Magnify",disabled:!0}];return A.dispatch=T,A.legend=w,A.xAxis=y,A.yAxis=b,d3.rebind(A,g,"interactive","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius","fisheye","fisheyeRadius"),A.margin=function(e){return arguments.length?(t=e,A):t},A.width=function(e){return arguments.length?(n=e,A):n},A.height=function(e){return arguments.length?(r=e,A):r},A.color=function(e){return arguments.length?(i=e,w.color(e),S.color(e),x.color(e),A):i},A.showDistX=function(e){return arguments.length?(s=e,A):s},A.showDistY=function(e){return arguments.length?(o=e,A):o},A.showControls=function(e){return arguments.length?(a=e,A):a},A.showLegend=function(e){return arguments.length?(u=e,A):u},A.fisheye=function(e){return arguments.length?(f=e,A):f},A.tooltips=function(e){return arguments.length?(c=e,A):c},A.tooltipContent=function(e){return arguments.length?(d=e,A):d},A},e.models.sparkline=function(){function c(r){return r.each(function(r){var c=t-e.left-e.right,h=n-e.top-e.bottom;f.domain(u||d3.extent(r,i)).range([0,c]),l.domain(a||d3.extent(r,s)).range([h,0]);var p=d3.select(this).selectAll("g.sparkline").data([r]),d=p.enter().append("g").attr("class","nvd3 sparkline");d.attr("transform","translate("+e.left+","+e.top+")").style("stroke",function(e,t){return e.color||o[t*o.length]});var v=d.selectAll("path").data(function(e){return[e]});v.enter().append("path"),v.exit().remove(),v.attr("d",d3.svg.line().x(function(e,t){return f(i(e,t))}).y(function(e,t){return l(s(e,t))}));var m=d.selectAll("circle.point").data(function(e){return e.filter(function(e,t){return l.domain().indexOf(s(e,t))!=-1||i(e,t)==f.domain()[1]})});m.enter().append("circle").attr("class","point"),m.exit().remove(),m.attr("cx",function(e,t){return f(i(e,t))}).attr("cy",function(e,t){return l(s(e,t))}).attr("r",2).style("stroke",function(e,t){return e.x==f.domain()[1]?"#444":e.y==l.domain()[0]?"#d62728":"#2ca02c"}).style("fill",function(e,t){return e.x==f.domain()[1]?"#444":e.y==l.domain()[0]?"#d62728":"#2ca02c"})}),c}var e={top:0,right:0,bottom:0,left:0},t=400,n=32,r=!0,i=function(e){return e.x},s=function(e){return e.y},o=d3.scale.category20().range(),u,a,f=d3.scale.linear(),l=d3.scale.linear();return c.margin=function(t){return arguments.length?(e=t,c):e},c.width=function(e){return arguments.length?(t=e,c):t},c.height=function(e){return arguments.length?(n=e,c):n},c.x=function(e){return arguments.length?(i=d3.functor(e),c):i},c.y=function(e){return arguments.length?(s=d3.functor(e),c):s},c.xDomain=function(e){return arguments.length?(u=e,c):u},c.yDomain=function(e){return arguments.length?(a=e,c):a},c.animate=function(e){return arguments.length?(r=e,c):r},c},e.models.sparklinePlus=function(){function d(e){return e.each(function(e){function T(){var n=d3.event.offsetX-t.left;w.attr("x1",n).attr("x2",n),E.attr("transform",function(e){return"translate("+(n-6)+","+ -t.top+")"}).text(f(Math.round(c.invert(n)))),S.attr("transform",function(e){return"translate("+(n+6)+","+ -t.top+")"}).text(l(o(e[Math.round(c.invert(n))])))}var i=n-t.left-t.right,a=r-t.top-t.bottom;c.domain(d3.extent(e,s)).range([0,i]),h.domain(d3.extent(e,o)).range([a,0]);var d=d3.select(this).selectAll("g.sparklineplus").data([e]),v=d.enter().append("g"),m=v.append("g").attr("class","nvd3 sparklineplus").attr("transform","translate("+t.left+","+t.top+")").style("stroke",function(e,t){return e.color||u[t%u.length]});p.xDomain(c.domain()).yDomain(h.domain()),m.call(p);var g=m.append("g").attr("class","hoverValue"),b=m.append("g").attr("class","hoverArea");g.attr("transform",function(e){return"translate("+c(e)+",0)"});var w=g.append("line").attr("x1",c.range()[1]).attr("y1",-t.top).attr("x2",c.range()[1]).attr("y2",r),E=g.append("text").attr("class","xValue").attr("text-anchor","end").attr("dy",".9em"),S=g.append("text").attr("class","yValue").attr("text-anchor","start").attr("dy",".9em");b.append("rect").attr("width",i).attr("height",a).on("mousemove",T)}),d}var t={top:15,right:40,bottom:3,left:40},n=400,r=50,i=!0,s=function(e){return e.x},o=function(e){return e.y},u=d3.scale.category20().range(),a=Math.floor(Math.random()*1e5),f=d3.format(",r"),l=d3.format(",.2f"),c=d3.scale.linear(),h=d3.scale.linear(),p=e.models.sparkline();return d.margin=function(e){return arguments.length?(t=e,d):t},d.width=function(e){return arguments.length?(n=e,p.width(e-t.left-t.right),d):n},d.height=function(e){return arguments.length?(r=e,p.height(e-t.top-t.bottom),d):r},d.x=function(e){return arguments.length?(s=d3.functor(e),p.x(e),d):s},d.y=function(e){return arguments.length?(o=d3.functor(e),p.y(e),d):o},d.id=function(e){return arguments.length?(a=e,d):a},d.animate=function(e){return arguments.length?(i=e,d):i},d},e.models.stackedArea=function(){function g(e){return e.each(function(e){var a=n-t.left-t.right,h=r-t.top-t.bottom;e=e.map(function(e,t){return e.values=e.values.map(function(t,n){return t.index=n,t.stackedY=e.disabled?0:u(t,n),t}),e}),e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(function(e){return e.stackedY}).out(function(e,t,n){e.display={y:n,y0:t}})(e);var g=d3.select(this).selectAll("g.wrap.stackedarea").data([e]),b=g.enter().append("g").attr("class","wrap nvd3 stackedarea"),w=b.append("defs"),E=b.append("g"),S=g.select("g");E.append("g").attr("class","areaWrap"),p.width(a).height(h).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i[t%i.length]}).filter(function(t,n){return!e[n].disabled})),E.append("g").attr("class","scatterWrap");var T=S.select(".scatterWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(T).call(p),g.attr("transform","translate("+t.left+","+t.top+")"),w.append("clipPath").attr("id","edge-clip-"+s).append("rect"),g.select("#edge-clip-"+s+" rect").attr("width",a).attr("height",h),S.attr("clip-path",c?"url(#edge-clip-"+s+")":"");var N=d3.svg.area().x(function(e,t){return d(o(e,t))}).y0(function(e){return v(e.display.y0)}).y1(function(e){return v(e.display.y+e.display.y0)}),C=d3.svg.area().x(function(e,t){return d(o(e,t))}).y0(function(e){return v(e.display.y0)}).y1(function(e){return v(e.display.y0)}),k=S.select(".areaWrap").selectAll("path.area").data(function(e){return e});k.enter().append("path").attr("class",function(e,t){return"area area-"+t}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}).on("click",function(e,t){d3.select(this).classed("hover",!1),m.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t})}),d3.transition(k.exit()).attr("d",function(e,t){return C(e.values,t)}).remove(),k.style("fill",function(e,t){return e.color||i[t%i.length]}).style("stroke",function(e,t){return e.color||i[t%i.length]}),d3.transition(k).attr("d",function(e,t){return N(e.values,t)}),p.dispatch.on("elementClick.area",function(e){m.areaClick(e)}),p.dispatch.on("elementMouseover.area",function(e){S.select(".area-"+e.seriesIndex).classed("hover",!0)}),p.dispatch.on("elementMouseout.area",function(e){S.select(".area-"+e.seriesIndex).classed("hover",!1)})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.category20().range(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c=!1,h=d3.layout.stack().values(function(e){return e.values}).x(o).y(function(e){return e.stackedY}).out(function(e,t,n){e.display={y:n,y0:t}}),p=e.models.scatter().size(2.2).sizeDomain([2.5]),d=p.xScale(),v=p.yScale(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return g.dispatch=m,g.scatter=p,d3.rebind(g,p,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),g.x=function(e){return arguments.length?(o=d3.functor(e),g):o},g.y=function(e){return arguments.length?(u=d3.functor(e),g):u},g.margin=function(e){return arguments.length?(t=e,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.clipEdge=function(e){return arguments.length?(c=e,g):c},g.color=function(e){return arguments.length?(i=e,g):i},g.offset=function(e){return arguments.length?(f=e,g):f},g.order=function(e){return arguments.length?(l=e,g):l},g.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":g.offset("zero"),g.order("default");break;case"stream":g.offset("wiggle"),g.order("inside-out");break;case"expand":g.offset("expand"),g.order("default")}return g},p.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),p.dispatch.on("elementMouseout.tooltip",function(e){m.tooltipHide(e)}),g},e.models.stackedAreaChart=function(){function b(i){return i.each(function(a){var l=d3.select(this),c=this,w=(n||parseInt(l.style("width"))||960)-t.left-t.right,E=(r||parseInt(l.style("height"))||400)-t.top-t.bottom,S=l.selectAll("g.wrap.stackedAreaChart").data([a]),x=S.enter().append("g").attr("class","wrap nvd3 stackedAreaChart").append("g");x.append("g").attr("class","x axis"),x.append("g").attr("class","y axis"),x.append("g").attr("class","stackedWrap"),x.append("g").attr("class","legendWrap"),x.append("g").attr("class","controlsWrap");var T=S.select("g");o&&(d.width(w/2),T.select(".legendWrap").datum(a).call(d),t.top!=d.height()&&(t.top=d.height(),E=(r||parseInt(l.style("height"))||400)-t.top-t.bottom),T.select(".legendWrap").attr("transform","translate("+(w/2-t.left)+","+ -t.top+")")),f.width(w).height(E),s&&(v.width(280).color(["#444","#444","#444"]),T.select(".controlsWrap").datum(g).attr("transform","translate(0,"+ -t.top+")").call(v)),T.attr("transform","translate("+t.left+","+t.top+")");var N=T.select(".stackedWrap").datum(a);d3.transition(N).call(f),h.ticks(w/100).tickSize(-E,0),T.select(".x.axis").attr("transform","translate(0,"+E+")"),d3.transition(T.select(".x.axis")).call(h),p.ticks(f.offset()=="wiggle"?0:E/36).tickSize(-w,0).tickFormat(f.offset()=="expand"?d3.format("%"):d3.format(",.2f")),d3.transition(T.select(".y.axis")).call(p),f.dispatch.on("areaClick.toggle",function(e){a.filter(function(e){return!e.disabled}).length===1?a=a.map(function(e){return e.disabled=!1,e}):a=a.map(function(t,n){return t.disabled=n!=e.seriesIndex,t}),i.transition().call(b)}),d.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,a.filter(function(e){return!e.disabled}).length||a.map(function(e){return e.disabled=!1,e}),i.transition().call(b)}),v.dispatch.on("legendClick",function(e,t){if(!e.disabled)return;g=g.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Stacked":f.style("stack");break;case"Stream":f.style("stream");break;case"Expanded":f.style("expand")}i.transition().call(b)}),f.dispatch.on("tooltipShow",function(e){if(!Math.round(f.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),u&&m.on("tooltipShow",function(e){y(e,c.parentNode)}),f.dispatch.on("tooltipHide",function(e){m.tooltipHide(e)}),u&&m.on("tooltipHide",e.tooltip.cleanup),b.update=function(){i.transition().call(b)},b.container=this}),b}var t={top:30,right:25,bottom:50,left:60},n=null,r=null,i=d3.scale.category20().range(),s=!0,o=!0,u=!0,a=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" on "+t+"

"},f=e.models.stackedArea(),l=f.xScale(),c=f.yScale(),h=e.models.axis().scale(l).orient("bottom").tickPadding(5),p=e.models.axis().scale(c).orient("left"),d=e.models.legend().height(30),v=e.models.legend().height(30),m=d3.dispatch("tooltipShow","tooltipHide"),g=[{key:"Stacked"},{key:"Stream",disabled:!0},{key:"Expanded",disabled:!0}],y=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=h.tickFormat()(f.x()(t.point)),o=p.tickFormat()(f.y()(t.point)),u=a(t.series.key,s,o,t,b);e.tooltip.show([r,i],u,t.value<0?"n":"s")};return b.dispatch=m,b.stacked=f,b.xAxis=h,b.yAxis=p,d3.rebind(b,f,"x","y","interactive","offset","order","style","clipEdge","size","forceX","forceY","forceSize"),b.margin=function(e){return arguments.length?(t=e,b):t},b.width=function(e){return arguments.length?(n=e,b):getWidth},b.height=function(e){return arguments.length?(r=e,b):getHeight},b.color=function(e){return arguments.length?(i=e,d.color(e),b):i},b.showControls=function(e){return arguments.length?(s=e,b):s},b.showLegend=function(e){return arguments.length?(o=e,b):o},b.tooltips= +function(e){return arguments.length?(u=e,b):u},b.tooltipContent=function(e){return arguments.length?(a=e,b):a},b}})(); \ No newline at end of file diff --git a/src/models/multiBarChart.js b/src/models/multiBarChart.js index 6b2bdf4..70b3e90 100644 --- a/src/models/multiBarChart.js +++ b/src/models/multiBarChart.js @@ -15,7 +15,7 @@ nv.models.multiBarChart = function() { var multibar = nv.models.multiBar().stacked(false), x = multibar.xScale(), y = multibar.yScale(), - xAxis = nv.models.axis().scale(x).orient('bottom').highlightZero(false); //.showMaxMin(false), //TODO: see why showMaxMin(false) causes no ticks to be shown on x axis + xAxis = nv.models.axis().scale(x).orient('bottom').highlightZero(false), //.showMaxMin(false), //TODO: see why showMaxMin(false) causes no ticks to be shown on x axis yAxis = nv.models.axis().scale(y).orient('left'), legend = nv.models.legend().height(30), controls = nv.models.legend().height(30),