diff --git a/nv.d3.js b/nv.d3.js index 4d2009c..43b9d9f 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -14131,7 +14131,7 @@ nv.models.stackedAreaChart = function() { // Update chart from a state object passed to event handler dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { + if (typeof e.disabled !== 'undefined' && data.length === e.disabled.length) { data.forEach(function(series,i) { series.disabled = e.disabled[i]; }); diff --git a/nv.d3.min.js b/nv.d3.min.js index e5c672d..d6e616d 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -5,4 +5,4 @@ var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Ma margin.left=typeof _.left!="undefined"?_.left:margin.left;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.brushExtent=function(_){if(!arguments.length)return brushExtent;brushExtent=_;return chart};return chart};nv.models.multiBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,x=d3.scale.ordinal(),y=d3.scale.linear(),id=Math.floor(Math.random()*1e4),getX=function(d){return d.x},getY=function(d){return d.y},forceY=[0],clipEdge=true,stacked=false,stackOffset="zero",color=nv.utils.defaultColor(),hideable=false,barColor=null,disabled,delay=1200,xDomain,yDomain,xRange,yRange,groupSpacing=.1,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x0,y0;function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this);if(hideable&&data.length)hideable=[{values:data[0].values.map(function(d){return{x:d.x,y:0,series:d.series,size:.01}})}];if(stacked)data=d3.layout.stack().offset(stackOffset).values(function(d){return d.values}).y(getY)(!data.length&&hideable?hideable:data);data.forEach(function(series,i){series.values.forEach(function(point){point.series=i})});if(stacked)data[0].values.map(function(d,i){var posBase=0,negBase=0;data.map(function(d){var f=d.values[i];f.size=Math.abs(f.y);if(f.y<0){f.y1=negBase;negBase=negBase-f.size}else{f.y1=f.size+posBase;posBase=posBase+f.size}})});var seriesData=xDomain&&yDomain?[]:data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),y0:d.y0,y1:d.y1}})});x.domain(xDomain||d3.merge(seriesData).map(function(d){return d.x})).rangeBands(xRange||[0,availableWidth],groupSpacing);y.domain(yDomain||d3.extent(d3.merge(seriesData).map(function(d){return stacked?d.y>0?d.y1:d.y1+d.y:d.y}).concat(forceY))).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);x0=x0||x;y0=y0||y;var wrap=container.selectAll("g.nv-wrap.nv-multibar").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");wrap.attr("transform","translate("+margin.left+","+margin.top+")");defsEnter.append("clipPath").attr("id","nv-edge-clip-"+id).append("rect");wrap.select("#nv-edge-clip-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+id+")":"");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d,i){return i});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().transition().selectAll("rect.nv-bar").delay(function(d,i){return i*delay/data[0].values.length}).attr("y",function(d){return stacked?y0(d.y0):y0(0)}).attr("height",0).remove();groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover}).style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)});groups.transition().style("stroke-opacity",1).style("fill-opacity",.75);var bars=groups.selectAll("rect.nv-bar").data(function(d){return hideable&&!data.length?hideable.values:d.values});bars.exit().remove();var barsEnter=bars.enter().append("rect").attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(d,i,j){return stacked?0:j*x.rangeBand()/data.length}).attr("y",function(d){return y0(stacked?d.y0:0)}).attr("height",0).attr("width",x.rangeBand()/(stacked?1:data.length)).attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"});bars.style("fill",function(d,i,j){return color(d,j,i)}).style("stroke",function(d,i,j){return color(d,j,i)}).on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({value:getY(d,i),point:d,series:data[d.series],pos:[x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length,y(getY(d,i)+(stacked?d.y0:0))],pointIndex:i,seriesIndex:d.series,e:d3.event})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({value:getY(d,i),point:d,series:data[d.series],pointIndex:i,seriesIndex:d.series,e:d3.event})}).on("click",function(d,i){dispatch.elementClick({value:getY(d,i),point:d,series:data[d.series],pos:[x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length,y(getY(d,i)+(stacked?d.y0:0))],pointIndex:i,seriesIndex:d.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({value:getY(d,i),point:d,series:data[d.series],pos:[x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length,y(getY(d,i)+(stacked?d.y0:0))],pointIndex:i,seriesIndex:d.series,e:d3.event});d3.event.stopPropagation()});bars.attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(d,i){return"translate("+x(getX(d,i))+",0)"});if(barColor){if(!disabled)disabled=data.map(function(){return true});bars.style("fill",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()}).style("stroke",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()})}if(stacked)bars.transition().delay(function(d,i){return i*delay/data[0].values.length}).attr("y",function(d,i){return y(stacked?d.y1:0)}).attr("height",function(d,i){return Math.max(Math.abs(y(d.y+(stacked?d.y0:0))-y(stacked?d.y0:0)),1)}).attr("x",function(d,i){return stacked?0:d.series*x.rangeBand()/data.length}).attr("width",x.rangeBand()/(stacked?1:data.length));else bars.transition().delay(function(d,i){return i*delay/data[0].values.length}).attr("x",function(d,i){return d.series*x.rangeBand()/data.length}).attr("width",x.rangeBand()/data.length).attr("y",function(d,i){return getY(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){return Math.max(Math.abs(y(getY(d,i))-y(0)),1)||0});x0=x.copy();y0=y.copy()});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart.x=function(_){if(!arguments.length)return getX;getX=_;return chart};chart.y=function(_){if(!arguments.length)return getY;getY=_;return chart};chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.forceY=function(_){if(!arguments.length)return forceY;forceY=_;return chart};chart.stacked=function(_){if(!arguments.length)return stacked;stacked=_;return chart};chart.stackOffset=function(_){if(!arguments.length)return stackOffset;stackOffset=_;return chart};chart.clipEdge=function(_){if(!arguments.length)return clipEdge;clipEdge=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.barColor=function(_){if(!arguments.length)return barColor;barColor=nv.utils.getColor(_);return chart};chart.disabled=function(_){if(!arguments.length)return disabled;disabled=_;return chart};chart.id=function(_){if(!arguments.length)return id;id=_;return chart};chart.hideable=function(_){if(!arguments.length)return hideable;hideable=_;return chart};chart.delay=function(_){if(!arguments.length)return delay;delay=_;return chart};chart.groupSpacing=function(_){if(!arguments.length)return groupSpacing;groupSpacing=_;return chart};return chart};nv.models.multiBarChart=function(){"use strict";var multibar=nv.models.multiBar(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend(),controls=nv.models.legend();var margin={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"

"+key+"

"+"

"+y+" on "+x+"

"},x,y,state={stacked:false},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),controlWidth=function(){return showControls?180:0},transitionDuration=250;multibar.stacked(false);xAxis.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(d){return d});yAxis.orient(rightAlignYAxis?"right":"left").tickFormat(d3.format(",.1f"));controls.updateState(false);var showTooltip=function(e,offsetElement){var left=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)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=multibar.xScale();y=multibar.yScale();var wrap=container.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var g=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");gEnter.append("g").attr("class","nv-controlsWrap");if(showLegend){legend.width(availableWidth-controlWidth());if(multibar.barColor())data.forEach(function(series,i){series.color=d3.rgb("#ccc").darker(i*1.5).toString()});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}g.select(".nv-legendWrap").attr("transform","translate("+controlWidth()+","+-margin.top+")")}if(showControls){var controlsData=[{key:"Grouped",disabled:multibar.stacked()},{key:"Stacked",disabled:!multibar.stacked()}];controls.width(controlWidth()).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}multibar.disabled(data.map(function(series){return series.disabled})).width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(multibar);if(showXAxis){xAxis.scale(x).ticks(availableWidth/100).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);var xTicks=g.select(".nv-x.nv-axis > g").selectAll("g");xTicks.selectAll("line, text").style("opacity",1);if(staggerLabels){var getTranslate=function(x,y){return"translate("+x+","+y+")"};var staggerUp=5,staggerDown=17;xTicks.selectAll("text").attr("transform",function(d,i,j){return getTranslate(0,j%2==0?staggerUp:staggerDown)});var totalInBetweenTicks=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(d,i){return getTranslate(0,i===0||totalInBetweenTicks%2!==0?staggerDown:staggerUp)})}if(reduceXTicks)xTicks.filter(function(d,i){return i%Math.ceil(data[0].values.length/(availableWidth/100))!==0}).selectAll("text, line").style("opacity",0);if(rotateLabels)xTicks.selectAll(".tick text").attr("transform","rotate("+rotateLabels+" 0,0)").style("text-anchor",rotateLabels>0?"start":"end");g.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(showYAxis){yAxis.scale(y).ticks(availableHeight/36).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").transition().call(yAxis)}legend.dispatch.on("stateChange",function(newState){state=newState;dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;switch(d.key){case"Grouped":multibar.stacked(false);break;case"Stacked":multibar.stacked(true);break}state.stacked=multibar.stacked();dispatch.stateChange(state);chart.update()});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.stacked!=="undefined"){multibar.stacked(e.stacked);state.stacked=e.stacked}chart.update()})});return chart}multibar.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});multibar.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.multibar=multibar;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;d3.rebind(chart,multibar,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.reduceXTicks=function(_){if(!arguments.length)return reduceXTicks;reduceXTicks=_;return chart};chart.rotateLabels=function(_){if(!arguments.length)return rotateLabels;rotateLabels=_;return chart};chart.staggerLabels=function(_){if(!arguments.length)return staggerLabels;staggerLabels=_;return chart};chart.tooltip=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};return chart};nv.models.multiBarHorizontal=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),x=d3.scale.ordinal(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},forceY=[0],color=nv.utils.defaultColor(),barColor=null,disabled,stacked=false,showValues=false,showBarLabels=false,valuePadding=60,valueFormat=d3.format(",.2f"),delay=1200,xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x0,y0;function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this);if(stacked)data=d3.layout.stack().offset("zero").values(function(d){return d.values}).y(getY)(data);data.forEach(function(series,i){series.values.forEach(function(point){point.series=i})});if(stacked)data[0].values.map(function(d,i){var posBase=0,negBase=0;data.map(function(d){var f=d.values[i];f.size=Math.abs(f.y);if(f.y<0){f.y1=negBase-f.size;negBase=negBase-f.size}else{f.y1=posBase;posBase=posBase+f.size}})});var seriesData=xDomain&&yDomain?[]:data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),y0:d.y0,y1:d.y1}})});x.domain(xDomain||d3.merge(seriesData).map(function(d){return d.x})).rangeBands(xRange||[0,availableHeight],.1);y.domain(yDomain||d3.extent(d3.merge(seriesData).map(function(d){return stacked?d.y>0?d.y1+d.y:d.y1:d.y}).concat(forceY)));if(showValues&&!stacked)y.range(yRange||[y.domain()[0]<0?valuePadding:0,availableWidth-(y.domain()[1]>0?valuePadding:0)]);else y.range(yRange||[0,availableWidth]);x0=x0||x;y0=y0||d3.scale.linear().domain(y.domain()).range([y(0),y(0)]);var wrap=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d,i){return i});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover}).style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)});groups.transition().style("stroke-opacity",1).style("fill-opacity",.75);var bars=groups.selectAll("g.nv-bar").data(function(d){return d.values});bars.exit().remove();var barsEnter=bars.enter().append("g").attr("transform",function(d,i,j){return"translate("+y0(stacked?d.y0:0)+","+(stacked?0:j*x.rangeBand()/data.length+x(getX(d,i)))+")"});barsEnter.append("rect").attr("width",0).attr("height",x.rangeBand()/(stacked?1:data.length));bars.on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({value:getY(d,i),point:d,series:data[d.series],pos:[y(getY(d,i)+(stacked?d.y0:0)),x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length],pointIndex:i,seriesIndex:d.series,e:d3.event})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({value:getY(d,i),point:d,series:data[d.series],pointIndex:i,seriesIndex:d.series,e:d3.event})}).on("click",function(d,i){dispatch.elementClick({value:getY(d,i),point:d,series:data[d.series],pos:[x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length,y(getY(d,i)+(stacked?d.y0:0))],pointIndex:i,seriesIndex:d.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({value:getY(d,i),point:d,series:data[d.series],pos:[x(getX(d,i))+x.rangeBand()*(stacked?data.length/2:d.series+.5)/data.length,y(getY(d,i)+(stacked?d.y0:0))],pointIndex:i,seriesIndex:d.series,e:d3.event});d3.event.stopPropagation()});barsEnter.append("text");if(showValues&&!stacked){bars.select("text").attr("text-anchor",function(d,i){return getY(d,i)<0?"end":"start"}).attr("y",x.rangeBand()/(data.length*2)).attr("dy",".32em").text(function(d,i){return valueFormat(getY(d,i))});bars.transition().select("text").attr("x",function(d,i){return getY(d,i)<0?-4:y(getY(d,i))-y(0)+4})}else{bars.selectAll("text").text("")}if(showBarLabels&&!stacked){barsEnter.append("text").classed("nv-bar-label",true);bars.select("text.nv-bar-label").attr("text-anchor",function(d,i){return getY(d,i)<0?"start":"end"}).attr("y",x.rangeBand()/(data.length*2)).attr("dy",".32em").text(function(d,i){return getX(d,i)});bars.transition().select("text.nv-bar-label").attr("x",function(d,i){return getY(d,i)<0?y(0)-y(getY(d,i))+4:-4})}else{bars.selectAll("text.nv-bar-label").text("")}bars.attr("class",function(d,i){return getY(d,i)<0?"nv-bar negative":"nv-bar positive"});if(barColor){if(!disabled)disabled=data.map(function(){return true});bars.style("fill",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()}).style("stroke",function(d,i,j){return d3.rgb(barColor(d,i)).darker(disabled.map(function(d,i){return i}).filter(function(d,i){return!disabled[i]})[j]).toString()})}if(stacked)bars.transition().attr("transform",function(d,i){return"translate("+y(d.y1)+","+x(getX(d,i))+")"}).select("rect").attr("width",function(d,i){return Math.abs(y(getY(d,i)+d.y0)-y(d.y0))}).attr("height",x.rangeBand());else bars.transition().attr("transform",function(d,i){return"translate("+(getY(d,i)<0?y(getY(d,i)):y(0))+","+(d.series*x.rangeBand()/data.length+x(getX(d,i)))+")"}).select("rect").attr("height",x.rangeBand()/data.length).attr("width",function(d,i){return Math.max(Math.abs(y(getY(d,i))-y(0)),1)});x0=x.copy();y0=y.copy()});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart.x=function(_){if(!arguments.length)return getX;getX=_;return chart};chart.y=function(_){if(!arguments.length)return getY;getY=_;return chart};chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.forceY=function(_){if(!arguments.length)return forceY;forceY=_;return chart};chart.stacked=function(_){if(!arguments.length)return stacked;stacked=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.barColor=function(_){if(!arguments.length)return barColor;barColor=nv.utils.getColor(_);return chart};chart.disabled=function(_){if(!arguments.length)return disabled;disabled=_;return chart};chart.id=function(_){if(!arguments.length)return id;id=_;return chart};chart.delay=function(_){if(!arguments.length)return delay;delay=_;return chart};chart.showValues=function(_){if(!arguments.length)return showValues;showValues=_;return chart};chart.showBarLabels=function(_){if(!arguments.length)return showBarLabels;showBarLabels=_;return chart};chart.valueFormat=function(_){if(!arguments.length)return valueFormat;valueFormat=_;return chart};chart.valuePadding=function(_){if(!arguments.length)return valuePadding;valuePadding=_;return chart};return chart};nv.models.multiBarHorizontalChart=function(){"use strict";var multibar=nv.models.multiBarHorizontal(),xAxis=nv.models.axis(),yAxis=nv.models.axis(),legend=nv.models.legend().height(30),controls=nv.models.legend().height(30);var margin={top:30,right:20,bottom:50,left:60},width=null,height=null,color=nv.utils.defaultColor(),showControls=true,showLegend=true,showXAxis=true,showYAxis=true,stacked=false,tooltips=true,tooltip=function(key,x,y,e,graph){return"

"+key+" - "+x+"

"+"

"+y+"

"},x,y,state={stacked:stacked},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),controlWidth=function(){return showControls?180:0},transitionDuration=250;multibar.stacked(stacked);xAxis.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(d){return d});yAxis.orient("bottom").tickFormat(d3.format(",.1f"));controls.updateState(false);var showTooltip=function(e,offsetElement){var left=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?"e":"w",null,offsetElement)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=multibar.xScale();y=multibar.yScale();var wrap=container.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line");gEnter.append("g").attr("class","nv-barsWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");if(showLegend){legend.width(availableWidth-controlWidth());if(multibar.barColor())data.forEach(function(series,i){series.color=d3.rgb("#ccc").darker(i*1.5).toString()});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}g.select(".nv-legendWrap").attr("transform","translate("+controlWidth()+","+-margin.top+")")}if(showControls){var controlsData=[{key:"Grouped",disabled:multibar.stacked()},{key:"Stacked",disabled:!multibar.stacked()}];controls.width(controlWidth()).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}wrap.attr("transform","translate("+margin.left+","+margin.top+")");multibar.disabled(data.map(function(series){return series.disabled})).width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));var barsWrap=g.select(".nv-barsWrap").datum(data.filter(function(d){return!d.disabled}));barsWrap.transition().call(multibar);if(showXAxis){xAxis.scale(x).ticks(availableHeight/24).tickSize(-availableWidth,0);g.select(".nv-x.nv-axis").transition().call(xAxis);var xTicks=g.select(".nv-x.nv-axis").selectAll("g");xTicks.selectAll("line, text")}if(showYAxis){yAxis.scale(y).ticks(availableWidth/100).tickSize(-availableHeight,0);g.select(".nv-y.nv-axis").attr("transform","translate(0,"+availableHeight+")");g.select(".nv-y.nv-axis").transition().call(yAxis)}g.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-availableHeight);legend.dispatch.on("stateChange",function(newState){state=newState;dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;switch(d.key){case"Grouped":multibar.stacked(false);break;case"Stacked":multibar.stacked(true);break}state.stacked=multibar.stacked();dispatch.stateChange(state);chart.update()});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.stacked!=="undefined"){multibar.stacked(e.stacked);state.stacked=e.stacked}chart.update()})});return chart}multibar.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top]; dispatch.tooltipShow(e)});multibar.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.multibar=multibar;chart.legend=legend;chart.xAxis=xAxis;chart.yAxis=yAxis;d3.rebind(chart,multibar,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.tooltip=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};return chart};nv.models.multiChart=function(){"use strict";var margin={top:30,right:20,bottom:50,left:60},color=d3.scale.category20().range(),width=null,height=null,showLegend=true,tooltips=true,tooltip=function(key,x,y,e,graph){return"

"+key+"

"+"

"+y+" at "+x+"

"},x,y,yDomain1,yDomain2;var x=d3.scale.linear(),yScale1=d3.scale.linear(),yScale2=d3.scale.linear(),lines1=nv.models.line().yScale(yScale1),lines2=nv.models.line().yScale(yScale2),bars1=nv.models.multiBar().stacked(false).yScale(yScale1),bars2=nv.models.multiBar().stacked(false).yScale(yScale2),stack1=nv.models.stackedArea().yScale(yScale1),stack2=nv.models.stackedArea().yScale(yScale2),xAxis=nv.models.axis().scale(x).orient("bottom").tickPadding(5),yAxis1=nv.models.axis().scale(yScale1).orient("left"),yAxis2=nv.models.axis().scale(yScale2).orient("right"),legend=nv.models.legend().height(30),dispatch=d3.dispatch("tooltipShow","tooltipHide");var showTooltip=function(e,offsetElement){var left=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(lines1.x()(e.point,e.pointIndex)),y=(e.series.yAxis==2?yAxis2:yAxis1).tickFormat()(lines1.y()(e.point,e.pointIndex)),content=tooltip(e.series.key,x,y,e,chart);nv.tooltip.show([left,top],content,undefined,undefined,offsetElement.offsetParent)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;chart.update=function(){container.transition().call(chart)};chart.container=this;var availableWidth=(width||parseInt(container.style("width"))||960)-margin.left-margin.right,availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom;var dataLines1=data.filter(function(d){return!d.disabled&&d.type=="line"&&d.yAxis==1});var dataLines2=data.filter(function(d){return!d.disabled&&d.type=="line"&&d.yAxis==2});var dataBars1=data.filter(function(d){return!d.disabled&&d.type=="bar"&&d.yAxis==1});var dataBars2=data.filter(function(d){return!d.disabled&&d.type=="bar"&&d.yAxis==2});var dataStack1=data.filter(function(d){return!d.disabled&&d.type=="area"&&d.yAxis==1});var dataStack2=data.filter(function(d){return!d.disabled&&d.type=="area"&&d.yAxis==2});var series1=data.filter(function(d){return!d.disabled&&d.yAxis==1}).map(function(d){return d.values.map(function(d,i){return{x:d.x,y:d.y}})});var series2=data.filter(function(d){return!d.disabled&&d.yAxis==2}).map(function(d){return d.values.map(function(d,i){return{x:d.x,y:d.y}})});x.domain(d3.extent(d3.merge(series1.concat(series2)),function(d){return d.x})).range([0,availableWidth]);var wrap=container.selectAll("g.wrap.multiChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");gEnter.append("g").attr("class","x axis");gEnter.append("g").attr("class","y1 axis");gEnter.append("g").attr("class","y2 axis");gEnter.append("g").attr("class","lines1Wrap");gEnter.append("g").attr("class","lines2Wrap");gEnter.append("g").attr("class","bars1Wrap");gEnter.append("g").attr("class","bars2Wrap");gEnter.append("g").attr("class","stack1Wrap");gEnter.append("g").attr("class","stack2Wrap");gEnter.append("g").attr("class","legendWrap");var g=wrap.select("g");if(showLegend){legend.width(availableWidth/2);g.select(".legendWrap").datum(data.map(function(series){series.originalKey=series.originalKey===undefined?series.key:series.originalKey;series.key=series.originalKey+(series.yAxis==1?"":" (right axis)");return series})).call(legend);if(margin.top!=legend.height()){margin.top=legend.height();availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom}g.select(".legendWrap").attr("transform","translate("+availableWidth/2+","+-margin.top+")")}lines1.width(availableWidth).height(availableHeight).interpolate("monotone").color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="line"}));lines2.width(availableWidth).height(availableHeight).interpolate("monotone").color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="line"}));bars1.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="bar"}));bars2.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="bar"}));stack1.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==1&&data[i].type=="area"}));stack2.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color[i%color.length]}).filter(function(d,i){return!data[i].disabled&&data[i].yAxis==2&&data[i].type=="area"}));g.attr("transform","translate("+margin.left+","+margin.top+")");var lines1Wrap=g.select(".lines1Wrap").datum(dataLines1);var bars1Wrap=g.select(".bars1Wrap").datum(dataBars1);var stack1Wrap=g.select(".stack1Wrap").datum(dataStack1);var lines2Wrap=g.select(".lines2Wrap").datum(dataLines2);var bars2Wrap=g.select(".bars2Wrap").datum(dataBars2);var stack2Wrap=g.select(".stack2Wrap").datum(dataStack2);var extraValue1=dataStack1.length?dataStack1.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(aVal,i){return{x:aVal.x,y:aVal.y+b[i].y}})}).concat([{x:0,y:0}]):[];var extraValue2=dataStack2.length?dataStack2.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(aVal,i){return{x:aVal.x,y:aVal.y+b[i].y}})}).concat([{x:0,y:0}]):[];yScale1.domain(yDomain1||d3.extent(d3.merge(series1).concat(extraValue1),function(d){return d.y})).range([0,availableHeight]);yScale2.domain(yDomain2||d3.extent(d3.merge(series2).concat(extraValue2),function(d){return d.y})).range([0,availableHeight]);lines1.yDomain(yScale1.domain());bars1.yDomain(yScale1.domain());stack1.yDomain(yScale1.domain());lines2.yDomain(yScale2.domain());bars2.yDomain(yScale2.domain());stack2.yDomain(yScale2.domain());if(dataStack1.length){d3.transition(stack1Wrap).call(stack1)}if(dataStack2.length){d3.transition(stack2Wrap).call(stack2)}if(dataBars1.length){d3.transition(bars1Wrap).call(bars1)}if(dataBars2.length){d3.transition(bars2Wrap).call(bars2)}if(dataLines1.length){d3.transition(lines1Wrap).call(lines1)}if(dataLines2.length){d3.transition(lines2Wrap).call(lines2)}xAxis.ticks(availableWidth/100).tickSize(-availableHeight,0);g.select(".x.axis").attr("transform","translate(0,"+availableHeight+")");d3.transition(g.select(".x.axis")).call(xAxis);yAxis1.ticks(availableHeight/36).tickSize(-availableWidth,0);d3.transition(g.select(".y1.axis")).call(yAxis1);yAxis2.ticks(availableHeight/36).tickSize(-availableWidth,0);d3.transition(g.select(".y2.axis")).call(yAxis2);g.select(".y2.axis").style("opacity",series2.length?1:0).attr("transform","translate("+x.range()[1]+",0)");legend.dispatch.on("stateChange",function(newState){chart.update()});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)})});return chart}lines1.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});lines1.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});lines2.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});lines2.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});bars1.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});bars1.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});bars2.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});bars2.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});stack1.dispatch.on("tooltipShow",function(e){if(!Math.round(stack1.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top],dispatch.tooltipShow(e)});stack1.dispatch.on("tooltipHide",function(e){dispatch.tooltipHide(e)});stack2.dispatch.on("tooltipShow",function(e){if(!Math.round(stack2.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top],dispatch.tooltipShow(e)});stack2.dispatch.on("tooltipHide",function(e){dispatch.tooltipHide(e)});lines1.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});lines1.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});lines2.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});lines2.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.lines1=lines1;chart.lines2=lines2;chart.bars1=bars1;chart.bars2=bars2;chart.stack1=stack1;chart.stack2=stack2;chart.xAxis=xAxis;chart.yAxis1=yAxis1;chart.yAxis2=yAxis2;chart.options=nv.utils.optionsFunc.bind(chart);chart.x=function(_){if(!arguments.length)return getX;getX=_;lines1.x(_);bars1.x(_);return chart};chart.y=function(_){if(!arguments.length)return getY;getY=_;lines1.y(_);bars1.y(_);return chart};chart.yDomain1=function(_){if(!arguments.length)return yDomain1;yDomain1=_;return chart};chart.yDomain2=function(_){if(!arguments.length)return yDomain2;yDomain2=_;return chart};chart.margin=function(_){if(!arguments.length)return margin;margin=_;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=_;legend.color(_);return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};return chart};nv.models.ohlcBar=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,id=Math.floor(Math.random()*1e4),x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getOpen=function(d){return d.open},getClose=function(d){return d.close},getHigh=function(d){return d.high},getLow=function(d){return d.low},forceX=[],forceY=[],padData=false,clipEdge=true,color=nv.utils.defaultColor(),xDomain,yDomain,xRange,yRange,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this);x.domain(xDomain||d3.extent(data[0].values.map(getX).concat(forceX)));if(padData)x.range(xRange||[availableWidth*.5/data[0].values.length,availableWidth*(data[0].values.length-.5)/data[0].values.length]);else x.range(xRange||[0,availableWidth]);y.domain(yDomain||[d3.min(data[0].values.map(getLow).concat(forceY)),d3.max(data[0].values.map(getHigh).concat(forceY))]).range(yRange||[availableHeight,0]);if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]+y.domain()[0]*.01,y.domain()[1]-y.domain()[1]*.01]):y.domain([-1,1]);var wrap=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([data[0].values]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-ticks");wrap.attr("transform","translate("+margin.left+","+margin.top+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});defsEnter.append("clipPath").attr("id","nv-chart-clip-path-"+id).append("rect");wrap.select("#nv-chart-clip-path-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-chart-clip-path-"+id+")":"");var ticks=wrap.select(".nv-ticks").selectAll(".nv-tick").data(function(d){return d});ticks.exit().remove();var ticksEnter=ticks.enter().append("path").attr("class",function(d,i,j){return(getOpen(d,i)>getClose(d,i)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+j+"-"+i}).attr("d",function(d,i){var w=availableWidth/data[0].values.length*.9;return"m0,0l0,"+(y(getOpen(d,i))-y(getHigh(d,i)))+"l"+-w/2+",0l"+w/2+",0l0,"+(y(getLow(d,i))-y(getOpen(d,i)))+"l0,"+(y(getClose(d,i))-y(getLow(d,i)))+"l"+w/2+",0l"+-w/2+",0z"}).attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getHigh(d,i))+")"}).on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({point:d,series:data[0],pos:[x(getX(d,i)),y(getY(d,i))],pointIndex:i,seriesIndex:0,e:d3.event})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({point:d,series:data[0],pointIndex:i,seriesIndex:0,e:d3.event})}).on("click",function(d,i){dispatch.elementClick({value:getY(d,i),data:d,index:i,pos:[x(getX(d,i)),y(getY(d,i))],e:d3.event,id:id});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({value:getY(d,i),data:d,index:i,pos:[x(getX(d,i)),y(getY(d,i))],e:d3.event,id:id});d3.event.stopPropagation()});ticks.attr("class",function(d,i,j){return(getOpen(d,i)>getClose(d,i)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+j+"-"+i});d3.transition(ticks).attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getHigh(d,i))+")"}).attr("d",function(d,i){var w=availableWidth/data[0].values.length*.9;return"m0,0l0,"+(y(getOpen(d,i))-y(getHigh(d,i)))+"l"+-w/2+",0l"+w/2+",0l0,"+(y(getLow(d,i))-y(getOpen(d,i)))+"l0,"+(y(getClose(d,i))-y(getLow(d,i)))+"l"+w/2+",0l"+-w/2+",0z"})});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart.x=function(_){if(!arguments.length)return getX;getX=_;return chart};chart.y=function(_){if(!arguments.length)return getY;getY=_;return chart};chart.open=function(_){if(!arguments.length)return getOpen;getOpen=_;return chart};chart.close=function(_){if(!arguments.length)return getClose;getClose=_;return chart};chart.high=function(_){if(!arguments.length)return getHigh;getHigh=_;return chart};chart.low=function(_){if(!arguments.length)return getLow;getLow=_;return chart};chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.forceX=function(_){if(!arguments.length)return forceX;forceX=_;return chart};chart.forceY=function(_){if(!arguments.length)return forceY;forceY=_;return chart};chart.padData=function(_){if(!arguments.length)return padData;padData=_;return chart};chart.clipEdge=function(_){if(!arguments.length)return clipEdge;clipEdge=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.id=function(_){if(!arguments.length)return id;id=_;return chart};return chart};nv.models.pie=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=500,height=500,getX=function(d){return d.x},getY=function(d){return d.y},getDescription=function(d){return d.description},id=Math.floor(Math.random()*1e4),color=nv.utils.defaultColor(),valueFormat=d3.format(",.2f"),showLabels=true,pieLabelsOutside=true,donutLabelsOutside=false,labelType="key",labelThreshold=.02,donut=false,labelSunbeamLayout=false,startAngle=false,endAngle=false,donutRatio=.5,dispatch=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,radius=Math.min(availableWidth,availableHeight)/2,arcRadius=radius-radius/5,container=d3.select(this);var wrap=container.selectAll(".nv-wrap.nv-pie").data(data);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+id);var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-pie");gEnter.append("g").attr("class","nv-pieLabels");wrap.attr("transform","translate("+margin.left+","+margin.top+")");g.select(".nv-pie").attr("transform","translate("+availableWidth/2+","+availableHeight/2+")");g.select(".nv-pieLabels").attr("transform","translate("+availableWidth/2+","+availableHeight/2+")");container.on("click",function(d,i){dispatch.chartClick({data:d,index:i,pos:d3.event,id:id})});var arc=d3.svg.arc().outerRadius(arcRadius);if(startAngle)arc.startAngle(startAngle);if(endAngle)arc.endAngle(endAngle);if(donut)arc.innerRadius(radius*donutRatio);var pie=d3.layout.pie().sort(null).value(function(d){return d.disabled?0:getY(d)});var slices=wrap.select(".nv-pie").selectAll(".nv-slice").data(pie);var pieLabels=wrap.select(".nv-pieLabels").selectAll(".nv-label").data(pie);slices.exit().remove();pieLabels.exit().remove();var ae=slices.enter().append("g").attr("class","nv-slice").on("mouseover",function(d,i){d3.select(this).classed("hover",true);dispatch.elementMouseover({label:getX(d.data),value:getY(d.data),point:d.data,pointIndex:i,pos:[d3.event.pageX,d3.event.pageY],id:id})}).on("mouseout",function(d,i){d3.select(this).classed("hover",false);dispatch.elementMouseout({label:getX(d.data),value:getY(d.data),point:d.data,index:i,id:id})}).on("click",function(d,i){dispatch.elementClick({label:getX(d.data),value:getY(d.data),point:d.data,index:i,pos:d3.event,id:id});d3.event.stopPropagation()}).on("dblclick",function(d,i){dispatch.elementDblClick({label:getX(d.data),value:getY(d.data),point:d.data,index:i,pos:d3.event,id:id});d3.event.stopPropagation()});slices.attr("fill",function(d,i){return color(d,i)}).attr("stroke",function(d,i){return color(d,i)});var paths=ae.append("path").each(function(d){this._current=d});slices.select("path").transition().attr("d",arc).attrTween("d",arcTween);if(showLabels){var labelsArc=d3.svg.arc().innerRadius(0);if(pieLabelsOutside){labelsArc=arc}if(donutLabelsOutside){labelsArc=d3.svg.arc().outerRadius(arc.outerRadius())}pieLabels.enter().append("g").classed("nv-label",true).each(function(d,i){var group=d3.select(this);group.attr("transform",function(d){if(labelSunbeamLayout){d.outerRadius=arcRadius+10;d.innerRadius=arcRadius+15;var rotateAngle=(d.startAngle+d.endAngle)/2*(180/Math.PI);if((d.startAngle+d.endAngle)/2labelThreshold?labelTypes[labelType]:""})}function angle(d){var a=(d.startAngle+d.endAngle)*90/Math.PI-90;return a>90?a-180:a}function arcTween(a){a.endAngle=isNaN(a.endAngle)?0:a.endAngle;a.startAngle=isNaN(a.startAngle)?0:a.startAngle;if(!donut)a.innerRadius=0;var i=d3.interpolate(this._current,a);this._current=i(0);return function(t){return arc(i(t))}}function tweenPie(b){b.innerRadius=0;var i=d3.interpolate({startAngle:0,endAngle:0},b);return function(t){return arc(i(t))}}});return chart}chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.values=function(_){nv.log("pie.values() is no longer supported.");return chart};chart.x=function(_){if(!arguments.length)return getX;getX=_;return chart};chart.y=function(_){if(!arguments.length)return getY;getY=d3.functor(_);return chart};chart.description=function(_){if(!arguments.length)return getDescription;getDescription=_;return chart};chart.showLabels=function(_){if(!arguments.length)return showLabels;showLabels=_;return chart};chart.labelSunbeamLayout=function(_){if(!arguments.length)return labelSunbeamLayout;labelSunbeamLayout=_;return chart};chart.donutLabelsOutside=function(_){if(!arguments.length)return donutLabelsOutside;donutLabelsOutside=_;return chart};chart.pieLabelsOutside=function(_){if(!arguments.length)return pieLabelsOutside;pieLabelsOutside=_;return chart};chart.labelType=function(_){if(!arguments.length)return labelType;labelType=_;labelType=labelType||"key";return chart};chart.donut=function(_){if(!arguments.length)return donut;donut=_;return chart};chart.donutRatio=function(_){if(!arguments.length)return donutRatio;donutRatio=_;return chart};chart.startAngle=function(_){if(!arguments.length)return startAngle;startAngle=_;return chart};chart.endAngle=function(_){if(!arguments.length)return endAngle;endAngle=_;return chart};chart.id=function(_){if(!arguments.length)return id;id=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.valueFormat=function(_){if(!arguments.length)return valueFormat;valueFormat=_;return chart};chart.labelThreshold=function(_){if(!arguments.length)return labelThreshold;labelThreshold=_;return chart};return chart};nv.models.pieChart=function(){"use strict";var pie=nv.models.pie(),legend=nv.models.legend();var margin={top:30,right:20,bottom:20,left:20},width=null,height=null,showLegend=true,color=nv.utils.defaultColor(),tooltips=true,tooltip=function(key,y,e,graph){return"

