diff --git a/.gitignore b/.gitignore index b5a9cc2..99eb693 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ _site ehthumbs.db Icon? Thumbs.db +# nodejs packages # +###################### +node_modules diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..66d7029 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "asi": true +} diff --git a/GruntFile.js b/GruntFile.js new file mode 100644 index 0000000..9874f5d --- /dev/null +++ b/GruntFile.js @@ -0,0 +1,87 @@ +module.exports = function(grunt) { + + //Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + concat: { + options: { + separator: '' + }, + dist: { + src: [ + 'src/intro.js', + 'src/core.js', + 'src/tooltip.js', + 'src/utils.js', + 'src/models/axis.js', + 'src/models/historicalBar.js', + 'src/models/bullet.js', + 'src/models/bulletChart.js', + 'src/models/cumulativeLineChart.js', + 'src/models/discreteBar.js', + 'src/models/discreteBarChart.js', + 'src/models/distribution.js', + 'src/models/indentedTree.js', + 'src/models/legend.js', + 'src/models/line.js', + 'src/models/lineChart.js', + 'src/models/linePlusBarChart.js', + 'src/models/lineWithFocusChart.js', + 'src/models/linePlusBarWithFocusChart.js', + 'src/models/multiBar.js', + 'src/models/multiBarChart.js', + 'src/models/multiBarHorizontal.js', + 'src/models/multiBarHorizontalChart.js', + 'src/models/multiChart.js', + 'src/models/ohlcBar.js', + 'src/models/pie.js', + 'src/models/pieChart.js', + 'src/models/scatter.js', + 'src/models/scatterChart.js', + 'src/models/scatterPlusLineChart.js', + 'src/models/sparkline.js', + 'src/models/sparklinePlus.js', + 'src/models/stackedArea.js', + 'src/models/stackedAreaChart.js', + 'src/outro.js' + ], + dest: 'nv.d3.js' + } + }, + uglify: { + options: { + banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %> */' + }, + js: { + files: { + 'nv.d3.min.js': ['nv.d3.js'] + } + } + }, + jshint: { + foo: { + src: "src/**/*.js" + }, + options: { + jshintrc: '.jshintrc' + } + }, + watch: { + js: { + files: ["src/**/*.js"], + tasks: ['concat'] + } + }, + + }); + + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + + grunt.registerTask('default', ['concat']); + grunt.registerTask('production', ['concat', 'uglify']); + grunt.registerTask('lint', ['jshint']); +}; diff --git a/README.md b/README.md index f4a2137..e3472fa 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,19 @@ fork's root directory will rebuild both `nv.d3.js` and `nv.d3.min.js`. Without UglifyJS, you won't get the minified version when running make. +## use grunt + +You can use grunt insteadof makefile to build js file. See more about [grunt](http://gruntjs.com/). +***[Nodejs](http://nodejs.org/) must be installed before you can use grunt.*** +Run `npm install` in root dir to install grunt and it's dependencies. + +Then, you can use these commands: + + grunt # build nv.d3.js + grunt production # build nv.d3.js and nv.d3.min.js + grunt watch # watch file changes in src/, and rebuild nv.d3.js, it's very helpful when delevop nvd3 + grunt lint # run jshint on src/**/*.js + **We ask that you DO NOT minify pull requests... If you need to minify please build pull request in separate branch, and merge and minify in your master. diff --git a/nv.d3.js b/nv.d3.js index e405d2e..4b4c630 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -3147,323 +3147,324 @@ nv.models.distribution = function() { return chart; } -nv.models.indentedTree = function() { - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div - , width = 960 - , height = 500 - , color = nv.utils.defaultColor() - , id = Math.floor(Math.random() * 10000) - , header = true - , filterZero = false - , noData = "No Data Available." - , childIndent = 20 - , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this - , tableClass = null - , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images - , iconClose = 'images/grey-minus.png' - , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') - ; - - //============================================================ - - var idx = 0; - - function chart(selection) { - selection.each(function(data) { - var depth = 1, - container = d3.select(this); - - var tree = d3.layout.tree() - .children(function(d) { return d.values }) - .size([height, childIndent]); //Not sure if this is needed now that the result is HTML - - chart.update = function() { container.transition().duration(600).call(chart) }; - - - //------------------------------------------------------------ - // Display No Data message if there's nothing to show. - if (!data[0]) data[0] = {key: noData}; - - //------------------------------------------------------------ - - - var nodes = tree.nodes(data[0]); - - // nodes.map(function(d) { - // d.id = i++; - // }) - - //------------------------------------------------------------ - // Setup containers and skeleton of chart - - var wrap = d3.select(this).selectAll('div').data([[nodes]]); - var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); - var tableEnter = wrapEnter.append('table'); - var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); - - //------------------------------------------------------------ - - - if (header) { - var thead = tableEnter.append('thead'); - - var theadRow1 = thead.append('tr'); - - columns.forEach(function(column) { - theadRow1 - .append('th') - .attr('width', column.width ? column.width : '10%') - .style('text-align', column.type == 'numeric' ? 'right' : 'left') - .append('span') - .text(column.label); - }); - } - - - var tbody = table.selectAll('tbody') - .data(function(d) { return d }); - tbody.enter().append('tbody'); - - - - //compute max generations - depth = d3.max(nodes, function(node) { return node.depth }); - tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all - - - // Update the nodes… - var node = tbody.selectAll('tr') - // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); - .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); - //.style('display', 'table-row'); //TODO: see if this does anything - - node.exit().remove(); - - node.select('img.nv-treeicon') - .attr('src', icon) - .classed('folded', folded); - - var nodeEnter = node.enter().append('tr'); - - - columns.forEach(function(column, index) { - - var nodeName = nodeEnter.append('td') - .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here - .style('text-align', column.type == 'numeric' ? 'right' : 'left'); - - - if (index == 0) { - nodeName.append('img') - .classed('nv-treeicon', true) - .classed('nv-folded', folded) - .attr('src', icon) - .style('width', '14px') - .style('height', '14px') - .style('padding', '0 1px') - .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) - .on('click', click); - } - - - nodeName.append('span') - .attr('class', d3.functor(column.classes) ) - .text(function(d) { return column.format ? column.format(d) : - (d[column.key] || '-') }); - - if (column.showCount) { - nodeName.append('span') - .attr('class', 'nv-childrenCount'); - - node.selectAll('span.nv-childrenCount').text(function(d) { - return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent - '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter - || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... - || 0) + ')' //This is the catch-all in case there are no children after a filter - : '' //If this is not a parent, just give an empty string - }); - } - - if (column.click) - nodeName.select('span').on('click', column.click); - - }); - - node - .order() - .on('click', function(d) { - dispatch.elementClick({ - row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) - data: d, - pos: [d.x, d.y] - }); - }) - .on('dblclick', function(d) { - dispatch.elementDblclick({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }) - .on('mouseover', function(d) { - dispatch.elementMouseover({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }) - .on('mouseout', function(d) { - dispatch.elementMouseout({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }); - - - - - // Toggle children on click. - function click(d, _, unshift) { - d3.event.stopPropagation(); - - if(d3.event.shiftKey && !unshift) { - //If you shift-click, it'll toggle fold all the children, instead of itself - d3.event.shiftKey = false; - d.values && d.values.forEach(function(node){ - if (node.values || node._values) { - click(node, 0, true); - } - }); - return true; - } - if(!hasChildren(d)) { - //download file - //window.location.href = d.url; - return true; - } - if (d.values) { - d._values = d.values; - d.values = null; - } else { - d.values = d._values; - d._values = null; - } - chart.update(); - } - - - function icon(d) { - return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; - } - - function folded(d) { - return (d._values && d._values.length); - } - - function hasChildren(d) { - var values = d.values || d._values; - - return (values && values.length); - } - - - }); - - return chart; - } - - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - 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(_); - scatter.color(color); - return chart; - }; - - chart.id = function(_) { - if (!arguments.length) return id; - id = _; - return chart; - }; - - chart.header = function(_) { - if (!arguments.length) return header; - header = _; - return chart; - }; - - chart.noData = function(_) { - if (!arguments.length) return noData; - noData = _; - return chart; - }; - - chart.filterZero = function(_) { - if (!arguments.length) return filterZero; - filterZero = _; - return chart; - }; - - chart.columns = function(_) { - if (!arguments.length) return columns; - columns = _; - return chart; - }; - - chart.tableClass = function(_) { - if (!arguments.length) return tableClass; - tableClass = _; - return chart; - }; - - chart.iconOpen = function(_){ - if (!arguments.length) return iconOpen; - iconOpen = _; - return chart; - } - - chart.iconClose = function(_){ - if (!arguments.length) return iconClose; - iconClose = _; - return chart; - } - - //============================================================ - - - return chart; -};nv.models.legend = function() { +nv.models.indentedTree = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() + , id = Math.floor(Math.random() * 10000) + , header = true + , filterZero = false + , noData = "No Data Available." + , childIndent = 20 + , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this + , tableClass = null + , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images + , iconClose = 'images/grey-minus.png' + , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + var idx = 0; + + function chart(selection) { + selection.each(function(data) { + var depth = 1, + container = d3.select(this); + + var tree = d3.layout.tree() + .children(function(d) { return d.values }) + .size([height, childIndent]); //Not sure if this is needed now that the result is HTML + + chart.update = function() { container.transition().duration(600).call(chart) }; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + if (!data[0]) data[0] = {key: noData}; + + //------------------------------------------------------------ + + + var nodes = tree.nodes(data[0]); + + // nodes.map(function(d) { + // d.id = i++; + // }) + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('div').data([[nodes]]); + var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); + var tableEnter = wrapEnter.append('table'); + var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); + + //------------------------------------------------------------ + + + if (header) { + var thead = tableEnter.append('thead'); + + var theadRow1 = thead.append('tr'); + + columns.forEach(function(column) { + theadRow1 + .append('th') + .attr('width', column.width ? column.width : '10%') + .style('text-align', column.type == 'numeric' ? 'right' : 'left') + .append('span') + .text(column.label); + }); + } + + + var tbody = table.selectAll('tbody') + .data(function(d) { return d }); + tbody.enter().append('tbody'); + + + + //compute max generations + depth = d3.max(nodes, function(node) { return node.depth }); + tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all + + + // Update the nodes… + var node = tbody.selectAll('tr') + // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); + .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); + //.style('display', 'table-row'); //TODO: see if this does anything + + node.exit().remove(); + + node.select('img.nv-treeicon') + .attr('src', icon) + .classed('folded', folded); + + var nodeEnter = node.enter().append('tr'); + + + columns.forEach(function(column, index) { + + var nodeName = nodeEnter.append('td') + .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here + .style('text-align', column.type == 'numeric' ? 'right' : 'left'); + + + if (index == 0) { + nodeName.append('img') + .classed('nv-treeicon', true) + .classed('nv-folded', folded) + .attr('src', icon) + .style('width', '14px') + .style('height', '14px') + .style('padding', '0 1px') + .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) + .on('click', click); + } + + + nodeName.append('span') + .attr('class', d3.functor(column.classes) ) + .text(function(d) { return column.format ? column.format(d) : + (d[column.key] || '-') }); + + if (column.showCount) { + nodeName.append('span') + .attr('class', 'nv-childrenCount'); + + node.selectAll('span.nv-childrenCount').text(function(d) { + return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent + '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter + || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... + || 0) + ')' //This is the catch-all in case there are no children after a filter + : '' //If this is not a parent, just give an empty string + }); + } + + if (column.click) + nodeName.select('span').on('click', column.click); + + }); + + node + .order() + .on('click', function(d) { + dispatch.elementClick({ + row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) + data: d, + pos: [d.x, d.y] + }); + }) + .on('dblclick', function(d) { + dispatch.elementDblclick({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }); + + + + + // Toggle children on click. + function click(d, _, unshift) { + d3.event.stopPropagation(); + + if(d3.event.shiftKey && !unshift) { + //If you shift-click, it'll toggle fold all the children, instead of itself + d3.event.shiftKey = false; + d.values && d.values.forEach(function(node){ + if (node.values || node._values) { + click(node, 0, true); + } + }); + return true; + } + if(!hasChildren(d)) { + //download file + //window.location.href = d.url; + return true; + } + if (d.values) { + d._values = d.values; + d.values = null; + } else { + d.values = d._values; + d._values = null; + } + chart.update(); + } + + + function icon(d) { + return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; + } + + function folded(d) { + return (d._values && d._values.length); + } + + function hasChildren(d) { + var values = d.values || d._values; + + return (values && values.length); + } + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + 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(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.header = function(_) { + if (!arguments.length) return header; + header = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.filterZero = function(_) { + if (!arguments.length) return filterZero; + filterZero = _; + return chart; + }; + + chart.columns = function(_) { + if (!arguments.length) return columns; + columns = _; + return chart; + }; + + chart.tableClass = function(_) { + if (!arguments.length) return tableClass; + tableClass = _; + return chart; + }; + + chart.iconOpen = function(_){ + if (!arguments.length) return iconOpen; + iconOpen = _; + return chart; + } + + chart.iconClose = function(_){ + if (!arguments.length) return iconClose; + iconClose = _; + return chart; + } + + //============================================================ + + + return chart; +}; +nv.models.legend = function() { //============================================================ // Public Variables with Default Settings diff --git a/nv.d3.min.js b/nv.d3.min.js index 21c8778..a35c685 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,5 +1,6 @@ -(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o1)while(o=document.body.scrollWidth?h:h-16,c=window.innerHeight>=document.body.scrollHeight?c:c-16;var g=function(e){var t=m;do isNaN(e.offsetTop)||(t+=e.offsetTop);while(e=e.offsetParent);return t},y=function(e){var t=v;do isNaN(e.offsetLeft)||(t+=e.offsetLeft);while(e=e.offsetParent);return t};switch(r){case"e":v=t[0]-l-i,m=t[1]-f/2;var b=y(u),w=g(u);bd?t[0]+i:d-b+v),wp+h&&(m=p+h-w+m-f);break;case"w":v=t[0]+i,m=t[1]-f/2,b+l>c&&(v=t[0]-l-i),wp+h&&(m=p-f-5);break;case"n":v=t[0]-l/2-5,m=t[1]+i;var b=y(u),w=g(u);bc&&(v=v-l/2+5),w+f>p+h&&(m=p+h-w+m-f);break;case"s":v=t[0]-l/2,m=t[1]-f-i;var b=y(u),w=g(u);bc&&(v=v-l/2+5),p>w&&(m=p)}return u.style.left=v+"px",u.style.top=m+"px",u.style.opacity=1,u.style.position="absolute",u.style.pointerEvents="none",u},t.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.models.axis=function(){function d(r){return r.each(function(r){var d=d3.select(this),v=d.selectAll("g.nv-wrap.nv-axis").data([r]),m=v.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),g=m.append("g"),y=v.select("g");h!==null?e.ticks(h):(e.orient()=="top"||e.orient()=="bottom")&&e.ticks(Math.abs(i.range()[1]-i.range()[0])/100),d3.transition(y).call(e),p=p||e.scale();var b=e.tickFormat();b==null&&(b=p.tickFormat());var w=y.selectAll("text.nv-axislabel").data([s||null]);w.exit().remove();switch(e.orient()){case"top":w.enter().append("text").attr("class","nv-axislabel");var E=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);w.attr("text-anchor","middle").attr("y",0).attr("x",E/2);if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text"),S.exit().remove(),S.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var x=36,T=30,N=y.selectAll("g").select("text");if(a%360){N.each(function(e,t){var n=this.getBBox().width;n>T&&(T=n)});var C=Math.abs(Math.sin(a*Math.PI/180)),x=(C?C*T:T)+30;N.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).attr("text-anchor",a%360>0?"start":"end")}w.enter().append("text").attr("class","nv-axislabel");var E=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);w.attr("text-anchor","middle").attr("y",x).attr("x",E/2);if(o){var S=v.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);S.enter().append("g").attr("class","nv-axisMaxMin").append("text"),S.exit().remove(),S.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).attr("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}l&&N.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":w.enter().append("text").attr("class","nv-axislabel"),w.attr("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),S.exit().remove(),S.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).attr("text-anchor","start").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":w.enter().append("text").attr("class","nv-axislabel"),w.attr("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+12:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var S=v.selectAll("g.nv-axisMaxMin").data(i.domain());S.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),S.exit().remove(),S.attr("transform",function(e,t){return"translate(0,"+p(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=b(e);return(""+n).match("NaN")?"":n}),d3.transition(S).attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}}w.text(function(e){return e}),o&&(e.orient()==="left"||e.orient()==="right")&&(y.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);if(i(e)i.range()[0]-10)(e>1e-10||e<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0)}),i.domain()[0]==i.domain()[1]&&i.domain()[0]==0&&v.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(o&&(e.orient()==="top"||e.orient()==="bottom")){var k=[];v.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?k.push(i(e)-this.getBBox().width-4):k.push(i(e)+this.getBBox().width+4)}catch(n){t?k.push(i(e)-4):k.push(i(e)+4)}}),y.selectAll("g").each(function(e,t){if(i(e)k[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}u&&y.selectAll("line.tick").filter(function(e){return!parseFloat(Math.round(e*1e5)/1e6)}).classed("zero",!0),p=i.copy()}),d}var e=d3.svg.axis(),t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=!0,u=!0,a=0,f=!0,l=!1,c=!1,h=null;e.scale(i).orient("bottom").tickFormat(function(e){return e});var p;return d.axis=e,d3.rebind(d,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(d,i,"domain","range","rangeBand","rangeBands"),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.ticks=function(e){return arguments.length?(h=e,d):h},d.height=function(e){return arguments.length?(r=e,d):r},d.axisLabel=function(e){return arguments.length?(s=e,d):s},d.showMaxMin=function(e){return arguments.length?(o=e,d):o},d.highlightZero=function(e){return arguments.length?(u=e,d):u},d.scale=function(t){return arguments.length?(i=t,e.scale(i),c=typeof i.rangeBands=="function",d3.rebind(d,i,"domain","range","rangeBand","rangeBands"),d):i},d.rotateYLabel=function(e){return arguments.length?(f=e,d):f},d.rotateLabels=function(e){return arguments.length?(a=e,d):a},d.staggerLabels=function(e){return arguments.length?(l=e,d):l},d},e.models.historicalBar=function(){function g(e){return e.each(function(e){var g=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);s.domain(d||d3.extent(e[0].values.map(u).concat(f))),c?s.range([g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range([0,g]),o.domain(v||d3.extent(e[0].values.map(a).concat(l))).range([b,0]);if(s.domain()[0]===s.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var E=w.selectAll("g.nv-wrap.nv-bar").data([e[0].values]),S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),T=S.append("defs"),N=S.append("g"),C=E.select("g");N.append("g").attr("class","nv-bars"),E.attr("transform","translate("+t.left+","+t.top+")"),w.on("click",function(e,t){m.chartClick({data:e,index:t,pos:d3.event,id:i})}),T.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),E.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",b),C.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var k=E.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e});k.exit().remove();var L=k.enter().append("rect").attr("x",0).attr("y",function(e,t){return o(Math.max(0,a(e,t)))}).attr("height",function(e,t){return Math.abs(o(a(e,t))-o(0))}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),m.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),m.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){m.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){m.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});k.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(t,n){return"translate("+(s(u(t,n))-g/e[0].values.length*.45)+",0)"}).attr("width",g/e[0].values.length*.9),d3.transition(k).attr("y",function(e,t){return a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t))}).attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!1,h=!0,p=e.utils.defaultColor(),d,v,m=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return g.dispatch=m,g.x=function(e){return arguments.length?(u=e,g):u},g.y=function(e){return arguments.length?(a=e,g):a},g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.xScale=function(e){return arguments.length?(s=e,g):s},g.yScale=function(e){return arguments.length?(o=e,g):o},g.xDomain=function(e){return arguments.length?(d=e,g):d},g.yDomain=function(e){return arguments.length?(v=e,g):v},g.forceX=function(e){return arguments.length?(f=e,g):f},g.forceY=function(e){return arguments.length?(l=e,g):l},g.padData=function(e){return arguments.length?(c=e,g):c},g.clipEdge=function(e){return arguments.length?(h=e,g):h},g.color=function(t){return arguments.length?(p=e.utils.getColor(t),g):p},g.id=function(e){return arguments.length?(i=e,g):i},g},e.models.bullet=function(){function p(e){return e.each(function(e,n){var l=a-t.left-t.right,p=f-t.top-t.bottom,d=d3.select(this),v=i.call(this,e,n).slice().sort(d3.descending),m=s.call(this,e,n).slice().sort(d3.descending),g=o.call(this,e,n).slice().sort(d3.descending),y=d3.scale.linear().domain(d3.extent(d3.merge([u,v]))).range(r?[l,0]:[0,l]),b=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(y.range());this.__chart__=y;var w=d3.min(v),E=d3.max(v),S=v[1],x=d.selectAll("g.nv-wrap.nv-bullet").data([e]),T=x.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),N=T.append("g"),C=x.select("g");N.append("rect").attr("class","nv-range nv-rangeMax"),N.append("rect").attr("class","nv-range nv-rangeAvg"),N.append("rect").attr("class","nv-range nv-rangeMin"),N.append("rect").attr("class","nv-measure"),N.append("path").attr("class","nv-markerTriangle"),x.attr("transform","translate("+t.left+","+t.top+")");var k=function(e){return Math.abs(b(e)-b(0))},L=function(e){return Math.abs(y(e)-y(0))},A=function(e){return e<0?b(e):b(0)},O=function(e){return e<0?y(e):y(0)};C.select("rect.nv-rangeMax").attr("height",p).attr("width",L(E>0?E:w)).attr("x",O(E>0?E:w)).datum(E>0?E:w),C.select("rect.nv-rangeAvg").attr("height",p).attr("width",L(S)).attr("x",O(S)).datum(S),C.select("rect.nv-rangeMin").attr("height",p).attr("width",L(E)).attr("x",O(E)).attr("width",L(E>0?w:E)).attr("x",O(E>0?w:E)).datum(E>0?w:E),C.select("rect.nv-measure").style("fill",c).attr("height",p/3).attr("y",p/3).attr("width",g<0?y(0)-y(g[0]):y(g[0])-y(0)).attr("x",O(g)).on("mouseover",function(){h.elementMouseover({value:g[0],label:"Current",pos:[y(g[0]),p/2]})}).on("mouseout",function(){h.elementMouseout({value:g[0],label:"Current"})});var M=p/6;m[0]?C.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+y(m[0])+","+p/2+")"}).attr("d","M0,"+M+"L"+M+","+ -M+" "+ -M+","+ -M+"Z").on("mouseover",function(){h.elementMouseover({value:m[0],label:"Previous",pos:[y(m[0]),p/2]})}).on("mouseout",function(){h.elementMouseout({value:m[0],label:"Previous"})}):C.selectAll("path.nv-markerTriangle").remove(),x.selectAll(".nv-range").on("mouseover",function(e,t){var n=t?t==1?"Mean":"Minimum":"Maximum";h.elementMouseover({value:e,label:n,pos:[y(e),p/2]})}).on("mouseout",function(e,t){var n=t?t==1?"Mean":"Minimum":"Maximum";h.elementMouseout({value:e,label:n})})}),p}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=[0],a=380,f=30,l=null,c=e.utils.getColor(["#1f77b4"]),h=d3.dispatch("elementMouseover","elementMouseout");return p.dispatch=h,p.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",p):n},p.ranges=function(e){return arguments.length?(i=e,p):i},p.markers=function(e){return arguments.length?(s=e,p):s},p.measures=function(e){return arguments.length?(o=e,p):o},p.forceX=function(e){return arguments.length?(u=e,p):u},p.width=function(e){return arguments.length?(a=e,p):a},p.height=function(e){return arguments.length?(f=e,p):f},p.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,p):t},p.tickFormat=function(e){return arguments.length?(l=e,p):l},p.color=function(t){return arguments.length?(c=e.utils.getColor(t),p):c},p},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=data[0].title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"

"+t+"

"+"

"+n+"

