misc_pterodactyl-panel/public/js/metricsgraphics.min.js
Dane Everitt aa54e657e1 Change graphing library for node view
Server view coming soon
2016-02-06 01:29:24 -05:00

3 lines
No EOL
81 KiB
JavaScript
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(t,e){"function"==typeof define&&define.amd?define(["d3","jquery"],e):"object"==typeof exports?module.exports=e(require("d3"),require("jquery")):t.MG=e(t.d3,t.jQuery)}(this,function(t,e){function r(t,e,r){MG.charts[t]={descriptor:e,defaults:r||{}}}function n(r){"use strict";var n=Ie(r.target);if(n.select(".mg-header").remove(),r.target&&r.title){var a=n.insert("text").attr("class","mg-header").attr("x",(r.width+r.left-r.right)/2).attr("y",r.title_y_position).attr("text-anchor","middle").attr("dy","0.55em");if(a.append("tspan").attr("class","mg-chart-title").text(r.title),r.show_tooltips&&r.description){a.append("tspan").attr("class","mg-chart-description").attr("dx","0.3em").text("");var o=e(a.node());o.popover({html:!0,animation:!1,placement:"top",content:r.description,container:r.target,trigger:"manual",template:'<div class="popover mg-popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'}).on("mouseenter",function(){t.selectAll(r.target).selectAll(".mg-popover").remove(),e(this).popover("show"),e(r.target).select(".popover").on("mouseleave",function(){o.popover("hide")})}).on("mouseleave",function(){setTimeout(function(){e(".popover:hover").length||o.popover("hide")},120)})}}r.error&&er(r)}function a(t){"use strict";t.rug_buffer_size="point"===t.chart_type?t.buffer/2:2*t.buffer/3;var e=Ce(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),Fe(e,t,"mg-y-rug-mono")}function o(e,r){return"bar"===e.chart_type&&(r.min=0,r.max=t.max(e.data[0],function(t){var r=[];return r.push(t[e.y_accessor]),null!==e.baseline_accessor&&r.push(t[e.baseline_accessor]),null!==e.predictor_accessor&&r.push(t[e.predictor_accessor]),Math.max.apply(null,r)})),r}function i(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){if(1>r)return e.yax_units+t.round(r,e.decimals);var n=t.formatPrefix(r);return e.yax_units+n.scale(r)+n.symbol}):r=function(e){var r=t.format("2p");return r(e)}),r}function s(e){var r=Re(e.data);"log"===e.y_scale_type&&(r=r.filter(function(t){return t[e.y_accessor]>0})),e.baselines&&(r=r.concat(e.baselines));var n=t.extent(r,function(t){return t[e.y_accessor]}),a={};a.min=n[0],a.max=n[1],a.min>=0&&!e.min_y&&!e.min_y_from_data&&(a.min=0),o(e,a),a.min=null!==e.min_y?e.min_y:a.min,a.max=null!==e.max_y?e.max_y:a.max<0?a.max+(a.max-a.max*e.inflator):a.max*e.inflator,"log"!==e.y_scale_type&&a.min<0&&(a.min=a.min-(a.min-a.min*e.inflator)),!e.min_y&&e.min_y_from_data&&(a.min=a.min/e.inflator),e.processed.min_y=a.min,e.processed.max_y=a.max}function l(t,e){return e.domain([t.processed.min_y,t.processed.max_y]).range([we(t),t.top]),e}function c(e){var r="log"===e.y_scale_type?t.scale.log():t.scale.linear();"log"===e.y_scale_type&&("histogram"===e.chart_type?e.processed.min_y=.2:e.processed.min_y<=0&&(e.processed.min_y=1)),e.scales.Y=l(e,r),e.scales.Y.clamp("log"===e.y_scale_type),e.scales.Y_axis=l(e,t.scale.linear())}function u(t,e){e.y_label&&t.append("text").attr("class","label").attr("x",function(){return-1*(Me(e)+(we(e)-Me(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 f(t){function e(t){return 1e3===t?3:1e6===t?7:Math.log(t)/Math.LN10}var r=t.scales.Y.ticks(t.yax_count);"log"===t.y_scale_type&&(r=r.filter(function(t){return Math.abs(e(t))%1<1e-6||Math.abs(e(t))%1>1-1e-6}));var n=t.scales.Y.ticks(t.yax_count).length,a=!0;t.data.forEach(function(e,r){e.forEach(function(e,r){return e[t.y_accessor]%1!==0?(a=!1,!1):void 0})}),a&&n>t.processed.max_y&&"count"===t.format&&(r=r.filter(function(t){return t%1===0})),t.processed.y_ticks=r}function d(t,e){var r=e.processed.y_ticks.length;if(!e.x_extended_ticks&&!e.y_extended_ticks&&r){var n,a;e.axes_not_compact&&"bar"!==e.chart_type?(n=e.height-e.bottom,a=e.top):r?(n=e.scales.Y(e.processed.y_ticks[0]).toFixed(2),a=e.scales.Y(e.processed.y_ticks[r-1]).toFixed(2)):(n=0,a=0),t.append("line").attr("x1",e.left).attr("x2",e.left).attr("y1",n).attr("y2",a)}}function p(t,e){t.selectAll(".mg-yax-ticks").data(e.processed.y_ticks).enter().append("line").classed("mg-extended-y-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 m(t,e){var r=i(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 h(t){t.processed||(t.processed={});var e=Ie(t.target);if(s(t),MG.call_hook("y_axis.process_min_max",t,t.processed.min_y,t.processed.max_y),c(t),Ee(t,"yf","Y",t.y_accessor),Ye(e,".mg-y-axis"),!t.y_axis)return this;var r=ze(e,"mg-y-axis");return u(r,t),f(t),d(r,t),p(r,t),m(r,t),t.y_rug&&a(t),this}function _(t){var e=Ie(t.target);Ye(e,".mg-y-axis");var r=ze(e,"mg-y-axis"),n=r.selectAll("text").data(t.categorical_variables).enter().append("svg:text").attr("x",t.left).attr("y",function(e){return t.scales.Y(e)+t.scales.Y.rangeBand()/2+t.buffer*t.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String);Pe(n,t.rotate_y_labels)}function g(t){return Xe(t,"Y",t.categorical_variables,we(t),t.top,t.padding_percentage,t.outer_padding_percentage),Ee(t,"yf","Y",t.y_accessor),t.y_axis?(_(t),this):this}function v(t){"use strict";t.rug_buffer_size="point"===t.chart_type?t.buffer/2:t.buffer;var e=Ce(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),Fe(e,t,"mg-x-rug-mono")}function x(t){t.processed||(t.processed={})}function y(e){Ee(e,"xf","X",e.x_accessor),st(e);var r=e.utc_time?t.time.scale.utc():t.time.scale();e.scales.X=e.time_series?r:t.scale.linear(),e.scales.X.domain([e.processed.min_x,e.processed.max_x]).range([Ge(e),Oe(e)-e.additional_buffer])}function b(t){"use strict";var e=Ie(t.target);if(x(t),y(t),"point"===t.chart_type&&(M(t),D(t)),Ye(e,".mg-x-axis"),!t.x_axis)return this;var r=ze(e,"mg-x-axis");return t.x_label&&Y(r,t),R(r,t),H(r,t),t.x_rug&&v(t),this}function w(t){var e=Ie(t.target),r=0;"bar"===t.chart_type&&(r=t.buffer+5),Xe(t,"X",t.categorical_variables.reverse(),t.left,Oe(t)-r),Ee(t,"xf","X",t.x_accessor),Ye(e,".mg-x-axis");var n=ze(e,"mg-x-axis");return t.x_axis?(k(n,t,r),this):this}function k(t,e,r){var n=t.selectAll("text").data(e.categorical_variables).enter().append("svg:text");n.attr("x",function(t){return e.scales.X(t)+e.scales.X.rangeBand()/2+e.buffer*e.outer_padding_percentage+r/2}).attr("y",we(e)).attr("dy",".35em").attr("text-anchor","middle").text(String),e.truncate_x_labels&&n.each(function(t,r){var n=this,a=e.scales.X.rangeBand();Ke(n,t,a)}),Pe(n,e.rotate_x_labels)}function M(e){var r,n;null!==e.color_accessor&&(r=A(e),n=G(e),"number"===e.color_type?e.scales.color=t.scale.linear().domain(r).range(n).clamp(!0):(e.scales.color=null!==e.color_range?t.scale.ordinal().range(n):r.length>10?t.scale.category20():t.scale.category10(),e.scales.color.domain(r)),Ee(e,"color","color",e.color_accessor))}function A(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 G(t){var e;return e=null===t.color_range?"number"===t.color_type?["blue","red"]:null:t.color_range}function D(e){var r,n;null!==e.size_accessor&&(r=O(e),n=T(e),e.scales.size=t.scale.linear().domain(r).range(n).clamp(!0),Ee(e,"size","size",e.size_accessor))}function O(e){return null===e.size_domain?t.extent(e.data[0],function(t){return t[e.size_accessor]}):e.size_domain}function T(t){var e;return e=null===t.size_range?[1,5]:t.size_range}function Y(t,e){t.append("text").attr("class","label").attr("x",function(){return(e.left+e.width-e.right)/2}).attr("y",(e.height-e.bottom/2).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return e.x_label})}function z(e){return function(r){if(1>r)return e.xax_units+t.round(r,e.decimals);var n=t.formatPrefix(r);return e.xax_units+n.scale(r)+n.symbol}}function C(t){var e;return e=E(t)?"millis":F(t)?"seconds":X(t)?"less-than-a-day":P(t)?"four-days":$(t)?"many-days":S(t)?"many-months":j(t)?"years":"default"}function E(t){return 10>t}function F(t){return 60>t}function X(t){return 24>=t/3600}function P(t){return 96>=t/3600}function $(t){return 93>=t/86400}function S(t){return 730>t/86400}function j(t){return t/86400>=730}function N(t,e){var r;return r=E(e)?MG.time_format(t,"%M:%S.%L"):F(e)?MG.time_format(t,"%M:%S"):X(e)?MG.time_format(t,"%H:%M"):P(e)?MG.time_format(t,"%H:%M"):$(e)?MG.time_format(t,"%b %d"):S(e)?MG.time_format(t,"%b"):MG.time_format(t,"%Y")}function L(t){var e,r,n;t.time_series&&(e=(t.processed.max_x-t.processed.min_x)/1e3,n=C(e),r=N(t.utc_time,e)),t.processed.main_x_time_format=r,t.processed.x_time_frame=n}function I(e){if(e.xax_format)return e.xax_format;var r=e.processed.original_data||e.data,n=Re(r)[0][e.processed.original_x_accessor||e.x_accessor];return function(r){L(e);var a=t.formatPrefix(r);return n instanceof Date?e.processed.main_x_time_format(new Date(r)):"number"==typeof n?1>r?e.xax_units+t.round(r,e.decimals):(a=t.formatPrefix(r),e.xax_units+a.scale(r)+a.symbol):r}}function R(t,e){"bar"===e.chart_type||e.y_extended_ticks||(B(e,t),q(e,t))}function B(t,e){var r=t.scales.X.ticks(t.xax_count).length-1;t.x_extended_ticks||e.append("line").attr("x1",function(){return 0===t.xax_count?Ge(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?Oe(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 q(t,e){var r=t.scales.X.ticks(t.xax_count);e.selectAll(".mg-xax-ticks").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",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(){return t.x_extended_ticks?"mg-extended-x-ticks":void 0}).classed("mg-xax-ticks",!0)}function H(t,e){U(e,t),Q(e,t)}function U(e,r){var n=e.scales.X.ticks(e.xax_count),a=r.selectAll(".mg-xax-labels").data(n).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 n=new Date(e);return 0===r?t.time.format("%H")(n):""}),a.append("tspan").classed("mg-european-minutes-seconds",!0).text(function(t,r){var n=new Date(t);return":"+e.processed.xax_format(n)})):a.text(function(t){return e.xax_units+e.processed.xax_format(t)}),$e(a)){a.filter(function(t,e){return(e+1)%2===0}).remove();var o=Ie(e.target);o.selectAll(".mg-xax-ticks").filter(function(t,e){return(e+1)%2===0}).remove()}}function Q(t,e){if(t.time_series&&(t.show_years||t.show_secondary_x_label)){var r=Z(t);V(t,e,r.timeframe,r.yformat,r.secondary)}}function Z(e){var r={};switch(r.timeframe=e.processed.x_time_frame,r.timeframe){case"millis":case"seconds":r.secondary=t.time.days,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.time.days,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"four-days":r.secondary=t.time.days,r.yformat=MG.time_format(e.utc_time,"%b %d");break;case"many-days":r.secondary=t.time.years,r.yformat=MG.time_format(e.utc_time,"%Y");break;case"many-months":r.secondary=t.time.years,r.yformat=MG.time_format(e.utc_time,"%Y");break;default:r.secondary=t.time.years,r.yformat=MG.time_format(e.utc_time,"%Y")}return r}function V(t,e,r,n,a){var o=a(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=ze(e,"mg-year-marker");"default"===r&&t.show_year_markers&&W(t,s,o,n),"years"!=r&&J(t,s,o,n)}function W(t,e,r,n){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",ke(t)).attr("y2",be(t))}function J(e,r,n,a){r.selectAll(".mg-year-marker").data(n).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 be(e)+7*e.xax_tick_length/3+.8*r.height}).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return a(new Date(t))})}function K(e,r,n){var a=t.extent(n,function(t){return t[r.x_accessor]});e.min=a[0],e.max=a[1]}function tt(e,r,n){e.min=0,e.max=t.max(n,function(t){var e=[t[r.x_accessor],t[r.baseline_accessor]?t[r.baseline_accessor]:0,t[r.predictor_accessor]?t[r.predictor_accessor]:0];return Math.max.apply(null,e)})}function et(t){var e=MG.clone(t.min).setDate(t.min.getDate()-1),r=MG.clone(t.min).setDate(t.min.getDate()+1);t.min=e,t.max=r}function rt(t){t.min=t.min-1,t.max=t.max+1}function nt(t){t.min=Number(t.min)-1,t.max=Number(t.max)+1}function at(t){t.xax_count=2}function ot(t,e,r){"line"===e.chart_type||"point"===e.chart_type||"histogram"===e.chart_type?K(t,e,r):"bar"===e.chart_type&&tt(t,e,r),t.min!==t.max||e.min_x&&e.max_x||(t.min instanceof Date?et(t):"number"==typeof min_x?rt(t):"string"==typeof min_x&&nt(t),at(e))}function it(t){var e=Re(t.data),r={};ot(r,t,e),r.min=t.min_x||r.min,r.max=t.max_x||r.max,t.x_axis_negative=!1,t.processed.min_x=r.min,t.processed.max_x=r.max}function st(t){it(t),lt(t),MG.call_hook("x_axis.process_min_max",t,t.processed.min_x,t.processed.max_x),t.time_series||t.processed.min_x<0&&(t.processed.min_x=t.processed.min_x-t.processed.max_x*(t.inflator-1),t.x_axis_negative=!0),"bar"===t.chart_type?t.additional_buffer=5*t.buffer:t.additional_buffer=0}function lt(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=I(t):"bar"===e&&(t.processed.xax_format=z(t)))}function ct(t){var e={target:null,title:null,description:null};return t||(t={}),t.processed||(t.processed={}),t=Ve(t,e)}function ut(t){var e=Re(t.processed.original_data||t.data)[0];t.time_series=e[t.processed.original_x_accessor||t.x_accessor]instanceof Date}function ft(t){var e=t.width;t.full_width&&(e=Qe(t.target)),t.width=e}function dt(t){var e=t.height;t.full_height&&(e=Ze(t.target)),"bar"===t.chart_type&&null===e&&(e=t.height=t.data[0].length*t.bar_height+t.top+t.bottom),t.height=e}function pt(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 mt(e,r){return Ie(r.target).empty()&&(e=t.select(r.target).append("svg").classed("linked",r.linked).attr("width",r.width).attr("height",r.height)),e}function ht(t,e){t.selectAll(".mg-clip-path").remove(),t.append("defs").attr("class","mg-clip-path").append("clipPath").attr("id","mg-plot-window-"+qe(e.target)).append("svg:rect").attr("x",e.left).attr("y",e.top).attr("width",e.width-e.left-e.right-e.buffer).attr("height",e.height-e.top-e.bottom-e.buffer+1)}function _t(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 gt(t,e){t.attr("viewBox","0 0 "+e.width+" "+e.height),(e.full_width||e.full_height)&&t.attr("preserveAspectRatio","xMinYMin meet")}function vt(t){t.classed("mg-missing",!1),t.selectAll(".mg-missing-text").remove(),t.selectAll(".mg-missing-pane").remove()}function xt(t,e){var r=0;if(t.selectAll(".mg-main-line")[0].length>=e.data.length)if(e.custom_line_color_map.length>0){var n=function(t){for(var e=new Array(t),r=0;r<e.length;r++)e[r]=r+1;return e},a=We(n(e.max_data_size),e.custom_line_color_map);for(r=0;r<a.length;r++)t.selectAll(".mg-main-line.mg-line"+a[r]+"-color").remove()}else{var o=e.data.length,i=t.selectAll(".mg-main-line")[0].length;for(r=i;r>o;r--)t.selectAll(".mg-main-line.mg-line"+r+"-color").remove()}}function yt(t,e){return t.empty()?void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.'):void 0}function bt(e){"use strict";e=arguments[0],e=ct(e);var r=t.select(e.target);yt(r,e);var a=r.selectAll("svg");return ut(e),ft(e),dt(e),pt(a,e),a=mt(a,e),ht(a,e),_t(a,e),gt(a,e),vt(a),n(e),xt(a,e),this}function wt(t){return t.label}function kt(t){t.selectAll(".mg-markers").remove(),t.selectAll(".mg-baselines").remove()}function Mt(t){return function(e){return t.scales.X(e[t.x_accessor])>Ge(t)&&t.scales.X(e[t.x_accessor])<Oe(t)}}function At(t){return function(e){return t.scales.X(e[t.x_accessor])}}function Gt(t){var e=At(t);return function(t){return e(t).toFixed(2)}}function Dt(t){var e=t.scales.Y;return function(t){return e(t.value).toFixed(2)}}function Ot(t,e,r,n,a,o){var i;t&&(i=n.append("g").attr("class",e),a(i,r),o(i,r))}function Tt(t,e){Ot(t.markers,"mg-markers",t,e,zt,Ct)}function Yt(t,e){Ot(t.baselines,"mg-baselines",t,e,Et,Ft)}function zt(t,e){var r=Gt(e);t.selectAll(".mg-markers").data(e.markers.filter(Mt(e))).enter().append("line").attr("x1",r).attr("x2",r).attr("y1",e.top).attr("y2",we(e)).attr("class",function(t){return t.lineclass}).attr("stroke-dasharray","3,1")}function Ct(e,r){e.selectAll(".mg-markers").data(r.markers.filter(Mt(r))).enter().append("text").attr("class",function(t){return t.textclass||""}).classed("mg-marker-text",!0).attr("x",At(r)).attr("y",.95*r.top).attr("text-anchor","middle").text(wt).each(function(e){e.click&&t.select(this).style("cursor","pointer").on("click",e.click)}),Se(e.selectAll(".mg-marker-text")[0],r)}function Et(t,e){var r=Dt(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("line").attr("x1",Ge(e)).attr("x2",Oe(e)).attr("y1",r).attr("y2",r)}function Ft(t,e){var r=Dt(e);t.selectAll(".mg-baselines").data(e.baselines).enter().append("text").attr("x",Oe(e)).attr("y",r).attr("dy",-3).attr("text-anchor","end").text(wt)}function Xt(t){"use strict";var e=Ie(t.target);return kt(e),Tt(t,e),Yt(t,e),this}function Pt(t,e){var r="",n=null;return 3===arguments.length&&(n=arguments[2]),r=t.append("tspan").text(e),null!==n&&r.classed(n,!0),function(){return this.tspan=r,this.bold=function(){return this.tspan.attr("font-weight","bold"),this},this.color=function(t,e){"line"===t.chart_type?this.tspan.classed("mg-hover-line"+e.line_id+"-color",null===t.colors).attr("stroke",null===t.colors?"":t.colors[e.line_id-1]):"point"===t.chart_type&&(null!==t.color_accessor?(this.tspan.attr("fill",t.scalefns.color(e)),this.tspan.attr("stroke",t.scalefns.color(e))):this.tspan.classed("mg-points-mono",!0))},this.x=function(t){return this.tspan.attr("x",t),this},this.y=function(t){return this.tspan.attr("y",t),this},this.elem=function(){return this.tspan},this}()}function $t(t){var e=t.select(".mg-active-datapoint");return e.selectAll("*").remove(),e}function St(t,e,r,n,a,o,i,s,l){var c=0,u=1.1;t.time_series?jt(t,r,n,s,o):Nt(t,r,n,s,o),Pt(r," ").x(0).y(c*u+"em")}function jt(t,e,r,n,a){var o,i=0,s=1.1;Pt(e,r.trim()),i=1;var l;n.values.forEach(function(r){l=e.append("tspan").attr("x",0).attr("y",i*s+"em"),o=ce(t,a,r),Pt(l,"— ").color(t,r),Pt(l,o),i++}),Pt(e," ").x(0).y(i*s+"em")}function Nt(t,e,r,n,a){var o=0,i=1.1;n.values.forEach(function(n){formatted_y=ce(t,a,n),null!==t.y_rollover_format?formatted_y=ar(t.y_rollover_format,n,t.y_accessor):formatted_y=t.yax_units+a(n[t.y_accessor]),sub_container=e.append("tspan").attr("x",0).attr("y",o*i+"em"),formatted_y=ce(t,a,n),Pt(sub_container,"— ").color(t,n),Pt(sub_container,r+" "+formatted_y),o++})}function Lt(t,e,r,n,a,o){var i=le(t),s=$t(e),l=ce(t,i,a),c=ue(t,r,a);t.aggregate_rollover&&t.data.length>1?St(t,e,s,c,l,i,r,a,o):(t.time_series&&s.select("*").remove(),(t.legend||t.label_accessor)&&Pt(s,"line"===t.chart_type?t.legend[a.line_id-1]+" ":a[t.label_accessor]+" ").color(t,a),(t.data.length>1||"point"===t.chart_type)&&Pt(s,n+" ").color(t,a),Pt(s,c,t.time_series?"mg-x-rollover-text":null),Pt(s,l,t.time_series?"mg-y-rollover-text":null))}function It(t){Rt(t)}function Rt(e){function r(){var r=t.select(e.target).select("svg"),n=0!==r.attr("width")?r.attr("height")/r.attr("width"):0,a=Qe(e.target);r.attr("width",a),r.attr("height",n*a)}(e.full_width||e.full_height)&&null===window.onresize&&(window.onresize=r)}function Bt(t){"use strict";if(t.data=MG.clone(t.data),t.array_of_objects=!1,t.array_of_arrays=!1,t.nested_array_of_arrays=!1,t.nested_array_of_objects=!1,ve(t.data)?(t.nested_array_of_objects=t.data.map(function(t){return ye(t)}),t.nested_array_of_arrays=t.data.map(function(t){return ve(t)})):(t.array_of_objects=xe(t.data),t.array_of_arrays=ve(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]),qt(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;e<t.data.length;e++)t.data[e].sort(function(e,r){return e[t.x_accessor]-r[t.x_accessor]});return this}function qt(t){t.y_accessor instanceof Array&&(t.data=t.data.map(function(e){return t.y_accessor.map(function(t){return e.map(function(e){return e=MG.clone(e),void 0!==e[t]?(e.multiline_y_accessor=e[t],e):void 0}).filter(function(t){return void 0!==t})})})[0],t.y_accessor="multiline_y_accessor")}function Ht(e){"use strict";var r,n=t.sum(e.data.map(function(t){return t.length>0&&t[0][e.x_accessor]instanceof Date}))>0;if(e.missing_is_hidden&&(e.interpolate="linear"),(e.missing_is_zero||e.missing_is_hidden)&&"line"===e.chart_type&&n)for(var a=0;a<e.data.length;a++)if(!(e.data[a].length<=1)){var o=e.data[a][0],i=e.data[a][e.data[a].length-1],s=[],l=MG.clone(o[e.x_accessor]).setDate(o[e.x_accessor].getDate()+1),c=e.min_x?e.min_x:l,u=e.max_x?e.max_x:i[e.x_accessor];if(r=C((u-c)/1e3),"default"==r&&null===e.missing_is_hidden_accessor)for(var f=new Date(c);u>=f;f.setDate(f.getDate()+1)){var d={};f.setHours(0,0,0,0),Date.parse(f)===Date.parse(new Date(l))&&s.push(MG.clone(e.data[a][0]));var p=null;e.data[a].forEach(function(t,r){return Date.parse(t[e.x_accessor])===Date.parse(new Date(f))?(p=t,!1):void 0}),p?p[e.missing_is_hidden_accessor]||null===p[e.y_accessor]?(p._missing=!0,s.push(p)):s.push(p):(d[e.x_accessor]=new Date(f),d[e.y_accessor]=0,d._missing=!0,s.push(d))}else for(var m=0;m<e.data[a].length;m+=1){var h=MG.clone(e.data[a][m]);h._missing=e.data[a][m][e.missing_is_hidden_accessor],s.push(h)}e.data[a]=s}return this}function Ut(e){"use strict";var r,n=e.data[0];if(e.binned===!1){if("object"==typeof n[0])r=n.map(function(t){return t[e.x_accessor]});else{if("number"!=typeof n[0])return void console.log("TypeError: expected an array of numbers, found "+typeof n[0]);r=n}var a=t.layout.histogram();e.bins&&(a=a.bins(e.bins)),e.processed_data=a(r).map(function(t){return{x:t.x,y:t.y,dx:t.dx}})}else{e.processed_data=n.map(function(t){return{x:t[e.x_accessor],y:t[e.y_accessor]}});for(var o,i,s=0;s<e.processed_data.length;s++)o=e.processed_data[s],s===e.processed_data.length-1?o.dx=e.processed_data[s-1].dx:(i=e.processed_data[s+1],o.dx=i.x-o.x)}return e.processed||(e.processed={}),e.processed.original_data=e.data,e.processed.original_x_accessor=e.x_accessor,e.processed.original_y_accessor=e.y_accessor,e.data=[e.processed_data],e.x_accessor=e.processed_x_accessor,e.y_accessor=e.processed_y_accessor,this}function Qt(e){"use strict";var r,n={},a=e.data[0],o="vertical"===e.bar_orientation?e.x_accessor:e.y_accessor,i="vertical"===e.bar_orientation?e.y_accessor:e.x_accessor;if(e.categorical_variables=[],e.binned===!1){r="object"==typeof a[0]?a.map(function(t){return t[o]}):a;for(var s,l=0;l<r.length;l++)s=r[l],-1===e.categorical_variables.indexOf(s)&&e.categorical_variables.push(s),n.hasOwnProperty(s)||(n[s]=0),n[s]+=1;n=Object.keys(n).map(function(t){var e={};return e[i]=n[t],e[o]=t,e})}else n=a,e.categorical_variables=t.set(n.map(function(t){return t[o]})).values(),e.categorical_variables.reverse();return e.data=[n],this}function Zt(t){"use strict";var e=t.data[0],r=e.map(function(e){return e[t.x_accessor]}),n=e.map(function(e){return e[t.y_accessor]});return t.least_squares&&(t.ls_line=te(r,n)),this}function Vt(e){var r=Ie(e.target),n=e.data[0],a=t.min(n,function(t){return t[e.x_accessor]}),o=t.max(n,function(t){return t[e.x_accessor]});t.select(e.target).selectAll(".mg-least-squares-line").remove(),r.append("svg:line").attr("x1",e.scales.X(a)).attr("x2",e.scales.X(o)).attr("y1",e.scales.Y(e.ls_line.fit(a))).attr("y2",e.scales.Y(e.ls_line.fit(o))).attr("class","mg-least-squares-line")}function Wt(r){var n=t.select(e(r.target).find("svg").get(0)),a=r.lowess_line,o=t.svg.line().x(function(t){return r.scales.X(t.x)}).y(function(t){return r.scales.Y(t.y)}).interpolate(r.interpolate);n.append("path").attr("d",o(a)).attr("class","mg-lowess-line")}function Jt(e,r,n,a){var o,i,s=[];t.mean(r);for(i=0;i<e.length;i+=1)s.push(1);o=se(e,r,n,a,s);var l=o.x,c=o.y;for(i=0;100>i;i+=1){s=t.zip(c,r).map(function(t){return Math.abs(t[1]-t[0])});var u=t.quantile(s.sort(),.5);s=s.map(function(t){return re(t/(6*u))}),o=se(e,r,n,a,s),l=o.x,c=o.y}return t.zip(l,c).map(function(t){var e={};return e.x=t[0],e.y=t[1],e})}function Kt(t,e,r,n){for(var a=[],o=0;o<t.length;o+=1)a.push(1);se(t,e,r,n,a)}function te(e,r){var n,a,o,i;e.length;n=e[0]instanceof Date?e.map(function(t){return t.getTime()}):e,a=r[0]instanceof Date?r.map(function(t){return t.getTime()}):r;for(var s=t.mean(n),l=t.mean(a),c=0,u=0,f=0;f<n.length;f++)o=n[f],i=a[f],c+=(o-s)*(i-l),u+=(o-s)*(o-s);var d=c/u,p=l-d*s;return{x0:p,beta:d,fit:function(t){return p+t*d}}}function ee(t,e){return t>=0&&1>=t?Math.pow(1-Math.pow(t,e),e):0}function re(t){return ee(t,2)}function ne(t){return ee(t,3)}function ae(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 oe(e,r,n){var a=t.sum(e.map(function(t){return Math.pow(t.w,2)*(t.x-r)*(t.y-n)})),o=t.sum(e.map(function(t){return Math.pow(t.w,2)*Math.pow(t.x-r,2)}));return a/o}function ie(t){var e,r,n=ae(t);r=n.xbar,e=n.ybar;var a=oe(t,r,e);return{beta:a,xbar:r,ybar:e,x0:e-a*r}}function se(e,r,n,a,o){var i=Math.floor(e.length*n),s=e.slice();s.sort(function(t,e){return e>t?-1:t>e?1:0});for(var l,c,u,f,d,p=t.quantile(s,.98),m=t.quantile(s,.02),h=t.zip(e,r,o).sort(),_=Math.abs(p-m)/a,g=m,v=p,x=t.range(g,v,_),y=[],b=0;b<x.length;b+=1){c=x[b],l=h.map(function(t){return[Math.abs(t[0]-c),t[0],t[1],t[2]]}).sort().slice(0,i),d=t.max(l)[0],l=l.map(function(t){return{w:ne(t[0]/d)*t[3],x:t[1],y:t[2]}});var w=ie(l);f=w.x0,u=w.beta,y.push(f+u*c)}return{x:x,y:y}}function le(e){var r;return r="count"===e.format?function(r){var n=r%1!==0,a=t.format("0,000");return r=n?t.round(r,e.decimals):r,a(r)}:function(r){var n=(e.decimals?"."+e.decimals:"")+"%",a=t.format(n);return a(r)}}function ce(t,e,r){var n;return n=null!==t.y_mouseover?t.aggregate_rollover?ar(t.y_mouseover,r,t.y_accessor):ar(t.y_mouseover,r,t.y_accessor):t.time_series?t.aggregate_rollover?e(r[t.y_accessor]):t.yax_units+e(r[t.y_accessor]):t.y_accessor+": "+t.yax_units+e(r[t.y_accessor])}function ue(t,e,r){var n;if(null!==t.x_mouseover)n=t.time_series?t.aggregate_rollover?nr(t.x_mouseover,r,"key",t.utc):nr(t.x_mouseover,r,t.x_accessor,t.utc):ar(t.x_mouseover,r,t.x_accessor);else if(t.time_series){var a;t.aggregate_rollover&&t.data.length>1?a=new Date(r.key):(a=new Date(+r[t.x_accessor]),a.setDate(a.getDate())),n=e(a)+" "}else n=t.x_accessor+": "+r[t.x_accessor]+", ";return n}function fe(e,r){return function(){for(var n=this,a=n.cloneNode(),o=n.getTotalLength()||0,i=(a.setAttribute("d",e),a).getTotalLength()||0,s=[0],l=0,c=r/Math.max(o,i);(l+=c)<1;)s.push(l);s.push(1);var u=s.map(function(e){var r=n.getPointAtLength(e*o),s=a.getPointAtLength(e*i);return t.interpolate([r.x,r.y],[s.x,s.y])});return function(t){return 1>t?"M"+u.map(function(e){return e(t)}).join("L"):e}}}function de(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 pe(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 me(t){return"[object Array]"===Object.prototype.toString.call(t)}function he(t){return"[object Function]"===Object.prototype.toString.call(t)}function _e(t){return me(t)&&0===t.length}function ge(t){return"[object Object]"===Object.prototype.toString.call(t)}function ve(e){var r=e.map(function(t){return me(t)===!0&&t.length>0});return t.sum(r)===e.length}function xe(e){var r=e.map(function(t){return ge(t)===!0});return t.sum(r)===e.length}function ye(t){return _e(t)||xe(t)}function be(t){return t.height-t.bottom}function we(t){return be(t)-t.buffer}function ke(t){return t.top}function Me(t){return ke(t)+t.buffer}function Ae(t){return t.left}function Ge(t){return Ae(t)+t.buffer}function De(t){return t.width-t.right}function Oe(t){return De(t)-t.buffer}function Te(t){t.exit().remove()}function Ye(t,e){t.selectAll(e).remove()}function ze(t,e){return t.append("g").classed(e,!0)}function Ce(t,e){var r=Ie(t.target),n=Re(t.data),a=r.selectAll("line."+e).data(n);return a.enter().append("svg:line").attr("class",e).attr("opacity",.3),Te(a),Te(a),a}function Ee(t,e,r,n){t.scalefns[e]=function(e){return t.scales[r](e[n])}}function Fe(t,e,r){e.color_accessor?(t.attr("stroke",e.scalefns.color),t.classed(r,!1)):(t.attr("stroke",null),t.classed(r,!0))}function Xe(e,r,n,a,o,i,s){e.scales[r]=t.scale.ordinal().domain(n).rangeRoundBands([a,o],i||0,s||0)}function Pe(e,r){r&&e.attr({dy:0,transform:function(){var e=t.select(this);return"rotate("+r+" "+e.attr("x")+","+e.attr("y")+")"}})}function $e(t){t=t[0];for(var e=0;e<t.length;e++)if(Le(t[e],t))return!0;return!1}function Se(e,r){if(e&&1!=e.length)for(var n=0;n<e.length;n++)if(Le(e[n],e)){var a=t.select(e[n]),o=+a.attr("y");o+8>=r.top&&(o=r.top-16),a.attr("y",o)}}function je(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 n,a,o,i=0;i<e.length;i++){a=t.select(e[i]).text();for(var s=0;s<e.length;s++)if(o=t.select(e[s]).text(),n=Ne(e[i],e[s]),n!==!1&&a!==o){var l=t.select(e[i]),c=+l.attr("y");c+=n,l.attr("y",c)}}}}function Ne(t,e){var r=t.getBoundingClientRect(),n=e.getBoundingClientRect();return r.top<=n.bottom&&r.top>=n.top?n.bottom-r.top:!1}function Le(t,e){for(var r=t.getBoundingClientRect(),n=0;n<e.length;n++)if(e[n]!=t){var a=e[n].getBoundingClientRect();if(r.top===a.top&&!(a.left>r.right||a.right<r.left))return!0}return!1}function Ie(e){return t.select(e).select("svg")}function Re(t){var e=[];return e.concat.apply(e,t)}function Be(){return"undefined"==typeof MG._next_elem_id&&(MG._next_elem_id=0),"mg-"+MG._next_elem_id++}function qe(t){return"string"==typeof t?He(t):t instanceof HTMLElement?(target_ref=t.getAttribute("data-mg-uid"),
target_ref||(target_ref=Be(),t.setAttribute("data-mg-uid",target_ref)),target_ref):(console.warn("The specified target should be a string or an HTMLElement.",t),He(t))}function He(t){return t.replace(/[^a-zA-Z0-9 _-]+/g,"").replace(/ +?/g,"")}function Ue(e,r){return Number(t.select(e).style(r).replace(/px/g,""))}function Qe(t){return Ue(t,"width")}function Ze(t){return Ue(t,"height")}function Ve(t){return or(Array.prototype.slice.call(arguments,1),function(e){if(e)for(var r in e)void 0===t[r]&&(t[r]=e[r])}),t}function We(t,e){var r,n=[],a=[];for(r=0;r<e.length;r++)n[e[r]]=!0;for(r=0;r<t.length;r++)n[t[r]]||a.push(t[r]);return a}function Je(t,e){console.warn("Deprecation: "+t+(e?". This feature will be removed in "+e+".":" the near future.")),console.trace()}function Ke(t,e,r){var n,a=0;for(t.textContent=e,n=t.getBBox();n.width>r&&(t.textContent=e.slice(0,--a)+"...",n=t.getBBox(),"..."!==t.textContent););}function tr(e,r,n,a){e.each(function(){for(var e,o=t.select(this),i=o.text().split(n||/\s+/).reverse(),s=[],l=0,c=1.1,u=(o.attr("y"),0),f=o.text(null).append("tspan").attr("x",0).attr("y",u+"em").attr(a||{});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",++l*c+u+"em").attr(a||{}).text(e))})}function er(e){console.log("ERROR : ",e.target," : ",e.error),t.select(e.target).select(".mg-chart-title").append("i").attr("class","fa fa-x fa-exclamation-circle warning")}function rr(t){console.log("INTERNAL ERROR : ",t.target," : ",t.internal_error)}window.MG={version:"2.8.0"},MG.register=r,MG._hooks={},MG.add_hook=function(t,e,r){var n;MG._hooks[t]||(MG._hooks[t]=[]),n=MG._hooks[t];var a=n.filter(function(t){return t.func===e}).length>0;if(a)throw"That function is already registered.";n.push({func:e,context:r})},MG.call_hook=function(t){var e,r=MG._hooks[t],n=[].slice.apply(arguments,[1]);return r&&r.forEach(function(t){if(t.func){var r=e||n;r&&r.constructor!==Array&&(r=[r]),r=[].concat.apply([],r),e=t.func.apply(t.context,r)}}),e||n},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"}},MG.globals.link=!1,MG.globals.version="1.1",MG.charts={},MG.data_graphic=function(t){"use strict";var e={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,bottom:30,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,xax_count:6,xax_tick_length:5,axes_not_compact:!0,yax_count:5,yax_tick_length:5,x_extended_ticks:!1,y_extended_ticks:!1,y_scale_type:"linear",max_x:null,max_y:null,min_x:null,min_y:null,min_y_from_data:!1,point_size:2.5,x_accessor:"date",xax_units:"",x_label:"",x_sort:!0,x_axis:!0,y_axis:!0,y_accessor:"value",y_label:"",yax_units:"",x_rug:!1,y_rug:!1,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:"cardinal",interpolate_tension:.7,custom_line_color_map:[],colors:null,max_data_size:null,aggregate_rollover:!1,show_tooltips:!0};MG.call_hook("global.defaults",e),t||(t={});var r=MG.charts[t.chart_type||e.chart_type];Ve(t,r.defaults,e),t.list&&(t.x_accessor=0,t.y_accessor=1);for(var n in MG.deprecations)if(t.hasOwnProperty(n)){var a=MG.deprecations[n],o="Use of `args."+n+"` has been deprecated",i=a.replacement;if(i&&(t[i]?o+=". The replacement - `args."+i+"` - has already been defined. This definition will be discarded.":t[i]=t[n]),a.warned)continue;a.warned=!0,i&&(o+=" in favor of `args."+i+"`"),Je(o,a.version)}return MG.call_hook("global.before_init",t),new r.descriptor(t),t.data},"undefined"!=typeof jQuery&&(+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),a=n.data("bs.tooltip"),o="object"==typeof e&&e;(a||!/destroy|hide/.test(e))&&(a||n.data("bs.tooltip",a=new r(this,o)),"string"==typeof e&&a[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:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},r.prototype.init=function(e,r,n){if(this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(n),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 a=this.options.trigger.split(" "),o=a.length;o--;){var i=a[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",l="hover"==i?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},r.prototype.getDelegateOptions=function(){var e={},r=this.getDefaults();return this._options&&t.each(this._options,function(t,n){r[t]!=n&&(e[t]=n)}),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);return 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()?void 0:(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 n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var a=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,l=/\s?auto?\s?/i,c=l.test(s);c&&(s=s.replace(l,"")||"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(c){var p=s,m=this.getPosition(this.$viewport);s="bottom"==s&&u.bottom+d>m.bottom?"top":"top"==s&&u.top-d<m.top?"bottom":"right"==s&&u.right+f>m.width?"left":"left"==s&&u.left-f<m.left?"right":s,o.removeClass(p).addClass(s)}var h=this.getCalculatedOffset(s,u,f,d);this.applyPlacement(h,s);var _=function(){var t=a.hoverState;a.$element.trigger("shown.bs."+a.type),a.hoverState=null,"out"==t&&a.leave(a)};t.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",_).emulateTransitionEnd(r.TRANSITION_DURATION):_()}},r.prototype.applyPlacement=function(e,r){var n=this.tip(),a=n[0].offsetWidth,o=n[0].offsetHeight,i=parseInt(n.css("margin-top"),10),s=parseInt(n.css("margin-left"),10);isNaN(i)&&(i=0),isNaN(s)&&(s=0),e.top+=i,e.left+=s,t.offset.setOffset(n[0],t.extend({using:function(t){n.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),n.addClass("in");var l=n[0].offsetWidth,c=n[0].offsetHeight;"top"==r&&c!=o&&(e.top=e.top+o-c);var u=this.getViewportAdjustedDelta(r,e,l,c);u.left?e.left+=u.left:e.top+=u.top;var f=/top|bottom/.test(r),d=f?2*u.left-a+l:2*u.top-o+c,p=f?"offsetWidth":"offsetHeight";n.offset(e),this.replaceArrow(d,n[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 n(){"in"!=a.hoverState&&o.detach(),a.$element.removeAttr("aria-describedby").trigger("hidden.bs."+a.type),e&&e()}var a=this,o=t(this.$tip),i=t.Event("hide.bs."+this.type);return this.$element.trigger(i),i.isDefaultPrevented()?void 0:(o.removeClass("in"),t.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(r.TRANSITION_DURATION):n(),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],n="BODY"==r.tagName,a=r.getBoundingClientRect();null==a.width&&(a=t.extend({},a,{width:a.right-a.left,height:a.bottom-a.top}));var o=n?{top:0,left:0}:e.offset(),i={scroll:n?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},s=n?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},a,i,s,o)},r.prototype.getCalculatedOffset=function(t,e,r,n){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-r/2}:"top"==t?{top:e.top-n,left:e.left+e.width/2-r/2}:"left"==t?{top:e.top+e.height/2-n/2,left:e.left-r}:{top:e.top+e.height/2-n/2,left:e.left+e.width}},r.prototype.getViewportAdjustedDelta=function(t,e,r,n){var a={top:0,left:0};if(!this.$viewport)return a;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,l=e.top+o-i.scroll+n;s<i.top?a.top=i.top-s:l>i.top+i.height&&(a.top=i.top+i.height-l)}else{var c=e.left-o,u=e.left+o+r;c<i.left?a.left=i.left-c:u>i.right&&(a.left=i.left+i.width-u)}return a},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 n=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=r,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=n,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),a=n.data("bs.popover"),o="object"==typeof e&&e;(a||!/destroy|hide/.test(e))&&(a||n.data("bs.popover",a=new r(this,o)),"string"==typeof e&&a[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:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),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 n=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=r,t.fn.popover.noConflict=function(){return t.fn.popover=n,this}}(jQuery)),MG.chart_title=n,MG.y_rug=a,MG.y_axis=h,MG.y_axis_categorical=g,MG.x_rug=v,MG.x_axis=b,MG.x_axis_categorical=w,MG.init=bt,MG.markers=Xt,"undefined"!=typeof jQuery&&+function(t){"use strict";function e(e){e&&3===e.which||(t(a).remove(),t(o).each(function(){var n=t(this),a=r(n),o={relatedTarget:this};a.hasClass("open")&&(a.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(n.attr("aria-expanded","false"),a.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 n=r&&t(r);return n&&n.length?n:e.parent()}function n(e){return this.each(function(){var r=t(this),n=r.data("bs.dropdown");n||r.data("bs.dropdown",n=new i(this)),"string"==typeof e&&n[e].call(r)})}if("function"==typeof t().dropdown)return!0;var a=".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(n){var a=t(this);if(!a.is(".disabled, :disabled")){var o=r(a),i=o.hasClass("open");if(e(),!i){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('<div class="dropdown-backdrop"/>').insertAfter(t(this)).on("click",e);var s={relatedTarget:this};if(o.trigger(n=t.Event("show.bs.dropdown",s)),n.isDefaultPrevented())return;a.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger("shown.bs.dropdown",s)}return!1}},i.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var n=t(this);if(e.preventDefault(),e.stopPropagation(),!n.is(".disabled, :disabled")){var a=r(n),i=a.hasClass("open");if(!i&&27!=e.which||i&&27==e.which)return 27==e.which&&a.find(o).trigger("focus"),n.trigger("click");var s=" li:not(.divider):visible a",l=a.find('[role="menu"]'+s+', [role="listbox"]'+s);if(l.length){var c=l.index(e.target);38==e.which&&c>0&&c--,40==e.which&&c<l.length-1&&c++,~c||(c=0),l.eq(c).trigger("focus")}}}};var s=t.fn.dropdown;t.fn.dropdown=n,t.fn.dropdown.Constructor=i,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=s,this},t(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",o,i.prototype.toggle).on("keydown.bs.dropdown.data-api",o,i.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',i.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',i.prototype.keydown)}(jQuery),MG.button_layout=function(t){"use strict";return this.target=t,this.feature_set={},this.public_name={},this.sorters={},this.manual=[],this.manual_map={},this.manual_callback={},this._strip_punctuation=function(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r},this.data=function(t){return this._data=t,this},this.manual_button=function(t,e,r){return this.feature_set[t]=e,this.manual_map[this._strip_punctuation(t)]=t,this.manual_callback[t]=r,this},this.button=function(t){return arguments.length>1&&(this.public_name[t]=arguments[1]),arguments.length>2&&(this.sorters[t]=arguments[2]),this.feature_set[t]=[],this},this.callback=function(t){return this._callback=t,this},this.display=function(){var t,r,n,a,o=this._callback,i=this.manual_callback,s=this.manual_map;n=Object.keys(this.feature_set);var l,c=function(e){return t[e]};for(l=0;l<this._data.length;l++){t=this._data[l],r=n.map(c);for(var u=0;u<n.length;u++)a=n[u],-1===this.feature_set[a].indexOf(r[u])&&this.feature_set[a].push(r[u])}for(a in this.feature_set)this.sorters.hasOwnProperty(a)&&this.feature_set[a].sort(this.sorters[a]);e(this.target).empty(),e(this.target).append("<div class='col-lg-12 segments text-center'></div>");var f=function(){var t,r=e(this).data("key"),n=e(this).data("feature");return e("."+n+"-btns button.btn span.title").html(r),s.hasOwnProperty(n)?(t=s[n],i[t](r)):o(n,r),!1};for(var d in this.feature_set){for(n=this.feature_set[d],e(this.target+" div.segments").append('<div class="btn-group '+this._strip_punctuation(d)+'-btns text-left"><button type="button" class="btn btn-default btn-lg dropdown-toggle" data-toggle="dropdown"><span class=\'which-button\'>'+(this.public_name.hasOwnProperty(d)?this.public_name[d]:d)+"</span><span class='title'>"+(this.manual_callback.hasOwnProperty(d)?this.feature_set[d][0]:"all")+'</span><span class="caret"></span></button><ul class="dropdown-menu" role="menu">'+(this.manual_callback.hasOwnProperty(d)?"":'<li><a href="#" data-feature="'+d+'" data-key="all">All</a></li>')+(this.manual_callback.hasOwnProperty(d)?"":'<li class="divider"></li>')+"</ul></div>"),l=0;l<n.length;l++)"all"!==n[l]&&void 0!==n[l]&&e(this.target+" div."+this._strip_punctuation(d)+"-btns ul.dropdown-menu").append('<li><a href="#" data-feature="'+this._strip_punctuation(d)+'" data-key="'+n[l]+'">'+n[l]+"</a></li>");e("."+this._strip_punctuation(d)+"-btns .dropdown-menu li a").on("click",f)}return this},this},function(){"use strict";function e(t,e,i){o(t,e),n(t,e),a(t,e),r(t,e,i)}function r(e,r,n){r.existing_band=n.selectAll(".mg-confidence-band"),e.show_confidence_band&&(r.confidence_area=t.svg.area().defined(r.line.defined()).x(e.scalefns.xf).y0(function(t){var r=e.show_confidence_band[0];return e.scales.Y(t[r])}).y1(function(t){var r=e.show_confidence_band[1];return e.scales.Y(t[r])}).interpolate(e.interpolate).tension(e.interpolate_tension))}function n(e,r){r.area=t.svg.area().defined(r.line.defined()).x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).interpolate(e.interpolate).tension(e.interpolate_tension)}function a(e,r){r.flat_line=t.svg.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)}).interpolate(e.interpolate).tension(e.interpolate_tension)}function o(e,r){r.line=t.svg.line().x(e.scalefns.xf).y(e.scalefns.yf).interpolate(e.interpolate).tension(e.interpolate_tension),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 i(t,e,r,n){var a;t.show_confidence_band&&(a=e.existing_band.empty()?r.append("path").attr("class","mg-confidence-band"):e.existing_band.transition().duration(function(){return t.transition_on_update?1e3:0}),a.attr("d",e.confidence_area(t.data[n])).attr("clip-path","url(#mg-plot-window-"+qe(t.target)+")"))}function s(t,e,r,n,a){var o=r.selectAll(".mg-main-area.mg-area"+a);e.display_area?o.empty()?r.append("path").classed("mg-main-area",!0).classed("mg-area"+a,!0).classed("mg-area"+a+"-color",null===t.colors).attr("d",e.area(t.data[n])).attr("fill",null===t.colors?"":t.colors[a-1]).attr("clip-path","url(#mg-plot-window-"+qe(t.target)+")"):(r.node().appendChild(o.node()),o.transition().duration(e.update_transition_duration).attr("d",e.area(t.data[n])).attr("clip-path","url(#mg-plot-window-"+qe(t.target)+")")):o.empty()||o.remove()}function l(t,e){t.classed("mg-line"+e+"-color",!0)}function c(t,e,r,n){t.colors&&t.colors.constructor===Array?(e.attr("stroke",t.colors[r]),t.colors.length<r+1&&l(e,n)):l(e,n)}function u(e,r,n,a){e.animate_on_load?(r.data_median=t.median(e.data[a],function(t){return t[e.y_accessor]}),n.attr("d",r.flat_line(e.data[a])).transition().duration(1e3).attr("d",r.line(e.data[a])).attr("clip-path","url(#mg-plot-window-"+qe(e.target)+")")):n.attr("d",r.line(e.data[a])).attr("clip-path","url(#mg-plot-window-"+qe(e.target)+")")}function f(t,e,r,n,a,o){if(n.empty()){var i=r.append("path").attr("class","mg-main-line mg-line"+o);c(t,i,a,o),u(t,e,i,a)}else{r.node().appendChild(n.node());var s=n.transition().duration(e.update_transition_duration);!e.display_area&&t.transition_on_update?s.attrTween("d",fe(e.line(t.data[a]),4)):s.attr("d",e.line(t.data[a]))}}function d(t,e,r,n){var a;if(t.legend)if(me(t.legend)?a=t.legend[r]:he(t.legend)&&(a=t.legend(t.data[r])),t.legend_target)t.colors&&t.colors.constructor===Array?e.legend_text="<span style='color:"+t.colors[r]+"'>&mdash; "+a+"&nbsp; </span>"+e.legend_text:e.legend_text="<span class='mg-line"+n+"-legend-color'>&mdash; "+a+"&nbsp; </span>"+e.legend_text;else{var o=t.data[r][t.data[r].length-1],i=e.legend_group.append("svg:text").attr("x",t.scalefns.xf(o)).attr("dx",t.buffer).attr("y",t.scalefns.yf(o)).attr("dy",".35em").attr("font-size",10).attr("font-weight","300").text(a);t.colors&&t.colors.constructor===Array?t.colors.length<r+1?i.classed("mg-line"+n+"-legend-color",!0):i.attr("fill",t.colors[r]):i.classed("mg-line"+n+"-legend-color",!0),je(e.legend_group.selectAll(".mg-line-legend text")[0],t)}}function p(e,r){e&&t.select(e).html(r)}function m(t,e,r){t.legend&&(e.legend_group=ze(r,"mg-line-legend"))}function _(t){Ye(t,".mg-rollover-rect"),Ye(t,".mg-voronoi"),Ye(t,".mg-active-datapoint"),Ye(t,".mg-line-rollover-circle"),Ye(t,".mg-active-datapoint-container")}function g(e,r){var n=ze(r,"mg-active-datapoint-container").append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("text-anchor","end"),a=.75;if(e.markers){var o;r.selectAll(".mg-marker-text").each(function(){o?o!==t.select(this).attr("y")&&(a=.56):o=t.select(this).attr("y")})}n.attr("transform","translate("+Oe(e)+","+ke(e)*a+")")}function v(t,e){var r=e.selectAll(".mg-line-rollover-circle").data(t.data).enter().append("circle").attr({cx:0,cy:0,r:0});t.colors&&t.colors.constructor===Array?r.attr("class",function(t){return"mg-line"+t.line_id}).attr("fill",function(e,r){return t.colors[r]}).attr("stroke",function(e,r){return t.colors[r]}):r.attr("class",function(t,e){return["mg-line"+t.line_id,"mg-line"+t.line_id+"-color","mg-area"+t.line_id+"-color"].join(" ")}),r.classed("mg-line-rollover-circle",!0)}function x(t){for(var e=1,r=0;r<t.data.length;r++){for(var n=0;n<t.data[r].length;n++)t.custom_line_color_map.length>0?t.data[r][n].line_id=t.custom_line_color_map[r]:t.data[r][n].line_id=e;e++}}function y(e){return t.nest().key(function(t){return e.scales.X(t[e.x_accessor])+","+e.scales.Y(t[e.y_accessor])}).rollup(function(t){return t[0]}).entries(t.merge(e.data.map(function(t){return t}))).map(function(t){return t.values})}function w(t){return function(e){var r;if(t.linked){var n=e[t.x_accessor],a=MG.time_format(t.utc_time,t.linked_format),o="number"==typeof n?e.line_id-1:a(n);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 k(e,r,n,a,o){var i=t.geom.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)}).clipExtent([[e.buffer,e.buffer+e.title_y_position],[e.width-e.buffer,e.height-e.buffer]]),s=ze(r,"mg-voronoi");s.selectAll("path").data(i(y(e))).enter().append("path").filter(function(t){return void 0!==t&&t.length>0}).attr("d",function(t){return"M"+t.join("L")+"Z"}).datum(function(t){return t.point}).attr("class",w(e)).on("mouseover",n).on("mouseout",a).on("mousemove",o),D(e,r)}function M(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 A(t,e,r,n,a){var o=M(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?Ge(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?Oe(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(r){var n=O(e.line_id);return null===t.colors&&(n+=" "+T(r.line_id)),n}).join(" ");return t.linked&&e.values.length>0&&(r+=" "+Y(z(e.values[0],0,t))),r}).attr("height",t.height-t.bottom-t.top-t.buffer).attr("opacity",0).on("mouseover",r).on("mouseout",n).on("mousemove",a),E(t,e)}function G(t,e){e.select(".mg-rollover-rect rect").on("mouseover")(t.data[0][0],0)}function D(t,e){for(var r=0;r<t.data.length;r++){var n=r+1;t.custom_line_color_map.length>0&&void 0!==t.custom_line_color_map[r]&&(n=t.custom_line_color_map[r]),1!==t.data[r].length||e.selectAll(".mg-voronoi .mg-line"+n).empty()||(e.selectAll(".mg-voronoi .mg-line"+n).on("mouseover")(t.data[r][0],0),e.selectAll(".mg-voronoi .mg-line"+n).on("mouseout")(t.data[r][0],0))}}function O(t){return"mg-line"+t}function T(t){return"mg-line"+t+"-color"}function Y(t){return"roll_"+t}function z(t,e,r){var n=t[r.x_accessor],a=MG.time_format(r.utc_time,r.linked_format),o="number"==typeof n?e:a(n);return o}function C(t,e,r,n,a){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 n=T(o)+" "+O(e.line_id);return t.linked&&(n+=n+" "+Y(z(e,r,t))),n}).attr("x",function(e,r){return 1===s.length?Ge(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?Oe(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",n).on("mousemove",a),P(t)&&G(t,e)}function E(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 F(t){return t.data.length>1&&!t.aggregate_rollover}function X(t){return t.data.length>1&&t.aggregate_rollover}function P(t){return 1===t.data.length&&1===t.data[0].length}function $(t,e,r){for(var n=t.data.length-1;n>=0;n--){var a=t.data[n];MG.call_hook("line.before_each_series",[a,t]);var o=n+1;if(t.custom_line_color_map.length>0&&(o=t.custom_line_color_map[n]),t.data[n].line_id=o,0!==a.length){var l=r.select("path.mg-main-line.mg-line"+o);i(t,e,r,n),s(t,e,r,n,o),f(t,e,r,l,n,o),d(t,e,n,o),MG.call_hook("line.after_each_series",[a,l,t])}}}function S(t){var r={},n=Ie(t.target);Ye(n,".mg-line-legend"),m(t,r,n),r.data_median=0,r.update_transition_duration=t.transition_on_update?1e3:0,r.display_area=t.area&&!t.use_data_y_min&&t.data.length<=1,r.legend_text="",e(t,r,n),r.existing_band=n.selectAll(".mg-confidence-band");var a=MG.call_hook("line.before_all_series",[t]);a!==!1&&$(t,r,n),p(t.legend_target,r.legend_text)}function j(t,e){var r=Ie(t.target);_(r),g(t,r),v(t,r),x(t),F(t)?k(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):X(t)?A(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t)):C(t,r,e.rolloverOn(t),e.rolloverOff(t),e.rolloverMove(t))}function N(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){pe(r,t)&&L(t,e,r)});else{if(t.missing_is_hidden&&r._missing||null===r[t.y_accessor])return;pe(r,t)&&I(t,e,r)}}function L(t,e,r){e.select("circle.mg-line-rollover-circle.mg-line"+r.line_id).attr({cx:function(){return t.scales.X(r[t.x_accessor]).toFixed(2)},cy:function(){return t.scales.Y(r[t.y_accessor]).toFixed(2)},r:t.point_size}).style("opacity",1)}function I(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 R(e,r,n){if(e.linked&&!MG.globals.link&&(MG.globals.link=!0,!e.aggregate_rollover||void 0!==r.value||r.values.length>0)){var a=r.values?r.values[0]:r,o=z(a,n,e);t.selectAll("."+O(a.line_id)+"."+Y(o)).each(function(e){t.select(this).on("mouseover")(e,n)})}}function B(e,r,n){if(e.linked&&MG.globals.link){MG.globals.link=!1;var a=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?n:a(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})})}}function q(t,e){e.selectAll("circle.mg-line-rollover-circle").style("opacity",0)}function H(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 U(t){t.select(".mg-active-datapoint").text("")}function Q(t){this.init=function(t){return this.args=t,t.data&&0!==t.data.length?(t.internal_error=void 0,Bt(t),Ht(t),bt(t),b(t),h(t),this.markers(),this.mainPlot(),this.rollover(),this.windowListeners(),MG.call_hook("line.after_init",this),this):(t.internal_error="No data was supplied",rr(t),this)},this.mainPlot=function(){return S(t),this},this.markers=function(){return Xt(t),this},this.rollover=function(){var e=this;
return j(t,e),MG.call_hook("line.after_rollover",t),this},this.rolloverOn=function(t){var e=Ie(t.target),r=de(t);return function(n,a){N(t,e,n),R(t,n,a),e.selectAll("text").filter(function(t,e){return n===t}).attr("opacity",.3),t.show_rollover_text&&Lt(t,e,r,"— ",n,a),t.mouseover&&t.mouseover(n,a)}},this.rolloverOff=function(t){var e=Ie(t.target);return function(r,n){B(t,r,n),t.aggregate_rollover?q(t,e):H(t,e,r),U(e),t.mouseout&&t.mouseout(r,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return It(this.args),this},this.init(t)}MG.register("line",Q)}.call(this),function(){"use strict";function r(r){this.init=function(t){return this.args=t,Bt(t),Ut(t),bt(t),b(t),h(t),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var t=Ie(r.target);t.selectAll(".mg-histogram").remove();var e=t.append("g").attr("class","mg-histogram"),n=e.selectAll(".mg-bar").data(r.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+r.scales.X(t[r.x_accessor]).toFixed(2)+","+r.scales.Y(t[r.y_accessor]).toFixed(2)+")"});return n.append("rect").attr("x",1).attr("width",function(t,e){return 1===r.data[0].length?(r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2):(r.scalefns.xf(r.data[0][1])-r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2)}).attr("height",function(t){return 0===t[r.y_accessor]?0:(r.height-r.bottom-r.buffer-r.scales.Y(t[r.y_accessor])).toFixed(2)}),this},this.markers=function(){return Xt(r),this},this.rollover=function(){var t=Ie(r.target);e(e(r.target).find("svg").get(0));t.selectAll(".mg-rollover-rect").remove(),t.selectAll(".mg-active-datapoint").remove(),t.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",r.width-r.right).attr("y",.75*r.top).attr("text-anchor","end");var n=t.append("g").attr("class","mg-rollover-rect"),a=n.selectAll(".mg-bar").data(r.data[0]).enter().append("g").attr("class",function(t,e){return r.linked?"mg-rollover-rects roll_"+e:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+r.scales.X(t[r.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",r.buffer+r.title_y_position).attr("width",function(t,e){return 1===r.data[0].length?(r.scalefns.xf(r.data[0][0])-r.bar_margin).toFixed(2):e!==r.data[0].length-1?(r.scalefns.xf(r.data[0][e+1])-r.scalefns.xf(t)).toFixed(2):(r.scalefns.xf(r.data[0][1])-r.scalefns.xf(r.data[0][0])).toFixed(2)}).attr("height",function(t){return r.height}).attr("opacity",0).on("mouseover",this.rolloverOn(r)).on("mouseout",this.rolloverOff(r)).on("mousemove",this.rolloverMove(r)),this},this.rolloverOn=function(e){var r=Ie(e.target);return function(n,a){r.selectAll("text").filter(function(t,e){return n===t}).attr("opacity",.3);var o=e.processed.xax_format||MG.time_format(e.utc_time,"%b %e, %Y"),i=le(e);r.selectAll(".mg-bar rect").filter(function(t,e){return e===a}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+a+" rect").each(function(e){t.select(this).on("mouseover")(e,a)})),e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+n[e.x_accessor]);return t.setDate(t.getDate()),o(t)+" "+e.yax_units+i(n[e.y_accessor])}return e.x_accessor+": "+i(n[e.x_accessor])+", "+e.y_accessor+": "+e.yax_units+i(n[e.y_accessor])}),e.mouseover&&e.mouseover(n,a)}},this.rolloverOff=function(e){var r=Ie(e.target);return function(n,a){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+a+" rect").each(function(e){t.select(this).on("mouseout")(e,a)})),r.selectAll(".mg-bar rect").classed("active",!1),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(n,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return It(this.args),this},this.init(r)}var n={mouseover:function(e,r){t.select("#histogram svg .mg-active-datapoint").text("Frequency Count: "+e.y)},binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1};MG.register("histogram",r,n)}.call(this),function(){"use strict";function e(e){this.init=function(t){return this.args=t,Bt(t),Zt(t),bt(t),b(t),h(t),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.markers=function(){return Xt(e),e.least_squares&&Vt(e),this},this.mainPlot=function(){var t,r=Ie(e.target);r.selectAll(".mg-points").remove(),t=r.append("g").classed("mg-points",!0);var n=t.selectAll("circle").data(e.data[0]).enter().append("svg:circle").attr("class",function(t,e){return"path-"+e}).attr("cx",e.scalefns.xf).attr("cy",e.scalefns.yf);return null!==e.color_accessor?(n.attr("fill",e.scalefns.color),n.attr("stroke",e.scalefns.color)):n.classed("mg-points-mono",!0),null!==e.size_accessor?n.attr("r",e.scalefns.size):n.attr("r",e.point_size),this},this.rollover=function(){var r=Ie(e.target);r.selectAll(".mg-voronoi").remove(),r.selectAll(".mg-active-datapoint").remove(),r.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",e.width-e.right).attr("y",.75*e.top).attr("text-anchor","end");var n=t.geom.voronoi().x(e.scalefns.xf).y(e.scalefns.yf).clipExtent([[e.buffer,e.buffer+e.title_y_position],[e.width-e.buffer,e.height-e.buffer]]),a=r.append("g").attr("class","mg-voronoi");return a.selectAll("path").data(n(e.data[0])).enter().append("path").attr("d",function(t){return void 0!==t?"M"+t.join(",")+"Z":void 0}).attr("class",function(t,e){return"path-"+e}).style("fill-opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=Ie(e.target);return function(n,a){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+a).classed("selected",!0);if(e.size_accessor?o.attr("r",function(t){return e.scalefns.size(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-"+a).each(function(){t.select(this).on("mouseover")(n,a)})),e.show_rollover_text){var i=MG.time_format(e.utc_time,"%b %e, %Y");Lt(e,r,i,"•",n.point,a)}e.mouseover&&e.mouseover(n,a)}},this.rolloverOff=function(e){var r=Ie(e.target);return function(n,a){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-voronoi .path-"+a).each(function(){t.select(this).on("mouseout")(n,a)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.size):o.attr("r",e.point_size),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(n,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.update=function(t){return this},this.windowListeners=function(){return It(this.args),this},this.init(e)}var r={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",e,r)}.call(this),function(){"use strict";function t(t){this.args=t,this.init=function(t){return this.args=t,Bt(t),Qt(t),bt(t),this.is_vertical="vertical"===t.bar_orientation,this.is_vertical?(w(t),h(t)):(b(t),g(t)),this.mainPlot(),this.markers(),this.rollover(),this.windowListeners(),this},this.mainPlot=function(){var e,r,n,a,o,i=Ie(t.target),s=t.data[0],l=i.select("g.mg-barplot"),c=l.empty(),u=c&&t.animate_on_load,f=u||t.transition_on_update,d=t.transition_duration||1e3;c&&(l=i.append("g").classed("mg-barplot",!0)),e=e=l.selectAll(".mg-bar").data(s),e.exit().remove(),e.enter().append("rect").classed("mg-bar",!0),t.predictor_accessor&&(r=l.selectAll(".mg-bar-prediction").data(s),r.exit().remove(),r.enter().append("rect").classed("mg-bar-prediction",!0)),t.baseline_accessor&&(o=l.selectAll(".mg-bar-baseline").data(s),o.exit().remove(),o.enter().append("line").classed("mg-bar-baseline",!0));var p;return f&&(e=e.transition().duration(d),r&&(r=r.transition().duration(d)),o&&(o=o.transition().duration(d))),i.select(".mg-y-axis").node().parentNode.appendChild(l.node()),this.is_vertical?(p=t.scales.X.rangeBand()/1.5,u&&(e.attr({height:0,y:t.scales.Y(0)}),r&&r.attr({height:0,y:t.scales.Y(0)}),o&&o.attr({y1:t.scales.Y(0),y2:t.scales.Y(0)})),e.attr("y",t.scalefns.yf).attr("x",function(e){return t.scalefns.xf(e)+p/2}).attr("width",p).attr("height",function(e){return 0-(t.scalefns.yf(e)-t.scales.Y(0))}),t.predictor_accessor&&(n=t.predictor_proportion,a=n-1,r.attr("y",function(e){return t.scales.Y(0)-(t.scales.Y(0)-t.scales.Y(e[t.predictor_accessor]))}).attr("x",function(e){return t.scalefns.xf(e)+a*p/(2*n)+p/2}).attr("width",p/n).attr("height",function(e){return 0-(t.scales.Y(e[t.predictor_accessor])-t.scales.Y(0))})),t.baseline_accessor&&(n=t.predictor_proportion,o.attr("x1",function(e){return t.scalefns.xf(e)+p/2-p/n+p/2}).attr("x2",function(e){return t.scalefns.xf(e)+p/2+p/n+p/2}).attr("y1",function(e){return t.scales.Y(e[t.baseline_accessor])}).attr("y2",function(e){return t.scales.Y(e[t.baseline_accessor])}))):(p=t.scales.Y.rangeBand()/1.5,u&&(e.attr("width",0),r&&r.attr("width",0),o&&o.attr({x1:t.scales.X(0),x2:t.scales.X(0)})),e.attr("x",t.scales.X(0)).attr("y",function(e){return t.scalefns.yf(e)+p/2}).attr("height",p).attr("width",function(e){return t.scalefns.xf(e)-t.scales.X(0)}),t.predictor_accessor&&(n=t.predictor_proportion,a=n-1,r.attr("x",t.scales.X(0)).attr("y",function(e){return t.scalefns.yf(e)+a*p/(2*n)+p/2}).attr("height",p/n).attr("width",function(e){return t.scales.X(e[t.predictor_accessor])-t.scales.X(0)})),t.baseline_accessor&&(n=t.predictor_proportion,o.attr("x1",function(e){return t.scales.X(e[t.baseline_accessor])}).attr("x2",function(e){return t.scales.X(e[t.baseline_accessor])}).attr("y1",function(e){return t.scalefns.yf(e)+p/2-p/n+p/2}).attr("y2",function(e){return t.scalefns.yf(e)+p/2+p/n+p/2}))),this},this.markers=function(){return Xt(t),this},this.rollover=function(){var e,r=Ie(t.target);r.selectAll(".mg-rollover-rect").remove(),r.selectAll(".mg-active-datapoint").remove(),r.append("text").attr("class","mg-active-datapoint").attr("xml:space","preserve").attr("x",t.width-t.right).attr("y",.75*t.top).attr("dy",".35em").attr("text-anchor","end"),e=r.append("g").attr("class","mg-rollover-rect");var n=e.selectAll(".mg-bar-rollover").data(t.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return this.is_vertical?n.attr("x",t.scalefns.xf).attr("y",function(){return t.scales.Y(0)-t.height}).attr("width",t.scales.X.rangeBand()).attr("height",t.height).attr("opacity",0).on("mouseover",this.rolloverOn(t)).on("mouseout",this.rolloverOff(t)).on("mousemove",this.rolloverMove(t)):n.attr("x",t.scales.X(0)).attr("y",t.scalefns.yf).attr("width",t.width).attr("height",t.scales.Y.rangeBand()+2).attr("opacity",0).on("mouseover",this.rolloverOn(t)).on("mouseout",this.rolloverOff(t)).on("mousemove",this.rolloverMove(t)),this},this.rolloverOn=function(t){var e=Ie(t.target),r=this.is_vertical?t.x_accessor:t.y_accessor,n=this.is_vertical?t.y_accessor:t.x_accessor,a=this.is_vertical?t.yax_units:t.xax_units;return function(o,i){e.selectAll("text").filter(function(t,e){return o===t}).attr("opacity",.3);var s=MG.time_format(t.utc_time,"%b %e, %Y"),l=le(t);e.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===i}).classed("active",!0),t.show_rollover_text&&e.select(".mg-active-datapoint").text(function(){if(t.time_series){var e=new Date(+o[n]);return e.setDate(e.getDate()),s(e)+" "+a+l(o[r])}return o[r]+": "+l(o[n])}),t.mouseover&&t.mouseover(o,i)}},this.rolloverOff=function(t){var e=Ie(t.target);return function(r,n){e.selectAll("g.mg-barplot .mg-bar").classed("active",!1),e.select(".mg-active-datapoint").text(""),t.mouseout&&t.mouseout(r,n)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return It(this.args),this},this.init(t)}var e={y_accessor:"factor",x_accessor:"value",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,dodge_accessor:null,binned:!0,padding_percentage:0,outer_padding_percentage:.1,height:500,bar_height:20,top:45,left:70,truncate_x_labels:!0,truncate_y_labels:!0,rotate_x_labels:0,rotate_y_labels:0};MG.register("bar",t,e)}.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(n){var a=n[0],o=n[1];r[o]&&t.style(a,"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,n=Ve(MG.clone(t),MG.clone(r));n.type=e,this.args.columns.push(n)},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;n(r);var a,o,i,s,l,c,u,f,d,p,m,h,_=r.target,g=t.select(_).append("table").classed("mg-data-table",!0),v=g.append("colgroup"),x=g.append("thead"),y=g.append("tbody");for(i=x.append("tr"),h=0;h<r.columns.length;h++){var b=r.columns[h];c=b.type,f=b.label,f=void 0===f?"":f,s=i.append("th").style("width",b.width).style("text-align","title"===c?"left":"right").text(f),r.show_tooltips&&b.description&&(s.append("i").classed("fa",!0).classed("fa-question-circle",!0).classed("fa-inverse",!0),e(s[0]).popover({html:!0,animation:!1,content:b.description,trigger:"hover",placement:"top",container:e(s[0])}))}for(h=0;h<r.columns.length;h++)m=v.append("col"),"number"===r.columns[h].type&&m.attr("align","char").attr("char",".");for(var w=0;w<r.data.length;w++){i=y.append("tr");for(var k=0;k<r.columns.length;k++){if(a=r.columns[k],l=a.accessor,u=d=r.data[w][l],c=a.type,"number"===c){if(a.hasOwnProperty("round")&&!a.hasOwnProperty("format")&&(d=t.format("0,."+a.round+"f")(d)),a.hasOwnProperty("value_formatter")&&(d=a.value_formatter(d)),a.hasOwnProperty("format")){a.round&&(d=t.round(d,a.round));var M,A=a.format;"percentage"===A&&(M=t.format("%p")),"count"===A&&(M=t.format("0,000")),"temperature"===A&&(M=function(t){return t+"°"}),d=M(d)}a.hasOwnProperty("currency")&&(d=a.currency+d)}p=i.append("td").classed("table-"+c,!0).classed("table-"+c+"-"+this._strip_punctuation(l),!0).attr("data-value",u).style("width",a.width).style("text-align","title"===c||"text"===c?"left":"right"),this._format_element(p,u,a),"title"===c?(o=p.append("div").text(d),this._format_element(o,d,a),r.columns[k].hasOwnProperty("secondary_accessor")&&p.append("div").text(r.data[w][r.columns[k].secondary_accessor]).classed("secondary-title",!0)):p.text(d)}}return this},this},function(){"use strict";function e(t,e){t.selectAll(".mg-missing-text").data([e.missing_text]).enter().append("text").attr("class","mg-missing-text").attr("x",e.width/2).attr("y",e.height/2).attr("dy",".50em").attr("text-anchor","middle").text(e.missing_text)}function r(e){e.scales.X=t.scale.linear().domain([0,e.data.length]).range([Ge(e),Oe(e)]),e.scalefns.yf=function(t){return e.scales.Y(t.y)}}function a(e){e.scales.Y=t.scale.linear().domain([-2,2]).range([e.height-e.bottom-2*e.buffer,e.top]),e.scalefns.xf=function(t){return e.scales.X(t.x)}}function o(t){for(var e=[],r=1;50>=r;r++)e.push({x:r,y:Math.random()-.03*r});t.data=e}function i(t,e){t.append("svg:rect").classed("mg-missing-background",!0).attr("x",e.buffer).attr("y",e.buffer).attr("width",e.width-2*e.buffer).attr("height",e.height-2*e.buffer).attr("rx",15).attr("ry",15)}function s(e,r){var n=t.svg.line().x(r.scalefns.xf).y(r.scalefns.yf).interpolate(r.interpolate);e.append("path").attr("class","mg-main-line mg-line1-color").attr("d",n(r.data))}function l(e,r){var n=t.svg.area().x(r.scalefns.xf).y0(r.scales.Y.range()[0]).y1(r.scalefns.yf).interpolate(r.interpolate);e.append("path").attr("class","mg-main-area mg-area1-color").attr("d",n(r.data))}function c(e){t.select(e.target).selectAll("svg *").remove()}function u(e){e.legend_target&&t.select(e.legend_target).html("")}function f(f){this.init=function(f){this.args=f,ft(f),dt(f),n(f);var d=t.select(f.target);yt(d,f);var p=d.selectAll("svg");if(pt(p,f),p=mt(p,f),_t(p,f),gt(p,f),c(f),p.classed("mg-missing",!0),u(f),f.show_missing_background){o(f),r(f),a(f);var m=ze(p,"mg-missing-pane");i(m,f),s(m,f),l(m,f)}return e(p,f),this.windowListeners(),this},this.windowListeners=function(){return It(this.args),this},this.init(f)}var d={top:40,bottom:30,right:10,left:10,buffer:8,legend_target:"",width:350,height:220,missing_text:"Data currently missing or unavailable",scalefns:{},scales:{},show_tooltips:!0,show_missing_background:!0,interpolate:"cardinal"};MG.register("missing-data",f,d)}.call(this),MG.raw_data_transformation=Bt,MG.process_line=Ht,MG.process_histogram=Ut,MG.process_categorical_variables=Qt,MG.process_point=Zt,MG.add_ls=Vt,MG.add_lowess=Wt,MG.lowess_robust=Jt,MG.lowess=Kt,MG.least_squares=te;var nr=function(t,e,r,n){var a;return a="string"==typeof t?MG.time_format(n,t)(e[r]):"function"==typeof t?t(e):e[r]},ar=function(e,r,n){var a;return a="string"==typeof e?t.format(e)(r[n]):"function"==typeof e?e(r):r[n]};MG.format_rollover_number=le,MG.path_tween=fe,MG.convert={},MG.convert.date=function(e,r,n){return n="undefined"==typeof n?"%Y-%m-%d":n,e=e.map(function(e){var a=t.time.format(n);return e[r]=a.parse(e[r]),e})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})},MG.time_format=function(e,r){return e?t.time.format.utc(r):t.time.format(r)};var or=function(t,e,r){var n={};if(null===t)return t;if(Array.prototype.forEach&&t.forEach===Array.prototype.forEach)t.forEach(e,r);else if(t.length===+t.length){for(var a=0,o=t.length;o>a;a++)if(e.call(r,t[a],a,t)===n)return}else for(var i in t)if(e.call(r,t[i],i,t)===n)return;return t};return MG.merge_with_defaults=Ve,MG.clone=function(t){var e;if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return e=new Date,e.setTime(t.getTime()),e;if(t instanceof Array){e=[];for(var r=0,n=t.length;n>r;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var a in t)t.hasOwnProperty(a)&&(e[a]=MG.clone(t[a]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG.arr_diff=We,MG.warn_deprecation=Je,MG.truncate_text=Ke,MG.wrap_text=tr,MG.error=er,MG});