diff --git a/dist/metricsgraphics.css b/dist/metricsgraphics.css
index d8245af5..014201df 100644
--- a/dist/metricsgraphics.css
+++ b/dist/metricsgraphics.css
@@ -249,6 +249,16 @@
opacity: 0.9;
}
+.mg-missing-background {
+ stroke-width:2;
+ stroke-opacity:0.05;
+ stroke-dasharray:10,5;
+ fill:none;
+ stroke:blue;
+ rx:15;
+ ry:15;
+}
+
.mg-missing .mg-main-line {
opacity: 0.1;
}
diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js
index 6bed6c10..05223fc8 100644
--- a/dist/metricsgraphics.js
+++ b/dist/metricsgraphics.js
@@ -136,11 +136,11 @@
};
defaults.missing = {
- top: 0,
- bottom: 0,
- right: 0,
- left: 0,
- buffer: 8,
+ top: 40, // the size of the top margin
+ bottom: 30, // the size of the bottom margin
+ right: 10, // size of the right margin
+ left: 10, // size of the left margin
+ buffer: 8, // the buffer between the actual chart area and the margins
legend_target: '',
width: 350,
height: 220,
@@ -2409,7 +2409,7 @@
svg.append('path')
.attr('class', 'mg-confidence-band')
.attr('d', confidence_area(args.data[i]))
- .attr('clip-path', 'url(#mg-plot-window-'+ mg_strip_punctuation(args.target)+')');
+ .attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
}
//add the area
@@ -2453,12 +2453,12 @@
.transition()
.duration(1000)
.attr('d', line(args.data[i]))
- .attr('clip-path', 'url(#mg-plot-window-'+mg_strip_punctuation(args.target)+')');
+ .attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
} else { //or just add the line
svg.append('path')
.attr('class', 'mg-main-line ' + 'mg-line' + (line_id) + '-color')
.attr('d', line(args.data[i]))
- .attr('clip-path', 'url(#mg-plot-window-'+mg_strip_punctuation(args.target)+')');
+ .attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
}
}
@@ -4062,7 +4062,7 @@
.attr('height', args.height);
var svg = d3.select(args.target).select('svg');
-
+
// has the width or height changed?
if (args.width !== Number(svg.attr('width'))) {
svg.attr('width', args.width);
@@ -4096,7 +4096,7 @@
args.scales.Y = d3.scale.linear()
.domain([-2, 2])
- .range([args.height - args.bottom - args.buffer, args.top]);
+ .range([args.height - args.bottom - args.buffer*2, args.top]);
args.scalefns.xf = function(di) { return args.scales.X(di.x); };
args.scalefns.yf = function(di) { return args.scales.Y(di.y); };
@@ -4114,6 +4114,13 @@
var g = svg.append('g')
.attr('class', 'mg-missing-pane');
+
+ g.append('svg:rect')
+ .classed('mg-missing-background', true)
+ .attr('x', args.buffer)
+ .attr('y', args.buffer)
+ .attr('width', args.width-args.buffer*2)
+ .attr('height', args.height-args.buffer*2);
g.append('path')
.attr('class', 'mg-main-line mg-line1-color')
diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js
index a34ed591..beb9256e 100644
--- a/dist/metricsgraphics.min.js
+++ b/dist/metricsgraphics.min.js
@@ -1,3 +1,3 @@
-(function(){"use strict";!function(t,e){"function"==typeof define&&define.amd?define(["d3","jquery"],e):"object"==typeof exports?module.exports=e(require("d3"),require("jquery")):t.MG=e(t.d3,t.jQuery)}(this,function(t,e){function r(t){var r=e(t.target).find("h2.mg-chart-title");if(t.title&&t.title!==r.text())r.remove();else{if(t.title&&""!==t.title)return;r.remove()}if(t.target&&t.title){var a,n=t.description?'':"";e(t.target).prepend('
'+t.title+n+"
"),t.description&&(a=e(t.target).find("h2.mg-chart-title"),a.popover({html:!0,animation:!1,content:t.description,trigger:"hover",placement:"top",container:a}))}t.error&&j(t)}function a(r){for(var a=t.select(e(r.target).find("svg").get(0)),n="point"===r.chart_type?r.buffer/2:2*r.buffer/3,s=[],o=0;o0},f=function(t){return t[r.y_accessor]},p=0;p0){var g=t.extent(h,f);u?(o=Math.min(g[0],o),i=Math.max(g[1],i)):(o=g[0],i=g[1],u=!0)}}o>=0&&!r.min_y&&!r.min_y_from_data&&(o=0),"bar"===r.chart_type&&(o=0,i=t.max(r.data[0],function(t){var e=[];return e.push(t[r.y_accessor]),null!==r.baseline_accessor&&e.push(t[r.baseline_accessor]),null!==r.predictor_accessor&&e.push(t[r.predictor_accessor]),Math.max.apply(null,e)})),o=null!==r.min_y?r.min_y:o,i=null!==r.max_y?r.max_y:i*r.inflator,"log"!==r.y_scale_type&&(o>=0?r.y_axis_negative=!1:(o-=i*(r.inflator-1),r.y_axis_negative=!0)),!r.min_y&&r.min_y_from_data&&(o/=r.inflator),"log"===r.y_scale_type?("histogram"===r.chart_type?o=.2:0>=o&&(o=1),r.scales.Y=t.scale.log().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]).clamp(!0)):r.scales.Y=t.scale.linear().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]),r.processed.min_y=o,r.processed.max_y=i,r.scales.Y_axis=t.scale.linear().domain([r.processed.min_y,r.processed.max_y]).range([r.height-r.bottom-r.buffer,r.top]);var m=r.yax_format;if(m||(m="count"===r.format?function(e){if(1>e)return r.yax_units+t.round(e,r.decimals);var a=t.formatPrefix(e);return r.yax_units+a.scale(e)+a.symbol}:function(e){var r=t.format("%p");return r(e)}),c.find(".mg-y-axis").remove(),!r.y_axis)return this;s=l.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class),r.y_label&&s.append("text").attr("class","label").attr("x",function(){return-1*(r.top+r.buffer+(r.height-r.bottom-r.buffer-(r.top+r.buffer))/2)}).attr("y",function(){return r.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(){return r.y_label}).attr("transform",function(){return"rotate(-90)"});var _=r.scales.Y.ticks(r.yax_count);"log"===r.y_scale_type&&(_=_.filter(function(t){return Math.abs(n(t))%1<1e-6||Math.abs(n(t))%1>1-1e-6}));var v=r.scales.Y.ticks(r.yax_count).length,x=!0;e.each(r.data,function(t,a){e.each(a,function(t,e){return e[r.y_accessor]%1!==0?(x=!1,!1):void 0})}),x&&v>i&&"count"===r.format&&(_=_.filter(function(t){return t%1===0}));var y=_.length-1;return r.x_extended_ticks||r.y_extended_ticks||s.append("line").attr("x1",r.left).attr("x2",r.left).attr("y1",r.scales.Y(_[0]).toFixed(2)).attr("y2",r.scales.Y(_[y]).toFixed(2)),s.selectAll(".mg-yax-ticks").data(_).enter().append("line").classed("mg-extended-y-ticks",r.y_extended_ticks).attr("x1",r.left).attr("x2",function(){return r.y_extended_ticks?r.width-r.right:r.left-r.yax_tick_length}).attr("y1",function(t){return r.scales.Y(t).toFixed(2)}).attr("y2",function(t){return r.scales.Y(t).toFixed(2)}),s.selectAll(".mg-yax-labels").data(_).enter().append("text").attr("x",r.left-3*r.yax_tick_length/2).attr("dx",-3).attr("y",function(t){return r.scales.Y(t).toFixed(2)}).attr("dy",".35em").attr("text-anchor","end").text(function(t){var e=m(t);return e}),r.y_rug&&a(r),this}function s(r){r.scales.Y=t.scale.ordinal().domain(r.categorical_variables).rangeRoundBands([r.height-r.bottom-r.buffer,r.top],r.padding_percentage,r.outer_padding_percentage),r.scalefns.yf=function(t){return r.scales.Y(t[r.y_accessor])};var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-y-axis").remove();var s=a.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class);return r.y_axis?(s.selectAll("text").data(r.categorical_variables).enter().append("svg:text").attr("x",r.left).attr("y",function(t){return r.scales.Y(t)+r.scales.Y.rangeBand()/2+r.buffer*r.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String),this):this}function o(r){for(var a="point"===r.chart_type?r.buffer/2:r.buffer,n=t.select(e(r.target).find("svg").get(0)),s=[],o=0;o10?t.scale.category20():t.scale.category10(),e.scales.color.domain(n)),e.scalefns.color=function(t){return e.scales.color(t[e.color_accessor])})}function u(e){var r,a,n,s;null!==e.size_accessor&&(null===e.size_domain?(r=t.min(e.data[0],function(t){return t[e.size_accessor]}),a=t.max(e.data[0],function(t){return t[e.size_accessor]}),n=[r,a]):n=e.size_domain,s=null===e.size_range?[1,5]:e.size_range,e.scales.size=t.scale.linear().domain(n).range(s).clamp(!0),e.scalefns.size=function(t){return e.scales.size(t[e.size_accessor])})}function d(t,e){t.append("text").attr("class","label").attr("x",function(){return e.left+e.buffer+(e.width-e.right-e.buffer-(e.left+e.buffer))/2}).attr("y",(e.height-e.bottom/2).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(){return e.x_label})}function f(e){return e.xax_format?e.xax_format:function(r){if(1>r)return e.yax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.xax_units+a.scale(r)+a.symbol}}function p(r){if(r.xax_format)return r.xax_format;var a,n,s;return r.time_series&&(a=(r.processed.max_x-r.processed.min_x)/1e3,60>a?(n=t.time.format("%M:%S"),s="seconds"):24>=a/3600?(n=t.time.format("%H:%M"),s="less-than-a-day"):96>=a/3600?(n=t.time.format("%H:%M"),s="four-days"):(n=t.time.format("%b %d"),s="default")),r.processed.main_x_time_format=n,r.processed.x_time_frame=s,function(a){var n=(t.time.format("%b %d"),t.formatPrefix(a));return"date"===e.type(r.data[0][0][r.x_accessor])?r.processed.main_x_time_format(a):"number"===e.type(r.data[0][0][r.x_accessor])?1>a?r.yax_units+t.round(a,r.decimals):(n=t.formatPrefix(a),r.xax_units+n.scale(a)+n.symbol):a}}function h(t,e){var r=e.scales.X.ticks(e.xax_count).length-1;"bar"===e.chart_type||e.x_extended_ticks||e.y_extended_ticks||t.append("line").attr("x1",e.concise===!1||0===e.xax_count?e.left+e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[0]).toFixed(2)).attr("x2",e.concise===!1||0===e.xax_count?e.width-e.right-e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[r]).toFixed(2)).attr("y1",e.height-e.bottom).attr("y2",e.height-e.bottom),t.selectAll(".mg-xax-ticks").data(e.scales.X.ticks(e.xax_count)).enter().append("line").attr("x1",function(t){return e.scales.X(t).toFixed(2)}).attr("x2",function(t){return e.scales.X(t).toFixed(2)}).attr("y1",e.height-e.bottom).attr("y2",function(){return e.x_extended_ticks?e.top:e.height-e.bottom+e.xax_tick_length}).attr("class",function(){return e.x_extended_ticks?"mg-extended-x-ticks":void 0})}function g(e,r){if(e.selectAll(".mg-xax-labels").data(r.scales.X.ticks(r.xax_count)).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/3).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return r.xax_units+r.xax_format(t)}),r.time_series&&(r.show_years||r.show_secondary_x_label)){var a,n,s=r.processed.x_time_frame;switch(s){case"seconds":a=t.time.days,n=t.time.format("%I %p");break;case"less-than-a-day":a=t.time.days,n=t.time.format("%b %d");break;case"four-days":a=t.time.days,n=t.time.format("%b %d");break;default:a=t.time.years,n=t.time.format("%Y")}var o=a(r.processed.min_x,r.processed.max_x);if(0===o.length){var i=r.scales.X.ticks(r.xax_count)[0];o=[i]}e=e.append("g").classed("mg-year-marker",!0).classed("mg-year-marker-small",r.use_small_class),"default"===s&&e.selectAll(".mg-year-marker").data(o).enter().append("line").attr("x1",function(t){return r.scales.X(t).toFixed(2)}).attr("x2",function(t){return r.scales.X(t).toFixed(2)}).attr("y1",r.top).attr("y2",r.height-r.bottom),e.selectAll(".mg-year-marker").data(o).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/1.3).toFixed(2)).attr("dy",r.use_small_class?-3:0).attr("text-anchor","middle").text(function(t){return n(t)})}}function m(e){var r,a,n;if("line"===e.chart_type)for(var s=0;sn||!n)&&(n=e.data[s][r][e.x_accessor]);else"point"===e.chart_type?(n=t.max(e.data[0],function(t){return t[e.x_accessor]}),a=t.min(e.data[0],function(t){return t[e.x_accessor]})):"histogram"===e.chart_type?(a=t.min(e.data[0],function(t){return t[e.x_accessor]}),n=t.max(e.data[0],function(t){return t[e.x_accessor]})):"bar"===e.chart_type&&(a=0,n=t.max(e.data[0],function(t){var r=[];return r.push(t[e.x_accessor]),null!==e.baseline_accessor&&r.push(t[e.baseline_accessor]),null!==e.predictor_accessor&&r.push(t[e.predictor_accessor]),Math.max.apply(null,r)}));if(a===n){if(a instanceof Date){var o=MG.clone(a).setDate(a.getDate()-1),i=MG.clone(a).setDate(a.getDate()+1);a=o,n=i}else"number"==typeof a?(a-=1,n+=1):"string"==typeof a&&(a=Number(a)-1,n=Number(n)+1);e.xax_count=2}a=e.min_x?e.min_x:a,n=e.max_x?e.max_x:n,e.x_axis_negative=!1,e.processed.min_x=a,e.processed.max_x=n,_(e),e.time_series||e.processed.min_x<0&&(e.processed.min_x=e.processed.min_x-e.processed.max_x*(e.inflator-1),e.x_axis_negative=!0),e.additional_buffer="bar"===e.chart_type?5*e.buffer:0}function _(t){t.xax_format||"line"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"point"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"histogram"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"bar"!==t.chart_type||(t.xax_format=f(t))}function v(a){var n={target:null,title:null,description:null};if(a||(a={}),a=P(a,n),t.select(a.target).empty())return void console.warn('The specified target element "'+a.target+'" could not be found in the page. The chart will not be rendered.');a.time_series="date"===e.type(a.data[0][0][a.x_accessor])?!0:!1;var s=a.width,o=a.height;a.full_width&&(s=F(a.target)),a.fill_height&&(o=C(a.target)),"bar"===a.chart_type&&null===o&&(o=a.height=a.data[0].length*a.bar_height+a.top+a.bottom);var i=e(a.target).find("svg");(i.find(".mg-main-line").length>0&&"line"!==a.chart_type||i.find(".mg-points").length>0&&"point"!==a.chart_type||i.find(".mg-histogram").length>0&&"histogram"!==a.chart_type||i.find(".mg-barplot").length>0&&"bar"!==a.chart_type)&&e(a.target).empty(),""===e.trim(e(a.target).html())&&t.select(a.target).append("svg").classed("linked",a.linked).attr("width",s).attr("height",o),a.width=s,a.height=o,i=t.select(a.target).selectAll("svg"),i.append("defs").append("clipPath").attr("id","mg-plot-window-"+T(a.target)).append("svg:rect").attr("x",a.left).attr("y",a.top).attr("width",a.width-a.left-a.right-a.buffer).attr("height",a.height-a.top-a.bottom-a.buffer+1),s!==Number(i.attr("width"))&&i.attr("width",s),o!==Number(i.attr("height"))&&i.attr("height",o),i.attr("viewBox","0 0 "+s+" "+o),(a.full_width||a.full_height)&&i.attr("preserveAspectRatio","xMinYMin meet"),i.classed("mg-missing",!1),i.selectAll(".mg-missing-text").remove(),i.selectAll(".mg-missing-pane").remove(),r(a),a.use_small_class=a.height-a.top-a.bottom-a.buffer<=a.small_height_threshold&&a.width-a.left-a.right-2*a.buffer<=a.small_width_threshold||a.small_text;var l;if(a.data.length0){var c=function(t){var e=new Array(t);for(l=0;ld;l--)e(a.target).find("svg .mg-main-line.mg-line"+l+"-color").remove()}return this}function x(r){var a,n,s=t.select(e(r.target).find("svg").get(0));return e(r.target).find("svg .mg-markers").remove(),e(r.target).find("svg .mg-baselines").remove(),r.markers&&(a=s.append("g").attr("class","mg-markers"),a.selectAll(".mg-markers").data(r.markers.filter(function(t){return r.scales.X(t[r.x_accessor])>r.buffer+r.left&&r.scales.X(t[r.x_accessor])r.buffer+r.left&&r.scales.X(t[r.x_accessor])=u;u.setDate(u.getDate()+1)){var d={};u.setHours(0,0,0,0),Date.parse(u)===Date.parse(new Date(i))&&o.push(MG.clone(t.data[a][0]));var f=null;e.each(t.data[a],function(e,r){return Date.parse(r[t.x_accessor])===Date.parse(new Date(u))?(f=r,!1):void 0}),f?o.push(f):(d[t.x_accessor]=new Date(u),d[t.y_accessor]=0,o.push(d)),Date.parse(u)===Date.parse(new Date(s[t.x_accessor]))&&o.push(s)}t.data[a]=o}return this}function A(e){var r,a=e.data[0];if(e.binned===!1){if("object"==typeof a[0])r=a.map(function(t){return t[e.x_accessor]});else{if("number"!=typeof a[0])return void console.log("TypeError: expected an array of numbers, found "+typeof a[0]);r=a}var n=t.layout.histogram();e.bins&&(n=n.bins(e.bins)),e.processed_data=n(r).map(function(t){return{x:t.x,y:t.y,dx:t.dx}})}else{e.processed_data=a.map(function(t){return{x:t[e.x_accessor],y:t[e.y_accessor]}});for(var s,o,i=0;ir&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function j(t){console.log("ERROR : ",t.target," : ",t.error),e(t.target).find(".mg-chart-title").append('')}window.MG={version:"2.1.0"};var G={};if(MG.globals={},MG.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},show_years:{replacement:"show_secondary_x_label",version:"2.1"}},MG.globals.link=!1,MG.globals.version="1.1",MG.data_graphic=function(){var t={};t.all={missing_is_zero:!1,legend:"",legend_target:"",error:"",animate_on_load:!1,top:40,bottom:30,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,small_text:!1,xax_count:6,xax_tick_length:5,yax_count:5,yax_tick_length:5,x_extended_ticks:!1,y_extended_ticks:!1,y_scale_type:"linear",max_x:null,max_y:null,min_x:null,min_y:null,min_y_from_data:!1,point_size:2.5,x_accessor:"date",xax_units:"",x_label:"",x_axis:!0,y_axis:!0,y_accessor:"value",y_label:"",yax_units:"",x_rug:!1,y_rug:!1,transition_on_update:!0,mouseover:null,show_rollover_text:!0,show_confidence_band:null,xax_format:null,area:!0,chart_type:"line",data:[],decimals:2,format:"count",inflator:10/9,linked:!1,linked_format:"%Y-%m-%d",list:!1,baselines:null,markers:null,scalefns:{},scales:{},show_secondary_x_label:!0,target:"#viz",interpolate:"cardinal",custom_line_color_map:[],max_data_size:null,aggregate_rollover:!1},t.point={buffer:16,ls:!1,lowess:!1,point_size:2.5,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,color_type:"number"},t.histogram={mouseover:function(t){e("#histogram svg .mg-active-datapoint").html("Frequency Count: "+t.y)},binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1},t.bar={y_accessor:"factor",x_accessor:"value",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,dodge_accessor:null,binned:!0,padding_percentage:0,outer_padding_percentage:.1,height:500,top:20,bar_height:20,left:70},t.missing={top:0,bottom:0,right:0,left:0,buffer:8,legend_target:"",width:350,height:220,missing_text:"Data currently missing or unavailable",scalefns:{},scales:{},show_missing_background:!0,interpolate:"cardinal"};var r=arguments[0];r||(r={}),r.list&&(r.x_accessor=0,r.y_accessor=1);for(var a in MG.deprecations)if(r.hasOwnProperty(a)){var n=MG.deprecations[a],s="Use of `args."+a+"` has been deprecated",o=n.replacement;if(o&&(r[o]?s+=". The replacement - `args."+o+"` - has already been defined. This definition will be discarded.":r[o]=r[a]),n.warned)continue;n.warned=!0,o&&(s+=" in favor of `args."+o+"`"),E(s,n.version)}var i;return"missing-data"===r.chart_type?(r=P(r,t.missing),G.missing(r)):"point"===r.chart_type?(i=P(t.point,t.all),r=P(r,i),G.point(r).mainPlot().markers().rollover().windowListeners()):"histogram"===r.chart_type?(i=P(t.histogram,t.all),r=P(r,i),G.histogram(r).mainPlot().markers().rollover().windowListeners()):"bar"===r.chart_type?(i=P(t.bar,t.all),r=P(r,i),G.bar(r).mainPlot().markers().rollover().windowListeners()):(r=P(r,t.all),G.line(r).mainPlot().markers().rollover().windowListeners()),r.data},"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");if(+function(t){var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),s="object"==typeof e&&e,o=s&&s.selector;(n||"destroy"!=e)&&(o?(n||a.data("bs.tooltip",n={}),n[o]||(n[o]=new r(this,s))):n||a.data("bs.tooltip",n=new r(this,s)),"string"==typeof e&&n[e]())})}if("function"==typeof t().tooltip)return!0;var r=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};r.VERSION="3.3.1",r.TRANSITION_DURATION=150,r.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},r.prototype.init=function(e,r,a){this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(this.options.viewport.selector||this.options.viewport);for(var n=this.options.trigger.split(" "),s=n.length;s--;){var o=n[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=o){var i="hover"==o?"mouseenter":"focusin",l="hover"==o?"mouseleave":"focusout";this.$element.on(i+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},r.prototype.getDelegateOptions=function(){var e={},r=this.getDefaults();return this._options&&t.each(this._options,function(t,a){r[t]!=a&&(e[t]=a)}),e},r.prototype.enter=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r&&r.$tip&&r.$tip.is(":visible")?void(r.hoverState="in"):(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="in",r.options.delay&&r.options.delay.show?void(r.timeout=setTimeout(function(){"in"==r.hoverState&&r.show()},r.options.delay.show)):r.show())},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="out",r.options.delay&&r.options.delay.hide?void(r.timeout=setTimeout(function(){"out"==r.hoverState&&r.hide()},r.options.delay.hide)):r.hide()},r.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var a=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!a)return;var n=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(i);c&&(i=i.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var u=this.getPosition(),d=s[0].offsetWidth,f=s[0].offsetHeight;if(c){var p=i,h=this.options.container?t(this.options.container):this.$element.parent(),g=this.getPosition(h);i="bottom"==i&&u.bottom+f>g.bottom?"top":"top"==i&&u.top-fg.width?"left":"left"==i&&u.left-do.top+o.height&&(n.top=o.top+o.height-l)}else{var c=e.left-s,u=e.left+s+r;
+(function(){"use strict";!function(t,e){"function"==typeof define&&define.amd?define(["d3","jquery"],e):"object"==typeof exports?module.exports=e(require("d3"),require("jquery")):t.MG=e(t.d3,t.jQuery)}(this,function(t,e){function r(t){var r=e(t.target).find("h2.mg-chart-title");if(t.title&&t.title!==r.text())r.remove();else{if(t.title&&""!==t.title)return;r.remove()}if(t.target&&t.title){var a,n=t.description?'':"";e(t.target).prepend(''+t.title+n+"
"),t.description&&(a=e(t.target).find("h2.mg-chart-title"),a.popover({html:!0,animation:!1,content:t.description,trigger:"hover",placement:"top",container:a}))}t.error&&j(t)}function a(r){for(var a=t.select(e(r.target).find("svg").get(0)),n="point"===r.chart_type?r.buffer/2:2*r.buffer/3,s=[],o=0;o0},f=function(t){return t[r.y_accessor]},p=0;p0){var g=t.extent(h,f);u?(o=Math.min(g[0],o),i=Math.max(g[1],i)):(o=g[0],i=g[1],u=!0)}}o>=0&&!r.min_y&&!r.min_y_from_data&&(o=0),"bar"===r.chart_type&&(o=0,i=t.max(r.data[0],function(t){var e=[];return e.push(t[r.y_accessor]),null!==r.baseline_accessor&&e.push(t[r.baseline_accessor]),null!==r.predictor_accessor&&e.push(t[r.predictor_accessor]),Math.max.apply(null,e)})),o=null!==r.min_y?r.min_y:o,i=null!==r.max_y?r.max_y:i*r.inflator,"log"!==r.y_scale_type&&(o>=0?r.y_axis_negative=!1:(o-=i*(r.inflator-1),r.y_axis_negative=!0)),!r.min_y&&r.min_y_from_data&&(o/=r.inflator),"log"===r.y_scale_type?("histogram"===r.chart_type?o=.2:0>=o&&(o=1),r.scales.Y=t.scale.log().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]).clamp(!0)):r.scales.Y=t.scale.linear().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]),r.processed.min_y=o,r.processed.max_y=i,r.scales.Y_axis=t.scale.linear().domain([r.processed.min_y,r.processed.max_y]).range([r.height-r.bottom-r.buffer,r.top]);var m=r.yax_format;if(m||(m="count"===r.format?function(e){if(1>e)return r.yax_units+t.round(e,r.decimals);var a=t.formatPrefix(e);return r.yax_units+a.scale(e)+a.symbol}:function(e){var r=t.format("%p");return r(e)}),c.find(".mg-y-axis").remove(),!r.y_axis)return this;s=l.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class),r.y_label&&s.append("text").attr("class","label").attr("x",function(){return-1*(r.top+r.buffer+(r.height-r.bottom-r.buffer-(r.top+r.buffer))/2)}).attr("y",function(){return r.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(){return r.y_label}).attr("transform",function(){return"rotate(-90)"});var _=r.scales.Y.ticks(r.yax_count);"log"===r.y_scale_type&&(_=_.filter(function(t){return Math.abs(n(t))%1<1e-6||Math.abs(n(t))%1>1-1e-6}));var v=r.scales.Y.ticks(r.yax_count).length,x=!0;e.each(r.data,function(t,a){e.each(a,function(t,e){return e[r.y_accessor]%1!==0?(x=!1,!1):void 0})}),x&&v>i&&"count"===r.format&&(_=_.filter(function(t){return t%1===0}));var y=_.length-1;return r.x_extended_ticks||r.y_extended_ticks||s.append("line").attr("x1",r.left).attr("x2",r.left).attr("y1",r.scales.Y(_[0]).toFixed(2)).attr("y2",r.scales.Y(_[y]).toFixed(2)),s.selectAll(".mg-yax-ticks").data(_).enter().append("line").classed("mg-extended-y-ticks",r.y_extended_ticks).attr("x1",r.left).attr("x2",function(){return r.y_extended_ticks?r.width-r.right:r.left-r.yax_tick_length}).attr("y1",function(t){return r.scales.Y(t).toFixed(2)}).attr("y2",function(t){return r.scales.Y(t).toFixed(2)}),s.selectAll(".mg-yax-labels").data(_).enter().append("text").attr("x",r.left-3*r.yax_tick_length/2).attr("dx",-3).attr("y",function(t){return r.scales.Y(t).toFixed(2)}).attr("dy",".35em").attr("text-anchor","end").text(function(t){var e=m(t);return e}),r.y_rug&&a(r),this}function s(r){r.scales.Y=t.scale.ordinal().domain(r.categorical_variables).rangeRoundBands([r.height-r.bottom-r.buffer,r.top],r.padding_percentage,r.outer_padding_percentage),r.scalefns.yf=function(t){return r.scales.Y(t[r.y_accessor])};var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-y-axis").remove();var s=a.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class);return r.y_axis?(s.selectAll("text").data(r.categorical_variables).enter().append("svg:text").attr("x",r.left).attr("y",function(t){return r.scales.Y(t)+r.scales.Y.rangeBand()/2+r.buffer*r.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String),this):this}function o(r){for(var a="point"===r.chart_type?r.buffer/2:r.buffer,n=t.select(e(r.target).find("svg").get(0)),s=[],o=0;o10?t.scale.category20():t.scale.category10(),e.scales.color.domain(n)),e.scalefns.color=function(t){return e.scales.color(t[e.color_accessor])})}function u(e){var r,a,n,s;null!==e.size_accessor&&(null===e.size_domain?(r=t.min(e.data[0],function(t){return t[e.size_accessor]}),a=t.max(e.data[0],function(t){return t[e.size_accessor]}),n=[r,a]):n=e.size_domain,s=null===e.size_range?[1,5]:e.size_range,e.scales.size=t.scale.linear().domain(n).range(s).clamp(!0),e.scalefns.size=function(t){return e.scales.size(t[e.size_accessor])})}function d(t,e){t.append("text").attr("class","label").attr("x",function(){return e.left+e.buffer+(e.width-e.right-e.buffer-(e.left+e.buffer))/2}).attr("y",(e.height-e.bottom/2).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(){return e.x_label})}function f(e){return e.xax_format?e.xax_format:function(r){if(1>r)return e.yax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.xax_units+a.scale(r)+a.symbol}}function p(r){if(r.xax_format)return r.xax_format;var a,n,s;return r.time_series&&(a=(r.processed.max_x-r.processed.min_x)/1e3,60>a?(n=t.time.format("%M:%S"),s="seconds"):24>=a/3600?(n=t.time.format("%H:%M"),s="less-than-a-day"):96>=a/3600?(n=t.time.format("%H:%M"),s="four-days"):(n=t.time.format("%b %d"),s="default")),r.processed.main_x_time_format=n,r.processed.x_time_frame=s,function(a){var n=(t.time.format("%b %d"),t.formatPrefix(a));return"date"===e.type(r.data[0][0][r.x_accessor])?r.processed.main_x_time_format(a):"number"===e.type(r.data[0][0][r.x_accessor])?1>a?r.yax_units+t.round(a,r.decimals):(n=t.formatPrefix(a),r.xax_units+n.scale(a)+n.symbol):a}}function h(t,e){var r=e.scales.X.ticks(e.xax_count).length-1;"bar"===e.chart_type||e.x_extended_ticks||e.y_extended_ticks||t.append("line").attr("x1",e.concise===!1||0===e.xax_count?e.left+e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[0]).toFixed(2)).attr("x2",e.concise===!1||0===e.xax_count?e.width-e.right-e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[r]).toFixed(2)).attr("y1",e.height-e.bottom).attr("y2",e.height-e.bottom),t.selectAll(".mg-xax-ticks").data(e.scales.X.ticks(e.xax_count)).enter().append("line").attr("x1",function(t){return e.scales.X(t).toFixed(2)}).attr("x2",function(t){return e.scales.X(t).toFixed(2)}).attr("y1",e.height-e.bottom).attr("y2",function(){return e.x_extended_ticks?e.top:e.height-e.bottom+e.xax_tick_length}).attr("class",function(){return e.x_extended_ticks?"mg-extended-x-ticks":void 0})}function g(e,r){if(e.selectAll(".mg-xax-labels").data(r.scales.X.ticks(r.xax_count)).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/3).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return r.xax_units+r.xax_format(t)}),r.time_series&&(r.show_years||r.show_secondary_x_label)){var a,n,s=r.processed.x_time_frame;switch(s){case"seconds":a=t.time.days,n=t.time.format("%I %p");break;case"less-than-a-day":a=t.time.days,n=t.time.format("%b %d");break;case"four-days":a=t.time.days,n=t.time.format("%b %d");break;default:a=t.time.years,n=t.time.format("%Y")}var o=a(r.processed.min_x,r.processed.max_x);if(0===o.length){var i=r.scales.X.ticks(r.xax_count)[0];o=[i]}e=e.append("g").classed("mg-year-marker",!0).classed("mg-year-marker-small",r.use_small_class),"default"===s&&e.selectAll(".mg-year-marker").data(o).enter().append("line").attr("x1",function(t){return r.scales.X(t).toFixed(2)}).attr("x2",function(t){return r.scales.X(t).toFixed(2)}).attr("y1",r.top).attr("y2",r.height-r.bottom),e.selectAll(".mg-year-marker").data(o).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/1.3).toFixed(2)).attr("dy",r.use_small_class?-3:0).attr("text-anchor","middle").text(function(t){return n(t)})}}function m(e){var r,a,n;if("line"===e.chart_type)for(var s=0;sn||!n)&&(n=e.data[s][r][e.x_accessor]);else"point"===e.chart_type?(n=t.max(e.data[0],function(t){return t[e.x_accessor]}),a=t.min(e.data[0],function(t){return t[e.x_accessor]})):"histogram"===e.chart_type?(a=t.min(e.data[0],function(t){return t[e.x_accessor]}),n=t.max(e.data[0],function(t){return t[e.x_accessor]})):"bar"===e.chart_type&&(a=0,n=t.max(e.data[0],function(t){var r=[];return r.push(t[e.x_accessor]),null!==e.baseline_accessor&&r.push(t[e.baseline_accessor]),null!==e.predictor_accessor&&r.push(t[e.predictor_accessor]),Math.max.apply(null,r)}));if(a===n){if(a instanceof Date){var o=MG.clone(a).setDate(a.getDate()-1),i=MG.clone(a).setDate(a.getDate()+1);a=o,n=i}else"number"==typeof a?(a-=1,n+=1):"string"==typeof a&&(a=Number(a)-1,n=Number(n)+1);e.xax_count=2}a=e.min_x?e.min_x:a,n=e.max_x?e.max_x:n,e.x_axis_negative=!1,e.processed.min_x=a,e.processed.max_x=n,_(e),e.time_series||e.processed.min_x<0&&(e.processed.min_x=e.processed.min_x-e.processed.max_x*(e.inflator-1),e.x_axis_negative=!0),e.additional_buffer="bar"===e.chart_type?5*e.buffer:0}function _(t){t.xax_format||"line"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"point"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"histogram"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"bar"!==t.chart_type||(t.xax_format=f(t))}function v(a){var n={target:null,title:null,description:null};if(a||(a={}),a=P(a,n),t.select(a.target).empty())return void console.warn('The specified target element "'+a.target+'" could not be found in the page. The chart will not be rendered.');a.time_series="date"===e.type(a.data[0][0][a.x_accessor])?!0:!1;var s=a.width,o=a.height;a.full_width&&(s=F(a.target)),a.fill_height&&(o=C(a.target)),"bar"===a.chart_type&&null===o&&(o=a.height=a.data[0].length*a.bar_height+a.top+a.bottom);var i=e(a.target).find("svg");(i.find(".mg-main-line").length>0&&"line"!==a.chart_type||i.find(".mg-points").length>0&&"point"!==a.chart_type||i.find(".mg-histogram").length>0&&"histogram"!==a.chart_type||i.find(".mg-barplot").length>0&&"bar"!==a.chart_type)&&e(a.target).empty(),""===e.trim(e(a.target).html())&&t.select(a.target).append("svg").classed("linked",a.linked).attr("width",s).attr("height",o),a.width=s,a.height=o,i=t.select(a.target).selectAll("svg"),i.append("defs").append("clipPath").attr("id","mg-plot-window-"+T(a.target)).append("svg:rect").attr("x",a.left).attr("y",a.top).attr("width",a.width-a.left-a.right-a.buffer).attr("height",a.height-a.top-a.bottom-a.buffer+1),s!==Number(i.attr("width"))&&i.attr("width",s),o!==Number(i.attr("height"))&&i.attr("height",o),i.attr("viewBox","0 0 "+s+" "+o),(a.full_width||a.full_height)&&i.attr("preserveAspectRatio","xMinYMin meet"),i.classed("mg-missing",!1),i.selectAll(".mg-missing-text").remove(),i.selectAll(".mg-missing-pane").remove(),r(a),a.use_small_class=a.height-a.top-a.bottom-a.buffer<=a.small_height_threshold&&a.width-a.left-a.right-2*a.buffer<=a.small_width_threshold||a.small_text;var l;if(a.data.length0){var c=function(t){var e=new Array(t);for(l=0;ld;l--)e(a.target).find("svg .mg-main-line.mg-line"+l+"-color").remove()}return this}function x(r){var a,n,s=t.select(e(r.target).find("svg").get(0));return e(r.target).find("svg .mg-markers").remove(),e(r.target).find("svg .mg-baselines").remove(),r.markers&&(a=s.append("g").attr("class","mg-markers"),a.selectAll(".mg-markers").data(r.markers.filter(function(t){return r.scales.X(t[r.x_accessor])>r.buffer+r.left&&r.scales.X(t[r.x_accessor])r.buffer+r.left&&r.scales.X(t[r.x_accessor])=u;u.setDate(u.getDate()+1)){var d={};u.setHours(0,0,0,0),Date.parse(u)===Date.parse(new Date(i))&&o.push(MG.clone(t.data[a][0]));var f=null;e.each(t.data[a],function(e,r){return Date.parse(r[t.x_accessor])===Date.parse(new Date(u))?(f=r,!1):void 0}),f?o.push(f):(d[t.x_accessor]=new Date(u),d[t.y_accessor]=0,o.push(d)),Date.parse(u)===Date.parse(new Date(s[t.x_accessor]))&&o.push(s)}t.data[a]=o}return this}function A(e){var r,a=e.data[0];if(e.binned===!1){if("object"==typeof a[0])r=a.map(function(t){return t[e.x_accessor]});else{if("number"!=typeof a[0])return void console.log("TypeError: expected an array of numbers, found "+typeof a[0]);r=a}var n=t.layout.histogram();e.bins&&(n=n.bins(e.bins)),e.processed_data=n(r).map(function(t){return{x:t.x,y:t.y,dx:t.dx}})}else{e.processed_data=a.map(function(t){return{x:t[e.x_accessor],y:t[e.y_accessor]}});for(var s,o,i=0;ir&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function j(t){console.log("ERROR : ",t.target," : ",t.error),e(t.target).find(".mg-chart-title").append('')}window.MG={version:"2.1.0"};var G={};if(MG.globals={},MG.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},show_years:{replacement:"show_secondary_x_label",version:"2.1"}},MG.globals.link=!1,MG.globals.version="1.1",MG.data_graphic=function(){var t={};t.all={missing_is_zero:!1,legend:"",legend_target:"",error:"",animate_on_load:!1,top:40,bottom:30,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,small_text:!1,xax_count:6,xax_tick_length:5,yax_count:5,yax_tick_length:5,x_extended_ticks:!1,y_extended_ticks:!1,y_scale_type:"linear",max_x:null,max_y:null,min_x:null,min_y:null,min_y_from_data:!1,point_size:2.5,x_accessor:"date",xax_units:"",x_label:"",x_axis:!0,y_axis:!0,y_accessor:"value",y_label:"",yax_units:"",x_rug:!1,y_rug:!1,transition_on_update:!0,mouseover:null,show_rollover_text:!0,show_confidence_band:null,xax_format:null,area:!0,chart_type:"line",data:[],decimals:2,format:"count",inflator:10/9,linked:!1,linked_format:"%Y-%m-%d",list:!1,baselines:null,markers:null,scalefns:{},scales:{},show_secondary_x_label:!0,target:"#viz",interpolate:"cardinal",custom_line_color_map:[],max_data_size:null,aggregate_rollover:!1},t.point={buffer:16,ls:!1,lowess:!1,point_size:2.5,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,color_type:"number"},t.histogram={mouseover:function(t){e("#histogram svg .mg-active-datapoint").html("Frequency Count: "+t.y)},binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1},t.bar={y_accessor:"factor",x_accessor:"value",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,dodge_accessor:null,binned:!0,padding_percentage:0,outer_padding_percentage:.1,height:500,top:20,bar_height:20,left:70},t.missing={top:40,bottom:30,right:10,left:10,buffer:8,legend_target:"",width:350,height:220,missing_text:"Data currently missing or unavailable",scalefns:{},scales:{},show_missing_background:!0,interpolate:"cardinal"};var r=arguments[0];r||(r={}),r.list&&(r.x_accessor=0,r.y_accessor=1);for(var a in MG.deprecations)if(r.hasOwnProperty(a)){var n=MG.deprecations[a],s="Use of `args."+a+"` has been deprecated",o=n.replacement;if(o&&(r[o]?s+=". The replacement - `args."+o+"` - has already been defined. This definition will be discarded.":r[o]=r[a]),n.warned)continue;n.warned=!0,o&&(s+=" in favor of `args."+o+"`"),E(s,n.version)}var i;return"missing-data"===r.chart_type?(r=P(r,t.missing),G.missing(r)):"point"===r.chart_type?(i=P(t.point,t.all),r=P(r,i),G.point(r).mainPlot().markers().rollover().windowListeners()):"histogram"===r.chart_type?(i=P(t.histogram,t.all),r=P(r,i),G.histogram(r).mainPlot().markers().rollover().windowListeners()):"bar"===r.chart_type?(i=P(t.bar,t.all),r=P(r,i),G.bar(r).mainPlot().markers().rollover().windowListeners()):(r=P(r,t.all),G.line(r).mainPlot().markers().rollover().windowListeners()),r.data},"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");if(+function(t){var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),s="object"==typeof e&&e,o=s&&s.selector;(n||"destroy"!=e)&&(o?(n||a.data("bs.tooltip",n={}),n[o]||(n[o]=new r(this,s))):n||a.data("bs.tooltip",n=new r(this,s)),"string"==typeof e&&n[e]())})}if("function"==typeof t().tooltip)return!0;var r=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};r.VERSION="3.3.1",r.TRANSITION_DURATION=150,r.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},r.prototype.init=function(e,r,a){this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(this.options.viewport.selector||this.options.viewport);for(var n=this.options.trigger.split(" "),s=n.length;s--;){var o=n[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=o){var i="hover"==o?"mouseenter":"focusin",l="hover"==o?"mouseleave":"focusout";this.$element.on(i+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},r.prototype.getDelegateOptions=function(){var e={},r=this.getDefaults();return this._options&&t.each(this._options,function(t,a){r[t]!=a&&(e[t]=a)}),e},r.prototype.enter=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r&&r.$tip&&r.$tip.is(":visible")?void(r.hoverState="in"):(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="in",r.options.delay&&r.options.delay.show?void(r.timeout=setTimeout(function(){"in"==r.hoverState&&r.show()},r.options.delay.show)):r.show())},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="out",r.options.delay&&r.options.delay.hide?void(r.timeout=setTimeout(function(){"out"==r.hoverState&&r.hide()},r.options.delay.hide)):r.hide()},r.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var a=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!a)return;var n=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(i);c&&(i=i.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var u=this.getPosition(),d=s[0].offsetWidth,f=s[0].offsetHeight;if(c){var p=i,h=this.options.container?t(this.options.container):this.$element.parent(),g=this.getPosition(h);i="bottom"==i&&u.bottom+f>g.bottom?"top":"top"==i&&u.top-fg.width?"left":"left"==i&&u.left-do.top+o.height&&(n.top=o.top+o.height-l)}else{var c=e.left-s,u=e.left+s+r;
co.width&&(n.left=o.left+o.width-u)}return n},r.prototype.getTitle=function(){var t,e=this.$element,r=this.options;return t=e.attr("data-original-title")||("function"==typeof r.title?r.title.call(e[0]):r.title)},r.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},r.prototype.tip=function(){return this.$tip=this.$tip||t(this.options.template)},r.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},r.prototype.enable=function(){this.enabled=!0},r.prototype.disable=function(){this.enabled=!1},r.prototype.toggleEnabled=function(){this.enabled=!this.enabled},r.prototype.toggle=function(e){var r=this;e&&(r=t(e.currentTarget).data("bs."+this.type),r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r))),r.tip().hasClass("in")?r.leave(r):r.enter(r)},r.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type)})};var a=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=r,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=a,this}}(jQuery),+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.popover"),s="object"==typeof e&&e,o=s&&s.selector;(n||"destroy"!=e)&&(o?(n||a.data("bs.popover",n={}),n[o]||(n[o]=new r(this,s))):n||a.data("bs.popover",n=new r(this,s)),"string"==typeof e&&n[e]())})}if("function"==typeof t().popover)return!0;var r=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");r.VERSION="3.3.1",r.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),r.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),r.prototype.constructor=r,r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),r=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof r?"html":"append":"text"](r),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},r.prototype.hasContent=function(){return this.getTitle()||this.getContent()},r.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},r.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},r.prototype.tip=function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip};var a=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=r,t.fn.popover.noConflict=function(){return t.fn.popover=a,this}}(jQuery),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){function e(e){e&&3===e.which||(t(n).remove(),t(s).each(function(){var a=t(this),n=r(a),s={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",s)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",s)))}))}function r(e){var r=e.attr("data-target");r||(r=e.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var a=r&&t(r);return a&&a.length?a:e.parent()}function a(e){return this.each(function(){var r=t(this),a=r.data("bs.dropdown");a||r.data("bs.dropdown",a=new o(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",s='[data-toggle="dropdown"]',o=function(e){t(e).on("click.bs.dropdown",this.toggle)};o.VERSION="3.3.1",o.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var s=r(n),o=s.hasClass("open");if(e(),!o){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t('').insertAfter(t(this)).on("click",e);var i={relatedTarget:this};if(s.trigger(a=t.Event("show.bs.dropdown",i)),a.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger("shown.bs.dropdown",i)}return!1}},o.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var a=t(this);if(e.preventDefault(),e.stopPropagation(),!a.is(".disabled, :disabled")){var n=r(a),o=n.hasClass("open");if(!o&&27!=e.which||o&&27==e.which)return 27==e.which&&n.find(s).trigger("focus"),a.trigger("click");var i=" li:not(.divider):visible a",l=n.find('[role="menu"]'+i+', [role="listbox"]'+i);if(l.length){var c=l.index(e.target);38==e.which&&c>0&&c--,40==e.which&&c1&&(this.public_name[t]=arguments[1]),arguments.length>2&&(this.sorters[t]=arguments[2]),this.feature_set[t]=[],this},this.callback=function(t){return this._callback=t,this},this.display=function(){var t,r,a,n,s=this._callback,o=this.manual_callback,i=this.manual_map;a=Object.keys(this.feature_set);var l,c=function(e){return t[e]};for(l=0;l");var d=function(){var t,r=e(this).data("key"),a=e(this).data("feature");return e("."+a+"-btns button.btn span.title").html(r),i.hasOwnProperty(a)?(t=i[a],o[t](r)):s(a,r),!1};for(var f in this.feature_set){for(a=this.feature_set[f],e(this.target+" div.segments").append('"),l=0;l'+a[l]+"");e("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",d)}return this},this},G.line=function(r){return this.args=r,this.init=function(t){return w(t),k(t),v(t),i(t),n(t),this},this.mainPlot=function(){var a,n=t.select(e(r.target).find("svg").get(0)),s=0,o=r.transition_on_update?1e3:0,i=function(t){return t[r.y_accessor]},l=t.svg.area().x(r.scalefns.xf).y0(r.scales.Y.range()[0]).y1(r.scalefns.yf).interpolate(r.interpolate),c=e(r.target).find(".mg-confidence-band");c.length>0&&c.remove(),r.show_confidence_band&&(a=t.svg.area().x(r.scalefns.xf).y0(function(t){var e=r.show_confidence_band[0];return r.scales.Y(t[e])}).y1(function(t){var e=r.show_confidence_band[1];return r.scales.Y(t[e])}).interpolate(r.interpolate));for(var u,d=t.svg.line().x(r.scalefns.xf).y(r.scalefns.yf).interpolate(r.interpolate),f=t.svg.line().x(r.scalefns.xf).y(function(){return r.scales.Y(s)}).interpolate(r.interpolate),p="",h=r.data.length-1;h>=0;h--){u=r.data[h];var g=h+1;r.custom_line_color_map.length>0&&(g=r.custom_line_color_map[h]),r.data[h].line_id=g,r.show_confidence_band&&n.append("path").attr("class","mg-confidence-band").attr("d",a(r.data[h])).attr("clip-path","url(#mg-plot-window-"+T(r.target)+")");var m=e(r.target).find("svg path.mg-area"+g+"-color");r.area&&!r.use_data_y_min&&!r.y_axis_negative&&r.data.length<=1?m.length>0?(e(n.node()).find(".mg-y-axis").after(m.detach()),t.select(m.get(0)).transition().duration(o).attr("d",l(r.data[h])).attr("clip-path","url(#mg-plot-window)")):n.append("path").attr("class","mg-main-area mg-area"+g+"-color").attr("d",l(r.data[h])).attr("clip-path","url(#mg-plot-window-"+T(r.target)+")"):m.length>0&&m.remove();var _=e(r.target).find("svg path.mg-main-line.mg-line"+g+"-color").first();_.length>0?(e(n.node()).find(".mg-y-axis").after(_.detach()),t.select(_.get(0)).transition().duration(o).attr("d",d(r.data[h]))):r.animate_on_load?(s=t.median(r.data[h],i),n.append("path").attr("class","mg-main-line mg-line"+g+"-color").attr("d",f(r.data[h])).transition().duration(1e3).attr("d",d(r.data[h])).attr("clip-path","url(#mg-plot-window-"+T(r.target)+")")):n.append("path").attr("class","mg-main-line mg-line"+g+"-color").attr("d",d(r.data[h])).attr("clip-path","url(#mg-plot-window-"+T(r.target)+")"),r.legend&&(p="— "+r.legend[h]+" "+p)}return r.legend&&e(r.legend_target).html(p),this},this.markers=function(){return x(r),this},this.rollover=function(){var a,n=t.select(e(r.target).find("svg").get(0)),s=e(e(r.target).find("svg").get(0));s.find(".mg-rollover-rect").remove(),s.find(".mg-voronoi").remove(),s.find(".mg-active-datapoint").remove(),s.find(".mg-line-rollover-circle").remove(),n.append("g").attr("class","mg-active-datapoint-container").attr("transform","translate("+(r.width-r.right)+","+r.top/2+")").append("text").attr("class","mg-active-datapoint").classed("mg-active-datapoint-small",r.use_small_class).attr("xml:space","preserve").attr("text-anchor","end"),n.selectAll(".mg-line-rollover-circle").data(r.data).enter().append("circle").attr({"class":function(t){return["mg-line-rollover-circle","mg-line"+t.line_id+"-color","mg-area"+t.line_id+"-color"].join(" ")},cx:0,cy:0,r:0});for(var o=1,i=0;i0?r.custom_line_color_map[i]:o;o++}var c,u;if(r.data.length>1&&!r.aggregate_rollover){var d=t.geom.voronoi().x(function(t){return r.scales.X(t[r.x_accessor]).toFixed(2)}).y(function(t){return r.scales.Y(t[r.y_accessor]).toFixed(2)}).clipExtent([[r.buffer,r.buffer],[r.width-r.buffer,r.height-r.buffer]]);a=n.append("g").attr("class","mg-voronoi"),c=t.nest().key(function(t){return r.scales.X(t[r.x_accessor])+","+r.scales.Y(t[r.y_accessor])}).rollup(function(t){return t[0]}).entries(t.merge(r.data.map(function(t){return t}))).map(function(t){return t.values}),a.selectAll("path").data(d(c)).enter().append("path").attr("d",function(t){return"M"+t.join("L")+"Z"}).datum(function(t){return t.point}).attr("class",function(e){if(r.linked){var a=e[r.x_accessor],n=t.time.format(r.linked_format),s="number"==typeof a?i:n(a);return"mg-line"+e.line_id+"-color roll_"+s}return"mg-line"+e.line_id+"-color"}).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r))}else r.data.length>1&&r.aggregate_rollover?(c=t.nest().key(function(t){return t[r.x_accessor]}).entries(t.merge(r.data)),u=c.map(function(t){return r.scales.X(new Date(t.key))}),a=n.append("g").attr("class","mg-rollover-rect"),a.selectAll(".mg-rollover-rects").data(c).enter().append("rect").attr("x",function(t,e){return 1===u.length?r.left+r.buffer:0===e?u[e].toFixed(2):((u[e-1]+u[e])/2).toFixed(2)}).attr("y",r.top).attr("width",function(t,e){return 1===u.length?r.width-r.right-r.buffer:0===e?((u[e+1]-u[e])/2).toFixed(2):e==u.length-1?((u[e]-u[e-1])/2).toFixed(2):((u[e+1]-u[e-1])/2).toFixed(2)}).attr("height",r.height-r.bottom-r.top-r.buffer).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r))):(o=1,r.custom_line_color_map.length>0&&(o=r.custom_line_color_map[0]),a=n.append("g").attr("class","mg-rollover-rect"),u=r.data[0].map(r.scalefns.xf),a.selectAll(".mg-rollover-rects").data(r.data[0]).enter().append("rect").attr("class",function(e,a){if(r.linked){var n=e[r.x_accessor],s=t.time.format(r.linked_format),i="number"==typeof n?a:s(n);return"mg-line"+o+"-color roll_"+i}return"mg-line"+o+"-color"}).attr("x",function(t,e){return 1===u.length?r.left+r.buffer:0===e?u[e].toFixed(2):((u[e-1]+u[e])/2).toFixed(2)}).attr("y",function(t){return r.data.length>1?r.scalefns.yf(t)-6:r.top}).attr("width",function(t,e){return 1===u.length?r.width-r.right-r.buffer:0===e?((u[e+1]-u[e])/2).toFixed(2):e===u.length-1?((u[e]-u[e-1])/2).toFixed(2):((u[e+1]-u[e-1])/2).toFixed(2)}).attr("height",function(){return r.data.length>1?12:r.height-r.bottom-r.top-r.buffer}).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)));return 1==r.data.length&&1==r.data[0].length&&t.select(".mg-rollover-rect .mg-line1-color").on("mouseover")(r.data[0][0],0),this},this.rolloverOn=function(r){var a,n=t.select(e(r.target).find("svg").get(0));switch(r.processed.x_time_frame){case"seconds":a=t.time.format("%b %e, %Y %H:%M:%S");break;case"less-than-a-day":a=t.time.format("%b %e, %Y %I:%M%p");break;case"four-days":a=t.time.format("%b %e, %Y %I:%M%p");break;default:a=t.time.format("%b %e, %Y")}return function(e,s){if(r.aggregate_rollover&&r.data.length>1)n.selectAll("circle.mg-line-rollover-circle").style("opacity",0),e.values.forEach(function(t){if(t[r.x_accessor]>=r.processed.min_x&&t[r.x_accessor]<=r.processed.max_x&&t[r.y_accessor]>=r.processed.min_y&&t[r.y_accessor]<=r.processed.max_y){n.select("circle.mg-line"+t.line_id+"-color").attr({cx:function(){return r.scales.X(t[r.x_accessor]).toFixed(2)},cy:function(){return r.scales.Y(t[r.y_accessor]).toFixed(2)},r:r.point_size}).style("opacity",1)}});else if(e[r.x_accessor]>=r.processed.min_x&&e[r.x_accessor]<=r.processed.max_x&&e[r.y_accessor]>=r.processed.min_y&&e[r.y_accessor]<=r.processed.max_y&&n.selectAll("circle.mg-line-rollover-circle").attr("class","").attr("class","mg-area"+e.line_id+"-color").classed("mg-line-rollover-circle",!0).attr("cx",function(){return r.scales.X(e[r.x_accessor]).toFixed(2)}).attr("cy",function(){return r.scales.Y(e[r.y_accessor]).toFixed(2)}).attr("r",r.point_size).style("opacity",1),r.linked&&!MG.globals.link){MG.globals.link=!0;var o=e[r.x_accessor],i=t.time.format(r.linked_format),l="number"==typeof o?s:i(o);t.selectAll(".mg-line"+e.line_id+"-color.roll_"+l).each(function(e,r){t.select(this).on("mouseover")(e,r)})}n.selectAll("text").filter(function(t){return e===t}).attr("opacity",.3);var c;if(c="count"===r.format?function(e){var a=e%1!==0,n=t.format("0,000");return e=a?t.round(e,r.decimals):e,n(e)}:function(e){var a=(r.decimals?"."+r.decimals:"")+"%",n=t.format(a);return n(e)},r.show_rollover_text){var u=n.select(".mg-active-datapoint"),d=0,f=1.1;if(u.select("*").remove(),r.aggregate_rollover&&r.data.length>1){if(r.time_series){var p=new Date(e.key);u.append("tspan").text((a(p)+" "+r.yax_units).trim()),d=1,e.values.forEach(function(t){var e=u.append("tspan").attr({x:0,y:d*f+"em"}).text(c(t[r.y_accessor]));u.append("tspan").attr({x:-e.node().getComputedTextLength(),y:d*f+"em"}).text("— ").classed("mg-hover-line"+t.line_id+"-color",!0).style("font-weight","bold"),d++}),u.append("tspan").attr("x",0).attr("y",d*f+"em").text(" ")}else e.values.forEach(function(t){var e=u.append("tspan").attr({x:0,y:d*f+"em"}).text(r.x_accessor+": "+t[r.x_accessor]+", "+r.y_accessor+": "+r.yax_units+c(t[r.y_accessor]));u.append("tspan").attr({x:-e.node().getComputedTextLength(),y:d*f+"em"}).text("— ").classed("mg-hover-line"+t.line_id+"-color",!0).style("font-weight","bold"),d++});u.append("tspan").attr("x",0).attr("y",d*f+"em").text(" ")}else if(r.time_series){var h=new Date(+e[r.x_accessor]);h.setDate(h.getDate()),u.append("tspan").text(a(h)+" "+r.yax_units+c(e[r.y_accessor]))}else u.append("tspan").text(r.x_accessor+": "+e[r.x_accessor]+", "+r.y_accessor+": "+r.yax_units+c(e[r.y_accessor]))}r.mouseover&&r.mouseover(e,s)}},this.rolloverOff=function(r){var a=t.select(e(r.target).find("svg").get(0));return function(e,n){if(r.linked&&MG.globals.link){MG.globals.link=!1;var s=e[r.x_accessor],o=t.time.format(r.linked_format),i="number"==typeof s?n:o(s);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})}a.selectAll("circle.mg-line-rollover-circle").style("opacity",function(){return 1==r.data.length&&1==r.data[0].length?1:0}),a.select(".mg-active-datapoint").text(""),r.mouseout&&r.mouseout(e,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return y(this.args),this},this.init(r),this},G.histogram=function(r){return this.args=r,this.init=function(t){return w(t),A(t),v(t),i(t),n(t),this},this.mainPlot=function(){var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-histogram").remove();var s=a.append("g").attr("class","mg-histogram"),o=s.selectAll(".mg-bar").data(r.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+r.scales.X(t[r.x_accessor]).toFixed(2)+","+r.scales.Y(t[r.y_accessor]).toFixed(2)+")"});return o.append("rect").attr("x",1).attr("width",function(){return 1===r.data[0].length?(r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2):(r.scalefns.xf(r.data[0][1])-r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2)}).attr("height",function(t){return 0===t[r.y_accessor]?0:(r.height-r.bottom-r.buffer-r.scales.Y(t[r.y_accessor])).toFixed(2)}),this},this.markers=function(){return x(r),this},this.rollover=function(){var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-rollover-rect").remove(),n.find(".mg-active-datapoint").remove(),a.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",r.width-r.right).attr("y",r.top/2).attr("text-anchor","end");var s=a.append("g").attr("class","mg-rollover-rect"),o=s.selectAll(".mg-bar").data(r.data[0]).enter().append("g").attr("class",function(t,e){return r.linked?"mg-rollover-rects roll_"+e:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+r.scales.X(t[r.x_accessor])+",0)"});return o.append("rect").attr("x",1).attr("y",0).attr("width",function(t,e){return 1===r.data[0].length?(r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2):e!==r.data[0].length-1?(r.scalefns.xf(r.data[0][e+1])-r.scalefns.xf(t)).toFixed(2):(r.scalefns.xf(r.data[0][1])-r.scalefns.xf(r.data[0][0])).toFixed(2)}).attr("height",function(){return r.height}).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)),this},this.rolloverOn=function(r){{var a=t.select(e(r.target).find("svg").get(0));t.time.format("%Y-%m-%d")}return function(n,s){a.selectAll("text").filter(function(t){return n===t}).attr("opacity",.3);var o,i=t.time.format("%b %e, %Y");o="count"===r.format?function(e){var a=e%1!==0,n=t.format("0,000");return e=a?t.round(e,r.decimals):e,n(e)}:function(e){var a=(r.decimals?"."+r.decimals:"")+"%",n=t.format(a);return n(e)},t.selectAll(e(r.target).find(" svg .mg-bar :eq("+s+")")).classed("active",!0),r.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+s+" rect").each(function(e){t.select(this).on("mouseover")(e,s)})),r.show_rollover_text&&a.select(".mg-active-datapoint").text(function(){if(r.time_series){var t=new Date(+n[r.x_accessor]);return t.setDate(t.getDate()),i(t)+" "+r.yax_units+o(n[r.y_accessor])}return r.x_accessor+": "+o(n[r.x_accessor])+", "+r.y_accessor+": "+r.yax_units+o(n[r.y_accessor])}),r.mouseover&&r.mouseover(n,s)}},this.rolloverOff=function(r){var a=t.select(e(r.target).find("svg").get(0));return function(n,s){r.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+s+" rect").each(function(e){t.select(this).on("mouseout")(e,s)})),t.selectAll(e(r.target).find("svg .mg-bar :eq("+s+")")).classed("active",!1),a.select(".mg-active-datapoint").text(""),r.mouseout&&r.mouseout(n,s)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return y(this.args),this},this.init(r),this},G.point=function(r){return this.args=r,this.init=function(t){return w(t),M(t),v(t),i(t),n(t),this},this.markers=function(){return x(r),r.least_squares&&O(r),this},this.mainPlot=function(){var a,n=t.select(e(r.target).find("svg").get(0)),s=e(e(r.target).find("svg").get(0));s.find(".mg-points").remove(),a=n.append("g").classed("mg-points",!0);var o=a.selectAll("circle").data(r.data[0]).enter().append("svg:circle").attr("class",function(t,e){return"path-"+e}).attr("cx",r.scalefns.xf).attr("cy",r.scalefns.yf);return null!==r.color_accessor?(o.attr("fill",r.scalefns.color),o.attr("stroke",r.scalefns.color)):o.classed("mg-points-mono",!0),null!==r.size_accessor?o.attr("r",r.scalefns.size):o.attr("r",r.point_size),this},this.rollover=function(){var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-voronoi").remove(),n.find(".mg-active-datapoint").remove(),a.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",r.width-r.right).attr("y",r.top/2).attr("text-anchor","end");var s=t.geom.voronoi().x(r.scalefns.xf).y(r.scalefns.yf).clipExtent([[r.buffer,r.buffer],[r.width-r.buffer,r.height-r.buffer]]),o=a.append("g").attr("class","mg-voronoi");return o.selectAll("path").data(s(r.data[0])).enter().append("path").attr("d",function(t){return void 0!==t?"M"+t.join(",")+"Z":void 0}).attr("class",function(t,e){return"path-"+e}).style("fill-opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)),this},this.rolloverOn=function(r){var a=t.select(e(r.target).find("svg").get(0));return function(e,n){a.selectAll(".mg-points circle").classed("selected",!1);var s=a.selectAll(".mg-points circle.path-"+n).classed("selected",!0);r.size_accessor?s.attr("r",function(t){return r.scalefns.size(t)+1}):s.attr("r",r.point_size),r.linked&&!globals.link&&(globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(e,n)}));var o,i=t.time.format("%b %e, %Y");o="count"===r.format?function(e){var a=e%1!==0,n=t.format("0,000");return e=a?t.round(e,r.decimals):e,n(e)}:function(e){var a=(r.decimals?"."+r.decimals:"")+"%",n=t.format(a);return n(e)},r.show_rollover_text&&a.select(".mg-active-datapoint").text(function(){if(r.time_series){var t=new Date(+e.point[r.x_accessor]);return t.setDate(t.getDate()),i(t)+" "+r.yax_units+o(e.point[r.y_accessor])}return r.x_accessor+": "+o(e.point[r.x_accessor])+", "+r.y_accessor+": "+r.yax_units+o(e.point[r.y_accessor])}),r.mouseover&&r.mouseover(e,n)}},this.rolloverOff=function(r){var a=t.select(e(r.target).find("svg").get(0));return function(e,n){r.linked&&globals.link&&(globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(e,n)}));var s=a.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);r.size_accessor?s.attr("r",r.scalefns.size):s.attr("r",r.point_size),a.select(".mg-active-datapoint").text(""),r.mouseout&&r.mouseout(e,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.update=function(){return this},this.windowListeners=function(){return y(this.args),this},this.init(r),this},G.bar=function(r){return this.args=r,this.is_vertical=!0,this.init=function(t){return w(t),D(t),v(t),this.is_vertical="vertical"===t.bar_orientation,this.is_vertical?(l(t),n(t)):(i(t),s(t)),this},this.mainPlot=function(){var a,n,s,o,i,l=t.select(r.target).select("svg"),c=r.data[0],u=l.select(".mg-barplot"),d=u.empty(),f=d&&r.animate_on_load,p=f||r.transition_on_update,h=r.transition_duration||1e3;d?(u=l.append("g").classed("mg-barplot",!0),a=u.selectAll(".mg-bar").data(c).enter().append("rect").classed("mg-bar",!0),r.predictor_accessor&&(n=u.selectAll(".mg-bar-prediction").data(c).enter().append("rect").classed("mg-bar-prediction",!0)),r.baseline_accessor&&(i=u.selectAll(".mg-bar-baseline").data(c).enter().append("line").classed("mg-bar-baseline",!0))):(u=l.select("g.mg-barplot"),e(l.node()).find(".mg-y-axis").after(e(u.node()).detach()),a=u.selectAll("rect.mg-bar"),r.predictor_accessor&&(n=u.selectAll(".mg-bar-prediction")),r.baseline_accessor&&(i=u.selectAll(".mg-bar-baseline")));var g;return this.is_vertical?(g=r.scales.X.rangeBand()/1.5,f&&a.attr("height",0).attr("y",r.scales.Y(0)),p&&(a=a.transition().duration(h)),a.attr("y",function(t){return r.scales.Y(0)-(r.scales.Y(0)-r.scalefns.yf(t))}).attr("x",function(t){return r.scalefns.xf(t)+g/2}).attr("width",g).attr("height",function(t){return 0-(r.scalefns.yf(t)-r.scales.Y(0))}),r.predictor_accessor&&(s=r.predictor_proportion,o=s-1,f&&n.attr("height",0).attr("y",r.scales.Y(0)),p&&(n=n.transition().duration(h)),n.attr("y",function(t){return r.scales.Y(0)-(r.scales.Y(0)-r.scales.Y(t[r.predictor_accessor]))}).attr("x",function(t){return r.scalefns.xf(t)+o*g/(2*s)+g/2}).attr("width",g/s).attr("height",function(t){return 0-(r.scales.Y(t[r.predictor_accessor])-r.scales.Y(0))})),r.baseline_accessor&&(s=r.predictor_proportion,f&&i.attr({y1:r.scales.Y(0),y2:r.scales.Y(0)}),p&&(i=i.transition().duration(h)),i.attr("x1",function(t){return r.scalefns.xf(t)+g/2-g/s+g/2}).attr("x2",function(t){return r.scalefns.xf(t)+g/2+g/s+g/2}).attr("y1",function(t){return r.scales.Y(t[r.baseline_accessor])}).attr("y2",function(t){return r.scales.Y(t[r.baseline_accessor])}))):(g=r.scales.Y.rangeBand()/1.5,f&&a.attr("width",0),p&&(a=a.transition().duration(h)),a.attr("x",r.scales.X(0)).attr("y",function(t){return r.scalefns.yf(t)+g/2}).attr("height",g).attr("width",function(t){return r.scalefns.xf(t)-r.scales.X(0)}),r.predictor_accessor&&(s=r.predictor_proportion,o=s-1,f&&n.attr("width",0),p&&(n=n.transition().duration(h)),n.attr("x",r.scales.X(0)).attr("y",function(t){return r.scalefns.yf(t)+o*g/(2*s)+g/2}).attr("height",g/s).attr("width",function(t){return r.scales.X(t[r.predictor_accessor])-r.scales.X(0)})),r.baseline_accessor&&(s=r.predictor_proportion,f&&i.attr({x1:r.scales.X(0),x2:r.scales.X(0)}),p&&(i=i.transition().duration(h)),i.attr("x1",function(t){return r.scales.X(t[r.baseline_accessor])}).attr("x2",function(t){return r.scales.X(t[r.baseline_accessor])}).attr("y1",function(t){return r.scalefns.yf(t)+g/2-g/s+g/2}).attr("y2",function(t){return r.scalefns.yf(t)+g/2+g/s+g/2}))),this},this.markers=function(){return x(r),this},this.rollover=function(){var a,n=t.select(e(r.target).find("svg").get(0)),s=e(e(r.target).find("svg").get(0));s.find(".mg-rollover-rect").remove(),s.find(".mg-active-datapoint").remove(),n.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",r.width-r.right).attr("y",r.top/2).attr("dy",".35em").attr("text-anchor","end"),a=n.append("g").attr("class","mg-rollover-rect");var o=a.selectAll(".mg-bar-rollover").data(r.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return this.is_vertical?o.attr("x",r.scalefns.xf).attr("y",function(){return r.scales.Y(0)-r.height}).attr("width",r.scales.X.rangeBand()).attr("height",r.height).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)):o.attr("x",r.scales.X(0)).attr("y",r.scalefns.yf).attr("width",r.width).attr("height",r.scales.Y.rangeBand()+2).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)),this},this.rolloverOn=function(r){var a=t.select(e(r.target).find("svg").get(0)),n=this.is_vertical?r.x_accessor:r.y_accessor,s=this.is_vertical?r.y_accessor:r.x_accessor,o=this.is_vertical?r.yax_units:r.xax_units;return function(i,l){a.selectAll("text").filter(function(t){return i===t}).attr("opacity",.3);var c,u=t.time.format("%b %e, %Y");c="count"===r.format?function(e){var a=e%1!==0,n=t.format("0,000");return e=a?t.round(e,r.decimals):e,n(e)}:function(e){var a=(r.decimals?"."+r.decimals:"")+"%",n=t.format(a);return n(e)},t.selectAll(e(r.target+" svg g.mg-barplot .mg-bar:eq("+l+")")).classed("active",!0),r.show_rollover_text&&a.select(".mg-active-datapoint").text(function(){if(r.time_series){var t=new Date(+i[s]);return t.setDate(t.getDate()),u(t)+" "+o+c(i[n])}return i[n]+": "+c(i[s])}),r.mouseover&&r.mouseover(i,l)}},this.rolloverOff=function(r){var a=t.select(e(r.target).find("svg").get(0));return function(n,s){t.selectAll(e(r.target).find("svg g.mg-barplot .mg-bar:eq("+s+")")).classed("active",!1),a.select(".mg-active-datapoint").text(""),r.mouseout&&r.mouseout(n,s)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return y(this.args),this},this.init(r),this},MG.data_table=function(a){return this.args=a,this.args.standard_col={width:150,font_size:12,font_weight:"normal"},this.args.columns=[],this.formatting_options=[["color","color"],["font-weight","font_weight"],["font-style","font_style"],["font-size","font_size"]],this._strip_punctuation=function(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r},this._format_element=function(t,e,r){this.formatting_options.forEach(function(a){var n=a[0],s=a[1];r[s]&&t.style(n,"string"==typeof r[s]||"number"==typeof r[s]?r[s]:r[s](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=P(MG.clone(t),MG.clone(r));a.type=e,this.args.columns.push(a)},this.target=function(){var t=arguments[0];return this.args.target=t,this},this.title=function(){return this._add_column(arguments[0],"title"),this},this.text=function(){return this._add_column(arguments[0],"text"),this},this.bullet=function(){return this},this.sparkline=function(){return this},this.number=function(){return this._add_column(arguments[0],"number"),this},this.display=function(){var a=this.args;r(a);var n,s,o,i,l,c,u,d,f,p,h,g,m=a.target,_=t.select(m).append("table").classed("mg-data-table",!0),v=_.append("colgroup"),x=_.append("thead"),y=_.append("tbody");for(o=x.append("tr"),g=0;g=o;o++)s.push({x:o,y:Math.random()-.03*o});a.scales.X=t.scale.linear().domain([0,s.length]).range([a.left+a.buffer,a.width-a.right-a.buffer]),a.scales.Y=t.scale.linear().domain([-2,2]).range([a.height-a.bottom-a.buffer,a.top]),a.scalefns.xf=function(t){return a.scales.X(t.x)},a.scalefns.yf=function(t){return a.scales.Y(t.y)};var i=t.svg.line().x(a.scalefns.xf).y(a.scalefns.yf).interpolate(a.interpolate),l=t.svg.area().x(a.scalefns.xf).y0(a.scales.Y.range()[0]).y1(a.scalefns.yf).interpolate(a.interpolate),c=n.append("g").attr("class","mg-missing-pane");c.append("path").attr("class","mg-main-line mg-line1-color").attr("d",i(s)),c.append("path").attr("class","mg-main-area mg-area1-color").attr("d",l(s))}return n.selectAll(".mg-missing-text").data([a.missing_text]).enter().append("text").attr("class","mg-missing-text").attr("x",a.width/2).attr("y",a.height/2).attr("dy",".50em").attr("text-anchor","middle").text(a.missing_text),this},this.init(a),this},MG.convert={},MG.convert.date=function(e,r,a){return a="undefined"==typeof a?"%Y-%m-%d":a,e=e.map(function(e){var n=t.time.format(a);return e[r]=n.parse(e[r]),e})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})};var S=function(t,e,r){if(null===t)return t;if(Array.prototype.forEach&&t.forEach===Array.prototype.forEach)t.forEach(e,r);else if(t.length===+t.length){for(var a=0,n=t.length;n>a;a++)if(e.call(r,t[a],a,t)===breaker)return}else for(var s in t)if(e.call(r,t[s],s,t)===breaker)return;return t};return MG.clone=function(t){var e;if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(t instanceof Array){e=[];for(var r=0,a=t.length;a>r;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=MG.clone(t[n]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG})}).call(this);
\ No newline at end of file
+var A,D=n.format;"percentage"===D&&(A=t.format("%p")),"count"===D&&(A=t.format("0,000")),"temperature"===D&&(A=function(t){return t+"º"}),f=A(f)}n.hasOwnProperty("currency")&&(f=n.currency+f)}p=o.append("td").classed("table-"+c,!0).classed("table-"+c+"-"+this._strip_punctuation(l),!0).attr("data-value",u).style("width",n.width).style("text-align","title"===c||"text"===c?"left":"right"),this._format_element(p,u,n),"title"===c?(s=p.append("div").text(f),this._format_element(s,f,n),a.columns[k].hasOwnProperty("secondary_accessor")&&p.append("div").text(a.data[w][a.columns[k].secondary_accessor]).classed("secondary-title",!0)):p.text(f)}}return this},this},G.missing=function(a){return this.args=a,this.init=function(a){r(a),t.select(a.target).selectAll("svg").data([a]).enter().append("svg").attr("width",a.width).attr("height",a.height);var n=t.select(a.target).select("svg");if(a.width!==Number(n.attr("width"))&&n.attr("width",a.width),a.height!==Number(n.attr("height"))&&n.attr("height",a.height),t.select(a.target).selectAll("svg *").remove(),n.classed("mg-missing",!0),a.legend_target&&e(a.legend_target).html(""),a.show_missing_background){for(var s=[],o=1;50>=o;o++)s.push({x:o,y:Math.random()-.03*o});a.scales.X=t.scale.linear().domain([0,s.length]).range([a.left+a.buffer,a.width-a.right-a.buffer]),a.scales.Y=t.scale.linear().domain([-2,2]).range([a.height-a.bottom-2*a.buffer,a.top]),a.scalefns.xf=function(t){return a.scales.X(t.x)},a.scalefns.yf=function(t){return a.scales.Y(t.y)};var i=t.svg.line().x(a.scalefns.xf).y(a.scalefns.yf).interpolate(a.interpolate),l=t.svg.area().x(a.scalefns.xf).y0(a.scales.Y.range()[0]).y1(a.scalefns.yf).interpolate(a.interpolate),c=n.append("g").attr("class","mg-missing-pane");c.append("svg:rect").classed("mg-missing-background",!0).attr("x",a.buffer).attr("y",a.buffer).attr("width",a.width-2*a.buffer).attr("height",a.height-2*a.buffer),c.append("path").attr("class","mg-main-line mg-line1-color").attr("d",i(s)),c.append("path").attr("class","mg-main-area mg-area1-color").attr("d",l(s))}return n.selectAll(".mg-missing-text").data([a.missing_text]).enter().append("text").attr("class","mg-missing-text").attr("x",a.width/2).attr("y",a.height/2).attr("dy",".50em").attr("text-anchor","middle").text(a.missing_text),this},this.init(a),this},MG.convert={},MG.convert.date=function(e,r,a){return a="undefined"==typeof a?"%Y-%m-%d":a,e=e.map(function(e){var n=t.time.format(a);return e[r]=n.parse(e[r]),e})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})};var S=function(t,e,r){if(null===t)return t;if(Array.prototype.forEach&&t.forEach===Array.prototype.forEach)t.forEach(e,r);else if(t.length===+t.length){for(var a=0,n=t.length;n>a;a++)if(e.call(r,t[a],a,t)===breaker)return}else for(var s in t)if(e.call(r,t[s],s,t)===breaker)return;return t};return MG.clone=function(t){var e;if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(t instanceof Array){e=[];for(var r=0,a=t.length;a>r;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=MG.clone(t[n]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG})}).call(this);
\ No newline at end of file
diff --git a/src/js/charts/missing.js b/src/js/charts/missing.js
index 348ab2ef..c7b9a817 100644
--- a/src/js/charts/missing.js
+++ b/src/js/charts/missing.js
@@ -12,7 +12,7 @@ charts.missing = function(args) {
.attr('height', args.height);
var svg = d3.select(args.target).select('svg');
-
+
// has the width or height changed?
if (args.width !== Number(svg.attr('width'))) {
svg.attr('width', args.width);
@@ -46,7 +46,7 @@ charts.missing = function(args) {
args.scales.Y = d3.scale.linear()
.domain([-2, 2])
- .range([args.height - args.bottom - args.buffer, args.top]);
+ .range([args.height - args.bottom - args.buffer*2, args.top]);
args.scalefns.xf = function(di) { return args.scales.X(di.x); };
args.scalefns.yf = function(di) { return args.scales.Y(di.y); };
@@ -64,6 +64,13 @@ charts.missing = function(args) {
var g = svg.append('g')
.attr('class', 'mg-missing-pane');
+
+ g.append('svg:rect')
+ .classed('mg-missing-background', true)
+ .attr('x', args.buffer)
+ .attr('y', args.buffer)
+ .attr('width', args.width-args.buffer*2)
+ .attr('height', args.height-args.buffer*2);
g.append('path')
.attr('class', 'mg-main-line mg-line1-color')
diff --git a/src/js/common/data_graphic.js b/src/js/common/data_graphic.js
index 88a9f571..24ea4304 100644
--- a/src/js/common/data_graphic.js
+++ b/src/js/common/data_graphic.js
@@ -123,11 +123,11 @@ MG.data_graphic = function() {
};
defaults.missing = {
- top: 0,
- bottom: 0,
- right: 0,
- left: 0,
- buffer: 8,
+ top: 40, // the size of the top margin
+ bottom: 30, // the size of the bottom margin
+ right: 10, // size of the right margin
+ left: 10, // size of the left margin
+ buffer: 8, // the buffer between the actual chart area and the margins
legend_target: '',
width: 350,
height: 220,