diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js index cba90d9a..f7f52ca9 100644 --- a/dist/metricsgraphics.js +++ b/dist/metricsgraphics.js @@ -7372,11 +7372,6 @@ function process_line(args) { return series.length > 0 && series[0][args.x_accessor] instanceof Date; })) > 0; - // force linear interpolation when missing_is_hidden is enabled - if (args.missing_is_hidden) { - args.interpolate = d3.curveLinear; - } - // are we replacing missing y values with zeros? if ((args.missing_is_zero || args.missing_is_hidden) && args.chart_type === 'line' && is_time_series) { for (var i = 0; i < args.data.length; i++) { diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js index 4784bc73..8078da51 100644 --- a/dist/metricsgraphics.min.js +++ b/dist/metricsgraphics.min.js @@ -1,4 +1,4 @@ !function(t,e){"function"==typeof define&&define.amd?define(["d3"],e):"object"==typeof exports?module.exports=e(require("d3")):t.MG=e(t.d3)}(this,function(t){function e(){return"undefined"!=typeof jQuery||"undefined"!=typeof $}function r(t){var e;switch(t.processed.x_time_frame){case"millis":e=MG.time_format(t.utc_time,"%b %e, %Y %H:%M:%S.%L");break;case"seconds":e=MG.time_format(t.utc_time,"%b %e, %Y %H:%M:%S");break;case"less-than-a-day":e=MG.time_format(t.utc_time,"%b %e, %Y %I:%M%p");break;case"four-days":e=MG.time_format(t.utc_time,"%b %e, %Y %I:%M%p");break;default:e=MG.time_format(t.utc_time,"%b %e, %Y")}return e}function a(t,e){return t[e.x_accessor]>=e.processed.min_x&&t[e.x_accessor]<=e.processed.max_x&&t[e.y_accessor]>=e.processed.min_y&&t[e.y_accessor]<=e.processed.max_y}function n(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(t){return"[object Function]"===Object.prototype.toString.call(t)}function i(t){return n(t)&&0===t.length}function s(t){return"[object Object]"===Object.prototype.toString.call(t)}function c(e){var r=e.map(function(t){return n(t)===!0&&t.length>0});return t.sum(r)===e.length}function l(e){var r=e.map(function(t){return s(t)===!0});return t.sum(r)===e.length}function u(t){return i(t)||l(t)}function f(t,e){return t.map(function(t){return t[e]})}function d(t){return t.reduce(function(t,e){return t[e]=t[e]+1||1,t},{})}function p(t){return t.height-t.bottom}function _(t){return p(t)-t.buffer}function m(t){return t.top}function g(t){return m(t)+t.buffer}function h(t){return t.left}function x(t){return h(t)+t.buffer}function y(t){return t.width-t.right}function v(t){return y(t)-t.buffer}function b(t){t.exit().remove()}function w(t,e){t.selectAll(e).remove()}function k(t,e){return t.append("g").classed(e,!0)}function M(t,e){var r=R(t.target),a=Y(t.data),n=r.selectAll("line."+e).data(a);return n.enter().append("line").attr("class",e).attr("opacity",.3),b(n),b(n),n}function G(t,e,r){e.color_accessor?(t.attr("stroke",e.scalefns.colorf),t.classed(r,!1)):(t.attr("stroke",null),t.classed(r,!0))}function A(e,r){r&&e.attr({dy:0,transform:function(){var e=t.select(this);return"rotate("+r+" "+e.attr("x")+","+e.attr("y")+")"}})}function D(t){if(t=t.node(),!t)return!1;for(var e=0;e=r.top&&(o=r.top-16),n.attr("y",o)}}function F(e,r){if(e&&1!=e.length){e.sort(function(e,r){return t.select(r).attr("y")-t.select(e).attr("y")}),e.reverse();for(var a,n,o,i=0;i=a.top&&a.bottom-r.top}function C(t,e){for(var r=t.getBoundingClientRect(),a=0;ar.right||n.rightr&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function H(e,r,a,n){e.each(function(){for(var e,o=t.select(this),i=o.text().split(a||/\s+/).reverse(),s=[],c=0,l=1.1,u=(o.attr("y"),0),f=o.text(null).append("tspan").attr("x",0).attr("y",u+"em").attr(n||{});e=i.pop();)s.push(e),f.text(s.join(" ")),(null===r||f.node().getComputedTextLength()>r)&&(s.pop(),f.text(s.join(" ")),s=[e],f=o.append("tspan").attr("x",0).attr("y",++c*l+u+"em").attr(n||{}).text(e))})}function q(t,e,r){MG.charts[t]={descriptor:e,defaults:r||{}}}function V(r){"use strict";var a=R(r.target);if(a.select(".mg-header").remove(),r.target&&r.title){var n=a.insert("text").attr("class","mg-header").attr("x",r.center_title_full_width?r.width/2:(r.width+r.left-r.right)/2).attr("y",r.title_y_position).attr("text-anchor","middle").attr("dy","0.55em");if(n.append("tspan").attr("class","mg-chart-title").text(r.title),r.show_tooltips&&r.description&&e()){n.append("tspan").attr("class","mg-chart-description").attr("dx","0.3em").text("");var o=$(n.node());o.popover({html:!0,animation:!1,placement:"top",content:r.description,container:r.target,trigger:"manual",template:'