"+key+"

"+"

"+y+"

"},state={},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var showTooltip=function(e,offsetElement){var tooltipLabel=pie.description()(e.point)||pie.x()(e.point);var left=e.pos[0]+(offsetElement&&offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement&&offsetElement.offsetTop||0),y=pie.valueFormat()(pie.y()(e.point)),content=tooltip(tooltipLabel,y,e,chart);nv.tooltip.show([left,top],content,e.value<0?"n":"s",null,offsetElement)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}var wrap=container.selectAll("g.nv-wrap.nv-pieChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-pieWrap");gEnter.append("g").attr("class","nv-legendWrap");if(showLegend){legend.width(availableWidth).key(pie.x());wrap.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+")");pie.width(availableWidth).height(availableHeight);var pieWrap=g.select(".nv-pieWrap").datum([data]);d3.transition(pieWrap).call(pie);legend.dispatch.on("stateChange",function(newState){state=newState;dispatch.stateChange(state);chart.update()});pie.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()})});return chart}pie.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.legend=legend;chart.dispatch=dispatch;chart.pie=pie;d3.rebind(chart,pie,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);pie.color(color);return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};return chart};nv.models.scatter=function(){"use strict";var margin={top:0,right:0,bottom:0,left:0},width=960,height=500,color=nv.utils.defaultColor(),id=Math.floor(Math.random()*1e5),x=d3.scale.linear(),y=d3.scale.linear(),z=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},getSize=function(d){return d.size||1},getShape=function(d){return d.shape||"circle"},onlyCircles=true,forceX=[],forceY=[],forceSize=[],interactive=true,pointKey=null,pointActive=function(d){return!d.notActive},padData=false,padDataOuter=.1,clipEdge=false,clipVoronoi=true,clipRadius=function(){return 25},xDomain=null,yDomain=null,xRange=null,yRange=null,sizeDomain=null,sizeRange=null,singlePoint=false,dispatch=d3.dispatch("elementClick","elementMouseover","elementMouseout"),useVoronoi=true;var x0,y0,z0,timeoutID,needsUpdate=false;function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this); data.forEach(function(series,i){series.values.forEach(function(point){point.series=i})});var seriesData=xDomain&&yDomain&&sizeDomain?[]:d3.merge(data.map(function(d){return d.values.map(function(d,i){return{x:getX(d,i),y:getY(d,i),size:getSize(d,i)}})}));x.domain(xDomain||d3.extent(seriesData.map(function(d){return d.x}).concat(forceX)));if(padData&&data[0])x.range(xRange||[(availableWidth*padDataOuter+availableWidth)/(2*data[0].values.length),availableWidth-availableWidth*(1+padDataOuter)/(2*data[0].values.length)]);else x.range(xRange||[0,availableWidth]);y.domain(yDomain||d3.extent(seriesData.map(function(d){return d.y}).concat(forceY))).range(yRange||[availableHeight,0]);z.domain(sizeDomain||d3.extent(seriesData.map(function(d){return d.size}).concat(forceSize))).range(sizeRange||[16,256]);if(x.domain()[0]===x.domain()[1]||y.domain()[0]===y.domain()[1])singlePoint=true;if(x.domain()[0]===x.domain()[1])x.domain()[0]?x.domain([x.domain()[0]-x.domain()[0]*.01,x.domain()[1]+x.domain()[1]*.01]):x.domain([-1,1]);if(y.domain()[0]===y.domain()[1])y.domain()[0]?y.domain([y.domain()[0]-y.domain()[0]*.01,y.domain()[1]+y.domain()[1]*.01]):y.domain([-1,1]);if(isNaN(x.domain()[0])){x.domain([-1,1])}if(isNaN(y.domain()[0])){y.domain([-1,1])}x0=x0||x;y0=y0||y;z0=z0||z;var wrap=container.selectAll("g.nv-wrap.nv-scatter").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+id+(singlePoint?" nv-single-point":""));var defsEnter=wrapEnter.append("defs");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-groups");gEnter.append("g").attr("class","nv-point-paths");wrap.attr("transform","translate("+margin.left+","+margin.top+")");defsEnter.append("clipPath").attr("id","nv-edge-clip-"+id).append("rect");wrap.select("#nv-edge-clip-"+id+" rect").attr("width",availableWidth).attr("height",availableHeight);g.attr("clip-path",clipEdge?"url(#nv-edge-clip-"+id+")":"");function updateInteractiveLayer(){if(!interactive)return false;var eventElements;var vertices=d3.merge(data.map(function(group,groupIndex){return group.values.map(function(point,pointIndex){var pX=getX(point,pointIndex);var pY=getY(point,pointIndex);return[x(pX)+Math.random()*1e-7,y(pY)+Math.random()*1e-7,groupIndex,pointIndex,point]}).filter(function(pointArray,pointIndex){return pointActive(pointArray[4],pointIndex)})}));if(useVoronoi===true){if(clipVoronoi){var pointClipsEnter=wrap.select("defs").selectAll(".nv-point-clips").data([id]).enter();pointClipsEnter.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+id);var pointClips=wrap.select("#nv-points-clip-"+id).selectAll("circle").data(vertices);pointClips.enter().append("circle").attr("r",clipRadius);pointClips.exit().remove();pointClips.attr("cx",function(d){return d[0]}).attr("cy",function(d){return d[1]});wrap.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+id+")")}if(vertices.length){vertices.push([x.range()[0]-20,y.range()[0]-20,null,null]);vertices.push([x.range()[1]+20,y.range()[1]+20,null,null]);vertices.push([x.range()[0]-20,y.range()[0]+20,null,null]);vertices.push([x.range()[1]+20,y.range()[1]-20,null,null])}var bounds=d3.geom.polygon([[-10,-10],[-10,height+10],[width+10,height+10],[width+10,-10]]);var voronoi=d3.geom.voronoi(vertices).map(function(d,i){return{data:bounds.clip(d),series:vertices[i][2],point:vertices[i][3]}});var pointPaths=wrap.select(".nv-point-paths").selectAll("path").data(voronoi);pointPaths.enter().append("path").attr("class",function(d,i){return"nv-path-"+i});pointPaths.exit().remove();pointPaths.attr("d",function(d){if(d.data.length===0)return"M 0 0";else return"M"+d.data.join("L")+"Z"});var mouseEventCallback=function(d,mDispatch){if(needsUpdate)return 0;var series=data[d.series];if(typeof series==="undefined")return;var point=series.values[d.point];mDispatch({point:point,series:series,pos:[x(getX(point,d.point))+margin.left,y(getY(point,d.point))+margin.top],seriesIndex:d.series,pointIndex:d.point})};pointPaths.on("click",function(d){mouseEventCallback(d,dispatch.elementClick)}).on("mouseover",function(d){mouseEventCallback(d,dispatch.elementMouseover)}).on("mouseout",function(d,i){mouseEventCallback(d,dispatch.elementMouseout)})}else{wrap.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(d,i){if(needsUpdate||!data[d.series])return 0;var series=data[d.series],point=series.values[i];dispatch.elementClick({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d.series,pointIndex:i})}).on("mouseover",function(d,i){if(needsUpdate||!data[d.series])return 0;var series=data[d.series],point=series.values[i];dispatch.elementMouseover({point:point,series:series,pos:[x(getX(point,i))+margin.left,y(getY(point,i))+margin.top],seriesIndex:d.series,pointIndex:i})}).on("mouseout",function(d,i){if(needsUpdate||!data[d.series])return 0;var series=data[d.series],point=series.values[i];dispatch.elementMouseout({point:point,series:series,seriesIndex:d.series,pointIndex:i})})}needsUpdate=false}needsUpdate=true;var groups=wrap.select(".nv-groups").selectAll(".nv-group").data(function(d){return d},function(d){return d.key});groups.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);groups.exit().remove();groups.attr("class",function(d,i){return"nv-group nv-series-"+i}).classed("hover",function(d){return d.hover});groups.transition().style("fill",function(d,i){return color(d,i)}).style("stroke",function(d,i){return color(d,i)}).style("stroke-opacity",1).style("fill-opacity",.5);if(onlyCircles){var points=groups.selectAll("circle.nv-point").data(function(d){return d.values},pointKey);points.enter().append("circle").style("fill",function(d,i){return d.color}).style("stroke",function(d,i){return d.color}).attr("cx",function(d,i){return nv.utils.NaNtoZero(x0(getX(d,i)))}).attr("cy",function(d,i){return nv.utils.NaNtoZero(y0(getY(d,i)))}).attr("r",function(d,i){return Math.sqrt(z(getSize(d,i))/Math.PI)});points.exit().remove();groups.exit().selectAll("path.nv-point").transition().attr("cx",function(d,i){return nv.utils.NaNtoZero(x(getX(d,i)))}).attr("cy",function(d,i){return nv.utils.NaNtoZero(y(getY(d,i)))}).remove();points.each(function(d,i){d3.select(this).classed("nv-point",true).classed("nv-point-"+i,true).classed("hover",false)});points.transition().attr("cx",function(d,i){return nv.utils.NaNtoZero(x(getX(d,i)))}).attr("cy",function(d,i){return nv.utils.NaNtoZero(y(getY(d,i)))}).attr("r",function(d,i){return Math.sqrt(z(getSize(d,i))/Math.PI)})}else{var points=groups.selectAll("path.nv-point").data(function(d){return d.values});points.enter().append("path").style("fill",function(d,i){return d.color}).style("stroke",function(d,i){return d.color}).attr("transform",function(d,i){return"translate("+x0(getX(d,i))+","+y0(getY(d,i))+")"}).attr("d",d3.svg.symbol().type(getShape).size(function(d,i){return z(getSize(d,i))}));points.exit().remove();groups.exit().selectAll("path.nv-point").transition().attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getY(d,i))+")"}).remove();points.each(function(d,i){d3.select(this).classed("nv-point",true).classed("nv-point-"+i,true).classed("hover",false)});points.transition().attr("transform",function(d,i){return"translate("+x(getX(d,i))+","+y(getY(d,i))+")"}).attr("d",d3.svg.symbol().type(getShape).size(function(d,i){return z(getSize(d,i))}))}clearTimeout(timeoutID);timeoutID=setTimeout(updateInteractiveLayer,300);x0=x.copy();y0=y.copy();z0=z.copy()});return chart}chart.clearHighlights=function(){d3.selectAll(".nv-chart-"+id+" .nv-point.hover").classed("hover",false)};chart.highlightPoint=function(seriesIndex,pointIndex,isHoverOver){d3.select(".nv-chart-"+id+" .nv-series-"+seriesIndex+" .nv-point-"+pointIndex).classed("hover",isHoverOver)};dispatch.on("elementMouseover.point",function(d){if(interactive)chart.highlightPoint(d.seriesIndex,d.pointIndex,true)});dispatch.on("elementMouseout.point",function(d){if(interactive)chart.highlightPoint(d.seriesIndex,d.pointIndex,false)});chart.dispatch=dispatch;chart.options=nv.utils.optionsFunc.bind(chart);chart.x=function(_){if(!arguments.length)return getX;getX=d3.functor(_);return chart};chart.y=function(_){if(!arguments.length)return getY;getY=d3.functor(_);return chart};chart.size=function(_){if(!arguments.length)return getSize;getSize=d3.functor(_);return chart};chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.zScale=function(_){if(!arguments.length)return z;z=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.sizeDomain=function(_){if(!arguments.length)return sizeDomain;sizeDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.sizeRange=function(_){if(!arguments.length)return sizeRange;sizeRange=_;return chart};chart.forceX=function(_){if(!arguments.length)return forceX;forceX=_;return chart};chart.forceY=function(_){if(!arguments.length)return forceY;forceY=_;return chart};chart.forceSize=function(_){if(!arguments.length)return forceSize;forceSize=_;return chart};chart.interactive=function(_){if(!arguments.length)return interactive;interactive=_;return chart};chart.pointKey=function(_){if(!arguments.length)return pointKey;pointKey=_;return chart};chart.pointActive=function(_){if(!arguments.length)return pointActive;pointActive=_;return chart};chart.padData=function(_){if(!arguments.length)return padData;padData=_;return chart};chart.padDataOuter=function(_){if(!arguments.length)return padDataOuter;padDataOuter=_;return chart};chart.clipEdge=function(_){if(!arguments.length)return clipEdge;clipEdge=_;return chart};chart.clipVoronoi=function(_){if(!arguments.length)return clipVoronoi;clipVoronoi=_;return chart};chart.useVoronoi=function(_){if(!arguments.length)return useVoronoi;useVoronoi=_;if(useVoronoi===false){clipVoronoi=false}return chart};chart.clipRadius=function(_){if(!arguments.length)return clipRadius;clipRadius=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};chart.shape=function(_){if(!arguments.length)return getShape;getShape=_;return chart};chart.onlyCircles=function(_){if(!arguments.length)return onlyCircles;onlyCircles=_;return chart};chart.id=function(_){if(!arguments.length)return id;id=_;return chart};chart.singlePoint=function(_){if(!arguments.length)return singlePoint;singlePoint=_;return chart};return chart};nv.models.scatterChart=function(){"use strict";var scatter=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();var margin={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""+x+""},tooltipY=function(key,x,y){return""+y+""},tooltip=null,state={},defaultState=null,dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),noData="No Data Available.",transitionDuration=250;scatter.xScale(x).yScale(y);xAxis.orient("bottom").tickPadding(10);yAxis.orient(rightAlignYAxis?"right":"left").tickPadding(10);distX.axis("x");distY.axis("y");controls.updateState(false);var x0,y0;var showTooltip=function(e,offsetElement){var left=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()(e.point,e.pointIndex));if(tooltipX!=null)nv.tooltip.show([leftX,topX],tooltipX(e.series.key,xVal,yVal,e,chart),"n",1,offsetElement,"x-nvtooltip");if(tooltipY!=null)nv.tooltip.show([leftY,topY],tooltipY(e.series.key,xVal,yVal,e,chart),"e",1,offsetElement,"y-nvtooltip");if(tooltip!=null)nv.tooltip.show([left,top],tooltip(e.series.key,xVal,yVal,e,chart),e.value<0?"n":"s",null,offsetElement)};var controlsData=[{key:"Magnify",disabled:true}];function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x0=x0||x;y0=y0||y;var wrap=container.selectAll("g.nv-wrap.nv-scatterChart").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+scatter.id());var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("rect").attr("class","nvd3 nv-background");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-scatterWrap");gEnter.append("g").attr("class","nv-distWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");if(showLegend){var legendWidth=showControls?availableWidth/2:availableWidth;legend.width(legendWidth);wrap.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("+(availableWidth-legendWidth)+","+-margin.top+")")}if(showControls){controls.width(180).color(["#444"]);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}scatter.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));if(xPadding!==0)scatter.xDomain(null);if(yPadding!==0)scatter.yDomain(null);wrap.select(".nv-scatterWrap").datum(data.filter(function(d){return!d.disabled})).call(scatter);if(xPadding!==0){var xRange=x.domain()[1]-x.domain()[0];scatter.xDomain([x.domain()[0]-xPadding*xRange,x.domain()[1]+xPadding*xRange])}if(yPadding!==0){var yRange=y.domain()[1]-y.domain()[0];scatter.yDomain([y.domain()[0]-yPadding*yRange,y.domain()[1]+yPadding*yRange])}if(yPadding!==0||xPadding!==0){wrap.select(".nv-scatterWrap").datum(data.filter(function(d){return!d.disabled})).call(scatter)}if(showXAxis){xAxis.scale(x).ticks(xAxis.ticks()&&xAxis.ticks().length?xAxis.ticks():availableWidth/100).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")").call(xAxis)}if(showYAxis){yAxis.scale(y).ticks(yAxis.ticks()&&yAxis.ticks().length?yAxis.ticks():availableHeight/36).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}if(showDistX){distX.getData(scatter.x()).scale(x).width(availableWidth).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionX");g.select(".nv-distributionX").attr("transform","translate(0,"+y.range()[0]+")").datum(data.filter(function(d){return!d.disabled})).call(distX)}if(showDistY){distY.getData(scatter.y()).scale(y).width(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionY");g.select(".nv-distributionY").attr("transform","translate("+(rightAlignYAxis?availableWidth:-distY.size())+",0)").datum(data.filter(function(d){return!d.disabled})).call(distY)}if(d3.fisheye){g.select(".nv-background").attr("width",availableWidth).attr("height",availableHeight);g.select(".nv-background").on("mousemove",updateFisheye);g.select(".nv-background").on("click",function(){pauseFisheye=!pauseFisheye});scatter.dispatch.on("elementClick.freezeFisheye",function(){pauseFisheye=!pauseFisheye})}function updateFisheye(){if(pauseFisheye){g.select(".nv-point-paths").style("pointer-events","all");return false}g.select(".nv-point-paths").style("pointer-events","none");var mouse=d3.mouse(this);x.distortion(fisheye).focus(mouse[0]);y.distortion(fisheye).focus(mouse[1]);g.select(".nv-scatterWrap").call(scatter);if(showXAxis)g.select(".nv-x.nv-axis").call(xAxis);if(showYAxis)g.select(".nv-y.nv-axis").call(yAxis);g.select(".nv-distributionX").datum(data.filter(function(d){return!d.disabled})).call(distX);g.select(".nv-distributionY").datum(data.filter(function(d){return!d.disabled})).call(distY)}controls.dispatch.on("legendClick",function(d,i){d.disabled=!d.disabled;fisheye=d.disabled?0:2.5;g.select(".nv-background").style("pointer-events",d.disabled?"none":"all");g.select(".nv-point-paths").style("pointer-events",d.disabled?"all":"none");if(d.disabled){x.distortion(fisheye).focus(0);y.distortion(fisheye).focus(0);g.select(".nv-scatterWrap").call(scatter);g.select(".nv-x.nv-axis").call(xAxis);g.select(".nv-y.nv-axis").call(yAxis)}else{pauseFisheye=false}chart.update()});legend.dispatch.on("stateChange",function(newState){state.disabled=newState.disabled;dispatch.stateChange(state);chart.update()});scatter.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(d,i){return e.pos[1]-availableHeight});d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+distX.size());e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});x0=x.copy();y0=y.copy()});return chart}scatter.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",distY.size())});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.scatter=scatter;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.distX=distX;chart.distY=distY;d3.rebind(chart,scatter,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);distX.color(color);distY.color(color);return chart};chart.showDistX=function(_){if(!arguments.length)return showDistX;showDistX=_;return chart};chart.showDistY=function(_){if(!arguments.length)return showDistY;showDistY=_;return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.fisheye=function(_){if(!arguments.length)return fisheye;fisheye=_;return chart};chart.xPadding=function(_){if(!arguments.length)return xPadding;xPadding=_;return chart};chart.yPadding=function(_){if(!arguments.length)return yPadding;yPadding=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltipXContent=function(_){if(!arguments.length)return tooltipX;tooltipX=_;return chart};chart.tooltipYContent=function(_){if(!arguments.length)return tooltipY;tooltipY=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};return chart};nv.models.scatterPlusLineChart=function(){"use strict";var scatter=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();var margin={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(),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""+x+""},tooltipY=function(key,x,y){return""+y+""},tooltip=function(key,x,y,date){return"