"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function N(e){return e.each(function(d){function D(e,t){d3.select(N.container).style("cursor","ew-resize")}function P(e,t){x.x=d3.event.x,x.i=Math.round(S.invert(x.x)),V()}function H(e,t){d3.select(N.container).style("cursor","auto"),y.index=x.i,E.stateChange(y)}function V(){X.data([x]),N.update()}var k=d3.select(this).classed("nv-chart-"+g,!0),L=this,A=(a||parseInt(k.style("width"))||960)-o.left-o.right,O=(f||parseInt(k.style("height"))||400)-o.top-o.bottom;N.update=function(){N(e)},N.container=this,y.disabled=d.map(function(e){return!!e.disabled});if(!b){var M;b={};for(M in y)y[M]instanceof Array?b[M]=y[M].slice(0):b[M]=y[M]}var _=d3.behavior.drag().on("dragstart",D).on("drag",P).on("dragend",H);if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var B=k.selectAll(".nv-noData").data([w]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",o.left+A/2).attr("y",o.top+O/2).text(function(e){return e}),N}k.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();if(!p){var j=d.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return r[0]<-0.95&&(r[0]=-0.95),[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),F=[d3.min(j,function(e){return e[0]}),d3.max(j,function(e){return e[1]})];t.yDomain(F)}else t.yDomain(null);S.domain([0,d[0].values.length-1]).range([0,A]).clamp(!0);var d=C(x.i,d),I=k.selectAll("g.nv-wrap.nv-cumulativeLine").data([d]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),R=I.select("g");q.append("g").attr("class","nv-x nv-axis"),q.append("g").attr("class","nv-y nv-axis"),q.append("g").attr("class","nv-background"),q.append("g").attr("class","nv-linesWrap"),q.append("g").attr("class","nv-legendWrap"),q.append("g").attr("class","nv-controlsWrap"),l&&(i.width(A),R.select(".nv-legendWrap").datum(d).call(i),o.top!=i.height()&&(o.top=i.height(),O=(f||parseInt(k.style("height"))||400)-o.top-o.bottom),R.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")"));if(h){var U=[{key:"Re-scale y-axis",disabled:!p}];s.width(140).color(["#444","#444","#444"]),R.select(".nv-controlsWrap").datum(U).attr("transform","translate(0,"+ -o.top+")").call(s)}I.attr("transform","translate("+o.left+","+o.top+")");var z=d.filter(function(e){return e.tempDisabled});I.select(".tempDisabled").remove(),z.length&&I.append("text").attr("class","tempDisabled").attr("x",A/2).attr("y","-.71em").style("text-anchor","end").text(z.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period."),q.select(".nv-background").append("rect"),R.select(".nv-background rect").attr("width",A).attr("height",O),t.y(function(e){return e.display.y}).width(A).height(O).color(d.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!d[t].disabled&&!d[t].tempDisabled}));var W=R.select(".nv-linesWrap").datum(d.filter(function(e){return!e.disabled&&!e.tempDisabled}));W.call(t);var X=W.selectAll(".nv-indexLine").data([x]);X.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(_),X.attr("transform",function(e){return"translate("+S(e.i)+",0)"}).attr("height",O),n.scale(v).ticks(Math.min(d[0].values.length,A/70)).tickSize(-O,0),R.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),d3.transition(R.select(".nv-x.nv-axis")).call(n),r.scale(m).ticks(O/36).tickSize(-A,0),d3.transition(R.select(".nv-y.nv-axis")).call(r),R.select(".nv-background rect").on("click",function(){x.x=d3.mouse(this)[0],x.i=Math.round(S.invert(x.x)),y.index=x.i,E.stateChange(y),V()}),t.dispatch.on("elementClick",function(e){x.i=e.pointIndex,x.x=S(x.i),y.index=x.i,E.stateChange(y),V()}),s.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,p=!t.disabled,y.rescaleY=p,E.stateChange(y),e.call(N)}),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1),e}),y.disabled=d.map(function(e){return!!e.disabled}),E.stateChange(y),e.call(N)}),E.on("tooltipShow",function(e){c&&T(e,L.parentNode)}),E.on("changeState",function(t){typeof t.disabled!="undefined"&&(d.forEach(function(e,n){e.disabled=t.disabled[n]}),y.disabled=t.disabled),typeof t.index!="undefined"&&(x.i=t.index,x.x=S(x.i),y.index=t.index,X.data([x])),typeof t.rescaleY!="undefined"&&(p=t.rescaleY),e.call(N)})}),N}function C(e,n){return n.map(function(n,r){var i=t.y()(n.values[e],e);return i<-0.95?(n.tempDisabled=!0,n):(n.tempDisabled=!1,n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-i)/(1+i)},e}),n)})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:30,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!0,d=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

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

"+t+"

"+"

"+n+"

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

"+e+"

"+"

"+n+" at "+t+"

"},h,p,d={},v=null,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.orient("bottom").tickPadding(7),r.orient("left");var y=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.attr("viewBox");if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),h=n.tickFormat()(t.x()(i.point,i.pointIndex)),p=r.tickFormat()(t.y()(i.point,i.pointIndex)),d=c(i.series.key,h,p,i,b);e.tooltip.show([f,l],d,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],g.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)}),g.on("tooltipHide",function(){l&&e.tooltip.cleanup()}),b.dispatch=g,b.lines=t,b.legend=i,b.xAxis=n,b.yAxis=r,d3.rebind(b,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),b.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,b):s},b.width=function(e){return arguments.length?(u=e,b):u},b.height=function(e){return arguments.length?(a=e,b):a},b.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),b):o},b.showLegend=function(e){return arguments.length?(f=e,b):f},b.tooltips=function(e){return arguments.length?(l=e,b):l},b.tooltipContent=function(e){return arguments.length?(c=e,b):c},b.state=function(e){return arguments.length?(d=e,b):d},b.defaultState=function(e){return arguments.length?(v=e,b):v},b.noData=function(e){return arguments.length?(m=e,b):m},b},e.models.linePlusBarChart=function(){function T(e){return e.each(function(l){var c=d3.select(this),v=this,N=(a||parseInt(c.style("width"))||960)-u.left-u.right,C=(f||parseInt(c.style("height"))||400)-u.top-u.bottom;T.update=function(){T(e)},T.container=this,b.disabled=l.map(function(e){return!!e.disabled});if(!w){var k;w={};for(k in b)b[k]instanceof Array?w[k]=b[k].slice(0):w[k]=b[k]}if(!l||!l.length||!l.filter(function(e){return e.values.length}).length){var L=c.selectAll(".nv-noData").data([E]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",u.left+N/2).attr("y",u.top+C/2).text(function(e){return e}),T}c.selectAll(".nv-noData").remove();var A=l.filter(function(e){return!e.disabled&&e.bar}),O=l.filter(function(e){return!e.bar});m=O.filter(function(e){return!e.disabled}).length&&O.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale(),g=n.yScale(),y=t.yScale();var M=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([l]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),D=M.select("g");_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y1 nv-axis"),_.append("g").attr("class","nv-y2 nv-axis"),_.append("g").attr("class","nv-barsWrap"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),p&&(o.width(N/2),D.select(".nv-legendWrap").datum(l.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),C=(f||parseInt(c.style("height"))||400)-u.top-u.bottom),D.select(".nv-legendWrap").attr("transform","translate("+N/2+","+ -u.top+")")),M.attr("transform","translate("+u.left+","+u.top+")"),t.width(N).height(C).color(l.map(function(e,t){return e.color||h(e,t)}).filter(function(e,t){return!l[t].disabled&&!l[t].bar})),n.width(N).height(C).color(l.map(function(e,t){return e.color||h(e,t)}).filter(function(e,t){return!l[t].disabled&&l[t].bar}));var P=D.select(".nv-barsWrap").datum(A.length?A:[{values:[]}]),H=D.select(".nv-linesWrap").datum(O[0]&&!O[0].disabled?O:[{values:[]}]);d3.transition(P).call(n),d3.transition(H).call(t),r.scale(m).ticks(N/100).tickSize(-C,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(D.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(C/36).tickSize(-N,0),d3.transition(D.select(".nv-y1.nv-axis")).style("opacity",A.length?1:0).call(i),s.scale(y).ticks(C/36).tickSize(A.length?0:-N,0),D.select(".nv-y2.nv-axis").style("opacity",O.length?1:0).attr("transform","translate("+N+",0)"),d3.transition(D.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,l.filter(function(e){return!e.disabled}).length||l.map(function(e){return e.disabled=!1,M.selectAll(".nv-series").classed("disabled",!1),e}),b.disabled=l.map(function(e){return!!e.disabled}),S.stateChange(b),e.transition().call(T)}),S.on("tooltipShow",function(e){d&&x(e,v.parentNode)}),S.on("changeState",function(t){typeof t.disabled!="undefined"&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),e.call(T)})}),T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(!0),t.clipEdge(!1).padData(!0),r.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),T.dispatch=S,T.legend=o,T.lines=t,T.bars=n,T.xAxis=r,T.y1Axis=i,T.y2Axis=s,d3.rebind(T,t,"defined","size","clipVoronoi","interpolate"),T.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),T):l},T.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),T):c},T.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,T):u},T.width=function(e){return arguments.length?(a=e,T):a},T.height=function(e){return arguments.length?(f=e,T):f},T.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),T):h},T.showLegend=function(e){return arguments.length?(p=e,T):p},T.tooltips=function(e){return arguments.length?(d=e,T):d},T.tooltipContent=function(e){return arguments.length?(v=e,T):v},T.state=function(e){return arguments.length?(b=e,T):b},T.defaultState=function(e){return arguments.length?(w=e,T):w},T.noData=function(e){return arguments.length?(E=e,T):E},T},e.models.lineWithFocusChart=function(){function C(e){return e.each(function(S){function R(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent(),extent=a.empty()?g.domain():a.extent(),T.brush({extent:extent,brush:a}),U();var e=H.select(".nv-focus .nv-linesWrap").datum(S.filter(function(e){return!e.disabled}).map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=extent[0]&&t.x()(e,n)<=extent[1]})}}));d3.transition(e).call(t),d3.transition(H.select(".nv-focus .nv-x.nv-axis")).call(r),d3.transition(H.select(".nv-focus .nv-y.nv-axis")).call(i)}var k=d3.select(this),L=this,A=(h||parseInt(k.style("width"))||960)-f.left-f.right,O=(p||parseInt(k.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;C.update=function(){C(e)},C.container=this;if(!S||!S.length||!S.filter(function(e){return e.values.length}).length){var _=k.selectAll(".nv-noData").data([x]);return _.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e}),C}k.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var D=k.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([S]),P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis"),j.append("g").attr("class","nv-y nv-axis"),j.append("g").attr("class","nv-linesWrap"),j.append("g").attr("class","nv-brushBackground"),j.append("g").attr("class","nv-x nv-brush"),b&&(u.width(A),H.select(".nv-legendWrap").datum(S).call(u),f.top!=u.height()&&(f.top=u.height(),O=(p||parseInt(k.style("height"))||400)-f.top-f.bottom-d),H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),D.attr("transform","translate("+f.left+","+f.top+")"),t.width(A).height(O).color(S.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!S[t].disabled})),n.defined(t.defined()).width(A).height(M).color(S.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!S[t].disabled})),H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(S.filter(function(e){return!e.disabled}));d3.transition(F).call(n),r.scale(v).ticks(A/100).tickSize(-O,0),i.scale(m).ticks(O/36).tickSize(-A,0),H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")"),a.x(g).on("brush",z),w&&a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M),q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M),gBrush=H.select(".nv-x.nv-brush").call(a),gBrush.selectAll("rect").attr("height",M),gBrush.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(A/100).tickSize(-M,0),H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(M/36).tickSize(-A,0),d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o),H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,S.filter(function(e){return!e.disabled}).length||S.map(function(e){return e.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1),e}),e.transition().call(C)}),T.on("tooltipShow",function(e){E&&N(e,L.parentNode)})}),C}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush");t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var N=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,C);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),C.dispatch=T,C.legend=u,C.lines=t,C.lines2=n,C.xAxis=r,C.yAxis=i,C.x2Axis=s,C.y2Axis=o,d3.rebind -(C,t,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),C.x=function(e){return arguments.length?(t.x(e),n.x(e),C):t.x},C.y=function(e){return arguments.length?(t.y(e),n.y(e),C):t.y},C.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,C):f},C.margin2=function(e){return arguments.length?(l=e,C):l},C.width=function(e){return arguments.length?(h=e,C):h},C.height=function(e){return arguments.length?(p=e,C):p},C.height2=function(e){return arguments.length?(d=e,C):d},C.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),C):c},C.showLegend=function(e){return arguments.length?(b=e,C):b},C.tooltips=function(e){return arguments.length?(E=e,C):E},C.tooltipContent=function(e){return arguments.length?(S=e,C):S},C.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),C):t.interpolate()},C.noData=function(e){return arguments.length?(x=e,C):x},C.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),C):r.tickFormat()},C.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),C):i.tickFormat()},C},e.models.linePlusBarWithFocusChart=function(){function H(e){return e.each(function(N){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){h.empty()||h.extent(x),Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent(),S=h.empty()?k.domain():h.extent(),D.brush({extent:S,brush:h}),rt(),r.width(F).height(I).color(N.map(function(e,t){return e.color||w(e,t)}).filter(function(e,t){return!N[t].disabled&&N[t].bar})),t.width(F).height(I).color(N.map(function(e,t){return e.color||w(e,t)}).filter(function(e,t){return!N[t].disabled&&!N[t].bar}));var e=J.select(".nv-focus .nv-barsWrap").datum(U.length?U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}):[{values:[]}]),n=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));U.length?C=r.xScale():C=t.xScale(),s.scale(C).ticks(F/100).tickSize(-I,0),s.domain([Math.ceil(S[0]),Math.floor(S[1])]),d3.transition(J.select(".nv-x.nv-axis")).call(s),d3.transition(e).call(r),d3.transition(n).call(t),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")"),u.scale(L).ticks(I/36).tickSize(-F,0),J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0),a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0),J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)"),d3.transition(J.select(".nv-focus .nv-y1.nv-axis")).call(u),d3.transition(J.select(".nv-focus .nv-y2.nv-axis")).call(a)}var B=d3.select(this),j=this,F=(v||parseInt(B.style("width"))||960)-p.left-p.right,I=(m||parseInt(B.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;H.update=function(){H(e)},H.container=this;if(!N||!N.length||!N.filter(function(e){return e.values.length}).length){var R=B.selectAll(".nv-noData").data([_]);return R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e}),H}B.selectAll(".nv-noData").remove();var U=N.filter(function(e){return!e.disabled&&e.bar}),z=N.filter(function(e){return!e.bar});C=r.xScale(),k=o.scale(),L=r.yScale(),A=t.yScale(),O=i.yScale(),M=n.yScale();var W=N.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})}),X=N.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]),k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=B.selectAll("g.nv-wrap.nv-linePlusBar").data([N]),$=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y1 nv-axis"),K.append("g").attr("class","nv-y2 nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis"),Q.append("g").attr("class","nv-y1 nv-axis"),Q.append("g").attr("class","nv-y2 nv-axis"),Q.append("g").attr("class","nv-barsWrap"),Q.append("g").attr("class","nv-linesWrap"),Q.append("g").attr("class","nv-brushBackground"),Q.append("g").attr("class","nv-x nv-brush"),E&&(c.width(F/2),J.select(".nv-legendWrap").datum(N.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(c),p.top!=c.height()&&(p.top=c.height(),I=(m||parseInt(B.style("height"))||400)-p.top-p.bottom-g),J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")),V.attr("transform","translate("+p.left+","+p.top+")"),i.width(F).height(q).color(N.map(function(e,t){return e.color||w(e,t)}).filter(function(e,t){return!N[t].disabled&&N[t].bar})),n.width(F).height(q).color(N.map(function(e,t){return e.color||w(e,t)}).filter(function(e,t){return!N[t].disabled&&!N[t].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]),Y=J.select(".nv-context .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")"),d3.transition(G).call(i),d3.transition(Y).call(n),h.x(k).on("brush",it),x&&h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]),et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q),et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q),tt.selectAll(".resize").append("path").attr("d",nt),o.ticks(F/100).tickSize(-q,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(o),f.scale(O).ticks(q/36).tickSize(-F,0),J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")"),d3.transition(J.select(".nv-context .nv-y1.nv-axis")).call(f),l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0),J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)"),d3.transition(J.select(".nv-context .nv-y2.nv-axis")).call(l),c.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,N.filter(function(e){return!e.disabled}).length||N.map(function(e){return e.disabled=!1,V.selectAll(".nv-series").classed("disabled",!1),e}),e.call(H)}),D.on("tooltipShow",function(e){T&&P(e,j.parentNode)}),it()}),H}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush(),p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=!0,S,x=null,T=!0,N=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush");t.clipEdge(!0),n.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),a.orient("right"),o.orient("bottom").tickPadding(5),f.orient("left"),l.orient("right");var P=function(n,r){S&&(n.pointIndex+=Math.ceil(S[0]));var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,H);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),D.on("tooltipHide",function(){T&&e.tooltip.cleanup()}),H.dispatch=D,H.legend=c,H.lines=t,H.lines2=n,H.bars=r,H.bars2=i,H.xAxis=s,H.x2Axis=o,H.y1Axis=u,H.y2Axis=a,H.y3Axis=f,H.y4Axis=l,d3.rebind(H,t,"defined","size","clipVoronoi","interpolate"),H.x=function(e){return arguments.length?(y=e,t.x(e),r.x(e),H):y},H.y=function(e){return arguments.length?(b=e,t.y(e),r.y(e),H):b},H.margin=function(e){return arguments.length?(p.top=typeof e.top!="undefined"?e.top:p.top,p.right=typeof e.right!="undefined"?e.right:p.right,p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom,p.left=typeof e.left!="undefined"?e.left:p.left,H):p},H.width=function(e){return arguments.length?(v=e,H):v},H.height=function(e){return arguments.length?(m=e,H):m},H.color=function(t){return arguments.length?(w=e.utils.getColor(t),c.color(w),H):w},H.showLegend=function(e){return arguments.length?(E=e,H):E},H.tooltips=function(e){return arguments.length?(T=e,H):T},H.tooltipContent=function(e){return arguments.length?(N=e,H):N},H.noData=function(e){return arguments.length?(_=e,H):_},H.brushExtent=function(e){return arguments.length?(x=e,H):x},H},e.models.multiBar=function(){function S(e){return e.each(function(e){var S=n-t.left-t.right,T=r-t.top-t.bottom,N=d3.select(this);p&&e.length&&(p=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}]),c&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(!e.length&&p?p:e)),e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e}),c&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i,i-=t.size):(t.y1=t.size+r,r+=t.size)})});var C=g&&y?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(d3.merge(C).map(function(e){return e.x})).rangeBands([0,S],.1),s.domain(y||d3.extent(d3.merge(C).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range([T,0]);if(i.domain()[0]===i.domain()[1]||s.domain()[0]===s.domain()[1])singlePoint=!0;i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1])),w=w||i,E=E||s;var k=N.selectAll("g.nv-wrap.nv-multibar").data([e]),L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),A=L.append("defs"),O=L.append("g"),M=k.select("g");O.append("g").attr("class","nv-groups"),k.attr("transform","translate("+t.left+","+t.top+")"),A.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),k.select("#nv-edge-clip-"+o+" rect").attr("width",S).attr("height",T),M.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(_.exit()).selectAll("rect.nv-bar").delay(function(t,n){return n*m/e[0].values.length}).attr("y",function(e){return c?E(e.y0):E(0)}).attr("height",0).remove(),_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return h(e,t)}).style("stroke",function(e,t){return h(e,t)}),d3.transition(_).style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("rect.nv-bar").data(function(t){return p&&!e.length?p.values:t.values});D.exit().remove();var P=D.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return E(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length));D.style("fill",function(e,t,n){return h(e,n,t)}).style("stroke",function(e,t,n){return h(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),b.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),b.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){b.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){b.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),d&&(v||(v=e.map(function(){return!0})),D.style("fill",function(e,t,n){return d3.rgb(d(e,t)).darker(v.map(function(e,t){return t}).filter(function(e,t){return!v[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(d(e,t)).darker(v.map(function(e,t){return t}).filter(function(e,t){return!v[t]})[n]).toString()})),c?d3.transition(D).delay(function(t,n){return n*m/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length))}):d3.transition(D).delay(function(t,n){return n*m/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0})}),w=i.copy(),E=s.copy()}),S}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h=e.utils.defaultColor(),p=!1,d=null,v,m=1200,g,y,b=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),w,E;return S.dispatch=b,S.x=function(e){return arguments.length?(u=e,S):u},S.y=function(e){return arguments.length?(a=e,S):a},S.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,S):t},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.xScale=function(e){return arguments.length?(i=e,S):i},S.yScale=function(e){return arguments.length?(s=e,S):s},S.xDomain=function(e){return arguments.length?(g=e,S):g},S.yDomain=function(e){return arguments.length?(y=e,S):y},S.forceY=function(e){return arguments.length?(f=e,S):f},S.stacked=function(e){return arguments.length?(c=e,S):c},S.clipEdge=function(e){return arguments.length?(l=e,S):l},S.color=function(t){return arguments.length?(h=e.utils.getColor(t),S):h},S.barColor=function(t){return arguments.length?(d=e.utils.getColor(t),S):d},S.disabled=function(e){return arguments.length?(v=e,S):v},S.id=function(e){return arguments.length?(o=e,S):o},S.hideable=function(e){return arguments.length?(p=e,S):p},S.delay=function(e){return arguments.length?(m=e,S):m},S},e.models.multiBarChart=function(){function T(e){return e.each(function(v){var N=d3.select(this),C=this,k=(u||parseInt(N.style("width"))||960)-o.left-o.right,L=(a||parseInt(N.style("height"))||400)-o.top-o.bottom;T.update=function(){e.transition().call(T)},T.container=this,y.disabled=v.map(function(e){return!!e.disabled});if(!b){var A;b={};for(A in y)y[A]instanceof Array?b[A]=y[A].slice(0):b[A]=y[A]}if(!v||!v.length||!v.filter(function(e){return e.values.length}).length){var O=N.selectAll(".nv-noData").data([w]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e}),T}N.selectAll(".nv-noData").remove(),m=t.xScale(),g=t.yScale();var M=N.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([v]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),D=M.select("g");_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-barsWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-controlsWrap"),c&&(i.width(k-S()),t.barColor()&&v.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),D.select(".nv-legendWrap").datum(v).call(i),o.top!=i.height()&&(o.top=i.height(),L=(a||parseInt(N.style("height"))||400)-o.top-o.bottom),D.select(".nv-legendWrap").attr("transform","translate("+S()+","+ -o.top+")"));if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(S()).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")"),t.disabled(v.map(function(e){return e.disabled})).width(k).height(L).color(v.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!v[t].disabled}));var H=D.select(".nv-barsWrap").datum(v.filter(function(e){return!e.disabled}));d3.transition(H).call(t),n.scale(m).ticks(k/100).tickSize(-L,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(D.select(".nv-x.nv-axis")).call(n);var B=D.select(".nv-x.nv-axis > g").selectAll("g");B.selectAll("line, text").style("opacity",1),h&&B.filter(function(e,t){return t%Math.ceil(v[0].values.length/(k/100))!==0}).selectAll("text, line").style("opacity",0),p&&B.selectAll("text").attr("transform","rotate("+p+" 0,0)").attr("text-anchor",p>0?"start":"end"),D.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),r.scale(g).ticks(L/36).tickSize(-k,0),d3.transition(D.select(".nv-y.nv-axis")).call(r),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,v.filter(function(e){return!e.disabled}).length||v.map(function(e){return e.disabled=!1,M.selectAll(".nv-series").classed("disabled",!1),e}),y.disabled=v.map(function(e){return!!e.disabled}),E.stateChange(y),e.transition().call(T)}),s.dispatch.on("legendClick",function(n,r){if(!n.disabled)return;P=P.map(function(e){return e.disabled=!0,e}),n.disabled=!1;switch(n.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}y.stacked=t.stacked(),E.stateChange(y),e.transition().call(T)}),E.on("tooltipShow",function(e){d&&x(e,C.parentNode)}),E.on("changeState",function(n){typeof n.disabled!="undefined"&&(v.forEach(function(e,t){e.disabled=n.disabled[t]}),y.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),y.stacked=n.stacked),e.call(T)})}),T}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:30,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=0,d=!0,v=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" on "+t+"

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

"+e+" - "+t+"

"+"

"+n+"

"},v,m,g={stacked:h},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=function(){return l?180:0};t.stacked(h),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f"));var S=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=d(i.series.key,a,f,i,x);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),x.dispatch=w,x.multibar=t,x.legend=i,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"x","y","xDomain" -,"yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor"),x.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,x):o},x.width=function(e){return arguments.length?(u=e,x):u},x.height=function(e){return arguments.length?(a=e,x):a},x.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),x):f},x.showControls=function(e){return arguments.length?(l=e,x):l},x.showLegend=function(e){return arguments.length?(c=e,x):c},x.tooltip=function(e){return arguments.length?(d=e,x):d},x.tooltips=function(e){return arguments.length?(p=e,x):p},x.tooltipContent=function(e){return arguments.length?(d=e,x):d},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},x},e.models.multiChart=function(){function T(e){return e.each(function(u){var f=d3.select(this),N=this,C=(r||parseInt(f.style("width"))||960)-t.left-t.right,k=(i||parseInt(f.style("height"))||400)-t.top-t.bottom,L=u.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),A=u.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),O=u.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),M=u.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),_=u.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),D=u.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),P=u.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),H=u.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(P.concat(H)),function(e){return e.x})).range([0,C]);var B=f.selectAll("g.wrap.multiChart").data([u]),j=B.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");j.append("g").attr("class","x axis"),j.append("g").attr("class","y1 axis"),j.append("g").attr("class","y2 axis"),j.append("g").attr("class","lines1Wrap"),j.append("g").attr("class","lines2Wrap"),j.append("g").attr("class","bars1Wrap"),j.append("g").attr("class","bars2Wrap"),j.append("g").attr("class","stack1Wrap"),j.append("g").attr("class","stack2Wrap"),j.append("g").attr("class","legendWrap");var F=B.select("g");s&&(E.width(C/2),F.select(".legendWrap").datum(u.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(E),t.top!=E.height()&&(t.top=E.height(),k=(i||parseInt(f.style("height"))||400)-t.top-t.bottom),F.select(".legendWrap").attr("transform","translate("+C/2+","+ -t.top+")")),h.width(C).height(k).interpolate("monotone").color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="line"})),p.width(C).height(k).interpolate("monotone").color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="line"})),d.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="bar"})),v.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="bar"})),m.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==1&&u[t].type=="area"})),g.width(C).height(k).color(u.map(function(e,t){return e.color||n[t%n.length]}).filter(function(e,t){return!u[t].disabled&&u[t].yAxis==2&&u[t].type=="area"})),F.attr("transform","translate("+t.left+","+t.top+")");var I=F.select(".lines1Wrap").datum(L),q=F.select(".bars1Wrap").datum(O),R=F.select(".stack1Wrap").datum(_),U=F.select(".lines2Wrap").datum(A),z=F.select(".bars2Wrap").datum(M),W=F.select(".stack2Wrap").datum(D),X=_.length?_.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];l.domain(d3.extent(d3.merge(P).concat(X),function(e){return e.y})).range([0,k]),c.domain(d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,k]),h.yDomain(l.domain()),d.yDomain(l.domain()),m.yDomain(l.domain()),p.yDomain(c.domain()),v.yDomain(c.domain()),g.yDomain(c.domain()),_.length&&d3.transition(R).call(m),D.length&&d3.transition(W).call(g),O.length&&d3.transition(q).call(d),M.length&&d3.transition(z).call(v),L.length&&d3.transition(I).call(h),A.length&&d3.transition(U).call(p),y.ticks(C/100).tickSize(-k,0),F.select(".x.axis").attr("transform","translate(0,"+k+")"),d3.transition(F.select(".x.axis")).call(y),b.ticks(k/36).tickSize(-C,0),d3.transition(F.select(".y1.axis")).call(b),w.ticks(k/36).tickSize(-C,0),d3.transition(F.select(".y2.axis")).call(w),F.select(".y2.axis").style("opacity",H.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),E.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,u.filter(function(e){return!e.disabled}).length||u.map(function(e){return e.disabled=!1,B.selectAll(".series").classed("disabled",!1),e}),e.transition().call(T)}),S.on("tooltipShow",function(e){o&&x(e,N.parentNode)})}),T.update=function(){T(e)},T.container=this,T}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"

"+e+"

"+"

"+n+" at "+t+"

"},a,f,a=d3.scale.linear(),l=d3.scale.linear(),c=d3.scale.linear(),h=e.models.line().yScale(l),p=e.models.line().yScale(c),d=e.models.multiBar().stacked(!1).yScale(l),v=e.models.multiBar().stacked(!1).yScale(c),m=e.models.stackedArea().yScale(l),g=e.models.stackedArea().yScale(c),y=e.models.axis().scale(a).orient("bottom").tickPadding(5),b=e.models.axis().scale(l).orient("left"),w=e.models.axis().scale(c).orient("right"),E=e.models.legend().height(30),S=d3.dispatch("tooltipShow","tooltipHide"),x=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=y.tickFormat()(h.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?w:b).tickFormat()(h.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,T);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return h.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),h.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),p.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),p.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),m.dispatch.on("tooltipShow",function(e){if(!Math.round(m.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),m.dispatch.on("tooltipHide",function(e){S.tooltipHide(e)}),g.dispatch.on("tooltipShow",function(e){if(!Math.round(g.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),g.dispatch.on("tooltipHide",function(e){S.tooltipHide(e)}),h.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),h.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),p.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],S.tooltipShow(e)}),p.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),T.dispatch=S,T.lines1=h,T.lines2=p,T.bars1=d,T.bars2=v,T.stack1=m,T.stack2=g,T.xAxis=y,T.yAxis1=b,T.yAxis2=w,T.x=function(e){return arguments.length?(getX=e,h.x(e),d.x(e),T):getX},T.y=function(e){return arguments.length?(getY=e,h.y(e),d.y(e),T):getY},T.margin=function(e){return arguments.length?(t=e,T):t},T.width=function(e){return arguments.length?(r=e,T):r},T.height=function(e){return arguments.length?(i=e,T):i},T.color=function(e){return arguments.length?(n=e,E.color(e),T):n},T.showLegend=function(e){return arguments.length?(s=e,T):s},T.tooltips=function(e){return arguments.length?(o=e,T):o},T.tooltipContent=function(e){return arguments.length?(u=e,T):u},T},e.models.ohlcBar=function(){function E(e){return e.each(function(e){var g=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p))),v?s.range([g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range([0,g]),o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range([E,0]);if(s.domain()[0]===s.domain()[1]||o.domain()[0]===o.domain()[1])singlePoint=!0;s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var T=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-ticks"),T.attr("transform","translate("+t.left+","+t.top+")"),S.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:i})}),C.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),T.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",E),L.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var A=T.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});A.exit().remove();var O=A.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),w.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),w.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){w.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});A.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(A).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!1,m=!0,g=e.utils.defaultColor(),y,b,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return E.dispatch=w,E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.open=function(e){return arguments.length?(f=e,E):f},E.close=function(e){return arguments.length?(l=e,E):l},E.high=function(e){return arguments.length?(c=e,E):c},E.low=function(e){return arguments.length?(h=e,E):h},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(y=e,E):y},E.yDomain=function(e){return arguments.length?(b=e,E):b},E.forceX=function(e){return arguments.length?(p=e,E):p},E.forceY=function(e){return arguments.length?(d=e,E):d},E.padData=function(e){return arguments.length?(v=e,E):v},E.clipEdge=function(e){return arguments.length?(m=e,E):m},E.color=function(t){return arguments.length?(g=e.utils.getColor(t),E):g},E.id=function(e){return arguments.length?(i=e,E):i},E},e.models.pie=function(){function E(e){return e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){v||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var u=n-t.left-t.right,l=r-t.top-t.bottom,E=Math.min(u,l)/2,S=E-E/5,x=d3.select(this),T=x.selectAll(".nv-wrap.nv-pie").data([i(e[0])]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+a),C=N.append("g"),k=T.select("g");C.append("g").attr("class","nv-pie"),T.attr("transform","translate("+t.left+","+t.top+")"),k.select(".nv-pie").attr("transform","translate("+u/2+","+l/2+")"),x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:a})});var L=d3.svg.arc().outerRadius(S);g&&L.startAngle(g),y&&L.endAngle(y),v&&L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:o(e)}),O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),w.elementMouseover({label:s(e.data),value:o(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:a})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),w.elementMouseout({label:s(e.data),value:o(e.data),point:e.data,index:t,id:a})}).on("click",function(e,t){w.elementClick({label:s(e.data),value:o(e.data),point:e.data,index:t,pos:d3.event,id:a}),d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:s(e.data),value:o(e.data),point:e.data,index:t,pos:d3.event,id:a}),d3.event.stopPropagation()});O.attr("fill",function(e,t){return f(e,t)}).attr("stroke",function(e,t){return f(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(c){var D=d3.svg.arc().innerRadius(0);h&&(D=L),p&&(D=d3.svg.arc().outerRadius(L.outerRadius())),M.append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10,e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2d?s(e.data):""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}}),E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.values},s=function(e){return e.x},o=function(e){return e.y},u=function(e){return e.description},a=Math.floor(Math.random()*1e4),f=e.utils.defaultColor(),l=d3.format(",.2f"),c=!0,h=!0,p=!1,d=.02,v=!1,m=!1,g=!1,y=!1,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return E.dispatch=w,E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.values=function(e){return arguments.length?(i=e,E):i},E.x=function(e){return arguments.length?(s=e,E):s},E.y=function(e){return arguments.length?(o=d3.functor(e),E):o},E.description=function(e){return arguments.length?(u=e,E):u},E.showLabels=function(e){return arguments.length?(c=e,E):c},E.labelSunbeamLayout=function(e){return arguments.length?(m=e,E):m},E.donutLabelsOutside=function(e){return arguments.length?(p=e,E):p},E.pieLabelsOutside=function(e){return arguments.length?(h=e,E):h},E.donut=function(e){return arguments.length?(v=e,E):v},E.donutRatio=function(e){return arguments.length?(b=e,E):b},E.startAngle=function(e){return arguments.length?(g=e,E):g},E.endAngle=function(e){return arguments.length?(y=e,E):y},E.id=function(e){return arguments.length?(a=e,E):a},E.color=function(t){return arguments.length?(f=e.utils.getColor(t),E):f},E.valueFormat=function(e){return arguments.length?(l=e,E):l},E.labelThreshold=function(e){return arguments.length?(d=e,E):d},E},e.models.pieChart=function(){function v(e){return e.each(function(u){var a=d3.select(this),f=this,d=(i||parseInt(a.style("width"))||960)-r.left-r.right,m=(s||parseInt(a.style("height"))||400)-r.top-r.bottom;v.update=function(){v(e)},v.container=this,l.disabled=u[0].map(function(e){return!!e.disabled});if(!c){var g;c={};for(g in l)l[g]instanceof Array?c[g]=l[g].slice(0):c[g]=l[g]}if(!u[0]||!u[0].length){var y=a.selectAll(".nv-noData").data([h]);return y.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),y.attr("x",r.left+d/2).attr("y",r.top+m/2).text(function(e){return e}),v}a.selectAll(".nv-noData").remove();var b=a.selectAll("g.nv-wrap.nv-pieChart").data([u]),w=b.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),E=b.select("g");w.append("g").attr("class","nv-pieWrap"),w.append("g").attr("class","nv-legendWrap"),o&&(n.width(d).key(t.x()),b.select(".nv-legendWrap").datum(t.values()(u[0])).call(n),r.top!=n.height()&&(r.top=n.height(),m=(s||parseInt(a.style("height"))||400)-r.top-r.bottom),b.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),b.attr("transform","translate("+r.left+","+r.top+")"),t.width(d).height(m);var S=E.select(".nv-pieWrap").datum(u);d3.transition(S).call(t),n.dispatch.on("legendClick",function(n,r,i){n.disabled=!n.disabled,t.values()(u[0]).filter(function(e){return!e.disabled}).length||t.values()(u[0]).map(function(e){return e.disabled=!1,b.selectAll(".nv-series").classed("disabled",!1),e}),l.disabled=u[0].map(function(e){return!!e.disabled}),p.stateChange(l),e.transition().call(v)}),t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)}),p.on("changeState",function(t){typeof t.disabled!="undefined"&&(u[0].forEach(function(e,n){e.disabled=t.disabled[n]}),l.disabled=t.disabled),e.call(v)})}),v}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"

