diff --git a/dist/metricsgraphics.js b/dist/metricsgraphics.js
index 9fdaa84b2b..eeb7b085cf 100644
--- a/dist/metricsgraphics.js
+++ b/dist/metricsgraphics.js
@@ -27,6 +27,7 @@
var defaults = {};
defaults.all = {
missing_is_zero: false, // if true, missing values will be treated as zeros
+ missing_is_hidden: false, // if true, missing values will appear as broken segments
legend: '' , // an array identifying the labels for a chart's lines
legend_target: '', // if set, the specified element is populated with a legend
error: '', // if set, a graph will show an error icon and log the error to the console
@@ -257,14 +258,14 @@
this.enabled =
this.timeout =
this.hoverState =
- this.$element = null
+ this.$element = null;
- this.init('tooltip', element, options)
- }
+ this.init('tooltip', element, options);
+ };
- Tooltip.VERSION = '3.3.1'
+ Tooltip.VERSION = '3.3.1';
- Tooltip.TRANSITION_DURATION = 150
+ Tooltip.TRANSITION_DURATION = 150;
Tooltip.DEFAULTS = {
animation: true,
@@ -280,200 +281,200 @@
selector: 'body',
padding: 0
}
- }
+ };
Tooltip.prototype.init = function (type, element, options) {
- this.enabled = true
- this.type = type
- this.$element = $(element)
- this.options = this.getOptions(options)
- this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
+ this.enabled = true;
+ this.type = type;
+ this.$element = $(element);
+ this.options = this.getOptions(options);
+ this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport);
- var triggers = this.options.trigger.split(' ')
+ var triggers = this.options.trigger.split(' ');
for (var i = triggers.length; i--;) {
- var trigger = triggers[i]
+ var trigger = triggers[i];
if (trigger == 'click') {
- this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
+ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this));
} else if (trigger != 'manual') {
- var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
- var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
+ var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';
+ var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
- this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
- this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
+ this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this));
+ this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this));
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
- this.fixTitle()
- }
+ this.fixTitle();
+ };
Tooltip.prototype.getDefaults = function () {
- return Tooltip.DEFAULTS
- }
+ return Tooltip.DEFAULTS;
+ };
Tooltip.prototype.getOptions = function (options) {
- options = $.extend({}, this.getDefaults(), this.$element.data(), options)
+ options = $.extend({}, this.getDefaults(), this.$element.data(), options);
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
- }
+ };
}
- return options
- }
+ return options;
+ };
Tooltip.prototype.getDelegateOptions = function () {
- var options = {}
- var defaults = this.getDefaults()
+ var options = {};
+ var defaults = this.getDefaults();
this._options && $.each(this._options, function (key, value) {
- if (defaults[key] != value) options[key] = value
- })
+ if (defaults[key] != value) options[key] = value;
+ });
- return options
- }
+ return options;
+ };
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
- obj : $(obj.currentTarget).data('bs.' + this.type)
+ obj : $(obj.currentTarget).data('bs.' + this.type);
if (self && self.$tip && self.$tip.is(':visible')) {
- self.hoverState = 'in'
- return
+ self.hoverState = 'in';
+ return;
}
if (!self) {
- self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
- $(obj.currentTarget).data('bs.' + this.type, self)
+ self = new this.constructor(obj.currentTarget, this.getDelegateOptions());
+ $(obj.currentTarget).data('bs.' + this.type, self);
}
- clearTimeout(self.timeout)
+ clearTimeout(self.timeout);
- self.hoverState = 'in'
+ self.hoverState = 'in';
- if (!self.options.delay || !self.options.delay.show) return self.show()
+ if (!self.options.delay || !self.options.delay.show) return self.show();
self.timeout = setTimeout(function () {
- if (self.hoverState == 'in') self.show()
- }, self.options.delay.show)
- }
+ if (self.hoverState == 'in') self.show();
+ }, self.options.delay.show);
+ };
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
- obj : $(obj.currentTarget).data('bs.' + this.type)
+ obj : $(obj.currentTarget).data('bs.' + this.type);
if (!self) {
- self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
- $(obj.currentTarget).data('bs.' + this.type, self)
+ self = new this.constructor(obj.currentTarget, this.getDelegateOptions());
+ $(obj.currentTarget).data('bs.' + this.type, self);
}
- clearTimeout(self.timeout)
+ clearTimeout(self.timeout);
- self.hoverState = 'out'
+ self.hoverState = 'out';
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
+ if (!self.options.delay || !self.options.delay.hide) return self.hide();
self.timeout = setTimeout(function () {
- if (self.hoverState == 'out') self.hide()
- }, self.options.delay.hide)
- }
+ if (self.hoverState == 'out') self.hide();
+ }, self.options.delay.hide);
+ };
Tooltip.prototype.show = function () {
- var e = $.Event('show.bs.' + this.type)
+ var e = $.Event('show.bs.' + this.type);
if (this.hasContent() && this.enabled) {
- this.$element.trigger(e)
+ this.$element.trigger(e);
- var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
- if (e.isDefaultPrevented() || !inDom) return
- var that = this
+ var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);
+ if (e.isDefaultPrevented() || !inDom) return;
+ var that = this;
- var $tip = this.tip()
+ var $tip = this.tip();
- var tipId = this.getUID(this.type)
+ var tipId = this.getUID(this.type);
- this.setContent()
- $tip.attr('id', tipId)
- this.$element.attr('aria-describedby', tipId)
+ this.setContent();
+ $tip.attr('id', tipId);
+ this.$element.attr('aria-describedby', tipId);
- if (this.options.animation) $tip.addClass('fade')
+ if (this.options.animation) $tip.addClass('fade');
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
- this.options.placement
+ this.options.placement;
- var autoToken = /\s?auto?\s?/i
- var autoPlace = autoToken.test(placement)
- if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
+ var autoToken = /\s?auto?\s?/i;
+ var autoPlace = autoToken.test(placement);
+ if (autoPlace) placement = placement.replace(autoToken, '') || 'top';
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
- .data('bs.' + this.type, this)
+ .data('bs.' + this.type, this);
- this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element);
- var pos = this.getPosition()
- var actualWidth = $tip[0].offsetWidth
- var actualHeight = $tip[0].offsetHeight
+ var pos = this.getPosition();
+ var actualWidth = $tip[0].offsetWidth;
+ var actualHeight = $tip[0].offsetHeight;
if (autoPlace) {
- var orgPlacement = placement
- var $container = this.options.container ? $(this.options.container) : this.$element.parent()
- var containerDim = this.getPosition($container)
+ var orgPlacement = placement;
+ var $container = this.options.container ? $(this.options.container) : this.$element.parent();
+ var containerDim = this.getPosition($container);
placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
- placement
+ placement;
$tip
.removeClass(orgPlacement)
- .addClass(placement)
+ .addClass(placement);
}
- var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
+ var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
- this.applyPlacement(calculatedOffset, placement)
+ this.applyPlacement(calculatedOffset, placement);
var complete = function () {
- var prevHoverState = that.hoverState
- that.$element.trigger('shown.bs.' + that.type)
- that.hoverState = null
+ var prevHoverState = that.hoverState;
+ that.$element.trigger('shown.bs.' + that.type);
+ that.hoverState = null;
- if (prevHoverState == 'out') that.leave(that)
- }
+ if (prevHoverState == 'out') that.leave(that);
+ };
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
- complete()
+ complete();
}
- }
+ };
Tooltip.prototype.applyPlacement = function (offset, placement) {
- var $tip = this.tip()
- var width = $tip[0].offsetWidth
- var height = $tip[0].offsetHeight
+ var $tip = this.tip();
+ var width = $tip[0].offsetWidth;
+ var height = $tip[0].offsetHeight;
// manually read margins because getBoundingClientRect includes difference
- var marginTop = parseInt($tip.css('margin-top'), 10)
- var marginLeft = parseInt($tip.css('margin-left'), 10)
+ var marginTop = parseInt($tip.css('margin-top'), 10);
+ var marginLeft = parseInt($tip.css('margin-left'), 10);
// we must check for NaN for ie 8/9
- if (isNaN(marginTop)) marginTop = 0
- if (isNaN(marginLeft)) marginLeft = 0
+ if (isNaN(marginTop)) marginTop = 0;
+ if (isNaN(marginLeft)) marginLeft = 0;
- offset.top = offset.top + marginTop
- offset.left = offset.left + marginLeft
+ offset.top = offset.top + marginTop;
+ offset.left = offset.left + marginLeft;
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
@@ -482,199 +483,199 @@
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
- })
+ });
}
- }, offset), 0)
+ }, offset), 0);
- $tip.addClass('in')
+ $tip.addClass('in');
// check to see if placing tip in new offset caused the tip to resize itself
- var actualWidth = $tip[0].offsetWidth
- var actualHeight = $tip[0].offsetHeight
+ var actualWidth = $tip[0].offsetWidth;
+ var actualHeight = $tip[0].offsetHeight;
if (placement == 'top' && actualHeight != height) {
- offset.top = offset.top + height - actualHeight
+ offset.top = offset.top + height - actualHeight;
}
- var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
+ var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight);
- if (delta.left) offset.left += delta.left
- else offset.top += delta.top
+ if (delta.left) offset.left += delta.left;
+ else offset.top += delta.top;
- var isVertical = /top|bottom/.test(placement)
- var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
- var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
+ var isVertical = /top|bottom/.test(placement);
+ var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight;
+ var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight';
- $tip.offset(offset)
- this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
- }
+ $tip.offset(offset);
+ this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical);
+ };
Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) {
this.arrow()
.css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
- .css(isHorizontal ? 'top' : 'left', '')
- }
+ .css(isHorizontal ? 'top' : 'left', '');
+ };
Tooltip.prototype.setContent = function () {
- var $tip = this.tip()
- var title = this.getTitle()
+ var $tip = this.tip();
+ var title = this.getTitle();
- $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
- $tip.removeClass('fade in top bottom left right')
- }
+ $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title);
+ $tip.removeClass('fade in top bottom left right');
+ };
Tooltip.prototype.hide = function (callback) {
- var that = this
- var $tip = this.tip()
- var e = $.Event('hide.bs.' + this.type)
+ var that = this;
+ var $tip = this.tip();
+ var e = $.Event('hide.bs.' + this.type);
function complete() {
- if (that.hoverState != 'in') $tip.detach()
+ if (that.hoverState != 'in') $tip.detach();
that.$element
.removeAttr('aria-describedby')
- .trigger('hidden.bs.' + that.type)
- callback && callback()
+ .trigger('hidden.bs.' + that.type);
+ callback && callback();
}
- this.$element.trigger(e)
+ this.$element.trigger(e);
- if (e.isDefaultPrevented()) return
+ if (e.isDefaultPrevented()) return;
- $tip.removeClass('in')
+ $tip.removeClass('in');
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
- complete()
+ complete();
- this.hoverState = null
+ this.hoverState = null;
- return this
- }
+ return this;
+ };
Tooltip.prototype.fixTitle = function () {
- var $e = this.$element
+ var $e = this.$element;
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
- $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
+ $e.attr('data-original-title', $e.attr('title') || '').attr('title', '');
}
- }
+ };
Tooltip.prototype.hasContent = function () {
- return this.getTitle()
- }
+ return this.getTitle();
+ };
Tooltip.prototype.getPosition = function ($element) {
- $element = $element || this.$element
+ $element = $element || this.$element;
- var el = $element[0]
- var isBody = el.tagName == 'BODY'
+ var el = $element[0];
+ var isBody = el.tagName == 'BODY';
- var elRect = el.getBoundingClientRect()
+ var elRect = el.getBoundingClientRect();
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
- elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
+ elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top });
}
- var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
- var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
- var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
+ var elOffset = isBody ? { top: 0, left: 0 } : $element.offset();
+ var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() };
+ var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null;
- return $.extend({}, elRect, scroll, outerDims, elOffset)
- }
+ return $.extend({}, elRect, scroll, outerDims, elOffset);
+ };
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
- /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
+ /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width };
- }
+ };
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
- var delta = { top: 0, left: 0 }
- if (!this.$viewport) return delta
+ var delta = { top: 0, left: 0 };
+ if (!this.$viewport) return delta;
- var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
- var viewportDimensions = this.getPosition(this.$viewport)
+ var viewportPadding = this.options.viewport && this.options.viewport.padding || 0;
+ var viewportDimensions = this.getPosition(this.$viewport);
if (/right|left/.test(placement)) {
- var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
- var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
+ var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll;
+ var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight;
if (topEdgeOffset < viewportDimensions.top) { // top overflow
- delta.top = viewportDimensions.top - topEdgeOffset
+ delta.top = viewportDimensions.top - topEdgeOffset;
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
- delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
+ delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset;
}
} else {
- var leftEdgeOffset = pos.left - viewportPadding
- var rightEdgeOffset = pos.left + viewportPadding + actualWidth
+ var leftEdgeOffset = pos.left - viewportPadding;
+ var rightEdgeOffset = pos.left + viewportPadding + actualWidth;
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
- delta.left = viewportDimensions.left - leftEdgeOffset
+ delta.left = viewportDimensions.left - leftEdgeOffset;
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
- delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
+ delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset;
}
}
- return delta
- }
+ return delta;
+ };
Tooltip.prototype.getTitle = function () {
- var title
- var $e = this.$element
- var o = this.options
+ var title;
+ var $e = this.$element;
+ var o = this.options;
title = $e.attr('data-original-title')
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
+ || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title);
- return title
- }
+ return title;
+ };
Tooltip.prototype.getUID = function (prefix) {
- do prefix += ~~(Math.random() * 1000000)
- while (document.getElementById(prefix))
- return prefix
- }
+ do prefix += ~~(Math.random() * 1000000);
+ while (document.getElementById(prefix));
+ return prefix;
+ };
Tooltip.prototype.tip = function () {
- return (this.$tip = this.$tip || $(this.options.template))
- }
+ return (this.$tip = this.$tip || $(this.options.template));
+ };
Tooltip.prototype.arrow = function () {
- return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
- }
+ return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'));
+ };
Tooltip.prototype.enable = function () {
- this.enabled = true
- }
+ this.enabled = true;
+ };
Tooltip.prototype.disable = function () {
- this.enabled = false
- }
+ this.enabled = false;
+ };
Tooltip.prototype.toggleEnabled = function () {
- this.enabled = !this.enabled
- }
+ this.enabled = !this.enabled;
+ };
Tooltip.prototype.toggle = function (e) {
- var self = this
+ var self = this;
if (e) {
- self = $(e.currentTarget).data('bs.' + this.type)
+ self = $(e.currentTarget).data('bs.' + this.type);
if (!self) {
- self = new this.constructor(e.currentTarget, this.getDelegateOptions())
- $(e.currentTarget).data('bs.' + this.type, self)
+ self = new this.constructor(e.currentTarget, this.getDelegateOptions());
+ $(e.currentTarget).data('bs.' + this.type, self);
}
}
- self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
- }
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self);
+ };
Tooltip.prototype.destroy = function () {
- var that = this
- clearTimeout(this.timeout)
+ var that = this;
+ clearTimeout(this.timeout);
this.hide(function () {
- that.$element.off('.' + that.type).removeData('bs.' + that.type)
- })
- }
+ that.$element.off('.' + that.type).removeData('bs.' + that.type);
+ });
+ };
// TOOLTIP PLUGIN DEFINITION
@@ -682,35 +683,35 @@
function Plugin(option) {
return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.tooltip')
- var options = typeof option == 'object' && option
- var selector = options && options.selector
+ var $this = $(this);
+ var data = $this.data('bs.tooltip');
+ var options = typeof option == 'object' && option;
+ var selector = options && options.selector;
- if (!data && option == 'destroy') return
+ if (!data && option == 'destroy') return;
if (selector) {
- if (!data) $this.data('bs.tooltip', (data = {}))
- if (!data[selector]) data[selector] = new Tooltip(this, options)
+ if (!data) $this.data('bs.tooltip', (data = {}));
+ if (!data[selector]) data[selector] = new Tooltip(this, options);
} else {
- if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
+ if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)));
}
- if (typeof option == 'string') data[option]()
- })
+ if (typeof option == 'string') data[option]();
+ });
}
- var old = $.fn.tooltip
+ var old = $.fn.tooltip;
- $.fn.tooltip = Plugin
- $.fn.tooltip.Constructor = Tooltip
+ $.fn.tooltip = Plugin;
+ $.fn.tooltip.Constructor = Tooltip;
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
- $.fn.tooltip = old
- return this
- }
+ $.fn.tooltip = old;
+ return this;
+ };
}(jQuery);
@@ -733,71 +734,71 @@
// ===============================
var Popover = function (element, options) {
- this.init('popover', element, options)
- }
+ this.init('popover', element, options);
+ };
- if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
+ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');
- Popover.VERSION = '3.3.1'
+ Popover.VERSION = '3.3.1';
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '
'
- })
+ });
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
- Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);
- Popover.prototype.constructor = Popover
+ Popover.prototype.constructor = Popover;
Popover.prototype.getDefaults = function () {
- return Popover.DEFAULTS
- }
+ return Popover.DEFAULTS;
+ };
Popover.prototype.setContent = function () {
- var $tip = this.tip()
- var title = this.getTitle()
- var content = this.getContent()
+ var $tip = this.tip();
+ var title = this.getTitle();
+ var content = this.getContent();
- $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
- ](content)
+ ](content);
- $tip.removeClass('fade top bottom left right in')
+ $tip.removeClass('fade top bottom left right in');
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
- if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
- }
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
+ };
Popover.prototype.hasContent = function () {
- return this.getTitle() || this.getContent()
- }
+ return this.getTitle() || this.getContent();
+ };
Popover.prototype.getContent = function () {
- var $e = this.$element
- var o = this.options
+ var $e = this.$element;
+ var o = this.options;
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
- o.content)
- }
+ o.content);
+ };
Popover.prototype.arrow = function () {
- return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
- }
+ return (this.$arrow = this.$arrow || this.tip().find('.arrow'));
+ };
Popover.prototype.tip = function () {
- if (!this.$tip) this.$tip = $(this.options.template)
- return this.$tip
- }
+ if (!this.$tip) this.$tip = $(this.options.template);
+ return this.$tip;
+ };
// POPOVER PLUGIN DEFINITION
@@ -805,35 +806,35 @@
function Plugin(option) {
return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.popover')
- var options = typeof option == 'object' && option
- var selector = options && options.selector
+ var $this = $(this);
+ var data = $this.data('bs.popover');
+ var options = typeof option == 'object' && option;
+ var selector = options && options.selector;
- if (!data && option == 'destroy') return
+ if (!data && option == 'destroy') return;
if (selector) {
- if (!data) $this.data('bs.popover', (data = {}))
- if (!data[selector]) data[selector] = new Popover(this, options)
+ if (!data) $this.data('bs.popover', (data = {}));
+ if (!data[selector]) data[selector] = new Popover(this, options);
} else {
- if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
+ if (!data) $this.data('bs.popover', (data = new Popover(this, options)));
}
- if (typeof option == 'string') data[option]()
- })
+ if (typeof option == 'string') data[option]();
+ });
}
- var old = $.fn.popover
+ var old = $.fn.popover;
- $.fn.popover = Plugin
- $.fn.popover.Constructor = Popover
+ $.fn.popover = Plugin;
+ $.fn.popover.Constructor = Popover;
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
- $.fn.popover = old
- return this
- }
+ $.fn.popover = old;
+ return this;
+ };
}(jQuery);
}
@@ -1511,7 +1512,7 @@
// a custom function if desired
if(args.data[0][0][args.x_accessor] instanceof Date) {
return args.processed.main_x_time_format(d);
- } else if($.type(args.data[0][0][args.x_accessor]) === 'number') {
+ } if (typeof args.data[0][0][args.x_accessor] === 'number') {
if (d < 1.0) {
//don't scale tiny values
return args.xax_units + d3.round(d, args.decimals);
@@ -1722,7 +1723,7 @@
description: null
};
- var args = arguments[0];
+ args = arguments[0];
if (!args) { args = {}; }
args = merge_with_defaults(args, defaults);
@@ -1790,7 +1791,7 @@
svg.append('defs')
.attr('class', 'mg-clip-path')
.append('clipPath')
- .attr('class', 'mg-plot-window-' + mg_strip_punctuation(args.target))
+ .attr('id', 'mg-plot-window-' + mg_strip_punctuation(args.target))
.append('svg:rect')
.attr('x', args.left)
.attr('y', args.top)
@@ -1815,7 +1816,7 @@
// remove missing class
svg.classed('mg-missing', false);
-
+
// remove missing text
svg.selectAll('.mg-missing-text').remove();
svg.selectAll('.mg-missing-pane').remove();
@@ -1883,18 +1884,11 @@
.attr('class', 'mg-markers');
gm.selectAll('.mg-markers')
- .data(args.markers.filter(function(d){
- return (args.scales.X(d[args.x_accessor]) > args.buffer + args.left)
- && (args.scales.X(d[args.x_accessor]) < args.width - args.buffer - args.right);
- }))
+ .data(args.markers.filter(inRange))
.enter()
.append('line')
- .attr('x1', function(d) {
- return args.scales.X(d[args.x_accessor]).toFixed(2);
- })
- .attr('x2', function(d) {
- return args.scales.X(d[args.x_accessor]).toFixed(2);
- })
+ .attr('x1', xPositionFixed)
+ .attr('x2', xPositionFixed)
.attr('y1', args.top)
.attr('y2', function() {
return args.height - args.bottom - args.buffer;
@@ -1902,20 +1896,18 @@
.attr('stroke-dasharray', '3,1');
gm.selectAll('.mg-markers')
- .data(args.markers.filter(function(d){
- return (args.scales.X(d[args.x_accessor]) > args.buffer + args.left)
- && (args.scales.X(d[args.x_accessor]) < args.width - args.buffer - args.right);
- }))
+ .data(args.markers.filter(inRange))
.enter()
.append('text')
- .attr('x', function(d) {
- return args.scales.X(d[args.x_accessor]);
- })
+ .attr('class', 'mg-marker-text')
+ .attr('x', xPosition)
.attr('y', args.top - 8)
.attr('text-anchor', 'middle')
.text(function(d) {
return d.label;
});
+
+ preventOverlap(gm.selectAll('.mg-marker-text'));
}
if (args.baselines) {
@@ -1948,6 +1940,50 @@
});
}
+ function preventOverlap (labels) {
+ var prev;
+ labels.each(function(d, i) {
+ if (i > 0) {
+ var thisbb = this.getBoundingClientRect();
+
+ if (isOverlapping(this, labels)) {
+ var node = d3.select(this), newY = +node.attr('y');
+ if (newY + 8 == args.top) {
+ newY = args.top - 16;
+ }
+ node.attr('y', newY);
+ }
+ }
+ prev = this;
+ });
+ }
+
+ function isOverlapping(element, labels) {
+ var bbox = element.getBoundingClientRect();
+ for(var i = 0; i < labels.length; i++) {
+ var elbb = labels[0][i].getBoundingClientRect();
+ if (
+ labels[0][i] !== element &&
+ ((elbb.right > bbox.left && elbb.left > bbox.left && bbox.top === elbb.top) ||
+ (elbb.left < bbox.left && elbb.right > bbox.left && bbox.top === elbb.top))
+ ) return true;
+ }
+ return false;
+ }
+
+ function xPosition (d) {
+ return args.scales.X(d[args.x_accessor]);
+ }
+
+ function xPositionFixed (d) {
+ return xPosition(d).toFixed(2);
+ }
+
+ function inRange (d) {
+ return (args.scales.X(d[args.x_accessor]) > args.buffer + args.left)
+ && (args.scales.X(d[args.x_accessor]) < args.width - args.buffer - args.right);
+ }
+
return this;
}
@@ -1999,109 +2035,109 @@
// DROPDOWN CLASS DEFINITION
// =========================
- var backdrop = '.dropdown-backdrop'
- var toggle = '[data-toggle="dropdown"]'
+ var backdrop = '.dropdown-backdrop';
+ var toggle = '[data-toggle="dropdown"]';
var Dropdown = function (element) {
- $(element).on('click.bs.dropdown', this.toggle)
- }
+ $(element).on('click.bs.dropdown', this.toggle);
+ };
- Dropdown.VERSION = '3.3.1'
+ Dropdown.VERSION = '3.3.1';
Dropdown.prototype.toggle = function (e) {
- var $this = $(this)
+ var $this = $(this);
- if ($this.is('.disabled, :disabled')) return
+ if ($this.is('.disabled, :disabled')) return;
- var $parent = getParent($this)
- var isActive = $parent.hasClass('open')
+ var $parent = getParent($this);
+ var isActive = $parent.hasClass('open');
- clearMenus()
+ clearMenus();
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
- $('').insertAfter($(this)).on('click', clearMenus)
+ $('').insertAfter($(this)).on('click', clearMenus);
}
- var relatedTarget = { relatedTarget: this }
- $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
+ var relatedTarget = { relatedTarget: this };
+ $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget));
- if (e.isDefaultPrevented()) return
+ if (e.isDefaultPrevented()) return;
$this
.trigger('focus')
- .attr('aria-expanded', 'true')
+ .attr('aria-expanded', 'true');
$parent
.toggleClass('open')
- .trigger('shown.bs.dropdown', relatedTarget)
+ .trigger('shown.bs.dropdown', relatedTarget);
}
- return false
- }
+ return false;
+ };
Dropdown.prototype.keydown = function (e) {
- if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
+ if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return;
- var $this = $(this)
+ var $this = $(this);
- e.preventDefault()
- e.stopPropagation()
+ e.preventDefault();
+ e.stopPropagation();
- if ($this.is('.disabled, :disabled')) return
+ if ($this.is('.disabled, :disabled')) return;
- var $parent = getParent($this)
- var isActive = $parent.hasClass('open')
+ var $parent = getParent($this);
+ var isActive = $parent.hasClass('open');
if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
- if (e.which == 27) $parent.find(toggle).trigger('focus')
- return $this.trigger('click')
+ if (e.which == 27) $parent.find(toggle).trigger('focus');
+ return $this.trigger('click');
}
- var desc = ' li:not(.divider):visible a'
- var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
+ var desc = ' li:not(.divider):visible a';
+ var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc);
- if (!$items.length) return
+ if (!$items.length) return;
- var index = $items.index(e.target)
+ var index = $items.index(e.target);
- if (e.which == 38 && index > 0) index-- // up
- if (e.which == 40 && index < $items.length - 1) index++ // down
- if (!~index) index = 0
+ if (e.which == 38 && index > 0) index--; // up
+ if (e.which == 40 && index < $items.length - 1) index++; // down
+ if (!~index) index = 0;
- $items.eq(index).trigger('focus')
- }
+ $items.eq(index).trigger('focus');
+ };
function clearMenus(e) {
- if (e && e.which === 3) return
- $(backdrop).remove()
+ if (e && e.which === 3) return;
+ $(backdrop).remove();
$(toggle).each(function () {
- var $this = $(this)
- var $parent = getParent($this)
- var relatedTarget = { relatedTarget: this }
+ var $this = $(this);
+ var $parent = getParent($this);
+ var relatedTarget = { relatedTarget: this };
- if (!$parent.hasClass('open')) return
+ if (!$parent.hasClass('open')) return;
- $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget));
- if (e.isDefaultPrevented()) return
+ if (e.isDefaultPrevented()) return;
- $this.attr('aria-expanded', 'false')
- $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
- })
+ $this.attr('aria-expanded', 'false');
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget);
+ });
}
function getParent($this) {
- var selector = $this.attr('data-target')
+ var selector = $this.attr('data-target');
if (!selector) {
- selector = $this.attr('href')
- selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+ selector = $this.attr('href');
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, ''); // strip for ie7
}
- var $parent = selector && $(selector)
+ var $parent = selector && $(selector);
- return $parent && $parent.length ? $parent : $this.parent()
+ return $parent && $parent.length ? $parent : $this.parent();
}
@@ -2110,27 +2146,27 @@
function Plugin(option) {
return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.dropdown')
+ var $this = $(this);
+ var data = $this.data('bs.dropdown');
- if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
- if (typeof option == 'string') data[option].call($this)
- })
+ if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)));
+ if (typeof option == 'string') data[option].call($this);
+ });
}
- var old = $.fn.dropdown
+ var old = $.fn.dropdown;
- $.fn.dropdown = Plugin
- $.fn.dropdown.Constructor = Dropdown
+ $.fn.dropdown = Plugin;
+ $.fn.dropdown.Constructor = Dropdown;
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
- $.fn.dropdown = old
- return this
- }
+ $.fn.dropdown = old;
+ return this;
+ };
// APPLY TO STANDARD DROPDOWN ELEMENTS
@@ -2138,11 +2174,11 @@
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
- .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation(); })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
- .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
+ .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown);
}(jQuery);
}
@@ -2305,12 +2341,7 @@
//confidence band
var confidence_area;
-
- //if it already exists, remove it
- var existing_band = svg.selectAll('.mg-confidence-band');
- if (!existing_band.empty()) {
- existing_band.remove();
- }
+ var existing_band = svg.select('.mg-confidence-band');
if (args.show_confidence_band) {
confidence_area = d3.svg.area()
@@ -2342,6 +2373,7 @@
//for building the optional legend
var legend = '';
var this_data;
+ var confidenceBand;
for (var i = args.data.length - 1; i >= 0; i--) {
this_data = args.data[i];
@@ -2356,10 +2388,20 @@
//add confidence band
if (args.show_confidence_band) {
- svg.append('path')
- .attr('class', 'mg-confidence-band')
- .attr('d', confidence_area(args.data[i]))
- .attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
+ if (!existing_band.empty()) {
+ confidenceBand = existing_band
+ .transition()
+ .duration(function() {
+ return (args.transition_on_update) ? 1000 : 0;
+ });
+ } else {
+ confidenceBand = svg.append('path')
+ .attr('class', 'mg-confidence-band');
+ }
+
+ confidenceBand
+ .attr('d', confidence_area(args.data[i]))
+ .attr('clip-path', 'url(#mg-plot-window-'+ mg_strip_punctuation(args.target)+')');
}
//add the area
@@ -2376,7 +2418,7 @@
.transition()
.duration(updateTransitionDuration)
.attr('d', area(args.data[i]))
- .attr('clip-path', 'url(#mg-plot-window)');
+ .attr('clip-path', 'url(#mg-plot-window'+ mg_strip_punctuation(args.target)+')');
} else { //otherwise, add the area
svg.append('path')
.attr('class', 'mg-main-area ' + 'mg-area' + (line_id) + '-color')
@@ -2424,6 +2466,64 @@
}
}
+ if (args.missing_is_hidden) {
+ var the_line = svg.select('.mg-line' + (line_id) + '-color');
+ var bits = the_line.attr('d').split('L');
+ var zero = args.scales.Y(0);
+ var dasharray = [];
+ var singleton_point_length = 2;
+
+ var x_y,
+ x_y_plus_1,
+ x,
+ y,
+ x_plus_1,
+ y_plus_1,
+ segment_length,
+ cumulative_segment_length = 0;
+
+ bits[0] = bits[0].replace('M', '');
+ bits[bits.length - 1] = bits[bits.length - 1].replace('Z', '');
+
+ //if we have a min_x, turn the line off first
+ if (args.min_x) {
+ dasharray.push(0);
+ }
+
+ //build the stroke-dasharray pattern
+ for (var j = 0; j < bits.length - 1; j++) {
+ x_y = bits[j].split(',');
+ x_y_plus_1 = bits[j + 1].split(',');
+ x = Number(x_y[0]);
+ y = Number(x_y[1]);
+ x_plus_1 = Number(x_y_plus_1[0]);
+ y_plus_1 = Number(x_y_plus_1[1]);
+
+ segment_length = Math.sqrt(Math.pow(x - x_plus_1, 2) + Math.pow(y - y_plus_1, 2));
+
+ //do we need to either cover or clear the current stroke
+ if (y_plus_1 == zero && y != zero) {
+ dasharray.push(cumulative_segment_length || singleton_point_length);
+ cumulative_segment_length = (cumulative_segment_length)
+ ? segment_length
+ : segment_length - singleton_point_length;
+ } else if (y_plus_1 != zero && y == zero) { //switching on line
+ dasharray.push(cumulative_segment_length += segment_length);
+ cumulative_segment_length = 0;
+ } else {
+ cumulative_segment_length += segment_length;
+ }
+ }
+
+ //fear not, end bit of line, ye too shall be covered
+ if (dasharray.length > 0) {
+ dasharray.push(the_line.node().getTotalLength() - dasharray[dasharray.length - 1]);
+
+ svg.select('.mg-line' + (line_id) + '-color')
+ .attr('stroke-dasharray', dasharray.join());
+ }
+ }
+
//build legend
if (args.legend) {
legend = "— "
@@ -2720,6 +2820,9 @@
.style('opacity', 1);
}
});
+ } else if (args.missing_is_hidden && d[args.y_accessor] == 0) {
+ //disable rollovers for hidden parts of the line
+ return;
} else {
//show circle on mouse-overed rect
@@ -3911,7 +4014,7 @@
if (this_format === 'percentage') formatter = d3.format('%p');
if (this_format === 'count') formatter = d3.format("0,000");
- if (this_format === 'temperature') formatter = function(t) { return t +'º'; };
+ if (this_format === 'temperature') formatter = function(t) { return t +'°'; };
td_text = formatter(td_text);
}
@@ -4113,11 +4216,16 @@
'use strict';
//do we have a time-series?
var is_time_series = args.data[0][0][args.x_accessor] instanceof Date
- ? true
- : false;
+ ? true
+ : false;
+
+ //force linear interpolation when missing_is_hidden is enabled
+ if (args.missing_is_hidden) {
+ args.interpolate = 'linear';
+ }
//are we replacing missing y values with zeros?
- if (args.missing_is_zero
+ if ((args.missing_is_zero || args.missing_is_hidden)
&& args.chart_type === 'line'
&& is_time_series
) {
diff --git a/dist/metricsgraphics.min.js b/dist/metricsgraphics.min.js
index 84636fd8bd..a9a673f158 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(r){var a=t.select(r.target);if(a.select(".mg-chart-title").remove(),r.target&&r.title){var n=r.show_tooltips&&r.description?'':"";if(a.insert("h2",":first-child").attr("class","mg-chart-title").html(r.title+n),r.show_tooltips&&r.description){var o=e(a.node()).find("h2.mg-chart-title");o.popover({html:!0,animation:!1,content:r.description,trigger:"hover",placement:"top",container:o})}}r.error&&S(r)}function a(t){for(var e=F(t.target),r="point"===t.chart_type?t.buffer/2:2*t.buffer/3,a=[],n=0;n0},u=function(t){return t[e.y_accessor]},d=0;d0){var p=t.extent(f,u);l?(o=Math.min(p[0],o),s=Math.max(p[1],s)):(o=p[0],s=p[1],l=!0)}}o>=0&&!e.min_y&&!e.min_y_from_data&&(o=0),"bar"===e.chart_type&&(o=0,s=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)})),o=null!==e.min_y?e.min_y:o,s=null!==e.max_y?e.max_y:s*e.inflator,"log"!==e.y_scale_type&&(o>=0?e.y_axis_negative=!1:(o-=s*(e.inflator-1),e.y_axis_negative=!0)),!e.min_y&&e.min_y_from_data&&(o/=e.inflator),"log"===e.y_scale_type?("histogram"===e.chart_type?o=.2:0>=o&&(o=1),e.scales.Y=t.scale.log().domain([o,s]).range([e.height-e.bottom-e.buffer,e.top]).clamp(!0)):e.scales.Y=t.scale.linear().domain([o,s]).range([e.height-e.bottom-e.buffer,e.top]),e.processed.min_y=o,e.processed.max_y=s,e.scales.Y_axis=t.scale.linear().domain([e.processed.min_y,e.processed.max_y]).range([e.height-e.bottom-e.buffer,e.top]);var h=e.yax_format;if(h||(h="count"===e.format?function(r){if(1>r)return e.yax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.yax_units+a.scale(r)+a.symbol}:function(e){var r=t.format("%p");return r(e)}),i.selectAll(".mg-y-axis").remove(),!e.y_axis)return this;n=i.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",e.use_small_class),e.y_label&&n.append("text").attr("class","label").attr("x",function(){return-1*(e.top+e.buffer+(e.height-e.bottom-e.buffer-(e.top+e.buffer))/2)}).attr("y",function(){return e.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(){return e.y_label}).attr("transform",function(){return"rotate(-90)"});var m=e.scales.Y.ticks(e.yax_count);"log"===e.y_scale_type&&(m=m.filter(function(t){return Math.abs(r(t))%1<1e-6||Math.abs(r(t))%1>1-1e-6}));var g=e.scales.Y.ticks(e.yax_count).length,_=!0;e.data.forEach(function(t){t.forEach(function(t){return t[e.y_accessor]%1!==0?(_=!1,!1):void 0})}),_&&g>s&&"count"===e.format&&(m=m.filter(function(t){return t%1===0}));var v=m.length-1;return e.x_extended_ticks||e.y_extended_ticks||n.append("line").attr("x1",e.left).attr("x2",e.left).attr("y1",e.scales.Y(m[0]).toFixed(2)).attr("y2",e.scales.Y(m[v]).toFixed(2)),n.selectAll(".mg-yax-ticks").data(m).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)}),n.selectAll(".mg-yax-labels").data(m).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=h(t);return e}),e.y_rug&&a(e),this}function o(e){e.scales.Y=t.scale.ordinal().domain(e.categorical_variables).rangeRoundBands([e.height-e.bottom-e.buffer,e.top],e.padding_percentage,e.outer_padding_percentage),e.scalefns.yf=function(t){return e.scales.Y(t[e.y_accessor])};var r=F(e.target);r.selectAll(".mg-y-axis").remove();var a=r.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",e.use_small_class);return e.y_axis?(a.selectAll("text").data(e.categorical_variables).enter().append("svg:text").attr("x",e.left).attr("y",function(t){return e.scales.Y(t)+e.scales.Y.rangeBand()/2+e.buffer*e.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String),this):this}function s(t){for(var e="point"===t.chart_type?t.buffer/2:t.buffer,r=F(t.target),a=[],n=0;n10?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,o;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,o=null===e.size_range?[1,5]:e.size_range,e.scales.size=t.scale.linear().domain(n).range(o).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.xax_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,o;return r.time_series&&(a=(r.processed.max_x-r.processed.min_x)/1e3,60>a?(n=t.time.format("%M:%S"),o="seconds"):24>=a/3600?(n=t.time.format("%H:%M"),o="less-than-a-day"):96>=a/3600?(n=t.time.format("%H:%M"),o="four-days"):(n=t.time.format("%b %d"),o="default")),r.processed.main_x_time_format=n,r.processed.x_time_frame=o,function(a){var n=(t.time.format("%b %d"),t.formatPrefix(a));return r.data[0][0][r.x_accessor]instanceof Date?r.processed.main_x_time_format(a):"number"===e.type(r.data[0][0][r.x_accessor])?1>a?r.xax_units+t.round(a,r.decimals):(n=t.formatPrefix(a),r.xax_units+n.scale(a)+n.symbol):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 m(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,o=r.processed.x_time_frame;switch(o){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 s=a(r.processed.min_x,r.processed.max_x);if(0===s.length){var i=r.scales.X.ticks(r.xax_count)[0];s=[i]}e=e.append("g").classed("mg-year-marker",!0).classed("mg-year-marker-small",r.use_small_class),"default"===o&&e.selectAll(".mg-year-marker").data(s).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(s).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 g(e){var r,a,n=[],o=[].concat.apply([],e.data),s=function(t){return t[e.x_accessor]};if(delete e.xax_format,"line"===e.chart_type||"point"===e.chart_type||"histogram"===e.chart_type?(n=t.extent(o,s),r=n[0],a=n[1]):"bar"===e.chart_type&&(r=0,a=t.max(o,function(t){var r=[t[e.x_accessor],t[e.baseline_accessor]?t[e.baseline_accessor]:0,t[e.predictor_accessor]?t[e.predictor_accessor]:0];return Math.max.apply(null,r)})),r===a){if(r instanceof Date){var i=MG.clone(r).setDate(r.getDate()-1),l=MG.clone(r).setDate(r.getDate()+1);r=i,a=l}else"number"==typeof r?(r-=1,a+=1):"string"==typeof r&&(r=Number(r)-1,a=Number(a)+1);e.xax_count=2}r=e.min_x?e.min_x:r,a=e.max_x?e.max_x:a,e.x_axis_negative=!1,e.processed.min_x=r,e.processed.max_x=a,_(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(e){var a={target:null,title:null,description:null},e=arguments[0];if(e||(e={}),e=$(e,a),t.select(e.target).empty())return void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.');var n=t.select(e.target),o=n.selectAll("svg");e.time_series=e.data[0][0][e.x_accessor]instanceof Date?!0:!1;var s=e.width,i=e.height;e.full_width&&(s=z(e.target)),e.fill_height&&(i=E(e.target)),"bar"===e.chart_type&&null===i&&(i=e.height=e.data[0].length*e.bar_height+e.top+e.bottom),(!o.selectAll(".mg-main-line").empty()&&"line"!==e.chart_type||!o.selectAll(".mg-points").empty()&&"point"!==e.chart_type||!o.selectAll(".mg-histogram").empty()&&"histogram"!==e.chart_type||!o.selectAll(".mg-barplot").empty()&&"bar"!==e.chart_type)&&o.remove(),F(e.target).empty()&&(o=t.select(e.target).append("svg").classed("linked",e.linked).attr("width",s).attr("height",i)),e.width=s,e.height=i,o.selectAll(".mg-clip-path").remove(),o.append("defs").attr("class","mg-clip-path").append("clipPath").attr("class","mg-plot-window-"+C(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),s!==Number(o.attr("width"))&&o.attr("width",s),i!==Number(o.attr("height"))&&o.attr("height",i),o.attr("viewBox","0 0 "+s+" "+i),(e.full_width||e.full_height)&&o.attr("preserveAspectRatio","xMinYMin meet"),o.classed("mg-missing",!1),o.selectAll(".mg-missing-text").remove(),o.selectAll(".mg-missing-pane").remove(),r(e),e.use_small_class=e.height-e.top-e.bottom-e.buffer<=e.small_height_threshold&&e.width-e.left-e.right-2*e.buffer<=e.small_width_threshold||e.small_text;var l=0;if(e.data.length0){var c=function(t){for(var e=new Array(t),r=0;rd;l--)o.selectAll(".mg-main-line.mg-line"+l+"-color").remove()}return this}function x(t){var e,r,a=F(t.target);return a.selectAll(".mg-markers").remove(),a.selectAll(".mg-baselines").remove(),t.markers&&(e=a.append("g").attr("class","mg-markers"),e.selectAll(".mg-markers").data(t.markers.filter(function(e){return t.scales.X(e[t.x_accessor])>t.buffer+t.left&&t.scales.X(e[t.x_accessor])t.buffer+t.left&&t.scales.X(e[t.x_accessor])=c;c.setDate(c.getDate()+1)){var u={};c.setHours(0,0,0,0),Date.parse(c)===Date.parse(new Date(s))&&o.push(MG.clone(t.data[r][0]));var d=null;t.data[r].forEach(function(e){return Date.parse(e[t.x_accessor])===Date.parse(new Date(c))?(d=e,!1):void 0}),d?o.push(d):(u[t.x_accessor]=new Date(c),u[t.y_accessor]=0,o.push(u)),Date.parse(c)===Date.parse(new Date(n[t.x_accessor]))&&o.push(n)}t.data[r]=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 o,s,i=0;it?"M"+u.map(function(e){return e(t)}).join("L"):e}}}function F(e){return t.select(e).select("svg")}function C(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r}function P(e,r){return Number(t.select(e).style(r).replace(/px/g,""))}function z(t){return P(t,"width")}function E(t){return P(t,"height")}function $(t){return I(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 G(t,e){var r,a=[],n=[];for(r=0;rr&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function S(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")}window.MG={version:"2.1.0"};var L={};MG.globals={},MG.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"}},MG.globals.link=!1,MG.globals.version="1.1",MG.data_graphic=function(){var e={};e.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,linked_format:"%Y-%m-%d",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,show_tooltips:!0},e.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"},e.histogram={mouseover:function(e){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},e.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},e.missing={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_missing_background:!0,interpolate:"cardinal"};var r=arguments[0];r||(r={}),r.list&&(r.x_accessor=0,r.y_accessor=1);for(var a in MG.deprecations)if(r.hasOwnProperty(a)){var n=MG.deprecations[a],o="Use of `args."+a+"` has been deprecated",s=n.replacement;if(s&&(r[s]?o+=". The replacement - `args."+s+"` - has already been defined. This definition will be discarded.":r[s]=r[a]),n.warned)continue;n.warned=!0,s&&(o+=" in favor of `args."+s+"`"),N(o,n.version)}var i;return"missing-data"===r.chart_type?(r=$(r,e.missing),L.missing(r)):"point"===r.chart_type?(i=$(e.point,e.all),r=$(r,i),L.point(r).mainPlot().markers().rollover().windowListeners()):"histogram"===r.chart_type?(i=$(e.histogram,e.all),r=$(r,i),L.histogram(r).mainPlot().markers().rollover().windowListeners()):"bar"===r.chart_type?(i=$(e.bar,e.all),r=$(r,i),L.bar(r).mainPlot().markers().rollover().windowListeners()):(r=$(r,e.all),L.line(r).markers().mainPlot().rollover().windowListeners()),r.data},"undefined"!=typeof jQuery&&(+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),o="object"==typeof e&&e,s=o&&o.selector;(n||"destroy"!=e)&&(s?(n||a.data("bs.tooltip",n={}),n[s]||(n[s]=new r(this,o))):n||a.data("bs.tooltip",n=new r(this,o)),"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(" "),o=n.length;o--;){var s=n[o];if("click"==s)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=s){var i="hover"==s?"mouseenter":"focusin",l="hover"==s?"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,o=this.tip(),s=this.getUID(this.type);this.setContent(),o.attr("id",s),this.$element.attr("aria-describedby",s),this.options.animation&&o.addClass("fade");var i="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(i);c&&(i=i.replace(l,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element);var u=this.getPosition(),d=o[0].offsetWidth,f=o[0].offsetHeight;if(c){var p=i,h=this.options.container?t(this.options.container):this.$element.parent(),m=this.getPosition(h);i="bottom"==i&&u.bottom+f>m.bottom?"top":"top"==i&&u.top-fm.width?"left":"left"==i&&u.left-ds.top+s.height&&(n.top=s.top+s.height-l)}else{var c=e.left-o,u=e.left+o+r;cs.width&&(n.left=s.left+s.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"),o="object"==typeof e&&e,s=o&&o.selector;(n||"destroy"!=e)&&(s?(n||a.data("bs.popover",n={}),n[s]||(n[s]=new r(this,o))):n||a.data("bs.popover",n=new r(this,o)),"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&&+function(t){function e(e){e&&3===e.which||(t(n).remove(),t(o).each(function(){var a=t(this),n=r(a),o={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",o)))}))}function r(e){var r=e.attr("data-target");r||(r=e.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var a=r&&t(r);return a&&a.length?a:e.parent()}function a(e){return this.each(function(){var r=t(this),a=r.data("bs.dropdown");a||r.data("bs.dropdown",a=new s(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",o='[data-toggle="dropdown"]',s=function(e){t(e).on("click.bs.dropdown",this.toggle)};s.VERSION="3.3.1",s.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),s=o.hasClass("open");if(e(),!s){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('').insertAfter(t(this)).on("click",e);var i={relatedTarget:this};if(o.trigger(a=t.Event("show.bs.dropdown",i)),a.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger("shown.bs.dropdown",i)}return!1}},s.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var a=t(this);if(e.preventDefault(),e.stopPropagation(),!a.is(".disabled, :disabled")){var n=r(a),s=n.hasClass("open");if(!s&&27!=e.which||s&&27==e.which)return 27==e.which&&n.find(o).trigger("focus"),a.trigger("click");var i=" li:not(.divider):visible a",l=n.find('[role="menu"]'+i+', [role="listbox"]'+i);if(l.length){var c=l.index(e.target);38==e.which&&c>0&&c--,40==e.which&&c1&&(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,a,n,o=this._callback,s=this.manual_callback,i=this.manual_map;a=Object.keys(this.feature_set);var l,c=function(e){return t[e]};for(l=0;l");var d=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],s[t](r)):o(a,r),!1};for(var f in this.feature_set){for(a=this.feature_set[f],e(this.target+" div.segments").append('"),l=0;l'+a[l]+"");e("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",d)}return this},this},L.line=function(e){return this.args=e,this.init=function(t){return w(t),k(t),v(t),i(t),n(t),this},this.mainPlot=function(){var r,a=F(e.target),n=0,o=e.transition_on_update?1e3:0,s=function(t){return t[e.y_accessor]},i=t.svg.area().x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).interpolate(e.interpolate),l=a.selectAll(".mg-confidence-band");l.empty()||l.remove(),e.show_confidence_band&&(r=t.svg.area().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));for(var c,u=t.svg.line().x(e.scalefns.xf).y(e.scalefns.yf).interpolate(e.interpolate),d=t.svg.line().x(e.scalefns.xf).y(function(){return e.scales.Y(n)}).interpolate(e.interpolate),f="",p=e.data.length-1;p>=0;p--){c=e.data[p];var h=p+1;e.custom_line_color_map.length>0&&(h=e.custom_line_color_map[p]),e.data[p].line_id=h,e.show_confidence_band&&a.append("path").attr("class","mg-confidence-band").attr("d",r(e.data[p])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")");var m=a.selectAll(".mg-area"+h+"-color"),g=e.area&&!e.use_data_y_min&&!e.y_axis_negative&&e.data.length<=1;g?m.empty()?a.append("path").attr("class","mg-main-area mg-area"+h+"-color").attr("d",i(e.data[p])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")"):(a.select(".mg-y-axis").node().parentNode.appendChild(m.node()),m.transition().duration(o).attr("d",i(e.data[p])).attr("clip-path","url(#mg-plot-window)")):m.empty()||m.remove();var _=a.select("path.mg-main-line.mg-line"+h+"-color");if(_.empty())e.animate_on_load?(n=t.median(e.data[p],s),a.append("path").attr("class","mg-main-line mg-line"+h+"-color").attr("d",d(e.data[p])).transition().duration(1e3).attr("d",u(e.data[p])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")")):a.append("path").attr("class","mg-main-line mg-line"+h+"-color").attr("d",u(e.data[p])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")");else{a.select(".mg-y-axis").node().parentNode.appendChild(_.node());var v=_.transition().duration(o);g?v.attr("d",u(e.data[p])):v.attrTween("d",X(u(e.data[p]),4))}e.legend&&(f="— "+e.legend[p]+" "+f)}return e.legend&&t.select(e.legend_target).html(f),this},this.markers=function(){return x(e),this},this.rollover=function(){var r,a=F(e.target);a.selectAll(".mg-rollover-rect").remove(),a.selectAll(".mg-voronoi").remove(),a.selectAll(".mg-active-datapoint").remove(),a.selectAll(".mg-line-rollover-circle").remove(),a.selectAll(".mg-active-datapoint-container").remove(),a.append("g").attr("class","mg-active-datapoint-container").attr("transform","translate("+(e.width-e.right)+","+e.top/2+")").append("text").attr("class","mg-active-datapoint").classed("mg-active-datapoint-small",e.use_small_class).attr("xml:space","preserve").attr("text-anchor","end"),a.selectAll(".mg-line-rollover-circle").data(e.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 n=1,o=0;o0?e.custom_line_color_map[o]:n;n++}var i,l;if(e.data.length>1&&!e.aggregate_rollover){var c=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.width-e.buffer,e.height-e.buffer]]);r=a.append("g").attr("class","mg-voronoi"),i=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}),r.selectAll("path").data(c(i)).enter().append("path").filter(function(t){return void 0!==t}).attr("d",function(t){return"M"+t.join("L")+"Z"}).datum(function(t){return t.point}).attr("class",function(r){if(e.linked){var a=r[e.x_accessor],n=t.time.format(e.linked_format),s="number"==typeof a?o:n(a);return"mg-line"+r.line_id+"-color roll_"+s}return"mg-line"+r.line_id+"-color"}).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e))}else e.data.length>1&&e.aggregate_rollover?(i=t.nest().key(function(t){return t[e.x_accessor]}).entries(t.merge(e.data)),l=i.map(function(t){return e.scales.X(new Date(t.key))}),r=a.append("g").attr("class","mg-rollover-rect"),r.selectAll(".mg-rollover-rects").data(i).enter().append("rect").attr("x",function(t,r){return 1===l.length?e.left+e.buffer:0===r?l[r].toFixed(2):((l[r-1]+l[r])/2).toFixed(2)}).attr("y",e.top).attr("width",function(t,r){return 1===l.length?e.width-e.right-e.buffer:0===r?((l[r+1]-l[r])/2).toFixed(2):r==l.length-1?((l[r]-l[r-1])/2).toFixed(2):((l[r+1]-l[r-1])/2).toFixed(2)}).attr("height",e.height-e.bottom-e.top-e.buffer).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e))):(n=1,e.custom_line_color_map.length>0&&(n=e.custom_line_color_map[0]),r=a.append("g").attr("class","mg-rollover-rect"),l=e.data[0].map(e.scalefns.xf),r.selectAll(".mg-rollover-rects").data(e.data[0]).enter().append("rect").attr("class",function(r,a){if(e.linked){var o=r[e.x_accessor],s=t.time.format(e.linked_format),i="number"==typeof o?a:s(o);return"mg-line"+n+"-color roll_"+i}return"mg-line"+n+"-color"}).attr("x",function(t,r){return 1===l.length?e.left+e.buffer:0===r?l[r].toFixed(2):((l[r-1]+l[r])/2).toFixed(2)}).attr("y",function(t){return e.data.length>1?e.scalefns.yf(t)-6:e.top}).attr("width",function(t,r){return 1===l.length?e.width-e.right-e.buffer:0===r?((l[r+1]-l[r])/2).toFixed(2):r===l.length-1?((l[r]-l[r-1])/2).toFixed(2):((l[r+1]-l[r-1])/2).toFixed(2)}).attr("height",function(){return e.data.length>1?12:e.height-e.bottom-e.top-e.buffer}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)));return 1==e.data.length&&1==e.data[0].length&&t.select(".mg-rollover-rect .mg-line1-color").on("mouseover")(e.data[0][0],0),this},this.rolloverOn=function(e){var r,a=F(e.target);switch(e.processed.x_time_frame){case"seconds":r=t.time.format("%b %e, %Y %H:%M:%S");break;case"less-than-a-day":r=t.time.format("%b %e, %Y %I:%M%p");break;case"four-days":r=t.time.format("%b %e, %Y %I:%M%p");break;default:r=t.time.format("%b %e, %Y")}return function(n,o){if(e.aggregate_rollover&&e.data.length>1)a.selectAll("circle.mg-line-rollover-circle").style("opacity",0),n.values.forEach(function(t){if(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){a.select("circle.mg-line"+t.line_id+"-color").attr({cx:function(){return e.scales.X(t[e.x_accessor]).toFixed(2)},cy:function(){return e.scales.Y(t[e.y_accessor]).toFixed(2)},r:e.point_size}).style("opacity",1)}});else if(n[e.x_accessor]>=e.processed.min_x&&n[e.x_accessor]<=e.processed.max_x&&n[e.y_accessor]>=e.processed.min_y&&n[e.y_accessor]<=e.processed.max_y&&a.selectAll("circle.mg-line-rollover-circle").attr("class","").attr("class","mg-area"+n.line_id+"-color").classed("mg-line-rollover-circle",!0).attr("cx",function(){return e.scales.X(n[e.x_accessor]).toFixed(2)}).attr("cy",function(){return e.scales.Y(n[e.y_accessor]).toFixed(2)}).attr("r",e.point_size).style("opacity",1),e.linked&&!MG.globals.link){MG.globals.link=!0;var s=n[e.x_accessor],i=t.time.format(e.linked_format),l="number"==typeof s?o:i(s);t.selectAll(".mg-line"+n.line_id+"-color.roll_"+l).each(function(e,r){t.select(this).on("mouseover")(e,r)})}a.selectAll("text").filter(function(t){return n===t}).attr("opacity",.3);var c=T(e);if(e.show_rollover_text){var u=a.select(".mg-active-datapoint"),d=0,f=1.1;if(u.select("*").remove(),e.aggregate_rollover&&e.data.length>1){if(e.time_series){var p=new Date(n.key);u.append("tspan").text((r(p)+" "+e.yax_units).trim()),d=1,n.values.forEach(function(t){var r=u.append("tspan").attr({x:0,y:d*f+"em"}).text(c(t[e.y_accessor]));u.append("tspan").attr({x:-r.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 n.values.forEach(function(t){var r=u.append("tspan").attr({x:0,y:d*f+"em"}).text(e.x_accessor+": "+t[e.x_accessor]+", "+e.y_accessor+": "+e.yax_units+c(t[e.y_accessor]));u.append("tspan").attr({x:-r.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(e.time_series){var h=new Date(+n[e.x_accessor]);h.setDate(h.getDate()),u.append("tspan").text(r(h)+" "+e.yax_units+c(n[e.y_accessor]))}else u.append("tspan").text(e.x_accessor+": "+n[e.x_accessor]+", "+e.y_accessor+": "+e.yax_units+c(n[e.y_accessor]))}e.mouseover&&e.mouseover(n,o)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){if(e.linked&&MG.globals.link){MG.globals.link=!1;var o=a[e.x_accessor],s=t.time.format(e.linked_format),i="number"==typeof o?n:s(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})}r.selectAll("circle.mg-line-rollover-circle").style("opacity",function(){return 1==e.data.length&&1==e.data[0].length?1:0}),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},L.histogram=function(e){return this.args=e,this.init=function(t){return w(t),A(t),v(t),i(t),n(t),this},this.mainPlot=function(){var t=F(e.target);t.selectAll(".mg-histogram").remove();var r=t.append("g").attr("class","mg-histogram"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor]).toFixed(2)+","+e.scales.Y(t[e.y_accessor]).toFixed(2)+")"});return a.append("rect").attr("x",1).attr("width",function(){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2)}).attr("height",function(t){return 0===t[e.y_accessor]?0:(e.height-e.bottom-e.buffer-e.scales.Y(t[e.y_accessor])).toFixed(2)}),this},this.markers=function(){return x(e),this},this.rollover=function(){var t=F(e.target);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",e.width-e.right).attr("y",e.top/2).attr("text-anchor","end");var r=t.append("g").attr("class","mg-rollover-rect"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class",function(t,r){return e.linked?"mg-rollover-rects roll_"+r:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",0).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(2):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(2)}).attr("height",function(){return e.height}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){{var r=F(e.target);t.time.format("%Y-%m-%d")}return function(a,n){r.selectAll("text").filter(function(t){return a===t}).attr("opacity",.3);var o=t.time.format("%b %e, %Y"),s=T(e);r.selectAll(".mg-bar rect").filter(function(t,e){return e===n}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseover")(e,n)})),e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+a[e.x_accessor]);return t.setDate(t.getDate()),o(t)+" "+e.yax_units+s(a[e.y_accessor])}return e.x_accessor+": "+s(a[e.x_accessor])+", "+e.y_accessor+": "+e.yax_units+s(a[e.y_accessor])}),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseout")(e,n)})),r.selectAll(".mg-bar rect").classed("active",!1),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},L.point=function(e){return this.args=e,this.init=function(t){return w(t),M(t),v(t),i(t),n(t),this},this.markers=function(){return x(e),e.least_squares&&O(e),this},this.mainPlot=function(){var t,r=F(e.target);r.selectAll(".mg-points").remove(),t=r.append("g").classed("mg-points",!0);var a=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?(a.attr("fill",e.scalefns.color),a.attr("stroke",e.scalefns.color)):a.classed("mg-points-mono",!0),null!==e.size_accessor?a.attr("r",e.scalefns.size):a.attr("r",e.point_size),this},this.rollover=function(){var r=F(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",e.top/2).attr("text-anchor","end");var a=t.geom.voronoi().x(e.scalefns.xf).y(e.scalefns.yf).clipExtent([[e.buffer,e.buffer],[e.width-e.buffer,e.height-e.buffer]]),n=r.append("g").attr("class","mg-voronoi");return n.selectAll("path").data(a(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=F(e.target);return function(a,n){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+n).classed("selected",!0);e.size_accessor?o.attr("r",function(t){return e.scalefns.size(t)+1}):o.attr("r",e.point_size),e.linked&&!globals.link&&(globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(a,n)}));var s=t.time.format("%b %e, %Y"),i=T(e);e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+a.point[e.x_accessor]);return t.setDate(t.getDate()),s(t)+" "+e.yax_units+i(a.point[e.y_accessor])}return e.x_accessor+": "+i(a.point[e.x_accessor])+", "+e.y_accessor+": "+e.yax_units+i(a.point[e.y_accessor])}),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){e.linked&&globals.link&&(globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(a,n)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.size):o.attr("r",e.point_size),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},L.bar=function(e){return this.args=e,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),o(t)),this},this.mainPlot=function(){var t,r,a,n,o,s=F(e.target),i=e.data[0],l=s.select(".mg-barplot"),c=l.empty(),u=c&&e.animate_on_load,d=u||e.transition_on_update,f=e.transition_duration||1e3;c?(l=s.append("g").classed("mg-barplot",!0),t=l.selectAll(".mg-bar").data(i).enter().append("rect").classed("mg-bar",!0),e.predictor_accessor&&(r=l.selectAll(".mg-bar-prediction").data(i).enter().append("rect").classed("mg-bar-prediction",!0)),e.baseline_accessor&&(o=l.selectAll(".mg-bar-baseline").data(i).enter().append("line").classed("mg-bar-baseline",!0))):(s.select(".mg-y-axis").node().parentNode.appendChild(l.node()),console.log("waylee"),t=l.selectAll("rect.mg-bar"),e.predictor_accessor&&(r=l.selectAll(".mg-bar-prediction")),e.baseline_accessor&&(o=l.selectAll(".mg-bar-baseline")));var p;return this.is_vertical?(p=e.scales.X.rangeBand()/1.5,u&&t.attr("height",0).attr("y",e.scales.Y(0)),d&&(t=t.transition().duration(f)),t.attr("y",function(t){return e.scales.Y(0)-(e.scales.Y(0)-e.scalefns.yf(t))}).attr("x",function(t){return e.scalefns.xf(t)+p/2}).attr("width",p).attr("height",function(t){return 0-(e.scalefns.yf(t)-e.scales.Y(0))}),e.predictor_accessor&&(a=e.predictor_proportion,n=a-1,u&&r.attr("height",0).attr("y",e.scales.Y(0)),d&&(r=r.transition().duration(f)),r.attr("y",function(t){return e.scales.Y(0)-(e.scales.Y(0)-e.scales.Y(t[e.predictor_accessor]))}).attr("x",function(t){return e.scalefns.xf(t)+n*p/(2*a)+p/2}).attr("width",p/a).attr("height",function(t){return 0-(e.scales.Y(t[e.predictor_accessor])-e.scales.Y(0))})),e.baseline_accessor&&(a=e.predictor_proportion,u&&o.attr({y1:e.scales.Y(0),y2:e.scales.Y(0)}),d&&(o=o.transition().duration(f)),o.attr("x1",function(t){return e.scalefns.xf(t)+p/2-p/a+p/2}).attr("x2",function(t){return e.scalefns.xf(t)+p/2+p/a+p/2}).attr("y1",function(t){return e.scales.Y(t[e.baseline_accessor])}).attr("y2",function(t){return e.scales.Y(t[e.baseline_accessor])}))):(p=e.scales.Y.rangeBand()/1.5,u&&t.attr("width",0),d&&(t=t.transition().duration(f)),t.attr("x",e.scales.X(0)).attr("y",function(t){return e.scalefns.yf(t)+p/2}).attr("height",p).attr("width",function(t){return e.scalefns.xf(t)-e.scales.X(0)}),e.predictor_accessor&&(a=e.predictor_proportion,n=a-1,u&&r.attr("width",0),d&&(r=r.transition().duration(f)),r.attr("x",e.scales.X(0)).attr("y",function(t){return e.scalefns.yf(t)+n*p/(2*a)+p/2}).attr("height",p/a).attr("width",function(t){return e.scales.X(t[e.predictor_accessor])-e.scales.X(0)})),e.baseline_accessor&&(a=e.predictor_proportion,u&&o.attr({x1:e.scales.X(0),x2:e.scales.X(0)}),d&&(o=o.transition().duration(f)),o.attr("x1",function(t){return e.scales.X(t[e.baseline_accessor])}).attr("x2",function(t){return e.scales.X(t[e.baseline_accessor])}).attr("y1",function(t){return e.scalefns.yf(t)+p/2-p/a+p/2}).attr("y2",function(t){return e.scalefns.yf(t)+p/2+p/a+p/2}))),this},this.markers=function(){return x(e),this},this.rollover=function(){var t,r=F(e.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",e.width-e.right).attr("y",e.top/2).attr("dy",".35em").attr("text-anchor","end"),t=r.append("g").attr("class","mg-rollover-rect");var a=t.selectAll(".mg-bar-rollover").data(e.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return this.is_vertical?a.attr("x",e.scalefns.xf).attr("y",function(){return e.scales.Y(0)-e.height}).attr("width",e.scales.X.rangeBand()).attr("height",e.height).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)):a.attr("x",e.scales.X(0)).attr("y",e.scalefns.yf).attr("width",e.width).attr("height",e.scales.Y.rangeBand()+2).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=F(e.target),a=this.is_vertical?e.x_accessor:e.y_accessor,n=this.is_vertical?e.y_accessor:e.x_accessor,o=this.is_vertical?e.yax_units:e.xax_units;return function(s,i){r.selectAll("text").filter(function(t){return s===t}).attr("opacity",.3);var l=t.time.format("%b %e, %Y"),c=T(e);r.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===i}).classed("active",!0),e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+s[n]);return t.setDate(t.getDate()),l(t)+" "+o+c(s[a])}return s[a]+": "+c(s[n])}),e.mouseover&&e.mouseover(s,i)}},this.rolloverOff=function(t){var e=F(t.target);return function(r,a){e.selectAll("g.mg-barplot .mg-bar").classed("active",!1),e.select(".mg-active-datapoint").text(""),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return y(this.args),this},this.init(e),this},MG.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],o=a[1];r[o]&&t.style(n,"string"==typeof r[o]||"number"==typeof r[o]?r[o]:r[o](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=$(MG.clone(t),MG.clone(r));a.type=e,this.args.columns.push(a)},this.target=function(){var t=arguments[0];return this.args.target=t,this},this.title=function(){return this._add_column(arguments[0],"title"),this},this.text=function(){return this._add_column(arguments[0],"text"),this},this.bullet=function(){return this},this.sparkline=function(){return this},this.number=function(){return this._add_column(arguments[0],"number"),this},this.display=function(){var a=this.args;r(a);var n,o,s,i,l,c,u,d,f,p,h,m,g=a.target,_=t.select(g).append("table").classed("mg-data-table",!0),v=_.append("colgroup"),x=_.append("thead"),y=_.append("tbody");for(s=x.append("tr"),m=0;m=o;o++)n.push({x:o,y:Math.random()-.03*o});e.scales.X=t.scale.linear().domain([0,n.length]).range([e.left+e.buffer,e.width-e.right-e.buffer]),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)},e.scalefns.yf=function(t){return e.scales.Y(t.y)
-};var s=t.svg.line().x(e.scalefns.xf).y(e.scalefns.yf).interpolate(e.interpolate),i=t.svg.area().x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).interpolate(e.interpolate),l=a.append("g").attr("class","mg-missing-pane");l.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),l.append("path").attr("class","mg-main-line mg-line1-color").attr("d",s(n)),l.append("path").attr("class","mg-main-area mg-area1-color").attr("d",i(n))}return a.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),this},this.init(e),this},MG.convert={},MG.convert.date=function(e,r,a){return a="undefined"==typeof a?"%Y-%m-%d":a,e=e.map(function(e){var n=t.time.format(a);return e[r]=n.parse(e[r]),e})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})};var I=function(t,e,r){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,n=t.length;n>a;a++)if(e.call(r,t[a],a,t)===breaker)return}else for(var o in t)if(e.call(r,t[o],o,t)===breaker)return;return t};return 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,a=t.length;a>r;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=MG.clone(t[n]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG})}).call(this);
\ No newline at end of file
+(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(r){var a=t.select(r.target);if(a.select(".mg-chart-title").remove(),r.target&&r.title){var n=r.show_tooltips&&r.description?'':"";if(a.insert("h2",":first-child").attr("class","mg-chart-title").html(r.title+n),r.show_tooltips&&r.description){var o=e(a.node()).find("h2.mg-chart-title");o.popover({html:!0,animation:!1,content:r.description,trigger:"hover",placement:"top",container:o})}}r.error&&L(r)}function a(t){for(var e=F(t.target),r="point"===t.chart_type?t.buffer/2:2*t.buffer/3,a=[],n=0;n0},u=function(t){return t[e.y_accessor]},d=0;d0){var p=t.extent(f,u);l?(o=Math.min(p[0],o),s=Math.max(p[1],s)):(o=p[0],s=p[1],l=!0)}}o>=0&&!e.min_y&&!e.min_y_from_data&&(o=0),"bar"===e.chart_type&&(o=0,s=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)})),o=null!==e.min_y?e.min_y:o,s=null!==e.max_y?e.max_y:s*e.inflator,"log"!==e.y_scale_type&&(o>=0?e.y_axis_negative=!1:(o-=s*(e.inflator-1),e.y_axis_negative=!0)),!e.min_y&&e.min_y_from_data&&(o/=e.inflator),"log"===e.y_scale_type?("histogram"===e.chart_type?o=.2:0>=o&&(o=1),e.scales.Y=t.scale.log().domain([o,s]).range([e.height-e.bottom-e.buffer,e.top]).clamp(!0)):e.scales.Y=t.scale.linear().domain([o,s]).range([e.height-e.bottom-e.buffer,e.top]),e.processed.min_y=o,e.processed.max_y=s,e.scales.Y_axis=t.scale.linear().domain([e.processed.min_y,e.processed.max_y]).range([e.height-e.bottom-e.buffer,e.top]);var h=e.yax_format;if(h||(h="count"===e.format?function(r){if(1>r)return e.yax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.yax_units+a.scale(r)+a.symbol}:function(e){var r=t.format("%p");return r(e)}),i.selectAll(".mg-y-axis").remove(),!e.y_axis)return this;n=i.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",e.use_small_class),e.y_label&&n.append("text").attr("class","label").attr("x",function(){return-1*(e.top+e.buffer+(e.height-e.bottom-e.buffer-(e.top+e.buffer))/2)}).attr("y",function(){return e.left/2}).attr("dy","0.4em").attr("text-anchor","middle").text(function(){return e.y_label}).attr("transform",function(){return"rotate(-90)"});var m=e.scales.Y.ticks(e.yax_count);"log"===e.y_scale_type&&(m=m.filter(function(t){return Math.abs(r(t))%1<1e-6||Math.abs(r(t))%1>1-1e-6}));var g=e.scales.Y.ticks(e.yax_count).length,_=!0;e.data.forEach(function(t){t.forEach(function(t){return t[e.y_accessor]%1!==0?(_=!1,!1):void 0})}),_&&g>s&&"count"===e.format&&(m=m.filter(function(t){return t%1===0}));var v=m.length-1;return e.x_extended_ticks||e.y_extended_ticks||n.append("line").attr("x1",e.left).attr("x2",e.left).attr("y1",e.scales.Y(m[0]).toFixed(2)).attr("y2",e.scales.Y(m[v]).toFixed(2)),n.selectAll(".mg-yax-ticks").data(m).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)}),n.selectAll(".mg-yax-labels").data(m).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=h(t);return e}),e.y_rug&&a(e),this}function o(e){e.scales.Y=t.scale.ordinal().domain(e.categorical_variables).rangeRoundBands([e.height-e.bottom-e.buffer,e.top],e.padding_percentage,e.outer_padding_percentage),e.scalefns.yf=function(t){return e.scales.Y(t[e.y_accessor])};var r=F(e.target);r.selectAll(".mg-y-axis").remove();var a=r.append("g").classed("mg-y-axis",!0).classed("mg-y-axis-small",e.use_small_class);return e.y_axis?(a.selectAll("text").data(e.categorical_variables).enter().append("svg:text").attr("x",e.left).attr("y",function(t){return e.scales.Y(t)+e.scales.Y.rangeBand()/2+e.buffer*e.outer_padding_percentage}).attr("dy",".35em").attr("text-anchor","end").text(String),this):this}function s(t){for(var e="point"===t.chart_type?t.buffer/2:t.buffer,r=F(t.target),a=[],n=0;n10?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,o;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,o=null===e.size_range?[1,5]:e.size_range,e.scales.size=t.scale.linear().domain(n).range(o).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.xax_units+t.round(r,e.decimals);var a=t.formatPrefix(r);return e.xax_units+a.scale(r)+a.symbol}}function p(e){if(e.xax_format)return e.xax_format;var r,a,n;return e.time_series&&(r=(e.processed.max_x-e.processed.min_x)/1e3,60>r?(a=t.time.format("%M:%S"),n="seconds"):24>=r/3600?(a=t.time.format("%H:%M"),n="less-than-a-day"):96>=r/3600?(a=t.time.format("%H:%M"),n="four-days"):(a=t.time.format("%b %d"),n="default")),e.processed.main_x_time_format=a,e.processed.x_time_frame=n,function(r){var a=(t.time.format("%b %d"),t.formatPrefix(r));return e.data[0][0][e.x_accessor]instanceof Date?e.processed.main_x_time_format(r):"number"==typeof e.data[0][0][e.x_accessor]?1>r?e.xax_units+t.round(r,e.decimals):(a=t.formatPrefix(r),e.xax_units+a.scale(r)+a.symbol):r}}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 m(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,o=r.processed.x_time_frame;switch(o){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 s=a(r.processed.min_x,r.processed.max_x);if(0===s.length){var i=r.scales.X.ticks(r.xax_count)[0];s=[i]}e=e.append("g").classed("mg-year-marker",!0).classed("mg-year-marker-small",r.use_small_class),"default"===o&&e.selectAll(".mg-year-marker").data(s).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(s).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 g(e){var r,a,n=[],o=[].concat.apply([],e.data),s=function(t){return t[e.x_accessor]};if(delete e.xax_format,"line"===e.chart_type||"point"===e.chart_type||"histogram"===e.chart_type?(n=t.extent(o,s),r=n[0],a=n[1]):"bar"===e.chart_type&&(r=0,a=t.max(o,function(t){var r=[t[e.x_accessor],t[e.baseline_accessor]?t[e.baseline_accessor]:0,t[e.predictor_accessor]?t[e.predictor_accessor]:0];return Math.max.apply(null,r)})),r===a){if(r instanceof Date){var i=MG.clone(r).setDate(r.getDate()-1),l=MG.clone(r).setDate(r.getDate()+1);r=i,a=l}else"number"==typeof r?(r-=1,a+=1):"string"==typeof r&&(r=Number(r)-1,a=Number(a)+1);e.xax_count=2}r=e.min_x?e.min_x:r,a=e.max_x?e.max_x:a,e.x_axis_negative=!1,e.processed.min_x=r,e.processed.max_x=a,_(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(e){var a={target:null,title:null,description:null};if(e=arguments[0],e||(e={}),e=$(e,a),t.select(e.target).empty())return void console.warn('The specified target element "'+e.target+'" could not be found in the page. The chart will not be rendered.');var n=t.select(e.target),o=n.selectAll("svg");e.time_series=e.data[0][0][e.x_accessor]instanceof Date?!0:!1;var s=e.width,i=e.height;e.full_width&&(s=z(e.target)),e.fill_height&&(i=E(e.target)),"bar"===e.chart_type&&null===i&&(i=e.height=e.data[0].length*e.bar_height+e.top+e.bottom),(!o.selectAll(".mg-main-line").empty()&&"line"!==e.chart_type||!o.selectAll(".mg-points").empty()&&"point"!==e.chart_type||!o.selectAll(".mg-histogram").empty()&&"histogram"!==e.chart_type||!o.selectAll(".mg-barplot").empty()&&"bar"!==e.chart_type)&&o.remove(),F(e.target).empty()&&(o=t.select(e.target).append("svg").classed("linked",e.linked).attr("width",s).attr("height",i)),e.width=s,e.height=i,o.selectAll(".mg-clip-path").remove(),o.append("defs").attr("class","mg-clip-path").append("clipPath").attr("id","mg-plot-window-"+C(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),s!==Number(o.attr("width"))&&o.attr("width",s),i!==Number(o.attr("height"))&&o.attr("height",i),o.attr("viewBox","0 0 "+s+" "+i),(e.full_width||e.full_height)&&o.attr("preserveAspectRatio","xMinYMin meet"),o.classed("mg-missing",!1),o.selectAll(".mg-missing-text").remove(),o.selectAll(".mg-missing-pane").remove(),r(e),e.use_small_class=e.height-e.top-e.bottom-e.buffer<=e.small_height_threshold&&e.width-e.left-e.right-2*e.buffer<=e.small_width_threshold||e.small_text;var l=0;if(e.data.length0){var c=function(t){for(var e=new Array(t),r=0;rd;l--)o.selectAll(".mg-main-line.mg-line"+l+"-color").remove()}return this}function x(e){function r(r){var n;r.each(function(o,s){if(s>0){{this.getBoundingClientRect()}if(a(this,r)){var i=t.select(this),l=+i.attr("y");l+8==e.top&&(l=e.top-16),i.attr("y",l)}}n=this})}function a(t,e){for(var r=t.getBoundingClientRect(),a=0;ar.left&&n.left>r.left&&r.top===n.top||n.leftr.left&&r.top===n.top))return!0}return!1}function n(t){return e.scales.X(t[e.x_accessor])}function o(t){return n(t).toFixed(2)}function s(t){return e.scales.X(t[e.x_accessor])>e.buffer+e.left&&e.scales.X(t[e.x_accessor])=c;c.setDate(c.getDate()+1)){var u={};c.setHours(0,0,0,0),Date.parse(c)===Date.parse(new Date(s))&&o.push(MG.clone(t.data[r][0]));var d=null;t.data[r].forEach(function(e){return Date.parse(e[t.x_accessor])===Date.parse(new Date(c))?(d=e,!1):void 0}),d?o.push(d):(u[t.x_accessor]=new Date(c),u[t.y_accessor]=0,o.push(u)),Date.parse(c)===Date.parse(new Date(n[t.x_accessor]))&&o.push(n)}t.data[r]=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 o,s,i=0;it?"M"+u.map(function(e){return e(t)}).join("L"):e}}}function F(e){return t.select(e).select("svg")}function C(t){var e=t.replace(/[^a-zA-Z0-9 _]+/g,""),r=e.replace(/ +?/g,"");return r}function P(e,r){return Number(t.select(e).style(r).replace(/px/g,""))}function z(t){return P(t,"width")}function E(t){return P(t,"height")}function $(t){return I(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 N(t,e){var r,a=[],n=[];for(r=0;rr&&(t.textContent=e.slice(0,--n)+"...",a=t.getBBox(),"..."!==t.textContent););}function L(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")}window.MG={version:"2.1.0"};var S={};MG.globals={},MG.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"}},MG.globals.link=!1,MG.globals.version="1.1",MG.data_graphic=function(){var e={};e.all={missing_is_zero:!1,missing_is_hidden:!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,linked_format:"%Y-%m-%d",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,show_tooltips:!0},e.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"},e.histogram={mouseover:function(e){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},e.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},e.missing={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_missing_background:!0,interpolate:"cardinal"};var r=arguments[0];r||(r={}),r.list&&(r.x_accessor=0,r.y_accessor=1);for(var a in MG.deprecations)if(r.hasOwnProperty(a)){var n=MG.deprecations[a],o="Use of `args."+a+"` has been deprecated",s=n.replacement;if(s&&(r[s]?o+=". The replacement - `args."+s+"` - has already been defined. This definition will be discarded.":r[s]=r[a]),n.warned)continue;n.warned=!0,s&&(o+=" in favor of `args."+s+"`"),G(o,n.version)}var i;return"missing-data"===r.chart_type?(r=$(r,e.missing),S.missing(r)):"point"===r.chart_type?(i=$(e.point,e.all),r=$(r,i),S.point(r).mainPlot().markers().rollover().windowListeners()):"histogram"===r.chart_type?(i=$(e.histogram,e.all),r=$(r,i),S.histogram(r).mainPlot().markers().rollover().windowListeners()):"bar"===r.chart_type?(i=$(e.bar,e.all),r=$(r,i),S.bar(r).mainPlot().markers().rollover().windowListeners()):(r=$(r,e.all),S.line(r).markers().mainPlot().rollover().windowListeners()),r.data},"undefined"!=typeof jQuery&&(+function(t){function e(e){return this.each(function(){var a=t(this),n=a.data("bs.tooltip"),o="object"==typeof e&&e,s=o&&o.selector;(n||"destroy"!=e)&&(s?(n||a.data("bs.tooltip",n={}),n[s]||(n[s]=new r(this,o))):n||a.data("bs.tooltip",n=new r(this,o)),"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(" "),o=n.length;o--;){var s=n[o];if("click"==s)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=s){var i="hover"==s?"mouseenter":"focusin",l="hover"==s?"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,o=this.tip(),s=this.getUID(this.type);this.setContent(),o.attr("id",s),this.$element.attr("aria-describedby",s),this.options.animation&&o.addClass("fade");var i="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(i);c&&(i=i.replace(l,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this),this.options.container?o.appendTo(this.options.container):o.insertAfter(this.$element);var u=this.getPosition(),d=o[0].offsetWidth,f=o[0].offsetHeight;if(c){var p=i,h=this.options.container?t(this.options.container):this.$element.parent(),m=this.getPosition(h);i="bottom"==i&&u.bottom+f>m.bottom?"top":"top"==i&&u.top-fm.width?"left":"left"==i&&u.left-ds.top+s.height&&(n.top=s.top+s.height-l)}else{var c=e.left-o,u=e.left+o+r;cs.width&&(n.left=s.left+s.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"),o="object"==typeof e&&e,s=o&&o.selector;(n||"destroy"!=e)&&(s?(n||a.data("bs.popover",n={}),n[s]||(n[s]=new r(this,o))):n||a.data("bs.popover",n=new r(this,o)),"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&&+function(t){function e(e){e&&3===e.which||(t(n).remove(),t(o).each(function(){var a=t(this),n=r(a),o={relatedTarget:this};n.hasClass("open")&&(n.trigger(e=t.Event("hide.bs.dropdown",o)),e.isDefaultPrevented()||(a.attr("aria-expanded","false"),n.removeClass("open").trigger("hidden.bs.dropdown",o)))}))}function r(e){var r=e.attr("data-target");r||(r=e.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var a=r&&t(r);return a&&a.length?a:e.parent()}function a(e){return this.each(function(){var r=t(this),a=r.data("bs.dropdown");a||r.data("bs.dropdown",a=new s(this)),"string"==typeof e&&a[e].call(r)})}if("function"==typeof t().dropdown)return!0;var n=".dropdown-backdrop",o='[data-toggle="dropdown"]',s=function(e){t(e).on("click.bs.dropdown",this.toggle)};s.VERSION="3.3.1",s.prototype.toggle=function(a){var n=t(this);if(!n.is(".disabled, :disabled")){var o=r(n),s=o.hasClass("open");if(e(),!s){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t('').insertAfter(t(this)).on("click",e);var i={relatedTarget:this};if(o.trigger(a=t.Event("show.bs.dropdown",i)),a.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger("shown.bs.dropdown",i)}return!1}},s.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var a=t(this);if(e.preventDefault(),e.stopPropagation(),!a.is(".disabled, :disabled")){var n=r(a),s=n.hasClass("open");if(!s&&27!=e.which||s&&27==e.which)return 27==e.which&&n.find(o).trigger("focus"),a.trigger("click");var i=" li:not(.divider):visible a",l=n.find('[role="menu"]'+i+', [role="listbox"]'+i);if(l.length){var c=l.index(e.target);38==e.which&&c>0&&c--,40==e.which&&c1&&(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,a,n,o=this._callback,s=this.manual_callback,i=this.manual_map;a=Object.keys(this.feature_set);var l,c=function(e){return t[e]};for(l=0;l");var d=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],s[t](r)):o(a,r),!1};for(var f in this.feature_set){for(a=this.feature_set[f],e(this.target+" div.segments").append('"),l=0;l'+a[l]+"");e("."+this._strip_punctuation(f)+"-btns .dropdown-menu li a").on("click",d)}return this},this},S.line=function(e){return this.args=e,this.init=function(t){return w(t),k(t),v(t),i(t),n(t),this},this.mainPlot=function(){var r,a=F(e.target),n=0,o=e.transition_on_update?1e3:0,s=function(t){return t[e.y_accessor]},i=t.svg.area().x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).interpolate(e.interpolate),l=a.select(".mg-confidence-band");e.show_confidence_band&&(r=t.svg.area().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));for(var c,u,d=t.svg.line().x(e.scalefns.xf).y(e.scalefns.yf).interpolate(e.interpolate),f=t.svg.line().x(e.scalefns.xf).y(function(){return e.scales.Y(n)}).interpolate(e.interpolate),p="",h=e.data.length-1;h>=0;h--){c=e.data[h];var m=h+1;e.custom_line_color_map.length>0&&(m=e.custom_line_color_map[h]),e.data[h].line_id=m,e.show_confidence_band&&(u=l.empty()?a.append("path").attr("class","mg-confidence-band"):l.transition().duration(function(){return e.transition_on_update?1e3:0}),u.attr("d",r(e.data[h])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")"));var g=a.selectAll(".mg-area"+m+"-color"),_=e.area&&!e.use_data_y_min&&!e.y_axis_negative&&e.data.length<=1;_?g.empty()?a.append("path").attr("class","mg-main-area mg-area"+m+"-color").attr("d",i(e.data[h])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")"):(a.select(".mg-y-axis").node().parentNode.appendChild(g.node()),g.transition().duration(o).attr("d",i(e.data[h])).attr("clip-path","url(#mg-plot-window"+C(e.target)+")")):g.empty()||g.remove();var v=a.select("path.mg-main-line.mg-line"+m+"-color");if(v.empty())e.animate_on_load?(n=t.median(e.data[h],s),a.append("path").attr("class","mg-main-line mg-line"+m+"-color").attr("d",f(e.data[h])).transition().duration(1e3).attr("d",d(e.data[h])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")")):a.append("path").attr("class","mg-main-line mg-line"+m+"-color").attr("d",d(e.data[h])).attr("clip-path","url(#mg-plot-window-"+C(e.target)+")");else{a.select(".mg-y-axis").node().parentNode.appendChild(v.node());var x=v.transition().duration(o);_?x.attr("d",d(e.data[h])):x.attrTween("d",X(d(e.data[h]),4))}if(e.missing_is_hidden){var y,b,w,k,A,D,M,O=a.select(".mg-line"+m+"-color"),Y=O.attr("d").split("L"),T=e.scales.Y(0),P=[],z=2,E=0;Y[0]=Y[0].replace("M",""),Y[Y.length-1]=Y[Y.length-1].replace("Z",""),e.min_x&&P.push(0);for(var $=0;$0&&(P.push(O.node().getTotalLength()-P[P.length-1]),a.select(".mg-line"+m+"-color").attr("stroke-dasharray",P.join()))}e.legend&&(p="— "+e.legend[h]+" "+p)}return e.legend&&t.select(e.legend_target).html(p),this},this.markers=function(){return x(e),this},this.rollover=function(){var r,a=F(e.target);a.selectAll(".mg-rollover-rect").remove(),a.selectAll(".mg-voronoi").remove(),a.selectAll(".mg-active-datapoint").remove(),a.selectAll(".mg-line-rollover-circle").remove(),a.selectAll(".mg-active-datapoint-container").remove(),a.append("g").attr("class","mg-active-datapoint-container").attr("transform","translate("+(e.width-e.right)+","+e.top/2+")").append("text").attr("class","mg-active-datapoint").classed("mg-active-datapoint-small",e.use_small_class).attr("xml:space","preserve").attr("text-anchor","end"),a.selectAll(".mg-line-rollover-circle").data(e.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 n=1,o=0;o0?e.custom_line_color_map[o]:n;n++}var i,l;if(e.data.length>1&&!e.aggregate_rollover){var c=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.width-e.buffer,e.height-e.buffer]]);r=a.append("g").attr("class","mg-voronoi"),i=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}),r.selectAll("path").data(c(i)).enter().append("path").filter(function(t){return void 0!==t}).attr("d",function(t){return"M"+t.join("L")+"Z"}).datum(function(t){return t.point}).attr("class",function(r){if(e.linked){var a=r[e.x_accessor],n=t.time.format(e.linked_format),s="number"==typeof a?o:n(a);return"mg-line"+r.line_id+"-color roll_"+s}return"mg-line"+r.line_id+"-color"}).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e))}else e.data.length>1&&e.aggregate_rollover?(i=t.nest().key(function(t){return t[e.x_accessor]}).entries(t.merge(e.data)),l=i.map(function(t){return e.scales.X(new Date(t.key))}),r=a.append("g").attr("class","mg-rollover-rect"),r.selectAll(".mg-rollover-rects").data(i).enter().append("rect").attr("x",function(t,r){return 1===l.length?e.left+e.buffer:0===r?l[r].toFixed(2):((l[r-1]+l[r])/2).toFixed(2)}).attr("y",e.top).attr("width",function(t,r){return 1===l.length?e.width-e.right-e.buffer:0===r?((l[r+1]-l[r])/2).toFixed(2):r==l.length-1?((l[r]-l[r-1])/2).toFixed(2):((l[r+1]-l[r-1])/2).toFixed(2)}).attr("height",e.height-e.bottom-e.top-e.buffer).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e))):(n=1,e.custom_line_color_map.length>0&&(n=e.custom_line_color_map[0]),r=a.append("g").attr("class","mg-rollover-rect"),l=e.data[0].map(e.scalefns.xf),r.selectAll(".mg-rollover-rects").data(e.data[0]).enter().append("rect").attr("class",function(r,a){if(e.linked){var o=r[e.x_accessor],s=t.time.format(e.linked_format),i="number"==typeof o?a:s(o);return"mg-line"+n+"-color roll_"+i}return"mg-line"+n+"-color"}).attr("x",function(t,r){return 1===l.length?e.left+e.buffer:0===r?l[r].toFixed(2):((l[r-1]+l[r])/2).toFixed(2)}).attr("y",function(t){return e.data.length>1?e.scalefns.yf(t)-6:e.top}).attr("width",function(t,r){return 1===l.length?e.width-e.right-e.buffer:0===r?((l[r+1]-l[r])/2).toFixed(2):r===l.length-1?((l[r]-l[r-1])/2).toFixed(2):((l[r+1]-l[r-1])/2).toFixed(2)}).attr("height",function(){return e.data.length>1?12:e.height-e.bottom-e.top-e.buffer}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)));return 1==e.data.length&&1==e.data[0].length&&t.select(".mg-rollover-rect .mg-line1-color").on("mouseover")(e.data[0][0],0),this},this.rolloverOn=function(e){var r,a=F(e.target);switch(e.processed.x_time_frame){case"seconds":r=t.time.format("%b %e, %Y %H:%M:%S");break;case"less-than-a-day":r=t.time.format("%b %e, %Y %I:%M%p");break;case"four-days":r=t.time.format("%b %e, %Y %I:%M%p");break;default:r=t.time.format("%b %e, %Y")}return function(n,o){if(e.aggregate_rollover&&e.data.length>1)a.selectAll("circle.mg-line-rollover-circle").style("opacity",0),n.values.forEach(function(t){if(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){a.select("circle.mg-line"+t.line_id+"-color").attr({cx:function(){return e.scales.X(t[e.x_accessor]).toFixed(2)},cy:function(){return e.scales.Y(t[e.y_accessor]).toFixed(2)},r:e.point_size}).style("opacity",1)}});else{if(e.missing_is_hidden&&0==n[e.y_accessor])return;if(n[e.x_accessor]>=e.processed.min_x&&n[e.x_accessor]<=e.processed.max_x&&n[e.y_accessor]>=e.processed.min_y&&n[e.y_accessor]<=e.processed.max_y&&a.selectAll("circle.mg-line-rollover-circle").attr("class","").attr("class","mg-area"+n.line_id+"-color").classed("mg-line-rollover-circle",!0).attr("cx",function(){return e.scales.X(n[e.x_accessor]).toFixed(2)}).attr("cy",function(){return e.scales.Y(n[e.y_accessor]).toFixed(2)}).attr("r",e.point_size).style("opacity",1),e.linked&&!MG.globals.link){MG.globals.link=!0;var s=n[e.x_accessor],i=t.time.format(e.linked_format),l="number"==typeof s?o:i(s);t.selectAll(".mg-line"+n.line_id+"-color.roll_"+l).each(function(e,r){t.select(this).on("mouseover")(e,r)})}}a.selectAll("text").filter(function(t){return n===t}).attr("opacity",.3);var c=T(e);if(e.show_rollover_text){var u=a.select(".mg-active-datapoint"),d=0,f=1.1;if(u.select("*").remove(),e.aggregate_rollover&&e.data.length>1){if(e.time_series){var p=new Date(n.key);u.append("tspan").text((r(p)+" "+e.yax_units).trim()),d=1,n.values.forEach(function(t){var r=u.append("tspan").attr({x:0,y:d*f+"em"}).text(c(t[e.y_accessor]));u.append("tspan").attr({x:-r.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 n.values.forEach(function(t){var r=u.append("tspan").attr({x:0,y:d*f+"em"}).text(e.x_accessor+": "+t[e.x_accessor]+", "+e.y_accessor+": "+e.yax_units+c(t[e.y_accessor]));u.append("tspan").attr({x:-r.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(e.time_series){var h=new Date(+n[e.x_accessor]);h.setDate(h.getDate()),u.append("tspan").text(r(h)+" "+e.yax_units+c(n[e.y_accessor]))}else u.append("tspan").text(e.x_accessor+": "+n[e.x_accessor]+", "+e.y_accessor+": "+e.yax_units+c(n[e.y_accessor]))}e.mouseover&&e.mouseover(n,o)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){if(e.linked&&MG.globals.link){MG.globals.link=!1;var o=a[e.x_accessor],s=t.time.format(e.linked_format),i="number"==typeof o?n:s(o);t.selectAll(".roll_"+i).each(function(e){t.select(this).on("mouseout")(e)})}r.selectAll("circle.mg-line-rollover-circle").style("opacity",function(){return 1==e.data.length&&1==e.data[0].length?1:0}),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},S.histogram=function(e){return this.args=e,this.init=function(t){return w(t),A(t),v(t),i(t),n(t),this},this.mainPlot=function(){var t=F(e.target);t.selectAll(".mg-histogram").remove();var r=t.append("g").attr("class","mg-histogram"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class","mg-bar").attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor]).toFixed(2)+","+e.scales.Y(t[e.y_accessor]).toFixed(2)+")"});return a.append("rect").attr("x",1).attr("width",function(){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2)}).attr("height",function(t){return 0===t[e.y_accessor]?0:(e.height-e.bottom-e.buffer-e.scales.Y(t[e.y_accessor])).toFixed(2)}),this},this.markers=function(){return x(e),this},this.rollover=function(){var t=F(e.target);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",e.width-e.right).attr("y",e.top/2).attr("text-anchor","end");var r=t.append("g").attr("class","mg-rollover-rect"),a=r.selectAll(".mg-bar").data(e.data[0]).enter().append("g").attr("class",function(t,r){return e.linked?"mg-rollover-rects roll_"+r:"mg-rollover-rects"}).attr("transform",function(t){return"translate("+e.scales.X(t[e.x_accessor])+",0)"});return a.append("rect").attr("x",1).attr("y",0).attr("width",function(t,r){return 1===e.data[0].length?(e.scalefns.xf(e.data[0][0])-e.bar_margin).toFixed(2):r!==e.data[0].length-1?(e.scalefns.xf(e.data[0][r+1])-e.scalefns.xf(t)).toFixed(2):(e.scalefns.xf(e.data[0][1])-e.scalefns.xf(e.data[0][0])).toFixed(2)}).attr("height",function(){return e.height}).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){{var r=F(e.target);t.time.format("%Y-%m-%d")}return function(a,n){r.selectAll("text").filter(function(t){return a===t}).attr("opacity",.3);var o=t.time.format("%b %e, %Y"),s=T(e);r.selectAll(".mg-bar rect").filter(function(t,e){return e===n}).classed("active",!0),e.linked&&!MG.globals.link&&(MG.globals.link=!0,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseover")(e,n)})),e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+a[e.x_accessor]);return t.setDate(t.getDate()),o(t)+" "+e.yax_units+s(a[e.y_accessor])}return e.x_accessor+": "+s(a[e.x_accessor])+", "+e.y_accessor+": "+e.yax_units+s(a[e.y_accessor])}),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){e.linked&&MG.globals.link&&(MG.globals.link=!1,t.selectAll(".mg-rollover-rects.roll_"+n+" rect").each(function(e){t.select(this).on("mouseout")(e,n)})),r.selectAll(".mg-bar rect").classed("active",!1),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},S.point=function(e){return this.args=e,this.init=function(t){return w(t),M(t),v(t),i(t),n(t),this},this.markers=function(){return x(e),e.least_squares&&O(e),this},this.mainPlot=function(){var t,r=F(e.target);r.selectAll(".mg-points").remove(),t=r.append("g").classed("mg-points",!0);var a=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?(a.attr("fill",e.scalefns.color),a.attr("stroke",e.scalefns.color)):a.classed("mg-points-mono",!0),null!==e.size_accessor?a.attr("r",e.scalefns.size):a.attr("r",e.point_size),this},this.rollover=function(){var r=F(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",e.top/2).attr("text-anchor","end");var a=t.geom.voronoi().x(e.scalefns.xf).y(e.scalefns.yf).clipExtent([[e.buffer,e.buffer],[e.width-e.buffer,e.height-e.buffer]]),n=r.append("g").attr("class","mg-voronoi");return n.selectAll("path").data(a(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=F(e.target);return function(a,n){r.selectAll(".mg-points circle").classed("selected",!1);var o=r.selectAll(".mg-points circle.path-"+n).classed("selected",!0);e.size_accessor?o.attr("r",function(t){return e.scalefns.size(t)+1}):o.attr("r",e.point_size),e.linked&&!globals.link&&(globals.link=!0,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseover")(a,n)}));var s=t.time.format("%b %e, %Y"),i=T(e);e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+a.point[e.x_accessor]);return t.setDate(t.getDate()),s(t)+" "+e.yax_units+i(a.point[e.y_accessor])}return e.x_accessor+": "+i(a.point[e.x_accessor])+", "+e.y_accessor+": "+e.yax_units+i(a.point[e.y_accessor])}),e.mouseover&&e.mouseover(a,n)}},this.rolloverOff=function(e){var r=F(e.target);return function(a,n){e.linked&&globals.link&&(globals.link=!1,t.selectAll(".mg-voronoi .path-"+n).each(function(){t.select(this).on("mouseout")(a,n)}));var o=r.selectAll(".mg-points circle").classed("unselected",!1).classed("selected",!1);e.size_accessor?o.attr("r",e.scalefns.size):o.attr("r",e.point_size),r.select(".mg-active-datapoint").text(""),e.mouseout&&e.mouseout(a,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(e),this},S.bar=function(e){return this.args=e,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),o(t)),this},this.mainPlot=function(){var t,r,a,n,o,s=F(e.target),i=e.data[0],l=s.select(".mg-barplot"),c=l.empty(),u=c&&e.animate_on_load,d=u||e.transition_on_update,f=e.transition_duration||1e3;c?(l=s.append("g").classed("mg-barplot",!0),t=l.selectAll(".mg-bar").data(i).enter().append("rect").classed("mg-bar",!0),e.predictor_accessor&&(r=l.selectAll(".mg-bar-prediction").data(i).enter().append("rect").classed("mg-bar-prediction",!0)),e.baseline_accessor&&(o=l.selectAll(".mg-bar-baseline").data(i).enter().append("line").classed("mg-bar-baseline",!0))):(s.select(".mg-y-axis").node().parentNode.appendChild(l.node()),console.log("waylee"),t=l.selectAll("rect.mg-bar"),e.predictor_accessor&&(r=l.selectAll(".mg-bar-prediction")),e.baseline_accessor&&(o=l.selectAll(".mg-bar-baseline")));var p;return this.is_vertical?(p=e.scales.X.rangeBand()/1.5,u&&t.attr("height",0).attr("y",e.scales.Y(0)),d&&(t=t.transition().duration(f)),t.attr("y",function(t){return e.scales.Y(0)-(e.scales.Y(0)-e.scalefns.yf(t))}).attr("x",function(t){return e.scalefns.xf(t)+p/2}).attr("width",p).attr("height",function(t){return 0-(e.scalefns.yf(t)-e.scales.Y(0))}),e.predictor_accessor&&(a=e.predictor_proportion,n=a-1,u&&r.attr("height",0).attr("y",e.scales.Y(0)),d&&(r=r.transition().duration(f)),r.attr("y",function(t){return e.scales.Y(0)-(e.scales.Y(0)-e.scales.Y(t[e.predictor_accessor]))}).attr("x",function(t){return e.scalefns.xf(t)+n*p/(2*a)+p/2}).attr("width",p/a).attr("height",function(t){return 0-(e.scales.Y(t[e.predictor_accessor])-e.scales.Y(0))})),e.baseline_accessor&&(a=e.predictor_proportion,u&&o.attr({y1:e.scales.Y(0),y2:e.scales.Y(0)}),d&&(o=o.transition().duration(f)),o.attr("x1",function(t){return e.scalefns.xf(t)+p/2-p/a+p/2}).attr("x2",function(t){return e.scalefns.xf(t)+p/2+p/a+p/2}).attr("y1",function(t){return e.scales.Y(t[e.baseline_accessor])}).attr("y2",function(t){return e.scales.Y(t[e.baseline_accessor])}))):(p=e.scales.Y.rangeBand()/1.5,u&&t.attr("width",0),d&&(t=t.transition().duration(f)),t.attr("x",e.scales.X(0)).attr("y",function(t){return e.scalefns.yf(t)+p/2}).attr("height",p).attr("width",function(t){return e.scalefns.xf(t)-e.scales.X(0)}),e.predictor_accessor&&(a=e.predictor_proportion,n=a-1,u&&r.attr("width",0),d&&(r=r.transition().duration(f)),r.attr("x",e.scales.X(0)).attr("y",function(t){return e.scalefns.yf(t)+n*p/(2*a)+p/2}).attr("height",p/a).attr("width",function(t){return e.scales.X(t[e.predictor_accessor])-e.scales.X(0)})),e.baseline_accessor&&(a=e.predictor_proportion,u&&o.attr({x1:e.scales.X(0),x2:e.scales.X(0)}),d&&(o=o.transition().duration(f)),o.attr("x1",function(t){return e.scales.X(t[e.baseline_accessor])}).attr("x2",function(t){return e.scales.X(t[e.baseline_accessor])}).attr("y1",function(t){return e.scalefns.yf(t)+p/2-p/a+p/2}).attr("y2",function(t){return e.scalefns.yf(t)+p/2+p/a+p/2}))),this},this.markers=function(){return x(e),this},this.rollover=function(){var t,r=F(e.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",e.width-e.right).attr("y",e.top/2).attr("dy",".35em").attr("text-anchor","end"),t=r.append("g").attr("class","mg-rollover-rect");var a=t.selectAll(".mg-bar-rollover").data(e.data[0]).enter().append("rect").attr("class","mg-bar-rollover");return this.is_vertical?a.attr("x",e.scalefns.xf).attr("y",function(){return e.scales.Y(0)-e.height}).attr("width",e.scales.X.rangeBand()).attr("height",e.height).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)):a.attr("x",e.scales.X(0)).attr("y",e.scalefns.yf).attr("width",e.width).attr("height",e.scales.Y.rangeBand()+2).attr("opacity",0).on("mouseover",this.rolloverOn(e)).on("mouseout",this.rolloverOff(e)).on("mousemove",this.rolloverMove(e)),this},this.rolloverOn=function(e){var r=F(e.target),a=this.is_vertical?e.x_accessor:e.y_accessor,n=this.is_vertical?e.y_accessor:e.x_accessor,o=this.is_vertical?e.yax_units:e.xax_units;return function(s,i){r.selectAll("text").filter(function(t){return s===t}).attr("opacity",.3);var l=t.time.format("%b %e, %Y"),c=T(e);r.selectAll("g.mg-barplot .mg-bar").filter(function(t,e){return e===i}).classed("active",!0),e.show_rollover_text&&r.select(".mg-active-datapoint").text(function(){if(e.time_series){var t=new Date(+s[n]);return t.setDate(t.getDate()),l(t)+" "+o+c(s[a])}return s[a]+": "+c(s[n])}),e.mouseover&&e.mouseover(s,i)}},this.rolloverOff=function(t){var e=F(t.target);return function(r,a){e.selectAll("g.mg-barplot .mg-bar").classed("active",!1),e.select(".mg-active-datapoint").text(""),t.mouseout&&t.mouseout(r,a)}},this.rolloverMove=function(t){return function(e,r){t.mousemove&&t.mousemove(e,r)}},this.windowListeners=function(){return y(this.args),this},this.init(e),this},MG.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],o=a[1];r[o]&&t.style(n,"string"==typeof r[o]||"number"==typeof r[o]?r[o]:r[o](e))})},this._add_column=function(t,e){var r=this.args.standard_col,a=$(MG.clone(t),MG.clone(r));a.type=e,this.args.columns.push(a)},this.target=function(){var t=arguments[0];return this.args.target=t,this},this.title=function(){return this._add_column(arguments[0],"title"),this},this.text=function(){return this._add_column(arguments[0],"text"),this},this.bullet=function(){return this},this.sparkline=function(){return this},this.number=function(){return this._add_column(arguments[0],"number"),this},this.display=function(){var a=this.args;r(a);var n,o,s,i,l,c,u,d,f,p,h,m,g=a.target,_=t.select(g).append("table").classed("mg-data-table",!0),v=_.append("colgroup"),x=_.append("thead"),y=_.append("tbody");for(s=x.append("tr"),m=0;m=o;o++)n.push({x:o,y:Math.random()-.03*o});e.scales.X=t.scale.linear().domain([0,n.length]).range([e.left+e.buffer,e.width-e.right-e.buffer]),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)},e.scalefns.yf=function(t){return e.scales.Y(t.y)};var s=t.svg.line().x(e.scalefns.xf).y(e.scalefns.yf).interpolate(e.interpolate),i=t.svg.area().x(e.scalefns.xf).y0(e.scales.Y.range()[0]).y1(e.scalefns.yf).interpolate(e.interpolate),l=a.append("g").attr("class","mg-missing-pane");l.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),l.append("path").attr("class","mg-main-line mg-line1-color").attr("d",s(n)),l.append("path").attr("class","mg-main-area mg-area1-color").attr("d",i(n))}return a.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),this},this.init(e),this},MG.convert={},MG.convert.date=function(e,r,a){return a="undefined"==typeof a?"%Y-%m-%d":a,e=e.map(function(e){var n=t.time.format(a);return e[r]=n.parse(e[r]),e})},MG.convert.number=function(t,e){return t=t.map(function(t){return t[e]=Number(t[e]),t})};var I=function(t,e,r){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,n=t.length;n>a;a++)if(e.call(r,t[a],a,t)===breaker)return}else for(var o in t)if(e.call(r,t[o],o,t)===breaker)return;return t};return 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,a=t.length;a>r;r++)e[r]=MG.clone(t[r]);return e}if(t instanceof Object){e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=MG.clone(t[n]));return e}throw new Error("Unable to copy obj! Its type isn't supported.")},MG})}).call(this);
\ No newline at end of file
diff --git a/examples/data/missing-is-hidden-multi.json b/examples/data/missing-is-hidden-multi.json
new file mode 100644
index 0000000000..e64a30bfa6
--- /dev/null
+++ b/examples/data/missing-is-hidden-multi.json
@@ -0,0 +1,1436 @@
+[
+ [
+ {
+ "date": "2014-01-01",
+ "value": 10000000
+ },
+ {
+ "date": "2014-01-02",
+ "value": 10379978
+ },
+ {
+ "date": "2014-01-03",
+ "value": 10493749
+ },
+ {
+ "date": "2014-01-04",
+ "value": 10785250
+ },
+ {
+ "date": "2014-01-08",
+ "value": 15177211
+ },
+ {
+ "date": "2014-01-09",
+ "value": 16622100
+ },
+ {
+ "date": "2014-01-10",
+ "value": 17381072
+ },
+ {
+ "date": "2014-01-11",
+ "value": 18802310
+ },
+ {
+ "date": "2014-01-12",
+ "value": 15531790
+ },
+ {
+ "date": "2014-01-13",
+ "value": 15748881
+ },
+ {
+ "date": "2014-01-14",
+ "value": 18706437
+ },
+ {
+ "date": "2014-01-15",
+ "value": 19752685
+ },
+ {
+ "date": "2014-01-16",
+ "value": 21016418
+ },
+ {
+ "date": "2014-01-17",
+ "value": 25622924
+ },
+ {
+ "date": "2014-01-18",
+ "value": 25337480
+ },
+ {
+ "date": "2014-01-19",
+ "value": 22258882
+ },
+ {
+ "date": "2014-01-20",
+ "value": 23829538
+ },
+ {
+ "date": "2014-01-21",
+ "value": 24245689
+ },
+ {
+ "date": "2014-01-22",
+ "value": 26429711
+ },
+ {
+ "date": "2014-01-23",
+ "value": 26259017
+ },
+ {
+ "date": "2014-01-24",
+ "value": 25396183
+ },
+ {
+ "date": "2014-01-25",
+ "value": 23107346
+ },
+ {
+ "date": "2014-01-26",
+ "value": 28659852
+ },
+ {
+ "date": "2014-01-27",
+ "value": 25270783
+ },
+ {
+ "date": "2014-01-28",
+ "value": 26270783
+ },
+ {
+ "date": "2014-01-29",
+ "value": 27270783
+ },
+ {
+ "date": "2014-01-30",
+ "value": 28270783
+ },
+ {
+ "date": "2014-01-31",
+ "value": 29270783
+ },
+ {
+ "date": "2014-02-01",
+ "value": 30270783
+ },
+ {
+ "date": "2014-02-02",
+ "value": 31270783
+ },
+ {
+ "date": "2014-02-03",
+ "value": 32270783
+ },
+ {
+ "date": "2014-02-04",
+ "value": 33270783
+ },
+ {
+ "date": "2014-02-05",
+ "value": 28270783
+ },
+ {
+ "date": "2014-02-06",
+ "value": 27270783
+ },
+ {
+ "date": "2014-02-07",
+ "value": 35270783
+ },
+ {
+ "date": "2014-02-08",
+ "value": 34270783
+ },
+ {
+ "date": "2014-02-09",
+ "value": 28270783
+ },
+ {
+ "date": "2014-02-10",
+ "value": 35270783
+ },
+ {
+ "date": "2014-02-11",
+ "value": 36270783
+ },
+ {
+ "date": "2014-02-12",
+ "value": 34127078
+ },
+ {
+ "date": "2014-02-13",
+ "value": 33124078
+ },
+ {
+ "date": "2014-02-14",
+ "value": 36227078
+ },
+ {
+ "date": "2014-02-15",
+ "value": 37827078
+ },
+ {
+ "date": "2014-02-16",
+ "value": 36427073
+ },
+ {
+ "date": "2014-02-17",
+ "value": 37570783
+ },
+ {
+ "date": "2014-02-18",
+ "value": 38627073
+ },
+ {
+ "date": "2014-02-19",
+ "value": 37727078
+ },
+ {
+ "date": "2014-02-20",
+ "value": 38827073
+ },
+ {
+ "date": "2014-02-21",
+ "value": 40927078
+ },
+ {
+ "date": "2014-02-22",
+ "value": 41027078
+ },
+ {
+ "date": "2014-02-23",
+ "value": 42127073
+ },
+ {
+ "date": "2014-02-24",
+ "value": 43220783
+ },
+ {
+ "date": "2014-02-25",
+ "value": 44327078
+ },
+ {
+ "date": "2014-02-26",
+ "value": 40427078
+ },
+ {
+ "date": "2014-02-27",
+ "value": 41027078
+ },
+ {
+ "date": "2014-02-28",
+ "value": 45627078
+ },
+ {
+ "date": "2014-03-01",
+ "value": 44727078
+ },
+ {
+ "date": "2014-03-02",
+ "value": 44227078
+ },
+ {
+ "date": "2014-03-03",
+ "value": 45227078
+ },
+ {
+ "date": "2014-03-04",
+ "value": 46027078
+ },
+ {
+ "date": "2014-03-05",
+ "value": 46927078
+ },
+ {
+ "date": "2014-03-06",
+ "value": 47027078
+ },
+ {
+ "date": "2014-03-07",
+ "value": 46227078
+ },
+ {
+ "date": "2014-03-08",
+ "value": 47027078
+ },
+ {
+ "date": "2014-03-09",
+ "value": 48027078
+ },
+ {
+ "date": "2014-03-10",
+ "value": 47027078
+ },
+ {
+ "date": "2014-03-11",
+ "value": 47027078
+ },
+ {
+ "date": "2014-03-12",
+ "value": 48017078
+ },
+ {
+ "date": "2014-03-13",
+ "value": 48077078
+ },
+ {
+ "date": "2014-03-14",
+ "value": 48087078
+ },
+ {
+ "date": "2014-03-15",
+ "value": 48017078
+ },
+ {
+ "date": "2014-03-16",
+ "value": 48047078
+ },
+ {
+ "date": "2014-03-17",
+ "value": 48067078
+ },
+ {
+ "date": "2014-03-18",
+ "value": 48077078
+ },
+ {
+ "date": "2014-03-19",
+ "value": 48027074
+ },
+ {
+ "date": "2014-03-20",
+ "value": 48927079
+ },
+ {
+ "date": "2014-03-21",
+ "value": 48727071
+ },
+ {
+ "date": "2014-03-22",
+ "value": 48127072
+ },
+ {
+ "date": "2014-03-23",
+ "value": 48527072
+ },
+ {
+ "date": "2014-03-24",
+ "value": 48627027
+ },
+ {
+ "date": "2014-03-25",
+ "value": 48027040
+ },
+ {
+ "date": "2014-03-26",
+ "value": 48027043
+ },
+ {
+ "date": "2014-03-27",
+ "value": 48057022
+ },
+ {
+ "date": "2014-03-28",
+ "value": 49057022
+ },
+ {
+ "date": "2014-03-29",
+ "value": 50057022
+ },
+ {
+ "date": "2014-03-30",
+ "value": 51057022
+ },
+ {
+ "date": "2014-03-31",
+ "value": 52057022
+ },
+ {
+ "date": "2014-04-01",
+ "value": 53057022
+ },
+ {
+ "date": "2014-04-02",
+ "value": 54057022
+ },
+ {
+ "date": "2014-04-03",
+ "value": 52057022
+ },
+ {
+ "date": "2014-04-04",
+ "value": 55057022
+ },
+ {
+ "date": "2014-04-05",
+ "value": 58270783
+ },
+ {
+ "date": "2014-04-06",
+ "value": 56270783
+ },
+ {
+ "date": "2014-04-07",
+ "value": 55270783
+ },
+ {
+ "date": "2014-04-08",
+ "value": 58270783
+ },
+ {
+ "date": "2014-04-09",
+ "value": 59270783
+ },
+ {
+ "date": "2014-04-10",
+ "value": 60270783
+ },
+ {
+ "date": "2014-04-11",
+ "value": 61270783
+ },
+ {
+ "date": "2014-04-12",
+ "value": 62270783
+ },
+ {
+ "date": "2014-04-13",
+ "value": 63270783
+ },
+ {
+ "date": "2014-04-14",
+ "value": 64270783
+ },
+ {
+ "date": "2014-04-15",
+ "value": 65270783
+ },
+ {
+ "date": "2014-04-16",
+ "value": 66270783
+ },
+ {
+ "date": "2014-04-17",
+ "value": 67270783
+ },
+ {
+ "date": "2014-04-18",
+ "value": 68270783
+ },
+ {
+ "date": "2014-04-19",
+ "value": 69270783
+ },
+ {
+ "date": "2014-04-20",
+ "value": 70270783
+ },
+ {
+ "date": "2014-04-21",
+ "value": 71270783
+ },
+ {
+ "date": "2014-04-22",
+ "value": 72270783
+ },
+ {
+ "date": "2014-04-23",
+ "value": 73270783
+ },
+ {
+ "date": "2014-04-24",
+ "value": 74270783
+ },
+ {
+ "date": "2014-04-25",
+ "value": 75270783
+ },
+ {
+ "date": "2014-04-26",
+ "value": 76660783
+ },
+ {
+ "date": "2014-04-27",
+ "value": 77270783
+ },
+ {
+ "date": "2014-04-28",
+ "value": 78370783
+ },
+ {
+ "date": "2014-04-29",
+ "value": 79470783
+ },
+ {
+ "date": "2014-04-30",
+ "value": 80170783
+ }
+ ],
+ [
+ {
+ "date": "2014-01-01",
+ "value": 150000000
+ },
+ {
+ "date": "2014-01-02",
+ "value": 160379978
+ },
+ {
+ "date": "2014-01-03",
+ "value": 170493749
+ },
+ {
+ "date": "2014-01-04",
+ "value": 160785250
+ },
+ {
+ "date": "2014-01-05",
+ "value": 167391904
+ },
+ {
+ "date": "2014-01-06",
+ "value": 161576838
+ },
+ {
+ "date": "2014-01-07",
+ "value": 161413854
+ },
+ {
+ "date": "2014-01-08",
+ "value": 152177211
+ },
+ {
+ "date": "2014-01-09",
+ "value": 143762210
+ },
+ {
+ "date": "2014-01-10",
+ "value": 144381072
+ },
+ {
+ "date": "2014-01-11",
+ "value": 154352310
+ },
+ {
+ "date": "2014-01-12",
+ "value": 165531790
+ },
+ {
+ "date": "2014-01-13",
+ "value": 175748881
+ },
+ {
+ "date": "2014-01-14",
+ "value": 187064037
+ },
+ {
+ "date": "2014-01-15",
+ "value": 197520685
+ },
+ {
+ "date": "2014-01-16",
+ "value": 210176418
+ },
+ {
+ "date": "2014-01-17",
+ "value": 196122924
+ },
+ {
+ "date": "2014-01-18",
+ "value": 207337480
+ },
+ {
+ "date": "2014-01-19",
+ "value": 200258882
+ },
+ {
+ "date": "2014-01-20",
+ "value": 186829538
+ },
+ {
+ "date": "2014-01-21",
+ "value": 192456897
+ },
+ {
+ "date": "2014-01-22",
+ "value": 204299711
+ },
+ {
+ "date": "2014-01-23",
+ "value": 192759017
+ },
+ {
+ "date": "2014-01-24",
+ "value": 203596183
+ },
+ {
+ "date": "2014-01-25",
+ "value": 208107346
+ },
+ {
+ "date": "2014-01-26",
+ "value": 196359852
+ },
+ {
+ "date": "2014-01-27",
+ "value": 192570783
+ },
+ {
+ "date": "2014-01-28",
+ "value": 177967768
+ },
+ {
+ "date": "2014-01-29",
+ "value": 190632803
+ },
+ {
+ "date": "2014-01-30",
+ "value": 203725316
+ },
+ {
+ "date": "2014-01-31",
+ "value": 218226177
+ },
+ {
+ "date": "2014-02-01",
+ "value": 210698669
+ },
+ {
+ "date": "2014-02-02",
+ "value": 217640656
+ },
+ {
+ "date": "2014-02-03",
+ "value": 216142362
+ },
+ {
+ "date": "2014-02-04",
+ "value": 201410971
+ },
+ {
+ "date": "2014-02-05",
+ "value": 196704289
+ },
+ {
+ "date": "2014-02-06",
+ "value": 190436945
+ },
+ {
+ "date": "2014-02-07",
+ "value": 178891686
+ },
+ {
+ "date": "2014-02-08",
+ "value": 171613962
+ },
+ {
+ "date": "2014-02-09",
+ "value": 157579773
+ },
+ {
+ "date": "2014-02-10",
+ "value": 158677098
+ },
+ {
+ "date": "2014-02-11",
+ "value": 147129977
+ },
+ {
+ "date": "2014-02-12",
+ "value": 151561876
+ },
+ {
+ "date": "2014-02-13",
+ "value": 151627421
+ },
+ {
+ "date": "2014-02-14",
+ "value": 143543872
+ },
+ {
+ "date": "2014-02-15",
+ "value": 136581057
+ },
+ {
+ "date": "2014-02-16",
+ "value": 135560715
+ },
+ {
+ "date": "2014-02-17",
+ "value": 122625263
+ },
+ {
+ "date": "2014-02-18",
+ "value": 112091484
+ },
+ {
+ "date": "2014-02-19",
+ "value": 98810329
+ },
+ {
+ "date": "2014-02-20",
+ "value": 99882912
+ },
+ {
+ "date": "2014-02-21",
+ "value": 94943095
+ },
+ {
+ "date": "2014-02-22",
+ "value": 104875743
+ },
+ {
+ "date": "2014-02-23",
+ "value": 116383678
+ },
+ {
+ "date": "2014-02-24",
+ "value": 125028841
+ },
+ {
+ "date": "2014-02-25",
+ "value": 123967310
+ },
+ {
+ "date": "2014-02-26",
+ "value": 133167029
+ },
+ {
+ "date": "2014-02-27",
+ "value": 128577263
+ },
+ {
+ "date": "2014-02-28",
+ "value": 115836969
+ },
+ {
+ "date": "2014-03-01",
+ "value": 119264529
+ },
+ {
+ "date": "2014-03-02",
+ "value": 109363374
+ },
+ {
+ "date": "2014-03-03",
+ "value": 113985628
+ },
+ {
+ "date": "2014-03-04",
+ "value": 114650999
+ },
+ {
+ "date": "2014-03-05",
+ "value": 110866108
+ },
+ {
+ "date": "2014-03-06",
+ "value": 96473454
+ },
+ {
+ "date": "2014-03-07",
+ "value": 104075886
+ },
+ {
+ "date": "2014-03-08",
+ "value": 103568384
+ },
+ {
+ "date": "2014-03-09",
+ "value": 101534883
+ },
+ {
+ "date": "2014-03-10",
+ "value": 115825447
+ },
+ {
+ "date": "2014-03-11",
+ "value": 126133916
+ },
+ {
+ "date": "2014-03-12",
+ "value": 116502109
+ },
+ {
+ "date": "2014-03-13",
+ "value": 130169411
+ },
+ {
+ "date": "2014-03-14",
+ "value": 124296886
+ },
+ {
+ "date": "2014-03-15",
+ "value": 126347399
+ },
+ {
+ "date": "2014-03-16",
+ "value": 131483669
+ },
+ {
+ "date": "2014-03-17",
+ "value": 142811333
+ },
+ {
+ "date": "2014-03-18",
+ "value": 129675396
+ },
+ {
+ "date": "2014-03-19",
+ "value": 115514483
+ },
+ {
+ "date": "2014-03-20",
+ "value": 117630630
+ },
+ {
+ "date": "2014-03-21",
+ "value": 122340239
+ },
+ {
+ "date": "2014-03-22",
+ "value": 132349091
+ },
+ {
+ "date": "2014-03-23",
+ "value": 125613305
+ },
+ {
+ "date": "2014-03-24",
+ "value": 135592466
+ },
+ {
+ "date": "2014-03-25",
+ "value": 123408762
+ },
+ {
+ "date": "2014-03-26",
+ "value": 111991454
+ },
+ {
+ "date": "2014-03-27",
+ "value": 116123955
+ },
+ {
+ "date": "2014-03-28",
+ "value": 112817214
+ },
+ {
+ "date": "2014-03-29",
+ "value": 113029590
+ },
+ {
+ "date": "2014-03-30",
+ "value": 108753398
+ },
+ {
+ "date": "2014-03-31",
+ "value": 99383763
+ },
+ {
+ "date": "2014-04-01",
+ "value": 100151737
+ },
+ {
+ "date": "2014-04-02",
+ "value": 94985209
+ },
+ {
+ "date": "2014-04-03",
+ "value": 82913669
+ },
+ {
+ "date": "2014-04-04",
+ "value": 78748268
+ },
+ {
+ "date": "2014-04-05",
+ "value": 63829135
+ },
+ {
+ "date": "2014-04-06",
+ "value": 78694727
+ },
+ {
+ "date": "2014-04-07",
+ "value": 80868994
+ },
+ {
+ "date": "2014-04-08",
+ "value": 93799013
+ },
+ {
+ "date": "2014-04-09",
+ "value": 99042416
+ },
+ {
+ "date": "2014-04-10",
+ "value": 97298692
+ },
+ {
+ "date": "2014-04-11",
+ "value": 83353499
+ },
+ {
+ "date": "2014-04-12",
+ "value": 71248129
+ },
+ {
+ "date": "2014-04-13",
+ "value": 75253744
+ },
+ {
+ "date": "2014-04-14",
+ "value": 68976648
+ },
+ {
+ "date": "2014-04-15",
+ "value": 71002284
+ },
+ {
+ "date": "2014-04-16",
+ "value": 75052401
+ },
+ {
+ "date": "2014-04-17",
+ "value": 83894030
+ },
+ {
+ "date": "2014-04-18",
+ "value": 90236528
+ },
+ {
+ "date": "2014-04-19",
+ "value": 99739114
+ },
+ {
+ "date": "2014-04-20",
+ "value": 96407136
+ },
+ {
+ "date": "2014-04-21",
+ "value": 108323177
+ },
+ {
+ "date": "2014-04-22",
+ "value": 101578914
+ },
+ {
+ "date": "2014-04-23",
+ "value": 115877608
+ },
+ {
+ "date": "2014-04-24",
+ "value": 112088857
+ },
+ {
+ "date": "2014-04-25",
+ "value": 112071353
+ },
+ {
+ "date": "2014-04-26",
+ "value": 101790062
+ },
+ {
+ "date": "2014-04-27",
+ "value": 115003761
+ },
+ {
+ "date": "2014-04-28",
+ "value": 120457727
+ },
+ {
+ "date": "2014-04-29",
+ "value": 118253926
+ },
+ {
+ "date": "2014-04-30",
+ "value": 117956992
+ }
+ ],
+ [
+ {
+ "date": "2014-01-01",
+ "value": 60000000
+ },
+ {
+ "date": "2014-01-02",
+ "value": 60379978
+ },
+ {
+ "date": "2014-01-03",
+ "value": 40493749
+ },
+ {
+ "date": "2014-01-04",
+ "value": 60785250
+ },
+ {
+ "date": "2014-01-05",
+ "value": 67391904
+ },
+ {
+ "date": "2014-01-06",
+ "value": 61576838
+ },
+ {
+ "date": "2014-01-07",
+ "value": 61413854
+ },
+ {
+ "date": "2014-01-08",
+ "value": 82177211
+ },
+ {
+ "date": "2014-01-09",
+ "value": 103762210
+ },
+ {
+ "date": "2014-01-10",
+ "value": 84381072
+ },
+ {
+ "date": "2014-01-11",
+ "value": 54352310
+ },
+ {
+ "date": "2014-01-12",
+ "value": 65531790
+ },
+ {
+ "date": "2014-01-13",
+ "value": 75748881
+ },
+ {
+ "date": "2014-01-14",
+ "value": 47064037
+ },
+ {
+ "date": "2014-01-15",
+ "value": 67520685
+ },
+ {
+ "date": "2014-01-16",
+ "value": 60176418
+ },
+ {
+ "date": "2014-01-17",
+ "value": 66122924
+ },
+ {
+ "date": "2014-01-18",
+ "value": 57337480
+ },
+ {
+ "date": "2014-01-19",
+ "value": 100258882
+ },
+ {
+ "date": "2014-01-20",
+ "value": 46829538
+ },
+ {
+ "date": "2014-01-21",
+ "value": 92456897
+ },
+ {
+ "date": "2014-01-22",
+ "value": 94299711
+ },
+ {
+ "date": "2014-01-23",
+ "value": 62759017
+ },
+ {
+ "date": "2014-01-24",
+ "value": 103596183
+ },
+ {
+ "date": "2014-01-25",
+ "value": 108107346
+ },
+ {
+ "date": "2014-01-26",
+ "value": 66359852
+ },
+ {
+ "date": "2014-01-27",
+ "value": 62570783
+ },
+ {
+ "date": "2014-01-28",
+ "value": 77967768
+ },
+ {
+ "date": "2014-01-29",
+ "value": 60632803
+ },
+ {
+ "date": "2014-01-30",
+ "value": 103725316
+ },
+ {
+ "date": "2014-01-31",
+ "value": 98226177
+ },
+ {
+ "date": "2014-02-01",
+ "value": 60698669
+ },
+ {
+ "date": "2014-02-02",
+ "value": 67640656
+ },
+ {
+ "date": "2014-02-03",
+ "value": 66142362
+ },
+ {
+ "date": "2014-02-04",
+ "value": 101410971
+ },
+ {
+ "date": "2014-02-05",
+ "value": 66704289
+ },
+ {
+ "date": "2014-02-06",
+ "value": 60436945
+ },
+ {
+ "date": "2014-02-07",
+ "value": 78891686
+ },
+ {
+ "date": "2014-02-08",
+ "value": 71613962
+ },
+ {
+ "date": "2014-02-09",
+ "value": 107579773
+ },
+ {
+ "date": "2014-02-10",
+ "value": 58677098
+ },
+ {
+ "date": "2014-02-11",
+ "value": 87129977
+ },
+ {
+ "date": "2014-02-12",
+ "value": 51561876
+ },
+ {
+ "date": "2014-02-13",
+ "value": 51627421
+ },
+ {
+ "date": "2014-02-14",
+ "value": 83543872
+ },
+ {
+ "date": "2014-02-15",
+ "value": 66581057
+ },
+ {
+ "date": "2014-02-16",
+ "value": 65560715
+ },
+ {
+ "date": "2014-02-17",
+ "value": 62625263
+ },
+ {
+ "date": "2014-02-18",
+ "value": 92091484
+ },
+ {
+ "date": "2014-02-19",
+ "value": 48810329
+ },
+ {
+ "date": "2014-02-20",
+ "value": 49882912
+ },
+ {
+ "date": "2014-02-21",
+ "value": 44943095
+ },
+ {
+ "date": "2014-02-22",
+ "value": 104875743
+ },
+ {
+ "date": "2014-02-23",
+ "value": 96383678
+ },
+ {
+ "date": "2014-02-24",
+ "value": 105028841
+ },
+ {
+ "date": "2014-02-25",
+ "value": 63967310
+ },
+ {
+ "date": "2014-02-26",
+ "value": 63167029
+ },
+ {
+ "date": "2014-02-27",
+ "value": 68577263
+ },
+ {
+ "date": "2014-02-28",
+ "value": 95836969
+ },
+ {
+ "date": "2014-03-01",
+ "value": 99264529
+ },
+ {
+ "date": "2014-03-02",
+ "value": 109363374
+ },
+ {
+ "date": "2014-03-03",
+ "value": 93985628
+ },
+ {
+ "date": "2014-03-04",
+ "value": 94650999
+ },
+ {
+ "date": "2014-03-05",
+ "value": 90866108
+ },
+ {
+ "date": "2014-03-06",
+ "value": 46473454
+ },
+ {
+ "date": "2014-03-07",
+ "value": 84075886
+ },
+ {
+ "date": "2014-03-08",
+ "value": 103568384
+ },
+ {
+ "date": "2014-03-09",
+ "value": 101534883
+ },
+ {
+ "date": "2014-03-10",
+ "value": 95825447
+ },
+ {
+ "date": "2014-03-11",
+ "value": 66133916
+ },
+ {
+ "date": "2014-03-12",
+ "value": 96502109
+ },
+ {
+ "date": "2014-03-13",
+ "value": 80169411
+ },
+ {
+ "date": "2014-03-14",
+ "value": 84296886
+ },
+ {
+ "date": "2014-03-15",
+ "value": 86347399
+ },
+ {
+ "date": "2014-03-16",
+ "value": 31483669
+ },
+ {
+ "date": "2014-03-17",
+ "value": 82811333
+ },
+ {
+ "date": "2014-03-18",
+ "value": 89675396
+ },
+ {
+ "date": "2014-03-19",
+ "value": 95514483
+ },
+ {
+ "date": "2014-03-20",
+ "value": 97630630
+ },
+ {
+ "date": "2014-03-21",
+ "value": 62340239
+ },
+ {
+ "date": "2014-03-22",
+ "value": 62349091
+ },
+ {
+ "date": "2014-03-23",
+ "value": 65613305
+ },
+ {
+ "date": "2014-03-24",
+ "value": 65592466
+ },
+ {
+ "date": "2014-03-25",
+ "value": 63408762
+ },
+ {
+ "date": "2014-03-26",
+ "value": 91991454
+ },
+ {
+ "date": "2014-03-27",
+ "value": 96123955
+ },
+ {
+ "date": "2014-03-28",
+ "value": 92817214
+ },
+ {
+ "date": "2014-03-29",
+ "value": 93029590
+ },
+ {
+ "date": "2014-03-30",
+ "value": 108753398
+ },
+ {
+ "date": "2014-03-31",
+ "value": 49383763
+ },
+ {
+ "date": "2014-04-01",
+ "value": 100151737
+ },
+ {
+ "date": "2014-04-02",
+ "value": 44985209
+ },
+ {
+ "date": "2014-04-03",
+ "value": 52913669
+ },
+ {
+ "date": "2014-04-04",
+ "value": 48748268
+ },
+ {
+ "date": "2014-04-05",
+ "value": 23829135
+ },
+ {
+ "date": "2014-04-06",
+ "value": 58694727
+ },
+ {
+ "date": "2014-04-07",
+ "value": 50868994
+ },
+ {
+ "date": "2014-04-08",
+ "value": 43799013
+ },
+ {
+ "date": "2014-04-09",
+ "value": 4042416
+ },
+ {
+ "date": "2014-04-10",
+ "value": 47298692
+ },
+ {
+ "date": "2014-04-11",
+ "value": 53353499
+ },
+ {
+ "date": "2014-04-12",
+ "value": 71248129
+ },
+ {
+ "date": "2014-04-13",
+ "value": 75253744
+ },
+ {
+ "date": "2014-04-14",
+ "value": 68976648
+ },
+ {
+ "date": "2014-04-15",
+ "value": 71002284
+ },
+ {
+ "date": "2014-04-16",
+ "value": 75052401
+ },
+ {
+ "date": "2014-04-17",
+ "value": 83894030
+ },
+ {
+ "date": "2014-04-18",
+ "value": 50236528
+ },
+ {
+ "date": "2014-04-19",
+ "value": 59739114
+ },
+ {
+ "date": "2014-04-20",
+ "value": 56407136
+ },
+ {
+ "date": "2014-04-21",
+ "value": 108323177
+ },
+ {
+ "date": "2014-04-22",
+ "value": 101578914
+ },
+ {
+ "date": "2014-04-23",
+ "value": 95877608
+ },
+ {
+ "date": "2014-04-24",
+ "value": 62088857
+ },
+ {
+ "date": "2014-04-25",
+ "value": 92071353
+ },
+ {
+ "date": "2014-04-26",
+ "value": 81790062
+ },
+ {
+ "date": "2014-04-27",
+ "value": 105003761
+ },
+ {
+ "date": "2014-04-28",
+ "value": 100457727
+ },
+ {
+ "date": "2014-04-29",
+ "value": 98253926
+ },
+ {
+ "date": "2014-04-30",
+ "value": 67956992
+ }
+ ]
+]
\ No newline at end of file
diff --git a/examples/data/missing-is-hidden.json b/examples/data/missing-is-hidden.json
new file mode 100644
index 0000000000..7a3f2d9b4a
--- /dev/null
+++ b/examples/data/missing-is-hidden.json
@@ -0,0 +1,39 @@
+
+ [
+ {
+ "date": "2014-01-08",
+ "value": 500
+ },
+ {
+ "date": "2014-01-09",
+ "value": 500
+ },
+ {
+ "date": "2014-01-10",
+ "value": 400
+ },
+ {
+ "date": "2014-02-12",
+ "value": 500
+ },
+ {
+ "date": "2014-02-13",
+ "value": 100
+ },
+ {
+ "date": "2014-02-14",
+ "value": 120
+ },
+ {
+ "date": "2014-02-15",
+ "value": 30
+ },
+ {
+ "date": "2014-02-16",
+ "value": 300
+ },
+ {
+ "date": "2014-02-17",
+ "value": 200
+ }
+ ]
diff --git a/examples/dev.htm b/examples/dev.htm
index 74adf96aef..d9c721f8e7 100644
--- a/examples/dev.htm
+++ b/examples/dev.htm
@@ -95,6 +95,8 @@
+
+
diff --git a/examples/examples.htm b/examples/examples.htm
index 8386be786e..1b8e2a5fa5 100644
--- a/examples/examples.htm
+++ b/examples/examples.htm
@@ -70,6 +70,8 @@
+
+
diff --git a/examples/js/main.js b/examples/js/main.js
index 0825c65547..05cad4f576 100644
--- a/examples/js/main.js
+++ b/examples/js/main.js
@@ -154,6 +154,40 @@
y_accessor: 'value'
});
});
+
+ d3.json('data/missing-is-hidden.json', function(data) {
+ data = MG.convert.date(data, 'date');
+ MG.data_graphic({
+ title: 'Broken Lines',
+ description: 'Setting missing_is_hidden to true will hide missing ranges rather than considering them to be zeros or interpolating between the two points on either side.',
+ data: data,
+ missing_is_hidden: true,
+ width: torso.width,
+ height: torso.height,
+ right: torso.right,
+ target: '#missing_is_hidden',
+ show_secondary_x_label: false
+ });
+ });
+
+ d3.json('data/missing-is-hidden-multi.json', function(data) {
+ for (var i = 0; i < data.length; i++) {
+ data[i] = MG.convert.date(data[i], 'date');
+ }
+
+ // add a multi-line chart
+ MG.data_graphic({
+ title: 'Broken Multi-Lines',
+ description: 'Setting missing_is_hidden works with multiple lines too.',
+ data: data,
+ width: torso.width,
+ height: torso.height,
+ right: torso.right,
+ missing_is_hidden: true,
+ target: '#missing_is_hidden_multi',
+ show_secondary_x_label: false
+ });
+ });
d3.json('data/fake_users1.json', function(data) {
data = MG.convert.date(data, 'date');
diff --git a/src/js/charts/line.js b/src/js/charts/line.js
index d3cb85c377..0bbe7e68ec 100644
--- a/src/js/charts/line.js
+++ b/src/js/charts/line.js
@@ -154,6 +154,64 @@ charts.line = function(args) {
}
}
+ if (args.missing_is_hidden) {
+ var the_line = svg.select('.mg-line' + (line_id) + '-color');
+ var bits = the_line.attr('d').split('L');
+ var zero = args.scales.Y(0);
+ var dasharray = [];
+ var singleton_point_length = 2;
+
+ var x_y,
+ x_y_plus_1,
+ x,
+ y,
+ x_plus_1,
+ y_plus_1,
+ segment_length,
+ cumulative_segment_length = 0;
+
+ bits[0] = bits[0].replace('M', '');
+ bits[bits.length - 1] = bits[bits.length - 1].replace('Z', '');
+
+ //if we have a min_x, turn the line off first
+ if (args.min_x) {
+ dasharray.push(0);
+ }
+
+ //build the stroke-dasharray pattern
+ for (var j = 0; j < bits.length - 1; j++) {
+ x_y = bits[j].split(',');
+ x_y_plus_1 = bits[j + 1].split(',');
+ x = Number(x_y[0]);
+ y = Number(x_y[1]);
+ x_plus_1 = Number(x_y_plus_1[0]);
+ y_plus_1 = Number(x_y_plus_1[1]);
+
+ segment_length = Math.sqrt(Math.pow(x - x_plus_1, 2) + Math.pow(y - y_plus_1, 2));
+
+ //do we need to either cover or clear the current stroke
+ if (y_plus_1 == zero && y != zero) {
+ dasharray.push(cumulative_segment_length || singleton_point_length);
+ cumulative_segment_length = (cumulative_segment_length)
+ ? segment_length
+ : segment_length - singleton_point_length;
+ } else if (y_plus_1 != zero && y == zero) { //switching on line
+ dasharray.push(cumulative_segment_length += segment_length);
+ cumulative_segment_length = 0;
+ } else {
+ cumulative_segment_length += segment_length;
+ }
+ }
+
+ //fear not, end bit of line, ye too shall be covered
+ if (dasharray.length > 0) {
+ dasharray.push(the_line.node().getTotalLength() - dasharray[dasharray.length - 1]);
+
+ svg.select('.mg-line' + (line_id) + '-color')
+ .attr('stroke-dasharray', dasharray.join());
+ }
+ }
+
//build legend
if (args.legend) {
legend = "— "
@@ -450,6 +508,9 @@ charts.line = function(args) {
.style('opacity', 1);
}
});
+ } else if (args.missing_is_hidden && d[args.y_accessor] == 0) {
+ //disable rollovers for hidden parts of the line
+ return;
} else {
//show circle on mouse-overed rect
diff --git a/src/js/common/data_graphic.js b/src/js/common/data_graphic.js
index 626687f1ec..905cc8b59e 100644
--- a/src/js/common/data_graphic.js
+++ b/src/js/common/data_graphic.js
@@ -14,6 +14,7 @@ MG.data_graphic = function() {
var defaults = {};
defaults.all = {
missing_is_zero: false, // if true, missing values will be treated as zeros
+ missing_is_hidden: false, // if true, missing values will appear as broken segments
legend: '' , // an array identifying the labels for a chart's lines
legend_target: '', // if set, the specified element is populated with a legend
error: '', // if set, a graph will show an error icon and log the error to the console
diff --git a/src/js/misc/process.js b/src/js/misc/process.js
index 5fee6062b7..81c0db9630 100644
--- a/src/js/misc/process.js
+++ b/src/js/misc/process.js
@@ -57,11 +57,16 @@ function process_line(args) {
'use strict';
//do we have a time-series?
var is_time_series = args.data[0][0][args.x_accessor] instanceof Date
- ? true
- : false;
+ ? true
+ : false;
+
+ //force linear interpolation when missing_is_hidden is enabled
+ if (args.missing_is_hidden) {
+ args.interpolate = 'linear';
+ }
//are we replacing missing y values with zeros?
- if (args.missing_is_zero
+ if ((args.missing_is_zero || args.missing_is_hidden)
&& args.chart_type === 'line'
&& is_time_series
) {