'}).on("mouseenter",function(){t.selectAll(r.target).selectAll(".mg-popover").remove(),$(this).popover("show"),$(t.select(r.target).select(".popover").node()).on("mouseleave",function(){o.popover("hide")})}).on("mouseleave",function(){setTimeout(function(){$(".popover:hover").length||o.popover("hide")},120)})}else r.show_tooltips&&r.description&&"undefined"==typeof $&&(r.error="In order to enable tooltips, please make sure you include jQuery.")}r.error&&Fr(r)}function W(t,e,r,a,n){t.scalefns[e]=function(e){return void 0===n?t.scales[r](e[a]):t.scales[r](e[a])+n}}function Z(t,e){return"bottom"===t||"top"===t?[x(e),v(e)]:"left"===t||"right"===t?[_(e),e.top]:void 0}function Q(e){var r={};return r.use_inflator=!1,r.zero_bottom=!1,r.scaleType="numerical",this.namespace=function(t){return r.namespace=t,r.namespace_accessor_name=r.namespace+"_accessor",r.scale_name=r.namespace.toUpperCase(),r.scalefn_name=r.namespace+"f",this},this.scaleName=function(t){return r.scale_name=t.toUpperCase(),r.scalefn_name=t+"f",this},this.inflateDomain=function(t){return r.use_inflator=t,this},this.zeroBottom=function(t){return r.zero_bottom=t,this},this.numericalDomainFromData=function(){var a=[];arguments.length>0&&(a=arguments);for(var n,o=0;o0&&(n=e.data[o]);r.is_time_series=n[0][e[r.namespace_accessor_name]]instanceof Date,W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),K(e,r,a,r.use_inflator);var i=e.utc_time?t.scaleUtc():t.scaleTime();return e.scales[r.scale_name]=r.is_time_series?i:"log"===e[r.namespace+"_scale_type"]?t.scaleLog():t.scaleLinear(),e.scales[r.scale_name].domain([e.processed["min_"+r.namespace],e.processed["max_"+r.namespace]]),r.scaleType="numerical",this},this.categoricalDomain=function(a){return e.scales[r.scale_name]=t.scaleOrdinal().domain(a),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.categoricalDomainFromData=function(){var a=Y(e.data);return r.categoricalVariables=t.set(a.map(function(t){return t[e[r.namespace_accessor_name]]})).values(),e.scales[r.scale_name]=t.scaleBand().domain(r.categoricalVariables),r.scaleType="categorical",this},this.numericalRange=function(t){return"string"==typeof t?e.scales[r.scale_name].range(Z(t,e)):e.scales[r.scale_name].range(t),this},this.categoricalRangeBands=function(t,a){void 0===a&&(a=!1);var n=r.namespace,o=e[n+"_padding_percentage"],i=e[n+"_outer_padding_percentage"];return"string"==typeof t?e.scales[r.scale_name].range(Z(t,e)).paddingInner(o).paddingOuter(i):e.scales[r.scale_name].range(t).paddingInner(o).paddingOuter(i),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name],a?e.scales[r.scale_name].bandwidth()/2:0),this},this.categoricalRange=function(t){return e.scales[r.scale_name].range(t),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.categoricalColorRange=function(){return e.scales[r.scale_name]=e.scales[r.scale_name].domain().length>10?t.scaleOrdinal(t.schemeCategory20):t.scaleOrdinal(t.schemeCategory10),e.scales[r.scale_name].domain(r.categoricalVariables),W(e,r.scalefn_name,r.scale_name,e[r.namespace_accessor_name]),this},this.clamp=function(t){return e.scales[r.scale_name].clamp(t),this},this}function K(e,r,a){var n=r.namespace,o=r.namespace_accessor_name,i=r.use_inflator,s=r.zero_bottom,c=e[o],l=Y(e.data).map(function(t){return t[c]}).concat(Y(a));"log"===e[n+"_scale_type"]&&(l=l.filter(function(t){return t>0}));var u=t.extent(l),f=u[0],d=u[1];s&&!e["min_"+n+"_from_data"]&&f>0&&!r.is_time_series&&(f="log"===e[n+"_scale_type"]?1:0),"log"!==e[n+"_scale_type"]&&f<0&&!r.is_time_series&&(f-=(f-f*e.inflator)*i),r.is_time_series||(d=d<0?d+(d-d*e.inflator)*i:d*(i?e.inflator:1)),f=e["min_"+n]||f,d=e["max_"+n]||d,f!==d||e["min_"+n]&&e["max_"+n]||(f instanceof Date?(d=new Date(MG.clone(f).setDate(f.getDate()+1)),f=new Date(MG.clone(f).setDate(f.getDate()-1))):"number"==typeof f&&(f-=1,d=f+1,ue(e))),e.processed["min_"+n]=f,e.processed["max_"+n]=d,MG.call_hook("x_axis.process_min_max",e,e.processed.min_x,e.processed.max_x),MG.call_hook("y_axis.process_min_max",e,e.processed.min_y,e.processed.max_y)}function J(e,r){return t.set(e.map(function(t){return t[r]})).values()}function tt(e){var r;return null===e.color_domain?"number"===e.color_type?r=t.extent(e.data[0],function(t){return t[e.color_accessor]}):"category"===e.color_type&&(r=J(e.data[0],e.color_accessor)):r=e.color_domain,r}function et(t){var e;return e=null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function rt(t,e){function r(t){return 1e3===t?3:1e6===t?7:Math.log(t)/Math.LN10}var a=t[e+"_accessor"],n=t.scales[e.toUpperCase()].ticks(t[e+"ax_count"]),o=t.processed["max_"+e];"log"===t[e+"_scale_type"]&&(n=n.filter(function(t){return Math.abs(r(t))%1<1e-6||Math.abs(r(t))%1>1-1e-6}));var i=n.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[a]%1!==0)return s=!1,!1})}),s&&i>o&&"count"===t.format&&(n=n.filter(function(t){return t%1===0})),t.processed[e+"_ticks"]=n}function at(t,e){var r=e.position,a=e.namespace,n={};return"left"===r&&(n.x1=h(t)+1,n.x2=h(t)+t.rug_buffer_size,n.y1=t.scalefns[a+"f"],n.y2=t.scalefns[a+"f"]),"right"===r&&(n.x1=y(t)-1,n.x2=y(t)-t.rug_buffer_size,n.y1=t.scalefns[a+"f"],n.y2=t.scalefns[a+"f"]),"top"===r&&(n.x1=t.scalefns[a+"f"],n.x2=t.scalefns[a+"f"],n.y1=m(t)+1,n.y2=m(t)+t.rug_buffer_size),"bottom"===r&&(n.x1=t.scalefns[a+"f"],n.x2=t.scalefns[a+"f"],n.y1=p(t)-1,n.y2=p(t)-t.rug_buffer_size),n}function nt(t,e){var r=e.namespace,a=e.position,n=t.processed[r+"_ticks"].length,o=t.processed[r+"_ticks"],i=t.scales[r.toUpperCase()],s={};return"left"===a&&(s.x1=h(t),s.x2=h(t),s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2)),"right"===a&&(s.x1=y(t),s.x2=y(t),s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2)),"top"===a&&(s.x1=h(t),s.x2=y(t),s.y1=m(t),s.y2=m(t)),"bottom"===a&&(s.x1=h(t),s.x2=y(t),s.y1=p(t),s.y2=p(t)),"left"!==a&&"right"!==a||(t.axes_not_compact?(s.y1=p(t),s.y2=m(t)):n&&(s.y1=i(o[0]).toFixed(2),s.y2=i(o[n-1]).toFixed(2))),s}function ot(t,e){var r=e.position,a=e.namespace,n=t[a+"ax_tick_length"],o=t.scales[a.toUpperCase()],i={};return"left"===r&&(i.x=h(t)-3*n/2,i.y=function(t){return o(t).toFixed(2)},i.dx=-3,i.dy=".35em",i.textAnchor="end",i.text=function(e){return wt(t)(e)}),"right"===r&&(i.x=y(t)+3*n/2,i.y=function(t){return o(t).toFixed(2)},i.dx=3,i.dy=".35em",i.textAnchor="start",i.text=function(e){return wt(t)(e)}),"top"===r&&(i.x=function(t){return o(t).toFixed(2)},i.y=(m(t)-7*n/3).toFixed(2),i.dx=0,i.dy="0em",i.textAnchor="middle",i.text=function(e){return Jt(t)(e)}),"bottom"===r&&(i.x=function(t){return o(t).toFixed(2)},i.y=(p(t)+7*n/3).toFixed(2),i.dx=0,i.dy=".50em",i.textAnchor="middle",i.text=function(e){return Jt(t)(e)}),i}function it(t){var e=t.chart_type;t.processed.xax_format||(t.xax_format?t.processed.xax_format=t.xax_format:"line"===e||"point"===e||"histogram"===e?t.processed.xax_format=Jt(t):"bar"===e&&(t.processed.xax_format=Ut(t)))}function st(t,e,r){if(e.time_series&&(e.show_years||e.show_secondary_x_label)){var a=ie(e);ct(e,r,t,a.timeframe,a.yformat,a.secondary)}}function ct(t,e,r,a,n,o){var i=o(t.processed.min_x,t.processed.max_x);if(0===i.length){var s=t.scales.X.ticks(t.xax_count)[0];i=[s]}var c=k(r,"mg-year-marker");"default"===a&&t.show_year_markers&<(t,e,c,i,n),"years"!=a&&ut(t,e,c,i,n)}function lt(t,e,r,a,n){r.selectAll(".mg-year-marker").data(a).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",m(t)).attr("y2",p(t))}function ut(e,r,a,n,o){var i,s,c,l,u,f=r.position,d=r.namespace,_=e.scales[d.toUpperCase()],g=t.select(e.target).select(".mg-x-axis text").node().getBoundingClientRect();"top"===f&&(i=function(t,e){return _(t).toFixed(2)},s=m(e)-7*e.xax_tick_length/3-g.height,c=".50em",l="middle",u=function(t){return o(new Date(t))}),"bottom"===f&&(i=function(t,e){return _(t).toFixed(2)},s=p(e)+7*e.xax_tick_length/3+.8*g.height,c=".50em",l="middle",u=function(t){return o(new Date(t))}),a.selectAll(".mg-year-marker").data(n).enter().append("text").attr("x",i).attr("y",s).attr("dy",c).attr("text-anchor",l).text(u)}function ft(e,r,a){var n=a.namespace,o=ot(r,a),i=r.processed[n+"_ticks"],s=e.selectAll(".mg-yax-labels").data(i).enter().append("text").attr("x",o.x).attr("dx",o.dx).attr("y",o.y).attr("dy",o.dy).attr("text-anchor",o.textAnchor).text(o.text);if("x"==n&&(it(r),r.time_series&&r.european_clock?(s.append("tspan").classed("mg-european-hours",!0).text(function(e,r){var a=new Date(e);return 0===r?t.timeFormat("%H")(a):""}),s.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,e){var a=new Date(t);return":"+r.processed.xax_format(a)})):s.text(function(t){return r.xax_units+r.processed.xax_format(t)}),st(e,r,a)),D(s)){s.filter(function(t,e){return(e+1)%2===0}).remove();var c=R(r.target);c.selectAll(".mg-"+n+"ax-ticks").filter(function(t,e){return(e+1)%2===0}).remove()}}function dt(t,e,r){var a,n,o,i,s=r.namespace,c=r.position,l=e.scales[s.toUpperCase()],u=e.processed[s+"_ticks"],f="mg-"+s+"ax-ticks",d="mg-extended-"+s+"ax-ticks",_=e[s+"_extended_ticks"],g=e[s+"ax_tick_length"];"left"===c&&(a=h(e),n=_?y(e):h(e)-g,o=function(t){return l(t).toFixed(2)},i=function(t){return l(t).toFixed(2)}),"right"===c&&(a=y(e),n=_?h(e):y(e)+g,o=function(t){return l(t).toFixed(2)},i=function(t){return l(t).toFixed(2)}),"top"===c&&(a=function(t){return l(t).toFixed(2)},n=function(t){return l(t).toFixed(2)},o=m(e),i=_?p(e):m(e)-g),"bottom"===c&&(a=function(t){return l(t).toFixed(2)},n=function(t){return l(t).toFixed(2)},o=p(e),i=_?m(e):p(e)+g),t.selectAll("."+f).data(u).enter().append("line").classed(d,_).attr("x1",a).attr("x2",n).attr("y1",o).attr("y2",i)}function pt(t,e,r){var a=r.namespace,n=e.processed[a+"_ticks"].length,o=nt(e,r);e[a+"_extended_ticks"]||e[a+"_extended_ticks"]||!n||t.append("line").attr("x1",o.x1).attr("x2",o.x2).attr("y1",o.y1).attr("y2",o.y2)}function _t(t,e){var r=R(t.target),a=Y(t.data),n=r.selectAll("line."+e).data(a);return n.enter().append("svg:line").attr("class",e).attr("opacity",.3),b(n),b(n),n}function mt(t,e){"use strict";t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var r=_t(t,"mg-"+e.namespace+"-rug"),a=at(t,e);r.attr("x1",a.x1).attr("x2",a.x2).attr("y1",a.y1).attr("y2",a.y2),G(r,t,"mg-"+e.namespace+"-rug-mono")}function gt(t,e,r){var a=e.namespace,n=e.position,o=t.scales[a.toUpperCase()],i=t.scales[(a+"group").toUpperCase()],s={};return s.cat={},s.group={},"left"===n&&(s.cat.x=x(t)-t.buffer,s.cat.y=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.dy=".35em",s.cat.textAnchor="end",s.group.x=x(t)-t.buffer,s.group.y=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.dy=".35em",s.group.textAnchor=(t["rotate_"+a+"_labels"],"end")),"right"===n&&(s.cat.x=v(t)-t.buffer,s.cat.y=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.dy=".35em",s.cat.textAnchor="start",s.group.x=v(t)-t.buffer,s.group.y=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.dy=".35em",s.group.textAnchor="start"),"top"===n&&(s.cat.x=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.y=g(t)+t.buffer,s.cat.dy=".35em",s.cat.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle",s.group.x=i(r)+(i.bandwidth?i.bandwidth()/2:0),s.group.y=g(t)+t.buffer,s.group.dy=".35em",s.group.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle"),"bottom"===n&&(s.cat.x=function(t){return i(r)+o(t)+o.bandwidth()/2},s.cat.y=_(t)+t.buffer,s.cat.dy=".35em",s.cat.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle",s.group.x=i(r)+(i.bandwidth?i.bandwidth()/2-o.bandwidth()/2:0),s.group.y=_(t)+t.buffer,s.group.dy=".35em",s.group.textAnchor=t["rotate_"+a+"_labels"]?"start":"middle"),s}function ht(t,e){var r=e.namespace,a="mg-"+r+"-axis",n=t.scales[r.toUpperCase()],o=t.scales[(r+"group").toUpperCase()],i=r+"group_accessor",s=R(t.target);w(s,"."+a);var c,l=k(s,a),u=o.domain&&o.domain()?o.domain():["1"];u.forEach(function(a){var o=gt(t,e,a);if(c=k(l,"mg-group-"+L(a)),null!==t[i])var s=c.append("text").classed("mg-barplot-group-label",!0).attr("x",o.group.x).attr("y",o.group.y).attr("dy",o.group.dy).attr("text-anchor",o.group.textAnchor).text(a);else var s=c.selectAll("text").data(n.domain()).enter().append("text").attr("x",o.cat.x).attr("y",o.cat.y).attr("dy",o.cat.dy).attr("text-anchor",o.cat.textAnchor).text(String);t["rotate_"+r+"_labels"]&&yt(s,t["rotate_"+r+"_labels"])})}function xt(t,e){var r,a,n,o,i=e.namespace,s=(t.scalefns[i+"f"],t.scalefns[i+"groupf"],t.scales[(i+"group").toUpperCase()]),c=t.scales[i.toUpperCase()],l=e.position,u=R(t.target),f=s.domain&&s.domain()?s.domain():[null];w(u,".mg-category-guides");var d=k(u,"mg-category-guides");f.forEach(function(e){c.domain().forEach(function(i){"left"!==l&&"right"!==l||(r=x(t),a=v(t),n=c(i)+s(e)+c.bandwidth()/2,o=c(i)+s(e)+c.bandwidth()/2),"top"!==l&&"bottom"!==l||(r=c(i)+s(e)+c.bandwidth()/2*(null===e),a=c(i)+s(e)+c.bandwidth()/2*(null===e),n=_(t),o=g(t)),d.append("line").attr("x1",r).attr("x2",a).attr("y1",n).attr("y2",o).attr("stroke-dasharray","2,1")});var i=s(e)+c(c.domain()[0])+c.bandwidth()/2*(null===e||"top"!==l&&"bottom"!=l),u=s(e)+c(c.domain()[c.domain().length-1])+c.bandwidth()/2*(null===e||"top"!==l&&"bottom"!=l);"left"!==l&&"right"!==l||(x11=x(t),x21=x(t),y11=i,y21=u,x12=v(t),x22=v(t),y12=i,y22=u),"bottom"!==l&&"top"!==l||(x11=i,x21=u,y11=_(t),y21=_(t),x12=i,x22=u,y12=g(t),y22=g(t)),d.append("line").attr("x1",x11).attr("x2",x21).attr("y1",y11).attr("y2",y21).attr("stroke-dasharray","2,1"),d.append("line").attr("x1",x12).attr("x2",x22).attr("y1",y12).attr("y2",y22).attr("stroke-dasharray","2,1")})}function yt(e,r){r&&e.attr("transform",function(){var e=t.select(this);return"rotate("+r+" "+e.attr("x")+","+e.attr("y")+")"})}function vt(t){var e={};return e.type="numerical",this.namespace=function(t){return e.namespace=t,this},this.rug=function(t){return e.rug=t,this},this.label=function(t){return e.label=t,this},this.type=function(t){return e.type=t,this},this.position=function(t){return e.position=t,this},this.zeroLine=function(t){return e.zeroLine=t,this},this.draw=function(){return Tr[e.type](t,e),this},this}function bt(t){"use strict";if(t.y_rug){t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var e=M(t,"mg-y-rug");e.attr("x1",t.left+1).attr("x2",t.left+t.rug_buffer_size).attr("y1",t.scalefns.yf).attr("y2",t.scalefns.yf),G(e,t,"mg-y-rug-mono")}}function wt(e){var r=e.yax_format;return r||("count"===e.format?(e.processed.max_y<1e-4?e.decimals=6:e.processed.max_y<.1&&(e.decimals=4),r=function(r){var a;return a=r<1&&r>-1&&0!==r?t.format(",."+e.decimals+"f"):r<1e3?t.format(",.0f"):t.format(",.0s"),e.yax_units_append?a(r)+e.yax_units:e.yax_units+a(r)}):r=function(e){var r=t.format(".0%");return r(e)}),r}function kt(t){var e=R(t.target),r=t.scales.X.domain();if(0>=r[0]&&r[1]>=0){var a=t.scales.Y.range(),n=t.categorical_groups.length?t.scales.YGROUP(t.categorical_groups[t.categorical_groups.length-1]):t.scales.YGROUP();e.append("svg:line").attr("x1",t.scales.X(0)).attr("x2",t.scales.X(0)).attr("y1",a[0]+g(t)).attr("y2",a[a.length-1]+n).attr("stroke","black").attr("opacity",.2)}}function Mt(t,e){e.y_label&&t.append("text").attr("class","label").attr("x",function(){return-1*(g(e)+(_(e)-g(e))/2)}).attr("y",function(){return e.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(t){return e.y_label}).attr("transform",function(t){return"rotate(-90)"})}function Gt(t,e){var r=e.processed.y_ticks.length;if(!e.x_extended_ticks&&!e.y_extended_ticks&&r){var a,n;e.axes_not_compact&&"bar"!==e.chart_type?(a=e.height-e.bottom,n=e.top):r?(a=e.scales.Y(e.processed.y_ticks[0]).toFixed(2),n=e.scales.Y(e.processed.y_ticks[r-1]).toFixed(2)):(a=0,n=0),t.append("line").attr("x1",e.left).attr("x2",e.left).attr("y1",a).attr("y2",n)}}function At(t,e){t.selectAll(".mg-yax-ticks").data(e.processed.y_ticks).enter().append("line").classed("mg-extended-yax-ticks",e.y_extended_ticks).attr("x1",e.left).attr("x2",function(){return e.y_extended_ticks?e.width-e.right:e.left-e.yax_tick_length}).attr("y1",function(t){return e.scales.Y(t).toFixed(2)}).attr("y2",function(t){return e.scales.Y(t).toFixed(2)})}function Dt(t,e){var r=wt(e);t.selectAll(".mg-yax-labels").data(e.processed.y_ticks).enter().append("text").attr("x",e.left-3*e.yax_tick_length/2).attr("dx",-3).attr("y",function(t){return e.scales.Y(t).toFixed(2)}).attr("dy",".35em").attr("text-anchor","end").text(function(t){var e=r(t);return e})}function Ot(t){t.processed||(t.processed={});var e=R(t.target);if(MG.call_hook("y_axis.process_min_max",t,t.processed.min_y,t.processed.max_y),w(e,".mg-y-axis"),!t.y_axis)return this;var r=k(e,"mg-y-axis");return Mt(r,t),rr(t,"y"),Gt(r,t),At(r,t),Dt(r,t),t.y_rug&&bt(t),this}function Ft(t){var e=R(t.target);w(e,".mg-y-axis");var r,a=k(e,"mg-y-axis");(t.categorical_groups.length?t.categorical_groups:["1"]).forEach(function(e){if(r=k(a,"mg-group-"+L(e)),null!==t.ygroup_accessor)Ct(r,e,t);else{var n=zt(r,e,t);A(n,t.rotate_y_labels)}})}function zt(t,e,r){return t.selectAll("text").data(r.scales.Y.domain()).enter().append("svg:text").attr("x",r.left-r.buffer).attr("y",function(t){return r.scales.YGROUP(e)+r.scales.Y(t)+r.scales.Y.bandwidth()/2}).attr("dy",".35em").attr("text-anchor","end").text(String)}function Ct(t,e,r){t.append("svg:text").classed("mg-barplot-group-label",!0).attr("x",r.left-r.buffer).attr("y",r.scales.YGROUP(e)+r.scales.YGROUP.bandwidth()/2).attr("dy",".35em").attr("text-anchor","end").text(e)}function Tt(t){var e=R(t.target),r=t.scales.YGROUP.domain();r[0],r[r.length-1];e.select(".mg-category-guides").selectAll("mg-group-lines").data(r).enter().append("line").attr("x1",x(t)).attr("x2",x(t)).attr("y1",function(e){return t.scales.YGROUP(e)}).attr("y2",function(e){return t.scales.YGROUP(e)+t.ygroup_height}).attr("stroke-width",1)}function Rt(t){var e=R(t.target),r=[];t.data[0].forEach(function(a){r.indexOf(a[t.y_accessor])===-1&&e.select(".mg-category-guides").append("line").attr("x1",x(t)).attr("x2",v(t)).attr("y1",t.scalefns.yf(a)+t.scalefns.ygroupf(a)).attr("y2",t.scalefns.yf(a)+t.scalefns.ygroupf(a)).attr("stroke-dasharray","2,1")})}function Yt(t){return t.y_axis?(Ft(t),t.show_bar_zero&&kt(t),t.ygroup_accessor&&Tt(t),t.y_categorical_show_guides&&Rt(t),this):this}function $t(t){"use strict";if(t.x_rug){t.rug_buffer_size="point"===t.chart_type?t.buffer/2:t.buffer;var e=M(t,"mg-x-rug");e.attr("x1",t.scalefns.xf).attr("x2",t.scalefns.xf).attr("y1",t.height-t.bottom-t.rug_buffer_size).attr("y2",t.height-t.bottom),G(e,t,"mg-x-rug-mono")}}function Et(t){t.processed||(t.processed={})}function Pt(t){"use strict";var e=R(t.target);if(Et(t),fe(t),w(e,".mg-x-axis"),!t.x_axis)return this;var r=k(e,"mg-x-axis");return te(r,t),ae(r,t),t.x_label&&jt(r,t),t.x_rug&&$t(t),this}function Lt(t){var e=R(t.target),r=0;"bar"===t.chart_type&&(r=t.buffer+5),mg_add_categorical_scale(t,"X",t.categorical_variables.reverse(),t.left,v(t)-r),W(t,"xf","X","value"),w(e,".mg-x-axis");var a=k(e,"mg-x-axis");return t.x_axis?(Xt(a,t,r),this):this}function Xt(t,e,r){var a=t.selectAll("text").data(e.categorical_variables).enter().append("text");a.attr("x",function(t){return e.scales.X(t)+e.scales.X.bandwidth()/2+e.buffer*e.bar_outer_padding_percentage+r/2}).attr("y",_(e)).attr("dy",".35em").attr("text-anchor","middle").text(String),e.truncate_x_labels&&a.each(function(t,r){var a=this,n=e.scales.X.bandwidth();I(a,t,n)}),A(a,e.rotate_x_labels)}function tt(e){var r;return null===e.color_domain?"number"===e.color_type?r=t.extent(e.data[0],function(t){return t[e.color_accessor]}):"category"===e.color_type&&(r=t.set(e.data[0].map(function(t){return t[e.color_accessor]})).values(),r.sort()):r=e.color_domain,r}function et(t){var e;return e=null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function St(t){var e;return e=null===t.size_range?[1,5]:t.size_range}function jt(e,r){r.x_label&&e.append("text").attr("class","label").attr("x",function(){return x(r)+(v(r)-x(r))/2}).attr("dx",null!=r.x_label_nudge_x?r.x_label_nudge_x:0).attr("y",function(){var e=t.select(r.target).select(".mg-x-axis text").node().getBoundingClientRect();return p(r)+r.xax_tick_length*(7/3)+.8*e.height+10}).attr("dy",".5em").attr("text-anchor","middle").text(function(t){return r.x_label})}function Ut(e){return function(r){if(r<1&&r>-1&&0!==r)return e.xax_units+r.toFixed(e.decimals);var a=t.format(",.0f");return e.xax_units+a(r)}}function Bt(t){var e;return e=Nt(t)?"millis":It(t)?"seconds":Ht(t)?"less-than-a-day":qt(t)?"four-days":Vt(t)?"many-days":Wt(t)?"many-months":Zt(t)?"years":"default"}function Nt(t){return t<10}function It(t){return t<60}function Ht(t){return t/3600<=24}function qt(t){return t/3600<=96}function Vt(t){return t/86400<=93}function Wt(t){return t/86400<730}function Zt(t){return t/86400>=730}function Qt(t,e){var r;return r=Nt(e)?MG.time_format(t,"%M:%S.%L"):It(e)?MG.time_format(t,"%M:%S"):Ht(e)?MG.time_format(t,"%H:%M"):qt(e)?MG.time_format(t,"%H:%M"):Vt(e)?MG.time_format(t,"%b %d"):Wt(e)?MG.time_format(t,"%b"):MG.time_format(t,"%Y")}function Kt(t){var e,r,a;t.time_series&&(e=(t.processed.max_x-t.processed.min_x)/1e3,a=Bt(e),r=Qt(t.utc_time,e)),t.processed.main_x_time_format=r,t.processed.x_time_frame=a}function Jt(e){if(e.xax_format)return e.xax_format;var r=e.processed.original_data||e.data,a=Y(r)[0],n=a[e.processed.original_x_accessor||e.x_accessor];return void 0===n&&(n=a),function(r){if(Kt(e),n instanceof Date)return e.processed.main_x_time_format(new Date(r));if("number"==typeof n){var a,o=r%1!==0;return a=o?t.format(",."+e.decimals+"f"):r<1e3?t.format(",.0f"):t.format(",.0s"),e.xax_units+a(r)}return e.xax_units+r}}function te(t,e){rr(e,"x"),ee(e,t),re(e,t)}function ee(t,e){var r=(t.processed.x_ticks.length,t.scales.X.ticks(t.xax_count).length-1);t.x_extended_ticks||e.append("line").attr("x1",function(){return 0===t.xax_count?x(t):t.axes_not_compact&&"bar"!==t.chart_type?t.left:t.scales.X(t.scales.X.ticks(t.xax_count)[0]).toFixed(2)}).attr("x2",function(){return 0===t.xax_count||t.axes_not_compact&&"bar"!==t.chart_type?y(t):t.scales.X(t.scales.X.ticks(t.xax_count)[r]).toFixed(2)}).attr("y1",t.height-t.bottom).attr("y2",t.height-t.bottom)}function re(t,e){e.selectAll(".mg-xax-ticks").data(t.processed.x_ticks).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",t.height-t.bottom).attr("y2",function(){return t.x_extended_ticks?t.top:t.height-t.bottom+t.xax_tick_length}).attr("class",function(){if(t.x_extended_ticks)return"mg-extended-xax-ticks"}).classed("mg-xax-ticks",!0)}function ae(t,e){ne(e,t),oe(e,t)}function ne(e,r){var a=r.selectAll(".mg-xax-labels").data(e.processed.x_ticks).enter().append("text").attr("x",function(t){return e.scales.X(t).toFixed(2)}).attr("y",(e.height-e.bottom+7*e.xax_tick_length/3).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle");if(e.time_series&&e.european_clock?(a.append("tspan").classed("mg-european-hours",!0).text(function(e,r){var a=new Date(e);return 0===r?t.timeFormat("%H")(a):""}),a.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,r){var a=new Date(t);return":"+e.processed.xax_format(a)})):a.text(function(t){return e.xax_units+e.processed.xax_format(t)}),D(a)){a.filter(function(t,e){return(e+1)%2===0}).remove();var n=R(e.target);n.selectAll(".mg-xax-ticks").filter(function(t,e){return(e+1)%2===0}).remove()}}function oe(t,e){if(t.time_series&&(t.show_years||t.show_secondary_x_label)){var r=ie(t);se(t,e,r.timeframe,r.yformat,r.secondary)}}function ie(e){var r={};switch(r.timeframe=e.processed.x_time_frame,r.timeframe){case"millis":case"seconds":r.secondary=t.timeDays,e.european_clock?r.yformat=MG.time_format(e.utc_time,"%b %d"):r.yformat=MG.time_format(e.utc_time,"%I %p");break;case"less-than-a-day":r.secondary=t.timeDays,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"four-days":r.secondary=t.timeDays,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"many-days":r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y");break;case"many-months":r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y");break;default:r.secondary=t.timeYears,r.yformat=MG.time_format(e.utc_time,"%Y")}return r}function se(t,e,r,a,n){var o=n(t.processed.min_x,t.processed.max_x);if(0===o.length){var i=t.scales.X.ticks(t.xax_count)[0];o=[i]}var s=k(e,"mg-year-marker");"default"===r&&t.show_year_markers&&ce(t,s,o,a),"years"!=r&&le(t,s,o,a)}function ce(t,e,r,a){e.selectAll(".mg-year-marker").data(r).enter().append("line").attr("x1",function(e){return t.scales.X(e).toFixed(2)}).attr("x2",function(e){return t.scales.X(e).toFixed(2)}).attr("y1",m(t)).attr("y2",p(t))}function le(e,r,a,n){r.selectAll(".mg-year-marker").data(a).enter().append("text").attr("x",function(t,r){return e.scales.X(t).toFixed(2)}).attr("y",function(){var r=t.select(e.target).select(".mg-x-axis text").node().getBoundingClientRect();return p(e)+7*e.xax_tick_length/3+.8*r.height}).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return n(new Date(t))})}function ue(t){t.xax_count=2}function fe(t){var e=t.chart_type;t.processed.xax_format||(t.xax_format?t.processed.xax_format=t.xax_format:"line"===e||"point"===e||"histogram"===e?t.processed.xax_format=Jt(t):"bar"===e&&(t.processed.xax_format=Ut(t)))}function de(t){var e={target:null,title:null,description:null};return t||(t={}),t.processed||(t.processed={}),t=U(t,e)}function pe(t){var e=Y(t.processed.original_data||t.data)[0];t.time_series=e[t.processed.original_x_accessor||t.x_accessor]instanceof Date}function _e(t){var e=t.width;t.full_width&&(e=S(t.target)),"categorical"===t.x_axis_type&&null===e&&(e=Fe(t,"x")),t.width=e}function me(t){var e=t.height;t.full_height&&(e=j(t.target)),"categorical"===t.y_axis_type&&null===e&&(e=Fe(t,"y")),t.height=e}function ge(t,e){(!t.selectAll(".mg-main-line").empty()&&"line"!==e.chart_type||!t.selectAll(".mg-points").empty()&&"point"!==e.chart_type||!t.selectAll(".mg-histogram").empty()&&"histogram"!==e.chart_type||!t.selectAll(".mg-barplot").empty()&&"bar"!==e.chart_type)&&t.remove()}function he(e,r){return R(r.target).empty()&&(e=t.select(r.target).append("svg").classed("linked",r.linked).attr("width",r.width).attr("height",r.height)),e}function xe(t,e){t.selectAll(".mg-clip-path").remove(), -t.append("defs").attr("class","mg-clip-path").append("clipPath").attr("id","mg-plot-window-"+P(e.target)).append("svg:rect").attr("x",h(e)).attr("y",m(e)).attr("width",e.width-e.left-e.right-e.buffer).attr("height",e.height-e.top-e.bottom-e.buffer+1)}function ye(t,e){e.width!==Number(t.attr("width"))&&t.attr("width",e.width),e.height!==Number(t.attr("height"))&&t.attr("height",e.height)}function ve(t,e){t.attr("viewBox","0 0 "+e.width+" "+e.height),(e.full_width||e.full_height)&&t.attr("preserveAspectRatio","xMinYMin meet")}function be(t){t.classed("mg-missing",!1),t.selectAll(".mg-missing-text").remove(),t.selectAll(".mg-missing-pane").remove()}function we(t,e){var r=0;if(t.selectAll(".mg-main-line").nodes().length>=e.data.length)if(e.custom_line_color_map.length>0){var a=function(t){for(var e=new Array(t),r=0;ro;r--)t.selectAll(".mg-main-line.mg-line"+r+"-color").remove()}}function ke(t,e){if(t.empty())return void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.')}function Me(t,e){var r="x"===e?t.width:t.height;Ge(t,e),Ae(t,e),De(t,e,r),r&&Oe(t,e)}function Ge(e,r){var a=r+"group_accessor",n=e[a];if(e.categorical_groups=[],n){var o=e.data[0];e.categorical_groups=t.set(o.map(function(t){return t[n]})).values()}}function Ae(e,r){var a=r+"group_accessor",n=e[a];if(e.total_bars=e.data[0].length,n){var o=d(f(e.data[0],n));o=t.max(Object.keys(o).map(function(t){return o[t]})),e.bars_per_group=o}else e.bars_per_group=e.data[0].length}function De(t,e,r){var a=e+"group_height";if(r){var n="y"===e?(t.height-t.top-t.bottom-2*t.buffer)/(t.categorical_groups.length||1):(t.width-t.left-t.right-2*t.buffer)/(t.categorical_groups.length||1);t[a]=n}else{var o=(1+t[e+"_padding_percentage"])*t.bar_thickness;t[a]=t.bars_per_group*o+2*t[e+"_outer_padding_percentage"]*o}}function Oe(t,e){var r=t[e+"group_height"]/(t.bars_per_group+t[e+"_outer_padding_percentage"]);t.bar_thickness=r-r*t[e+"_padding_percentage"]}function Fe(t,e){var r=t[e+"group_height"]*(t.categorical_groups.length||1),a="y"===e?t.top+t.bottom+2*t.buffer:t.left+t.right+2*t.buffer;return r+a+t.categorical_groups.length*t[e+"group_height"]*(t[e+"group_padding_percentage"]+t[e+"group_outer_padding_percentage"])}function ze(e){"use strict";e=arguments[0],e=de(e);var r=t.select(e.target);ke(r,e);var a=r.selectAll("svg");return"categorical"===e.y_axis_type&&Me(e,"y"),"categorical"===e.x_axis_type&&Me(e,"x"),pe(e),_e(e),me(e),ge(a,e),a=he(a,e),xe(a,e),ye(a,e),ve(a,e),be(a),V(e),we(a,e),this}function Ce(t){return t.label}function Te(t){t.selectAll(".mg-markers").remove(),t.selectAll(".mg-baselines").remove()}function Re(t){return function(e){return t.scales.X(e[t.x_accessor])>x(t)&&t.scales.X(e[t.x_accessor])1-1e-6}));var i=n.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[a]%1!==0)return s=!1,!1})}),s&&i>o&&"count"===t.format&&(n=n.filter(function(t){return t%1===0})),"x"===e?t.processed.x_ticks=n:"y"===e&&(t.processed.y_ticks=n)}function ar(t){"use strict";if(t.data=MG.clone(t.data),t.single_object=!1,t.array_of_objects=!1,t.array_of_arrays=!1,t.nested_array_of_arrays=!1,t.nested_array_of_objects=!1,c(t.data)?(t.nested_array_of_objects=t.data.map(function(t){return u(t)}),t.nested_array_of_arrays=t.data.map(function(t){return c(t)})):(t.array_of_objects=l(t.data),t.array_of_arrays=c(t.data)),"line"===t.chart_type?(t.array_of_objects||t.array_of_arrays)&&(t.data=[t.data]):t.data[0]instanceof Array||(t.data=[t.data]),or(t),ir(t),void 0!==t.color&&(t.colors=t.color),null!==t.colors&&"string"==typeof t.colors&&(t.colors=[t.colors]),"line"===t.chart_type&&t.x_sort===!0)for(var e=0;e0&&t[0][e.x_accessor]instanceof Date}))>0;if(e.missing_is_hidden&&(e.interpolate=t.curveLinear),(e.missing_is_zero||e.missing_is_hidden)&&"line"===e.chart_type&&a)for(var n=0;n=0&&t<=1?Math.pow(1-Math.pow(t,e),e):0}function hr(t){return gr(t,2)}function xr(t){return gr(t,3)}function yr(e){var r=t.sum(e.map(function(t){return t.w}));return{xbar:t.sum(e.map(function(t){return t.w*t.x}))/r,ybar:t.sum(e.map(function(t){return t.w*t.y}))/r}}function vr(e,r,a){var n=t.sum(e.map(function(t){return Math.pow(t.w,2)*(t.x-r)*(t.y-a)})),o=t.sum(e.map(function(t){return Math.pow(t.w,2)*Math.pow(t.x-r,2)}));return n/o}function br(t){var e,r,a=yr(t);r=a.xbar,e=a.ybar;var n=vr(t,r,e);return{beta:n,xbar:r,ybar:e,x0:e-n*r}}function wr(e,r,a,n,o){var i=Math.floor(e.length*a),s=e.slice();s.sort(function(t,e){return te?1:0});for(var c,l,u,f,d,p=t.quantile(s,.98),_=t.quantile(s,.02),m=t.zip(e,r,o).sort(),g=Math.abs(p-_)/n,h=_,x=p,y=t.range(h,x,g),v=[],b=0;b0;if(n)throw"That function is already registered.";a.push({func:e,context:r})},MG.call_hook=function(t){var e,r=MG._hooks[t],a=[].slice.apply(arguments,[1]);return r&&r.forEach(function(t){if(t.func){var r=e||a;r&&r.constructor!==Array&&(r=[r]),r=[].concat.apply([],r),e=t.func.apply(t.context,r)}}),e||a},MG.globals={},MG.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},x_rollover_format:{replacement:"x_mouseover",version:"2.10"},y_rollover_format:{replacement:"y_mouseover",version:"2.10"},show_years:{replacement:"show_secondary_x_label",version:"2.1"},xax_start_at_min:{replacement:"axes_not_compact",version:"2.7"},interpolate_tension:{replacement:"interpolate",version:"2.10"}},MG.globals.link=!1,MG.globals.version="1.1",MG.charts={},MG.data_graphic=function(e){"use strict";var r={missing_is_zero:!1,missing_is_hidden:!1,missing_is_hidden_accessor:null,legend:"",legend_target:"",error:"",animate_on_load:!1,top:65,title_y_position:10,center_title_full_width:!1,bottom:45,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,xax_count:6,xax_tick_length:5,axes_not_compact:!0,yax_count:3,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_sort:!0,x_axis:!0,y_axis:!0,x_axis_position:"bottom",y_axis_position:"left",x_axis_type:null,y_axis_type:null,ygroup_accessor:null,xgroup_accessor:null,y_padding_percentage:.05,y_outer_padding_percentage:.1,ygroup_padding_percentage:.25,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.1,xgroup_padding_percentage:.25,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!1,x_categorical_show_guide:!1,rotate_x_labels:0,rotate_y_labels:0,y_accessor:"value",y_label:"",yax_units:"",yax_units_append:!1,x_rug:!1,y_rug:!1,mouseover_align:"right",x_mouseover:null,y_mouseover:null,transition_on_update:!0,mouseover:null,click: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:{},utc_time:!1,european_clock:!1,show_year_markers:!1,show_secondary_x_label:!0,target:"#viz",interpolate:t.curveCatmullRom.alpha(0),custom_line_color_map:[],colors:null,max_data_size:null,aggregate_rollover:!1,show_tooltips:!0};MG.call_hook("global.defaults",r),e||(e={});var a=MG.charts[e.chart_type||r.chart_type];U(e,a.defaults,r),e.list&&(e.x_accessor=0,e.y_accessor=1);for(var n in MG.deprecations)if(e.hasOwnProperty(n)){var o=MG.deprecations[n],i="Use of `args."+n+"` has been deprecated",s=o.replacement;if(s&&(e[s]?i+=". The replacement - `args."+s+"` - has already been defined. This definition will be discarded.":e[s]=e[n]),o.warned)continue;o.warned=!0,s&&(i+=" in favor of `args."+s+"`"),N(i,o.version)}return MG.call_hook("global.before_init",e),new a.descriptor(e),e.data},e()&&(+function(t){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.tooltip",n=new r(this,o)),"string"==typeof e&&n[e]())})}var r=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};r.VERSION="3.3.5",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){if(this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var n=this.options.trigger.split(" "),o=n.length;o--;){var i=n[o];if("click"==i)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=i){var s="hover"==i?"mouseenter":"focusin",c="hover"==i?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(c+"."+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=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusin"==e.type?"focus":"hover"]=!0),r.tip().hasClass("in")||"in"==r.hoverState?void(r.hoverState="in"):(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.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusout"==e.type?"focus":"hover"]=!1),!r.isInStateTrue())return 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,o=this.tip(),i=this.getUID(this.type);this.setContent(),o.attr("id",i),this.$element.attr("aria-describedby",i),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,c=/\s?auto?\s?/i,l=c.test(s);l&&(s=s.replace(c,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),f=o[0].offsetWidth,d=o[0].offsetHeight;if(l){var p=s,_=this.getPosition(this.$viewport);s="bottom"==s&&u.bottom+d>_.bottom?"top":"top"==s&&u.top-d<_.top?"bottom":"right"==s&&u.right+f>_.width?"left":"left"==s&&u.left-f<_.left?"right":s,o.removeClass(p).addClass(s)}var m=this.getCalculatedOffset(s,u,f,d);this.applyPlacement(m,s);var g=function(){var t=n.hoverState;n.$element.trigger("shown.bs."+n.type),n.hoverState=null,"out"==t&&n.leave(n)};t.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",g).emulateTransitionEnd(r.TRANSITION_DURATION):g()}},r.prototype.applyPlacement=function(e,r){var a=this.tip(),n=a[0].offsetWidth,o=a[0].offsetHeight,i=parseInt(a.css("margin-top"),10),s=parseInt(a.css("margin-left"),10);isNaN(i)&&(i=0),isNaN(s)&&(s=0),e.top+=i,e.left+=s,t.offset.setOffset(a[0],t.extend({using:function(t){a.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),a.addClass("in");var c=a[0].offsetWidth,l=a[0].offsetHeight;"top"==r&&l!=o&&(e.top=e.top+o-l);var u=this.getViewportAdjustedDelta(r,e,c,l);u.left?e.left+=u.left:e.top+=u.top;var f=/top|bottom/.test(r),d=f?2*u.left-n+c:2*u.top-o+l,p=f?"offsetWidth":"offsetHeight";a.offset(e),this.replaceArrow(d,a[0][p],f)},r.prototype.replaceArrow=function(t,e,r){this.arrow().css(r?"left":"top",50*(1-t/e)+"%").css(r?"top":"left","")},r.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},r.prototype.hide=function(e){function a(){"in"!=n.hoverState&&o.detach(),n.$element.removeAttr("aria-describedby").trigger("hidden.bs."+n.type),e&&e()}var n=this,o=t(this.$tip),i=t.Event("hide.bs."+this.type);if(this.$element.trigger(i),!i.isDefaultPrevented())return o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",a).emulateTransitionEnd(r.TRANSITION_DURATION):a(),this.hoverState=null,this},r.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},r.prototype.hasContent=function(){return this.getTitle()},r.prototype.getPosition=function(e){e=e||this.$element;var r=e[0],a="BODY"==r.tagName,n=r.getBoundingClientRect();null==n.width&&(n=t.extend({},n,{width:n.right-n.left,height:n.bottom-n.top}));var o=a?{top:0,left:0}:e.offset(),i={scroll:a?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},s=a?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},n,i,s,o)},r.prototype.getCalculatedOffset=function(t,e,r,a){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-r/2}:"top"==t?{top:e.top-a,left:e.left+e.width/2-r/2}:"left"==t?{top:e.top+e.height/2-a/2,left:e.left-r}:{top:e.top+e.height/2-a/2,left:e.left+e.width}},r.prototype.getViewportAdjustedDelta=function(t,e,r,a){var n={top:0,left:0};if(!this.$viewport)return n;var o=this.options.viewport&&this.options.viewport.padding||0,i=this.getPosition(this.$viewport);if(/right|left/.test(t)){var s=e.top-o-i.scroll,c=e.top+o-i.scroll+a;si.top+i.height&&(n.top=i.top+i.height-c)}else{var l=e.left-o,u=e.left+o+r;li.right&&(n.left=i.left+i.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(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},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))),e?(r.inState.click=!r.inState.click,r.isInStateTrue()?r.enter(r):r.leave(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),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null})};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){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.popover"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.popover",n=new r(this,o)),"string"==typeof e&&n[e]())})}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.5",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")};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)),MG.chart_title=V,MG.scale_factory=Q;var Tr={};Tr.categorical=function(t,e){e.namespace;ht(t,e),xt(t,e)},Tr.numerical=function(t,e){var r=e.namespace,a=r+"_axis",n="mg-"+r+"-axis",o=R(t.target);if(w(o,"."+n),!t[a])return this;var i=k(o,n);return rt(t,r),pt(i,t,e),dt(i,t,e),ft(i,t,e),t[r+"_label"]&&e.label(o.select(".mg-"+r+"-axis"),t),t[r+"_rug"]&&mt(t,e),t.show_bar_zero&&kt(t),this},MG.axis_factory=vt,MG.y_rug=bt,MG.y_axis=Ot,MG.y_axis_categorical=Yt,MG.x_rug=$t,MG.x_axis=Pt,MG.x_axis_categorical=Lt,MG.init=ze,MG.markers=Ne;var Rr=new Qe;e()&&+function(t){"use strict";function e(e){e&&3===e.which||(t(n).remove(),t(o).each(function(){var a=t(this),n=r(a),o={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",o)))}))}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 i(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",o='[data-toggle="dropdown"]',i=function(e){t(e).on("click.bs.dropdown",this.toggle)};i.VERSION="3.3.1",i.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),i=o.hasClass("open");if(e(),!i){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('");var u=function(){var t,e=$(this).data("key"),r=$(this).data("feature");return $("."+r+"-btns button.btn span.title").html(e),i.hasOwnProperty(r)?(t=i[r],o[t](e)):n(r,e),!1};for(var f in this.feature_set){for(r=this.feature_set[f],$(this.target+" div.segments").append('
"),s=0;s'+r[s]+"");$("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",u)}return this},this},function(){"use strict";function e(t,e,r){t.classed("mg-hover-line"+e.line_id+"-color",null===r.colors).attr("fill",null===r.colors?"":r.colors[e.line_id-1])}function i(t,e,r){u(t,e),c(t,e),l(t,e),s(t,e,r)}function s(e,r,a){r.existing_band=a.selectAll(".mg-confidence-band").nodes(),e.show_confidence_band&&(r.confidence_area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(function(t){var r=e.show_confidence_band[0];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).y1(function(t){var r=e.show_confidence_band[1];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).curve(e.interpolate))}function c(e,r){r.area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).curve(e.interpolate)}function l(e,r){r.flat_line=t.line().defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}).x(e.scalefns.xf).y(function(){return e.scales.Y(r.data_median)}).curve(e.interpolate)}function u(e,r){r.line=t.line().x(e.scalefns.xf).y(e.scalefns.yf).curve(e.interpolate),e.missing_is_zero||(r.line=r.line.defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}))}function f(t,e,r,a){if(t.show_confidence_band){var n;r.select(".mg-confidence-band-"+a).empty()&&r.append("path").attr("class","mg-confidence-band mg-confidence-band-"+a),n=r.select(".mg-confidence-band-"+a),n.transition().duration(function(){return t.transition_on_update?1e3:0}).attr("d",e.confidence_area(t.data[a-1])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")}}function d(t,e,r,a,n){var o=r.selectAll(".mg-main-area.mg-area"+n);e.display_area?o.empty()?r.append("path").classed("mg-main-area",!0).classed("mg-area"+n,!0).classed("mg-area"+n+"-color",null===t.colors).attr("d",e.area(t.data[a])).attr("fill",null===t.colors?"":t.colors[n-1]).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")"):(r.node().appendChild(o.node()),o.transition().duration(e.update_transition_duration).attr("d",e.area(t.data[a])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")):o.empty()||o.remove()}function p(t,e){t.classed("mg-line"+e+"-color",!0)}function _(t,e,r,a){t.colors&&t.colors.constructor===Array?(e.attr("stroke",t.colors[r]),t.colors.length— "+i+"  "+e.legend_text:e.legend_text="— "+i+"  "+e.legend_text;else{var s,c,l;"left"===t.y_axis_position?(s=t.data[r][t.data[r].length-1],c="start",l=t.buffer):(s=t.data[r][0],c="end",l=-t.buffer);var u=e.legend_group.append("svg:text").attr("x",t.scalefns.xf(s)).attr("dx",l).attr("y",t.scalefns.yf(s)).attr("dy",".35em").attr("font-size",10).attr("text-anchor",c).attr("font-weight","300").text(i);t.colors&&t.colors.constructor===Array?t.colors.length0?t.data[r][a].line_id=t.custom_line_color_map[r]:t.data[r][a].line_id=e;e++}}function D(e){return t.merge(e.data)}function O(t){return function(e){var r;if(t.linked){var a=e[t.x_accessor],n=MG.time_format(t.utc_time,t.linked_format),o="number"==typeof a?e.line_id-1:n(a);return r="roll_"+o+" mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}return r="mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}}function z(e,r,a,n,o){var i=t.voronoi().x(function(t){return e.scales.X(t[e.x_accessor]).toFixed(2)}).y(function(t){return e.scales.Y(t[e.y_accessor]).toFixed(2)}).extent([[e.buffer,e.buffer+e.title_y_position],[e.width-e.buffer,e.height-e.buffer]]),s=k(r,"mg-voronoi");s.selectAll("path").data(i.polygons(D(e))).enter().append("path").filter(function(t){return void 0!==t&&t.length>0}).attr("d",function(t){return null==t?null:"M"+t.join("L")+"Z"}).datum(function(t){return null==t?null:t.data}).attr("class",O(e)).on("mouseover",a).on("mouseout",n).on("mousemove",o),$(e,r)}function C(e){var r=t.nest().key(function(t){return t[e.x_accessor]}).entries(t.merge(e.data));return r.forEach(function(t){var r=t.values[0];t.key=r[e.x_accessor]}),e.x_sort?r.sort(function(t,e){return new Date(t.key)-new Date(e.key)}):r}function T(t,e,r,a,n){var o=C(t),i=o.map(function(e){return t.scales.X(e.key)}),s=e.append("g").attr("class","mg-rollover-rect");s.selectAll(".mg-rollover-rects").data(o).enter().append("rect").attr("x",function(e,r){return 1===i.length?x(t):0===r?i[r].toFixed(2):((i[r-1]+i[r])/2).toFixed(2)}).attr("y",t.top).attr("width",function(e,r){return 1===i.length?v(t):0===r?((i[r+1]-i[r])/2).toFixed(2):r===i.length-1?((i[r]-i[r-1])/2).toFixed(2):((i[r+1]-i[r-1])/2).toFixed(2)}).attr("class",function(e){var r=e.values.map(function(e){var r=E(e.line_id);return null===t.colors&&(r+=" "+L(e.line_id)),r}).join(" ");return t.linked&&e.values.length>0&&(r+=" "+X(S(e.values[0],0,t))),r}).attr("height",t.height-t.bottom-t.top-t.buffer).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),U(t,e)}function Y(t,e){e.select(".mg-rollover-rect rect").on("mouseover")(t.data[0][0],0)}function $(t,e){for(var r=0;r0&&void 0!==t.custom_line_color_map[r]&&(a=t.custom_line_color_map[r]),1!==t.data[r].length||e.selectAll(".mg-voronoi .mg-line"+a).empty()||(e.selectAll(".mg-voronoi .mg-line"+a).on("mouseover")(t.data[r][0],0),e.selectAll(".mg-voronoi .mg-line"+a).on("mouseout")(t.data[r][0],0))}}function E(t){return"mg-line"+t}function L(t){return"mg-line"+t+"-color"}function X(t){return"roll_"+t}function S(t,e,r){var a=t[r.x_accessor],n=MG.time_format(r.utc_time,r.linked_format),o="number"==typeof a?e:n(a);return o}function j(t,e,r,a,n){var o=1;t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[0]);var i=e.append("g").attr("class","mg-rollover-rect"),s=t.data[0].map(t.scalefns.xf);i.selectAll(".mg-rollover-rects").data(t.data[0]).enter().append("rect").attr("class",function(e,r){var a=L(o)+" "+E(e.line_id);return t.linked&&(a+=a+" "+X(S(e,r,t))),a}).attr("x",function(e,r){return 1===s.length?x(t):0===r?s[r].toFixed(2):((s[r-1]+s[r])/2).toFixed(2)}).attr("y",function(e,r){return t.data.length>1?t.scalefns.yf(e)-6:t.top}).attr("width",function(e,r){return 1===s.length?v(t):0===r?((s[r+1]-s[r])/2).toFixed(2):r===s.length-1?((s[r]-s[r-1])/2).toFixed(2):((s[r+1]-s[r-1])/2).toFixed(2)}).attr("height",function(e,r){return t.data.length>1?12:t.height-t.bottom-t.top-t.buffer}).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),I(t)&&Y(t,e)}function U(t,e){var r=e.selectAll(".mg-rollover-rect rect");t.data.filter(function(t){return 1===t.length}).length>0&&r.on("mouseover")(r[0][0].__data__,0)}function B(t){return t.data.length>1&&!t.aggregate_rollover}function N(t){return t.data.length>1&&t.aggregate_rollover}function I(t){return 1===t.data.length&&1===t.data[0].length}function H(t,e,r){q(e,r);for(var a=t.data.length-1;a>=0;a--){var n=t.data[a];MG.call_hook("line.before_each_series",[n,t]);var o=a+1;if(t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[a]),t.data[a].line_id=o,0!==n.length){var i=r.select("path.mg-main-line.mg-line"+o);f(t,e,r,o),d(t,e,r,a,o),g(t,e,r,i,a,o),h(t,e,a,o),MG.call_hook("line.after_each_series",[n,i,t])}}}function q(t,e){t.existing_band[0]&&t.existing_band[0].length>e.selectAll(".mg-main-line").node().length&&e.selectAll(".mg-confidence-band").remove()}function V(t){var e={},r=R(t.target);w(r,".mg-line-legend"),b(t,e,r),e.data_median=0,e.update_transition_duration=t.transition_on_update?1e3:0,e.display_area=t.area&&!t.use_data_y_min&&t.data.length<=1&&t.aggregate_rollover===!1,e.legend_text="",i(t,e,r),e.existing_band=r.selectAll(".mg-confidence-band").nodes();var a=MG.call_hook("line.before_all_series",[t]);a!==!1&&H(t,e,r),y(t.legend_target,e.legend_text)}function W(t,e){var r=R(t.target);0===r.selectAll(".mg-active-datapoint-container").nodes().length&&k(r,"mg-active-datapoint-container"),M(r),G(t,r),A(t),B(t)?z(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):N(t)?T(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):j(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t))}function Z(t,e,r){if(t.aggregate_rollover&&t.data.length>1)e.selectAll("circle.mg-line-rollover-circle").style("opacity",0),r.values.forEach(function(r){a(r,t)&&Q(t,e,r)});else{if(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])return;a(r,t)&&K(t,e,r)}}function Q(t,e,r){e.select("circle.mg-line-rollover-circle.mg-line"+r.line_id).attr("cx",t.scales.X(r[t.x_accessor]).toFixed(2)).attr("cy",t.scales.Y(r[t.y_accessor]).toFixed(2)).attr("r",t.point_size).style("opacity",1)}function K(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).classed("mg-line-rollover-circle",!0).attr("cx",function(){return t.scales.X(r[t.x_accessor]).toFixed(2)}).attr("cy",function(){return t.scales.Y(r[t.y_accessor]).toFixed(2)}).attr("r",t.point_size).style("opacity",1)}function J(e,r,a){if(e.linked&&!MG.globals.link&&(MG.globals.link=!0,!e.aggregate_rollover||void 0!==r.value||r.values.length>0)){var n=r.values?r.values[0]:r,o=S(n,a,e);t.selectAll("."+E(n.line_id)+"."+X(o)).each(function(e){t.select(this).on("mouseover")(e,a)})}}function tt(e,r,a){if(e.linked&&MG.globals.link){MG.globals.link=!1;var n=MG.time_format(e.utc_time,e.linked_format),o=r.values?r.values:[r];o.forEach(function(r){var o=r[e.x_accessor],i="number"==typeof o?a:n(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})})}}function et(t,e){e.selectAll("circle.mg-line-rollover-circle").filter(function(t){return t.length>1}).style("opacity",0)}function rt(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).style("opacity",function(){var e=r.line_id-1;return t.custom_line_color_map.length>0&&void 0!==t.custom_line_color_map.indexOf(r.line_id)&&(e=t.custom_line_color_map.indexOf(r.line_id)),1===t.data[e].length?1:0})}function at(t){this.init=function(t){if(this.args=t,!t.data||0===t.data.length)return t.internal_error="No data was supplied",zr(t),this;t.internal_error=void 0,ar(t),sr(t),MG.call_hook("line.before_destroy",this),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left");R(t.target);return t.x_axis&&new MG.axis_factory(t).namespace("x").type("numerical").position(t.x_axis_position).rug($t(t)).label(jt).draw(),t.y_axis&&new MG.axis_factory(t).namespace("y").type("numerical").position(t.y_axis_position).rug(bt(t)).label(Mt).draw(),this.markers(),this.mainPlot(),this.rollover(),this.windowListeners(),MG.call_hook("line.after_init",this),this},this.mainPlot=function(){return V(t),this},this.markers=function(){return Ne(t),this},this.rollover=function(){var e=this;return W(t,e),MG.call_hook("line.after_rollover",t),this},this.rolloverOn=function(t){var a=R(t.target);r(t);return function(r,n){if(Z(t,a,r),J(t,r,n),a.selectAll("text").filter(function(t,e){return r===t}).attr("opacity",.3),t.show_rollover_text&&!(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])){var o=Ze(t,{svg:a}),i=o.mouseover_row();t.aggregate_rollover&&i.text((t.aggregate_rollover&&t.data.length>1?Dr:Gr)(t,r));var s=t.aggregate_rollover&&t.data.length>1?r.values:[r];s.forEach(function(r){t.aggregate_rollover&&(i=o.mouseover_row()),t.legend&&e(i.text(t.legend[r.line_id-1]+" ").bold().elem(),r,t),e(i.text("— ").elem(),r,t),t.aggregate_rollover||i.text(Gr(t,r)),i.text(Ar(t,r,t.time_series===!1))})}t.mouseover&&t.mouseover(r,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){tt(t,r,a),t.aggregate_rollover?et(t,e):rt(t,e,r),t.data[0].length>1&&Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(t)}MG.register("line",at)}.call(this),function(){"use strict";function e(e){this.init=function(t){this.args=t,ar(t),cr(t),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});return new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left"),Pt(t),Ot(t),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t=R(e.target);t.selectAll(".mg-histogram").remove();var r=t.append("g").attr("class","mg-histogram"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor]).toFixed(2)+","+e.scales.Y(t[e.y_accessor]).toFixed(2)+")"});return a.append("rect").attr("x",1).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return 0===t[e.y_accessor]?0:(e.height-e.bottom-e.buffer-e.scales.Y(t[e.y_accessor])).toFixed(2)}),this},this.markers=function(){return Ne(e),this},this.rollover=function(){var t=R(e.target);0===t.selectAll(".mg-active-datapoint-container").nodes().length&&k(t,"mg-active-datapoint-container"),t.selectAll(".mg-rollover-rect").remove(),t.selectAll(".mg-active-datapoint").remove();var r=t.append("g").attr("class","mg-rollover-rect"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class",function(t,r){return e.linked?"mg-rollover-rects roll_"+r:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",e.buffer+e.title_y_position).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return e.height}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll("text").filter(function(t,e){return a===t}).attr("opacity",.3);e.processed.xax_format||MG.time_format(e.utc_time,"%b %e, %Y"),kr(e);if(r.selectAll(".mg-bar rect").filter(function(t,e){return e===n}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseover")(e,n)})),e.show_rollover_text){var o=Ze(e,{svg:r}),i=o.mouseover_row();i.text("▟ ").elem().classed("hist-symbol",!0),i.text(Gr(e,a)),i.text(Ar(e,a,e.time_series===!1))}e.mouseover&&(He(r,e),e.mouseover(a,n))}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseout")(e,n)})),r.selectAll(".mg-bar rect").classed("active",!1),Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(e)}var r={binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1};MG.register("histogram",e,r)}.call(this),function(){"use strict";function e(t,e){var r=e.x_accessor,a=e.y_accessor,n=t.filter(function(t){return(null===e.min_x||t[r]>=e.min_x)&&(null===e.max_x||t[r]<=e.max_x)&&(null===e.min_y||t[a]>=e.min_y)&&(null===e.max_y||t[a]<=e.max_y)});return n}function r(r){this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}if(null!==t.color_accessor){var n=MG.scale_factory(t).namespace("color");"number"===t.color_type?n.numericalDomainFromData(tt(t)).numericalRange(et(t)).clamp(!0):t.color_domain?n.categoricalDomain(t.color_domain).categoricalRange(t.color_range):n.categoricalDomainFromData().categoricalColorRange()}return t.size_accessor&&new MG.scale_factory(t).namespace("size").numericalDomainFromData().numericalRange(St(t)).clamp(!0),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).rug($t(t)).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).rug(bt(t)).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.markers=function(){return Ne(r),r.least_squares&&fr(r),this},this.mainPlot=function(){var t,a=R(r.target),n=e(r.data[0],r);a.selectAll(".mg-points").remove(),t=a.append("g").classed("mg-points",!0);var o=t.selectAll("circle").data(n).enter().append("circle").attr("class",function(t,e){return"path-"+e}).attr("cx",r.scalefns.xoutf).attr("cy",function(t){return r.scalefns.youtf(t)});return null!==r.color_accessor?(o.attr("fill",r.scalefns.colorf),o.attr("stroke",r.scalefns.colorf)):o.classed("mg-points-mono",!0),null!==r.size_accessor?o.attr("r",r.scalefns.sizef):o.attr("r",r.point_size),this},this.rollover=function(){var a=R(r.target);0===a.selectAll(".mg-active-datapoint-container").nodes().length&&k(a,"mg-active-datapoint-container"),a.selectAll(".mg-voronoi").remove();var n=t.voronoi().x(r.scalefns.xoutf).y(r.scalefns.youtf).extent([[r.buffer,r.buffer+r.title_y_position],[r.width-r.buffer,r.height-r.buffer]]),o=a.append("g").attr("class","mg-voronoi");return o.selectAll("path").data(n.polygons(e(r.data[0],r))).enter().append("path").attr("d",function(t){return null==t?null:"M"+t.join(",")+"Z"}).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)),1===r.data[0].length&&tr(r,a,r.data[0][0]),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+n).classed("selected",!0);e.size_accessor?o.attr("r",function(t){return e.scalefns.sizef(t)+e.active_point_size_increase}):o.attr("r",e.point_size+e.active_point_size_increase),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(a,n)})),e.show_rollover_text&&tr(e,r,a.data),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(a,n)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.sizef):o.attr("r",e.point_size),e.data[0].length>1&&Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.update=function(t){return this},this.windowListeners=function(){return Ke(this.args),this},this.init(r)}var a={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!0,x_categorical_show_guides:!0,buffer:16,ls:!1,lowess:!1,point_size:2.5,label_accessor:null,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,active_point_size_increase:1,color_type:"number"};MG.register("point",r,a)}.call(this),function(){"use strict";function e(e){if(e.legend_target){var r=t.select(e.legend_target).append("div").classed("mg-bar-target-legend",!0),a=e.categorical_variables;a.forEach(function(t){var a=r.append("span").classed("mg-bar-target-element",!0);a.append("span").classed("mg-bar-target-legend-shape",!0).style("color",e.scales.colorf(t)).text("◼ "),a.append("span").classed("mg-bar-target-legend-text",!0).text(t)})}}function r(t,e){var r=e.scales.Y.domain(),a=0,n=1.1,o=t.append("g").classed("mg-bar-legend",!0),i=o.append("text");i.selectAll("*").remove(),i.attr("width",e.right).attr("height",100).attr("text-anchor","start"),r.forEach(function(t){var r=i.append("tspan").attr("x",v(e)).attr("y",e.height/2).attr("dy",a*n+"em");r.append("tspan").text("■ ").attr("fill",e.scales.COLOR(t)).attr("font-size",20),r.append("tspan").text(t).attr("font-weight",300).attr("font-size",10),a++})}function a(a){this.args=a,this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),"categorical"==t.x_axis_type?t.orientation="vertical":"categorical"==t.y_axis_type?t.orientation="horizontal":"categorical"!=t.x_axis_type&&"categorical"!=t.y_axis_type&&(t.orientation="vertical"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}return null!==t.ygroup_accessor&&(t.ycolor_accessor=t.y_accessor,MG.scale_factory(t).namespace("ycolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),null!==t.xgroup_accessor&&(t.xcolor_accessor=t.x_accessor,MG.scale_factory(t).namespace("xcolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t,n=R(a.target),o=a.data[0],i=n.select("g.mg-barplot"),s=i.empty(),c=s&&a.animate_on_load;c||a.transition_on_update,a.transition_duration||1e3;s&&(i=n.append("g").classed("mg-barplot",!0)),t=i.selectAll(".mg-bar").data(o).enter().append("rect").classed("mg-bar",!0).classed("default-bar",!a.scales.hasOwnProperty("COLOR"));var l,u,f,d,p,_,m,g,h,x,y,v,b,w;return"vertical"==a.orientation&&(l="height",u="width",f=a.y_axis_type,d=a.x_axis_type,p="y",_="x",m="categorical"==f?a.scalefns.youtf:a.scalefns.yf,g="categorical"==d?a.scalefns.xoutf:a.scalefns.xf,h=a.scales.Y,x=a.scales.X,y=a.y_accessor,v=a.x_accessor,b=function(t){var e;return e=m(t),t[y]<0&&(e=h(0)),e},w=function(t){return Math.abs(m(t)-h(0))}),"horizontal"==a.orientation&&(l="width",u="height",f=a.x_axis_type,d=a.y_axis_type,p="x",_="y",m="categorical"==f?a.scalefns.xoutf:a.scalefns.xf,g="categorical"==d?a.scalefns.youtf:a.scalefns.yf,h=a.scales.X,x=a.scales.Y,y=a.x_accessor,v=a.y_accessor,b=function(t){var e;return e=h(0)},w=function(t){return Math.abs(m(t)-h(0))}),t.attr(p,b),t.attr(_,function(t){var e;return"categorical"==d?e=g(t):(e=x(0),t[v]<0&&(e=g(t))),e-=a.bar_thickness/2}),a.scales.COLOR&&t.attr("fill",a.scalefns.colorf),t.attr(l,w).attr(u,function(t){return a.bar_thickness}),a.legend&&a.ygroup_accessor&&a.color_accessor!==!1&&a.ygroup_accessor!==a.color_accessor&&(a.legend_target?e(a):r(n,a)),this},this.markers=function(){return Ne(a),this},this.rollover=function(){var t,e=R(a.target);0===e.selectAll(".mg-active-datapoint-container").nodes().length&&k(e,"mg-active-datapoint-container"),e.selectAll(".mg-rollover-rect").remove(),e.selectAll(".mg-active-datapoint").remove();var r,n,o,i,s,c,l,u,f,d,p,_,m,h;"vertical"==a.orientation&&(r="height",n="width",o=a.y_axis_type,i=a.x_axis_type,s="y",c="x",l="categorical"==o?a.scalefns.youtf:a.scalefns.yf,u="categorical"==i?a.scalefns.xoutf:a.scalefns.xf,f=a.scales.Y,d=a.scales.X,p=a.y_accessor,_=a.x_accessor,m=function(t){return g(a); -},h=function(t){return a.height-a.top-a.bottom-2*a.buffer}),"horizontal"==a.orientation&&(r="width",n="height",o=a.x_axis_type,i=a.y_axis_type,s="x",c="y",l="categorical"==o?a.scalefns.xoutf:a.scalefns.xf,u="categorical"==i?a.scalefns.youtf:a.scalefns.yf,f=a.scales.X,d=a.scales.Y,p=a.x_accessor,_=a.y_accessor,m=function(t){var e;return e=f(0)},h=function(t){return a.width-a.left-a.right-2*a.buffer});var x,y;"right"===a.rollover_align?(x=a.width-a.right,y="end"):"left"===a.rollover_align?(x=a.left,y="start"):(x=(a.width-a.left-a.right)/2+a.left,y="middle"),e.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",x).attr("y",.75*a.top).attr("dy",".35em").attr("text-anchor",y),t=e.append("g").attr("class","mg-rollover-rect");var v=t.selectAll(".mg-bar-rollover").data(a.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return v.attr("opacity",0).attr(s,m).attr(c,function(t){var e;return"categorical"==i?e=u(t):(e=d(0),t[_]<0&&(e=u(t))),e-=a.bar_thickness/2}),v.attr(r,h),v.attr(n,function(t){return a.bar_thickness}),v.on("mouseover",this.rolloverOn(a)).on("mouseout",this.rolloverOff(a)).on("mousemove",this.rolloverMove(a)),this},this.rolloverOn=function(e){var r=R(e.target);this.is_vertical?e.x_accessor:e.y_accessor,this.is_vertical?e.y_accessor:e.x_accessor,this.is_vertical?e.yax_units:e.xax_units;return function(a,n){var o=(MG.time_format(e.utc_time,"%b %e, %Y"),kr(e),r.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===n}).classed("active",!0));if(e.scales.hasOwnProperty("COLOR")?o.attr("fill",t.rgb(e.scalefns.colorf(a)).darker()):o.classed("default-active",!0),e.show_rollover_text){var i=Ze(e,{svg:r}),s=i.mouseover_row();e.ygroup_accessor&&s.text(a[e.ygroup_accessor]+" ").bold(),s.text(Gr(e,a)),s.text(e.y_accessor+": "+a[e.y_accessor]),(e.predictor_accessor||e.baseline_accessor)&&(s=i.mouseover_row(),e.predictor_accessor&&s.text(Mr(e,a,null,e.predictor_accessor,!1)),e.baseline_accessor&&s.text(Mr(e,a,null,e.baseline_accessor,!1)))}e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){var n=e.selectAll("g.mg-barplot .mg-bar.active").classed("active",!1);t.scales.hasOwnProperty("COLOR")?n.attr("fill",t.scalefns.colorf(r)):n.classed("default-active",!1),e.select(".mg-active-datapoint").text(""),Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(a)}var n={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,buffer:16,y_accessor:"factor",x_accessor:"value",secondary_label_accessor:null,color_accessor:null,color_type:"category",color_domain:null,legend:!0,legend_target:null,mouseover_align:"right",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,show_bar_zero:!0,binned:!0,truncate_x_labels:!0,truncate_y_labels:!0};MG.register("bar",a,n)}.call(this),MG.data_table=function(r){"use strict";return this.args=r,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],o=a[1];r[o]&&t.style(n,"string"==typeof r[o]||"number"==typeof r[o]?r[o]:r[o](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=U(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 r=this.args;V(r);var a,n,o,i,s,c,l,u,f,d,p,_,m=r.target,g=t.select(m).append("table").classed("mg-data-table",!0),h=g.append("colgroup"),x=g.append("thead"),y=g.append("tbody");for(o=x.append("tr"),_=0;_=e.data.length)if(e.custom_line_color_map.length>0){var a=function(t){for(var e=new Array(t),r=0;ro;r--)t.selectAll(".mg-main-line.mg-line"+r+"-color").remove()}}function ke(t,e){if(t.empty())return void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.')}function Me(t,e){var r="x"===e?t.width:t.height;Ge(t,e),Ae(t,e),De(t,e,r),r&&Oe(t,e)}function Ge(e,r){var a=r+"group_accessor",n=e[a];if(e.categorical_groups=[],n){var o=e.data[0];e.categorical_groups=t.set(o.map(function(t){return t[n]})).values()}}function Ae(e,r){var a=r+"group_accessor",n=e[a];if(e.total_bars=e.data[0].length,n){var o=d(f(e.data[0],n));o=t.max(Object.keys(o).map(function(t){return o[t]})),e.bars_per_group=o}else e.bars_per_group=e.data[0].length}function De(t,e,r){var a=e+"group_height";if(r){var n="y"===e?(t.height-t.top-t.bottom-2*t.buffer)/(t.categorical_groups.length||1):(t.width-t.left-t.right-2*t.buffer)/(t.categorical_groups.length||1);t[a]=n}else{var o=(1+t[e+"_padding_percentage"])*t.bar_thickness;t[a]=t.bars_per_group*o+2*t[e+"_outer_padding_percentage"]*o}}function Oe(t,e){var r=t[e+"group_height"]/(t.bars_per_group+t[e+"_outer_padding_percentage"]);t.bar_thickness=r-r*t[e+"_padding_percentage"]}function Fe(t,e){var r=t[e+"group_height"]*(t.categorical_groups.length||1),a="y"===e?t.top+t.bottom+2*t.buffer:t.left+t.right+2*t.buffer;return r+a+t.categorical_groups.length*t[e+"group_height"]*(t[e+"group_padding_percentage"]+t[e+"group_outer_padding_percentage"])}function ze(e){"use strict";e=arguments[0],e=de(e);var r=t.select(e.target);ke(r,e);var a=r.selectAll("svg");return"categorical"===e.y_axis_type&&Me(e,"y"),"categorical"===e.x_axis_type&&Me(e,"x"),pe(e),_e(e),me(e),ge(a,e),a=he(a,e),xe(a,e),ye(a,e),ve(a,e),be(a),V(e),we(a,e),this}function Ce(t){return t.label}function Te(t){t.selectAll(".mg-markers").remove(),t.selectAll(".mg-baselines").remove()}function Re(t){return function(e){return t.scales.X(e[t.x_accessor])>x(t)&&t.scales.X(e[t.x_accessor])1-1e-6}));var i=n.length,s=!0;t.data.forEach(function(t,e){t.forEach(function(t,e){if(t[a]%1!==0)return s=!1,!1})}),s&&i>o&&"count"===t.format&&(n=n.filter(function(t){return t%1===0})),"x"===e?t.processed.x_ticks=n:"y"===e&&(t.processed.y_ticks=n)}function ar(t){"use strict";if(t.data=MG.clone(t.data),t.single_object=!1,t.array_of_objects=!1,t.array_of_arrays=!1,t.nested_array_of_arrays=!1,t.nested_array_of_objects=!1,c(t.data)?(t.nested_array_of_objects=t.data.map(function(t){return u(t)}),t.nested_array_of_arrays=t.data.map(function(t){return c(t)})):(t.array_of_objects=l(t.data),t.array_of_arrays=c(t.data)),"line"===t.chart_type?(t.array_of_objects||t.array_of_arrays)&&(t.data=[t.data]):t.data[0]instanceof Array||(t.data=[t.data]),or(t),ir(t),void 0!==t.color&&(t.colors=t.color),null!==t.colors&&"string"==typeof t.colors&&(t.colors=[t.colors]),"line"===t.chart_type&&t.x_sort===!0)for(var e=0;e0&&t[0][e.x_accessor]instanceof Date}))>0;if((e.missing_is_zero||e.missing_is_hidden)&&"line"===e.chart_type&&a)for(var n=0;n=0&&t<=1?Math.pow(1-Math.pow(t,e),e):0}function hr(t){return gr(t,2)}function xr(t){return gr(t,3)}function yr(e){var r=t.sum(e.map(function(t){return t.w}));return{xbar:t.sum(e.map(function(t){return t.w*t.x}))/r,ybar:t.sum(e.map(function(t){return t.w*t.y}))/r}}function vr(e,r,a){var n=t.sum(e.map(function(t){return Math.pow(t.w,2)*(t.x-r)*(t.y-a)})),o=t.sum(e.map(function(t){return Math.pow(t.w,2)*Math.pow(t.x-r,2)}));return n/o}function br(t){var e,r,a=yr(t);r=a.xbar,e=a.ybar;var n=vr(t,r,e);return{beta:n,xbar:r,ybar:e,x0:e-n*r}}function wr(e,r,a,n,o){var i=Math.floor(e.length*a),s=e.slice();s.sort(function(t,e){return te?1:0});for(var c,l,u,f,d,p=t.quantile(s,.98),_=t.quantile(s,.02),m=t.zip(e,r,o).sort(),g=Math.abs(p-_)/n,h=_,x=p,y=t.range(h,x,g),v=[],b=0;b0;if(n)throw"That function is already registered.";a.push({func:e,context:r})},MG.call_hook=function(t){var e,r=MG._hooks[t],a=[].slice.apply(arguments,[1]);return r&&r.forEach(function(t){if(t.func){var r=e||a;r&&r.constructor!==Array&&(r=[r]),r=[].concat.apply([],r),e=t.func.apply(t.context,r)}}),e||a},MG.globals={},MG.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},x_rollover_format:{replacement:"x_mouseover",version:"2.10"},y_rollover_format:{replacement:"y_mouseover",version:"2.10"},show_years:{replacement:"show_secondary_x_label",version:"2.1"},xax_start_at_min:{replacement:"axes_not_compact",version:"2.7"},interpolate_tension:{replacement:"interpolate",version:"2.10"}},MG.globals.link=!1,MG.globals.version="1.1",MG.charts={},MG.data_graphic=function(e){"use strict";var r={missing_is_zero:!1,missing_is_hidden:!1,missing_is_hidden_accessor:null,legend:"",legend_target:"",error:"",animate_on_load:!1,top:65,title_y_position:10,center_title_full_width:!1,bottom:45,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,xax_count:6,xax_tick_length:5,axes_not_compact:!0,yax_count:3,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_sort:!0,x_axis:!0,y_axis:!0,x_axis_position:"bottom",y_axis_position:"left",x_axis_type:null,y_axis_type:null,ygroup_accessor:null,xgroup_accessor:null,y_padding_percentage:.05,y_outer_padding_percentage:.1,ygroup_padding_percentage:.25,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.1,xgroup_padding_percentage:.25,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!1,x_categorical_show_guide:!1,rotate_x_labels:0,rotate_y_labels:0,y_accessor:"value",y_label:"",yax_units:"",yax_units_append:!1,x_rug:!1,y_rug:!1,mouseover_align:"right",x_mouseover:null,y_mouseover:null,transition_on_update:!0,mouseover:null,click: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:{},utc_time:!1,european_clock:!1,show_year_markers:!1,show_secondary_x_label:!0,target:"#viz",interpolate:t.curveCatmullRom.alpha(0),custom_line_color_map:[],colors:null,max_data_size:null,aggregate_rollover:!1,show_tooltips:!0};MG.call_hook("global.defaults",r),e||(e={});var a=MG.charts[e.chart_type||r.chart_type];U(e,a.defaults,r),e.list&&(e.x_accessor=0,e.y_accessor=1);for(var n in MG.deprecations)if(e.hasOwnProperty(n)){var o=MG.deprecations[n],i="Use of `args."+n+"` has been deprecated",s=o.replacement;if(s&&(e[s]?i+=". The replacement - `args."+s+"` - has already been defined. This definition will be discarded.":e[s]=e[n]),o.warned)continue;o.warned=!0,s&&(i+=" in favor of `args."+s+"`"),N(i,o.version)}return MG.call_hook("global.before_init",e),new a.descriptor(e),e.data},e()&&(+function(t){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.tooltip",n=new r(this,o)),"string"==typeof e&&n[e]())})}var r=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};r.VERSION="3.3.5",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){if(this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var n=this.options.trigger.split(" "),o=n.length;o--;){var i=n[o];if("click"==i)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=i){var s="hover"==i?"mouseenter":"focusin",c="hover"==i?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(c+"."+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=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusin"==e.type?"focus":"hover"]=!0),r.tip().hasClass("in")||"in"==r.hoverState?void(r.hoverState="in"):(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.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),e instanceof t.Event&&(r.inState["focusout"==e.type?"focus":"hover"]=!1),!r.isInStateTrue())return 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,o=this.tip(),i=this.getUID(this.type);this.setContent(),o.attr("id",i),this.$element.attr("aria-describedby",i),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,c=/\s?auto?\s?/i,l=c.test(s);l&&(s=s.replace(c,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),f=o[0].offsetWidth,d=o[0].offsetHeight;if(l){var p=s,_=this.getPosition(this.$viewport);s="bottom"==s&&u.bottom+d>_.bottom?"top":"top"==s&&u.top-d<_.top?"bottom":"right"==s&&u.right+f>_.width?"left":"left"==s&&u.left-f<_.left?"right":s,o.removeClass(p).addClass(s)}var m=this.getCalculatedOffset(s,u,f,d);this.applyPlacement(m,s);var g=function(){var t=n.hoverState;n.$element.trigger("shown.bs."+n.type),n.hoverState=null,"out"==t&&n.leave(n)};t.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",g).emulateTransitionEnd(r.TRANSITION_DURATION):g()}},r.prototype.applyPlacement=function(e,r){var a=this.tip(),n=a[0].offsetWidth,o=a[0].offsetHeight,i=parseInt(a.css("margin-top"),10),s=parseInt(a.css("margin-left"),10);isNaN(i)&&(i=0),isNaN(s)&&(s=0),e.top+=i,e.left+=s,t.offset.setOffset(a[0],t.extend({using:function(t){a.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),a.addClass("in");var c=a[0].offsetWidth,l=a[0].offsetHeight;"top"==r&&l!=o&&(e.top=e.top+o-l);var u=this.getViewportAdjustedDelta(r,e,c,l);u.left?e.left+=u.left:e.top+=u.top;var f=/top|bottom/.test(r),d=f?2*u.left-n+c:2*u.top-o+l,p=f?"offsetWidth":"offsetHeight";a.offset(e),this.replaceArrow(d,a[0][p],f)},r.prototype.replaceArrow=function(t,e,r){this.arrow().css(r?"left":"top",50*(1-t/e)+"%").css(r?"top":"left","")},r.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},r.prototype.hide=function(e){function a(){"in"!=n.hoverState&&o.detach(),n.$element.removeAttr("aria-describedby").trigger("hidden.bs."+n.type),e&&e()}var n=this,o=t(this.$tip),i=t.Event("hide.bs."+this.type);if(this.$element.trigger(i),!i.isDefaultPrevented())return o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",a).emulateTransitionEnd(r.TRANSITION_DURATION):a(),this.hoverState=null,this},r.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},r.prototype.hasContent=function(){return this.getTitle()},r.prototype.getPosition=function(e){e=e||this.$element;var r=e[0],a="BODY"==r.tagName,n=r.getBoundingClientRect();null==n.width&&(n=t.extend({},n,{width:n.right-n.left,height:n.bottom-n.top}));var o=a?{top:0,left:0}:e.offset(),i={scroll:a?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},s=a?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},n,i,s,o)},r.prototype.getCalculatedOffset=function(t,e,r,a){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-r/2}:"top"==t?{top:e.top-a,left:e.left+e.width/2-r/2}:"left"==t?{top:e.top+e.height/2-a/2,left:e.left-r}:{top:e.top+e.height/2-a/2,left:e.left+e.width}},r.prototype.getViewportAdjustedDelta=function(t,e,r,a){var n={top:0,left:0};if(!this.$viewport)return n;var o=this.options.viewport&&this.options.viewport.padding||0,i=this.getPosition(this.$viewport);if(/right|left/.test(t)){var s=e.top-o-i.scroll,c=e.top+o-i.scroll+a;si.top+i.height&&(n.top=i.top+i.height-c)}else{var l=e.left-o,u=e.left+o+r;li.right&&(n.left=i.left+i.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(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},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))),e?(r.inState.click=!r.inState.click,r.isInStateTrue()?r.enter(r):r.leave(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),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null})};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){"use strict";function e(e){return this.each(function(){var a=t(this),n=a.data("bs.popover"),o="object"==typeof e&&e;!n&&/destroy|hide/.test(e)||(n||a.data("bs.popover",n=new r(this,o)),"string"==typeof e&&n[e]())})}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.5",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")};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)),MG.chart_title=V,MG.scale_factory=Q;var Tr={};Tr.categorical=function(t,e){e.namespace;ht(t,e),xt(t,e)},Tr.numerical=function(t,e){var r=e.namespace,a=r+"_axis",n="mg-"+r+"-axis",o=R(t.target);if(w(o,"."+n),!t[a])return this;var i=k(o,n);return rt(t,r),pt(i,t,e),dt(i,t,e),ft(i,t,e),t[r+"_label"]&&e.label(o.select(".mg-"+r+"-axis"),t),t[r+"_rug"]&&mt(t,e),t.show_bar_zero&&kt(t),this},MG.axis_factory=vt,MG.y_rug=bt,MG.y_axis=Ot,MG.y_axis_categorical=Yt,MG.x_rug=$t,MG.x_axis=Pt,MG.x_axis_categorical=Lt,MG.init=ze,MG.markers=Ne;var Rr=new Qe;e()&&+function(t){"use strict";function e(e){e&&3===e.which||(t(n).remove(),t(o).each(function(){var a=t(this),n=r(a),o={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",o)))}))}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 i(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",o='[data-toggle="dropdown"]',i=function(e){t(e).on("click.bs.dropdown",this.toggle)};i.VERSION="3.3.1",i.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),i=o.hasClass("open");if(e(),!i){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('");var u=function(){var t,e=$(this).data("key"),r=$(this).data("feature");return $("."+r+"-btns button.btn span.title").html(e),i.hasOwnProperty(r)?(t=i[r],o[t](e)):n(r,e),!1};for(var f in this.feature_set){for(r=this.feature_set[f],$(this.target+" div.segments").append('
"),s=0;s'+r[s]+"");$("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",u)}return this},this},function(){"use strict";function e(t,e,r){t.classed("mg-hover-line"+e.line_id+"-color",null===r.colors).attr("fill",null===r.colors?"":r.colors[e.line_id-1])}function i(t,e,r){u(t,e),c(t,e),l(t,e),s(t,e,r)}function s(e,r,a){r.existing_band=a.selectAll(".mg-confidence-band").nodes(),e.show_confidence_band&&(r.confidence_area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(function(t){var r=e.show_confidence_band[0];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).y1(function(t){var r=e.show_confidence_band[1];return void 0!=t[r]?e.scales.Y(t[r]):e.scales.Y(t[e.y_accessor])}).curve(e.interpolate))}function c(e,r){r.area=t.area().defined(r.line.defined()).x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).curve(e.interpolate)}function l(e,r){r.flat_line=t.line().defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}).x(e.scalefns.xf).y(function(){return e.scales.Y(r.data_median)}).curve(e.interpolate)}function u(e,r){r.line=t.line().x(e.scalefns.xf).y(e.scalefns.yf).curve(e.interpolate),e.missing_is_zero||(r.line=r.line.defined(function(t){return(void 0===t._missing||t._missing!==!0)&&null!==t[e.y_accessor]}))}function f(t,e,r,a){if(t.show_confidence_band){var n;r.select(".mg-confidence-band-"+a).empty()&&r.append("path").attr("class","mg-confidence-band mg-confidence-band-"+a),n=r.select(".mg-confidence-band-"+a),n.transition().duration(function(){return t.transition_on_update?1e3:0}).attr("d",e.confidence_area(t.data[a-1])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")}}function d(t,e,r,a,n){var o=r.selectAll(".mg-main-area.mg-area"+n);e.display_area?o.empty()?r.append("path").classed("mg-main-area",!0).classed("mg-area"+n,!0).classed("mg-area"+n+"-color",null===t.colors).attr("d",e.area(t.data[a])).attr("fill",null===t.colors?"":t.colors[n-1]).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")"):(r.node().appendChild(o.node()),o.transition().duration(e.update_transition_duration).attr("d",e.area(t.data[a])).attr("clip-path","url(#mg-plot-window-"+P(t.target)+")")):o.empty()||o.remove()}function p(t,e){t.classed("mg-line"+e+"-color",!0)}function _(t,e,r,a){t.colors&&t.colors.constructor===Array?(e.attr("stroke",t.colors[r]),t.colors.length— "+i+"  "+e.legend_text:e.legend_text="— "+i+"  "+e.legend_text;else{var s,c,l;"left"===t.y_axis_position?(s=t.data[r][t.data[r].length-1],c="start",l=t.buffer):(s=t.data[r][0],c="end",l=-t.buffer);var u=e.legend_group.append("svg:text").attr("x",t.scalefns.xf(s)).attr("dx",l).attr("y",t.scalefns.yf(s)).attr("dy",".35em").attr("font-size",10).attr("text-anchor",c).attr("font-weight","300").text(i);t.colors&&t.colors.constructor===Array?t.colors.length0?t.data[r][a].line_id=t.custom_line_color_map[r]:t.data[r][a].line_id=e;e++}}function D(e){return t.merge(e.data)}function O(t){return function(e){var r;if(t.linked){var a=e[t.x_accessor],n=MG.time_format(t.utc_time,t.linked_format),o="number"==typeof a?e.line_id-1:n(a);return r="roll_"+o+" mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}return r="mg-line"+e.line_id,null===t.color&&(r+=" mg-line"+e.line_id+"-color"),r}}function z(e,r,a,n,o){var i=t.voronoi().x(function(t){return e.scales.X(t[e.x_accessor]).toFixed(2)}).y(function(t){return e.scales.Y(t[e.y_accessor]).toFixed(2)}).extent([[e.buffer,e.buffer+e.title_y_position],[e.width-e.buffer,e.height-e.buffer]]),s=k(r,"mg-voronoi");s.selectAll("path").data(i.polygons(D(e))).enter().append("path").filter(function(t){return void 0!==t&&t.length>0}).attr("d",function(t){return null==t?null:"M"+t.join("L")+"Z"}).datum(function(t){return null==t?null:t.data}).attr("class",O(e)).on("mouseover",a).on("mouseout",n).on("mousemove",o),$(e,r)}function C(e){var r=t.nest().key(function(t){return t[e.x_accessor]}).entries(t.merge(e.data));return r.forEach(function(t){var r=t.values[0];t.key=r[e.x_accessor]}),e.x_sort?r.sort(function(t,e){return new Date(t.key)-new Date(e.key)}):r}function T(t,e,r,a,n){var o=C(t),i=o.map(function(e){return t.scales.X(e.key)}),s=e.append("g").attr("class","mg-rollover-rect");s.selectAll(".mg-rollover-rects").data(o).enter().append("rect").attr("x",function(e,r){return 1===i.length?x(t):0===r?i[r].toFixed(2):((i[r-1]+i[r])/2).toFixed(2)}).attr("y",t.top).attr("width",function(e,r){return 1===i.length?v(t):0===r?((i[r+1]-i[r])/2).toFixed(2):r===i.length-1?((i[r]-i[r-1])/2).toFixed(2):((i[r+1]-i[r-1])/2).toFixed(2)}).attr("class",function(e){var r=e.values.map(function(e){var r=E(e.line_id);return null===t.colors&&(r+=" "+L(e.line_id)),r}).join(" ");return t.linked&&e.values.length>0&&(r+=" "+X(S(e.values[0],0,t))),r}).attr("height",t.height-t.bottom-t.top-t.buffer).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),U(t,e)}function Y(t,e){e.select(".mg-rollover-rect rect").on("mouseover")(t.data[0][0],0)}function $(t,e){for(var r=0;r0&&void 0!==t.custom_line_color_map[r]&&(a=t.custom_line_color_map[r]),1!==t.data[r].length||e.selectAll(".mg-voronoi .mg-line"+a).empty()||(e.selectAll(".mg-voronoi .mg-line"+a).on("mouseover")(t.data[r][0],0),e.selectAll(".mg-voronoi .mg-line"+a).on("mouseout")(t.data[r][0],0))}}function E(t){return"mg-line"+t}function L(t){return"mg-line"+t+"-color"}function X(t){return"roll_"+t}function S(t,e,r){var a=t[r.x_accessor],n=MG.time_format(r.utc_time,r.linked_format),o="number"==typeof a?e:n(a);return o}function j(t,e,r,a,n){var o=1;t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[0]);var i=e.append("g").attr("class","mg-rollover-rect"),s=t.data[0].map(t.scalefns.xf);i.selectAll(".mg-rollover-rects").data(t.data[0]).enter().append("rect").attr("class",function(e,r){var a=L(o)+" "+E(e.line_id);return t.linked&&(a+=a+" "+X(S(e,r,t))),a}).attr("x",function(e,r){return 1===s.length?x(t):0===r?s[r].toFixed(2):((s[r-1]+s[r])/2).toFixed(2)}).attr("y",function(e,r){return t.data.length>1?t.scalefns.yf(e)-6:t.top}).attr("width",function(e,r){return 1===s.length?v(t):0===r?((s[r+1]-s[r])/2).toFixed(2):r===s.length-1?((s[r]-s[r-1])/2).toFixed(2):((s[r+1]-s[r-1])/2).toFixed(2)}).attr("height",function(e,r){return t.data.length>1?12:t.height-t.bottom-t.top-t.buffer}).attr("opacity",0).on("mouseover",r).on("mouseout",a).on("mousemove",n),I(t)&&Y(t,e)}function U(t,e){var r=e.selectAll(".mg-rollover-rect rect");t.data.filter(function(t){return 1===t.length}).length>0&&r.on("mouseover")(r[0][0].__data__,0)}function B(t){return t.data.length>1&&!t.aggregate_rollover}function N(t){return t.data.length>1&&t.aggregate_rollover}function I(t){return 1===t.data.length&&1===t.data[0].length}function H(t,e,r){q(e,r);for(var a=t.data.length-1;a>=0;a--){var n=t.data[a];MG.call_hook("line.before_each_series",[n,t]);var o=a+1;if(t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[a]),t.data[a].line_id=o,0!==n.length){var i=r.select("path.mg-main-line.mg-line"+o);f(t,e,r,o),d(t,e,r,a,o),g(t,e,r,i,a,o),h(t,e,a,o),MG.call_hook("line.after_each_series",[n,i,t])}}}function q(t,e){t.existing_band[0]&&t.existing_band[0].length>e.selectAll(".mg-main-line").node().length&&e.selectAll(".mg-confidence-band").remove()}function V(t){var e={},r=R(t.target);w(r,".mg-line-legend"),b(t,e,r),e.data_median=0,e.update_transition_duration=t.transition_on_update?1e3:0,e.display_area=t.area&&!t.use_data_y_min&&t.data.length<=1&&t.aggregate_rollover===!1,e.legend_text="",i(t,e,r),e.existing_band=r.selectAll(".mg-confidence-band").nodes();var a=MG.call_hook("line.before_all_series",[t]);a!==!1&&H(t,e,r),y(t.legend_target,e.legend_text)}function W(t,e){var r=R(t.target);0===r.selectAll(".mg-active-datapoint-container").nodes().length&&k(r,"mg-active-datapoint-container"),M(r),G(t,r),A(t),B(t)?z(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):N(t)?T(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):j(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t))}function Z(t,e,r){if(t.aggregate_rollover&&t.data.length>1)e.selectAll("circle.mg-line-rollover-circle").style("opacity",0),r.values.forEach(function(r){a(r,t)&&Q(t,e,r)});else{if(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])return;a(r,t)&&K(t,e,r)}}function Q(t,e,r){e.select("circle.mg-line-rollover-circle.mg-line"+r.line_id).attr("cx",t.scales.X(r[t.x_accessor]).toFixed(2)).attr("cy",t.scales.Y(r[t.y_accessor]).toFixed(2)).attr("r",t.point_size).style("opacity",1)}function K(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).classed("mg-line-rollover-circle",!0).attr("cx",function(){return t.scales.X(r[t.x_accessor]).toFixed(2)}).attr("cy",function(){return t.scales.Y(r[t.y_accessor]).toFixed(2)}).attr("r",t.point_size).style("opacity",1)}function J(e,r,a){if(e.linked&&!MG.globals.link&&(MG.globals.link=!0,!e.aggregate_rollover||void 0!==r.value||r.values.length>0)){var n=r.values?r.values[0]:r,o=S(n,a,e);t.selectAll("."+E(n.line_id)+"."+X(o)).each(function(e){t.select(this).on("mouseover")(e,a)})}}function tt(e,r,a){if(e.linked&&MG.globals.link){MG.globals.link=!1;var n=MG.time_format(e.utc_time,e.linked_format),o=r.values?r.values:[r];o.forEach(function(r){var o=r[e.x_accessor],i="number"==typeof o?a:n(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})})}}function et(t,e){e.selectAll("circle.mg-line-rollover-circle").filter(function(t){return t.length>1}).style("opacity",0)}function rt(t,e,r){e.selectAll("circle.mg-line-rollover-circle.mg-line"+r.line_id).style("opacity",function(){var e=r.line_id-1;return t.custom_line_color_map.length>0&&void 0!==t.custom_line_color_map.indexOf(r.line_id)&&(e=t.custom_line_color_map.indexOf(r.line_id)),1===t.data[e].length?1:0})}function at(t){this.init=function(t){if(this.args=t,!t.data||0===t.data.length)return t.internal_error="No data was supplied",zr(t),this;t.internal_error=void 0,ar(t),sr(t),MG.call_hook("line.before_destroy",this),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left");R(t.target);return t.x_axis&&new MG.axis_factory(t).namespace("x").type("numerical").position(t.x_axis_position).rug($t(t)).label(jt).draw(),t.y_axis&&new MG.axis_factory(t).namespace("y").type("numerical").position(t.y_axis_position).rug(bt(t)).label(Mt).draw(),this.markers(),this.mainPlot(),this.rollover(),this.windowListeners(),MG.call_hook("line.after_init",this),this},this.mainPlot=function(){return V(t),this},this.markers=function(){return Ne(t),this},this.rollover=function(){var e=this;return W(t,e),MG.call_hook("line.after_rollover",t),this},this.rolloverOn=function(t){var a=R(t.target);r(t);return function(r,n){if(Z(t,a,r),J(t,r,n),a.selectAll("text").filter(function(t,e){return r===t}).attr("opacity",.3),t.show_rollover_text&&!(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])){var o=Ze(t,{svg:a}),i=o.mouseover_row();t.aggregate_rollover&&i.text((t.aggregate_rollover&&t.data.length>1?Dr:Gr)(t,r));var s=t.aggregate_rollover&&t.data.length>1?r.values:[r];s.forEach(function(r){t.aggregate_rollover&&(i=o.mouseover_row()),t.legend&&e(i.text(t.legend[r.line_id-1]+" ").bold().elem(),r,t),e(i.text("— ").elem(),r,t),t.aggregate_rollover||i.text(Gr(t,r)),i.text(Ar(t,r,t.time_series===!1))})}t.mouseover&&t.mouseover(r,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){tt(t,r,a),t.aggregate_rollover?et(t,e):rt(t,e,r),t.data[0].length>1&&Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(t)}MG.register("line",at)}.call(this),function(){"use strict";function e(e){this.init=function(t){this.args=t,ar(t),cr(t),ze(t),new MG.scale_factory(t).namespace("x").numericalDomainFromData().numericalRange("bottom");var e=(t.baselines||[]).map(function(e){return e[t.y_accessor]});return new MG.scale_factory(t).namespace("y").zeroBottom(!0).inflateDomain(!0).numericalDomainFromData(e).numericalRange("left"),Pt(t),Ot(t),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t=R(e.target);t.selectAll(".mg-histogram").remove();var r=t.append("g").attr("class","mg-histogram"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor]).toFixed(2)+","+e.scales.Y(t[e.y_accessor]).toFixed(2)+")"});return a.append("rect").attr("x",1).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return 0===t[e.y_accessor]?0:(e.height-e.bottom-e.buffer-e.scales.Y(t[e.y_accessor])).toFixed(2)}),this},this.markers=function(){return Ne(e),this},this.rollover=function(){var t=R(e.target);0===t.selectAll(".mg-active-datapoint-container").nodes().length&&k(t,"mg-active-datapoint-container"),t.selectAll(".mg-rollover-rect").remove(),t.selectAll(".mg-active-datapoint").remove();var r=t.append("g").attr("class","mg-rollover-rect"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class",function(t,r){return e.linked?"mg-rollover-rects roll_"+r:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",e.buffer+e.title_y_position).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(0):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(0):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(0)}).attr("height",function(t){return e.height}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll("text").filter(function(t,e){return a===t}).attr("opacity",.3);e.processed.xax_format||MG.time_format(e.utc_time,"%b %e, %Y"),kr(e);if(r.selectAll(".mg-bar rect").filter(function(t,e){return e===n}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseover")(e,n)})),e.show_rollover_text){var o=Ze(e,{svg:r}),i=o.mouseover_row();i.text("▟ ").elem().classed("hist-symbol",!0),i.text(Gr(e,a)),i.text(Ar(e,a,e.time_series===!1))}e.mouseover&&(He(r,e),e.mouseover(a,n))}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseout")(e,n)})),r.selectAll(".mg-bar rect").classed("active",!1),Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(e)}var r={binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1};MG.register("histogram",e,r)}.call(this),function(){"use strict";function e(t,e){var r=e.x_accessor,a=e.y_accessor,n=t.filter(function(t){return(null===e.min_x||t[r]>=e.min_x)&&(null===e.max_x||t[r]<=e.max_x)&&(null===e.min_y||t[a]>=e.min_y)&&(null===e.max_y||t[a]<=e.max_y)});return n}function r(r){this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}if(null!==t.color_accessor){var n=MG.scale_factory(t).namespace("color");"number"===t.color_type?n.numericalDomainFromData(tt(t)).numericalRange(et(t)).clamp(!0):t.color_domain?n.categoricalDomain(t.color_domain).categoricalRange(t.color_range):n.categoricalDomainFromData().categoricalColorRange()}return t.size_accessor&&new MG.scale_factory(t).namespace("size").numericalDomainFromData().numericalRange(St(t)).clamp(!0),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).rug($t(t)).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).rug(bt(t)).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.markers=function(){return Ne(r),r.least_squares&&fr(r),this},this.mainPlot=function(){var t,a=R(r.target),n=e(r.data[0],r);a.selectAll(".mg-points").remove(),t=a.append("g").classed("mg-points",!0);var o=t.selectAll("circle").data(n).enter().append("circle").attr("class",function(t,e){return"path-"+e}).attr("cx",r.scalefns.xoutf).attr("cy",function(t){return r.scalefns.youtf(t)});return null!==r.color_accessor?(o.attr("fill",r.scalefns.colorf),o.attr("stroke",r.scalefns.colorf)):o.classed("mg-points-mono",!0),null!==r.size_accessor?o.attr("r",r.scalefns.sizef):o.attr("r",r.point_size),this},this.rollover=function(){var a=R(r.target);0===a.selectAll(".mg-active-datapoint-container").nodes().length&&k(a,"mg-active-datapoint-container"),a.selectAll(".mg-voronoi").remove();var n=t.voronoi().x(r.scalefns.xoutf).y(r.scalefns.youtf).extent([[r.buffer,r.buffer+r.title_y_position],[r.width-r.buffer,r.height-r.buffer]]),o=a.append("g").attr("class","mg-voronoi");return o.selectAll("path").data(n.polygons(e(r.data[0],r))).enter().append("path").attr("d",function(t){return null==t?null:"M"+t.join(",")+"Z"}).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)),1===r.data[0].length&&tr(r,a,r.data[0][0]),this},this.rolloverOn=function(e){var r=R(e.target);return function(a,n){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+n).classed("selected",!0);e.size_accessor?o.attr("r",function(t){return e.scalefns.sizef(t)+e.active_point_size_increase}):o.attr("r",e.point_size+e.active_point_size_increase),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(a,n)})),e.show_rollover_text&&tr(e,r,a.data),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=R(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(a,n)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.sizef):o.attr("r",e.point_size),e.data[0].length>1&&Ie(r),e.mouseout&&e.mouseout(a,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.update=function(t){return this},this.windowListeners=function(){return Ke(this.args),this},this.init(r)}var a={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,y_categorical_show_guides:!0,x_categorical_show_guides:!0,buffer:16,ls:!1,lowess:!1,point_size:2.5,label_accessor:null,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,active_point_size_increase:1,color_type:"number"};MG.register("point",r,a)}.call(this),function(){"use strict";function e(e){if(e.legend_target){var r=t.select(e.legend_target).append("div").classed("mg-bar-target-legend",!0),a=e.categorical_variables;a.forEach(function(t){var a=r.append("span").classed("mg-bar-target-element",!0);a.append("span").classed("mg-bar-target-legend-shape",!0).style("color",e.scales.colorf(t)).text("◼ "),a.append("span").classed("mg-bar-target-legend-text",!0).text(t)})}}function r(t,e){var r=e.scales.Y.domain(),a=0,n=1.1,o=t.append("g").classed("mg-bar-legend",!0),i=o.append("text");i.selectAll("*").remove(),i.attr("width",e.right).attr("height",100).attr("text-anchor","start"),r.forEach(function(t){var r=i.append("tspan").attr("x",v(e)).attr("y",e.height/2).attr("dy",a*n+"em");r.append("tspan").text("■ ").attr("fill",e.scales.COLOR(t)).attr("font-size",20),r.append("tspan").text(t).attr("font-weight",300).attr("font-size",10),a++})}function a(a){this.args=a,this.init=function(t){this.args=t,t.x_axis_type=T(t,"x"),t.y_axis_type=T(t,"y"),"categorical"==t.x_axis_type?t.orientation="vertical":"categorical"==t.y_axis_type?t.orientation="horizontal":"categorical"!=t.x_axis_type&&"categorical"!=t.y_axis_type&&(t.orientation="vertical"),ar(t),ur(t),ze(t);var e,r;if("categorical"===t.x_axis_type?(e=MG.scale_factory(t).namespace("x").categoricalDomainFromData().categoricalRangeBands([0,t.xgroup_height],null===t.xgroup_accessor),t.xgroup_accessor?new MG.scale_factory(t).namespace("xgroup").categoricalDomainFromData().categoricalRangeBands("bottom"):(t.scales.XGROUP=function(e){return x(t)},t.scalefns.xgroupf=function(e){return x(t)}),t.scalefns.xoutf=function(e){return t.scalefns.xf(e)+t.scalefns.xgroupf(e)}):(e=MG.scale_factory(t).namespace("x").inflateDomain(!0).zeroBottom("categorical"===t.y_axis_type).numericalDomainFromData((t.baselines||[]).map(function(e){return e[t.x_accessor]})).numericalRange("bottom"),t.scalefns.xoutf=t.scalefns.xf),"categorical"===t.y_axis_type)r=MG.scale_factory(t).namespace("y").zeroBottom(!0).categoricalDomainFromData().categoricalRangeBands([0,t.ygroup_height],!0),t.ygroup_accessor?new MG.scale_factory(t).namespace("ygroup").categoricalDomainFromData().categoricalRangeBands("left"):(t.scales.YGROUP=function(){return g(t)},t.scalefns.ygroupf=function(e){return g(t)}),t.scalefns.youtf=function(e){return t.scalefns.yf(e)+t.scalefns.ygroupf(e)};else{var a=(t.baselines||[]).map(function(e){return e[t.y_accessor]});r=MG.scale_factory(t).namespace("y").inflateDomain(!0).zeroBottom("categorical"===t.x_axis_type).numericalDomainFromData(a).numericalRange("left"),t.scalefns.youtf=function(e){return t.scalefns.yf(e)}}return null!==t.ygroup_accessor&&(t.ycolor_accessor=t.y_accessor,MG.scale_factory(t).namespace("ycolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),null!==t.xgroup_accessor&&(t.xcolor_accessor=t.x_accessor,MG.scale_factory(t).namespace("xcolor").scaleName("color").categoricalDomainFromData().categoricalColorRange()),new MG.axis_factory(t).namespace("x").type(t.x_axis_type).zeroLine("categorical"===t.y_axis_type).position(t.x_axis_position).draw(),new MG.axis_factory(t).namespace("y").type(t.y_axis_type).zeroLine("categorical"===t.x_axis_type).position(t.y_axis_position).draw(),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t,n=R(a.target),o=a.data[0],i=n.select("g.mg-barplot"),s=i.empty(),c=s&&a.animate_on_load;c||a.transition_on_update,a.transition_duration||1e3;s&&(i=n.append("g").classed("mg-barplot",!0)),t=i.selectAll(".mg-bar").data(o).enter().append("rect").classed("mg-bar",!0).classed("default-bar",!a.scales.hasOwnProperty("COLOR"));var l,u,f,d,p,_,m,g,h,x,y,v,b,w;return"vertical"==a.orientation&&(l="height",u="width",f=a.y_axis_type,d=a.x_axis_type,p="y",_="x",m="categorical"==f?a.scalefns.youtf:a.scalefns.yf,g="categorical"==d?a.scalefns.xoutf:a.scalefns.xf,h=a.scales.Y,x=a.scales.X,y=a.y_accessor,v=a.x_accessor,b=function(t){var e;return e=m(t),t[y]<0&&(e=h(0)),e},w=function(t){return Math.abs(m(t)-h(0))}),"horizontal"==a.orientation&&(l="width",u="height",f=a.x_axis_type,d=a.y_axis_type,p="x",_="y",m="categorical"==f?a.scalefns.xoutf:a.scalefns.xf,g="categorical"==d?a.scalefns.youtf:a.scalefns.yf,h=a.scales.X,x=a.scales.Y,y=a.x_accessor,v=a.y_accessor,b=function(t){var e;return e=h(0)},w=function(t){return Math.abs(m(t)-h(0))}),t.attr(p,b),t.attr(_,function(t){var e;return"categorical"==d?e=g(t):(e=x(0),t[v]<0&&(e=g(t))),e-=a.bar_thickness/2}),a.scales.COLOR&&t.attr("fill",a.scalefns.colorf),t.attr(l,w).attr(u,function(t){return a.bar_thickness}),a.legend&&a.ygroup_accessor&&a.color_accessor!==!1&&a.ygroup_accessor!==a.color_accessor&&(a.legend_target?e(a):r(n,a)),this},this.markers=function(){return Ne(a),this},this.rollover=function(){var t,e=R(a.target);0===e.selectAll(".mg-active-datapoint-container").nodes().length&&k(e,"mg-active-datapoint-container"),e.selectAll(".mg-rollover-rect").remove(),e.selectAll(".mg-active-datapoint").remove();var r,n,o,i,s,c,l,u,f,d,p,_,m,h;"vertical"==a.orientation&&(r="height",n="width",o=a.y_axis_type,i=a.x_axis_type,s="y",c="x",l="categorical"==o?a.scalefns.youtf:a.scalefns.yf,u="categorical"==i?a.scalefns.xoutf:a.scalefns.xf,f=a.scales.Y,d=a.scales.X,p=a.y_accessor,_=a.x_accessor,m=function(t){return g(a)},h=function(t){return a.height-a.top-a.bottom-2*a.buffer; +}),"horizontal"==a.orientation&&(r="width",n="height",o=a.x_axis_type,i=a.y_axis_type,s="x",c="y",l="categorical"==o?a.scalefns.xoutf:a.scalefns.xf,u="categorical"==i?a.scalefns.youtf:a.scalefns.yf,f=a.scales.X,d=a.scales.Y,p=a.x_accessor,_=a.y_accessor,m=function(t){var e;return e=f(0)},h=function(t){return a.width-a.left-a.right-2*a.buffer});var x,y;"right"===a.rollover_align?(x=a.width-a.right,y="end"):"left"===a.rollover_align?(x=a.left,y="start"):(x=(a.width-a.left-a.right)/2+a.left,y="middle"),e.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",x).attr("y",.75*a.top).attr("dy",".35em").attr("text-anchor",y),t=e.append("g").attr("class","mg-rollover-rect");var v=t.selectAll(".mg-bar-rollover").data(a.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return v.attr("opacity",0).attr(s,m).attr(c,function(t){var e;return"categorical"==i?e=u(t):(e=d(0),t[_]<0&&(e=u(t))),e-=a.bar_thickness/2}),v.attr(r,h),v.attr(n,function(t){return a.bar_thickness}),v.on("mouseover",this.rolloverOn(a)).on("mouseout",this.rolloverOff(a)).on("mousemove",this.rolloverMove(a)),this},this.rolloverOn=function(e){var r=R(e.target);this.is_vertical?e.x_accessor:e.y_accessor,this.is_vertical?e.y_accessor:e.x_accessor,this.is_vertical?e.yax_units:e.xax_units;return function(a,n){var o=(MG.time_format(e.utc_time,"%b %e, %Y"),kr(e),r.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===n}).classed("active",!0));if(e.scales.hasOwnProperty("COLOR")?o.attr("fill",t.rgb(e.scalefns.colorf(a)).darker()):o.classed("default-active",!0),e.show_rollover_text){var i=Ze(e,{svg:r}),s=i.mouseover_row();e.ygroup_accessor&&s.text(a[e.ygroup_accessor]+" ").bold(),s.text(Gr(e,a)),s.text(e.y_accessor+": "+a[e.y_accessor]),(e.predictor_accessor||e.baseline_accessor)&&(s=i.mouseover_row(),e.predictor_accessor&&s.text(Mr(e,a,null,e.predictor_accessor,!1)),e.baseline_accessor&&s.text(Mr(e,a,null,e.baseline_accessor,!1)))}e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(t){var e=R(t.target);return function(r,a){var n=e.selectAll("g.mg-barplot .mg-bar.active").classed("active",!1);t.scales.hasOwnProperty("COLOR")?n.attr("fill",t.scalefns.colorf(r)):n.classed("default-active",!1),e.select(".mg-active-datapoint").text(""),Ie(e),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return Ke(this.args),this},this.init(a)}var n={y_padding_percentage:.05,y_outer_padding_percentage:.2,ygroup_padding_percentage:0,ygroup_outer_padding_percentage:0,x_padding_percentage:.05,x_outer_padding_percentage:.2,xgroup_padding_percentage:0,xgroup_outer_padding_percentage:0,buffer:16,y_accessor:"factor",x_accessor:"value",secondary_label_accessor:null,color_accessor:null,color_type:"category",color_domain:null,legend:!0,legend_target:null,mouseover_align:"right",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,show_bar_zero:!0,binned:!0,truncate_x_labels:!0,truncate_y_labels:!0};MG.register("bar",a,n)}.call(this),MG.data_table=function(r){"use strict";return this.args=r,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],o=a[1];r[o]&&t.style(n,"string"==typeof r[o]||"number"==typeof r[o]?r[o]:r[o](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=U(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 r=this.args;V(r);var a,n,o,i,s,c,l,u,f,d,p,_,m=r.target,g=t.select(m).append("table").classed("mg-data-table",!0),h=g.append("colgroup"),x=g.append("thead"),y=g.append("tbody");for(o=x.append("tr"),_=0;_ 0 && series[0][args.x_accessor] instanceof Date; })) > 0; - // force linear interpolation when missing_is_hidden is enabled - if (args.missing_is_hidden) { - args.interpolate = d3.curveLinear; - } - // are we replacing missing y values with zeros? if ((args.missing_is_zero || args.missing_is_hidden) && args.chart_type === 'line' && is_time_series) { for (var i = 0; i < args.data.length; i++) {