"+e+"

"+"

"+t+"

"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),d=function(n,r){var i=t.description()(n.point)||t.x()(n.point),s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],p.tooltipShow(e)}),p.on("tooltipShow",function(e){a&&d(e)}),p.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),v.legend=n,v.dispatch=p,v.pie=t,d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","donut","donutRatio","labelThreshold"),v.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,v):r},v.width=function(e){return arguments.length?(i=e,v):i},v.height=function(e){return arguments.length?(s=e,v):s},v.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),v):u},v.showLegend=function(e){return arguments.length?(o=e,v):o},v.tooltips=function(e){return arguments.length?(a=e,v):a},v.tooltipContent=function(e){return arguments.length?(f=e,v):f},v.state=function(e){return arguments.length?(l=e,v):l},v.defaultState=function(e){return arguments.length?(c=e,v):c},v.noData=function(e){return arguments.length?(h=e,v):h},v},e.models.scatter=function(){function B(e){return e.each(function(e){function V(){if(!g)return!1;var i,a=d3.merge(e.map(function(e,t){return e.values.map(function(e,n){return[o(f(e,n))*(Math.random()/1e12+1),u(l(e,n))*(Math.random()/1e12+1),t,n,e]}).filter(function(e,t){return y(e[4],t)})}));if(O===!0){if(S){var c=q.select("defs").selectAll(".nv-point-clips").data([s]).enter();c.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var h=q.select("#nv-points-clip-"+s).selectAll("circle").data(a);h.enter().append("circle").attr("r",x),h.exit().remove(),h.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),q.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}a.push([o.range()[0]-20,u.range()[0]-20,null,null]),a.push([o.range()[1]+20,u.range()[1]+20,null,null]),a.push([o.range()[0]-20,u.range()[0]+20,null,null]),a.push([o.range()[1]+20,u.range()[1]-20,null,null]);var p=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]),d=d3.geom.voronoi(a).map(function(e,t){return{data:p.clip(e),series:a[t][2],point:a[t][3]}}),v=q.select(".nv-point-paths").selectAll("path").data(d);v.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),v.exit().remove(),v.attr("d",function(e){return"M"+e.data.join("L")+"Z"}),v.on("click",function(n){if(H)return 0;var r=e[n.series],i=r.values[n.point];A.elementClick({point:i,series:r,pos:[o(f(i,n.point))+t.left,u(l(i,n.point))+t.top],seriesIndex:n.series,pointIndex:n.point})}).on("mouseover",function(n){if(H)return 0;var r=e[n.series],i=r.values[n.point];A.elementMouseover({point:i,series:r,pos:[o(f(i,n.point))+t.left,u(l(i,n.point))+t.top],seriesIndex:n.series,pointIndex:n.point})}).on("mouseout",function(t,n){if(H)return 0;var r=e[t.series],i=r.values[t.point];A.elementMouseout({point:i,series:r,seriesIndex:t.series,pointIndex:t.point})})}else q.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(n,r){if(H||!e[n.series])return 0;var i=e[n.series],s=i.values[r];A.elementClick({point:s,series:i,pos:[o(f(s,r))+t.left,u(l(s,r))+t.top],seriesIndex:n.series,pointIndex:r})}).on("mouseover",function(n,r){if(H||!e[n.series])return 0;var i=e[n.series],s=i.values[r];A.elementMouseover({point:s,series:i,pos:[o(f(s,r))+t.left,u(l(s,r))+t.top],seriesIndex:n.series,pointIndex:r})}).on("mouseout",function(t,n){if(H||!e[t.series])return 0;var r=e[t.series],i=r.values[n];A.elementMouseout({point:i,series:r,seriesIndex:t.series,pointIndex:n})});H=!1}var B=n-t.left-t.right,j=r-t.top-t.bottom,F=d3.select(this);e=e.map(function(e,t){return e.values=e.values.map(function(e){return e.series=t,e}),e});var I=T&&N&&C?[]:d3.merge(e.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(T||d3.extent(I.map(function(e){return e.x}).concat(d))),b&&e[0]?o.range([(B*w+B)/(2*e[0].values.length),B-B*(1+w)/(2*e[0].values.length)]):o.range([0,B]),u.domain(N||d3.extent(I.map(function(e){return e.y}).concat(v))).range([j,0]),a.domain(C||d3.extent(I.map(function(e){return e.size}).concat(m))).range(k||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])L=!0;o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]+u.domain()[0]*.01,u.domain()[1]-u.domain()[1]*.01]):u.domain([-1,1])),M=M||o,_=_||u,D=D||a;var q=F.selectAll("g.nv-wrap.nv-scatter").data([e]),R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(L?" nv-single-point":"")),U=R.append("defs"),W=R.append("g"),X=q.select("g");W.append("g").attr("class","nv-groups"),W.append("g").attr("class","nv-point-paths"),q.attr("transform","translate("+t.left+","+t.top+")"),U.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),q.select("#nv-edge-clip-"+s+" rect").attr("width",B).attr("height",j),X.attr("clip-path",E?"url(#nv-edge-clip-"+s+")":""),H=!0;var $=q.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});$.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition($.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),$.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),d3.transition($).style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var J=$.selectAll("circle.nv-point").data(function(e){return e.values});J.enter().append("circle").attr("cx",function(e,t){return M(f(e,t))}).attr("cy",function(e,t){return _(l(e,t))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)}),J.exit().remove(),d3.transition($.exit().selectAll("path.nv-point")).attr("cx",function(e,t){return o(f(e,t))}).attr("cy",function(e,t){return u(l(e,t))}).remove(),J.attr("class",function(e,t){return"nv-point nv-point-"+t}),d3.transition(J).attr("cx",function(e,t){return o(f(e,t))}).attr("cy",function(e,t){return u(l(e,t))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var J=$.selectAll("path.nv-point").data(function(e){return e.values});J.enter().append("path").attr("transform",function(e,t){return"translate("+M(f(e,t))+","+_(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),J.exit().remove(),d3.transition($.exit().selectAll("path.nv-point")).attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),J.attr("class",function(e,t){return"nv-point nv-point-"+t}),d3.transition(J).attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(P),P=setTimeout(V,300),M=o.copy(),_=u.copy(),D=a.copy()}),B}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=!0,d=[],v=[],m=[],g=!0,y=function(e){return!e.notActive},b=!1,w=.1,E=!1,S=!0,x=function(){return 25},T=null,N=null,C=null,k=null,L=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),O=!0,M,_,D,P,H=!1;return A.on("elementMouseover.point",function(e){g&&d3.select(".nv-chart-"+s+" .nv-series-"+e.seriesIndex+" .nv-point-"+e.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(e){g&&d3.select(".nv-chart-"+s+" .nv-series-"+e.seriesIndex+" .nv-point-"+e.pointIndex).classed("hover",!1)}),B.dispatch=A,B.x=function(e){return arguments.length?(f=d3.functor(e),B):f},B.y=function(e){return arguments.length?(l=d3.functor(e),B):l},B.size=function(e){return arguments.length?(c=d3.functor(e),B):c},B.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,B):t},B.width=function(e){return arguments.length?(n=e,B):n},B.height=function(e){return arguments.length?(r=e,B):r},B.xScale=function(e){return arguments.length?(o=e,B):o},B.yScale=function(e){return arguments.length?(u=e,B):u},B.zScale=function(e){return arguments.length?(a=e,B):a},B.xDomain=function(e){return arguments.length?(T=e,B):T},B.yDomain=function(e){return arguments.length?(N=e,B):N},B.sizeDomain=function(e){return arguments.length?(C=e,B):C},B.sizeRange=function(e){return arguments.length?(k=e,B):k},B.forceX=function(e){return arguments.length?(d=e,B):d},B.forceY=function(e){return arguments.length?(v=e,B):v},B.forceSize=function(e){return arguments.length?(m=e,B):m},B.interactive=function(e){return arguments.length?(g=e,B):g},B.pointActive=function(e){return arguments.length?(y=e,B):y},B.padData=function(e){return arguments.length?(b=e,B):b},B.padDataOuter=function(e){return arguments.length?(w=e,B):w},B.clipEdge=function(e){return arguments.length?(E=e,B):E},B.clipVoronoi=function(e){return arguments.length?(S=e,B):S},B.useVoronoi=function(e){return arguments.length?(O=e,O===!1&&(S=!1),B):O},B.clipRadius=function(e){return arguments.length?(x=e,B):x},B.color=function(t){return arguments.length?(i=e.utils.getColor(t),B):i},B.shape=function(e){return arguments.length?(h=e,B):h},B.onlyCircles=function(e){return arguments.length?(p=e,B):p},B.id=function(e){return arguments.length?(s=e,B):s},B.singlePoint=function(e){return arguments.length?(L=e,B):L},B},e.models.scatterChart=function(){function P(e){return e.each(function(x){function X(){if(E)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var e=d3.mouse(this);h.distortion(w).focus(e[0]),p.distortion(w).focus(e[1]),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r),U.select(".nv-distributionX").datum(x.filter(function(e){return!e.disabled})).call(o),U.select(".nv-distributionY").datum(x.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,H=(f||parseInt(T.style("width"))||960)-a.left-a.right,B=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;P.update=function(){P(e)},P.container=this,C.disabled=x.map(function(e){return!!e.disabled});if(!k){var j;k={};for(j in C)C[j]instanceof Array?k[j]=C[j].slice(0):k[j]=C[j]}if(!x||!x.length||!x.filter(function(e){return e.values.length}).length){var F=T.selectAll(".nv-noData").data([A]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",a.left+H/2).attr("y",a.top+B/2).text(function(e){return e}),P}T.selectAll(".nv-noData").remove(),O=O||h,M=M||p;var I=T.selectAll("g.nv-wrap.nv-scatterChart").data([x]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),R=q.append("g"),U=I.select("g");R.append("rect").attr("class","nvd3 nv-background"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),y&&(i.width(H/2),I.select(".nv-legendWrap").datum -(x).call(i),a.top!=i.height()&&(a.top=i.height(),B=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),I.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -a.top+")")),b&&(s.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -a.top+")").call(s)),I.attr("transform","translate("+a.left+","+a.top+")"),t.width(H).height(B).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),I.select(".nv-scatterWrap").datum(x.filter(function(e){return!e.disabled})).call(t);if(d){var z=h.domain()[1]-h.domain()[0];h.domain([h.domain()[0]-d*z,h.domain()[1]+d*z])}if(v){var W=p.domain()[1]-p.domain()[0];p.domain([p.domain()[0]-v*W,p.domain()[1]+v*W])}n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():H/100).tickSize(-B,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n),r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():B/36).tickSize(-H,0),U.select(".nv-y.nv-axis").call(r),m&&(o.getData(t.x()).scale(h).width(H).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(x.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(B).color(x.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!x[t].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate(-"+u.size()+",0)").datum(x.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(U.select(".nv-background").attr("width",H).attr("height",B),U.select(".nv-background").on("mousemove",X),U.select(".nv-background").on("click",function(){E=!E}),t.dispatch.on("elementClick.freezeFisheye",function(){E=!E})),s.dispatch.on("legendClick",function(i,s){i.disabled=!i.disabled,w=i.disabled?0:2.5,U.select(".nv-background").style("pointer-events",i.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",i.disabled?"all":"none"),i.disabled?(h.distortion(w).focus(0),p.distortion(w).focus(0),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r)):E=!1,P(e)}),i.dispatch.on("legendClick",function(t,n,r){t.disabled=!t.disabled,x.filter(function(e){return!e.disabled}).length||x.map(function(e){return e.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1),e}),C.disabled=x.map(function(e){return!!e.disabled}),L.stateChange(C),P(e)}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-B),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],L.tooltipShow(e)}),L.on("tooltipShow",function(e){S&&_(e,N.parentNode)}),L.on("changeState",function(t){typeof t.disabled!="undefined"&&(x.forEach(function(e,n){e.disabled=t.disabled[n]}),C.disabled=t.disabled),e.call(P)}),O=h.copy(),M=p.copy()}),P}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!!d3.fisheye,w=0,E=!1,S=!0,x=function(e,t,n){return""+t+""},T=function(e,t,n){return""+n+""},N=null,C={},k=null,L=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),A="No Data Available.";t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient("left").tickPadding(10),o.axis("x"),u.axis("y");var O,M,_=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));x!=null&&e.tooltip.show([f,l],x(i.series.key,v,m,i,P),"n",1,s,"x-nvtooltip"),T!=null&&e.tooltip.show([c,d],T(i.series.key,v,m,i,P),"e",1,s,"y-nvtooltip"),N!=null&&e.tooltip.show([o,u],N(i.series.key,v,m,i,P),i.value<0?"n":"s",null,s)},D=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){L.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),L.on("tooltipHide",function(){S&&e.tooltip.cleanup()}),P.dispatch=L,P.scatter=t,P.legend=i,P.controls=s,P.xAxis=n,P.yAxis=r,P.distX=o,P.distY=u,d3.rebind(P,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),P.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,P):a},P.width=function(e){return arguments.length?(f=e,P):f},P.height=function(e){return arguments.length?(l=e,P):l},P.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),P):c},P.showDistX=function(e){return arguments.length?(m=e,P):m},P.showDistY=function(e){return arguments.length?(g=e,P):g},P.showControls=function(e){return arguments.length?(b=e,P):b},P.showLegend=function(e){return arguments.length?(y=e,P):y},P.fisheye=function(e){return arguments.length?(w=e,P):w},P.xPadding=function(e){return arguments.length?(d=e,P):d},P.yPadding=function(e){return arguments.length?(v=e,P):v},P.tooltips=function(e){return arguments.length?(S=e,P):S},P.tooltipContent=function(e){return arguments.length?(N=e,P):N},P.tooltipXContent=function(e){return arguments.length?(x=e,P):x},P.tooltipYContent=function(e){return arguments.length?(T=e,P):T},P.state=function(e){return arguments.length?(C=e,P):C},P.defaultState=function(e){return arguments.length?(k=e,P):k},P.noData=function(e){return arguments.length?(A=e,P):A},P},e.models.scatterPlusLineChart=function(){function _(e){return e.each(function(E){function z(){if(b)return q.select(".nv-point-paths").style("pointer-events","all"),!1;q.select(".nv-point-paths").style("pointer-events","none");var e=d3.mouse(this);h.distortion(y).focus(e[0]),p.distortion(y).focus(e[1]),q.select(".nv-scatterWrap").datum(E.filter(function(e){return!e.disabled})).call(t),q.select(".nv-x.nv-axis").call(n),q.select(".nv-y.nv-axis").call(r),q.select(".nv-distributionX").datum(E.filter(function(e){return!e.disabled})).call(o),q.select(".nv-distributionY").datum(E.filter(function(e){return!e.disabled})).call(u)}var S=d3.select(this),x=this,D=(f||parseInt(S.style("width"))||960)-a.left-a.right,P=(l||parseInt(S.style("height"))||400)-a.top-a.bottom;_.update=function(){_(e)},_.container=this,T.disabled=E.map(function(e){return!!e.disabled});if(!N){var H;N={};for(H in T)T[H]instanceof Array?N[H]=T[H].slice(0):N[H]=T[H]}if(!E||!E.length||!E.filter(function(e){return e.values.length}).length){var B=S.selectAll(".nv-noData").data([k]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",a.left+D/2).attr("y",a.top+P/2).text(function(e){return e}),_}S.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),L=L||h,A=A||p;var j=S.selectAll("g.nv-wrap.nv-scatterChart").data([E]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),I=F.append("g"),q=j.select("g");I.append("rect").attr("class","nvd3 nv-background"),I.append("g").attr("class","nv-x nv-axis"),I.append("g").attr("class","nv-y nv-axis"),I.append("g").attr("class","nv-scatterWrap"),I.append("g").attr("class","nv-regressionLinesWrap"),I.append("g").attr("class","nv-distWrap"),I.append("g").attr("class","nv-legendWrap"),I.append("g").attr("class","nv-controlsWrap"),j.attr("transform","translate("+a.left+","+a.top+")"),m&&(i.width(D/2),j.select(".nv-legendWrap").datum(E).call(i),a.top!=i.height()&&(a.top=i.height(),P=(l||parseInt(S.style("height"))||400)-a.top-a.bottom),j.select(".nv-legendWrap").attr("transform","translate("+D/2+","+ -a.top+")")),g&&(s.width(180).color(["#444"]),q.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(D).height(P).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),j.select(".nv-scatterWrap").datum(E.filter(function(e){return!e.disabled})).call(t),j.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var R=j.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e}),U=R.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);R.selectAll(".nv-regLines line").attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),n.scale(h).ticks(n.ticks()?n.ticks():D/100).tickSize(-P,0),q.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n),r.scale(p).ticks(r.ticks()?r.ticks():P/36).tickSize(-D,0),q.select(".nv-y.nv-axis").call(r),d&&(o.getData(t.x()).scale(h).width(D).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),I.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),q.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(E.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(P).color(E.map(function(e,t){return e.color||c(e,t)}).filter(function(e,t){return!E[t].disabled})),I.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),q.select(".nv-distributionY").attr("transform","translate(-"+u.size()+",0)").datum(E.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(q.select(".nv-background").attr("width",D).attr("height",P),q.select(".nv-background").on("mousemove",z),q.select(".nv-background").on("click",function(){b=!b}),t.dispatch.on("elementClick.freezeFisheye",function(){b=!b})),s.dispatch.on("legendClick",function(i,s){i.disabled=!i.disabled,y=i.disabled?0:2.5,q.select(".nv-background").style("pointer-events",i.disabled?"none":"all"),q.select(".nv-point-paths").style("pointer-events",i.disabled?"all":"none"),i.disabled?(h.distortion(y).focus(0),p.distortion(y).focus(0),q.select(".nv-scatterWrap").call(t),q.select(".nv-x.nv-axis").call(n),q.select(".nv-y.nv-axis").call(r)):b=!1,_(e)}),i.dispatch.on("legendClick",function(t,n,r){t.disabled=!t.disabled,E.filter(function(e){return!e.disabled}).length||E.map(function(e){return e.disabled=!1,j.selectAll(".nv-series").classed("disabled",!1),e}),T.disabled=E.map(function(e){return!!e.disabled}),C.stateChange(T),_(e)}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-P),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],C.tooltipShow(e)}),C.on("tooltipShow",function(e){w&&O(e,x.parentNode)}),C.on("changeState",function(t){typeof t.disabled!="undefined"&&(E.forEach(function(e,n){e.disabled=t.disabled[n]}),T.disabled=t.disabled),e.call(_)}),L=h.copy(),A=p.copy()}),_}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!!d3.fisheye,y=0,b=!1,w=!0,E=function(e,t,n){return""+t+""},S=function(e,t,n){return""+n+""},x=function(e,t,n,r){return"

"+e+"

"+"

"+r+"

"},T={},N=null,C=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),k="No Data Available.";t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient("left").tickPadding(10),o.axis("x"),u.axis("y");var L,A,O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));E!=null&&e.tooltip.show([f,l],E(i.series.key,v,m,i,_),"n",1,s,"x-nvtooltip"),S!=null&&e.tooltip.show([c,d],S(i.series.key,v,m,i,_),"e",1,s,"y-nvtooltip"),x!=null&&e.tooltip.show([o,u],x(i.series.key,v,m,i.point.tooltip,i,_),i.value<0?"n":"s",null,s)},M=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),C.on("tooltipHide",function(){w&&e.tooltip.cleanup()}),_.dispatch=C,_.scatter=t,_.legend=i,_.controls=s,_.xAxis=n,_.yAxis=r,_.distX=o,_.distY=u,d3.rebind(_,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),_.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,_):a},_.width=function(e){return arguments.length?(f=e,_):f},_.height=function(e){return arguments.length?(l=e,_):l},_.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),_):c},_.showDistX=function(e){return arguments.length?(d=e,_):d},_.showDistY=function(e){return arguments.length?(v=e,_):v},_.showControls=function(e){return arguments.length?(g=e,_):g},_.showLegend=function(e){return arguments.length?(m=e,_):m},_.fisheye=function(e){return arguments.length?(y=e,_):y},_.tooltips=function(e){return arguments.length?(w=e,_):w},_.tooltipContent=function(e){return arguments.length?(x=e,_):x},_.tooltipXContent=function(e){return arguments.length?(E=e,_):E},_.tooltipYContent=function(e){return arguments.length?(S=e,_):S},_.state=function(e){return arguments.length?(T=e,_):T},_.defaultState=function(e){return arguments.length?(N=e,_):N},_.noData=function(e){return arguments.length?(k=e,_):k},_},e.models.sparkline=function(){function h(e){return e.each(function(e){var i=n-t.left-t.right,h=r-t.top-t.bottom,p=d3.select(this);s.domain(l||d3.extent(e,u)).range([0,i]),o.domain(c||d3.extent(e,a)).range([h,0]);var d=p.selectAll("g.nv-wrap.nv-sparkline").data([e]),v=d.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),m=v.append("g"),g=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var b=d.selectAll("path").data(function(e){return[e]});b.enter().append("path"),b.exit().remove(),b.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var w=d.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});w.enter().append("circle"),w.exit().remove(),w.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),h}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c;return h.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,h):t},h.width=function(e){return arguments.length?(n=e,h):n},h.height=function(e){return arguments.length?(r=e,h):r},h.x=function(e){return arguments.length?(u=d3.functor(e),h):u},h.y=function(e){return arguments.length?(a=d3.functor(e),h):a},h.xScale=function(e){return arguments.length?(s=e,h):s},h.yScale=function(e){return arguments.length?(o=e,h):o},h.xDomain=function(e){return arguments.length?(l=e,h):l},h.yDomain=function(e){return arguments.length?(c=e,h):c},h.animate=function(e){return arguments.length?(i=e,h):i},h.color=function(t){return arguments.length?(f=e.utils.getColor(t),h):f},h},e.models.sparklinePlus=function(){function v(e){return e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s"+e+""+"

"+n+" on "+t+"

"},d,v,m=d3.format(",.2f"),g={style:t.style()},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7),r.orient("left"),t.scatter.pointActive(function(e){return!!Math.round(t.y()(e)*100)});var S=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,x);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],w.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),x.dispatch=w,x.stacked=t,x.legend=i,x.controls=s,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),x.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,x):o},x.width=function(e){return arguments.length?(u=e,x):getWidth},x.height=function(e){return arguments.length?(a=e,x):getHeight},x.color=function(n){return arguments.length?(f=e.utils.getColor(n),i.color(f),t.color(f),x):f},x.showControls=function(e){return arguments.length?(l=e,x):l},x.showLegend=function(e){return arguments.length?(c=e,x):c},x.tooltip=function(e){return arguments.length?(p=e,x):p},x.tooltips=function(e){return arguments.length?(h=e,x):h},x.tooltipContent=function(e){return arguments.length?(p=e,x):p},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(m=e,r):m},x}})(); \ No newline at end of file +/*! nvd3 - v0.0.1 - 2013-04-24 */(function(){function t(t,e){return new Date(e,t+1,0).getDate()}function e(t,e,n){return function(r,a,o){var i=t(r),l=[];if(r>i&&e(i),o>1)for(;a>i;){var s=new Date(+i);0===n(s)%o&&l.push(s),e(i)}else for(;a>i;)l.push(new Date(+i)),e(i);return l}}var n=window.nv||{};n.version="0.0.1a",n.dev=!0,window.nv=n,n.tooltip={},n.utils={},n.models={},n.charts={},n.graphs=[],n.logs={},n.dispatch=d3.dispatch("render_start","render_end"),n.dev&&(n.dispatch.on("render_start",function(){n.logs.startTime=+new Date}),n.dispatch.on("render_end",function(){n.logs.endTime=+new Date,n.logs.totalTime=n.logs.endTime-n.logs.startTime,n.log("total",n.logs.totalTime)})),n.log=function(){if(n.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(n.dev&&console.log&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]},n.render=function(t){t=t||1,n.render.active=!0,n.dispatch.render_start(),setTimeout(function(){for(var e,r,a=0;t>a&&(r=n.render.queue[a]);a++)e=r.generate(),typeof r.callback==typeof Function&&r.callback(e),n.graphs.push(e);n.render.queue.splice(0,a),n.render.queue.length?setTimeout(arguments.callee,0):(n.render.active=!1,n.dispatch.render_end())},0)},n.render.active=!1,n.render.queue=[],n.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),n.render.queue.push(t),n.render.active||n.render()},n.identity=function(t){return t},n.strip=function(t){return t.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(t){return new Date(t.getFullYear(),t.getMonth(),0)},d3.time.monthEnds=e(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1),e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(t){return t.getMonth()}),function(){var t=window.nv.tooltip={};t.show=function(t,e,r,a,o,i){var l=document.createElement("div");l.className="nvtooltip "+(i?i:"xy-tooltip"),r=r||"s",a=a||20;var s=o?o:document.getElementsByTagName("body")[0];l.innerHTML=e,l.style.left=0,l.style.top=0,l.style.opacity=0,s.appendChild(l);var u,c,d=parseInt(l.offsetHeight),p=parseInt(l.offsetWidth),f=n.utils.windowSize().width,g=n.utils.windowSize().height,h=window.scrollY,m=window.scrollX;g=window.innerWidth>=document.body.scrollWidth?g:g-16,f=window.innerHeight>=document.body.scrollHeight?f:f-16;var v=function(t){var e=c;do isNaN(t.offsetTop)||(e+=t.offsetTop);while(t=t.offsetParent);return e},x=function(t){var e=u;do isNaN(t.offsetLeft)||(e+=t.offsetLeft);while(t=t.offsetParent);return e};switch(r){case"e":u=t[0]-p-a,c=t[1]-d/2;var y=x(l),b=v(l);m>y&&(u=t[0]+a>m?t[0]+a:m-y+u),h>b&&(c=h-b+c),b+d>h+g&&(c=h+g-b+c-d);break;case"w":u=t[0]+a,c=t[1]-d/2,y+p>f&&(u=t[0]-p-a),h>b&&(c=h+5),b+d>h+g&&(c=h-d-5);break;case"n":u=t[0]-p/2-5,c=t[1]+a;var y=x(l),b=v(l);m>y&&(u=m+5),y+p>f&&(u=u-p/2+5),b+d>h+g&&(c=h+g-b+c-d);break;case"s":u=t[0]-p/2,c=t[1]-d-a;var y=x(l),b=v(l);m>y&&(u=m+5),y+p>f&&(u=u-p/2+5),h>b&&(c=h)}return l.style.left=u+"px",l.style.top=c+"px",l.style.opacity=1,l.style.position="absolute",l.style.pointerEvents="none",l},t.cleanup=function(){for(var t=document.getElementsByClassName("nvtooltip"),e=[];t.length;)e.push(t[0]),t[0].style.transitionDelay="0 !important",t[0].style.opacity=0,t[0].className="nvtooltip-pending-removal";setTimeout(function(){for(;e.length;){var t=e.pop();t.parentNode.removeChild(t)}},500)}}(),n.utils.windowSize=function(){var t={width:640,height:480};return document.body&&document.body.offsetWidth&&(t.width=document.body.offsetWidth,t.height=document.body.offsetHeight),"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth&&(t.width=document.documentElement.offsetWidth,t.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(t.width=window.innerWidth,t.height=window.innerHeight),t},n.utils.windowResize=function(t){var e=window.onresize;window.onresize=function(n){"function"==typeof e&&e(n),t(n)}},n.utils.getColor=function(t){return arguments.length?"[object Array]"===Object.prototype.toString.call(t)?function(e,n){return e.color||t[n%t.length]}:t:n.utils.defaultColor()},n.utils.defaultColor=function(){var t=d3.scale.category20().range();return function(e,n){return e.color||t[n%t.length]}},n.utils.customTheme=function(t,e,n){e=e||function(t){return t.key},n=n||d3.scale.category20().range();var r=n.length;return function(a){var o=e(a);return r||(r=n.length),t[o]!==void 0?"function"==typeof t[o]?t[o]():t[o]:n[--r]}},n.utils.pjax=function(t,e){function r(r){d3.html(r,function(r){var a=d3.select(e).node();a.parentNode.replaceChild(d3.select(r).select(e).node(),a),n.utils.pjax(t,e)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},n.models.axis=function(){function t(a){return a.each(function(t){var a=d3.select(this),h=a.selectAll("g.nv-wrap.nv-axis").data([t]),m=h.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");m.append("g");var v=h.select("g");null!==f?e.ticks(f):("top"==e.orient()||"bottom"==e.orient())&&e.ticks(Math.abs(o.range()[1]-o.range()[0])/100),d3.transition(v).call(e),g=g||e.scale();var x=e.tickFormat();null==x&&(x=g.tickFormat());var y=v.selectAll("text.nv-axislabel").data([i||null]);switch(y.exit().remove(),e.orient()){case"top":y.enter().append("text").attr("class","nv-axislabel");var b=2==o.range().length?o.range()[1]:o.range()[o.range().length-1]+(o.range()[1]-o.range()[0]);if(y.attr("text-anchor","middle").attr("y",0).attr("x",b/2),l){var k=h.selectAll("g.nv-axisMaxMin").data(o.domain());k.enter().append("g").attr("class","nv-axisMaxMin").append("text"),k.exit().remove(),k.attr("transform",function(t){return"translate("+o(t)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(t){var e=x(t);return(""+e).match("NaN")?"":e}),d3.transition(k).attr("transform",function(t,e){return"translate("+o.range()[e]+",0)"})}break;case"bottom":var w=36,A=30,C=v.selectAll("g").select("text");if(u%360){C.each(function(){var t=this.getBBox().width;t>A&&(A=t)});var M=Math.abs(Math.sin(u*Math.PI/180)),w=(M?M*A:A)+30;C.attr("transform",function(){return"rotate("+u+" 0,0)"}).attr("text-anchor",u%360>0?"start":"end")}y.enter().append("text").attr("class","nv-axislabel");var b=2==o.range().length?o.range()[1]:o.range()[o.range().length-1]+(o.range()[1]-o.range()[0]);if(y.attr("text-anchor","middle").attr("y",w).attr("x",b/2),l){var k=h.selectAll("g.nv-axisMaxMin").data([o.domain()[0],o.domain()[o.domain().length-1]]);k.enter().append("g").attr("class","nv-axisMaxMin").append("text"),k.exit().remove(),k.attr("transform",function(t){return"translate("+(o(t)+(p?o.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(){return"rotate("+u+" 0,0)"}).attr("text-anchor",u?u%360>0?"start":"end":"middle").text(function(t){var e=x(t);return(""+e).match("NaN")?"":e}),d3.transition(k).attr("transform",function(t){return"translate("+(o(t)+(p?o.rangeBand()/2:0))+",0)"})}d&&C.attr("transform",function(t,e){return"translate(0,"+(0==e%2?"0":"12")+")"});break;case"right":if(y.enter().append("text").attr("class","nv-axislabel"),y.attr("text-anchor",c?"middle":"begin").attr("transform",c?"rotate(90)":"").attr("y",c?-Math.max(n.right,r)+12:-10).attr("x",c?o.range()[0]/2:e.tickPadding()),l){var k=h.selectAll("g.nv-axisMaxMin").data(o.domain());k.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),k.exit().remove(),k.attr("transform",function(t){return"translate(0,"+o(t)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).attr("text-anchor","start").text(function(t){var e=x(t);return(""+e).match("NaN")?"":e}),d3.transition(k).attr("transform",function(t,e){return"translate(0,"+o.range()[e]+")"}).select("text").style("opacity",1)}break;case"left":if(y.enter().append("text").attr("class","nv-axislabel"),y.attr("text-anchor",c?"middle":"end").attr("transform",c?"rotate(-90)":"").attr("y",c?-Math.max(n.left,r)+12:-10).attr("x",c?-o.range()[0]/2:-e.tickPadding()),l){var k=h.selectAll("g.nv-axisMaxMin").data(o.domain());k.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),k.exit().remove(),k.attr("transform",function(t){return"translate(0,"+g(t)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(t){var e=x(t);return(""+e).match("NaN")?"":e}),d3.transition(k).attr("transform",function(t,e){return"translate(0,"+o.range()[e]+")"}).select("text").style("opacity",1)}}if(y.text(function(t){return t}),!l||"left"!==e.orient()&&"right"!==e.orient()||(v.selectAll("g").each(function(t){d3.select(this).select("text").attr("opacity",1),(o(t)o.range()[0]-10)&&((t>1e-10||-1e-10>t)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),o.domain()[0]==o.domain()[1]&&0==o.domain()[0]&&h.selectAll("g.nv-axisMaxMin").style("opacity",function(t,e){return e?0:1})),l&&("top"===e.orient()||"bottom"===e.orient())){var S=[];h.selectAll("g.nv-axisMaxMin").each(function(t,e){try{e?S.push(o(t)-this.getBBox().width-4):S.push(o(t)+this.getBBox().width+4)}catch(n){e?S.push(o(t)-4):S.push(o(t)+4)}}),v.selectAll("g").each(function(t){(o(t)S[1])&&(t>1e-10||-1e-10>t?d3.select(this).remove():d3.select(this).select("text").remove())})}s&&v.selectAll("line.tick").filter(function(t){return!parseFloat(Math.round(1e5*t)/1e6)}).classed("zero",!0),g=o.copy()}),t}var e=d3.svg.axis(),n={top:0,right:0,bottom:0,left:0},r=75,a=60,o=d3.scale.linear(),i=null,l=!0,s=!0,u=0,c=!0,d=!1,p=!1,f=null;e.scale(o).orient("bottom").tickFormat(function(t){return t});var g;return t.axis=e,d3.rebind(t,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(t,o,"domain","range","rangeBand","rangeBands"),t.margin=function(e){return arguments.length?(n.top=e.top!==void 0?e.top:n.top,n.right=e.right!==void 0?e.right:n.right,n.bottom=e.bottom!==void 0?e.bottom:n.bottom,n.left=e.left!==void 0?e.left:n.left,t):n},t.width=function(e){return arguments.length?(r=e,t):r},t.ticks=function(e){return arguments.length?(f=e,t):f},t.height=function(e){return arguments.length?(a=e,t):a},t.axisLabel=function(e){return arguments.length?(i=e,t):i},t.showMaxMin=function(e){return arguments.length?(l=e,t):l},t.highlightZero=function(e){return arguments.length?(s=e,t):s},t.scale=function(n){return arguments.length?(o=n,e.scale(o),p="function"==typeof o.rangeBands,d3.rebind(t,o,"domain","range","rangeBand","rangeBands"),t):o},t.rotateYLabel=function(e){return arguments.length?(c=e,t):c},t.rotateLabels=function(e){return arguments.length?(u=e,t):u},t.staggerLabels=function(e){return arguments.length?(d=e,t):d},t},n.models.historicalBar=function(){function t(n){return n.each(function(t){var n=o-a.left-a.right,x=i-a.top-a.bottom,y=d3.select(this);s.domain(e||d3.extent(t[0].values.map(c).concat(p))),g?s.range([.5*n/t[0].values.length,n*(t[0].values.length-.5)/t[0].values.length]):s.range([0,n]),u.domain(r||d3.extent(t[0].values.map(d).concat(f))).range([x,0]),(s.domain()[0]===s.domain()[1]||u.domain()[0]===u.domain()[1])&&(singlePoint=!0),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-.01*s.domain()[0],s.domain()[1]+.01*s.domain()[1]]):s.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]+.01*u.domain()[0],u.domain()[1]-.01*u.domain()[1]]):u.domain([-1,1]));var b=y.selectAll("g.nv-wrap.nv-bar").data([t[0].values]),k=b.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),w=k.append("defs"),A=k.append("g"),C=b.select("g");A.append("g").attr("class","nv-bars"),b.attr("transform","translate("+a.left+","+a.top+")"),y.on("click",function(t,e){v.chartClick({data:t,index:e,pos:d3.event,id:l})}),w.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),b.select("#nv-chart-clip-path-"+l+" rect").attr("width",n).attr("height",x),C.attr("clip-path",h?"url(#nv-chart-clip-path-"+l+")":"");var M=b.select(".nv-bars").selectAll(".nv-bar").data(function(t){return t});M.exit().remove(),M.enter().append("rect").attr("x",0).attr("y",function(t,e){return u(Math.max(0,d(t,e)))}).attr("height",function(t,e){return Math.abs(u(d(t,e))-u(0))}).on("mouseover",function(e,n){d3.select(this).classed("hover",!0),v.elementMouseover({point:e,series:t[0],pos:[s(c(e,n)),u(d(e,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,n){d3.select(this).classed("hover",!1),v.elementMouseout({point:e,series:t[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(t,e){v.elementClick({value:d(t,e),data:t,index:e,pos:[s(c(t,e)),u(d(t,e))],e:d3.event,id:l}),d3.event.stopPropagation()}).on("dblclick",function(t,e){v.elementDblClick({value:d(t,e),data:t,index:e,pos:[s(c(t,e)),u(d(t,e))],e:d3.event,id:l}),d3.event.stopPropagation()}),M.attr("fill",function(t,e){return m(t,e)}).attr("class",function(t,e,n){return(0>d(t,e)?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+e}).attr("transform",function(e,r){return"translate("+(s(c(e,r))-.45*(n/t[0].values.length))+",0)"}).attr("width",.9*(n/t[0].values.length)),d3.transition(M).attr("y",function(t,e){return 0>d(t,e)?u(0):1>u(0)-u(d(t,e))?u(0)-1:u(d(t,e))}).attr("height",function(t,e){return Math.max(Math.abs(u(d(t,e))-u(0)),1)})}),t}var e,r,a={top:0,right:0,bottom:0,left:0},o=960,i=500,l=Math.floor(1e4*Math.random()),s=d3.scale.linear(),u=d3.scale.linear(),c=function(t){return t.x},d=function(t){return t.y},p=[],f=[0],g=!1,h=!0,m=n.utils.defaultColor(),v=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return t.dispatch=v,t.x=function(e){return arguments.length?(c=e,t):c},t.y=function(e){return arguments.length?(d=e,t):d},t.margin=function(e){return arguments.length?(a.top=e.top!==void 0?e.top:a.top,a.right=e.right!==void 0?e.right:a.right,a.bottom=e.bottom!==void 0?e.bottom:a.bottom,a.left=e.left!==void 0?e.left:a.left,t):a},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.xScale=function(e){return arguments.length?(s=e,t):s},t.yScale=function(e){return arguments.length?(u=e,t):u},t.xDomain=function(n){return arguments.length?(e=n,t):e},t.yDomain=function(e){return arguments.length?(r=e,t):r},t.forceX=function(e){return arguments.length?(p=e,t):p},t.forceY=function(e){return arguments.length?(f=e,t):f},t.padData=function(e){return arguments.length?(g=e,t):g},t.clipEdge=function(e){return arguments.length?(h=e,t):h},t.color=function(e){return arguments.length?(m=n.utils.getColor(e),t):m},t.id=function(e){return arguments.length?(l=e,t):l},t},n.models.bullet=function(){function t(n){return n.each(function(t,n){var r=u-e.left-e.right,d=c-e.top-e.bottom,g=d3.select(this),h=o.call(this,t,n).slice().sort(d3.descending),m=i.call(this,t,n).slice().sort(d3.descending),v=l.call(this,t,n).slice().sort(d3.descending),x=d3.scale.linear().domain(d3.extent(d3.merge([s,h]))).range(a?[r,0]:[0,r]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(x.range()),this.__chart__=x;var y=d3.min(h),b=d3.max(h),k=h[1],w=g.selectAll("g.nv-wrap.nv-bullet").data([t]),A=w.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),C=A.append("g"),M=w.select("g");C.append("rect").attr("class","nv-range nv-rangeMax"),C.append("rect").attr("class","nv-range nv-rangeAvg"),C.append("rect").attr("class","nv-range nv-rangeMin"),C.append("rect").attr("class","nv-measure"),C.append("path").attr("class","nv-markerTriangle"),w.attr("transform","translate("+e.left+","+e.top+")");var S=function(t){return Math.abs(x(t)-x(0))},D=function(t){return 0>t?x(t):x(0)};M.select("rect.nv-rangeMax").attr("height",d).attr("width",S(b>0?b:y)).attr("x",D(b>0?b:y)).datum(b>0?b:y),M.select("rect.nv-rangeAvg").attr("height",d).attr("width",S(k)).attr("x",D(k)).datum(k),M.select("rect.nv-rangeMin").attr("height",d).attr("width",S(b)).attr("x",D(b)).attr("width",S(b>0?y:b)).attr("x",D(b>0?y:b)).datum(b>0?y:b),M.select("rect.nv-measure").style("fill",p).attr("height",d/3).attr("y",d/3).attr("width",0>v?x(0)-x(v[0]):x(v[0])-x(0)).attr("x",D(v)).on("mouseover",function(){f.elementMouseover({value:v[0],label:"Current",pos:[x(v[0]),d/2]})}).on("mouseout",function(){f.elementMouseout({value:v[0],label:"Current"})});var I=d/6;m[0]?M.selectAll("path.nv-markerTriangle").attr("transform",function(){return"translate("+x(m[0])+","+d/2+")"}).attr("d","M0,"+I+"L"+I+","+-I+" "+-I+","+-I+"Z").on("mouseover",function(){f.elementMouseover({value:m[0],label:"Previous",pos:[x(m[0]),d/2]})}).on("mouseout",function(){f.elementMouseout({value:m[0],label:"Previous"})}):M.selectAll("path.nv-markerTriangle").remove(),w.selectAll(".nv-range").on("mouseover",function(t,e){var n=e?1==e?"Mean":"Minimum":"Maximum";f.elementMouseover({value:t,label:n,pos:[x(t),d/2]})}).on("mouseout",function(t,e){var n=e?1==e?"Mean":"Minimum":"Maximum";f.elementMouseout({value:t,label:n})})}),t}var e={top:0,right:0,bottom:0,left:0},r="left",a=!1,o=function(t){return t.ranges},i=function(t){return t.markers},l=function(t){return t.measures},s=[0],u=380,c=30,d=null,p=n.utils.getColor(["#1f77b4"]),f=d3.dispatch("elementMouseover","elementMouseout");return t.dispatch=f,t.orient=function(e){return arguments.length?(r=e,a="right"==r||"bottom"==r,t):r},t.ranges=function(e){return arguments.length?(o=e,t):o},t.markers=function(e){return arguments.length?(i=e,t):i},t.measures=function(e){return arguments.length?(l=e,t):l},t.forceX=function(e){return arguments.length?(s=e,t):s},t.width=function(e){return arguments.length?(u=e,t):u},t.height=function(e){return arguments.length?(c=e,t):c},t.margin=function(n){return arguments.length?(e.top=n.top!==void 0?n.top:e.top,e.right=n.right!==void 0?n.right:e.right,e.bottom=n.bottom!==void 0?n.bottom:e.bottom,e.left=n.left!==void 0?n.left:e.left,t):e},t.tickFormat=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),t):p},t},n.models.bulletChart=function(){function t(n){return n.each(function(r,f){var v=d3.select(this),x=(u||parseInt(v.style("width"))||960)-o.left-o.right,y=c-o.top-o.bottom,b=this;if(t.update=function(){t(n)},t.container=this,!r||!i.call(this,r,f)){var k=v.selectAll(".nv-noData").data([g]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",o.left+x/2).attr("y",18+o.top+y/2).text(function(t){return t}),t}v.selectAll(".nv-noData").remove();var w=i.call(this,r,f).slice().sort(d3.descending),A=l.call(this,r,f).slice().sort(d3.descending),C=s.call(this,r,f).slice().sort(d3.descending),M=v.selectAll("g.nv-wrap.nv-bulletChart").data([r]),S=M.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),D=S.append("g"),I=M.select("g");D.append("g").attr("class","nv-bulletWrap"),D.append("g").attr("class","nv-titles"),M.attr("transform","translate("+o.left+","+o.top+")");var W=d3.scale.linear().domain([0,Math.max(w[0],A[0],C[0])]).range(a?[x,0]:[0,x]),z=this.__chart__||d3.scale.linear().domain([0,1/0]).range(W.range());this.__chart__=W;var B=D.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(c-o.top-o.bottom)/2+")");B.append("text").attr("class","nv-title").text(function(t){return t.title}),B.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(t){return t.subtitle}),e.width(x).height(y);var P=I.select(".nv-bulletWrap");d3.transition(P).call(e);var H=d||W.tickFormat(x/100),F=I.selectAll("g.nv-tick").data(W.ticks(x/50),function(t){return this.textContent||H(t)}),L=F.enter().append("g").attr("class","nv-tick").attr("transform",function(t){return"translate("+z(t)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",y).attr("y2",7*y/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*y/6).text(H);var T=d3.transition(F).attr("transform",function(t){return"translate("+W(t)+",0)"}).style("opacity",1);T.select("line").attr("y1",y).attr("y2",7*y/6),T.select("text").attr("y",7*y/6),d3.transition(F.exit()).attr("transform",function(t){return"translate("+W(t)+",0)"}).style("opacity",1e-6).remove(),h.on("tooltipShow",function(t){t.key=data[0].title,p&&m(t,b.parentNode)})}),d3.timer.flush(),t}var e=n.models.bullet(),r="left",a=!1,o={top:5,right:40,bottom:20,left:120},i=function(t){return t.ranges},l=function(t){return t.markers},s=function(t){return t.measures},u=null,c=55,d=null,p=!0,f=function(t,e,n){return"

"+e+"

"+"

"+n+"

"},g="No Data Available.",h=d3.dispatch("tooltipShow","tooltipHide"),m=function(e,r){var a=e.pos[0]+(r.offsetLeft||0)+o.left,i=e.pos[1]+(r.offsetTop||0)+o.top,l=f(e.key,e.label,e.value,e,t);n.tooltip.show([a,i],l,0>e.value?"e":"w",null,r)};return e.dispatch.on("elementMouseover.tooltip",function(t){h.tooltipShow(t)}),e.dispatch.on("elementMouseout.tooltip",function(t){h.tooltipHide(t)}),h.on("tooltipHide",function(){p&&n.tooltip.cleanup()}),t.dispatch=h,t.bullet=e,d3.rebind(t,e,"color"),t.orient=function(e){return arguments.length?(r=e,a="right"==r||"bottom"==r,t):r},t.ranges=function(e){return arguments.length?(i=e,t):i},t.markers=function(e){return arguments.length?(l=e,t):l},t.measures=function(e){return arguments.length?(s=e,t):s},t.width=function(e){return arguments.length?(u=e,t):u},t.height=function(e){return arguments.length?(c=e,t):c},t.margin=function(e){return arguments.length?(o.top=e.top!==void 0?e.top:o.top,o.right=e.right!==void 0?e.right:o.right,o.bottom=e.bottom!==void 0?e.bottom:o.bottom,o.left=e.left!==void 0?e.left:o.left,t):o},t.tickFormat=function(e){return arguments.length?(d=e,t):d},t.tooltips=function(e){return arguments.length?(p=e,t):p},t.tooltipContent=function(e){return arguments.length?(f=e,t):f},t.noData=function(e){return arguments.length?(g=e,t):g},t},n.models.cumulativeLineChart=function(){function t(n){return n.each(function(x){function D(){d3.select(t.container).style("cursor","ew-resize")}function I(){M.x=d3.event.x,M.i=Math.round(C.invert(M.x)),z()}function W(){d3.select(t.container).style("cursor","auto"),b.index=M.i,A.stateChange(b)}function z(){O.data([M]),t.update()}var B=d3.select(this).classed("nv-chart-"+y,!0),P=this,H=(p||parseInt(B.style("width"))||960)-c.left-c.right,F=(f||parseInt(B.style("height"))||400)-c.top-c.bottom;if(t.update=function(){t(n)},t.container=this,b.disabled=x.map(function(t){return!!t.disabled}),!k){var L;k={};for(L in b)k[L]=b[L]instanceof Array?b[L].slice(0):b[L]}var T=d3.behavior.drag().on("dragstart",D).on("drag",I).on("dragend",W);if(!(x&&x.length&&x.filter(function(t){return t.values.length}).length)){var N=B.selectAll(".nv-noData").data([w]);return N.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),N.attr("x",c.left+H/2).attr("y",c.top+F/2).text(function(t){return t}),t}if(B.selectAll(".nv-noData").remove(),r=o.xScale(),a=o.yScale(),v)o.yDomain(null);else{var Y=x.filter(function(t){return!t.disabled}).map(function(t){var e=d3.extent(t.values,o.y());return-.95>e[0]&&(e[0]=-.95),[(e[0]-e[1])/(1+e[1]),(e[1]-e[0])/(1+e[0])]}),E=[d3.min(Y,function(t){return t[0]}),d3.max(Y,function(t){return t[1]})];o.yDomain(E)}C.domain([0,x[0].values.length-1]).range([0,H]).clamp(!0);var x=e(M.i,x),V=B.selectAll("g.nv-wrap.nv-cumulativeLine").data([x]),_=V.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),X=V.select("g");if(_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-background"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-controlsWrap"),g&&(s.width(H),X.select(".nv-legendWrap").datum(x).call(s),c.top!=s.height()&&(c.top=s.height(),F=(f||parseInt(B.style("height"))||400)-c.top-c.bottom),X.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")")),m){var R=[{key:"Re-scale y-axis",disabled:!v}];u.width(140).color(["#444","#444","#444"]),X.select(".nv-controlsWrap").datum(R).attr("transform","translate(0,"+-c.top+")").call(u)}V.attr("transform","translate("+c.left+","+c.top+")");var K=x.filter(function(t){return t.tempDisabled});V.select(".tempDisabled").remove(),K.length&&V.append("text").attr("class","tempDisabled").attr("x",H/2).attr("y","-.71em").style("text-anchor","end").text(K.map(function(t){return t.key}).join(", ")+" values cannot be calculated for this time period."),_.select(".nv-background").append("rect"),X.select(".nv-background rect").attr("width",H).attr("height",F),o.y(function(t){return t.display.y}).width(H).height(F).color(x.map(function(t,e){return t.color||d(t,e)}).filter(function(t,e){return!x[e].disabled&&!x[e].tempDisabled}));var Z=X.select(".nv-linesWrap").datum(x.filter(function(t){return!t.disabled&&!t.tempDisabled}));Z.call(o);var O=Z.selectAll(".nv-indexLine").data([M]);O.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(T),O.attr("transform",function(t){return"translate("+C(t.i)+",0)"}).attr("height",F),i.scale(r).ticks(Math.min(x[0].values.length,H/70)).tickSize(-F,0),X.select(".nv-x.nv-axis").attr("transform","translate(0,"+a.range()[0]+")"),d3.transition(X.select(".nv-x.nv-axis")).call(i),l.scale(a).ticks(F/36).tickSize(-H,0),d3.transition(X.select(".nv-y.nv-axis")).call(l),X.select(".nv-background rect").on("click",function(){M.x=d3.mouse(this)[0],M.i=Math.round(C.invert(M.x)),b.index=M.i,A.stateChange(b),z()}),o.dispatch.on("elementClick",function(t){M.i=t.pointIndex,M.x=C(M.i),b.index=M.i,A.stateChange(b),z()}),u.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,v=!e.disabled,b.rescaleY=v,A.stateChange(b),n.call(t)}),s.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,x.filter(function(t){return!t.disabled}).length||x.map(function(t){return t.disabled=!1,V.selectAll(".nv-series").classed("disabled",!1),t}),b.disabled=x.map(function(t){return!!t.disabled}),A.stateChange(b),n.call(t)}),A.on("tooltipShow",function(t){h&&S(t,P.parentNode)}),A.on("changeState",function(e){e.disabled!==void 0&&(x.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),e.index!==void 0&&(M.i=e.index,M.x=C(M.i),b.index=e.index,O.data([M])),e.rescaleY!==void 0&&(v=e.rescaleY),n.call(t)})}),t}function e(t,e){return e.map(function(e){var n=o.y()(e.values[t],t);return-.95>n?(e.tempDisabled=!0,e):(e.tempDisabled=!1,e.values=e.values.map(function(t,e){return t.display={y:(o.y()(t,e)-n)/(1+n)},t}),e)})}var r,a,o=n.models.line(),i=n.models.axis(),l=n.models.axis(),s=n.models.legend(),u=n.models.legend(),c={top:30,right:30,bottom:50,left:60},d=n.utils.defaultColor(),p=null,f=null,g=!0,h=!0,m=!0,v=!0,x=function(t,e,n){return"

"+t+"

"+"

"+n+" at "+e+"

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

"+e+"

"+"

"+n+"

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

"+t+"

"+"

"+n+" at "+e+"

"},h={},m=null,v="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");o.orient("bottom").tickPadding(7),i.orient("left");var y=function(e,r){if(r){var l=d3.select(r).select("svg"),s=l.attr("viewBox");if(s){s=s.split(" ");var u=parseInt(l.style("width"))/s[2];e.pos[0]=e.pos[0]*u,e.pos[1]=e.pos[1]*u}}var c=e.pos[0]+(r.offsetLeft||0),d=e.pos[1]+(r.offsetTop||0),p=o.tickFormat()(a.x()(e.point,e.pointIndex)),f=i.tickFormat()(a.y()(e.point,e.pointIndex)),h=g(e.series.key,p,f,e,t);n.tooltip.show([c,d],h,null,null,r)};return a.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+s.left,t.pos[1]+s.top],x.tooltipShow(t)}),a.dispatch.on("elementMouseout.tooltip",function(t){x.tooltipHide(t)}),x.on("tooltipHide",function(){f&&n.tooltip.cleanup()}),t.dispatch=x,t.lines=a,t.legend=l,t.xAxis=o,t.yAxis=i,d3.rebind(t,a,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),t.margin=function(e){return arguments.length?(s.top=e.top!==void 0?e.top:s.top,s.right=e.right!==void 0?e.right:s.right,s.bottom=e.bottom!==void 0?e.bottom:s.bottom,s.left=e.left!==void 0?e.left:s.left,t):s},t.width=function(e){return arguments.length?(c=e,t):c},t.height=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(u=n.utils.getColor(e),l.color(u),t):u},t.showLegend=function(e){return arguments.length?(p=e,t):p},t.tooltips=function(e){return arguments.length?(f=e,t):f},t.tooltipContent=function(e){return arguments.length?(g=e,t):g},t.state=function(e){return arguments.length?(h=e,t):h},t.defaultState=function(e){return arguments.length?(m=e,t):m},t.noData=function(e){return arguments.length?(v=e,t):v},t},n.models.linePlusBarChart=function(){function t(n){return n.each(function(g){var h=d3.select(this),y=this,M=(p||parseInt(h.style("width"))||960)-d.left-d.right,S=(f||parseInt(h.style("height"))||400)-d.top-d.bottom;if(t.update=function(){t(n)},t.container=this,b.disabled=g.map(function(t){return!!t.disabled}),!k){var D;k={};for(D in b)k[D]=b[D]instanceof Array?b[D].slice(0):b[D]}if(!(g&&g.length&&g.filter(function(t){return t.values.length}).length)){var I=h.selectAll(".nv-noData").data([w]);return I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),I.attr("x",d.left+M/2).attr("y",d.top+S/2).text(function(t){return t}),t}h.selectAll(".nv-noData").remove();var W=g.filter(function(t){return!t.disabled&&t.bar}),z=g.filter(function(t){return!t.bar});e=z.filter(function(t){return!t.disabled}).length&&z.filter(function(t){return!t.disabled})[0].values.length?o.xScale():i.xScale(),r=i.yScale(),a=o.yScale();var B=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([g]),P=B.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),H=B.select("g");P.append("g").attr("class","nv-x nv-axis"),P.append("g").attr("class","nv-y1 nv-axis"),P.append("g").attr("class","nv-y2 nv-axis"),P.append("g").attr("class","nv-barsWrap"),P.append("g").attr("class","nv-linesWrap"),P.append("g").attr("class","nv-legendWrap"),v&&(c.width(M/2),H.select(".nv-legendWrap").datum(g.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=t.originalKey+(t.bar?" (left axis)":" (right axis)"),t})).call(c),d.top!=c.height()&&(d.top=c.height(),S=(f||parseInt(h.style("height"))||400)-d.top-d.bottom),H.select(".nv-legendWrap").attr("transform","translate("+M/2+","+-d.top+")")),B.attr("transform","translate("+d.left+","+d.top+")"),o.width(M).height(S).color(g.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!g[e].disabled&&!g[e].bar})),i.width(M).height(S).color(g.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!g[e].disabled&&g[e].bar}));var F=H.select(".nv-barsWrap").datum(W.length?W:[{values:[]}]),L=H.select(".nv-linesWrap").datum(z[0]&&!z[0].disabled?z:[{values:[]}]);d3.transition(F).call(i),d3.transition(L).call(o),l.scale(e).ticks(M/100).tickSize(-S,0),H.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(H.select(".nv-x.nv-axis")).call(l),s.scale(r).ticks(S/36).tickSize(-M,0),d3.transition(H.select(".nv-y1.nv-axis")).style("opacity",W.length?1:0).call(s),u.scale(a).ticks(S/36).tickSize(W.length?0:-M,0),H.select(".nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+M+",0)"),d3.transition(H.select(".nv-y2.nv-axis")).call(u),c.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,g.filter(function(t){return!t.disabled}).length||g.map(function(t){return t.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1),t}),b.disabled=g.map(function(t){return!!t.disabled}),A.stateChange(b),n.transition().call(t)}),A.on("tooltipShow",function(t){x&&C(t,y.parentNode)}),A.on("changeState",function(e){e.disabled!==void 0&&(g.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),n.call(t)})}),t}var e,r,a,o=n.models.line(),i=n.models.historicalBar(),l=n.models.axis(),s=n.models.axis(),u=n.models.axis(),c=n.models.legend(),d={top:30,right:60,bottom:50,left:60},p=null,f=null,g=function(t){return t.x},h=function(t){return t.y},m=n.utils.defaultColor(),v=!0,x=!0,y=function(t,e,n){return"

"+t+"

"+"

"+n+" at "+e+"

"},b={},k=null,w="No Data Available.",A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");i.padData(!0),o.clipEdge(!1).padData(!0),l.orient("bottom").tickPadding(7).highlightZero(!1),s.orient("left"),u.orient("right");var C=function(e,r){var a=e.pos[0]+(r.offsetLeft||0),i=e.pos[1]+(r.offsetTop||0),c=l.tickFormat()(o.x()(e.point,e.pointIndex)),d=(e.series.bar?s:u).tickFormat()(o.y()(e.point,e.pointIndex)),p=y(e.series.key,c,d,e,t);n.tooltip.show([a,i],p,0>e.value?"n":"s",null,r)};return o.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+d.left,t.pos[1]+d.top],A.tooltipShow(t)}),o.dispatch.on("elementMouseout.tooltip",function(t){A.tooltipHide(t)}),i.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+d.left,t.pos[1]+d.top],A.tooltipShow(t)}),i.dispatch.on("elementMouseout.tooltip",function(t){A.tooltipHide(t)}),A.on("tooltipHide",function(){x&&n.tooltip.cleanup()}),t.dispatch=A,t.legend=c,t.lines=o,t.bars=i,t.xAxis=l,t.y1Axis=s,t.y2Axis=u,d3.rebind(t,o,"defined","size","clipVoronoi","interpolate"),t.x=function(e){return arguments.length?(g=e,o.x(e),i.x(e),t):g},t.y=function(e){return arguments.length?(h=e,o.y(e),i.y(e),t):h},t.margin=function(e){return arguments.length?(d.top=e.top!==void 0?e.top:d.top,d.right=e.right!==void 0?e.right:d.right,d.bottom=e.bottom!==void 0?e.bottom:d.bottom,d.left=e.left!==void 0?e.left:d.left,t):d},t.width=function(e){return arguments.length?(p=e,t):p},t.height=function(e){return arguments.length?(f=e,t):f},t.color=function(e){return arguments.length?(m=n.utils.getColor(e),c.color(m),t):m},t.showLegend=function(e){return arguments.length?(v=e,t):v},t.tooltips=function(e){return arguments.length?(x=e,t):x},t.tooltipContent=function(e){return arguments.length?(y=e,t):y},t.state=function(e){return arguments.length?(b=e,t):b},t.defaultState=function(e){return arguments.length?(k=e,t):k},t.noData=function(e){return arguments.length?(w=e,t):w},t},n.models.lineWithFocusChart=function(){function t(n){return n.each(function(A){function D(t){var e=+("e"==t),n=e?1:-1,r=F/3;return"M"+.5*n+","+r+"A6,6 0 0 "+e+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function I(){f.empty()||f.extent(k),X.data([f.empty()?a.domain():k]).each(function(t){var n=a(t[0])-e.range()[0],r=e.range()[1]-a(t[1]);d3.select(this).select(".left").attr("width",0>n?0:n),d3.select(this).select(".right").attr("x",a(t[1])).attr("width",0>r?0:r)})}function W(){k=f.empty()?null:f.extent(),extent=f.empty()?a.domain():f.extent(),M.brush({extent:extent,brush:f}),I();var t=Y.select(".nv-focus .nv-linesWrap").datum(A.filter(function(t){return!t.disabled}).map(function(t){return{key:t.key,values:t.values.filter(function(t,e){return i.x()(t,e)>=extent[0]&&i.x()(t,e)<=extent[1]})}}));d3.transition(t).call(i),d3.transition(Y.select(".nv-focus .nv-x.nv-axis")).call(s),d3.transition(Y.select(".nv-focus .nv-y.nv-axis")).call(u)}var z=d3.select(this),B=this,P=(v||parseInt(z.style("width"))||960)-g.left-g.right,H=(x||parseInt(z.style("height"))||400)-g.top-g.bottom-y,F=y-h.top-h.bottom;if(t.update=function(){t(n)},t.container=this,!(A&&A.length&&A.filter(function(t){return t.values.length}).length)){var L=z.selectAll(".nv-noData").data([C]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",g.left+P/2).attr("y",g.top+H/2).text(function(t){return t}),t}z.selectAll(".nv-noData").remove(),e=i.xScale(),r=i.yScale(),a=l.xScale(),o=l.yScale();var T=z.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([A]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),Y=T.select("g");N.append("g").attr("class","nv-legendWrap");var E=N.append("g").attr("class","nv-focus");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-linesWrap");var V=N.append("g").attr("class","nv-context");V.append("g").attr("class","nv-x nv-axis"),V.append("g").attr("class","nv-y nv-axis"),V.append("g").attr("class","nv-linesWrap"),V.append("g").attr("class","nv-brushBackground"),V.append("g").attr("class","nv-x nv-brush"),b&&(p.width(P),Y.select(".nv-legendWrap").datum(A).call(p),g.top!=p.height()&&(g.top=p.height(),H=(x||parseInt(z.style("height"))||400)-g.top-g.bottom-y),Y.select(".nv-legendWrap").attr("transform","translate(0,"+-g.top+")")),T.attr("transform","translate("+g.left+","+g.top+")"),i.width(P).height(H).color(A.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!A[e].disabled})),l.defined(i.defined()).width(P).height(F).color(A.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!A[e].disabled})),Y.select(".nv-context").attr("transform","translate(0,"+(H+g.bottom+h.top)+")");var _=Y.select(".nv-context .nv-linesWrap").datum(A.filter(function(t){return!t.disabled}));d3.transition(_).call(l),s.scale(e).ticks(P/100).tickSize(-H,0),u.scale(r).ticks(H/36).tickSize(-P,0),Y.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+H+")"),f.x(a).on("brush",W),k&&f.extent(k);var X=Y.select(".nv-brushBackground").selectAll("g").data([k||f.extent()]),R=X.enter().append("g");R.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),R.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=Y.select(".nv-x.nv-brush").call(f),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",D),W(),c.scale(a).ticks(P/100).tickSize(-F,0),Y.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),d3.transition(Y.select(".nv-context .nv-x.nv-axis")).call(c),d.scale(o).ticks(F/36).tickSize(-P,0),d3.transition(Y.select(".nv-context .nv-y.nv-axis")).call(d),Y.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),p.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,A.filter(function(t){return!t.disabled}).length||A.map(function(t){return t.disabled=!1,T.selectAll(".nv-series").classed("disabled",!1),t}),n.transition().call(t)}),M.on("tooltipShow",function(t){w&&S(t,B.parentNode)})}),t}var e,r,a,o,i=n.models.line(),l=n.models.line(),s=n.models.axis(),u=n.models.axis(),c=n.models.axis(),d=n.models.axis(),p=n.models.legend(),f=d3.svg.brush(),g={top:30,right:30,bottom:30,left:60},h={top:0,right:30,bottom:20,left:60},m=n.utils.defaultColor(),v=null,x=null,y=100,b=!0,k=null,w=!0,A=function(t,e,n){return"

