diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js
index 26e0feb7..62c3cd25 100644
--- a/dist/metricsgraphics.js
+++ b/dist/metricsgraphics.js
@@ -4124,9 +4124,13 @@
if (args.missing_is_zero
&& args.chart_type === 'line'
&& is_time_series
- && args.data.length > 1
) {
- for (var i = 0;i < args.data.length; i++) {
+ for (var i = 0; i < args.data.length; i++) {
+ //we need to have a dataset of length > 2, so if it's less than that, skip
+ if (args.data[i].length == 1) {
+ continue;
+ }
+
var first = args.data[i][0];
var last = args.data[i][args.data[i].length-1];
//initialize our new array for storing the processed data
diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js
index 1d2a7a65..084976fa 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 r.markers&&(e(r.target).find("svg .mg-markers").remove(),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])1)for(var a=0;a=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:'