From 6b54d647ac64ed04e41f9f24947f3a9ad7e05c65 Mon Sep 17 00:00:00 2001 From: almossawi Date: Tue, 20 Jan 2015 12:35:03 -0800 Subject: [PATCH] Fix issue #333 --- dist/metricsgraphics.js | 2 +- dist/metricsgraphics.min.js | 2 +- src/js/misc/process.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js index 642dddb0e5..e0759a5f4d 100644 --- a/dist/metricsgraphics.js +++ b/dist/metricsgraphics.js @@ -4156,7 +4156,7 @@ //check to see if we already have this date in our data object var existing_o = null; $.each(args.data[i], function(i, val) { - if (Date.parse(val.date) === Date.parse(new Date(d))) { + if (Date.parse(val[args.x_accessor]) === Date.parse(new Date(d))) { existing_o = val; return false; diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js index a531b67371..32e6a97b08 100644 --- a/dist/metricsgraphics.min.js +++ b/dist/metricsgraphics.min.js @@ -1,3 +1,3 @@ -(function(){"use strict";!function(t,e){"function"==typeof define&&define.amd?define(["d3","jquery"],e):"object"==typeof exports?module.exports=e(require("d3"),require("jquery")):t.MG=e(t.d3,t.jQuery)}(this,function(t,e){function r(t){var r=e(t.target).find("h2.mg-chart-title");if(t.title&&t.title!==r.text())r.remove();else{if(t.title&&""!==t.title)return;r.remove()}if(t.target&&t.title){var a,n=t.description?'':"";e(t.target).prepend('

'+t.title+n+"