"+t+"

"+"

"+n+" at "+e+"

"},C="No Data Available.",M=d3.dispatch("tooltipShow","tooltipHide","brush");i.clipEdge(!0),l.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),c.orient("bottom").tickPadding(5),d.orient("left");var S=function(e,r){var a=e.pos[0]+(r.offsetLeft||0),o=e.pos[1]+(r.offsetTop||0),l=s.tickFormat()(i.x()(e.point,e.pointIndex)),c=u.tickFormat()(i.y()(e.point,e.pointIndex)),d=A(e.series.key,l,c,e,t); +n.tooltip.show([a,o],d,null,null,r)};return i.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+g.left,t.pos[1]+g.top],M.tooltipShow(t)}),i.dispatch.on("elementMouseout.tooltip",function(t){M.tooltipHide(t)}),M.on("tooltipHide",function(){w&&n.tooltip.cleanup()}),t.dispatch=M,t.legend=p,t.lines=i,t.lines2=l,t.xAxis=s,t.yAxis=u,t.x2Axis=c,t.y2Axis=d,d3.rebind(t,i,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),t.x=function(e){return arguments.length?(i.x(e),l.x(e),t):i.x},t.y=function(e){return arguments.length?(i.y(e),l.y(e),t):i.y},t.margin=function(e){return arguments.length?(g.top=e.top!==void 0?e.top:g.top,g.right=e.right!==void 0?e.right:g.right,g.bottom=e.bottom!==void 0?e.bottom:g.bottom,g.left=e.left!==void 0?e.left:g.left,t):g},t.margin2=function(e){return arguments.length?(h=e,t):h},t.width=function(e){return arguments.length?(v=e,t):v},t.height=function(e){return arguments.length?(x=e,t):x},t.height2=function(e){return arguments.length?(y=e,t):y},t.color=function(e){return arguments.length?(m=n.utils.getColor(e),p.color(m),t):m},t.showLegend=function(e){return arguments.length?(b=e,t):b},t.tooltips=function(e){return arguments.length?(w=e,t):w},t.tooltipContent=function(e){return arguments.length?(A=e,t):A},t.interpolate=function(e){return arguments.length?(i.interpolate(e),l.interpolate(e),t):i.interpolate()},t.noData=function(e){return arguments.length?(C=e,t):C},t.xTickFormat=function(e){return arguments.length?(s.tickFormat(e),c.tickFormat(e),t):s.tickFormat()},t.yTickFormat=function(e){return arguments.length?(u.tickFormat(e),d.tickFormat(e),t):u.tickFormat()},t},n.models.linePlusBarWithFocusChart=function(){function t(n){return n.each(function(P){function T(t){var e=+("e"==t),n=e?1:-1,r=R/3;return"M"+.5*n+","+r+"A6,6 0 0 "+e+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function N(){b.empty()||b.extent(z),ne.data([b.empty()?a.domain():z]).each(function(t){var e=a(t[0])-a.range()[0],n=a.range()[1]-a(t[1]);d3.select(this).select(".left").attr("width",0>e?0:e),d3.select(this).select(".right").attr("x",a(t[1])).attr("width",0>n?0:n)})}function Y(){z=b.empty()?null:b.extent(),e=b.empty()?a.domain():b.extent(),F.brush({extent:e,brush:b}),N(),d.width(_).height(X).color(P.map(function(t,e){return t.color||I(t,e)}).filter(function(t,e){return!P[e].disabled&&P[e].bar})),u.width(_).height(X).color(P.map(function(t,e){return t.color||I(t,e)}).filter(function(t,e){return!P[e].disabled&&!P[e].bar}));var t=J.select(".nv-focus .nv-barsWrap").datum(Z.length?Z.map(function(t){return{key:t.key,values:t.values.filter(function(t,n){return d.x()(t,n)>=e[0]&&d.x()(t,n)<=e[1]})}}):[{values:[]}]),n=J.select(".nv-focus .nv-linesWrap").datum(O[0].disabled?[{values:[]}]:O.map(function(t){return{key:t.key,values:t.values.filter(function(t,n){return u.x()(t,n)>=e[0]&&u.x()(t,n)<=e[1]})}}));r=Z.length?d.xScale():u.xScale(),f.scale(r).ticks(_/100).tickSize(-X,0),f.domain([Math.ceil(e[0]),Math.floor(e[1])]),d3.transition(J.select(".nv-x.nv-axis")).call(f),d3.transition(t).call(d),d3.transition(n).call(u),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),h.scale(o).ticks(X/36).tickSize(-_,0),J.select(".nv-focus .nv-y1.nv-axis").style("opacity",Z.length?1:0),m.scale(i).ticks(X/36).tickSize(Z.length?0:-_,0),J.select(".nv-focus .nv-y2.nv-axis").style("opacity",O.length?1:0).attr("transform","translate("+r.range()[1]+",0)"),d3.transition(J.select(".nv-focus .nv-y1.nv-axis")).call(h),d3.transition(J.select(".nv-focus .nv-y2.nv-axis")).call(m)}var E=d3.select(this),V=this,_=(A||parseInt(E.style("width"))||960)-k.left-k.right,X=(C||parseInt(E.style("height"))||400)-k.top-k.bottom-M,R=M-w.top-w.bottom;if(t.update=function(){t(n)},t.container=this,!(P&&P.length&&P.filter(function(t){return t.values.length}).length)){var K=E.selectAll(".nv-noData").data([H]);return K.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),K.attr("x",k.left+_/2).attr("y",k.top+X/2).text(function(t){return t}),t}E.selectAll(".nv-noData").remove();var Z=P.filter(function(t){return!t.disabled&&t.bar}),O=P.filter(function(t){return!t.bar});r=d.xScale(),a=g.scale(),o=d.yScale(),i=u.yScale(),l=p.yScale(),s=c.yScale();var q=P.filter(function(t){return!t.disabled&&t.bar}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:D(t,e)}})}),j=P.filter(function(t){return!t.disabled&&!t.bar}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:D(t,e)}})});r.range([0,_]),a.domain(d3.extent(d3.merge(q.concat(j)),function(t){return t.x})).range([0,_]);var G=E.selectAll("g.nv-wrap.nv-linePlusBar").data([P]),U=G.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),J=G.select("g");U.append("g").attr("class","nv-legendWrap");var Q=U.append("g").attr("class","nv-focus");Q.append("g").attr("class","nv-x nv-axis"),Q.append("g").attr("class","nv-y1 nv-axis"),Q.append("g").attr("class","nv-y2 nv-axis"),Q.append("g").attr("class","nv-barsWrap"),Q.append("g").attr("class","nv-linesWrap");var $=U.append("g").attr("class","nv-context");$.append("g").attr("class","nv-x nv-axis"),$.append("g").attr("class","nv-y1 nv-axis"),$.append("g").attr("class","nv-y2 nv-axis"),$.append("g").attr("class","nv-barsWrap"),$.append("g").attr("class","nv-linesWrap"),$.append("g").attr("class","nv-brushBackground"),$.append("g").attr("class","nv-x nv-brush"),W&&(y.width(_/2),J.select(".nv-legendWrap").datum(P.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=t.originalKey+(t.bar?" (left axis)":" (right axis)"),t})).call(y),k.top!=y.height()&&(k.top=y.height(),X=(C||parseInt(E.style("height"))||400)-k.top-k.bottom-M),J.select(".nv-legendWrap").attr("transform","translate("+_/2+","+-k.top+")")),G.attr("transform","translate("+k.left+","+k.top+")"),p.width(_).height(R).color(P.map(function(t,e){return t.color||I(t,e)}).filter(function(t,e){return!P[e].disabled&&P[e].bar})),c.width(_).height(R).color(P.map(function(t,e){return t.color||I(t,e)}).filter(function(t,e){return!P[e].disabled&&!P[e].bar}));var te=J.select(".nv-context .nv-barsWrap").datum(Z.length?Z:[{values:[]}]),ee=J.select(".nv-context .nv-linesWrap").datum(O[0].disabled?[{values:[]}]:O);J.select(".nv-context").attr("transform","translate(0,"+(X+k.bottom+w.top)+")"),d3.transition(te).call(p),d3.transition(ee).call(c),b.x(a).on("brush",Y),z&&b.extent(z);var ne=J.select(".nv-brushBackground").selectAll("g").data([z||b.extent()]),re=ne.enter().append("g");re.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",R),re.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",R);var ae=J.select(".nv-x.nv-brush").call(b);ae.selectAll("rect").attr("height",R),ae.selectAll(".resize").append("path").attr("d",T),g.ticks(_/100).tickSize(-R,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+l.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(g),v.scale(l).ticks(R/36).tickSize(-_,0),J.select(".nv-context .nv-y1.nv-axis").style("opacity",Z.length?1:0).attr("transform","translate(0,"+a.range()[0]+")"),d3.transition(J.select(".nv-context .nv-y1.nv-axis")).call(v),x.scale(s).ticks(R/36).tickSize(Z.length?0:-_,0),J.select(".nv-context .nv-y2.nv-axis").style("opacity",O.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),d3.transition(J.select(".nv-context .nv-y2.nv-axis")).call(x),y.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,P.filter(function(t){return!t.disabled}).length||P.map(function(t){return t.disabled=!1,G.selectAll(".nv-series").classed("disabled",!1),t}),n.call(t)}),F.on("tooltipShow",function(t){B&&L(t,V.parentNode)}),Y()}),t}var e,r,a,o,i,l,s,u=n.models.line(),c=n.models.line(),d=n.models.historicalBar(),p=n.models.historicalBar(),f=n.models.axis(),g=n.models.axis(),h=n.models.axis(),m=n.models.axis(),v=n.models.axis(),x=n.models.axis(),y=n.models.legend(),b=d3.svg.brush(),k={top:30,right:30,bottom:30,left:60},w={top:0,right:30,bottom:20,left:60},A=null,C=null,M=100,S=function(t){return t.x},D=function(t){return t.y},I=n.utils.defaultColor(),W=!0,z=null,B=!0,P=function(t,e,n){return"

