From aca3532f9945b08c85ba5e72946863ff3f2b762a Mon Sep 17 00:00:00 2001 From: almossawi Date: Tue, 16 Aug 2016 13:12:47 -0700 Subject: [PATCH] Update version to 2.10.1 --- dist/metricsgraphics.js | 2 +- dist/metricsgraphics.min.js | 2 +- package.json | 2 +- src/js/MG.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js index f7f52ca9..0b9ab448 100644 --- a/dist/metricsgraphics.js +++ b/dist/metricsgraphics.js @@ -7,7 +7,7 @@ root.MG = factory(root.d3); } }(this, function(d3) { -window.MG = {version: '2.10.0'}; +window.MG = {version: '2.10.1'}; //a set of helper functions, some that we've written, others that we've borrowed diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js index 8078da51..6067cc03 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_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('