"+key+"

"+"

"+date+"

"},state={},defaultState=null,dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),noData="No Data Available.",transitionDuration=250;scatter.xScale(x).yScale(y);xAxis.orient("bottom").tickPadding(10);yAxis.orient(rightAlignYAxis?"right":"left").tickPadding(10);distX.axis("x");distY.axis("y");controls.updateState(false);var x0,y0;var showTooltip=function(e,offsetElement){var left=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()(e.point,e.pointIndex));if(tooltipX!=null)nv.tooltip.show([leftX,topX],tooltipX(e.series.key,xVal,yVal,e,chart),"n",1,offsetElement,"x-nvtooltip");if(tooltipY!=null)nv.tooltip.show([leftY,topY],tooltipY(e.series.key,xVal,yVal,e,chart),"e",1,offsetElement,"y-nvtooltip");if(tooltip!=null)nv.tooltip.show([left,top],tooltip(e.series.key,xVal,yVal,e.point.tooltip,e,chart),e.value<0?"n":"s",null,offsetElement)};var controlsData=[{key:"Magnify",disabled:true}];function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=scatter.xScale();y=scatter.yScale();x0=x0||x;y0=y0||y;var wrap=container.selectAll("g.nv-wrap.nv-scatterChart").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+scatter.id());var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-scatterWrap");gEnter.append("g").attr("class","nv-regressionLinesWrap");gEnter.append("g").attr("class","nv-distWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");wrap.attr("transform","translate("+margin.left+","+margin.top+")");if(rightAlignYAxis){g.select(".nv-y.nv-axis").attr("transform","translate("+availableWidth+",0)")}if(showLegend){legend.width(availableWidth/2);wrap.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("+availableWidth/2+","+-margin.top+")")}if(showControls){controls.width(180).color(["#444"]);g.select(".nv-controlsWrap").datum(controlsData).attr("transform","translate(0,"+-margin.top+")").call(controls)}scatter.width(availableWidth).height(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));wrap.select(".nv-scatterWrap").datum(data.filter(function(d){return!d.disabled})).call(scatter);wrap.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+scatter.id()+")");var regWrap=wrap.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(d){return d});regWrap.enter().append("g").attr("class","nv-regLines");var regLine=regWrap.selectAll(".nv-regLine").data(function(d){return[d]});var regLineEnter=regLine.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);regLine.transition().attr("x1",x.range()[0]).attr("x2",x.range()[1]).attr("y1",function(d,i){return y(x.domain()[0]*d.slope+d.intercept)}).attr("y2",function(d,i){return y(x.domain()[1]*d.slope+d.intercept)}).style("stroke",function(d,i,j){return color(d,j)}).style("stroke-opacity",function(d,i){return d.disabled||typeof d.slope==="undefined"||typeof d.intercept==="undefined"?0:1});if(showXAxis){xAxis.scale(x).ticks(xAxis.ticks()?xAxis.ticks():availableWidth/100).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")").call(xAxis)}if(showYAxis){yAxis.scale(y).ticks(yAxis.ticks()?yAxis.ticks():availableHeight/36).tickSize(-availableWidth,0);g.select(".nv-y.nv-axis").call(yAxis)}if(showDistX){distX.getData(scatter.x()).scale(x).width(availableWidth).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionX");g.select(".nv-distributionX").attr("transform","translate(0,"+y.range()[0]+")").datum(data.filter(function(d){return!d.disabled})).call(distX)}if(showDistY){distY.getData(scatter.y()).scale(y).width(availableHeight).color(data.map(function(d,i){return d.color||color(d,i)}).filter(function(d,i){return!data[i].disabled}));gEnter.select(".nv-distWrap").append("g").attr("class","nv-distributionY");g.select(".nv-distributionY").attr("transform","translate("+(rightAlignYAxis?availableWidth:-distY.size())+",0)").datum(data.filter(function(d){return!d.disabled})).call(distY)}if(d3.fisheye){g.select(".nv-background").attr("width",availableWidth).attr("height",availableHeight);g.select(".nv-background").on("mousemove",updateFisheye);g.select(".nv-background").on("click",function(){pauseFisheye=!pauseFisheye});scatter.dispatch.on("elementClick.freezeFisheye",function(){pauseFisheye=!pauseFisheye})}function updateFisheye(){if(pauseFisheye){g.select(".nv-point-paths").style("pointer-events","all");return false}g.select(".nv-point-paths").style("pointer-events","none");var mouse=d3.mouse(this);x.distortion(fisheye).focus(mouse[0]);y.distortion(fisheye).focus(mouse[1]);g.select(".nv-scatterWrap").datum(data.filter(function(d){return!d.disabled})).call(scatter);if(showXAxis)g.select(".nv-x.nv-axis").call(xAxis);if(showYAxis)g.select(".nv-y.nv-axis").call(yAxis);g.select(".nv-distributionX").datum(data.filter(function(d){return!d.disabled})).call(distX);g.select(".nv-distributionY").datum(data.filter(function(d){return!d.disabled})).call(distY)}controls.dispatch.on("legendClick",function(d,i){d.disabled=!d.disabled;fisheye=d.disabled?0:2.5;g.select(".nv-background").style("pointer-events",d.disabled?"none":"all");g.select(".nv-point-paths").style("pointer-events",d.disabled?"all":"none");if(d.disabled){x.distortion(fisheye).focus(0);y.distortion(fisheye).focus(0);g.select(".nv-scatterWrap").call(scatter);g.select(".nv-x.nv-axis").call(xAxis);g.select(".nv-y.nv-axis").call(yAxis)}else{pauseFisheye=false}chart.update()});legend.dispatch.on("stateChange",function(newState){state=newState;dispatch.stateChange(state);chart.update()});scatter.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-availableHeight);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+distX.size());e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top];dispatch.tooltipShow(e)});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode) -});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});x0=x.copy();y0=y.copy()});return chart}scatter.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",distY.size())});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.scatter=scatter;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.distX=distX;chart.distY=distY;d3.rebind(chart,scatter,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);distX.color(color);distY.color(color);return chart};chart.showDistX=function(_){if(!arguments.length)return showDistX;showDistX=_;return chart};chart.showDistY=function(_){if(!arguments.length)return showDistY;showDistY=_;return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.fisheye=function(_){if(!arguments.length)return fisheye;fisheye=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltipXContent=function(_){if(!arguments.length)return tooltipX;tooltipX=_;return chart};chart.tooltipYContent=function(_){if(!arguments.length)return tooltipY;tooltipY=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};return chart};nv.models.sparkline=function(){"use strict";var margin={top:2,right:0,bottom:2,left:0},width=400,height=32,animate=true,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},color=nv.utils.getColor(["#000"]),xDomain,yDomain,xRange,yRange;function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this);x.domain(xDomain||d3.extent(data,getX)).range(xRange||[0,availableWidth]);y.domain(yDomain||d3.extent(data,getY)).range(yRange||[availableHeight,0]);var wrap=container.selectAll("g.nv-wrap.nv-sparkline").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var gEnter=wrapEnter.append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var paths=wrap.selectAll("path").data(function(d){return[d]});paths.enter().append("path");paths.exit().remove();paths.style("stroke",function(d,i){return d.color||color(d,i)}).attr("d",d3.svg.line().x(function(d,i){return x(getX(d,i))}).y(function(d,i){return y(getY(d,i))}));var points=wrap.selectAll("circle.nv-point").data(function(data){var yValues=data.map(function(d,i){return getY(d,i)});function pointIndex(index){if(index!=-1){var result=data[index];result.pointIndex=index;return result}else{return null}}var maxPoint=pointIndex(yValues.lastIndexOf(y.domain()[1])),minPoint=pointIndex(yValues.indexOf(y.domain()[0])),currentPoint=pointIndex(yValues.length-1);return[minPoint,maxPoint,currentPoint].filter(function(d){return d!=null})});points.enter().append("circle");points.exit().remove();points.attr("cx",function(d,i){return x(getX(d,d.pointIndex))}).attr("cy",function(d,i){return y(getY(d,d.pointIndex))}).attr("r",2).attr("class",function(d,i){return getX(d,d.pointIndex)==x.domain()[1]?"nv-point nv-currentValue":getY(d,d.pointIndex)==y.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.x=function(_){if(!arguments.length)return getX;getX=d3.functor(_);return chart};chart.y=function(_){if(!arguments.length)return getY;getY=d3.functor(_);return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.animate=function(_){if(!arguments.length)return animate;animate=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};return chart};nv.models.sparklinePlus=function(){"use strict";var sparkline=nv.models.sparkline();var margin={top:15,right:100,bottom:10,left:50},width=null,height=null,x,y,index=[],paused=false,xTickFormat=d3.format(",r"),yTickFormat=d3.format(",.2f"),showValue=true,alignValue=true,rightAlignValue=false,noData="No Data Available.";function chart(selection){selection.each(function(data){var container=d3.select(this);var availableWidth=(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;if(!data||!data.length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}var currentValue=sparkline.y()(data[data.length-1],data.length-1);x=sparkline.xScale();y=sparkline.yScale();var wrap=container.selectAll("g.nv-wrap.nv-sparklineplus").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-sparklineWrap");gEnter.append("g").attr("class","nv-valueWrap");gEnter.append("g").attr("class","nv-hoverArea");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var sparklineWrap=g.select(".nv-sparklineWrap");sparkline.width(availableWidth).height(availableHeight);sparklineWrap.call(sparkline);var valueWrap=g.select(".nv-valueWrap");var value=valueWrap.selectAll(".nv-currentValue").data([currentValue]);value.enter().append("text").attr("class","nv-currentValue").attr("dx",rightAlignValue?-8:8).attr("dy",".9em").style("text-anchor",rightAlignValue?"end":"start");value.attr("x",availableWidth+(rightAlignValue?margin.right:0)).attr("y",alignValue?function(d){return y(d)}:0).style("fill",sparkline.color()(data[data.length-1],data.length-1)).text(yTickFormat(currentValue));gEnter.select(".nv-hoverArea").append("rect").on("mousemove",sparklineHover).on("click",function(){paused=!paused}).on("mouseout",function(){index=[];updateValueLine()});g.select(".nv-hoverArea rect").attr("transform",function(d){return"translate("+-margin.left+","+-margin.top+")"}).attr("width",availableWidth+margin.left+margin.right).attr("height",availableHeight+margin.top);function updateValueLine(){if(paused)return;var hoverValue=g.selectAll(".nv-hoverValue").data(index);var hoverEnter=hoverValue.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);hoverValue.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();hoverValue.attr("transform",function(d){return"translate("+x(sparkline.x()(data[d],d))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!index.length)return;hoverEnter.append("line").attr("x1",0).attr("y1",-margin.top).attr("x2",0).attr("y2",availableHeight);hoverEnter.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-margin.top).attr("text-anchor","end").attr("dy",".9em");g.select(".nv-hoverValue .nv-xValue").text(xTickFormat(sparkline.x()(data[index[0]],index[0])));hoverEnter.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-margin.top).attr("text-anchor","start").attr("dy",".9em");g.select(".nv-hoverValue .nv-yValue").text(yTickFormat(sparkline.y()(data[index[0]],index[0])))}function sparklineHover(){if(paused)return;var pos=d3.mouse(this)[0]-margin.left;function getClosestIndex(data,x){var distance=Math.abs(sparkline.x()(data[0],0)-x);var closestIndex=0;for(var i=0;i"+key+""+"

"+y+" on "+x+"

"},x,y,yAxisTickFormat=d3.format(",.2f"),state={style:stacked.style()},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),controlWidth=250,cData=["Stacked","Stream","Expanded"],controlLabels={},transitionDuration=250;xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");controls.updateState(false);var showTooltip=function(e,offsetElement){var left=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(stacked.x()(e.point,e.pointIndex)),y=yAxis.tickFormat()(stacked.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)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=stacked.xScale();y=stacked.yScale();var wrap=container.selectAll("g.nv-wrap.nv-stackedAreaChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var g=wrap.select("g");gEnter.append("rect").style("opacity",0);gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-stackedWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");gEnter.append("g").attr("class","nv-interactive");g.select("rect").attr("width",availableWidth).attr("height",availableHeight);if(showLegend){var legendWidth=showControls?availableWidth-controlWidth:availableWidth;legend.width(legendWidth);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}g.select(".nv-legendWrap").attr("transform","translate("+(availableWidth-legendWidth)+","+-margin.top+")")}if(showControls){var controlsData=[{key:controlLabels.stacked||"Stacked",metaKey:"Stacked",disabled:stacked.style()!="stack",style:"stack"},{key:controlLabels.stream||"Stream",metaKey:"Stream",disabled:stacked.style()!="stream",style:"stream"},{key:controlLabels.expanded||"Expanded",metaKey:"Expanded",disabled:stacked.style()!="expand",style:"expand"},{key:controlLabels.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:stacked.style()!="stack_percent",style:"stack_percent"}];controlWidth=cData.length/3*260;controlsData=controlsData.filter(function(d){return cData.indexOf(d.metaKey)!==-1});controls.width(controlWidth).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).call(controls);if(margin.top!=Math.max(controls.height(),legend.height())){margin.top=Math.max(controls.height(),legend.height());availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom}g.select(".nv-controlsWrap").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)")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}stacked.width(availableWidth).height(availableHeight);var stackedWrap=g.select(".nv-stackedWrap").datum(data);stackedWrap.transition().call(stacked);if(showXAxis){xAxis.scale(x).ticks(availableWidth/100).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+availableHeight+")");g.select(".nv-x.nv-axis").transition().duration(0).call(xAxis)}if(showYAxis){yAxis.scale(y).ticks(stacked.offset()=="wiggle"?0:availableHeight/36).tickSize(-availableWidth,0).setTickFormat(stacked.style()=="expand"||stacked.style()=="stack_percent"?d3.format("%"):yAxisTickFormat);g.select(".nv-y.nv-axis").transition().duration(0).call(yAxis)}stacked.dispatch.on("areaClick.toggle",function(e){if(data.filter(function(d){return!d.disabled}).length===1)data.forEach(function(d){d.disabled=false});else data.forEach(function(d,i){d.disabled=i!=e.seriesIndex});state.disabled=data.map(function(d){return!!d.disabled});dispatch.stateChange(state);chart.update()});legend.dispatch.on("stateChange",function(newState){state.disabled=newState.disabled;dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;stacked.style(d.style);state.style=stacked.style();dispatch.stateChange(state);chart.update()});interactiveLayer.dispatch.on("elementMousemove",function(e){stacked.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());stacked.highlightPoint(i,pointIndex,true);var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof singlePoint==="undefined")singlePoint=point;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex));var tooltipValue=stacked.style()=="expand"?point.display.y:chart.y()(point,pointIndex);allData.push({key:series.key,value:tooltipValue,color:color(series,series.seriesIndex),stackedValue:point.display})});allData.reverse();if(allData.length>2){var yValue=chart.yScale().invert(e.mouseY);var yDistMax=Infinity,indexToHighlight=null;allData.forEach(function(series,i){if(yValue>=series.stackedValue.y0&&yValue<=series.stackedValue.y0+series.stackedValue.y){indexToHighlight=i;return}});if(indexToHighlight!=null)allData[indexToHighlight].highlight=true}var xValue=xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));var valueFormatter=stacked.style()=="expand"?function(d,i){return d3.format(".1%")(d)}:function(d,i){return yAxis.tickFormat()(d)};interactiveLayer.tooltip.position({left:pointXLocation+margin.left,top:e.mouseY+margin.top}).chartContainer(that.parentNode).enabled(tooltips).valueFormatter(valueFormatter).data({value:xValue,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){dispatch.tooltipHide();stacked.clearHighlights()});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.style!=="undefined"){stacked.style(e.style)}chart.update()})});return chart}stacked.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top],dispatch.tooltipShow(e)});stacked.dispatch.on("tooltipHide",function(e){dispatch.tooltipHide(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.stacked=stacked;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.interactiveLayer=interactiveLayer;d3.rebind(chart,stacked,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);stacked.color(color);return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.useInteractiveGuideline=function(_){if(!arguments.length)return useInteractiveGuideline;useInteractiveGuideline=_;if(_===true){chart.interactive(false);chart.useVoronoi(false)}return chart};chart.tooltip=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};chart.controlsData=function(_){if(!arguments.length)return cData;cData=_;return chart};chart.controlLabels=function(_){if(!arguments.length)return controlLabels;if(typeof _!=="object")return controlLabels;controlLabels=_;return chart};yAxis.setTickFormat=yAxis.tickFormat;yAxis.tickFormat=function(_){if(!arguments.length)return yAxisTickFormat;yAxisTickFormat=_;return yAxis};return chart}}(); \ No newline at end of file +});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}chart.update()});x0=x.copy();y0=y.copy()});return chart}scatter.dispatch.on("elementMouseout.tooltip",function(e){dispatch.tooltipHide(e);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+scatter.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",distY.size())});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.scatter=scatter;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.distX=distX;chart.distY=distY;d3.rebind(chart,scatter,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);distX.color(color);distY.color(color);return chart};chart.showDistX=function(_){if(!arguments.length)return showDistX;showDistX=_;return chart};chart.showDistY=function(_){if(!arguments.length)return showDistY;showDistY=_;return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.fisheye=function(_){if(!arguments.length)return fisheye;fisheye=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltipXContent=function(_){if(!arguments.length)return tooltipX;tooltipX=_;return chart};chart.tooltipYContent=function(_){if(!arguments.length)return tooltipY;tooltipY=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};return chart};nv.models.sparkline=function(){"use strict";var margin={top:2,right:0,bottom:2,left:0},width=400,height=32,animate=true,x=d3.scale.linear(),y=d3.scale.linear(),getX=function(d){return d.x},getY=function(d){return d.y},color=nv.utils.getColor(["#000"]),xDomain,yDomain,xRange,yRange;function chart(selection){selection.each(function(data){var availableWidth=width-margin.left-margin.right,availableHeight=height-margin.top-margin.bottom,container=d3.select(this);x.domain(xDomain||d3.extent(data,getX)).range(xRange||[0,availableWidth]);y.domain(yDomain||d3.extent(data,getY)).range(yRange||[availableHeight,0]);var wrap=container.selectAll("g.nv-wrap.nv-sparkline").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var gEnter=wrapEnter.append("g");var g=wrap.select("g");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var paths=wrap.selectAll("path").data(function(d){return[d]});paths.enter().append("path");paths.exit().remove();paths.style("stroke",function(d,i){return d.color||color(d,i)}).attr("d",d3.svg.line().x(function(d,i){return x(getX(d,i))}).y(function(d,i){return y(getY(d,i))}));var points=wrap.selectAll("circle.nv-point").data(function(data){var yValues=data.map(function(d,i){return getY(d,i)});function pointIndex(index){if(index!=-1){var result=data[index];result.pointIndex=index;return result}else{return null}}var maxPoint=pointIndex(yValues.lastIndexOf(y.domain()[1])),minPoint=pointIndex(yValues.indexOf(y.domain()[0])),currentPoint=pointIndex(yValues.length-1);return[minPoint,maxPoint,currentPoint].filter(function(d){return d!=null})});points.enter().append("circle");points.exit().remove();points.attr("cx",function(d,i){return x(getX(d,d.pointIndex))}).attr("cy",function(d,i){return y(getY(d,d.pointIndex))}).attr("r",2).attr("class",function(d,i){return getX(d,d.pointIndex)==x.domain()[1]?"nv-point nv-currentValue":getY(d,d.pointIndex)==y.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return chart}chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.x=function(_){if(!arguments.length)return getX;getX=d3.functor(_);return chart};chart.y=function(_){if(!arguments.length)return getY;getY=d3.functor(_);return chart};chart.xScale=function(_){if(!arguments.length)return x;x=_;return chart};chart.yScale=function(_){if(!arguments.length)return y;y=_;return chart};chart.xDomain=function(_){if(!arguments.length)return xDomain;xDomain=_;return chart};chart.yDomain=function(_){if(!arguments.length)return yDomain;yDomain=_;return chart};chart.xRange=function(_){if(!arguments.length)return xRange;xRange=_;return chart};chart.yRange=function(_){if(!arguments.length)return yRange;yRange=_;return chart};chart.animate=function(_){if(!arguments.length)return animate;animate=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);return chart};return chart};nv.models.sparklinePlus=function(){"use strict";var sparkline=nv.models.sparkline();var margin={top:15,right:100,bottom:10,left:50},width=null,height=null,x,y,index=[],paused=false,xTickFormat=d3.format(",r"),yTickFormat=d3.format(",.2f"),showValue=true,alignValue=true,rightAlignValue=false,noData="No Data Available.";function chart(selection){selection.each(function(data){var container=d3.select(this);var availableWidth=(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;if(!data||!data.length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}var currentValue=sparkline.y()(data[data.length-1],data.length-1);x=sparkline.xScale();y=sparkline.yScale();var wrap=container.selectAll("g.nv-wrap.nv-sparklineplus").data([data]);var wrapEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus");var gEnter=wrapEnter.append("g");var g=wrap.select("g");gEnter.append("g").attr("class","nv-sparklineWrap");gEnter.append("g").attr("class","nv-valueWrap");gEnter.append("g").attr("class","nv-hoverArea");wrap.attr("transform","translate("+margin.left+","+margin.top+")");var sparklineWrap=g.select(".nv-sparklineWrap");sparkline.width(availableWidth).height(availableHeight);sparklineWrap.call(sparkline);var valueWrap=g.select(".nv-valueWrap");var value=valueWrap.selectAll(".nv-currentValue").data([currentValue]);value.enter().append("text").attr("class","nv-currentValue").attr("dx",rightAlignValue?-8:8).attr("dy",".9em").style("text-anchor",rightAlignValue?"end":"start");value.attr("x",availableWidth+(rightAlignValue?margin.right:0)).attr("y",alignValue?function(d){return y(d)}:0).style("fill",sparkline.color()(data[data.length-1],data.length-1)).text(yTickFormat(currentValue));gEnter.select(".nv-hoverArea").append("rect").on("mousemove",sparklineHover).on("click",function(){paused=!paused}).on("mouseout",function(){index=[];updateValueLine()});g.select(".nv-hoverArea rect").attr("transform",function(d){return"translate("+-margin.left+","+-margin.top+")"}).attr("width",availableWidth+margin.left+margin.right).attr("height",availableHeight+margin.top);function updateValueLine(){if(paused)return;var hoverValue=g.selectAll(".nv-hoverValue").data(index);var hoverEnter=hoverValue.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);hoverValue.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();hoverValue.attr("transform",function(d){return"translate("+x(sparkline.x()(data[d],d))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!index.length)return;hoverEnter.append("line").attr("x1",0).attr("y1",-margin.top).attr("x2",0).attr("y2",availableHeight);hoverEnter.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-margin.top).attr("text-anchor","end").attr("dy",".9em");g.select(".nv-hoverValue .nv-xValue").text(xTickFormat(sparkline.x()(data[index[0]],index[0])));hoverEnter.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-margin.top).attr("text-anchor","start").attr("dy",".9em");g.select(".nv-hoverValue .nv-yValue").text(yTickFormat(sparkline.y()(data[index[0]],index[0])))}function sparklineHover(){if(paused)return;var pos=d3.mouse(this)[0]-margin.left;function getClosestIndex(data,x){var distance=Math.abs(sparkline.x()(data[0],0)-x);var closestIndex=0;for(var i=0;i"+key+""+"

"+y+" on "+x+"

"},x,y,yAxisTickFormat=d3.format(",.2f"),state={style:stacked.style()},defaultState=null,noData="No Data Available.",dispatch=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),controlWidth=250,cData=["Stacked","Stream","Expanded"],controlLabels={},transitionDuration=250;xAxis.orient("bottom").tickPadding(7);yAxis.orient(rightAlignYAxis?"right":"left");controls.updateState(false);var showTooltip=function(e,offsetElement){var left=e.pos[0]+(offsetElement.offsetLeft||0),top=e.pos[1]+(offsetElement.offsetTop||0),x=xAxis.tickFormat()(stacked.x()(e.point,e.pointIndex)),y=yAxis.tickFormat()(stacked.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)};function chart(selection){selection.each(function(data){var container=d3.select(this),that=this;var availableWidth=(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().duration(transitionDuration).call(chart)};chart.container=this;state.disabled=data.map(function(d){return!!d.disabled});if(!defaultState){var key;defaultState={};for(key in state){if(state[key]instanceof Array)defaultState[key]=state[key].slice(0);else defaultState[key]=state[key]}}if(!data||!data.length||!data.filter(function(d){return d.values.length}).length){var noDataText=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){return d});return chart}else{container.selectAll(".nv-noData").remove()}x=stacked.xScale();y=stacked.yScale();var wrap=container.selectAll("g.nv-wrap.nv-stackedAreaChart").data([data]);var gEnter=wrap.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g");var g=wrap.select("g");gEnter.append("rect").style("opacity",0);gEnter.append("g").attr("class","nv-x nv-axis");gEnter.append("g").attr("class","nv-y nv-axis");gEnter.append("g").attr("class","nv-stackedWrap");gEnter.append("g").attr("class","nv-legendWrap");gEnter.append("g").attr("class","nv-controlsWrap");gEnter.append("g").attr("class","nv-interactive");g.select("rect").attr("width",availableWidth).attr("height",availableHeight);if(showLegend){var legendWidth=showControls?availableWidth-controlWidth:availableWidth;legend.width(legendWidth);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}g.select(".nv-legendWrap").attr("transform","translate("+(availableWidth-legendWidth)+","+-margin.top+")")}if(showControls){var controlsData=[{key:controlLabels.stacked||"Stacked",metaKey:"Stacked",disabled:stacked.style()!="stack",style:"stack"},{key:controlLabels.stream||"Stream",metaKey:"Stream",disabled:stacked.style()!="stream",style:"stream"},{key:controlLabels.expanded||"Expanded",metaKey:"Expanded",disabled:stacked.style()!="expand",style:"expand"},{key:controlLabels.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:stacked.style()!="stack_percent",style:"stack_percent"}];controlWidth=cData.length/3*260;controlsData=controlsData.filter(function(d){return cData.indexOf(d.metaKey)!==-1});controls.width(controlWidth).color(["#444","#444","#444"]);g.select(".nv-controlsWrap").datum(controlsData).call(controls);if(margin.top!=Math.max(controls.height(),legend.height())){margin.top=Math.max(controls.height(),legend.height());availableHeight=(height||parseInt(container.style("height"))||400)-margin.top-margin.bottom}g.select(".nv-controlsWrap").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)")}if(useInteractiveGuideline){interactiveLayer.width(availableWidth).height(availableHeight).margin({left:margin.left,top:margin.top}).svgContainer(container).xScale(x);wrap.select(".nv-interactive").call(interactiveLayer)}stacked.width(availableWidth).height(availableHeight);var stackedWrap=g.select(".nv-stackedWrap").datum(data);stackedWrap.transition().call(stacked);if(showXAxis){xAxis.scale(x).ticks(availableWidth/100).tickSize(-availableHeight,0);g.select(".nv-x.nv-axis").attr("transform","translate(0,"+availableHeight+")");g.select(".nv-x.nv-axis").transition().duration(0).call(xAxis)}if(showYAxis){yAxis.scale(y).ticks(stacked.offset()=="wiggle"?0:availableHeight/36).tickSize(-availableWidth,0).setTickFormat(stacked.style()=="expand"||stacked.style()=="stack_percent"?d3.format("%"):yAxisTickFormat);g.select(".nv-y.nv-axis").transition().duration(0).call(yAxis)}stacked.dispatch.on("areaClick.toggle",function(e){if(data.filter(function(d){return!d.disabled}).length===1)data.forEach(function(d){d.disabled=false});else data.forEach(function(d,i){d.disabled=i!=e.seriesIndex});state.disabled=data.map(function(d){return!!d.disabled});dispatch.stateChange(state);chart.update()});legend.dispatch.on("stateChange",function(newState){state.disabled=newState.disabled;dispatch.stateChange(state);chart.update()});controls.dispatch.on("legendClick",function(d,i){if(!d.disabled)return;controlsData=controlsData.map(function(s){s.disabled=true;return s});d.disabled=false;stacked.style(d.style);state.style=stacked.style();dispatch.stateChange(state);chart.update()});interactiveLayer.dispatch.on("elementMousemove",function(e){stacked.clearHighlights();var singlePoint,pointIndex,pointXLocation,allData=[];data.filter(function(series,i){series.seriesIndex=i;return!series.disabled}).forEach(function(series,i){pointIndex=nv.interactiveBisect(series.values,e.pointXValue,chart.x());stacked.highlightPoint(i,pointIndex,true);var point=series.values[pointIndex];if(typeof point==="undefined")return;if(typeof singlePoint==="undefined")singlePoint=point;if(typeof pointXLocation==="undefined")pointXLocation=chart.xScale()(chart.x()(point,pointIndex));var tooltipValue=stacked.style()=="expand"?point.display.y:chart.y()(point,pointIndex);allData.push({key:series.key,value:tooltipValue,color:color(series,series.seriesIndex),stackedValue:point.display})});allData.reverse();if(allData.length>2){var yValue=chart.yScale().invert(e.mouseY);var yDistMax=Infinity,indexToHighlight=null;allData.forEach(function(series,i){if(yValue>=series.stackedValue.y0&&yValue<=series.stackedValue.y0+series.stackedValue.y){indexToHighlight=i;return}});if(indexToHighlight!=null)allData[indexToHighlight].highlight=true}var xValue=xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));var valueFormatter=stacked.style()=="expand"?function(d,i){return d3.format(".1%")(d)}:function(d,i){return yAxis.tickFormat()(d)};interactiveLayer.tooltip.position({left:pointXLocation+margin.left,top:e.mouseY+margin.top}).chartContainer(that.parentNode).enabled(tooltips).valueFormatter(valueFormatter).data({value:xValue,series:allData})();interactiveLayer.renderGuideLine(pointXLocation)});interactiveLayer.dispatch.on("elementMouseout",function(e){dispatch.tooltipHide();stacked.clearHighlights()});dispatch.on("tooltipShow",function(e){if(tooltips)showTooltip(e,that.parentNode)});dispatch.on("changeState",function(e){if(typeof e.disabled!=="undefined"&&data.length===e.disabled.length){data.forEach(function(series,i){series.disabled=e.disabled[i]});state.disabled=e.disabled}if(typeof e.style!=="undefined"){stacked.style(e.style)}chart.update()})});return chart}stacked.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+margin.left,e.pos[1]+margin.top],dispatch.tooltipShow(e)});stacked.dispatch.on("tooltipHide",function(e){dispatch.tooltipHide(e)});dispatch.on("tooltipHide",function(){if(tooltips)nv.tooltip.cleanup()});chart.dispatch=dispatch;chart.stacked=stacked;chart.legend=legend;chart.controls=controls;chart.xAxis=xAxis;chart.yAxis=yAxis;chart.interactiveLayer=interactiveLayer;d3.rebind(chart,stacked,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");chart.options=nv.utils.optionsFunc.bind(chart);chart.margin=function(_){if(!arguments.length)return margin;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;return chart};chart.width=function(_){if(!arguments.length)return width;width=_;return chart};chart.height=function(_){if(!arguments.length)return height;height=_;return chart};chart.color=function(_){if(!arguments.length)return color;color=nv.utils.getColor(_);legend.color(color);stacked.color(color);return chart};chart.showControls=function(_){if(!arguments.length)return showControls;showControls=_;return chart};chart.showLegend=function(_){if(!arguments.length)return showLegend;showLegend=_;return chart};chart.showXAxis=function(_){if(!arguments.length)return showXAxis;showXAxis=_;return chart};chart.showYAxis=function(_){if(!arguments.length)return showYAxis;showYAxis=_;return chart};chart.rightAlignYAxis=function(_){if(!arguments.length)return rightAlignYAxis;rightAlignYAxis=_;yAxis.orient(_?"right":"left");return chart};chart.useInteractiveGuideline=function(_){if(!arguments.length)return useInteractiveGuideline;useInteractiveGuideline=_;if(_===true){chart.interactive(false);chart.useVoronoi(false)}return chart};chart.tooltip=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.tooltips=function(_){if(!arguments.length)return tooltips;tooltips=_;return chart};chart.tooltipContent=function(_){if(!arguments.length)return tooltip;tooltip=_;return chart};chart.state=function(_){if(!arguments.length)return state;state=_;return chart};chart.defaultState=function(_){if(!arguments.length)return defaultState;defaultState=_;return chart};chart.noData=function(_){if(!arguments.length)return noData;noData=_;return chart};chart.transitionDuration=function(_){if(!arguments.length)return transitionDuration;transitionDuration=_;return chart};chart.controlsData=function(_){if(!arguments.length)return cData;cData=_;return chart};chart.controlLabels=function(_){if(!arguments.length)return controlLabels;if(typeof _!=="object")return controlLabels;controlLabels=_;return chart};yAxis.setTickFormat=yAxis.tickFormat;yAxis.tickFormat=function(_){if(!arguments.length)return yAxisTickFormat;yAxisTickFormat=_;return yAxis};return chart}}(); \ No newline at end of file