"+t+"

"+"

"+n+" at "+e+"

"},H="No Data Available.",F=d3.dispatch("tooltipShow","tooltipHide","brush");u.clipEdge(!0),c.interactive(!1),f.orient("bottom").tickPadding(5),h.orient("left"),m.orient("right"),g.orient("bottom").tickPadding(5),v.orient("left"),x.orient("right");var L=function(r,a){e&&(r.pointIndex+=Math.ceil(e[0]));var o=r.pos[0]+(a.offsetLeft||0),i=r.pos[1]+(a.offsetTop||0),l=f.tickFormat()(u.x()(r.point,r.pointIndex)),s=(r.series.bar?h:m).tickFormat()(u.y()(r.point,r.pointIndex)),c=P(r.series.key,l,s,r,t);n.tooltip.show([o,i],c,0>r.value?"n":"s",null,a)};return u.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+k.left,t.pos[1]+k.top],F.tooltipShow(t)}),u.dispatch.on("elementMouseout.tooltip",function(t){F.tooltipHide(t)}),d.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+k.left,t.pos[1]+k.top],F.tooltipShow(t)}),d.dispatch.on("elementMouseout.tooltip",function(t){F.tooltipHide(t)}),F.on("tooltipHide",function(){B&&n.tooltip.cleanup()}),t.dispatch=F,t.legend=y,t.lines=u,t.lines2=c,t.bars=d,t.bars2=p,t.xAxis=f,t.x2Axis=g,t.y1Axis=h,t.y2Axis=m,t.y3Axis=v,t.y4Axis=x,d3.rebind(t,u,"defined","size","clipVoronoi","interpolate"),t.x=function(e){return arguments.length?(S=e,u.x(e),d.x(e),t):S},t.y=function(e){return arguments.length?(D=e,u.y(e),d.y(e),t):D},t.margin=function(e){return arguments.length?(k.top=e.top!==void 0?e.top:k.top,k.right=e.right!==void 0?e.right:k.right,k.bottom=e.bottom!==void 0?e.bottom:k.bottom,k.left=e.left!==void 0?e.left:k.left,t):k},t.width=function(e){return arguments.length?(A=e,t):A},t.height=function(e){return arguments.length?(C=e,t):C},t.color=function(e){return arguments.length?(I=n.utils.getColor(e),y.color(I),t):I},t.showLegend=function(e){return arguments.length?(W=e,t):W},t.tooltips=function(e){return arguments.length?(B=e,t):B},t.tooltipContent=function(e){return arguments.length?(P=e,t):P},t.noData=function(e){return arguments.length?(H=e,t):H},t.brushExtent=function(e){return arguments.length?(z=e,t):z},t},n.models.multiBar=function(){function t(n){return n.each(function(t){var n=s-l.left-l.right,A=u-l.top-l.bottom,C=d3.select(this);y&&t.length&&(y=[{values:t[0].values.map(function(t){return{x:t.x,y:0,series:t.series,size:.01}})}]),v&&(t=d3.layout.stack().offset("zero").values(function(t){return t.values}).y(g)(!t.length&&y?y:t)),t=t.map(function(t,e){return t.values=t.values.map(function(t){return t.series=e,t}),t}),v&&t[0].values.map(function(e,n){var r=0,a=0;t.map(function(t){var e=t.values[n];e.size=Math.abs(e.y),0>e.y?(e.y1=a,a-=e.size):(e.y1=e.size+r,r+=e.size)})});var M=r&&a?[]:t.map(function(t){return t.values.map(function(t,e){return{x:f(t,e),y:g(t,e),y0:t.y0,y1:t.y1}})});c.domain(d3.merge(M).map(function(t){return t.x})).rangeBands([0,n],.1),d.domain(a||d3.extent(d3.merge(M).map(function(t){return v?t.y>0?t.y1:t.y1+t.y:t.y}).concat(h))).range([A,0]),(c.domain()[0]===c.domain()[1]||d.domain()[0]===d.domain()[1])&&(singlePoint=!0),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1])),o=o||c,i=i||d;var S=C.selectAll("g.nv-wrap.nv-multibar").data([t]),D=S.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),I=D.append("defs"),W=D.append("g"),z=S.select("g");W.append("g").attr("class","nv-groups"),S.attr("transform","translate("+l.left+","+l.top+")"),I.append("clipPath").attr("id","nv-edge-clip-"+p).append("rect"),S.select("#nv-edge-clip-"+p+" rect").attr("width",n).attr("height",A),z.attr("clip-path",m?"url(#nv-edge-clip-"+p+")":"");var B=S.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).selectAll("rect.nv-bar").delay(function(e,n){return n*k/t[0].values.length}).attr("y",function(t){return v?i(t.y0):i(0)}).attr("height",0).remove(),B.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return x(t,e)}).style("stroke",function(t,e){return x(t,e)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.75);var P=B.selectAll("rect.nv-bar").data(function(e){return y&&!t.length?y.values:e.values});P.exit().remove(),P.enter().append("rect").attr("class",function(t,e){return 0>g(t,e)?"nv-bar negative":"nv-bar positive"}).attr("x",function(e,n,r){return v?0:r*c.rangeBand()/t.length}).attr("y",function(t){return i(v?t.y0:0)}).attr("height",0).attr("width",c.rangeBand()/(v?1:t.length)),P.style("fill",function(t,e,n){return x(t,n,e)}).style("stroke",function(t,e,n){return x(t,n,e)}).on("mouseover",function(e,n){d3.select(this).classed("hover",!0),w.elementMouseover({value:g(e,n),point:e,series:t[e.series],pos:[c(f(e,n))+c.rangeBand()*(v?t.length/2:e.series+.5)/t.length,d(g(e,n)+(v?e.y0:0))],pointIndex:n,seriesIndex:e.series,e:d3.event})}).on("mouseout",function(e,n){d3.select(this).classed("hover",!1),w.elementMouseout({value:g(e,n),point:e,series:t[e.series],pointIndex:n,seriesIndex:e.series,e:d3.event})}).on("click",function(e,n){w.elementClick({value:g(e,n),point:e,series:t[e.series],pos:[c(f(e,n))+c.rangeBand()*(v?t.length/2:e.series+.5)/t.length,d(g(e,n)+(v?e.y0:0))],pointIndex:n,seriesIndex:e.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(e,n){w.elementDblClick({value:g(e,n),point:e,series:t[e.series],pos:[c(f(e,n))+c.rangeBand()*(v?t.length/2:e.series+.5)/t.length,d(g(e,n)+(v?e.y0:0))],pointIndex:n,seriesIndex:e.series,e:d3.event}),d3.event.stopPropagation()}),P.attr("class",function(t,e){return 0>g(t,e)?"nv-bar negative":"nv-bar positive"}).attr("transform",function(t,e){return"translate("+c(f(t,e))+",0)"}),b&&(e||(e=t.map(function(){return!0})),P.style("fill",function(t,n,r){return""+d3.rgb(b(t,n)).darker(e.map(function(t,e){return e}).filter(function(t,n){return!e[n]})[r])}).style("stroke",function(t,n,r){return""+d3.rgb(b(t,n)).darker(e.map(function(t,e){return e}).filter(function(t,n){return!e[n]})[r])})),v?d3.transition(P).delay(function(e,n){return n*k/t[0].values.length}).attr("y",function(t){return d(v?t.y1:0)}).attr("height",function(t){return Math.max(Math.abs(d(t.y+(v?t.y0:0))-d(v?t.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(e){return v?0:e.series*c.rangeBand()/t.length}).attr("width",c.rangeBand()/(v?1:t.length))}):d3.transition(P).delay(function(e,n){return n*k/t[0].values.length}).attr("x",function(e){return e.series*c.rangeBand()/t.length}).attr("width",c.rangeBand()/t.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(t,e){return 0>g(t,e)?d(0):1>d(0)-d(g(t,e))?d(0)-1:d(g(t,e))||0}).attr("height",function(t,e){return Math.max(Math.abs(d(g(t,e))-d(0)),1)||0})}),o=c.copy(),i=d.copy()}),t}var e,r,a,o,i,l={top:0,right:0,bottom:0,left:0},s=960,u=500,c=d3.scale.ordinal(),d=d3.scale.linear(),p=Math.floor(1e4*Math.random()),f=function(t){return t.x},g=function(t){return t.y},h=[0],m=!0,v=!1,x=n.utils.defaultColor(),y=!1,b=null,k=1200,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return t.dispatch=w,t.x=function(e){return arguments.length?(f=e,t):f},t.y=function(e){return arguments.length?(g=e,t):g},t.margin=function(e){return arguments.length?(l.top=e.top!==void 0?e.top:l.top,l.right=e.right!==void 0?e.right:l.right,l.bottom=e.bottom!==void 0?e.bottom:l.bottom,l.left=e.left!==void 0?e.left:l.left,t):l},t.width=function(e){return arguments.length?(s=e,t):s},t.height=function(e){return arguments.length?(u=e,t):u},t.xScale=function(e){return arguments.length?(c=e,t):c},t.yScale=function(e){return arguments.length?(d=e,t):d},t.xDomain=function(e){return arguments.length?(r=e,t):r},t.yDomain=function(e){return arguments.length?(a=e,t):a},t.forceY=function(e){return arguments.length?(h=e,t):h},t.stacked=function(e){return arguments.length?(v=e,t):v},t.clipEdge=function(e){return arguments.length?(m=e,t):m},t.color=function(e){return arguments.length?(x=n.utils.getColor(e),t):x},t.barColor=function(e){return arguments.length?(b=n.utils.getColor(e),t):b},t.disabled=function(n){return arguments.length?(e=n,t):e},t.id=function(e){return arguments.length?(p=e,t):p},t.hideable=function(e){return arguments.length?(y=e,t):y},t.delay=function(e){return arguments.length?(k=e,t):k},t},n.models.multiBarChart=function(){function t(n){return n.each(function(x){var M=d3.select(this),S=this,D=(c||parseInt(M.style("width"))||960)-u.left-u.right,I=(d||parseInt(M.style("height"))||400)-u.top-u.bottom;if(t.update=function(){n.transition().call(t)},t.container=this,y.disabled=x.map(function(t){return!!t.disabled}),!b){var W;b={};for(W in y)b[W]=y[W]instanceof Array?y[W].slice(0):y[W]}if(!(x&&x.length&&x.filter(function(t){return t.values.length}).length)){var z=M.selectAll(".nv-noData").data([k]);return z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),z.attr("x",u.left+D/2).attr("y",u.top+I/2).text(function(t){return t}),t}M.selectAll(".nv-noData").remove(),e=a.xScale(),r=a.yScale();var B=M.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([x]),P=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),H=B.select("g");if(P.append("g").attr("class","nv-x nv-axis"),P.append("g").attr("class","nv-y nv-axis"),P.append("g").attr("class","nv-barsWrap"),P.append("g").attr("class","nv-legendWrap"),P.append("g").attr("class","nv-controlsWrap"),g&&(l.width(D-A()),a.barColor()&&x.forEach(function(t,e){t.color=""+d3.rgb("#ccc").darker(1.5*e)}),H.select(".nv-legendWrap").datum(x).call(l),u.top!=l.height()&&(u.top=l.height(),I=(d||parseInt(M.style("height"))||400)-u.top-u.bottom),H.select(".nv-legendWrap").attr("transform","translate("+A()+","+-u.top+")")),f){var F=[{key:"Grouped",disabled:a.stacked()},{key:"Stacked",disabled:!a.stacked()}];s.width(A()).color(["#444","#444","#444"]),H.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+-u.top+")").call(s)}B.attr("transform","translate("+u.left+","+u.top+")"),a.disabled(x.map(function(t){return t.disabled})).width(D).height(I).color(x.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!x[e].disabled}));var L=H.select(".nv-barsWrap").datum(x.filter(function(t){return!t.disabled}));d3.transition(L).call(a),o.scale(e).ticks(D/100).tickSize(-I,0),H.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(H.select(".nv-x.nv-axis")).call(o);var T=H.select(".nv-x.nv-axis > g").selectAll("g");T.selectAll("line, text").style("opacity",1),h&&T.filter(function(t,e){return 0!==e%Math.ceil(x[0].values.length/(D/100))}).selectAll("text, line").style("opacity",0),m&&T.selectAll("text").attr("transform","rotate("+m+" 0,0)").attr("text-anchor",m>0?"start":"end"),H.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),i.scale(r).ticks(I/36).tickSize(-D,0),d3.transition(H.select(".nv-y.nv-axis")).call(i),l.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,x.filter(function(t){return!t.disabled}).length||x.map(function(t){return t.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1),t}),y.disabled=x.map(function(t){return!!t.disabled}),w.stateChange(y),n.transition().call(t)}),s.dispatch.on("legendClick",function(e){if(e.disabled){switch(F=F.map(function(t){return t.disabled=!0,t}),e.disabled=!1,e.key){case"Grouped":a.stacked(!1);break;case"Stacked":a.stacked(!0)}y.stacked=a.stacked(),w.stateChange(y),n.transition().call(t)}}),w.on("tooltipShow",function(t){v&&C(t,S.parentNode)}),w.on("changeState",function(e){e.disabled!==void 0&&(x.forEach(function(t,n){t.disabled=e.disabled[n]}),y.disabled=e.disabled),e.stacked!==void 0&&(a.stacked(e.stacked),y.stacked=e.stacked),n.call(t)})}),t}var e,r,a=n.models.multiBar(),o=n.models.axis(),i=n.models.axis(),l=n.models.legend(),s=n.models.legend(),u={top:30,right:20,bottom:30,left:60},c=null,d=null,p=n.utils.defaultColor(),f=!0,g=!0,h=!0,m=0,v=!0,x=function(t,e,n){return"

