width=x;returnchart};chart.height=function(x){if(!arguments.length)returnheight;height=x;returnchart};chart.margin=function(_){if(!arguments.length)returnmargin;margin.top=typeof_.top!="undefined"?_.top:margin.top;margin.right=typeof_.right!="undefined"?_.right:margin.right;margin.bottom=typeof_.bottom!="undefined"?_.bottom:margin.bottom;margin.left=typeof_.left!="undefined"?_.left:margin.left;returnchart};chart.tickFormat=function(x){if(!arguments.length)returntickFormat;tickFormat=x;returnchart};chart.tooltips=function(_){if(!arguments.length)returntooltips;tooltips=_;returnchart};chart.tooltipContent=function(_){if(!arguments.length)returntooltip;tooltip=_;returnchart};chart.noData=function(_){if(!arguments.length)returnnoData;noData=_;returnchart};returnchart};nv.models.cumulativeLineChart=function(){varlines=nv.models.line(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend(),interactiveLayer=nv.interactiveGuideline();varmargin={top:30,right:30,bottom:50,left:60},color=nv.utils.defaultColor(),width=null,height=null,showLegend=true,showXAxis=true,showYAxis=true,rightAlignYAxis=false,tooltips=true,showControls=true,useInteractiveGuideline=false,rescaleY=true,tooltip=function(key,x,y,e,graph){return"<h3>"+key+"</h3>"+"<p>"+y+" at "+x+"</p>"},x,y,id=lines.id(),state={index:0,rescaleY:rescaleY},defaultState=null,noData="No Data Available.",average=function(d){returnd.average},dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");vardx=d3.scale.linear(),index={i:0,x:0};varshowTooltip=function(e,offsetElement){varleft=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(lines.x()(e.point,e.pointIndex)),y=yAxis.tickFormat()(lines.y()(e.point,e.pointIndex)),content=tooltip(e.series.key,x,y,e,chart);nv.tooltip.show([left,top],content,null,null,offsetElement)};functionchart(selection){selection.each(function(data){varcontainer=d3.select(this).classed("nv-chart-"+id,true),that=this;varavailableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right,availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;chart.update=function(){container.transition().call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){varkey;defaultState={};for(keyinstate){if(state[key]instanceofArray)defaultState[key]=state[key].slice(0);elsedefaultState[key]=state[key]}}varindexDrag=d3.behavior.drag().on("dragstart",dragStart).on("drag",dragMove).on("dragend",dragEnd);functiondragStart(d,i){d3.select(chart.container).style("cursor","ew-resize")}functiondragMove(d,i){index.x=d3.event.x;index.i=Math.round(dx.invert(index.x));updateZero()}functiondragEnd(d,i){d3.select(chart.container).style("cursor","auto");state.index=index.i;dispatch.stateChange(state)}if(!data||!data.length||!data.filter(function(d){returnd.values.length}).length){varnoDataText=container.selectAll(".nv-noData").data([noData]);noDataText.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");noDataText.attr("x",margin.left+availableWidth/2).attr("y",margin.top+availableHeight/2).text(function(d){returnd});returnchart}else{container.selectAll(".nv-noData").remove()}x=lines.xScale();y=lines.yScale();if(!rescaleY){varseriesDomains=data.filter(function(series){return!series.disabled}).map(function(series,i){varinitialDomain=d3.extent(series.values,lines.y());if(initialDomain[0]<-.95)initialDomain[0]=-.95;return[(initialDomain[0]-initialDomain[1])/(1+initialDomain[1]),(initialDomain[1]-initialDomain[0])/(1+initialDomain[0])]});varcompleteDomain=[d3.min(seriesDomains,function(d){returnd[0]}),d3.max(seriesDomains,function(d){returnd[1]})];lines.yDomain(completeDomain)}else{lines.yDomain(null)}dx.domain([0,data[0].values.length-1]).range([0,availableWidth]).clamp(true);vardata=indexify(index.i
returnchart};chart.padData=function(_){if(!arguments.length)returnpadData;padData=_;returnchart};chart.clipEdge=function(_){if(!arguments.length)returnclipEdge;clipEdge=_;returnchart};chart.color=function(_){if(!arguments.length)returncolor;color=nv.utils.getColor(_);returnchart};chart.id=function(_){if(!arguments.length)returnid;id=_;returnchart};chart.interactive=function(_){if(!arguments.length)returninteractive;interactive=false;returnchart};returnchart};nv.models.historicalBarChart=function(){varbars=nv.models.historicalBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend();varmargin={top:30,right:90,bottom:50,left:90},color=nv.utils.defaultColor(),width=null,height=null,showLegend=false,showXAxis=true,showYAxis=true,rightAlignYAxis=false,tooltips=true,tooltip=function(key,x,y,e,graph){return"<h3>"+key+"</h3>"+"<p>"+y+" at "+x+"</p>"},x,y,state={},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");varshowTooltip=function(e,offsetElement){if(offsetElement){varsvg=d3.select(offsetElement).select("svg");varviewBox=svg.node()?svg.attr("viewBox"):null;if(viewBox){viewBox=viewBox.split(" ");varratio=parseInt(svg.style("width"))/viewBox[2];e.pos[0]=e.pos[0]*ratio;e.pos[1]=e.pos[1]*ratio}}varleft=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(bars.x()(e.point,e.pointIndex)),y=yAxis.tickFormat()(bars.y()(e.point,e.pointIndex)),content=tooltip(e.series.key,x,y,e,chart);nv.tooltip.show([left,top],content,null,null,offsetElement)};functionchart(selection){selection.each(function(data){varcontainer=d3.select(this),that=this;varavailableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right,availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;chart.update=function(){chart(selection)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){varkey;defaultState={};for(keyinstate){if(state[key]instanceofArray)defaultState[key]=state[key].slice(0);elsedefaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){returnd.values.length}).length){varnoDataText=container.selectAll(".nv-noData").data([noData]);noDataText.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");noDataText.attr("x",margin.left+availableWidth/2).attr("y",margin.top+availableHeight/2).text(function(d){returnd});returnchart}else{container.selectAll(".nv-noData").remove()}x=bars.xScale();y=bars.yScale();varwrap=container.selectAll("g.nv-wrap.nv-historicalBarChart").data([data]);vargEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");varg=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");if(showLegend){legend.width(availableWidth);g.select(".nv-legendWrap").datum(data).call(legend);if(margin.top!=legend.height()){margin.top=legend.height();availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom}wrap.select(".nv-legendWrap").attr("transform","translate(0,"+-margin.top+")")}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}bars.width(availableWidth).height(availableHeight).color(data.map(function(d,i){returnd.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));varbarsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));d3.transition(barsWrap).call(bars);if(showXAxis){xAxis.scale(x).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");g.select(".nv-x.nv-axis").transition().call(xAxis)}if(showYAxis
}).attr("x",function(d,i){returnd.series*x.rangeBand()/data.length}).attr("width",x.rangeBand()/data.length).each("end",function(){d3.select(this).transition().duration(drawTime).attr("y",function(d,i){returngetY(d,i)<0?y(0):y(0)-y(getY(d,i))<1?y(0)-1:y(getY(d,i))||0}).attr("height",function(d,i){returnMath.max(Math.abs(y(getY(d,i))-y(0)),1)||0})});x0=x.copy();y0=y.copy()});returnchart}chart.dispatch=dispatch;chart.x=function(_){if(!arguments.length)returngetX;getX=_;returnchart};chart.y=function(_){if(!arguments.length)returngetY;getY=_;returnchart};chart.margin=function(_){if(!arguments.length)returnmargin;margin.top=typeof_.top!="undefined"?_.top:margin.top;margin.right=typeof_.right!="undefined"?_.right:margin.right;margin.bottom=typeof_.bottom!="undefined"?_.bottom:margin.bottom;margin.left=typeof_.left!="undefined"?_.left:margin.left;returnchart};chart.width=function(_){if(!arguments.length)returnwidth;width=_;returnchart};chart.height=function(_){if(!arguments.length)returnheight;height=_;returnchart};chart.xScale=function(_){if(!arguments.length)returnx;x=_;returnchart};chart.yScale=function(_){if(!arguments.length)returny;y=_;returnchart};chart.xDomain=function(_){if(!arguments.length)returnxDomain;xDomain=_;returnchart};chart.yDomain=function(_){if(!arguments.length)returnyDomain;yDomain=_;returnchart};chart.forceY=function(_){if(!arguments.length)returnforceY;forceY=_;returnchart};chart.stacked=function(_){if(!arguments.length)returnstacked;stacked=_;returnchart};chart.clipEdge=function(_){if(!arguments.length)returnclipEdge;clipEdge=_;returnchart};chart.color=function(_){if(!arguments.length)returncolor;color=nv.utils.getColor(_);returnchart};chart.barColor=function(_){if(!arguments.length)returnbarColor;barColor=nv.utils.getColor(_);returnchart};chart.disabled=function(_){if(!arguments.length)returndisabled;disabled=_;returnchart};chart.id=function(_){if(!arguments.length)returnid;id=_;returnchart};chart.hideable=function(_){if(!arguments.length)returnhideable;hideable=_;returnchart};chart.delay=function(_){if(!arguments.length)returndelay;delay=_;returnchart};chart.drawTime=function(_){if(!arguments.length)returndrawTime;drawTime=_;returnchart};returnchart};nv.models.multiBarChart=function(){varmultibar=nv.models.multiBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend();varmargin={top:30,right:20,bottom:50,left:60},width=null,height=null,color=nv.utils.defaultColor(),showControls=true,showLegend=true,showXAxis=true,showYAxis=true,rightAlignYAxis=false,reduceXTicks=true,staggerLabels=false,rotateLabels=0,tooltips=true,tooltip=function(key,x,y,e,graph){return"<h3>"+key+"</h3>"+"<p>"+y+" on "+x+"</p>"},x,y,state={stacked:false},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),controlWidth=function(){returnshowControls?180:0};multibar.stacked(false);xAxis.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(d){returnd});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));varshowTooltip=function(e,offsetElement){varleft=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(multibar.x()(e.point,e.pointIndex)),y=yAxis.tickFormat()(multibar.y()(e.point,e.pointIndex)),content=tooltip(e.series.key,x,y,e,chart);nv.tooltip.show([left,top],content,e.value<0?"n":"s",null,offsetElement)};functionchart(selection){selection.each(function(data){varcontainer=d3.select(this),that=this;varavailableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right,availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;chart.update=function(){container.transition().call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){varkey;defaultState={};for(keyinstate){if(state[key]instanceofArray)defaultState[key]=state[key].slice(0);elsedefaultS
margin.right=typeof_.right!="undefined"?_.right:margin.right;margin.bottom=typeof_.bottom!="undefined"?_.bottom:margin.bottom;margin.left=typeof_.left!="undefined"?_.left:margin.left;returnchart};chart.width=function(_){if(!arguments.length)returnwidth;width=_;returnchart};chart.height=function(_){if(!arguments.length)returnheight;height=_;returnchart};chart.xScale=function(_){if(!arguments.length)returnx;x=_;returnchart};chart.yScale=function(_){if(!arguments.length)returny;y=_;returnchart};chart.zScale=function(_){if(!arguments.length)returnz;z=_;returnchart};chart.xDomain=function(_){if(!arguments.length)returnxDomain;xDomain=_;returnchart};chart.yDomain=function(_){if(!arguments.length)returnyDomain;yDomain=_;returnchart};chart.sizeDomain=function(_){if(!arguments.length)returnsizeDomain;sizeDomain=_;returnchart};chart.sizeRange=function(_){if(!arguments.length)returnsizeRange;sizeRange=_;returnchart};chart.forceX=function(_){if(!arguments.length)returnforceX;forceX=_;returnchart};chart.forceY=function(_){if(!arguments.length)returnforceY;forceY=_;returnchart};chart.forceSize=function(_){if(!arguments.length)returnforceSize;forceSize=_;returnchart};chart.interactive=function(_){if(!arguments.length)returninteractive;interactive=_;returnchart};chart.pointKey=function(_){if(!arguments.length)returnpointKey;pointKey=_;returnchart};chart.pointActive=function(_){if(!arguments.length)returnpointActive;pointActive=_;returnchart};chart.padData=function(_){if(!arguments.length)returnpadData;padData=_;returnchart};chart.padDataOuter=function(_){if(!arguments.length)returnpadDataOuter;padDataOuter=_;returnchart};chart.clipEdge=function(_){if(!arguments.length)returnclipEdge;clipEdge=_;returnchart};chart.clipVoronoi=function(_){if(!arguments.length)returnclipVoronoi;clipVoronoi=_;returnchart};chart.useVoronoi=function(_){if(!arguments.length)returnuseVoronoi;useVoronoi=_;if(useVoronoi===false){clipVoronoi=false}returnchart};chart.clipRadius=function(_){if(!arguments.length)returnclipRadius;clipRadius=_;returnchart};chart.color=function(_){if(!arguments.length)returncolor;color=nv.utils.getColor(_);returnchart};chart.shape=function(_){if(!arguments.length)returngetShape;getShape=_;returnchart};chart.onlyCircles=function(_){if(!arguments.length)returnonlyCircles;onlyCircles=_;returnchart};chart.id=function(_){if(!arguments.length)returnid;id=_;returnchart};chart.singlePoint=function(_){if(!arguments.length)returnsinglePoint;singlePoint=_;returnchart};returnchart};nv.models.scatterChart=function(){varscatter=nv.models.scatter(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend(),distX=nv.models.distribution(),distY=nv.models.distribution();varmargin={top:30,right:20,bottom:50,left:75},width=null,height=null,color=nv.utils.defaultColor(),x=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):scatter.xScale(),y=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):scatter.yScale(),xPadding=0,yPadding=0,showDistX=false,showDistY=false,showLegend=true,showXAxis=true,showYAxis=true,rightAlignYAxis=false,showControls=!!d3.fisheye,fisheye=0,pauseFisheye=false,tooltips=true,tooltipX=function(key,x,y){return"<strong>"+x+"</strong>"},tooltipY=function(key,x,y){return"<strong>"+y+"</strong>"},tooltip=null,state={},defaultState=null,dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),noData="No Data Available.";scatter.xScale(x).yScale(y);xAxis.orient("bottom").tickPadding(10);yAxis.orient(rightAlignYAxis?"right":"left").tickPadding(10);distX.axis("x");distY.axis("y");varx0,y0;varshowTooltip=function(e,offsetElement){varleft=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),leftX=e.pos[0]+(offsetElement.offsetLeft||0),topX=y.range()[0]+margin.top+(offsetElement.offsetTop||0),leftY=x.range()[0]+margin.left+(offsetElement.offsetLeft||0),topY=e.pos[1]+(offsetElement.offsetTop||0),xVal=xAxis.tickFormat()(scatter.x()(e.point,e.pointIndex)),yVal=yAxis.tickFormat()(scatter.y