"),t.description&&(a=e(t.target).find("h2.mg-chart-title"),a.popover({html:!0,animation:!1,content:t.description,trigger:"hover",placement:"top",container:a}))}t.error&&M(t)}function a(r){for(var a=t.select(e(r.target).find("svg").get(0)),n="point"===r.chart_type?r.buffer/2:2*r.buffer/3,s=[],o=0;o0})),f.length>0){var p=t.extent(f,function(t){return t[r.y_accessor]});u?(o=Math.min(p[0],o),i=Math.max(p[1],i)):(o=p[0],i=p[1],u=!0)}}o>=0&&!r.min_y&&!r.min_y_from_data&&(o=0),"bar"===r.chart_type&&(o=0,i=t.max(r.data[0],function(t){var e=[];return e.push(t[r.y_accessor]),null!==r.baseline_accessor&&e.push(t[r.baseline_accessor]),null!==r.predictor_accessor&&e.push(t[r.predictor_accessor]),Math.max.apply(null,e)})),o=null!==r.min_y?r.min_y:o,i=null!==r.max_y?r.max_y:i*r.inflator,"log"!==r.y_scale_type&&(o>=0?r.y_axis_negative=!1:(o-=i*(r.inflator-1),r.y_axis_negative=!0)),!r.min_y&&r.min_y_from_data&&(o/=r.inflator),"log"===r.y_scale_type?("histogram"===r.chart_type?o=.2:0>=o&&(o=1),r.scales.Y=t.scale.log().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]).clamp(!0)):r.scales.Y=t.scale.linear().domain([o,i]).range([r.height-r.bottom-r.buffer,r.top]),r.processed.min_y=o,r.processed.max_y=i,r.scales.Y_axis=t.scale.linear().domain([r.processed.min_y,r.processed.max_y]).range([r.height-r.bottom-r.buffer,r.top]);var h=r.yax_format;if(h||(h="count"===r.format?function(e){if(1>e)return r.yax_units+t.round(e,r.decimals);var a=t.formatPrefix(e);return r.yax_units+a.scale(e)+a.symbol}:function(e){var r=t.format("%p");return r(e)}),c.find(".mg-y-axis").remove(),!r.y_axis)return this;s=l.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class),r.y_label&&s.append("text").attr("class","label").attr("x",function(){return-1*(r.top+r.buffer+(r.height-r.bottom-r.buffer-(r.top+r.buffer))/2)}).attr("y",function(){return r.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(){return r.y_label}).attr("transform",function(){return"rotate(-90)"});var g=r.scales.Y.ticks(r.yax_count);"log"===r.y_scale_type&&(g=g.filter(function(t){return Math.abs(n(t))%1<1e-6||Math.abs(n(t))%1>1-1e-6}));var m=r.scales.Y.ticks(r.yax_count).length,_=!0;e.each(r.data,function(t,a){e.each(a,function(t,e){return e[r.y_accessor]%1!==0?(_=!1,!1):void 0})}),_&&m>i&&"count"===r.format&&(g=g.filter(function(t){return t%1===0}));var v=g.length-1;return r.x_extended_ticks||r.y_extended_ticks||s.append("line").attr("x1",r.left).attr("x2",r.left).attr("y1",r.scales.Y(g[0]).toFixed(2)).attr("y2",r.scales.Y(g[v]).toFixed(2)),s.selectAll(".mg-yax-ticks").data(g).enter().append("line").classed("mg-extended-y-ticks",r.y_extended_ticks).attr("x1",r.left).attr("x2",function(){return r.y_extended_ticks?r.width-r.right:r.left-r.yax_tick_length}).attr("y1",function(t){return r.scales.Y(t).toFixed(2)}).attr("y2",function(t){return r.scales.Y(t).toFixed(2)}),s.selectAll(".mg-yax-labels").data(g).enter().append("text").attr("x",r.left-3*r.yax_tick_length/2).attr("dx",-3).attr("y",function(t){return r.scales.Y(t).toFixed(2)}).attr("dy",".35em").attr("text-anchor","end").text(function(t){var e=h(t);return e}),r.y_rug&&a(r),this}function s(r){r.scales.Y=t.scale.ordinal().domain(r.categorical_variables).rangeRoundBands([r.height-r.bottom-r.buffer,r.top],r.padding_percentage,r.outer_padding_percentage),r.scalefns.yf=function(t){return r.scales.Y(t[r.y_accessor])};var a=t.select(e(r.target).find("svg").get(0)),n=e(e(r.target).find("svg").get(0));n.find(".mg-y-axis").remove();var s=a.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",r.use_small_class);return r.y_axis?(s.selectAll("text").data(r.categorical_variables).enter().append("svg:text").attr("x",r.left).attr("y",function(t){return r.scales.Y(t)+r.scales.Y.rangeBand()/2+r.buffer*r.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String),this):this}function o(r){for(var a="point"===r.chart_type?r.buffer/2:r.buffer,n=t.select(e(r.target).find("svg").get(0)),s=[],o=0;o10?t.scale.category20():t.scale.category10(),e.scales.color.domain(n)),e.scalefns.color=function(t){return e.scales.color(t[e.color_accessor])})}function u(e){var r,a,n,s;null!==e.size_accessor&&(null===e.size_domain?(r=t.min(e.data[0],function(t){return t[e.size_accessor]}),a=t.max(e.data[0],function(t){return t[e.size_accessor]}),n=[r,a]):n=e.size_domain,s=null===e.size_range?[1,5]:e.size_range,e.scales.size=t.scale.linear().domain(n).range(s).clamp(!0),e.scalefns.size=function(t){return e.scales.size(t[e.size_accessor])})}function d(t,e){t.append("text").attr("class","label").attr("x",function(){return e.left+e.buffer+(e.width-e.right-e.buffer-(e.left+e.buffer))/2}).attr("y",(e.height-e.bottom/2).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(){return e.x_label})}function f(e){return e.xax_format?e.xax_format:function(r){if(1>r)return e.yax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.xax_units+a.scale(r)+a.symbol}}function p(r){if(r.xax_format)return r.xax_format;var a,n,s;return r.time_series&&(a=(r.processed.max_x-r.processed.min_x)/1e3,60>a?(n=t.time.format("%M:%S"),s="seconds"):24>=a/3600?(n=t.time.format("%H:%M"),s="less-than-a-day"):96>=a/3600?(n=t.time.format("%H:%M"),s="four-days"):(n=t.time.format("%b %d"),s="default")),r.processed.main_x_time_format=n,r.processed.x_time_frame=s,function(a){var n=(t.time.format("%b %d"),t.formatPrefix(a));if("date"===e.type(r.data[0][0][r.x_accessor]))return r.processed.main_x_time_format(a);if("number"===e.type(r.data[0][0][r.x_accessor])){if(1>a)return r.yax_units+t.round(a,r.decimals);var n=t.formatPrefix(a);return r.xax_units+n.scale(a)+n.symbol}return a}}function h(t,e){var r=e.scales.X.ticks(e.xax_count).length-1;"bar"===e.chart_type||e.x_extended_ticks||e.y_extended_ticks||t.append("line").attr("x1",e.concise===!1||0===e.xax_count?e.left+e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[0]).toFixed(2)).attr("x2",e.concise===!1||0===e.xax_count?e.width-e.right-e.buffer:e.scales.X(e.scales.X.ticks(e.xax_count)[r]).toFixed(2)).attr("y1",e.height-e.bottom).attr("y2",e.height-e.bottom),t.selectAll(".mg-xax-ticks").data(e.scales.X.ticks(e.xax_count)).enter().append("line").attr("x1",function(t){return e.scales.X(t).toFixed(2)}).attr("x2",function(t){return e.scales.X(t).toFixed(2)}).attr("y1",e.height-e.bottom).attr("y2",function(){return e.x_extended_ticks?e.top:e.height-e.bottom+e.xax_tick_length}).attr("class",function(){return e.x_extended_ticks?"mg-extended-x-ticks":void 0})}function g(e,r){if(e.selectAll(".mg-xax-labels").data(r.scales.X.ticks(r.xax_count)).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/3).toFixed(2)).attr("dy",".50em").attr("text-anchor","middle").text(function(t){return r.xax_units+r.xax_format(t)}),r.time_series&&(r.show_years||r.show_secondary_x_label)){var a,n,s=r.processed.x_time_frame;switch(s){case"seconds":a=t.time.days,n=t.time.format("%I %p");break;case"less-than-a-day":a=t.time.days,n=t.time.format("%b %d");break;case"four-days":a=t.time.days,n=t.time.format("%b %d");break;default:a=t.time.years,n=t.time.format("%Y")}var o=a(r.processed.min_x,r.processed.max_x);if(0===o.length){var i=r.scales.X.ticks(r.xax_count)[0];o=[i]}e=e.append("g").classed("mg-year-marker",!0).classed("mg-year-marker-small",r.use_small_class),"default"===s&&e.selectAll(".mg-year-marker").data(o).enter().append("line").attr("x1",function(t){return r.scales.X(t).toFixed(2)}).attr("x2",function(t){return r.scales.X(t).toFixed(2)}).attr("y1",r.top).attr("y2",r.height-r.bottom),e.selectAll(".mg-year-marker").data(o).enter().append("text").attr("x",function(t){return r.scales.X(t).toFixed(2)}).attr("y",(r.height-r.bottom+7*r.xax_tick_length/1.3).toFixed(2)).attr("dy",r.use_small_class?-3:0).attr("text-anchor","middle").text(function(t){return n(t)})}}function m(e){var r,a,n;if("line"===e.chart_type)for(var s=0;sn||!n)&&(n=e.data[s][r][e.x_accessor]);else"point"===e.chart_type?(n=t.max(e.data[0],function(t){return t[e.x_accessor]}),a=t.min(e.data[0],function(t){return t[e.x_accessor]})):"histogram"===e.chart_type?(a=t.min(e.data[0],function(t){return t[e.x_accessor]}),n=t.max(e.data[0],function(t){return t[e.x_accessor]})):"bar"===e.chart_type&&(a=0,n=t.max(e.data[0],function(t){var r=[];return r.push(t[e.x_accessor]),null!==e.baseline_accessor&&r.push(t[e.baseline_accessor]),null!==e.predictor_accessor&&r.push(t[e.predictor_accessor]),Math.max.apply(null,r)}));if(a===n){if(a instanceof Date){var o=S.clone(a).setDate(a.getDate()-1),i=S.clone(a).setDate(a.getDate()+1);a=o,n=i}else"number"==typeof a?(a-=1,n+=1):"string"==typeof a&&(a=Number(a)-1,n=Number(n)+1);e.xax_count=2}a=e.min_x?e.min_x:a,n=e.max_x?e.max_x:n,e.x_axis_negative=!1,e.processed.min_x=a,e.processed.max_x=n,_(e),e.time_series||e.processed.min_x<0&&(e.processed.min_x=e.processed.min_x-e.processed.max_x*(e.inflator-1),e.x_axis_negative=!0),e.additional_buffer="bar"===e.chart_type?5*e.buffer:0}function _(t){t.xax_format||"line"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"point"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"histogram"!==t.chart_type||(t.xax_format=p(t)),t.xax_format||"bar"!==t.chart_type||(t.xax_format=f(t))}function v(a){var n={target:null,title:null,description:null},a=arguments[0];if(a||(a={}),a=z(a,n),t.select(a.target).empty())return void console.warn('The specified target element "'+a.target+'" could not be found in the page. The chart will not be rendered.');a.time_series="date"===e.type(a.data[0][0][a.x_accessor])?!0:!1;var s=a.width,o=a.height;a.full_width&&(s=C(a.target)),a.fill_height&&(o=P(a.target)),"bar"===a.chart_type&&null===o&&(o=a.height=a.data[0].length*a.bar_height+a.top+a.bottom);var i=e(a.target).find("svg");if((i.find(".mg-main-line").length>0&&"line"!==a.chart_type||i.find(".mg-points").length>0&&"point"!==a.chart_type||i.find(".mg-histogram").length>0&&"histogram"!==a.chart_type||i.find(".mg-barplot").length>0&&"bar"!==a.chart_type)&&e(a.target).empty(),""===e.trim(e(a.target).html())&&t.select(a.target).append("svg").classed("linked",a.linked).attr("width",s).attr("height",o),a.width=s,a.height=o,i=t.select(a.target).selectAll("svg"),i.append("defs").append("clipPath").attr("id","mg-plot-window-"+X(a.target)).append("svg:rect").attr("x",a.left).attr("y",a.top).attr("width",a.width-a.left-a.right-a.buffer).attr("height",a.height-a.top-a.bottom-a.buffer),s!==Number(i.attr("width"))&&i.attr("width",s),o!==Number(i.attr("height"))&&i.attr("height",o),i.attr("viewBox","0 0 "+s+" "+o),(a.full_width||a.full_height)&&i.attr("preserveAspectRatio","xMinYMin meet"),i.classed("mg-missing",!1),i.selectAll(".mg-missing-text").remove(),r(a),a.use_small_class=a.height-a.top-a.bottom-a.buffer<=a.small_height_threshold&&a.width-a.left-a.right-2*a.buffer<=a.small_width_threshold||a.small_text,a.data.length0)for(var l=function(t){for(var e=new Array(t),r=0;rd;u--)e(a.target).find("svg .mg-main-line.mg-line"+u+"-color").remove();return this}function x(r){var a,n,s=t.select(e(r.target).find("svg").get(0));return e(r.target).find("svg .mg-markers").remove(),e(r.target).find("svg .mg-baselines").remove(),r.markers&&(a=s.append("g").attr("class","mg-markers"),a.selectAll(".mg-markers").data(r.markers.filter(function(t){return r.scales.X(t[r.x_accessor])>r.buffer+r.left&&r.scales.X(t[r.x_accessor])r.buffer+r.left&&r.scales.X(t[r.x_accessor])=u;u.setDate(u.getDate()+1)){var d={};u.setHours(0,0,0,0),Date.parse(u)===Date.parse(new Date(i))&&o.push(S.clone(t.data[a][0]));var f=null;e.each(t.data[a],function(t,e){return Date.parse(e.date)===Date.parse(new Date(u))?(f=e,!1):void 0}),f?o.push(f):(d[t.x_accessor]=new Date(u),d[t.y_accessor]=0,o.push(d)),Date.parse(u)===Date.parse(new Date(s[t.x_accessor]))&&o.push(s)}t.data[a]=o}return this}function A(e){var r,a=e.data[0];if(e.binned===!1){if("object"==typeof a[0])r=a.map(function(t){return t[e.x_accessor]});else{if("number"!=typeof a[0])return void console.log("TypeError: expected an array of numbers, found "+typeof a[0]);r=a}var n=t.layout.histogram();e.bins&&(n=n.bins(e.bins)),e.processed_data=n(r).map(function(t){return{x:t.x,y:t.y,dx:t.dx}})}else{e.processed_data=a.map(function(t){return{x:t[e.x_accessor],y:t[e.y_accessor]}});for(var s,o,i=0;ir&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function M(t){var r='';console.log("ERROR : ",t.target," : ",t.error),e(t.target).find(".mg-chart-title").append(r)}var S={version:"2.0.0"},N={};if(S.globals={},S.deprecations={rollover_callback:{replacement:"mouseover",version:"2.0"},rollout_callback:{replacement:"mouseout",version:"2.0"},show_years:{replacement:"show_secondary_x_label",version:"2.1"}},S.globals.link=!1,S.globals.version="1.1",S.data_graphic=function(){var t={};t.all={missing_is_zero:!1,legend:"",legend_target:"",error:"",animate_on_load:!1,top:40,bottom:30,right:10,left:50,buffer:8,width:350,height:220,full_width:!1,full_height:!1,small_height_threshold:120,small_width_threshold:160,small_text:!1,xax_count:6,xax_tick_length:5,yax_count:5,yax_tick_length:5,x_extended_ticks:!1,y_extended_ticks:!1,y_scale_type:"linear",max_x:null,max_y:null,min_x:null,min_y:null,min_y_from_data:!1,point_size:2.5,x_accessor:"date",xax_units:"",x_label:"",x_axis:!0,y_axis:!0,y_accessor:"value",y_label:"",yax_units:"",x_rug:!1,y_rug:!1,transition_on_update:!0,mouseover:null,show_rollover_text:!0,show_confidence_band:null,xax_format:null,area:!0,chart_type:"line",data:[],decimals:2,format:"count",inflator:10/9,linked:!1,list:!1,baselines:null,markers:null,scalefns:{},scales:{},show_secondary_x_label:!0,target:"#viz",interpolate:"cardinal",custom_line_color_map:[],max_data_size:null,aggregate_rollover:!1},t.point={buffer:16,ls:!1,lowess:!1,point_size:2.5,size_accessor:null,color_accessor:null,size_range:null,color_range:null,size_domain:null,color_domain:null,color_type:"number"},t.histogram={mouseover:function(t){e("#histogram svg .mg-active-datapoint").html("Frequency Count: "+t.y)},binned:!1,bins:null,processed_x_accessor:"x",processed_y_accessor:"y",processed_dx_accessor:"dx",bar_margin:1},t.bar={y_accessor:"factor",x_accessor:"value",baseline_accessor:null,predictor_accessor:null,predictor_proportion:5,dodge_accessor:null,binned:!0,padding_percentage:0,outer_padding_percentage:.1,height:500,top:20,bar_height:20,left:70},t.missing={top:0,bottom:0,right:0,left:0,legend_target:"",width:350,height:220,missing_text:"Data currently missing or unavailable"};var r=arguments[0];r||(r={}),r.list&&(r.x_accessor=0,r.y_accessor=1);for(var a in S.deprecations)if(r.hasOwnProperty(a)){var n=S.deprecations[a],s="Use of `args."+a+"` has been deprecated",o=n.replacement;if(o&&(r[o]?s+=". The replacement - `args."+o+"` - has already been defined. This definition will be discarded.":r[o]=r[a]),n.warned)continue;n.warned=!0,o&&(s+=" in favor of `args."+o+"`"),$(s,n.version)}var i;return"missing-data"===r.chart_type?(r=z(r,t.missing),N.missing(r)):"point"===r.chart_type?(i=z(t.point,t.all),r=z(r,i),N.point(r).mainPlot().markers().rollover().windowListeners()):"histogram"===r.chart_type?(i=z(t.histogram,t.all),r=z(r,i),N.histogram(r).mainPlot().markers().rollover().windowListeners()):"bar"===r.chart_type?(i=z(t.bar,t.all),r=z(r,i),N.bar(r).mainPlot().markers().rollover().windowListeners()):(r=z(r,t.all),N.line(r).markers().mainPlot().rollover().windowListeners()),r.data},"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");if(+function(t){var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),s="object"==typeof e&&e,o=s&&s.selector;(n||"destroy"!=e)&&(o?(n||a.data("bs.tooltip",n={}),n[o]||(n[o]=new r(this,s))):n||a.data("bs.tooltip",n=new r(this,s)),"string"==typeof e&&n[e]())})}if("function"==typeof t().tooltip)return!0;var r=function(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)};r.VERSION="3.3.1",r.TRANSITION_DURATION=150,r.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},r.prototype.init=function(e,r,a){this.enabled=!0,this.type=e,this.$element=t(r),this.options=this.getOptions(a),this.$viewport=this.options.viewport&&t(this.options.viewport.selector||this.options.viewport);for(var n=this.options.trigger.split(" "),s=n.length;s--;){var o=n[s];if("click"==o)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=o){var i="hover"==o?"mouseenter":"focusin",l="hover"==o?"mouseleave":"focusout";this.$element.on(i+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},r.prototype.getDefaults=function(){return r.DEFAULTS},r.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},r.prototype.getDelegateOptions=function(){var e={},r=this.getDefaults();return this._options&&t.each(this._options,function(t,a){r[t]!=a&&(e[t]=a)}),e},r.prototype.enter=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r&&r.$tip&&r.$tip.is(":visible")?void(r.hoverState="in"):(r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="in",r.options.delay&&r.options.delay.show?void(r.timeout=setTimeout(function(){"in"==r.hoverState&&r.show()},r.options.delay.show)):r.show())},r.prototype.leave=function(e){var r=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return r||(r=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,r)),clearTimeout(r.timeout),r.hoverState="out",r.options.delay&&r.options.delay.hide?void(r.timeout=setTimeout(function(){"out"==r.hoverState&&r.hide()},r.options.delay.hide)):r.hide()},r.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var a=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!a)return;var n=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(i);c&&(i=i.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var u=this.getPosition(),d=s[0].offsetWidth,f=s[0].offsetHeight;if(c){var p=i,h=this.options.container?t(this.options.container):this.$element.parent(),g=this.getPosition(h);i="bottom"==i&&u.bottom+f>g.bottom?"top":"top"==i&&u.top-fg.width?"left":"left"==i&&u.left-do.top+o.height&&(n.top=o.top+o.height-l)}else{var c=e.left-s,u=e.left+s+r;co.width&&(n.left=o.left+o.width-u)}return n},r.prototype.getTitle=function(){var t,e=this.$element,r=this.options; +(function(){"use strict";!function(t,e){"function"==typeof define&&define.amd?define(["d3","jquery"],e):"object"==typeof exports?module.exports=e(require("d3"),require("jquery")):t.MG=e(t.d3,t.jQuery)}(this,function(t,e){function r(t){var r=e(t.target).find("h2.mg-chart-title");if(t.title&&t.title!==r.text())r.remove();else{if(t.title&&""!==t.title)return;r.remove()}if(t.target&&t.title){var a,n=t.description?'':"";e(t.target).prepend('

'+t.title+n+"

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