"+t+"

"+"

"+n+" on "+e+"

"},y={stacked:!1},b=null,k="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),A=function(){return f?180:0};a.stacked(!1),o.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(t){return t}),i.orient("left").tickFormat(d3.format(",.1f"));var C=function(e,r){var l=e.pos[0]+(r.offsetLeft||0),s=e.pos[1]+(r.offsetTop||0),u=o.tickFormat()(a.x()(e.point,e.pointIndex)),c=i.tickFormat()(a.y()(e.point,e.pointIndex)),d=x(e.series.key,u,c,e,t);n.tooltip.show([l,s],d,0>e.value?"n":"s",null,r)};return a.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+u.left,t.pos[1]+u.top],w.tooltipShow(t)}),a.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),w.on("tooltipHide",function(){v&&n.tooltip.cleanup()}),t.dispatch=w,t.multibar=a,t.legend=l,t.xAxis=o,t.yAxis=i,d3.rebind(t,a,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay","barColor"),t.margin=function(e){return arguments.length?(u.top=e.top!==void 0?e.top:u.top,u.right=e.right!==void 0?e.right:u.right,u.bottom=e.bottom!==void 0?e.bottom:u.bottom,u.left=e.left!==void 0?e.left:u.left,t):u},t.width=function(e){return arguments.length?(c=e,t):c},t.height=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),l.color(p),t):p},t.showControls=function(e){return arguments.length?(f=e,t):f},t.showLegend=function(e){return arguments.length?(g=e,t):g},t.reduceXTicks=function(e){return arguments.length?(h=e,t):h},t.rotateLabels=function(e){return arguments.length?(m=e,t):m},t.tooltip=function(e){return arguments.length?(x=e,t):x},t.tooltips=function(e){return arguments.length?(v=e,t):v},t.tooltipContent=function(e){return arguments.length?(x=e,t):x},t.state=function(e){return arguments.length?(y=e,t):y},t.defaultState=function(e){return arguments.length?(b=e,t):b},t.noData=function(e){return arguments.length?(k=e,t):k},t},n.models.multiBarHorizontal=function(){function t(n){return n.each(function(t){var n=s-l.left-l.right,c=u-l.top-l.bottom;d3.select(this),x&&(t=d3.layout.stack().offset("zero").values(function(t){return t.values}).y(g)(t)),t=t.map(function(t,e){return t.values=t.values.map(function(t){return t.series=e,t}),t}),x&&t[0].values.map(function(e,n){var r=0,a=0;t.map(function(t){var e=t.values[n];e.size=Math.abs(e.y),0>e.y?(e.y1=a-e.size,a-=e.size):(e.y1=r,r+=e.size)})});var w=r&&a?[]:t.map(function(t){return t.values.map(function(t,e){return{x:f(t,e),y:g(t,e),y0:t.y0,y1:t.y1}})});d.domain(r||d3.merge(w).map(function(t){return t.x})).rangeBands([0,c],.1),p.domain(a||d3.extent(d3.merge(w).map(function(t){return x?t.y>0?t.y1+t.y:t.y1:t.y}).concat(h))),y&&!x?p.range([0>p.domain()[0]?b:0,n-(p.domain()[1]>0?b:0)]):p.range([0,n]),o=o||d,i=i||d3.scale.linear().domain(p.domain()).range([p(0),p(0)]);var C=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([t]),M=C.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");M.append("defs");var S=M.append("g");C.select("g"),S.append("g").attr("class","nv-groups"),C.attr("transform","translate("+l.left+","+l.top+")");var D=C.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(D.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return m(t,e)}).style("stroke",function(t,e){return m(t,e)}),d3.transition(D).style("stroke-opacity",1).style("fill-opacity",.75);var I=D.selectAll("g.nv-bar").data(function(t){return t.values});I.exit().remove();var W=I.enter().append("g").attr("transform",function(e,n,r){return"translate("+i(x?e.y0:0)+","+(x?0:r*d.rangeBand()/t.length+d(f(e,n)))+")"});W.append("rect").attr("width",0).attr("height",d.rangeBand()/(x?1:t.length)),I.on("mouseover",function(e,n){d3.select(this).classed("hover",!0),A.elementMouseover({value:g(e,n),point:e,series:t[e.series],pos:[p(g(e,n)+(x?e.y0:0)),d(f(e,n))+d.rangeBand()*(x?t.length/2:e.series+.5)/t.length],pointIndex:n,seriesIndex:e.series,e:d3.event})}).on("mouseout",function(e,n){d3.select(this).classed("hover",!1),A.elementMouseout({value:g(e,n),point:e,series:t[e.series],pointIndex:n,seriesIndex:e.series,e:d3.event})}).on("click",function(e,n){A.elementClick({value:g(e,n),point:e,series:t[e.series],pos:[d(f(e,n))+d.rangeBand()*(x?t.length/2:e.series+.5)/t.length,p(g(e,n)+(x?e.y0:0))],pointIndex:n,seriesIndex:e.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(e,n){A.elementDblClick({value:g(e,n),point:e,series:t[e.series],pos:[d(f(e,n))+d.rangeBand()*(x?t.length/2:e.series+.5)/t.length,p(g(e,n)+(x?e.y0:0))],pointIndex:n,seriesIndex:e.series,e:d3.event}),d3.event.stopPropagation()}),W.append("text"),y&&!x?(I.select("text").attr("text-anchor",function(t,e){return 0>g(t,e)?"end":"start"}).attr("y",d.rangeBand()/(2*t.length)).attr("dy",".32em").text(function(t,e){return k(g(t,e))}),d3.transition(I).select("text").attr("x",function(t,e){return 0>g(t,e)?-4:p(g(t,e))-p(0)+4})):I.selectAll("text").text(""),I.attr("class",function(t,e){return 0>g(t,e)?"nv-bar negative":"nv-bar positive"}),v&&(e||(e=t.map(function(){return!0})),I.style("fill",function(t,n,r){return""+d3.rgb(v(t,n)).darker(e.map(function(t,e){return e}).filter(function(t,n){return!e[n]})[r])}).style("stroke",function(t,n,r){return""+d3.rgb(v(t,n)).darker(e.map(function(t,e){return e}).filter(function(t,n){return!e[n]})[r])})),x?d3.transition(I).attr("transform",function(t,e){return"translate("+p(t.y1)+","+d(f(t,e))+")"}).select("rect").attr("width",function(t,e){return Math.abs(p(g(t,e)+t.y0)-p(t.y0))}).attr("height",d.rangeBand()):d3.transition(I).attr("transform",function(e,n){return"translate("+(0>g(e,n)?p(g(e,n)):p(0))+","+(e.series*d.rangeBand()/t.length+d(f(e,n)))+")"}).select("rect").attr("height",d.rangeBand()/t.length).attr("width",function(t,e){return Math.max(Math.abs(p(g(t,e))-p(0)),1)}),o=d.copy(),i=p.copy()}),t}var e,r,a,o,i,l={top:0,right:0,bottom:0,left:0},s=960,u=500,c=Math.floor(1e4*Math.random()),d=d3.scale.ordinal(),p=d3.scale.linear(),f=function(t){return t.x},g=function(t){return t.y},h=[0],m=n.utils.defaultColor(),v=null,x=!1,y=!1,b=60,k=d3.format(",.2f"),w=1200,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return t.dispatch=A,t.x=function(e){return arguments.length?(f=e,t):f},t.y=function(e){return arguments.length?(g=e,t):g},t.margin=function(e){return arguments.length?(l.top=e.top!==void 0?e.top:l.top,l.right=e.right!==void 0?e.right:l.right,l.bottom=e.bottom!==void 0?e.bottom:l.bottom,l.left=e.left!==void 0?e.left:l.left,t):l},t.width=function(e){return arguments.length?(s=e,t):s},t.height=function(e){return arguments.length?(u=e,t):u},t.xScale=function(e){return arguments.length?(d=e,t):d},t.yScale=function(e){return arguments.length?(p=e,t):p},t.xDomain=function(e){return arguments.length?(r=e,t):r},t.yDomain=function(e){return arguments.length?(a=e,t):a},t.forceY=function(e){return arguments.length?(h=e,t):h},t.stacked=function(e){return arguments.length?(x=e,t):x},t.color=function(e){return arguments.length?(m=n.utils.getColor(e),t):m},t.barColor=function(e){return arguments.length?(v=n.utils.getColor(e),t):v},t.disabled=function(n){return arguments.length?(e=n,t):e},t.id=function(e){return arguments.length?(c=e,t):c},t.delay=function(e){return arguments.length?(w=e,t):w},t.showValues=function(e){return arguments.length?(y=e,t):y},t.valueFormat=function(e){return arguments.length?(k=e,t):k},t.valuePadding=function(e){return arguments.length?(b=e,t):b},t},n.models.multiBarHorizontalChart=function(){function t(n){return n.each(function(h){var v=d3.select(this),C=this,M=(c||parseInt(v.style("width"))||960)-u.left-u.right,S=(d||parseInt(v.style("height"))||400)-u.top-u.bottom;if(t.update=function(){n.transition().call(t)},t.container=this,x.disabled=h.map(function(t){return!!t.disabled}),!y){var D;y={};for(D in x)y[D]=x[D]instanceof Array?x[D].slice(0):x[D]}if(!(h&&h.length&&h.filter(function(t){return t.values.length}).length)){var I=v.selectAll(".nv-noData").data([b]);return I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),I.attr("x",u.left+M/2).attr("y",u.top+S/2).text(function(t){return t}),t}v.selectAll(".nv-noData").remove(),e=a.xScale(),r=a.yScale();var W=v.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]),z=W.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),B=W.select("g");if(z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-barsWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap"),g&&(l.width(M-w()),a.barColor()&&h.forEach(function(t,e){t.color=""+d3.rgb("#ccc").darker(1.5*e)}),B.select(".nv-legendWrap").datum(h).call(l),u.top!=l.height()&&(u.top=l.height(),S=(d||parseInt(v.style("height"))||400)-u.top-u.bottom),B.select(".nv-legendWrap").attr("transform","translate("+w()+","+-u.top+")")),f){var P=[{key:"Grouped",disabled:a.stacked()},{key:"Stacked",disabled:!a.stacked()}];s.width(w()).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+-u.top+")").call(s)}W.attr("transform","translate("+u.left+","+u.top+")"),a.disabled(h.map(function(t){return t.disabled})).width(M).height(S).color(h.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!h[e].disabled}));var H=B.select(".nv-barsWrap").datum(h.filter(function(t){return!t.disabled}));d3.transition(H).call(a),o.scale(e).ticks(S/24).tickSize(-M,0),d3.transition(B.select(".nv-x.nv-axis")).call(o);var F=B.select(".nv-x.nv-axis").selectAll("g");F.selectAll("line, text").style("opacity",1),i.scale(r).ticks(M/100).tickSize(-S,0),B.select(".nv-y.nv-axis").attr("transform","translate(0,"+S+")"),d3.transition(B.select(".nv-y.nv-axis")).call(i),l.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,h.filter(function(t){return!t.disabled}).length||h.map(function(t){return t.disabled=!1,W.selectAll(".nv-series").classed("disabled",!1),t}),x.disabled=h.map(function(t){return!!t.disabled}),k.stateChange(x),n.transition().call(t)}),s.dispatch.on("legendClick",function(e){if(e.disabled){switch(P=P.map(function(t){return t.disabled=!0,t}),e.disabled=!1,e.key){case"Grouped":a.stacked(!1);break;case"Stacked":a.stacked(!0)}x.stacked=a.stacked(),k.stateChange(x),n.transition().call(t)}}),k.on("tooltipShow",function(t){m&&A(t,C.parentNode)}),k.on("changeState",function(e){e.disabled!==void 0&&(h.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),e.stacked!==void 0&&(a.stacked(e.stacked),x.stacked=e.stacked),n.call(t)})}),t}var e,r,a=n.models.multiBarHorizontal(),o=n.models.axis(),i=n.models.axis(),l=n.models.legend().height(30),s=n.models.legend().height(30),u={top:30,right:20,bottom:50,left:60},c=null,d=null,p=n.utils.defaultColor(),f=!0,g=!0,h=!1,m=!0,v=function(t,e,n){return"

"+t+" - "+e+"

"+"

"+n+"

"},x={stacked:h},y=null,b="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),w=function(){return f?180:0 +};a.stacked(h),o.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(t){return t}),i.orient("bottom").tickFormat(d3.format(",.1f"));var A=function(e,r){var l=e.pos[0]+(r.offsetLeft||0),s=e.pos[1]+(r.offsetTop||0),u=o.tickFormat()(a.x()(e.point,e.pointIndex)),c=i.tickFormat()(a.y()(e.point,e.pointIndex)),d=v(e.series.key,u,c,e,t);n.tooltip.show([l,s],d,0>e.value?"e":"w",null,r)};return a.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+u.left,t.pos[1]+u.top],k.tooltipShow(t)}),a.dispatch.on("elementMouseout.tooltip",function(t){k.tooltipHide(t)}),k.on("tooltipHide",function(){m&&n.tooltip.cleanup()}),t.dispatch=k,t.multibar=a,t.legend=l,t.xAxis=o,t.yAxis=i,d3.rebind(t,a,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor"),t.margin=function(e){return arguments.length?(u.top=e.top!==void 0?e.top:u.top,u.right=e.right!==void 0?e.right:u.right,u.bottom=e.bottom!==void 0?e.bottom:u.bottom,u.left=e.left!==void 0?e.left:u.left,t):u},t.width=function(e){return arguments.length?(c=e,t):c},t.height=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),l.color(p),t):p},t.showControls=function(e){return arguments.length?(f=e,t):f},t.showLegend=function(e){return arguments.length?(g=e,t):g},t.tooltip=function(e){return arguments.length?(v=e,t):v},t.tooltips=function(e){return arguments.length?(m=e,t):m},t.tooltipContent=function(e){return arguments.length?(v=e,t):v},t.state=function(e){return arguments.length?(x=e,t):x},t.defaultState=function(e){return arguments.length?(y=e,t):y},t.noData=function(e){return arguments.length?(b=e,t):b},t},n.models.multiChart=function(){function t(n){return n.each(function(u){var C=d3.select(this),M=this,S=(o||parseInt(C.style("width"))||960)-r.left-r.right,D=(i||parseInt(C.style("height"))||400)-r.top-r.bottom,I=u.filter(function(t){return!t.disabled&&"line"==t.type&&1==t.yAxis}),W=u.filter(function(t){return!t.disabled&&"line"==t.type&&2==t.yAxis}),z=u.filter(function(t){return!t.disabled&&"bar"==t.type&&1==t.yAxis}),B=u.filter(function(t){return!t.disabled&&"bar"==t.type&&2==t.yAxis}),P=u.filter(function(t){return!t.disabled&&"area"==t.type&&1==t.yAxis}),H=u.filter(function(t){return!t.disabled&&"area"==t.type&&2==t.yAxis}),F=u.filter(function(t){return!t.disabled&&1==t.yAxis}).map(function(t){return t.values.map(function(t){return{x:t.x,y:t.y}})}),L=u.filter(function(t){return!t.disabled&&2==t.yAxis}).map(function(t){return t.values.map(function(t){return{x:t.x,y:t.y}})});e.domain(d3.extent(d3.merge(F.concat(L)),function(t){return t.x})).range([0,S]);var T=C.selectAll("g.wrap.multiChart").data([u]),N=T.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");N.append("g").attr("class","x axis"),N.append("g").attr("class","y1 axis"),N.append("g").attr("class","y2 axis"),N.append("g").attr("class","lines1Wrap"),N.append("g").attr("class","lines2Wrap"),N.append("g").attr("class","bars1Wrap"),N.append("g").attr("class","bars2Wrap"),N.append("g").attr("class","stack1Wrap"),N.append("g").attr("class","stack2Wrap"),N.append("g").attr("class","legendWrap");var Y=T.select("g");l&&(k.width(S/2),Y.select(".legendWrap").datum(u.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=t.originalKey+(1==t.yAxis?"":" (right axis)"),t})).call(k),r.top!=k.height()&&(r.top=k.height(),D=(i||parseInt(C.style("height"))||400)-r.top-r.bottom),Y.select(".legendWrap").attr("transform","translate("+S/2+","+-r.top+")")),p.width(S).height(D).interpolate("monotone").color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"line"==u[e].type})),f.width(S).height(D).interpolate("monotone").color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"line"==u[e].type})),g.width(S).height(D).color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"bar"==u[e].type})),h.width(S).height(D).color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"bar"==u[e].type})),m.width(S).height(D).color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"area"==u[e].type})),v.width(S).height(D).color(u.map(function(t,e){return t.color||a[e%a.length]}).filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"area"==u[e].type})),Y.attr("transform","translate("+r.left+","+r.top+")");var E=Y.select(".lines1Wrap").datum(I),V=Y.select(".bars1Wrap").datum(z),_=Y.select(".stack1Wrap").datum(P),X=Y.select(".lines2Wrap").datum(W),R=Y.select(".bars2Wrap").datum(B),K=Y.select(".stack2Wrap").datum(H),Z=P.length?P.map(function(t){return t.values}).reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})}).concat([{x:0,y:0}]):[],O=H.length?H.map(function(t){return t.values}).reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})}).concat([{x:0,y:0}]):[];c.domain(d3.extent(d3.merge(F).concat(Z),function(t){return t.y})).range([0,D]),d.domain(d3.extent(d3.merge(L).concat(O),function(t){return t.y})).range([0,D]),p.yDomain(c.domain()),g.yDomain(c.domain()),m.yDomain(c.domain()),f.yDomain(d.domain()),h.yDomain(d.domain()),v.yDomain(d.domain()),P.length&&d3.transition(_).call(m),H.length&&d3.transition(K).call(v),z.length&&d3.transition(V).call(g),B.length&&d3.transition(R).call(h),I.length&&d3.transition(E).call(p),W.length&&d3.transition(X).call(f),x.ticks(S/100).tickSize(-D,0),Y.select(".x.axis").attr("transform","translate(0,"+D+")"),d3.transition(Y.select(".x.axis")).call(x),y.ticks(D/36).tickSize(-S,0),d3.transition(Y.select(".y1.axis")).call(y),b.ticks(D/36).tickSize(-S,0),d3.transition(Y.select(".y2.axis")).call(b),Y.select(".y2.axis").style("opacity",L.length?1:0).attr("transform","translate("+e.range()[1]+",0)"),k.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,u.filter(function(t){return!t.disabled}).length||u.map(function(t){return t.disabled=!1,T.selectAll(".series").classed("disabled",!1),t}),n.transition().call(t)}),w.on("tooltipShow",function(t){s&&A(t,M.parentNode)})}),t.update=function(){t(n)},t.container=this,t}var e,r={top:30,right:20,bottom:50,left:60},a=d3.scale.category20().range(),o=null,i=null,l=!0,s=!0,u=function(t,e,n){return"

"+t+"

"+"

"+n+" at "+e+"

"},e=d3.scale.linear(),c=d3.scale.linear(),d=d3.scale.linear(),p=n.models.line().yScale(c),f=n.models.line().yScale(d),g=n.models.multiBar().stacked(!1).yScale(c),h=n.models.multiBar().stacked(!1).yScale(d),m=n.models.stackedArea().yScale(c),v=n.models.stackedArea().yScale(d),x=n.models.axis().scale(e).orient("bottom").tickPadding(5),y=n.models.axis().scale(c).orient("left"),b=n.models.axis().scale(d).orient("right"),k=n.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),A=function(e,r){var a=e.pos[0]+(r.offsetLeft||0),o=e.pos[1]+(r.offsetTop||0),i=x.tickFormat()(p.x()(e.point,e.pointIndex)),l=(2==e.series.yAxis?b:y).tickFormat()(p.y()(e.point,e.pointIndex)),s=u(e.series.key,i,l,e,t);n.tooltip.show([a,o],s,void 0,void 0,r.offsetParent)};return p.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),p.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),f.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),f.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),g.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),g.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),h.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),h.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),m.dispatch.on("tooltipShow",function(t){return Math.round(100*m.y()(t.point))?(t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t),void 0):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),m.dispatch.on("tooltipHide",function(t){w.tooltipHide(t)}),v.dispatch.on("tooltipShow",function(t){return Math.round(100*v.y()(t.point))?(t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t),void 0):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),v.dispatch.on("tooltipHide",function(t){w.tooltipHide(t)}),p.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),p.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),f.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+r.left,t.pos[1]+r.top],w.tooltipShow(t)}),f.dispatch.on("elementMouseout.tooltip",function(t){w.tooltipHide(t)}),w.on("tooltipHide",function(){s&&n.tooltip.cleanup()}),t.dispatch=w,t.lines1=p,t.lines2=f,t.bars1=g,t.bars2=h,t.stack1=m,t.stack2=v,t.xAxis=x,t.yAxis1=y,t.yAxis2=b,t.x=function(e){return arguments.length?(getX=e,p.x(e),g.x(e),t):getX},t.y=function(e){return arguments.length?(getY=e,p.y(e),g.y(e),t):getY},t.margin=function(e){return arguments.length?(r=e,t):r},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.color=function(e){return arguments.length?(a=e,k.color(e),t):a},t.showLegend=function(e){return arguments.length?(l=e,t):l},t.tooltips=function(e){return arguments.length?(s=e,t):s},t.tooltipContent=function(e){return arguments.length?(u=e,t):u},t},n.models.ohlcBar=function(){function t(n){return n.each(function(t){var n=o-a.left-a.right,b=i-a.top-a.bottom,w=d3.select(this);s.domain(e||d3.extent(t[0].values.map(c).concat(m))),x?s.range([.5*n/t[0].values.length,n*(t[0].values.length-.5)/t[0].values.length]):s.range([0,n]),u.domain(r||[d3.min(t[0].values.map(h).concat(v)),d3.max(t[0].values.map(g).concat(v))]).range([b,0]),(s.domain()[0]===s.domain()[1]||u.domain()[0]===u.domain()[1])&&(singlePoint=!0),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-.01*s.domain()[0],s.domain()[1]+.01*s.domain()[1]]):s.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]+.01*u.domain()[0],u.domain()[1]-.01*u.domain()[1]]):u.domain([-1,1]));var A=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([t[0].values]),C=A.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),M=C.append("defs"),S=C.append("g"),D=A.select("g");S.append("g").attr("class","nv-ticks"),A.attr("transform","translate("+a.left+","+a.top+")"),w.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:l})}),M.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),A.select("#nv-chart-clip-path-"+l+" rect").attr("width",n).attr("height",b),D.attr("clip-path",y?"url(#nv-chart-clip-path-"+l+")":"");var I=A.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});I.exit().remove(),I.enter().append("path").attr("class",function(t,e,n){return(p(t,e)>f(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}).attr("d",function(e,r){var a=.9*(n/t[0].values.length);return"m0,0l0,"+(u(p(e,r))-u(g(e,r)))+"l"+-a/2+",0l"+a/2+",0l0,"+(u(h(e,r))-u(p(e,r)))+"l0,"+(u(f(e,r))-u(h(e,r)))+"l"+a/2+",0l"+-a/2+",0z"}).attr("transform",function(t,e){return"translate("+s(c(t,e))+","+u(g(t,e))+")"}).on("mouseover",function(e,n){d3.select(this).classed("hover",!0),k.elementMouseover({point:e,series:t[0],pos:[s(c(e,n)),u(d(e,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,n){d3.select(this).classed("hover",!1),k.elementMouseout({point:e,series:t[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(t,e){k.elementClick({value:d(t,e),data:t,index:e,pos:[s(c(t,e)),u(d(t,e))],e:d3.event,id:l}),d3.event.stopPropagation()}).on("dblclick",function(t,e){k.elementDblClick({value:d(t,e),data:t,index:e,pos:[s(c(t,e)),u(d(t,e))],e:d3.event,id:l}),d3.event.stopPropagation()}),I.attr("class",function(t,e,n){return(p(t,e)>f(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}),d3.transition(I).attr("transform",function(t,e){return"translate("+s(c(t,e))+","+u(g(t,e))+")"}).attr("d",function(e,r){var a=.9*(n/t[0].values.length);return"m0,0l0,"+(u(p(e,r))-u(g(e,r)))+"l"+-a/2+",0l"+a/2+",0l0,"+(u(h(e,r))-u(p(e,r)))+"l0,"+(u(f(e,r))-u(h(e,r)))+"l"+a/2+",0l"+-a/2+",0z"})}),t}var e,r,a={top:0,right:0,bottom:0,left:0},o=960,i=500,l=Math.floor(1e4*Math.random()),s=d3.scale.linear(),u=d3.scale.linear(),c=function(t){return t.x},d=function(t){return t.y},p=function(t){return t.open},f=function(t){return t.close},g=function(t){return t.high},h=function(t){return t.low},m=[],v=[],x=!1,y=!0,b=n.utils.defaultColor(),k=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return t.dispatch=k,t.x=function(e){return arguments.length?(c=e,t):c},t.y=function(e){return arguments.length?(d=e,t):d},t.open=function(e){return arguments.length?(p=e,t):p},t.close=function(e){return arguments.length?(f=e,t):f},t.high=function(e){return arguments.length?(g=e,t):g},t.low=function(e){return arguments.length?(h=e,t):h},t.margin=function(e){return arguments.length?(a.top=e.top!==void 0?e.top:a.top,a.right=e.right!==void 0?e.right:a.right,a.bottom=e.bottom!==void 0?e.bottom:a.bottom,a.left=e.left!==void 0?e.left:a.left,t):a},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.xScale=function(e){return arguments.length?(s=e,t):s},t.yScale=function(e){return arguments.length?(u=e,t):u},t.xDomain=function(n){return arguments.length?(e=n,t):e},t.yDomain=function(e){return arguments.length?(r=e,t):r},t.forceX=function(e){return arguments.length?(m=e,t):m},t.forceY=function(e){return arguments.length?(v=e,t):v},t.padData=function(e){return arguments.length?(x=e,t):x},t.clipEdge=function(e){return arguments.length?(y=e,t):y},t.color=function(e){return arguments.length?(b=n.utils.getColor(e),t):b},t.id=function(e){return arguments.length?(l=e,t):l},t},n.models.pie=function(){function t(n){return n.each(function(t){function n(t){m||(t.innerRadius=0);var e=d3.interpolate(this._current,t);return this._current=e(0),function(t){return W(e(t))}}var s=r-e.left-e.right,d=a-e.top-e.bottom,w=Math.min(s,d)/2,A=w-w/5,C=d3.select(this),M=C.selectAll(".nv-wrap.nv-pie").data([o(t[0])]),S=M.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),D=S.append("g"),I=M.select("g");D.append("g").attr("class","nv-pie"),M.attr("transform","translate("+e.left+","+e.top+")"),I.select(".nv-pie").attr("transform","translate("+s/2+","+d/2+")"),C.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:u})});var W=d3.svg.arc().outerRadius(A);x&&W.startAngle(x),y&&W.endAngle(y),m&&W.innerRadius(w*b);var z=d3.layout.pie().sort(null).value(function(t){return t.disabled?0:l(t)}),B=M.select(".nv-pie").selectAll(".nv-slice").data(z);B.exit().remove();var P=B.enter().append("g").attr("class","nv-slice").on("mouseover",function(t,e){d3.select(this).classed("hover",!0),k.elementMouseover({label:i(t.data),value:l(t.data),point:t.data,pointIndex:e,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),k.elementMouseout({label:i(t.data),value:l(t.data),point:t.data,index:e,id:u})}).on("click",function(t,e){k.elementClick({label:i(t.data),value:l(t.data),point:t.data,index:e,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(t,e){k.elementDblClick({label:i(t.data),value:l(t.data),point:t.data,index:e,pos:d3.event,id:u}),d3.event.stopPropagation()});if(B.attr("fill",function(t,e){return c(t,e)}).attr("stroke",function(t,e){return c(t,e)}),P.append("path").each(function(t){this._current=t}),d3.transition(B.select("path")).attr("d",W).attrTween("d",n),p){var H=d3.svg.arc().innerRadius(0);f&&(H=W),g&&(H=d3.svg.arc().outerRadius(W.outerRadius())),P.append("g").classed("nv-label",!0).each(function(t){var e=d3.select(this);e.attr("transform",function(t){if(v){t.outerRadius=A+10,t.innerRadius=A+15;var e=(t.startAngle+t.endAngle)/2*(180/Math.PI);return(t.startAngle+t.endAngle)/2h?i(t.data):""});var n=e.select("text").node().getBBox();e.select(".nv-label rect").attr("width",n.width+10).attr("height",n.height+10).attr("transform",function(){return"translate("+[n.x-5,n.y-5]+")"})})}}),t}var e={top:0,right:0,bottom:0,left:0},r=500,a=500,o=function(t){return t.values},i=function(t){return t.x},l=function(t){return t.y},s=function(t){return t.description},u=Math.floor(1e4*Math.random()),c=n.utils.defaultColor(),d=d3.format(",.2f"),p=!0,f=!0,g=!1,h=.02,m=!1,v=!1,x=!1,y=!1,b=.5,k=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return t.dispatch=k,t.margin=function(n){return arguments.length?(e.top=n.top!==void 0?n.top:e.top,e.right=n.right!==void 0?n.right:e.right,e.bottom=n.bottom!==void 0?n.bottom:e.bottom,e.left=n.left!==void 0?n.left:e.left,t):e},t.width=function(e){return arguments.length?(r=e,t):r},t.height=function(e){return arguments.length?(a=e,t):a},t.values=function(e){return arguments.length?(o=e,t):o},t.x=function(e){return arguments.length?(i=e,t):i},t.y=function(e){return arguments.length?(l=d3.functor(e),t):l},t.description=function(e){return arguments.length?(s=e,t):s},t.showLabels=function(e){return arguments.length?(p=e,t):p},t.labelSunbeamLayout=function(e){return arguments.length?(v=e,t):v},t.donutLabelsOutside=function(e){return arguments.length?(g=e,t):g},t.pieLabelsOutside=function(e){return arguments.length?(f=e,t):f},t.donut=function(e){return arguments.length?(m=e,t):m},t.donutRatio=function(e){return arguments.length?(b=e,t):b},t.startAngle=function(e){return arguments.length?(x=e,t):x},t.endAngle=function(e){return arguments.length?(y=e,t):y},t.id=function(e){return arguments.length?(u=e,t):u},t.color=function(e){return arguments.length?(c=n.utils.getColor(e),t):c},t.valueFormat=function(e){return arguments.length?(d=e,t):d},t.labelThreshold=function(e){return arguments.length?(h=e,t):h},t},n.models.pieChart=function(){function t(n){return n.each(function(s){var u=d3.select(this),c=(o||parseInt(u.style("width"))||960)-a.left-a.right,h=(i||parseInt(u.style("height"))||400)-a.top-a.bottom;if(t.update=function(){t(n)},t.container=this,d.disabled=s[0].map(function(t){return!!t.disabled}),!p){var m;p={};for(m in d)p[m]=d[m]instanceof Array?d[m].slice(0):d[m]}if(!s[0]||!s[0].length){var v=u.selectAll(".nv-noData").data([f]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",a.left+c/2).attr("y",a.top+h/2).text(function(t){return t}),t}u.selectAll(".nv-noData").remove();var x=u.selectAll("g.nv-wrap.nv-pieChart").data([s]),y=x.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),b=x.select("g");y.append("g").attr("class","nv-pieWrap"),y.append("g").attr("class","nv-legendWrap"),l&&(r.width(c).key(e.x()),x.select(".nv-legendWrap").datum(e.values()(s[0])).call(r),a.top!=r.height()&&(a.top=r.height(),h=(i||parseInt(u.style("height"))||400)-a.top-a.bottom),x.select(".nv-legendWrap").attr("transform","translate(0,"+-a.top+")")),x.attr("transform","translate("+a.left+","+a.top+")"),e.width(c).height(h);var k=b.select(".nv-pieWrap").datum(s);d3.transition(k).call(e),r.dispatch.on("legendClick",function(r){r.disabled=!r.disabled,e.values()(s[0]).filter(function(t){return!t.disabled}).length||e.values()(s[0]).map(function(t){return t.disabled=!1,x.selectAll(".nv-series").classed("disabled",!1),t}),d.disabled=s[0].map(function(t){return!!t.disabled}),g.stateChange(d),n.transition().call(t)}),e.dispatch.on("elementMouseout.tooltip",function(t){g.tooltipHide(t)}),g.on("changeState",function(e){e.disabled!==void 0&&(s[0].forEach(function(t,n){t.disabled=e.disabled[n]}),d.disabled=e.disabled),n.call(t)})}),t}var e=n.models.pie(),r=n.models.legend(),a={top:30,right:20,bottom:20,left:20},o=null,i=null,l=!0,s=n.utils.defaultColor(),u=!0,c=function(t,e){return"

"+t+"

"+"

"+e+"

"},d={},p=null,f="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),h=function(r,a){var o=e.description()(r.point)||e.x()(r.point),i=r.pos[0]+(a&&a.offsetLeft||0),l=r.pos[1]+(a&&a.offsetTop||0),s=e.valueFormat()(e.y()(r.point)),u=c(o,s,r,t);n.tooltip.show([i,l],u,0>r.value?"n":"s",null,a)};return e.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+a.left,t.pos[1]+a.top],g.tooltipShow(t)}),g.on("tooltipShow",function(t){u&&h(t)}),g.on("tooltipHide",function(){u&&n.tooltip.cleanup()}),t.legend=r,t.dispatch=g,t.pie=e,d3.rebind(t,e,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","donut","donutRatio","labelThreshold"),t.margin=function(e){return arguments.length?(a.top=e.top!==void 0?e.top:a.top,a.right=e.right!==void 0?e.right:a.right,a.bottom=e.bottom!==void 0?e.bottom:a.bottom,a.left=e.left!==void 0?e.left:a.left,t):a},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.color=function(a){return arguments.length?(s=n.utils.getColor(a),r.color(s),e.color(s),t):s},t.showLegend=function(e){return arguments.length?(l=e,t):l},t.tooltips=function(e){return arguments.length?(u=e,t):u},t.tooltipContent=function(e){return arguments.length?(c=e,t):c},t.state=function(e){return arguments.length?(d=e,t):d},t.defaultState=function(e){return arguments.length?(p=e,t):p},t.noData=function(e){return arguments.length?(f=e,t):f},t},n.models.scatter=function(){function t(n){return n.each(function(t){function n(){if(!w)return!1;var e=d3.merge(t.map(function(t,e){return t.values.map(function(t,n){return[d(g(t,n))*(Math.random()/1e12+1),p(h(t,n))*(Math.random()/1e12+1),e,n,t]}).filter(function(t,e){return A(t[4],e)})}));if(L===!0){if(D){var n=_.select("defs").selectAll(".nv-point-clips").data([c]).enter();n.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+c);var r=_.select("#nv-points-clip-"+c).selectAll("circle").data(e);r.enter().append("circle").attr("r",I),r.exit().remove(),r.attr("cx",function(t){return t[0]}).attr("cy",function(t){return t[1]}),_.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+c+")")}e.push([d.range()[0]-20,p.range()[0]-20,null,null]),e.push([d.range()[1]+20,p.range()[1]+20,null,null]),e.push([d.range()[0]-20,p.range()[0]+20,null,null]),e.push([d.range()[1]+20,p.range()[1]-20,null,null]);var a=d3.geom.polygon([[-10,-10],[-10,s+10],[l+10,s+10],[l+10,-10]]),o=d3.geom.voronoi(e).map(function(t,n){return{data:a.clip(t),series:e[n][2],point:e[n][3]}}),u=_.select(".nv-point-paths").selectAll("path").data(o);u.enter().append("path").attr("class",function(t,e){return"nv-path-"+e}),u.exit().remove(),u.attr("d",function(t){return"M"+t.data.join("L")+"Z"}),u.on("click",function(e){if(T)return 0;var n=t[e.series],r=n.values[e.point];F.elementClick({point:r,series:n,pos:[d(g(r,e.point))+i.left,p(h(r,e.point))+i.top],seriesIndex:e.series,pointIndex:e.point})}).on("mouseover",function(e){if(T)return 0;var n=t[e.series],r=n.values[e.point];F.elementMouseover({point:r,series:n,pos:[d(g(r,e.point))+i.left,p(h(r,e.point))+i.top],seriesIndex:e.series,pointIndex:e.point})}).on("mouseout",function(e){if(T)return 0;var n=t[e.series],r=n.values[e.point];F.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:e.point})})}else _.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(T||!t[e.series])return 0;var r=t[e.series],a=r.values[n];F.elementClick({point:a,series:r,pos:[d(g(a,n))+i.left,p(h(a,n))+i.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(T||!t[e.series])return 0;var r=t[e.series],a=r.values[n];F.elementMouseover({point:a,series:r,pos:[d(g(a,n))+i.left,p(h(a,n))+i.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,n){if(T||!t[e.series])return 0;var r=t[e.series],a=r.values[n];F.elementMouseout({point:a,series:r,seriesIndex:e.series,pointIndex:n})});T=!1}var N=l-i.left-i.right,Y=s-i.top-i.bottom,E=d3.select(this);t=t.map(function(t,e){return t.values=t.values.map(function(t){return t.series=e,t}),t});var V=W&&z&&B?[]:d3.merge(t.map(function(t){return t.values.map(function(t,e){return{x:g(t,e),y:h(t,e),size:m(t,e)}})}));d.domain(W||d3.extent(V.map(function(t){return t.x}).concat(y))),C&&t[0]?d.range([(N*M+N)/(2*t[0].values.length),N-N*(1+M)/(2*t[0].values.length)]):d.range([0,N]),p.domain(z||d3.extent(V.map(function(t){return t.y}).concat(b))).range([Y,0]),f.domain(B||d3.extent(V.map(function(t){return t.size}).concat(k))).range(P||[16,256]),(d.domain()[0]===d.domain()[1]||p.domain()[0]===p.domain()[1])&&(H=!0),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]-.01*d.domain()[0],d.domain()[1]+.01*d.domain()[1]]):d.domain([-1,1])),p.domain()[0]===p.domain()[1]&&(p.domain()[0]?p.domain([p.domain()[0]+.01*p.domain()[0],p.domain()[1]-.01*p.domain()[1]]):p.domain([-1,1])),e=e||d,r=r||p,a=a||f;var _=E.selectAll("g.nv-wrap.nv-scatter").data([t]),X=_.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+c+(H?" nv-single-point":"")),R=X.append("defs"),K=X.append("g"),Z=_.select("g");K.append("g").attr("class","nv-groups"),K.append("g").attr("class","nv-point-paths"),_.attr("transform","translate("+i.left+","+i.top+")"),R.append("clipPath").attr("id","nv-edge-clip-"+c).append("rect"),_.select("#nv-edge-clip-"+c+" rect").attr("width",N).attr("height",Y),Z.attr("clip-path",S?"url(#nv-edge-clip-"+c+")":""),T=!0;var O=_.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});if(O.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(O.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),O.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}),d3.transition(O).style("fill",function(t,e){return u(t,e)}).style("stroke",function(t,e){return u(t,e)}).style("stroke-opacity",1).style("fill-opacity",.5),x){var q=O.selectAll("circle.nv-point").data(function(t){return t.values});q.enter().append("circle").attr("cx",function(t,n){return e(g(t,n))}).attr("cy",function(t,e){return r(h(t,e))}).attr("r",function(t,e){return Math.sqrt(f(m(t,e))/Math.PI)}),q.exit().remove(),d3.transition(O.exit().selectAll("path.nv-point")).attr("cx",function(t,e){return d(g(t,e))}).attr("cy",function(t,e){return p(h(t,e))}).remove(),q.attr("class",function(t,e){return"nv-point nv-point-"+e}),d3.transition(q).attr("cx",function(t,e){return d(g(t,e))}).attr("cy",function(t,e){return p(h(t,e))}).attr("r",function(t,e){return Math.sqrt(f(m(t,e))/Math.PI)})}else{var q=O.selectAll("path.nv-point").data(function(t){return t.values});q.enter().append("path").attr("transform",function(t,n){return"translate("+e(g(t,n))+","+r(h(t,n))+")"}).attr("d",d3.svg.symbol().type(v).size(function(t,e){return f(m(t,e))})),q.exit().remove(),d3.transition(O.exit().selectAll("path.nv-point")).attr("transform",function(t,e){return"translate("+d(g(t,e))+","+p(h(t,e))+")"}).remove(),q.attr("class",function(t,e){return"nv-point nv-point-"+e}),d3.transition(q).attr("transform",function(t,e){return"translate("+d(g(t,e))+","+p(h(t,e))+")"}).attr("d",d3.svg.symbol().type(v).size(function(t,e){return f(m(t,e))}))}clearTimeout(o),o=setTimeout(n,300),e=d.copy(),r=p.copy(),a=f.copy()}),t}var e,r,a,o,i={top:0,right:0,bottom:0,left:0},l=960,s=500,u=n.utils.defaultColor(),c=Math.floor(1e5*Math.random()),d=d3.scale.linear(),p=d3.scale.linear(),f=d3.scale.linear(),g=function(t){return t.x},h=function(t){return t.y},m=function(t){return t.size||1},v=function(t){return t.shape||"circle"},x=!0,y=[],b=[],k=[],w=!0,A=function(t){return!t.notActive},C=!1,M=.1,S=!1,D=!0,I=function(){return 25},W=null,z=null,B=null,P=null,H=!1,F=d3.dispatch("elementClick","elementMouseover","elementMouseout"),L=!0,T=!1;return F.on("elementMouseover.point",function(t){w&&d3.select(".nv-chart-"+c+" .nv-series-"+t.seriesIndex+" .nv-point-"+t.pointIndex).classed("hover",!0)}),F.on("elementMouseout.point",function(t){w&&d3.select(".nv-chart-"+c+" .nv-series-"+t.seriesIndex+" .nv-point-"+t.pointIndex).classed("hover",!1)}),t.dispatch=F,t.x=function(e){return arguments.length?(g=d3.functor(e),t):g},t.y=function(e){return arguments.length?(h=d3.functor(e),t):h},t.size=function(e){return arguments.length?(m=d3.functor(e),t):m},t.margin=function(e){return arguments.length?(i.top=e.top!==void 0?e.top:i.top,i.right=e.right!==void 0?e.right:i.right,i.bottom=e.bottom!==void 0?e.bottom:i.bottom,i.left=e.left!==void 0?e.left:i.left,t):i},t.width=function(e){return arguments.length?(l=e,t):l},t.height=function(e){return arguments.length?(s=e,t):s},t.xScale=function(e){return arguments.length?(d=e,t):d},t.yScale=function(e){return arguments.length?(p=e,t):p},t.zScale=function(e){return arguments.length?(f=e,t):f},t.xDomain=function(e){return arguments.length?(W=e,t):W},t.yDomain=function(e){return arguments.length?(z=e,t):z},t.sizeDomain=function(e){return arguments.length?(B=e,t):B},t.sizeRange=function(e){return arguments.length?(P=e,t):P},t.forceX=function(e){return arguments.length?(y=e,t):y},t.forceY=function(e){return arguments.length?(b=e,t):b},t.forceSize=function(e){return arguments.length?(k=e,t):k},t.interactive=function(e){return arguments.length?(w=e,t):w},t.pointActive=function(e){return arguments.length?(A=e,t):A},t.padData=function(e){return arguments.length?(C=e,t):C},t.padDataOuter=function(e){return arguments.length?(M=e,t):M},t.clipEdge=function(e){return arguments.length?(S=e,t):S},t.clipVoronoi=function(e){return arguments.length?(D=e,t):D},t.useVoronoi=function(e){return arguments.length?(L=e,L===!1&&(D=!1),t):L},t.clipRadius=function(e){return arguments.length?(I=e,t):I},t.color=function(e){return arguments.length?(u=n.utils.getColor(e),t):u},t.shape=function(e){return arguments.length?(v=e,t):v},t.onlyCircles=function(e){return arguments.length?(x=e,t):x},t.id=function(e){return arguments.length?(c=e,t):c},t.singlePoint=function(e){return arguments.length?(H=e,t):H},t},n.models.scatterChart=function(){function t(n){return n.each(function(C){function M(){if(w)return R.select(".nv-point-paths").style("pointer-events","all"),!1;R.select(".nv-point-paths").style("pointer-events","none");var t=d3.mouse(this);f.distortion(k).focus(t[0]),g.distortion(k).focus(t[1]),R.select(".nv-scatterWrap").call(e),R.select(".nv-x.nv-axis").call(r),R.select(".nv-y.nv-axis").call(a),R.select(".nv-distributionX").datum(C.filter(function(t){return!t.disabled})).call(l),R.select(".nv-distributionY").datum(C.filter(function(t){return!t.disabled})).call(s)}var S=d3.select(this),L=this,T=(c||parseInt(S.style("width"))||960)-u.left-u.right,N=(d||parseInt(S.style("height"))||400)-u.top-u.bottom;if(t.update=function(){t(n) +},t.container=this,D.disabled=C.map(function(t){return!!t.disabled}),!I){var Y;I={};for(Y in D)I[Y]=D[Y]instanceof Array?D[Y].slice(0):D[Y]}if(!(C&&C.length&&C.filter(function(t){return t.values.length}).length)){var E=S.selectAll(".nv-noData").data([z]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",u.left+T/2).attr("y",u.top+N/2).text(function(t){return t}),t}S.selectAll(".nv-noData").remove(),B=B||f,P=P||g;var V=S.selectAll("g.nv-wrap.nv-scatterChart").data([C]),_=V.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+e.id()),X=_.append("g"),R=V.select("g");if(X.append("rect").attr("class","nvd3 nv-background"),X.append("g").attr("class","nv-x nv-axis"),X.append("g").attr("class","nv-y nv-axis"),X.append("g").attr("class","nv-scatterWrap"),X.append("g").attr("class","nv-distWrap"),X.append("g").attr("class","nv-legendWrap"),X.append("g").attr("class","nv-controlsWrap"),y&&(o.width(T/2),V.select(".nv-legendWrap").datum(C).call(o),u.top!=o.height()&&(u.top=o.height(),N=(d||parseInt(S.style("height"))||400)-u.top-u.bottom),V.select(".nv-legendWrap").attr("transform","translate("+T/2+","+-u.top+")")),b&&(i.width(180).color(["#444"]),R.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+-u.top+")").call(i)),V.attr("transform","translate("+u.left+","+u.top+")"),e.width(T).height(N).color(C.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!C[e].disabled})),V.select(".nv-scatterWrap").datum(C.filter(function(t){return!t.disabled})).call(e),h){var K=f.domain()[1]-f.domain()[0];f.domain([f.domain()[0]-h*K,f.domain()[1]+h*K])}if(m){var Z=g.domain()[1]-g.domain()[0];g.domain([g.domain()[0]-m*Z,g.domain()[1]+m*Z])}r.scale(f).ticks(r.ticks()&&r.ticks().length?r.ticks():T/100).tickSize(-N,0),R.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")").call(r),a.scale(g).ticks(a.ticks()&&a.ticks().length?a.ticks():N/36).tickSize(-T,0),R.select(".nv-y.nv-axis").call(a),v&&(l.getData(e.x()).scale(f).width(T).color(C.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!C[e].disabled})),X.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),R.select(".nv-distributionX").attr("transform","translate(0,"+g.range()[0]+")").datum(C.filter(function(t){return!t.disabled})).call(l)),x&&(s.getData(e.y()).scale(g).width(N).color(C.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!C[e].disabled})),X.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),R.select(".nv-distributionY").attr("transform","translate(-"+s.size()+",0)").datum(C.filter(function(t){return!t.disabled})).call(s)),d3.fisheye&&(R.select(".nv-background").attr("width",T).attr("height",N),R.select(".nv-background").on("mousemove",M),R.select(".nv-background").on("click",function(){w=!w}),e.dispatch.on("elementClick.freezeFisheye",function(){w=!w})),i.dispatch.on("legendClick",function(o){o.disabled=!o.disabled,k=o.disabled?0:2.5,R.select(".nv-background").style("pointer-events",o.disabled?"none":"all"),R.select(".nv-point-paths").style("pointer-events",o.disabled?"all":"none"),o.disabled?(f.distortion(k).focus(0),g.distortion(k).focus(0),R.select(".nv-scatterWrap").call(e),R.select(".nv-x.nv-axis").call(r),R.select(".nv-y.nv-axis").call(a)):w=!1,t(n)}),o.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,C.filter(function(t){return!t.disabled}).length||C.map(function(t){return t.disabled=!1,V.selectAll(".nv-series").classed("disabled",!1),t}),D.disabled=C.map(function(t){return!!t.disabled}),W.stateChange(D),t(n)}),e.dispatch.on("elementMouseover.tooltip",function(t){d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.pos[1]-N),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.pos[0]+l.size()),t.pos=[t.pos[0]+u.left,t.pos[1]+u.top],W.tooltipShow(t)}),W.on("tooltipShow",function(t){A&&H(t,L.parentNode)}),W.on("changeState",function(e){e.disabled!==void 0&&(C.forEach(function(t,n){t.disabled=e.disabled[n]}),D.disabled=e.disabled),n.call(t)}),B=f.copy(),P=g.copy()}),t}var e=n.models.scatter(),r=n.models.axis(),a=n.models.axis(),o=n.models.legend(),i=n.models.legend(),l=n.models.distribution(),s=n.models.distribution(),u={top:30,right:20,bottom:50,left:75},c=null,d=null,p=n.utils.defaultColor(),f=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):e.xScale(),g=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):e.yScale(),h=0,m=0,v=!1,x=!1,y=!0,b=!!d3.fisheye,k=0,w=!1,A=!0,C=function(t,e){return""+e+""},M=function(t,e,n){return""+n+""},S=null,D={},I=null,W=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),z="No Data Available.";e.xScale(f).yScale(g),r.orient("bottom").tickPadding(10),a.orient("left").tickPadding(10),l.axis("x"),s.axis("y");var B,P,H=function(o,i){var l=o.pos[0]+(i.offsetLeft||0),s=o.pos[1]+(i.offsetTop||0),c=o.pos[0]+(i.offsetLeft||0),d=g.range()[0]+u.top+(i.offsetTop||0),p=f.range()[0]+u.left+(i.offsetLeft||0),h=o.pos[1]+(i.offsetTop||0),m=r.tickFormat()(e.x()(o.point,o.pointIndex)),v=a.tickFormat()(e.y()(o.point,o.pointIndex));null!=C&&n.tooltip.show([c,d],C(o.series.key,m,v,o,t),"n",1,i,"x-nvtooltip"),null!=M&&n.tooltip.show([p,h],M(o.series.key,m,v,o,t),"e",1,i,"y-nvtooltip"),null!=S&&n.tooltip.show([l,s],S(o.series.key,m,v,o,t),0>o.value?"n":"s",null,i)},F=[{key:"Magnify",disabled:!0}];return e.dispatch.on("elementMouseout.tooltip",function(t){W.tooltipHide(t),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",0),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",s.size())}),W.on("tooltipHide",function(){A&&n.tooltip.cleanup()}),t.dispatch=W,t.scatter=e,t.legend=o,t.controls=i,t.xAxis=r,t.yAxis=a,t.distX=l,t.distY=s,d3.rebind(t,e,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),t.margin=function(e){return arguments.length?(u.top=e.top!==void 0?e.top:u.top,u.right=e.right!==void 0?e.right:u.right,u.bottom=e.bottom!==void 0?e.bottom:u.bottom,u.left=e.left!==void 0?e.left:u.left,t):u},t.width=function(e){return arguments.length?(c=e,t):c},t.height=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),o.color(p),l.color(p),s.color(p),t):p},t.showDistX=function(e){return arguments.length?(v=e,t):v},t.showDistY=function(e){return arguments.length?(x=e,t):x},t.showControls=function(e){return arguments.length?(b=e,t):b},t.showLegend=function(e){return arguments.length?(y=e,t):y},t.fisheye=function(e){return arguments.length?(k=e,t):k},t.xPadding=function(e){return arguments.length?(h=e,t):h},t.yPadding=function(e){return arguments.length?(m=e,t):m},t.tooltips=function(e){return arguments.length?(A=e,t):A},t.tooltipContent=function(e){return arguments.length?(S=e,t):S},t.tooltipXContent=function(e){return arguments.length?(C=e,t):C},t.tooltipYContent=function(e){return arguments.length?(M=e,t):M},t.state=function(e){return arguments.length?(D=e,t):D},t.defaultState=function(e){return arguments.length?(I=e,t):I},t.noData=function(e){return arguments.length?(z=e,t):z},t},n.models.scatterPlusLineChart=function(){function t(n){return n.each(function(w){function A(){if(b)return _.select(".nv-point-paths").style("pointer-events","all"),!1;_.select(".nv-point-paths").style("pointer-events","none");var t=d3.mouse(this);f.distortion(y).focus(t[0]),g.distortion(y).focus(t[1]),_.select(".nv-scatterWrap").datum(w.filter(function(t){return!t.disabled})).call(e),_.select(".nv-x.nv-axis").call(r),_.select(".nv-y.nv-axis").call(a),_.select(".nv-distributionX").datum(w.filter(function(t){return!t.disabled})).call(l),_.select(".nv-distributionY").datum(w.filter(function(t){return!t.disabled})).call(s)}var C=d3.select(this),H=this,F=(c||parseInt(C.style("width"))||960)-u.left-u.right,L=(d||parseInt(C.style("height"))||400)-u.top-u.bottom;if(t.update=function(){t(n)},t.container=this,M.disabled=w.map(function(t){return!!t.disabled}),!S){var T;S={};for(T in M)S[T]=M[T]instanceof Array?M[T].slice(0):M[T]}if(!(w&&w.length&&w.filter(function(t){return t.values.length}).length)){var N=C.selectAll(".nv-noData").data([I]);return N.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),N.attr("x",u.left+F/2).attr("y",u.top+L/2).text(function(t){return t}),t}C.selectAll(".nv-noData").remove(),f=e.xScale(),g=e.yScale(),W=W||f,z=z||g;var Y=C.selectAll("g.nv-wrap.nv-scatterChart").data([w]),E=Y.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+e.id()),V=E.append("g"),_=Y.select("g");V.append("rect").attr("class","nvd3 nv-background"),V.append("g").attr("class","nv-x nv-axis"),V.append("g").attr("class","nv-y nv-axis"),V.append("g").attr("class","nv-scatterWrap"),V.append("g").attr("class","nv-regressionLinesWrap"),V.append("g").attr("class","nv-distWrap"),V.append("g").attr("class","nv-legendWrap"),V.append("g").attr("class","nv-controlsWrap"),Y.attr("transform","translate("+u.left+","+u.top+")"),v&&(o.width(F/2),Y.select(".nv-legendWrap").datum(w).call(o),u.top!=o.height()&&(u.top=o.height(),L=(d||parseInt(C.style("height"))||400)-u.top-u.bottom),Y.select(".nv-legendWrap").attr("transform","translate("+F/2+","+-u.top+")")),x&&(i.width(180).color(["#444"]),_.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+-u.top+")").call(i)),e.width(F).height(L).color(w.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!w[e].disabled})),Y.select(".nv-scatterWrap").datum(w.filter(function(t){return!t.disabled})).call(e),Y.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+e.id()+")");var X=Y.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(t){return t});X.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0),X.selectAll(".nv-regLines line").attr("x1",f.range()[0]).attr("x2",f.range()[1]).attr("y1",function(t){return g(f.domain()[0]*t.slope+t.intercept)}).attr("y2",function(t){return g(f.domain()[1]*t.slope+t.intercept)}).style("stroke",function(t,e,n){return p(t,n)}).style("stroke-opacity",function(t){return t.disabled||t.slope===void 0||t.intercept===void 0?0:1}),r.scale(f).ticks(r.ticks()?r.ticks():F/100).tickSize(-L,0),_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")").call(r),a.scale(g).ticks(a.ticks()?a.ticks():L/36).tickSize(-F,0),_.select(".nv-y.nv-axis").call(a),h&&(l.getData(e.x()).scale(f).width(F).color(w.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!w[e].disabled})),V.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),_.select(".nv-distributionX").attr("transform","translate(0,"+g.range()[0]+")").datum(w.filter(function(t){return!t.disabled})).call(l)),m&&(s.getData(e.y()).scale(g).width(L).color(w.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!w[e].disabled})),V.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),_.select(".nv-distributionY").attr("transform","translate(-"+s.size()+",0)").datum(w.filter(function(t){return!t.disabled})).call(s)),d3.fisheye&&(_.select(".nv-background").attr("width",F).attr("height",L),_.select(".nv-background").on("mousemove",A),_.select(".nv-background").on("click",function(){b=!b}),e.dispatch.on("elementClick.freezeFisheye",function(){b=!b})),i.dispatch.on("legendClick",function(o){o.disabled=!o.disabled,y=o.disabled?0:2.5,_.select(".nv-background").style("pointer-events",o.disabled?"none":"all"),_.select(".nv-point-paths").style("pointer-events",o.disabled?"all":"none"),o.disabled?(f.distortion(y).focus(0),g.distortion(y).focus(0),_.select(".nv-scatterWrap").call(e),_.select(".nv-x.nv-axis").call(r),_.select(".nv-y.nv-axis").call(a)):b=!1,t(n)}),o.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,w.filter(function(t){return!t.disabled}).length||w.map(function(t){return t.disabled=!1,Y.selectAll(".nv-series").classed("disabled",!1),t}),M.disabled=w.map(function(t){return!!t.disabled}),D.stateChange(M),t(n)}),e.dispatch.on("elementMouseover.tooltip",function(t){d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.pos[1]-L),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.pos[0]+l.size()),t.pos=[t.pos[0]+u.left,t.pos[1]+u.top],D.tooltipShow(t)}),D.on("tooltipShow",function(t){k&&B(t,H.parentNode)}),D.on("changeState",function(e){e.disabled!==void 0&&(w.forEach(function(t,n){t.disabled=e.disabled[n]}),M.disabled=e.disabled),n.call(t)}),W=f.copy(),z=g.copy()}),t}var e=n.models.scatter(),r=n.models.axis(),a=n.models.axis(),o=n.models.legend(),i=n.models.legend(),l=n.models.distribution(),s=n.models.distribution(),u={top:30,right:20,bottom:50,left:75},c=null,d=null,p=n.utils.defaultColor(),f=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):e.xScale(),g=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):e.yScale(),h=!1,m=!1,v=!0,x=!!d3.fisheye,y=0,b=!1,k=!0,w=function(t,e){return""+e+""},A=function(t,e,n){return""+n+""},C=function(t,e,n,r){return"

"+t+"

"+"

"+r+"

"},M={},S=null,D=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),I="No Data Available.";e.xScale(f).yScale(g),r.orient("bottom").tickPadding(10),a.orient("left").tickPadding(10),l.axis("x"),s.axis("y");var W,z,B=function(o,i){var l=o.pos[0]+(i.offsetLeft||0),s=o.pos[1]+(i.offsetTop||0),c=o.pos[0]+(i.offsetLeft||0),d=g.range()[0]+u.top+(i.offsetTop||0),p=f.range()[0]+u.left+(i.offsetLeft||0),h=o.pos[1]+(i.offsetTop||0),m=r.tickFormat()(e.x()(o.point,o.pointIndex)),v=a.tickFormat()(e.y()(o.point,o.pointIndex));null!=w&&n.tooltip.show([c,d],w(o.series.key,m,v,o,t),"n",1,i,"x-nvtooltip"),null!=A&&n.tooltip.show([p,h],A(o.series.key,m,v,o,t),"e",1,i,"y-nvtooltip"),null!=C&&n.tooltip.show([l,s],C(o.series.key,m,v,o.point.tooltip,o,t),0>o.value?"n":"s",null,i)},P=[{key:"Magnify",disabled:!0}];return e.dispatch.on("elementMouseout.tooltip",function(t){D.tooltipHide(t),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",0),d3.select(".nv-chart-"+e.id()+" .nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",s.size())}),D.on("tooltipHide",function(){k&&n.tooltip.cleanup()}),t.dispatch=D,t.scatter=e,t.legend=o,t.controls=i,t.xAxis=r,t.yAxis=a,t.distX=l,t.distY=s,d3.rebind(t,e,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),t.margin=function(e){return arguments.length?(u.top=e.top!==void 0?e.top:u.top,u.right=e.right!==void 0?e.right:u.right,u.bottom=e.bottom!==void 0?e.bottom:u.bottom,u.left=e.left!==void 0?e.left:u.left,t):u},t.width=function(e){return arguments.length?(c=e,t):c},t.height=function(e){return arguments.length?(d=e,t):d},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),o.color(p),l.color(p),s.color(p),t):p},t.showDistX=function(e){return arguments.length?(h=e,t):h},t.showDistY=function(e){return arguments.length?(m=e,t):m},t.showControls=function(e){return arguments.length?(x=e,t):x},t.showLegend=function(e){return arguments.length?(v=e,t):v},t.fisheye=function(e){return arguments.length?(y=e,t):y},t.tooltips=function(e){return arguments.length?(k=e,t):k},t.tooltipContent=function(e){return arguments.length?(C=e,t):C},t.tooltipXContent=function(e){return arguments.length?(w=e,t):w},t.tooltipYContent=function(e){return arguments.length?(A=e,t):A},t.state=function(e){return arguments.length?(M=e,t):M},t.defaultState=function(e){return arguments.length?(S=e,t):S},t.noData=function(e){return arguments.length?(I=e,t):I},t},n.models.sparkline=function(){function t(n){return n.each(function(t){var n=o-a.left-a.right,l=i-a.top-a.bottom,f=d3.select(this);s.domain(e||d3.extent(t,c)).range([0,n]),u.domain(r||d3.extent(t,d)).range([l,0]);var g=f.selectAll("g.nv-wrap.nv-sparkline").data([t]),h=g.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");h.append("g"),g.select("g"),g.attr("transform","translate("+a.left+","+a.top+")");var m=g.selectAll("path").data(function(t){return[t]});m.enter().append("path"),m.exit().remove(),m.style("stroke",function(t,e){return t.color||p(t,e)}).attr("d",d3.svg.line().x(function(t,e){return s(c(t,e))}).y(function(t,e){return u(d(t,e))}));var v=g.selectAll("circle.nv-point").data(function(t){function e(e){if(-1!=e){var n=t[e];return n.pointIndex=e,n}return null}var n=t.map(function(t,e){return d(t,e)}),r=e(n.lastIndexOf(u.domain()[1])),a=e(n.indexOf(u.domain()[0])),o=e(n.length-1);return[a,r,o].filter(function(t){return null!=t})});v.enter().append("circle"),v.exit().remove(),v.attr("cx",function(t){return s(c(t,t.pointIndex))}).attr("cy",function(t){return u(d(t,t.pointIndex))}).attr("r",2).attr("class",function(t){return c(t,t.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":d(t,t.pointIndex)==u.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),t}var e,r,a={top:2,right:0,bottom:2,left:0},o=400,i=32,l=!0,s=d3.scale.linear(),u=d3.scale.linear(),c=function(t){return t.x},d=function(t){return t.y},p=n.utils.getColor(["#000"]);return t.margin=function(e){return arguments.length?(a.top=e.top!==void 0?e.top:a.top,a.right=e.right!==void 0?e.right:a.right,a.bottom=e.bottom!==void 0?e.bottom:a.bottom,a.left=e.left!==void 0?e.left:a.left,t):a},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.x=function(e){return arguments.length?(c=d3.functor(e),t):c},t.y=function(e){return arguments.length?(d=d3.functor(e),t):d},t.xScale=function(e){return arguments.length?(s=e,t):s},t.yScale=function(e){return arguments.length?(u=e,t):u},t.xDomain=function(n){return arguments.length?(e=n,t):e},t.yDomain=function(e){return arguments.length?(r=e,t):r},t.animate=function(e){return arguments.length?(l=e,t):l},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),t):p},t},n.models.sparklinePlus=function(){function t(n){return n.each(function(p){function m(){if(!u){var t=S.selectAll(".nv-hoverValue").data(s),n=t.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);t.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),t.attr("transform",function(t){return"translate("+e(a.x()(p[t],t))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),s.length&&(n.append("line").attr("x1",0).attr("y1",-o.top).attr("x2",0).attr("y2",b),n.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-o.top).attr("text-anchor","end").attr("dy",".9em"),S.select(".nv-hoverValue .nv-xValue").text(c(a.x()(p[s[0]],s[0]))),n.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-o.top).attr("text-anchor","start").attr("dy",".9em"),S.select(".nv-hoverValue .nv-yValue").text(d(a.y()(p[s[0]],s[0]))))}}function v(){function t(t,e){for(var n=Math.abs(a.x()(t[0],0)-e),r=0,o=0;t.length>o;o++)n>Math.abs(a.x()(t[o],o)-e)&&(n=Math.abs(a.x()(t[o],o)-e),r=o);return r}if(!u){var n=d3.mouse(this)[0]-o.left;s=[t(p,Math.round(e.invert(n)))],m()}}var x=d3.select(this),y=(i||parseInt(x.style("width"))||960)-o.left-o.right,b=(l||parseInt(x.style("height"))||400)-o.top-o.bottom,k=a.y()(p[p.length-1],p.length-1);if(t.update=function(){t(n)},t.container=this,!p||!p.length){var w=x.selectAll(".nv-noData").data([h]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",o.left+y/2).attr("y",o.top+b/2).text(function(t){return t}),t}x.selectAll(".nv-noData").remove(),e=a.xScale(),r=a.yScale();var A=x.selectAll("g.nv-wrap.nv-sparklineplus").data([p]),C=A.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),M=C.append("g"),S=A.select("g");M.append("g").attr("class","nv-sparklineWrap"),M.append("g").attr("class","nv-valueWrap"),M.append("g").attr("class","nv-hoverArea"),A.attr("transform","translate("+o.left+","+o.top+")");var D=S.select(".nv-sparklineWrap");a.width(y).height(b),D.call(a);var I=S.select(".nv-valueWrap"),W=I.selectAll(".nv-currentValue").data([k]);W.enter().append("text").attr("class","nv-currentValue").attr("dx",g?-8:8).attr("dy",".9em").style("text-anchor",g?"end":"start"),W.attr("x",y+(g?o.right:0)).attr("y",f?function(t){return r(t)}:0).style("fill",a.color()(p[p.length-1],p.length-1)).text(d(k)),M.select(".nv-hoverArea").append("rect").on("mousemove",v).on("click",function(){u=!u}).on("mouseout",function(){s=[],m()}),S.select(".nv-hoverArea rect").attr("transform",function(){return"translate("+-o.left+","+-o.top+")"}).attr("width",y+o.left+o.right).attr("height",b+o.top)}),t}var e,r,a=n.models.sparkline(),o={top:15,right:100,bottom:10,left:50},i=null,l=null,s=[],u=!1,c=d3.format(",r"),d=d3.format(",.2f"),p=!0,f=!0,g=!1,h="No Data Available.";return t.sparkline=a,d3.rebind(t,a,"x","y","xScale","yScale","color"),t.margin=function(e){return arguments.length?(o.top=e.top!==void 0?e.top:o.top,o.right=e.right!==void 0?e.right:o.right,o.bottom=e.bottom!==void 0?e.bottom:o.bottom,o.left=e.left!==void 0?e.left:o.left,t):o},t.width=function(e){return arguments.length?(i=e,t):i},t.height=function(e){return arguments.length?(l=e,t):l},t.xTickFormat=function(e){return arguments.length?(c=e,t):c},t.yTickFormat=function(e){return arguments.length?(d=e,t):d},t.showValue=function(e){return arguments.length?(p=e,t):p},t.alignValue=function(e){return arguments.length?(f=e,t):f},t.rightAlignValue=function(e){return arguments.length?(g=e,t):g},t.noData=function(e){return arguments.length?(h=e,t):h},t},n.models.stackedArea=function(){function t(n){return n.each(function(t){var n=o-a.left-a.right,d=i-a.top-a.bottom,x=d3.select(this);e=m.xScale(),r=m.yScale(),t=t.map(function(t){return t.values=t.values.map(function(e,n){return e.index=n,e.stackedY=t.disabled?0:c(e,n),e}),t}),t=d3.layout.stack().order(f).offset(p).values(function(t){return t.values}).x(u).y(function(t){return t.stackedY}).out(function(t,e,n){t.display={y:n,y0:e}})(t);var y=x.selectAll("g.nv-wrap.nv-stackedarea").data([t]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),k=b.append("defs"),w=b.append("g"),A=y.select("g");w.append("g").attr("class","nv-areaWrap"),w.append("g").attr("class","nv-scatterWrap"),y.attr("transform","translate("+a.left+","+a.top+")"),m.width(n).height(d).x(u).y(function(t){return t.display.y+t.display.y0}).forceY([0]).color(t.map(function(t,e){return t.color||l(t,e)}).filter(function(e,n){return!t[n].disabled}));var C=A.select(".nv-scatterWrap").datum(t.filter(function(t){return!t.disabled}));C.call(m),k.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),y.select("#nv-edge-clip-"+s+" rect").attr("width",n).attr("height",d),A.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var M=d3.svg.area().x(function(t,n){return e(u(t,n))}).y0(function(t){return r(t.display.y0)}).y1(function(t){return r(t.display.y+t.display.y0)}).interpolate(g),S=d3.svg.area().x(function(t,n){return e(u(t,n))}).y0(function(t){return r(t.display.y0)}).y1(function(t){return r(t.display.y0)}),D=A.select(".nv-areaWrap").selectAll("path.nv-area").data(function(t){return t});D.enter().append("path").attr("class",function(t,e){return"nv-area nv-area-"+e}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),v.areaMouseover({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),v.areaMouseout({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e})}).on("click",function(t,e){d3.select(this).classed("hover",!1),v.areaClick({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e})}),D.exit().attr("d",function(t,e){return S(t.values,e)}).remove(),D.style("fill",function(t,e){return t.color||l(t,e)}).style("stroke",function(t,e){return t.color||l(t,e)}),D.attr("d",function(t,e){return M(t.values,e)}),m.dispatch.on("elementMouseover.area",function(t){A.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!0)}),m.dispatch.on("elementMouseout.area",function(t){A.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!1)})}),t}var e,r,a={top:0,right:0,bottom:0,left:0},o=960,i=500,l=n.utils.defaultColor(),s=Math.floor(1e5*Math.random()),u=function(t){return t.x},c=function(t){return t.y},d="stack",p="zero",f="default",g="linear",h=!1,m=n.models.scatter(),v=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return m.size(2.2).sizeDomain([2.2,2.2]),m.dispatch.on("elementClick.area",function(t){v.areaClick(t)}),m.dispatch.on("elementMouseover.tooltip",function(t){t.pos=[t.pos[0]+a.left,t.pos[1]+a.top],v.tooltipShow(t)}),m.dispatch.on("elementMouseout.tooltip",function(t){v.tooltipHide(t)}),t.dispatch=v,t.scatter=m,d3.rebind(t,m,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),t.x=function(e){return arguments.length?(u=d3.functor(e),t):u},t.y=function(e){return arguments.length?(c=d3.functor(e),t):c},t.margin=function(e){return arguments.length?(a.top=e.top!==void 0?e.top:a.top,a.right=e.right!==void 0?e.right:a.right,a.bottom=e.bottom!==void 0?e.bottom:a.bottom,a.left=e.left!==void 0?e.left:a.left,t):a},t.width=function(e){return arguments.length?(o=e,t):o},t.height=function(e){return arguments.length?(i=e,t):i},t.clipEdge=function(e){return arguments.length?(h=e,t):h},t.color=function(e){return arguments.length?(l=n.utils.getColor(e),t):l},t.offset=function(e){return arguments.length?(p=e,t):p},t.order=function(e){return arguments.length?(f=e,t):f},t.style=function(e){if(!arguments.length)return d;switch(d=e){case"stack":t.offset("zero"),t.order("default");break;case"stream":t.offset("wiggle"),t.order("inside-out");break;case"stream-center":t.offset("silhouette"),t.order("inside-out");break;case"expand":t.offset("expand"),t.order("default")}return t},t.interpolate=function(t){return arguments.length?g=t:g},t},n.models.stackedAreaChart=function(){function t(n){return n.each(function(p){var m=d3.select(this),C=this,M=(c||parseInt(m.style("width"))||960)-u.left-u.right,S=(d||parseInt(m.style("height"))||400)-u.top-u.bottom;if(t.update=function(){t(n)},t.container=this,x.disabled=p.map(function(t){return!!t.disabled}),!y){var D;y={};for(D in x)y[D]=x[D]instanceof Array?x[D].slice(0):x[D]}if(!(p&&p.length&&p.filter(function(t){return t.values.length}).length)){var I=m.selectAll(".nv-noData").data([b]);return I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),I.attr("x",u.left+M/2).attr("y",u.top+S/2).text(function(t){return t}),t}m.selectAll(".nv-noData").remove(),e=a.xScale(),r=a.yScale();var W=m.selectAll("g.nv-wrap.nv-stackedAreaChart").data([p]),z=W.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),B=W.select("g");if(z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-stackedWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap"),g&&(l.width(M-w),B.select(".nv-legendWrap").datum(p).call(l),u.top!=l.height()&&(u.top=l.height(),S=(d||parseInt(m.style("height"))||400)-u.top-u.bottom),B.select(".nv-legendWrap").attr("transform","translate("+w+","+-u.top+")")),f){var P=[{key:"Stacked",disabled:"zero"!=a.offset()},{key:"Stream",disabled:"wiggle"!=a.offset()},{key:"Expanded",disabled:"expand"!=a.offset()}];s.width(w).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(P).call(s),u.top!=Math.max(s.height(),l.height())&&(u.top=Math.max(s.height(),l.height()),S=(d||parseInt(m.style("height"))||400)-u.top-u.bottom),B.select(".nv-controlsWrap").attr("transform","translate(0,"+-u.top+")")}W.attr("transform","translate("+u.left+","+u.top+")"),a.width(M).height(S);var H=B.select(".nv-stackedWrap").datum(p);H.call(a),o.scale(e).ticks(M/100).tickSize(-S,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+S+")"),B.select(".nv-x.nv-axis").transition().duration(0).call(o),i.scale(r).ticks("wiggle"==a.offset()?0:S/36).tickSize(-M,0).setTickFormat("expand"==a.offset()?d3.format("%"):v),B.select(".nv-y.nv-axis").transition().duration(0).call(i),a.dispatch.on("areaClick.toggle",function(e){p=1===p.filter(function(t){return!t.disabled}).length?p.map(function(t){return t.disabled=!1,t}):p.map(function(t,n){return t.disabled=n!=e.seriesIndex,t}),x.disabled=p.map(function(t){return!!t.disabled}),k.stateChange(x),t(n)}),l.dispatch.on("legendClick",function(e){e.disabled=!e.disabled,p.filter(function(t){return!t.disabled}).length||p.map(function(t){return t.disabled=!1,t}),x.disabled=p.map(function(t){return!!t.disabled}),k.stateChange(x),t(n)}),s.dispatch.on("legendClick",function(e){if(e.disabled){switch(P=P.map(function(t){return t.disabled=!0,t}),e.disabled=!1,e.key){case"Stacked":a.style("stack");break;case"Stream":a.style("stream");break;case"Expanded":a.style("expand")}x.style=a.style(),k.stateChange(x),t(n)}}),k.on("tooltipShow",function(t){h&&A(t,C.parentNode)}),k.on("changeState",function(e){e.disabled!==void 0&&(p.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),e.style!==void 0&&a.style(e.style),n.call(t)})}),t}var e,r,a=n.models.stackedArea(),o=n.models.axis(),i=n.models.axis(),l=n.models.legend(),s=n.models.legend(),u={top:30,right:25,bottom:50,left:60},c=null,d=null,p=n.utils.defaultColor(),f=!0,g=!0,h=!0,m=function(t,e,n){return"

"+t+"

"+"

"+n+" on "+e+"

"},v=d3.format(",.2f"),x={style:a.style()},y=null,b="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),w=250;o.orient("bottom").tickPadding(7),i.orient("left"),a.scatter.pointActive(function(t){return!!Math.round(100*a.y()(t))});var A=function(e,r){var l=e.pos[0]+(r.offsetLeft||0),s=e.pos[1]+(r.offsetTop||0),u=o.tickFormat()(a.x()(e.point,e.pointIndex)),c=i.tickFormat()(a.y()(e.point,e.pointIndex)),d=m(e.series.key,u,c,e,t);n.tooltip.show([l,s],d,0>e.value?"n":"s",null,r)};return a.dispatch.on("tooltipShow",function(t){t.pos=[t.pos[0]+u.left,t.pos[1]+u.top],k.tooltipShow(t)}),a.dispatch.on("tooltipHide",function(t){k.tooltipHide(t)}),k.on("tooltipHide",function(){h&&n.tooltip.cleanup()}),t.dispatch=k,t.stacked=a,t.legend=l,t.controls=s,t.xAxis=o,t.yAxis=i,d3.rebind(t,a,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),t.margin=function(e){return arguments.length?(u.top=e.top!==void 0?e.top:u.top,u.right=e.right!==void 0?e.right:u.right,u.bottom=e.bottom!==void 0?e.bottom:u.bottom,u.left=e.left!==void 0?e.left:u.left,t):u},t.width=function(e){return arguments.length?(c=e,t):getWidth},t.height=function(e){return arguments.length?(d=e,t):getHeight},t.color=function(e){return arguments.length?(p=n.utils.getColor(e),l.color(p),a.color(p),t):p},t.showControls=function(e){return arguments.length?(f=e,t):f},t.showLegend=function(e){return arguments.length?(g=e,t):g},t.tooltip=function(e){return arguments.length?(m=e,t):m},t.tooltips=function(e){return arguments.length?(h=e,t):h},t.tooltipContent=function(e){return arguments.length?(m=e,t):m},t.state=function(e){return arguments.length?(x=e,t):x},t.defaultState=function(e){return arguments.length?(y=e,t):y},t.noData=function(e){return arguments.length?(b=e,t):b},i.setTickFormat=i.tickFormat,i.tickFormat=function(t){return arguments.length?(v=t,i):v +},t}})(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..e5c42eb --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "nvd3", + "version": "0.0.1", + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-jshint": "~0.3.0", + "grunt-contrib-watch": "~0.3.1", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-concat": "~0.2.0" + } +} diff --git a/src/models/indentedTree.js b/src/models/indentedTree.js index f2084b9..996208f 100644 --- a/src/models/indentedTree.js +++ b/src/models/indentedTree.js @@ -1,317 +1,317 @@ -nv.models.indentedTree = function() { - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div - , width = 960 - , height = 500 - , color = nv.utils.defaultColor() - , id = Math.floor(Math.random() * 10000) - , header = true - , filterZero = false - , noData = "No Data Available." - , childIndent = 20 - , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this - , tableClass = null - , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images - , iconClose = 'images/grey-minus.png' - , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') - ; - - //============================================================ - - var idx = 0; - - function chart(selection) { - selection.each(function(data) { - var depth = 1, - container = d3.select(this); - - var tree = d3.layout.tree() - .children(function(d) { return d.values }) - .size([height, childIndent]); //Not sure if this is needed now that the result is HTML - - chart.update = function() { container.transition().duration(600).call(chart) }; - - - //------------------------------------------------------------ - // Display No Data message if there's nothing to show. - if (!data[0]) data[0] = {key: noData}; - - //------------------------------------------------------------ - - - var nodes = tree.nodes(data[0]); - - // nodes.map(function(d) { - // d.id = i++; - // }) - - //------------------------------------------------------------ - // Setup containers and skeleton of chart - - var wrap = d3.select(this).selectAll('div').data([[nodes]]); - var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); - var tableEnter = wrapEnter.append('table'); - var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); - - //------------------------------------------------------------ - - - if (header) { - var thead = tableEnter.append('thead'); - - var theadRow1 = thead.append('tr'); - - columns.forEach(function(column) { - theadRow1 - .append('th') - .attr('width', column.width ? column.width : '10%') - .style('text-align', column.type == 'numeric' ? 'right' : 'left') - .append('span') - .text(column.label); - }); - } - - - var tbody = table.selectAll('tbody') - .data(function(d) { return d }); - tbody.enter().append('tbody'); - - - - //compute max generations - depth = d3.max(nodes, function(node) { return node.depth }); - tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all - - - // Update the nodes… - var node = tbody.selectAll('tr') - // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); - .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); - //.style('display', 'table-row'); //TODO: see if this does anything - - node.exit().remove(); - - node.select('img.nv-treeicon') - .attr('src', icon) - .classed('folded', folded); - - var nodeEnter = node.enter().append('tr'); - - - columns.forEach(function(column, index) { - - var nodeName = nodeEnter.append('td') - .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here - .style('text-align', column.type == 'numeric' ? 'right' : 'left'); - - - if (index == 0) { - nodeName.append('img') - .classed('nv-treeicon', true) - .classed('nv-folded', folded) - .attr('src', icon) - .style('width', '14px') - .style('height', '14px') - .style('padding', '0 1px') - .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) - .on('click', click); - } - - - nodeName.append('span') - .attr('class', d3.functor(column.classes) ) - .text(function(d) { return column.format ? column.format(d) : - (d[column.key] || '-') }); - - if (column.showCount) { - nodeName.append('span') - .attr('class', 'nv-childrenCount'); - - node.selectAll('span.nv-childrenCount').text(function(d) { - return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent - '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter - || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... - || 0) + ')' //This is the catch-all in case there are no children after a filter - : '' //If this is not a parent, just give an empty string - }); - } - - if (column.click) - nodeName.select('span').on('click', column.click); - - }); - - node - .order() - .on('click', function(d) { - dispatch.elementClick({ - row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) - data: d, - pos: [d.x, d.y] - }); - }) - .on('dblclick', function(d) { - dispatch.elementDblclick({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }) - .on('mouseover', function(d) { - dispatch.elementMouseover({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }) - .on('mouseout', function(d) { - dispatch.elementMouseout({ - row: this, - data: d, - pos: [d.x, d.y] - }); - }); - - - - - // Toggle children on click. - function click(d, _, unshift) { - d3.event.stopPropagation(); - - if(d3.event.shiftKey && !unshift) { - //If you shift-click, it'll toggle fold all the children, instead of itself - d3.event.shiftKey = false; - d.values && d.values.forEach(function(node){ - if (node.values || node._values) { - click(node, 0, true); - } - }); - return true; - } - if(!hasChildren(d)) { - //download file - //window.location.href = d.url; - return true; - } - if (d.values) { - d._values = d.values; - d.values = null; - } else { - d.values = d._values; - d._values = null; - } - chart.update(); - } - - - function icon(d) { - return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; - } - - function folded(d) { - return (d._values && d._values.length); - } - - function hasChildren(d) { - var values = d.values || d._values; - - return (values && values.length); - } - - - }); - - return chart; - } - - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - 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(_); - scatter.color(color); - return chart; - }; - - chart.id = function(_) { - if (!arguments.length) return id; - id = _; - return chart; - }; - - chart.header = function(_) { - if (!arguments.length) return header; - header = _; - return chart; - }; - - chart.noData = function(_) { - if (!arguments.length) return noData; - noData = _; - return chart; - }; - - chart.filterZero = function(_) { - if (!arguments.length) return filterZero; - filterZero = _; - return chart; - }; - - chart.columns = function(_) { - if (!arguments.length) return columns; - columns = _; - return chart; - }; - - chart.tableClass = function(_) { - if (!arguments.length) return tableClass; - tableClass = _; - return chart; - }; - - chart.iconOpen = function(_){ - if (!arguments.length) return iconOpen; - iconOpen = _; - return chart; - } - - chart.iconClose = function(_){ - if (!arguments.length) return iconClose; - iconClose = _; - return chart; - } - - //============================================================ - - - return chart; -}; \ No newline at end of file +nv.models.indentedTree = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() + , id = Math.floor(Math.random() * 10000) + , header = true + , filterZero = false + , noData = "No Data Available." + , childIndent = 20 + , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this + , tableClass = null + , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images + , iconClose = 'images/grey-minus.png' + , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + var idx = 0; + + function chart(selection) { + selection.each(function(data) { + var depth = 1, + container = d3.select(this); + + var tree = d3.layout.tree() + .children(function(d) { return d.values }) + .size([height, childIndent]); //Not sure if this is needed now that the result is HTML + + chart.update = function() { container.transition().duration(600).call(chart) }; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + if (!data[0]) data[0] = {key: noData}; + + //------------------------------------------------------------ + + + var nodes = tree.nodes(data[0]); + + // nodes.map(function(d) { + // d.id = i++; + // }) + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('div').data([[nodes]]); + var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); + var tableEnter = wrapEnter.append('table'); + var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); + + //------------------------------------------------------------ + + + if (header) { + var thead = tableEnter.append('thead'); + + var theadRow1 = thead.append('tr'); + + columns.forEach(function(column) { + theadRow1 + .append('th') + .attr('width', column.width ? column.width : '10%') + .style('text-align', column.type == 'numeric' ? 'right' : 'left') + .append('span') + .text(column.label); + }); + } + + + var tbody = table.selectAll('tbody') + .data(function(d) { return d }); + tbody.enter().append('tbody'); + + + + //compute max generations + depth = d3.max(nodes, function(node) { return node.depth }); + tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all + + + // Update the nodes… + var node = tbody.selectAll('tr') + // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); + .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); + //.style('display', 'table-row'); //TODO: see if this does anything + + node.exit().remove(); + + node.select('img.nv-treeicon') + .attr('src', icon) + .classed('folded', folded); + + var nodeEnter = node.enter().append('tr'); + + + columns.forEach(function(column, index) { + + var nodeName = nodeEnter.append('td') + .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here + .style('text-align', column.type == 'numeric' ? 'right' : 'left'); + + + if (index == 0) { + nodeName.append('img') + .classed('nv-treeicon', true) + .classed('nv-folded', folded) + .attr('src', icon) + .style('width', '14px') + .style('height', '14px') + .style('padding', '0 1px') + .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) + .on('click', click); + } + + + nodeName.append('span') + .attr('class', d3.functor(column.classes) ) + .text(function(d) { return column.format ? column.format(d) : + (d[column.key] || '-') }); + + if (column.showCount) { + nodeName.append('span') + .attr('class', 'nv-childrenCount'); + + node.selectAll('span.nv-childrenCount').text(function(d) { + return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent + '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter + || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... + || 0) + ')' //This is the catch-all in case there are no children after a filter + : '' //If this is not a parent, just give an empty string + }); + } + + if (column.click) + nodeName.select('span').on('click', column.click); + + }); + + node + .order() + .on('click', function(d) { + dispatch.elementClick({ + row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) + data: d, + pos: [d.x, d.y] + }); + }) + .on('dblclick', function(d) { + dispatch.elementDblclick({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }); + + + + + // Toggle children on click. + function click(d, _, unshift) { + d3.event.stopPropagation(); + + if(d3.event.shiftKey && !unshift) { + //If you shift-click, it'll toggle fold all the children, instead of itself + d3.event.shiftKey = false; + d.values && d.values.forEach(function(node){ + if (node.values || node._values) { + click(node, 0, true); + } + }); + return true; + } + if(!hasChildren(d)) { + //download file + //window.location.href = d.url; + return true; + } + if (d.values) { + d._values = d.values; + d.values = null; + } else { + d.values = d._values; + d._values = null; + } + chart.update(); + } + + + function icon(d) { + return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; + } + + function folded(d) { + return (d._values && d._values.length); + } + + function hasChildren(d) { + var values = d.values || d._values; + + return (values && values.length); + } + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + 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(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.header = function(_) { + if (!arguments.length) return header; + header = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.filterZero = function(_) { + if (!arguments.length) return filterZero; + filterZero = _; + return chart; + }; + + chart.columns = function(_) { + if (!arguments.length) return columns; + columns = _; + return chart; + }; + + chart.tableClass = function(_) { + if (!arguments.length) return tableClass; + tableClass = _; + return chart; + }; + + chart.iconOpen = function(_){ + if (!arguments.length) return iconOpen; + iconOpen = _; + return chart; + } + + chart.iconClose = function(_){ + if (!arguments.length) return iconClose; + iconClose = _; + return chart; + } + + //============================================================ + + + return chart; +};