text: /*! d3-traits - v0.0.1 - 2014-11-12
  * https://github.com/gec/d3-traits
  * Copyright (c) 2014 d3-traits; Licensed ,  */
  !function(a){function b(a,b){for(var c in a)c in b||(b[c]=a[c])}function c(a,b){var c=a[b];return c||(a[b]={},c=a[b]),c}function d(a){return"x"===a.charAt(0)}function e(a){return"y"===a.charAt(0)}function f(a){return a[0]}function g(a){return a[a.length-1]}function h(b,c){return a.max(b,function(a){return c(a).length})>0}function i(a){return"[object Date]"!==Object.prototype.toString.call(a)?!1:!isNaN(a.getTime())}function j(b,c){return a.trait.utils.isX(c)?[b.minRangeMarginLeft(c),b.chartWidth()-b.minRangeMarginRight(c)]:[b.chartHeight()-b.minRangeMarginBottom(c),b.minRangeMarginTop(c)]}function k(b,c,d){var e=d.domain();return a.trait.utils.isX(c)?[[0,d(e[0])],[d(e[1]),b.chartWidth()]]:[[0,d(e[0])],[d(e[1]),b.chartHeight()]]}function l(a,b){var c=parseFloat(a);return isNaN(c)?b:c}function m(a,b){if(!a)return b;var c={};return c.top=l(a.top,b.top),c.right=l(a.right,b.right),c.bottom=l(a.bottom,b.bottom),c.left=l(a.left,b.left),c}function n(a,b,c){if(!a)return c;if(Array.isArray(a)){var d=a.length;if(0===d)return c;var e=Math.min(d-1,b),f=a[e];return f?f:c}return a}function o(a,b,c){if(!a)return c;if("object"==typeof a){var d=a[b];return d?d:c}return a}function p(a){if(null==a||"object"!=typeof a)return a;var b=a.constructor();for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function q(){var a,b,c,d,e=arguments[0]||{},f=arguments.length;for(a=1;f>a;a++)if(null!=(b=arguments[a]))for(c in b)d=b[c],d&&(e[c]=d);return e}function r(a,b){for(var c in b)a.hasOwnProperty(c)||b[c]&&(a[c]=b[c]);return a}function s(a,b){var c=p(a);return c||(c={}),r(c,b)}function t(a,b,c){function d(a,b){return"_"+a+"_"+b}function e(a,b,c){return v&&console.log("makeVirtual "+a),function(a,b){return function(){var a=this._super;this._super=c;var d=b.apply(this,arguments);return this._super=a,d}}(a,b)}v&&console.log("trait( "+a.name+")");var f,g,h=this;h.config=b,h._super=c,h.index=-1,h.__leafTrait=null,h.getImp=function(){return g},h.trait=function(a,b){var c=new t(a,b,g);return c.getImp()},h.call=function(a,b){return b||(b=this),this.__leafTrait||(this.__leafTrait=b),this._super&&this._super.call(a,b),a.call(g),g},h.callTraits=function(a){return this.__leafTrait?this.__leafTrait.call(a):this},h.__replaceVirtual=function(a,b){g.hasOwnProperty(a)&&(g[a]=b),c&&c.__replaceVirtual(a,b)},h.__virtualize=function(b,d){v&&console.log("__virtualize begin "+a.name+" name="+b);var f=null;return g.hasOwnProperty(b)&&"function"==typeof g[b]?(v&&console.log("__virtualize "+a.name+" name="+b+" hasFunction"),f=e(b,d,g[b]),g[b]=f,c&&c.__replaceVirtual(b,f)):v&&console.log("__virtualize "+a.name+" name="+b+" hasFunction NOT  "),f},h.__makeVTable=function(){v&&console.log("__makeVTable begin "+a.name);var b,d;for(b in g)d=c.__virtualize(b,g[b]),d?(v&&console.log(a.name+".__makeVTable name "+b+"   virtualized"),g[b]=d):v&&console.log(a.name+".__makeVTable name "+b+" ! virtualized");for(b in c)b in g||(g[b]=c[b]);v&&console.log("__makeVTable end")},h.__getRoot=function(){return h._super?h._super.__getRoot():h},f=d(a.name,h._traitIndex),c&&(h.config=s(b,h.__getRoot().config)),g=a(c,h.config,f),c&&h.__makeVTable(),g.call=h.call,g.callTraits=h.callTraits,g.trait=h.trait,g.getImp=h.getImp,g.config=h.config,g.__makeVTable=h.__makeVTable,g.__virtualize=h.__virtualize,g.__replaceVirtual=h.__replaceVirtual,g.__getRoot=h.__getRoot,g._super=c}function u(a,b){return new t(a,b).getImp()}var v=!1;Array.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},t.prototype={trait:function(a,b){var c=new t(a,b,this),d=c.getImp();return d},__getRoot:function(){return this._super?this._super.__getRoot():this},callInstance:function(a){var b=this;a.call(function(a){a.each(function(c){b(c,a)})})},call:function(a,b){return b||(b=this),this.__leafTrait=b,this._super&&this._super.call(a,b),a.call(this),this}},t.prototype.constructor=t,a.selection.prototype.trait=function(a,c){if(Array.isArray(a))for(var d in a)this.trait(a[d]);else{this._traitsInitialize();var e=this.traits.length,f={};e>0&&(f=this.traits[e-1]);var g=s(this._traitsConfig,c),h=a(f,g,this);b(f,h),this.call(h),this.traits.push(h)}return this},a.selection.prototype.callTraits=function(){for(var a in this.traits){var b=this.traits[a];this.call(b)}return this};var w={};a.selection.prototype._traitsInitialize=function(){return this._traitsConfig||(this._traitsConfig=p(w)),this.traits||(this.traits=[]),this},a.selection.prototype.traitConfig=function(a){this._traitsInitialize();for(var b in a)this._traitsConfig[b]=a[b];return this},a.trait=u,a.trait.config={},a.trait.axis={},a.trait.chart={utils:{}},a.trait.control={},a.trait.focus={},a.trait.layout={},a.trait.legend={},a.trait.scale={},a.trait.utils={clone:p,extend:q,isX:d,isY:e,isData:h,isValidDate:i,extentMin:f,extentMax:g,getScaleRange:j,getScaleExtensions:k,getTraitCache:c,configMargin:m,configFloat:l,getValueOrArrayItem:n,getValueOrObjectProperty:o}}(d3),function(a,b){function c(a,b){switch(arguments.length){case 0:this.x=0,this.y=0;break;case 1:this.x=a.x,this.y=a.y;break;default:this.x=a,this.y=b}}function d(a,b){arguments.length<=0?(this.width=0,this.height=0):(this.width=a,this.height=b)}function e(){var a,b;switch(arguments.length){case 0:this.top=0,this.right=0,this.bottom=0,this.left=0;break;case 1:a=arguments[0],this.top=a,this.right=a,this.bottom=a,this.left=a;break;case 2:a=arguments[0],b=arguments[1],this.top=a,this.right=b,this.bottom=a,this.left=b;break;case 3:this.top=arguments[0],this.right=arguments[1],this.bottom=arguments[2],this.left=arguments[1];break;case 4:this.top=arguments[0],this.right=arguments[1],this.bottom=arguments[2],this.left=arguments[3]}}function f(a,b,e,f,g,h){switch(arguments.length){case 0:this.origin=new c(0,0),this.size=new d(0,0),this.anchor=new c(0,0);break;case 2:this.origin=new c(a.x,a.y),this.size=new d(b.width,b.height),this.anchor=new c(0,0);break;case 3:this.origin=new c(a.x,a.y),this.size=new d(b.width,b.height),this.anchor=new c(e.x,e.y);break;case 4:this.origin=new c(a,b),this.size=new d(e,f),this.anchor=new c(0,0);break;case 6:this.origin=new c(a,b),this.size=new d(e,f),this.anchor=new c(g,h)}}function g(){this.values=[void 0,void 0],this.indices=[void 0,void 0]}function h(a,b){var c,d,e,f,g,h=void 0===b?-1:b-1,i=a.length,j=this.access;if(void 0===j){for(;++h<i&&!(null!=(c=f=a[h])&&c>=c);)c=f=void 0;for(void 0!==c&&(d=g=h);++h<i;)null!=(e=a[h])&&(c>e&&(c=e,d=h),e>f&&(f=e,g=h))}else{for(;++h<i&&!(null!=(c=f=j.call(a,a[h],h))&&c>=c);)c=void 0;for(void 0!==c&&(d=g=h);++h<i;)null!=(e=j.call(a,a[h],h))&&(c>e&&(c=e,d=h),e>f&&(f=e,g=h))}this.values=[c,f],this.indices=[d,g]}function i(a,b,c,d){switch(arguments.length){case 0:g.call(this),this.access=void 0;break;case 4:this.values=[a,c],this.indices=[b,d];break;default:this.access=b,h.call(this,a,c)}}function j(){i.apply(this,arguments)}function k(a){if(a){var b,c,d=this.access,e=a.length-1;void 0!==d&&(this.access=d),0>e?g.call(this):(b=void 0===d?a[0]:this.access.call(a,a[0],0),c=void 0===d?a[e]:this.access.call(a,a[e],e),this.values=[b,c],this.indices=[0,e])}}function l(a,b,c,d){switch(arguments.length){case 0:g.call(this),this.access=void 0;break;case 4:this.values=[a,c],this.indices=[b,d];break;default:this.access=b,k.call(this,a)}}c.prototype.set=function(a){a&&"object"==typeof a&&(this.x=a.x,this.y=a.y)},c.prototype.distanceX=function(a){return a.x>this.x?a.x-this.x:this.x-a.x},c.prototype.distanceY=function(a){return a.y>this.y?a.y-this.y:this.y-a.y},c.prototype.distance=function(a){var b=this.distanceX(a),c=this.distanceY(a);return Math.sqrt(b*b+c*c)},f.prototype.minX=function(){return this.origin.x-this.size.width*this.anchor.x},f.prototype.maxX=function(){return this.origin.x+this.size.width*(1-this.anchor.x)},f.prototype.midX=function(){return this.origin.x+this.size.width*(1-2*this.anchor.x)/2},f.prototype.minY=function(){return this.origin.y-this.size.height*this.anchor.y},f.prototype.maxY=function(){return this.origin.y+this.size.height*(1-this.anchor.y)},f.prototype.midY=function(){return this.origin.y+this.size.height*(1-2*this.anchor.y)/2},f.prototype.spaceOnTop=function(a){return this.minY()-a.maxY()},f.prototype.spaceOnBottom=function(a){return a.minY()-this.maxY()},f.prototype.roomOnRight=function(a){return a.maxX()-this.maxX()},f.prototype.roomOnBottom=function(a){return a.maxY()-this.maxY()},f.prototype.roomOnLeft=function(a){return this.minX()-a.minX()},f.prototype.roomOnTop=function(a){return this.minY()-a.minY()},f.prototype.translate=function(a){this.origin.x+=a.x,this.origin.y+=a.y},j.prototype.set=h,j.prototype.reset=g,j.prototype.access=function(a){this.access=a},j.prototype.union=function(a,b){var c=!1;if(0===arguments.length)return c;if(Array.isArray(a)){var d=Object.getPrototypeOf(this),e=new d.constructor(a,this.access,b);c=this.union(e)}else if(a instanceof j)(void 0===this.values[0]||a.values[0]<this.values[0])&&(this.values[0]=a.values[0],this.indices[0]=a.indices[0],c=!0),(void 0===this.values[1]||a.values[1]>this.values[1])&&(this.values[1]=a.values[1],this.indices[1]=a.indices[1],c=!0);else{var f=a,g=b;f<this.values[0]&&(this.values[0]=f,this.indices[0]=g,c=!0),f>this.values[1]&&(this.values[1]=f,this.indices[1]=g,c=!0)}return c},j.prototype.shifted=function(a,b){this.indices[0]-=b,this.indices[1]-=b,(isNaN(this.indices[0])||this.indices[0]<0||isNaN(this.indices[1])||this.indices[1]<0)&&this.set(a)},l.prototype=new j,l.prototype.constructor=l,l.prototype.set=k,l.prototype.max=function(a,b){var c,d;return Array.isArray(a)?(d=a.length-1,d>=0&&(c=void 0!==this.access?this.access.call(this,a[d],d):a[d])):a instanceof j?(c=a.values[1],d=a.indices[1]):(c=a,d=b),d>=0&&(void 0===this.values[1]||c>this.values[1])?(this.values[1]=c,this.indices[1]=d,!0):!1},b.Point=c,b.Size=d,b.Margin=e,b.Rect=f,b.ExtentWithIndices=j,b.ExtentWithIndicesSorted=l}(d3,d3.trait),function(a,b){function c(a){return{x:a.xAxis||"x1",y:a.yAxis||"y1"}}function d(a){return a[0]}function e(a){return a[1]}function f(a){return a}function g(a,b){return b}function h(a,b){return{x:a[b.x]||d,y:a[b.y]||e,seriesData:a.seriesData||f,seriesName:a.seriesName||g}}b.config.axes=c,b.config.accessorsXY=h}(d3,d3.trait),function(a,b){function c(a){if(void 0===a||null===a)return void 0;if(0>=a)return n;var b=n;return b=q>a?p>a?3*o>=a?"1s":12*o>=a?"5s":24*o>=a?"15s":"30s":3*p>=a?"1m":12*p>=a?"5m":24*p>=a?"15m":"30m":r>a?4*q>=a?"1h":9*q>=a?"6h":"12h":6*r>=a?"1d":3*s>=a?"1w":10*t>=a?"1mo":"1y"}function d(b){var d,e;if(d=b.range(),!d)return void 0;if(e=b.invert(d[0]),isNaN(e))return void 0;var f=a.trait.utils.extentMax(d),g=Math.abs(f-d[0]),h=b.invert(f),i=Math.abs(h-e),j=i/g;return c(j)}function e(a,b,c,d,e){this.resolution=a,this.stepSize=w[this.resolution],this.access=b,this.data=d,this.sampled=e,this.extents=void 0,this.constraints={time:c.time,size:c.size},this.throttling={time:c.throttling,last:0,timer:void 0},this.nextResolution={higher:null,lower:null},this.lastRead=Date.now(),this.resampling={nextStep:0,source:void 0,unsampledCount:0},this.onHandlers={update:[]}}function f(){function a(a){var b,c;for(b=a-1;b>=0;b--)if(c=v[b],i.hasOwnProperty(c))return i[c];return null}function b(a){var b,c;for(b=a+1;b<v.length;b++)if(c=v[b],i.hasOwnProperty(c))return i[c];return null}function c(c){var d,e,f=v.indexOf(c.resolution);d=b(f),d&&(c.nextResolution.lower=d,d.nextResolution.higher=c),e=a(f),e&&(c.nextResolution.higher=e,e.nextResolution.lower=c)}function d(){}function f(a){var b=a||n,d=i[b];return void 0===d&&(d=new e(b,g,h),i[b]=d,c(d)),d}var g={x:function(a){return a[0]},y:function(a){return a[1]}},h={size:0,time:0,throttling:0},i={};return d.x=function(a){return arguments.length?(g.x=a,this):g.x},d.y=function(a){return arguments.length?(g.y=a,this):g.y},d.constrainSize=function(a){if(!arguments.length)return h.size;if(a>=0){h.size=a;for(var b in i)i[b].constrainSize(h.size)}return this},d.constrainTime=function(a){if(!arguments.length)return h.time;if(a>=0){h.time=a;for(var b in i)i[b].constrainTime(h.time)}return this},d.constrainThrottling=function(a){if(!arguments.length)return h.throttling;if(a>=0){h.throttling=a;for(var b in i)i[b].constrainThrottling(h.throttling)}return this},d.pushPoints=function(a,b,c){var d=f(c);return d.pushPoints(a,b),this},d.get=function(b){var c=b?b.resolution():void 0,d=f(c);if(void 0===d.data){var e=v.indexOf(d.resolution),g=a(e);g&&g.data?d.initialSample(g):(d.data=[],d.resolution!==n&&console.error(g?"murts.get findHigherResolution( "+d.resolution+") -- no data found in source":"murts.get findHigherResolution( "+d.resolution+") -- no source data found to sample from"))}return d.lastRead=Date.now(),d},d.removeOnUpdate=function(a,b){var c=a.resolution(),d=f(c);d.removeOnUpdate(b)},d.reset=function(){i={},g={x:function(a){return a[0]},y:function(a){return a[1]}}},d}function g(a,b,c,d,e,f){var g=a[b],h=f.x(g),i=f.y(g),j={x:[h,h],y:[i,i],d:[g,g]},k={x:h,y:i,count:1};if(h>=d){var l=h-d,m=Math.floor(l/c)+1;d=m*c+d}var n=!0;for(b++;n&&e>b;)g=a[b],h=f.x(g),n=d>h,n&&(i=f.y(g),k.x+=h,k.y+=i,k.count++,i<j.y[0]?(j.x[0]=h,j.y[0]=i,j.d[0]=g):i>j.y[1]&&(j.x[1]=h,j.y[1]=i,j.d[1]=g),b++);return{extents:j,ave:{x:k.x/k.count,y:k.y/k.count,count:k.count},sourceIndex:b,nextStep:d}}function h(a,b,c,d){var e,f,g=d.x(a),h=d.y(a);return e=.5*Math.abs((g-c.ave.x)*(b.extents.y[0]-h)-(g-b.extents.x[0])*(c.ave.y-h)),f=.5*Math.abs((g-c.ave.x)*(b.extents.y[1]-h)-(g-b.extents.x[1])*(c.ave.y-h)),e>f?b.extents.d[0]:b.extents.d[1]}function i(a,c,d){{var e,f,g=0,h=[];Date.now()}if(0===a.length)return{data:h,nextStep:0};if(e=a[g++],h[0]=e,f=d.x(e)+c,a.length<3)return 2===a.length&&(h[1]=a[g++]),{data:h,nextStep:f,extents:{x:new b.ExtentWithIndicesSorted(h,d.x),y:new b.ExtentWithIndices(h,d.y)}};var i=j(h,a,g,e,c,f,d);return i}function j(a,c,d,e,f,i,j){var k,l,m,n=c.length-1,o={x:new b.ExtentWithIndicesSorted([e],j.x),y:new b.ExtentWithIndices([e],j.y)};for(k=g(c,d,f,i,n,j),d=k.sourceIndex;n>d;d++)i=k.nextStep+f,l=g(c,d,f,i,n,j),d=l.sourceIndex,m=h(e,k,l,j),o.y.union(j.y(m),a.length),a[a.length]=m,e=m,k=l;var p=c[n],q=j.x(p),r=j.y(p);return l={ave:{x:q,y:r,count:1}},m=h(e,k,l,j),o.y.union(j.y(m),a.length),a[a.length]=m,o.y.union(r,a.length),o.x.max(q,a.length),a[a.length]=p,{data:a,extents:o,nextStep:i}}function k(a,c,d,e,f,g){{var h=[],i=a.length-c;Date.now()}if(1>=i){var k;return 1===i&&(h[0]=a[c++],k={x:new b.ExtentWithIndicesSorted(h,g.x),y:new b.ExtentWithIndices(h,g.y)}),{data:h,nextStep:f,extents:k}}var l=j(h,a,c,d,e,f,g);return l}function l(a){return"function"==typeof a&&0===a.toString().indexOf("function murtsDataStore(")}function m(a,b){return l(a)?a.get(b).data:a}var n="1s",o=1e3,p=60*o,q=60*p,r=24*q,s=7*r,t=30*r,u=365*r,v=[n,"5s","15s","30s","1m","5m","15m","30m","1h","6h","12h","1d","1w","1mo","1y"],w={"1s":1*o,"5s":5*o,"15s":15*o,"30s":30*o,"1m":1*p,"5m":5*p,"15m":15*p,"30m":30*p,"12h":12*q,"6h":6*q,"1h":1*q,"1d":1*r,"1w":1*s,"1mo":1*t,"1y":1*u+.25*r},x={time:a.time.scale,linear:a.scale.linear,identity:a.scale.identity};a.time.scale=function(){var a,b=x.time(),c=b.range,e=b.rangeRound,f=b.domain;return b.range=function(b){return arguments.length?(c(b),a=void 0,this):c()},b.rangeRound=function(b){return arguments.length?(e(b),a=void 0,this):e()},b.domain=function(b){return arguments.length?(f(b),a=void 0,this):f()},b.resolution=function(c){return arguments.length?(v.indexOf(c)>=0&&(a=c),this):(void 0===a&&(a=d(b)),a)},b},a.scale.linear=function(){var a,b=x.linear(),c=b.range,e=b.rangeRound,f=b.domain;return b.range=function(b){return arguments.length?(c(b),a=void 0,this):c()},b.rangeRound=function(b){return arguments.length?(e(b),a=void 0,this):e()},b.domain=function(b){return arguments.length?(f(b),a=void 0,this):f()},b.resolution=function(c){return arguments.length?(v.indexOf(c)>=0&&(a=c),this):(void 0===a&&(a=d(b)),a)},b},a.scale.identity=function(){var a,b=x.identity(),c=b.range,e=(b.rangeRound,b.domain);return b.range=function(b){return arguments.length?(c(b),a=void 0,this):c()},b.domain=function(b){return arguments.length?(e(b),a=void 0,this):e()},b.resolution=function(c){return arguments.length?(v.indexOf(c)>=0&&(a=c),this):(void 0===a&&(a=d(b)),a)},b};var y=function(){};e.prototype.on=function(a,b){var c,d;this.onHandlers.hasOwnProperty(a)||(this.onHandlers[a]=[]),c=this.onHandlers[a];var e=c.indexOf(b);return 0>e?(c.push(b),d=function(){var a=c.indexOf(b);a>=0&&c.splice(a,1)}):d=y,d},e.prototype.notify=function(a){var b=this;this.onHandlers.update.forEach(function(c){c(a,b.data,b)})},e.prototype.extendNextStepPastExtent=function(){if(this.extents){var a=this.extents.x.values[1];if(a>=this.resampling.nextStep){var b=a-this.resampling.nextStep,c=Math.floor(b/this.stepSize)+1;this.resampling.nextStep+=c*this.stepSize}}},e.prototype.initialSample=function(a){var b=i(a.data,this.stepSize,this.access);this.data=b.data,this.extents=b.extents,this.sampled=!0,this.resampling.nextStep=b.nextStep,this.resampling.source=a,this.resampling.unsampledCount=0,this.data.length>0&&this.extendNextStepPastExtent(),this.applyConstraintsBeforePushPoints()},e.prototype.constrainSize=function(a){a>=0&&(this.constraints.size=a,this.applyConstraintsBeforePushPoints()&&this.notify("constrained"))},e.prototype.constrainTime=function(a){a>=0&&(this.constraints.time=a,this.applyConstraintsBeforePushPoints()&&this.notify("constrained"))},e.prototype.constrainThrottling=function(a){this.throttling.time>=0&&(this.throttling.time=a)},e.prototype.delayConstraints=function(a){if(this.throttling.timer)return!0;if(this.throttling.time>0&&this.throttling.last+this.throttling.time>a){var b=this,c=function(){b.throttling.timer=void 0,b.applyConstraintsBeforePushPoints()&&b.notify("constrained")},d=this.throttling.last+this.throttling.time-a+1;return this.throttling.timer=setTimeout(c,d),!0}return!1},e.prototype.shift=function(a){a>=this.data.length?(this.data=[],this.extents.x.reset(),this.extents.y.reset()):(this.data.splice(0,a),this.extents.x.shifted(this.data,a),this.extents.y.shifted(this.data,a))},e.prototype.applyConstraintsBeforePushPoints=function(b){var c=!1,d=b?b.length:0,e=this.data?this.data.length:0;if(e+d===0)return c;var f=0,g=0,h=Date.now();if(this.constraints.size>0){var i=e+d;if(this.constraints.size<i){if(this.delayConstraints(h))return!1;var j=i-this.constraints.size;f=Math.min(e,j),g=j-f}}if(e>0&&f===e&&(this.shift(f),e=this.data.length,f=0,c=!0),this.constraints.time>0){var k=d>0?this.access.x(b[d-1]):void 0,l=d>0?this.access.x(b[0]):void 0,m=e>0?this.access.x(this.data[e-1]):void 0,n=e>0?this.access.x(this.data[0]):void 0,o=(d>0?k:m)-this.constraints.time;if(o>n||o>l){if(this.delayConstraints(h))return!1;var p,q=a.bisector(this.access.x).left;o>m?f=e:o>n&&(p=Math.min(q(this.data,o,f),e-1),f=Math.max(f,p)),o>l&&(p=Math.min(q(b,o),d-1),g=Math.max(g,p))}}return f>0&&(this.shift(f),c=!0),g>0&&(b.splice(0,g),c=!0),c&&(this.throttling.last=h),c},e.prototype.pushPoints=function(a,c){var d=a.length;if(void 0===this.data&&(this.data=[]),void 0!==c&&(this.sampled=this.sampled||c),d>0){this.applyConstraintsBeforePushPoints(a)&&(d=a.length);var e=this.data.length;this.data=this.data.concat(a),this.extents?(this.extents.x.union(this.data),this.extents.y.union(this.data,e)):this.extents={x:new b.ExtentWithIndicesSorted(this.data,this.access.x),y:new b.ExtentWithIndices(this.data,this.access.y)},this.notify("update"),d>0&&this.nextResolution.lower&&this.nextResolution.lower.sourceUpdated(d)}return this},e.prototype.findIndexOfStepStartFromEnd=function(a,b,c){var d;for(c=void 0===c?0:c,d=a.length-1-c,d=Math.min(d,a.length-1);d>=0&&this.access.x(a[d])>=b;)d--;return d++,Math.max(d,0)},e.prototype.sampleUpdatesFromSource=function(){var a,c=this.resampling.source,d=this.data.length,e=0;if(2>=d)return a=d,this.initialSample(c),this.data.length-a;var f=this.resampling.nextStep-this.stepSize,g=this.findIndexOfStepStartFromEnd(c.data,f,this.resampling.unsampledCount),h=this.findIndexOfStepStartFromEnd(this.data,f);if(this.data.splice(h,d-h),this.data.length<=2)return a=d,this.initialSample(c),this.data.length-a;var i=this.data[this.data.length-1],j=k(c.data,g,i,this.stepSize,this.resampling.nextStep,this.access);return this.applyConstraintsBeforePushPoints(j.data),e=j.data.length,this.data=this.data.concat(j.data),this.extents&&j.extents?(this.extents.x.union(j.extents.x),this.extents.y.union(j.extents.y)):this.extents={x:new b.ExtentWithIndicesSorted(this.data,this.access.x),y:new b.ExtentWithIndices(this.data,this.access.y)},this.resampling.nextStep=j.nextStep,this.resampling.unsampledCount=0,this.extendNextStepPastExtent(),e},e.prototype.sourceUpdated=function(a){if(!(0>=a)){var b=this.resampling.source,c=0;this.nextResolution.higher===b?(this.resampling.unsampledCount+=a,b&&b.extents&&b.extents.x.values[1]>=this.resampling.nextStep&&(c=this.sampleUpdatesFromSource())):(this.initialSample(this.nextResolution.higher),c=this.data.length),c>0&&(this.notify("update"),this.nextResolution.lower&&this.nextResolution.lower.sourceUpdated(c))}},b.murts={dataStore:f,utils:{Sampling:e,sample:i,sampleUpdates:k,mapResolution:c,isDataStore:l,getOrElse:m}}}(d3,d3.trait),function(a,b){function c(b,c,d){if(!b)return 0;var e=a.trait.utils.extentMax(c),f=a.trait.utils.extentMin(c),g=d(b),h=d(f);return h>g?0:g-d(e)}function d(a,b){a.selectAll("path").attr("d",b).attr("transform",null)}function e(b,e,f,g,h,i){var j=f.domain(),k=a.trait.utils.extentMax(j);if("trend"===b){var l=c(i,j,f);0!==l?(g.attr("transform",null),g.selectAll("path").attr("d",h),0!==e&&e?g.transition().duration(e).ease("linear").attr("transform","translate("+l+")"):g.attr("transform","translate("+l+")")):d(g,h)}else d(g,h);return k}function f(a,b,c,d){var e=d.range(),f=e[e.length-1]-e[0],g=a.length;if(2>g||b.length<2)return f;var h=b[0],i=Math.min(g-1,b[1]);if(0>h||h>=g)return f;var j,k=d(c(a[h],h));for(h++;i>=h;h++)j=d(c(a[h],h)),f=Math.min(f,j-k),k=j;return f}function g(b,c,d){if(b.length<=0)return null;var e=a.trait.utils.extentMin(d),f=a.trait.utils.extentMax(d),g=a.bisector(c),h=g.left,i=g.right,j=h(b,e),k=i(b,f);return[j,k-1]}b.chart.utils.updatePathWithTrend=e,b.chart.utils.minDistanceBetween=f,b.chart.utils.dataIndicesExtentForDomainExtent=g}(d3,d3.trait),function(a,b){function c(b){var c={distance:14,axis:null};return b.focus&&(c.distance=a.trait.utils.configFloat(b.focus.distance,c.distance),c.axis=b.focus.axis),c}function d(b,c,d,e){return new a.trait.Point(d(c.x(b)),e(c.y(b)))}function e(b,c,d,e){return new a.trait.Point(d(c.x(b)),e(b.y0+c.y(b)))}function f(a,b,c,d,e,f,g,h){var i,j,k=b[c],l=g(k,d,e,f);return i=l.distance(h),j=l.distanceX(h),{series:a,index:c,item:k,point:l,distance:i,distanceX:j}}function g(a,b){var c="x"===b.axis?a.distanceX:a.distance;return c<=b.distance}function h(c,h,i,j,k,l,m,n){var o=[],p=new a.trait.Point(k.invert(h.x),l.invert(h.y)),q=a.bisector(j.x).left,r=n?e:d;return c.forEach(function(a){var c,d,e,n=b.murts.utils.getOrElse(j.seriesData(a),k);if(n.length>0){if(e=q(n,p.x),e>=n.length&&(e=n.length-1),c=f(a,n,e,j,k,l,r,h),d=c.index-1,d>=0){var s=f(a,n,d,j,k,l,r,h);"x"===i.axis?s.distanceX<c.distanceX&&(c=s):s.distance<c.distance&&(c=s)}g(c,i)&&(c.color=m(a),o.push(c))}}),o}b.focus||(b.focus={}),b.focus.utils={makeConfig:c,getFocusItems:h}}(d3,d3.trait),function(a,b){function c(a,b){return a.rect.origin.y-b.rect.origin.y}function d(a,b){for(var c=null,d=a.length-1;d>=0;d--){var e,f=a[d],g=f.rect;e=d===a.length-1?b-g.maxY():c.rect.spaceOnTop(g),0>e&&(g.origin.y+=e),c=f}}function e(a,b,c){var d=0;c>0?d=-c-b:0>b&&(d=-b),a.origin.y+=d}function f(a,b,c){var d,f=null;a.forEach(function(a,g){d=a.rect,0===g?e(d,d.roomOnTop(b),c):e(d,d.spaceOnTop(f.rect),c),f=a})}function g(a,b,c,d){for(var e,f=b;c>f;f++)e=a[f],e.rect.origin.y+=d}function h(a,b,c){for(var d,e,f,h=0,i=0,j=0,k=0,l=null,m=0,n=0;h<a.length;h++){if(f=a[h],d=f.rect,e=0===h?d.roomOnTop(b):d.spaceOnTop(l.rect),e>0)if(j>0){if(n=m/j,-1>n||n>1){var o=n;n=n>0?Math.min(n,k):-Math.min(-n,e),g(a,i,h,-n),k-=n,e+=n,e>0?(j=1,i=h,k=e,m=0):(m=(o-n)*j,j++,m+=d.origin.y-c[h])}}else j=1,i=h,k=e,m+=d.origin.y-c[h];else j++,m+=d.origin.y-c[h];l=f}if(j>1&&(n=m/j,-1>n||n>1)){if(n>0)n=Math.min(n,k);else{var p=l.rect.roomOnBottom(b);n=p>0?-Math.min(-n,p):0}g(a,i,h,-n)}}function i(b,e){if(!(b.length<=0)){b.sort(c);var g=0,i=0,j=e.size.height,k=a.sum(b,function(a){return a.rect.size.height}),l=b.map(function(a){return a.rect.origin.y});k>j?i=(k-j)/b.length:g=j-k,f(b,e,i),g>0&&(d(b,e.maxY()),h(b,e,l))}}function j(a,b){var c,d=[],e=[];return a.forEach(function(a){c=a.rect,c.anchor.x<.5?c.roomOnRight(b)>=0?(a.orient=n,e.push(a)):(a.orient=m,c.anchor.x=1,d.push(a)):c.roomOnLeft(b)>=0?(a.orient=m,d.push(a)):(a.orient=n,c.anchor.x=0,e.push(a))}),[d,e]}function k(a,b){var c=j(a,b);i(c[0],b),i(c[1],b)}function l(a,b,c,d){var e,f,g=0;switch(c){case"left":g=b.minX(),a.forEach(function(a){e=a.rect,e.origin.x+=g-e.minX(),g=e.maxX()});break;case"right":for(g=b.maxX(),f=a.length-1;f>=0;f--)e=a[f].rect,e.origin.x+=g-e.maxX(),g=e.minX();break;case"top":g=b.minY(),a.forEach(function(a){e=a.rect,e.origin.y+=g-e.minY(),g=e.maxY()});break;case"bottom":for(g=b.maxY(),f=a.length-1;f>=0;f--)e=a[f].rect,e.origin.y+=g-e.maxY(),g=e.minY()}}var m=-1,n=1;b.layout.adjustOrientationToFitWidth=j,b.layout.vertical=i,b.layout.byOrientation=l,b.layout.verticalAnchorLeftRight=k,b.layout.utils={listNudgeUpFromBottom:d,removeOverlapFromTop:f,listBalanceFromTop:h}}(d3,d3.trait),function(a,b){function c(a,b,c){return e(a,b,b.value,c)}function d(a,b,c){return e(a,b,q,c)}function e(b,c,d,e){var f=a.min(b,function(a,b,e){return i(c.series(a,b,e),c,d)});return f||(f=e?e:0),f}function f(a,b,c){return h(a,b,b.value,c)}function g(a,b,c){var d=function(a){return a.y0+b.value(a)};return h(a,b,d,c)}function h(b,c,d,e){var f=a.max(b,function(a,b,e){return j(c.series(a,b,e),c,d)});return f||(f=e?e:0),f}function i(c,d,e){if(b.murts.utils.isDataStore(c)){var f=c.get();return void 0===f.extents?void 0:"x"===d.axisChar?f.extents.x.values[0]:f.extents.y.values[0]}return a.min(c,e)}function j(c,d,e){if(b.murts.utils.isDataStore(c)){var f=c.get();return void 0===f.extents?void 0:"x"===d.axisChar?f.extents.x.values[1]:f.extents.y.values[1]}return a.max(c,e)}function k(a,b,c,d){var e=a.map(function(a){return l(b.series(a),b)});return n(e,c,d)}function l(c,d){if(b.murts.utils.isDataStore(c)){var e=c.get();return void 0===e.extents?[void 0,void 0]:"x"===d.axisChar?e.extents.x.values:e.extents.y.values}return a.extent(c,d.value)}function m(b,c,d,e){var f;return f=b.map(function(b){var d=c.data(c.series(b)),e=[a.min(d,function(a){return a.y0}),a.max(d,function(a){return a.y0+c.value(a)})];return e}),n(f,d,e)}function n(b,c,d){var e,f;if(e=a.min(b,function(a){return a[0]}),f=a.max(b,function(a){return a[1]}),!e&&!f)return d?d:[0,1];if(!(e instanceof Date||f instanceof Date||isNaN(e)||isNaN(f)))if(e===f)e-=1,f+=1;else{var g=(f-e)*c;e-=g,f+=g}return[e,f]}function o(a,c){return!a||a.length<2?!0:c[0]<a[0]||b.utils.extentMax(c)>b.utils.extentMax(a)}function p(a,c){return!c||c.length<2?a:!a||a.length<2?c:(c[0]<a[0]&&(a[0]=c[0]),b.utils.extentMax(c)>b.utils.extentMax(a)&&(a[a.length-1]=b.utils.extentMax(c)),a)}var q=function(a){return a.y0};b.utils||(b.utils={}),b.utils.minFromData=c,b.utils.maxFromData=f,b.utils.minFromAreaData=d,b.utils.maxFromAreaData=g,b.utils.extentFromData=k,b.utils.extentFromAreaData=m,b.utils.isExtentExtended=o,b.utils.extendExtent=p}(d3,d3.trait),function(a,b){function c(a,b){return b?b:"x"===a?"bottom":"left"}function d(a){var b=a.axis,d=b.charAt(0),e={name:b,axisChar:d,accessData:a[b],orient:c(d,a.orient),ticks:a.ticks,extentTicks:a.extentTicks||!1,tickSize:a.tickSize,tickPadding:a.tickPadding,tickFormat:a.tickFormat,nice:a.nice,label:a.label,lines:a.lines,gridLines:a.gridLines};return e.labelLineHeight=e.label?a.labelLineHeight||14:0,e.axisMargin=a.axisMargin||40+e.labelLineHeight,e}function e(a,b,c){if(!b.label)return null;{var d,e,f=c.node().getBBox(),g=Math.round(f.width/2);b.axisMargin-b.labelLineHeight}switch(b.orient){case"left":return d=-b.axisMargin+b.labelLineHeight,e=a.chartHeight()/2+g,"translate( "+d+","+e+") rotate( -90)";case"bottom":return d=a.chartWidth()/2-g,e=b.axisMargin-b.labelLineHeight,"translate( "+d+","+e+")";case"top":return d=a.chartWidth()/2-g,e=-b.axisMargin+b.labelLineHeight,"translate( "+d+","+e+")";case"right":return d=b.axisMargin-b.labelLineHeight,e=a.chartHeight()/2-g,"translate( "+d+","+e+") rotate( 90)";default:return null}}function f(a,b,c,d,e){d.extentTicks?b.tickValues(c.domain()):d.ticks&&b.ticks(d.ticks),d.gridLines?g(a,b,d,e):d.tickSize&&b.tickSize(d.tickSize),d.tickPadding&&b.tickPadding(d.tickPadding),d.tickFormat&&b.tickFormat(d.tickFormat)}function g(a,b,c,d){switch(a.classed("grid",c.gridLines),c.axisChar){case"x":b.tickSize(-d.chartHeight());break;case"y":b.tickSize(-d.chartWidth())}}function h(a){return"object"==typeof a&&a.hasOwnProperty("class")?l+" "+a["class"]:l}function i(b,c){function g(a){var c=isNaN(a)?a.value:a,d=p(c);return"x"===o.axisChar?"M"+d+",0L"+d+","+b.chartHeight():"M0,"+d+"L"+b.chartWidth()+","+d}function i(c){var d=i;c.each(function(){if(j||(j=this._container.append("g").classed("axis",!0).classed("axis-"+o.name,!0),o.label&&(m=j.append("text").classed("axis-label axis-label-"+o.name,!0)),n=a.svg.axis().scale(p)),k&&console.log("axisLinear.each "+o.name),n.orient(o.orient),f(j,n,p,o,d),d.layoutAxis(o.name,j,o.orient,o.axisMargin),o.label&&(m.text(o.label),m.attr({transform:e(d,o,m)})),j.call(n),b.isMinRangeMargin(o.name)){var c=a.trait.utils.getScaleExtensions(b,o.name,p),i=j.selectAll("path.axis-extension").data(c);i.enter().append("path").attr("class","axis-extension").attr("d",function(a){return"M"+a[0]+",0L"+a[1]+",0"}),i.transition().duration(0).attr("class","axis-extension").attr("d",function(a){return"M"+a[0]+",0L"+a[1]+",0"})}if(o.lines&&Array.isArray(o.lines)){var q=j.selectAll("path."+l).data(o.lines);q.enter().append("path").attr("class",h).attr("d",g),q.attr("class","axis-line").attr("d",g)}})}var j,m,n,o=d(c),p=b[o.name]();return i.update=function(a,c){return this._super(a,c),k&&console.log("axisLinear.update "+o.name),f(j,n,p,o,this),0===c?j.call(n):j.transition().duration(c||b.duration()).ease("linear").call(n),this},b.onRangeMarginChanged("axisLinear-"+o.name,i),i}function j(b,c){function g(b){var d=g;b.each(function(b){i||(i=this._container.append("g").classed("axis",!0).classed("axis-"+n.name,!0),n.label&&(j=i.append("text").classed("axis-label axis-label-"+n.name,!0)),l=a.svg.axis());var g=o.domain();m.range(o.range()),m.domain(o.domain()),n.nice&&m.nice(n.nice),l.scale(m).orient(n.orient),f(i,l,m,n,d),d.layoutAxis(n.name,i,n.orient,n.axisMargin),n.label&&(j.text(n.label),j.attr({transform:e(d,n,j)})),i.call(l);var h=i.selectAll("path.axis-extension").data(a.trait.utils.isValidDate(g[0])?[g[0]]:[]);h.transition().attr("class","axis-extension").attr("d",function(a){return"M0,0L"+m(a)+",0"}),h.enter().append("path").attr("class","axis-extension").attr("d",function(a){return"M0,0L"+m(a)+",0"}),a.trait.utils.isData(b,c.seriesData)&&(k=a.trait.utils.extentMax(g))})}function h(){var b=o.domain(),c=a.trait.utils.extentMin(b),d=a.trait.utils.extentMax(b);if(k){var e=k.getTime();if(e>c.getTime()){var f=d.getTime()-e;c=new Date(c.getTime()+f)}}return[c,d]}var i,j,k,l=a.svg.axis(),m=a.time.scale(),n=d(c),o=b[n.name]();return g.update=function(c,d){this._super(c,d),m.range(a.trait.utils.getScaleRange(b,n.name));var e=h();return m.domain(e),k=a.trait.utils.extentMax(e),0===d?i.call(l):i.transition().duration(d||b.duration()).ease("linear").call(l),this},b.onChartResized("axisMonth-"+n.name,g),b.onRangeMarginChanged("axisMonth-"+n.name,g),g}var k=!1,l="axis-line";b.axis.linear=i,b.axis.time||(b.axis.time={}),b.axis.time.month=j}(d3,d3.trait),function(a,b){function c(b,c,d,e,f){var g=a.svg.area().interpolate(f||"linear");return g=b?g.x(function(a){return d(c.x(a))}).y0(function(a){return e(a.y0)}).y1(function(a){return e(a.y0+c.y(a))}):g.x(function(a){return d(c.x(a))}).y1(function(a){return e(c.y(a))
  })}function d(d,e){function f(c){var d=f;c.each(function(c){if(!g){var f=e.chartClass?"chart-area "+e.chartClass:"chart-area";g=this._chartGroup.append("g").classed(f,!0)}if(i=e.seriesFilter?c.filter(e.seriesFilter):c,t){i.length>0&&k(i),m.series=m.seriesData,m.value=m.y;var l=b.utils.extentFromAreaData(i,m,p);q(l)}else u.y0(d.chartHeight());h=g.selectAll(".series").data(i),h.selectAll("path").transition().duration(500).attr("d",function(a){return u(m.seriesData(a))}),h.enter().append("g").attr("class","series").append("path").attr("class","area").attr("d",function(a){return u(m.seriesData(a))}).style("fill",d.color),j=a.trait.utils.extentMax(n.domain())})}var g,h,i,j,k,l=b.config.axes(e),m=b.config.accessorsXY(e,l),n=d[l.x](),o=d[l.y](),p=a.trait.utils.configFloat(e.domainPadding,0),q=d[l.y+"MinDomainExtentFromData"],r=a.trait.focus.utils.makeConfig(e),s=e.interpolate||"linear",t=e.stacked?!0:!1,u=c(t,m,n,o,s,d.chartHeight());t&&(k=a.layout.stack().values(function(a){return m.seriesData(a)}).y(m.y));var v=a.dispatch("customHover");return f.update=function(a,c){this._super(a,c);var e=c||d.duration(),f=function(a){return u(m.seriesData(a))};if(t){k(i),m.series=m.seriesData,m.data=m.y;var g=b.utils.extentFromAreaData(i,m,p);q(g)}return j=b.chart.utils.updatePathWithTrend(a,e,n,h,f,j),this},f.getFocusItems=function(a){var c=this._super(a),d=b.focus.utils.getFocusItems(i,a,r,m,n,o,f.color,t);return c=c.concat(d)},a.rebind(f,v,"on"),f}b.chart.area=d}(d3,d3.trait),function(a,b){function c(b){var c=a.trait.utils.configFloat(b.gap,.1),d=a.trait.utils.configFloat(b.outerGap,c),e={width:b.width||"auto",gap:c,outerGap:d,justification:b.justification||"center",insets:b.insets||k};return e}function d(a,b,c,d,e){return{x:function(c){return d(a.x(c))+b.offset},y:function(b){return e(Math.max(a.y(b),0))},width:b.width,height:function(b){return e(0)-e(Math.abs(a.y(b)))}}}function e(a,b,c){var d=0;switch(a){case"left":d=Math.round(c/2);break;case"right":d=Math.round(0-b-c/2);break;default:d=0-Math.round(b/2)}return d}function f(a,b,c,d,f,g,h,i){var j,k,l,m=e(i,f,g)-h,n=e(i,f,g)+f+h;return b?(j=b[0],k=d(c(a[j],j))+m,j=b[1],l=d(c(a[j],j))+n,[Math.floor(k),Math.ceil(l)]):d.range()}function g(b,c,d,e,g,h,i,j,k){var l=b.map(function(a,b){return f(d(a),c[b],e,g,h,i,j,k)}),m=a.min(l,function(a){return a[0]}),n=a.min(l,function(a){return a[1]});return[m,n]}function h(c,d,f,h,i,l){var m,n=null,o=null,p=0,q=0;if(i.rangeBand)m="auto"===h.width?i.rangeBand():h.width;else{var r=i.domain(),s=c.map(function(a){return b.chart.utils.dataIndicesExtentForDomainExtent(d(a),f,r)}),t=a.min(c,function(a,c){return b.chart.utils.minDistanceBetween(d(a),s[c],f,i)});m="auto"===h.width?Math.max(1,Math.floor(t*(1-h.gap))):h.width,p=Math.round(m*h.gap),q=Math.floor(m*h.outerGap);var u=g(c,s,d,f,i,m,p,q,h.justification),v=u[0],w=u[1];if(0>v||w>l)if(h.insets===k){var x=Math.max(w,l)-Math.min(0,v),y=l/x;"auto"===h.width&&(m=Math.max(1,Math.floor(m*y)),p=Math.round(m*h.gap),q=Math.floor(m*h.outerGap)),h.insets===k&&(u=g(c,s,d,f,i,m,p,q,h.justification),v=u[0],w=u[1],(0>v||w>l)&&(n={},0>v&&(n.left=1-v),w>l&&(n.right=w-l)))}else if(h.insets===j){var z=0>v?i.invert(v):r[0],A=w>l?i.invert(w):r[r.length-1];o=[z,A]}}var B=e(h.justification,m,p);return{width:m,gap:p,outerGap:q,offset:B,domainExtent:o,minRangeMargin:n}}function i(e,f){function g(b){var c=g;b.each(function(b){var g=e.chartWidth();if(k=f.seriesFilter?b.filter(f.seriesFilter):b,m=h(k,p.seriesData,p.x,t,q,g),(m.minRangeMargin||m.domainExtent)&&(m.minRangeMargin?c.minRangeMargin("x1",m.minRangeMargin):m.domainExtent&&e.x1Domain(m.domainExtent),m=h(k,p.seriesData,p.x,t,q,g)),!i){var o=f.chartClass?"chart-bar "+f.chartClass:"chart-bar";i=this._chartGroup.append("g").classed(o,!0)}j=i.selectAll(".series").data(k),j.enter().append("g").attr("class","series").style("fill",c.color),l=j.selectAll("rect").data(p.seriesData),l.enter().append("rect").classed("bar",!0).attr(d(p,m,c.chartHeight(),q,r)).on("mouseover",s.customHover),l.transition().duration(0).delay(0).ease(c.ease()).attr(d(p,m,c.chartHeight(),q,r)),l.exit().transition().style({opacity:0}).remove(),n=a.trait.utils.extentMax(q.domain())})}{var i,j,k,l,m,n,o=b.config.axes(f),p=b.config.accessorsXY(f,o),q=e[o.x](),r=e[o.y](),s=(f.barCount,a.dispatch("customHover")),t=c(f),u=a.trait.focus.utils.makeConfig(f);"function"==typeof q.rangeBand}return g.update=function(b,c){this._super(b,c);var f=a.trait.utils.extentMax(q.domain()),g=q(n)-q(f);return j.attr("transform",null),l.attr(d(p,m,e.chartHeight(),q,r)),l=j.selectAll("rect").data(p.seriesData),l.enter().append("rect").classed("bar",!0).attr(d(p,m,e.chartHeight(),q,r)),l.exit().transition().style({opacity:0}).remove(),0===c?j.attr("transform","translate("+g+")"):j.transition().duration(c||e.duration()).ease("linear").attr("transform","translate("+g+")"),n=a.trait.utils.extentMax(q.domain()),this},g.getFocusItems=function(a){var c=this._super(a),d=b.focus.utils.getFocusItems(k,a,u,p,q,r,g.color,!1);return c=c.concat(d)},a.rebind(g,s,"on"),g}var j="extend-domain",k="inset-range";b.chart.bar=i,b.chart.barUtils={barConfig:c,barAttr:d,barOffsetForJustification:e,rangeExtentOfBarsAndOuterGapForOneSeries:f,rangeExtentOfBarsAndOuterGap:g,getBarDimensions:h}}(d3,d3.trait),function(a,b){function c(c,f){function g(a){M[a]||(M[a]=b.utils.clone(O))}function h(b){if(!M[b])return!1;var c=M[b];return a.trait.utils.isX(b)?0!==c.left||0!==c.right:0!==c.top||0!==c.bottom}function i(a,b){if(!arguments.length)return{};if(g(a),1===arguments.length)return M[a];if(!b)return this;var c=M[a],d=!1;return b.left&&c.left<b.left&&(c.left=b.left,d=!0),b.right&&c.right<b.right&&(c.right=b.right,d=!0),b.top&&c.top<b.top&&(c.top=b.top,d=!0),b.bottom&&c.bottom<b.bottom&&(c.bottom=b.bottom,d=!0),d&&fb.rangeMarginChanged(),this}function j(){return f.colors?Array.isArray(f.colors)?function(a){return f.colors[a]}:f.colors:a.scale.category10()}function k(a,b){var c="chart-group-clip-path-"+d;return a._chartGroupClipPath=b.append("clipPath").attr("id",c),a._chartGroupClipPathRect=a._chartGroupClipPath.append("rect").attr("width",X).attr("height",Y),d++,c}function l(a,b,c){return a.x>=0&&a.x<=b&&a.y>=0&&a.y<=c}function m(a,b,c,d){var e;c&&v(a,[b],d),e=c?s.getFocusItems.call(a,b):[],e.forEach(function(a){a.point.x+=L.left,a.point.y+=L.top}),t(a,e)&&u(a,[e,b],d),a.__onFocusChangeLastFoci=e}function n(a,b){w(a,b)}function o(a,b,c){return a?c:b}function p(a,b,c,d){return a?d.indexOf("%")>=0?d:c:b}function q(a,b,c,d){var e={};return e.width=p(b,c,a.offsetWidth,a.style.width),e.height=p(b,d,a.offsetHeight,a.style.height),e}function r(b,c,d,e){return new a.trait.Size(o(c,d,b.offsetWidth),o(c,e,b.offsetHeight))}function s(b){R=b,b.each(function(b){var c=this,d=q(c,T,V,W);if(Q=a.select(c),!c._svg){c._svg=a.select(c).append("svg").classed("chart",!0).attr("width",d.width).attr("height",d.height),c._svgDefs=c._svg.append("defs"),U=r(c,T,V,W),V=U.width,W=U.height,X=U.width-L.left-L.right,Y=U.height-L.top-L.bottom;var e=null;f.clip&&(e=k(c,c._svgDefs)),c._container=c._svg.append("g").classed("container-group",!0),c._chartGroup=c._container.append("g").classed("chart-group",!0),f.clip&&c._chartGroup.attr("clip-path","url(#"+e+")"),this._svg.on("mousemove",function(){var b=a.mouse(c._chartGroup.node()),d=new a.trait.Point(b[0],b[1]),e=l(d,X,Y);m(c,d,e,!0,L.left,L.top)}),this._svg.on("mouseout",function(){var b=a.mouse(c._chartGroup.node()),d=new a.trait.Point(b[0],b[1]),e=l(d,X,Y);e||n(c,!0)}),_=[],b.forEach(function(a){var b;a.__color__&&(b=_.indexOf(a.__color__),b>=0?delete a.__color__:_.push(a.__color__))})}c._svg.transition().duration(cb).attr({width:V,height:W}),c._svg.select(".chart-group").attr("transform","translate("+L.left+","+L.top+")"),f.clip&&c._chartGroupClipPathRect.attr("width",X).attr("height",Y),cb=500})}function t(a,b){var c=a.__onFocusChangeLastFoci;if(!c||c.length!==b.length)return!0;for(var d,e,f=c.length-1;f>=0;f--)if(d=c[f],e=b[f],d.index!==e.index||d.point.x!==e.point.x||d.point.y!==e.point.y)return!0;return!1}function u(a,b,c){x(a,"__onFocusChangeListeners",b),c&&x(ab,"__onFocusChangeListeners",b)}function v(a,b,c){x(a,"__onChartMouseMoveListeners",b),c&&x(ab,"__onChartMouseMoveListeners",b)}function w(a,b){x(a,"__onChartMouseOutListeners",[]),b&&x(ab,"__onChartMouseOutListeners",[])}function x(a,b,c){if(a[b])for(var d,e=0,f=a[b],g=f.length;g>e;e++)d=f[e],d.apply(a,c)}function y(a,b,c,d){var e=c===!1||d===!1;if(!b)return!1;var f=void 0===c||c===!1?ab:c;if(!f[a]){if(e)return!1;f[a]=[]}if(e){var g=f[a];if(g){var h=g.indexOf(b);h>=0&&g.splice(h,1)}return!1}return f[a].push(b),!0}function z(){var a={chartWidth:X,chartHeight:Y};X=Math.max(0,V-L.left-L.right),Y=Math.max(0,W-L.top-L.bottom),e.resize&&console.log("chartBase.updateChartSize() chartWidth "+a.chartWidth+"->"+X+", chartHeight "+a.chartHeight+"->"+Y+" selection:"+!!R),(a.chartWidth!==X||a.chartHeight!==Y)&&(R&&s.callTraits(R),fb.chartResized())}function A(){var a={width:V,height:W};V=X+L.left+L.right,W=Y+L.top+L.bottom,(a.width!==V||a.height!==W)&&fb.chartResized()}function B(a){var b,c,d=N.length;for(b=0;d>b;b++)if(c=N[b],c.group===a)return c;return null}function C(a,b){var c,d=!1;if(a.length<=0)return d;switch(b){case"left":c=a[a.length-1].rect.maxX(),L.left<c&&(L.left=c,d=!0);break;case"right":c=V-a[0].rect.minX(),L.right<c&&(L.right=c,d=!0);break;case"top":c=a[a.length-1].rect.maxY(),L.top<c&&(L.top=c,d=!0);break;case"bottom":c=W-a[0].rect.minY(),L.bottom<c&&(L.bottom=c,d=!0)}return d}function D(a){var b=!1;return a.forEach(function(a){a.rect.minY()<L.top&&(a.rect.origin.y=L.top,b=!0)}),b}function E(a){var b=!1;return a.forEach(function(a){a.rect.minX()<L.left&&(a.rect.origin.x=L.left,b=!0)}),b}function F(a,b){var c=!1,d=0,e=0;if(a.length<=0)return c;switch(b){case"left":c=D(a),d=a[a.length-1].rect.maxX(),d<L.left&&(e=L.left-d,a.forEach(function(a){a.rect.origin.x+=e}),c=!0);break;case"right":c=D(a),d=a[0].rect.minX(),d>V-L.right&&(e=V-L.right-d,a.forEach(function(a){a.rect.origin.x+=e}),c=!0);break;case"top":c=E(a),d=a[a.length-1].rect.maxY(),d<L.top&&(e=L.top-d,a.forEach(function(a){a.rect.origin.y+=e}),c=!0);break;case"bottom":c=E(a),d=a[0].rect.minY(),d>W-L.bottom&&(e=W-L.bottom-d,a.forEach(function(a){a.rect.origin.y+=e}),c=!0)}return c}function G(b,c){switch(b){case"left":return new a.trait.Rect(0,0,c,0,1,0);case"right":return new a.trait.Rect(0,0,c,0);case"top":return new a.trait.Rect(0,0,0,c,0,1);case"bottom":return new a.trait.Rect(0,0,0,c);default:return new a.trait.Rect}}function H(){var b,c,d=!1,e=new a.trait.Rect(0,0,V,W),f=["left","right","top","bottom"],g={};f.forEach(function(c){b=N.filter(function(a){return a.orient===c}),a.trait.layout.byOrientation(b,e,c),d=d||C(b,c),g[c]=b});for(c in g)b=g[c],F(b,c);d&&z()}function I(){void 0!==bb.timer&&(clearTimeout(bb.timer),bb.timer=void 0)}function J(a,b){var c=Date.now();console.log("invalidateDoUpdate count: "+bb.count+", timeSince: "+(c-bb.lastTime)),bb.count=0,bb.lastTime=Date.now(),s.update(a,b)}function K(a){if(a.__color__)return a.__color__;for(var b,c=0;10>c&&(a.__color__=$(Z++),b=_.indexOf(a.__color__),!(0>b));)c++;return _.push(a.__color__),a.__color__}f||(f={}),f.seriesData||(f.seriesData=function(a){return a}),f.seriesLabel||(f.seriesLabel=function(a,b){return"Series "+b}),f.x1||(f.x1=function(a){return a[0]}),f.y1||(f.y1=function(a){return a[1]});var L=a.trait.utils.configMargin(f.margin,{top:5,right:5,bottom:5,left:5});f.clip=void 0===f.clip||f.clip===!0;var M={},N=[],O={left:0,right:0,top:0,bottom:0};if(f.minRangeMargin)for(var P in f.minRangeMargin)i(P,f.minRangeMargin[P]);var Q,R,S="cubic-in-out",T=!0,U=new a.trait.Size,V=200,W=100,X=V-L.left-L.right,Y=W-L.top-L.bottom,Z=0,$=j(),_=[],ab={},bb={lastTime:0,timer:void 0},cb=0,db="chartResized",eb="rangeMarginChanged",fb=a.dispatch(db,eb);return s.subscribeToEvents=function(a,b){return a?(b.forEach(function(b){var c;"onChartMouseMove"===b?c=function(){var a=arguments;R&&R.each(function(){var b=this,c=a[0];c.x=Math.min(c.x,X),c.y=Math.min(c.y,Y),m(b,c,!0,!1,L.left,L.top)})}:"onChartMouseOut"===b&&(c=function(){R&&R.each(function(){var a=this;n(a,!1)})}),c&&a[b](c)}),this):this},s.onFocusChange=function(a,b,c){return y("__onFocusChangeListeners",a,b,c)},s.onChartMouseMove=function(a,b,c){return y("__onChartMouseMoveListeners",a,b,c)},s.onChartMouseOut=function(a,b,c){return y("__onChartMouseOutListeners",a,b,c)},s.remove=function(){R.each(function(){var a=this;a._svg&&(a._svg.remove(),delete a._svg,delete a._svgDefs,delete a._container,delete a._chartGroup,delete a._chartGroupClipPath,delete a._chartGroupClipPathRect,delete a.__onFocusChangeListeners,delete a.__onChartMouseOutListeners)})},s.layoutAxis=function(a,b,c,d){var f=B(b),g=G(c,d);e.layoutAxes&&(console.log("layoutAxis( "+a+", "+c+", "+d+") BEGIN width:"+V+" height:"+W+" margin l:"+L.left+" r:"+L.right+" t:"+L.top+" b:"+L.bottom),N.forEach(function(a){console.log("   "+a.name+", "+a.orient+" origin:"+a.rect.origin.x+","+a.rect.origin.y+" size:"+a.rect.size.width+","+a.rect.size.height+" anchor:"+a.rect.anchor.x+","+a.rect.anchor.y)})),f?(f.orient!==c||f.rect.size!==g.size)&&(f.orient=c,f.rect=g,H()):(f={name:a,group:b,orient:c,rect:g},N.push(f),H()),e.layoutAxes&&(console.log("layoutAxis( "+a+", "+c+", "+d+") END   width:"+V+" height:"+W+" margin l:"+L.left+" r:"+L.right+" t:"+L.top+" b:"+L.bottom),N.forEach(function(a){console.log("   "+a.name+", "+a.orient+" origin:"+a.rect.origin.x+","+a.rect.origin.y+" size:"+a.rect.size.width+","+a.rect.size.height+" anchor:"+a.rect.anchor.x+","+a.rect.anchor.y)})),f.group.attr("transform","translate("+f.rect.origin.x+","+f.rect.origin.y+")")},s.getFocusItems=function(){return[]},s.update=function(){},s.invalidate=function(a,b){var c=Date.now();return"domain"===a?(I(),void J(a,b)):void(bb.timer?bb.count++:c-bb.lastTime>1e3?J(a,b):(bb.count=0,bb.timer=setTimeout(function(){bb.timer=void 0,J(a,b)},1e3)))},s.select=function(){return Q},s.color=function(a,b){switch(arguments.length){case 1:return K(a);case 3:return K(a);case 2:return a.__color__=b,this;default:return"black"}},s.size=function(a){return arguments.length?(T=!1,V=parseInt(a.width,10),W=parseInt(a.height,10),e.resize&&console.log("chartBase.size( weight="+V+", height="+W+")"),z(),this):V},s.width=function(a){return arguments.length?(T=!1,V=parseInt(a,10),e.resize&&console.log("chartBase.width( "+V+")"),z(),this):V},s.height=function(a){return arguments.length?(T=!1,W=parseInt(a,10),e.resize&&console.log("chartBase.height( "+W+")"),z(),cb=0,this):W},s.marginTop=function(a){return arguments.length?(L.top=a,z(),this):L.top},s.marginBottom=function(a){return arguments.length?(L.bottom=a,z(),this):L.bottom},s.marginLeft=function(a){return arguments.length?(L.left=a,z(),this):L.left},s.marginRight=function(a){return arguments.length?(L.right=a,z(),this):L.right},s.plusMarginTop=function(a){return L.top+=parseInt(a,10),z(),this},s.plusMarginBottom=function(a){return L.bottom+=parseInt(a,10),z(),this},s.plusMarginLeft=function(a){return L.left+=parseInt(a,10),z(),this},s.plusMarginRight=function(a){return L.right+=parseInt(a,10),z(),this},s.chartRect=function(){return new a.trait.Rect(L.left,L.top,X,Y)},s.chartWidth=function(a){return arguments.length?(X=parseInt(a,10),A(),this):X},s.chartHeight=function(a){return arguments.length?(Y=parseInt(a,10),A(),this):Y},s.ease=function(a){return arguments.length?(S=a,this):S},s.duration=function(a){return arguments.length?(cb=a,this):cb},s.onChartResized=function(a,b){var c=db;a&&a.length>0&&(c=c+"."+a),fb.on(c,function(){R&&R.call(b)})},s.minRangeMargin=i,s.isMinRangeMargin=h,s.minRangeMarginLeft=function(a,b){return arguments.length?1===arguments.length?M[a]?M[a].left:0:(g(a),M[a].left<b&&(M[a].left=b,fb.rangeMarginChanged()),this):0},s.minRangeMarginRight=function(a,b){return arguments.length?1===arguments.length?M[a]?M[a].right:0:(g(a),M[a].right<b&&(M[a].right=b,fb.rangeMarginChanged()),this):0},s.minRangeMarginTop=function(a,b){return arguments.length?1===arguments.length?M[a]?M[a].top:0:(g(a),M[a].top<b&&(M[a].top=b,fb.rangeMarginChanged()),this):0},s.minRangeMarginBottom=function(a,b){return arguments.length?1===arguments.length?M[a]?M[a].bottom:0:(g(a),M[a].bottom<b&&(M[a].bottom=b,fb.rangeMarginChanged()),this):0},s.onRangeMarginChanged=function(a,b){var c=eb;a&&a.length>0&&(c=c+"."+a),b?fb.on(c,function(){R&&R.call(b)}):fb.on(c)},s}var d=1,e={layoutAxes:!1,resize:!1};b.chart.base=c}(d3,d3.trait),function(a,b){function c(c,d){function e(b){var c=e;b.each(function(b){if(!h){var e=d.chartClass?"chart-line "+d.chartClass:"chart-line";h=this._chartGroup.append("g").classed(e,!0)}j=d.seriesFilter?b.filter(d.seriesFilter):b,i=h.selectAll(".series").data(j),i.selectAll("path").transition().duration(500).attr("d",function(a){return q(g(d.seriesData(a),n,d.x1))}),i.enter().append("g").attr("class","series").append("path").attr("class","line").attr("d",function(a){return q(d.seriesData(a))}).style("stroke",c.color),i.exit().transition().style({opacity:0}).remove(),a.trait.utils.isData(j,d.seriesData)&&(k=a.trait.utils.extentMax(n.domain()))})}function f(a,b,c,d,e,f){var g,h;for(void 0===e&&(e=0),void 0===f&&(f=a.length-1);f>=e;)if(g=Math.floor((e+f)/2),h=b(a[g]),c>h)e=g+1;else{if(!(h>c))return g;f=g-1}return 0>d?0>e+d?0:e+d:f+d>=a.length?a.length-1:f+d}function g(c,d,e){var g,h,i,j=d.range(),k=a.trait.utils.extentMax(j),l=d.invert(j[0]),m=d.invert(k);return i=b.murts.utils.getOrElse(c,d),g=f(i,e,l,-1),h=f(i,e,m,1,g,i.length-1),h++,i.slice(g,h)}var h,i,j,k,l=b.config.axes(d),m=b.config.accessorsXY(d,l),n=c[l.x](),o=c[l.y](),p=a.trait.focus.utils.makeConfig(d),q=a.svg.line().interpolate(d.interpolate||"linear").x(function(a){return n(m.x(a))}).y(function(a){return o(m.y(a))});return e.update=function(a,e){this._super(a,e);var f=void 0===e?c.duration():e,h=function(a){return q(g(d.seriesData(a),n,d.x1))};return k=b.chart.utils.updatePathWithTrend(a,f,n,i,h,k),this},e.getFocusItems=function(a){var c=this._super(a),d=b.focus.utils.getFocusItems(j,a,p,m,n,o,e.color);return c=c.concat(d)},e}b.chart.line=c}(d3,d3.trait),function(a,b){function c(a,b,c,d,e,f){return{x:function(c){return e(a.x(c))+b},y:function(b){return f(a.y(b))},width:c,height:function(b){return d-f(a.y(b))}}}function d(a,b,c){return{cx:function(c){return b(a.x(c))},cy:function(b){return c(a.y(b))},r:8}}function e(e,f){function g(b){var c=g;b.each(function(b){var e=this,g=f.seriesFilter?b.filter(f.seriesFilter):b;if(!h){var k=f.chartClass?"chart-scatter "+f.chartClass:"chart-scatter";h=this._chartGroup.append("g").classed(k,!0)}i=h.selectAll(".series").data(g),i.enter().append("g").attr("class","series").style("fill",c.color),j=i.selectAll(r).data(o.seriesData),j.transition().duration(500).delay(500).ease(c.ease()).attr(d(o,p,q)),j.enter().append(r).classed("scatter-point",!0).attr(d(o,p,q)).on("mouseover",function(a){return e._svg.append("text").text("data: "+o.y(a).toFixed(1)).attr("id","tooltip").attr("x",p(o.x(a))+10).attr("y",q(o.y(a))).attr("fill","black").attr("opacity",0).style("font-family","sans-serif").transition().attr("opacity",1)}).on("mouseout",function(){a.select(this).transition().duration(500).attr("fill","slateblue"),a.selectAll("#tooltip").transition().duration(500).attr("opacity",0).remove()}),j.exit().transition().style({opacity:0}).remove(),m=a.trait.utils.extentMax(p.domain())})}var h,i,j,k,l,m,n=b.config.axes(f),o=b.config.accessorsXY(f,n),p=e[n.x](),q=e[n.y](),r="circle",s=a.dispatch("customHover");return g.update=function(b,d){this._super(b,d);var f=a.trait.utils.extentMax(p.domain()),g=p(m)-p(f);return i.attr("transform",null),j.attr(c(o,l,k,e.chartHeight(),p,q)),j=i.selectAll("rect").data(o.seriesData),j.enter().append("rect").classed("bar",!0).attr(c(o,l,k,e.chartHeight(),p,q)),j.exit().transition().style({opacity:0}).remove(),0===d?i.attr("transform","translate("+g+")"):i.transition().duration(d||e.duration()).ease("linear").attr("transform","translate("+g+")"),m=a.trait.utils.extentMax(p.domain()),this},a.rebind(g,s,"on"),e.onRangeMarginChanged("chartScatter",g),g}b.chart.scatter=e}(d3,d3.trait),function(a,b){function c(b,c){function d(){var a=p.empty()?m.domain():p.extent();e(a,"domain",0)}function e(a,b,c){n[o+"Domain"](a),n.update(b,c)}function f(b){var d=f;b.each(function(){if(!i){var b="brush brush-"+k,e=c.chartClass?b+c.chartClass:b;i=this._chartGroup.append("g").classed(e,!0)}i.call(p),i.selectAll("rect").attr("y",-6).attr("height",d.chartHeight()+7),j=a.trait.utils.extentMax(m.domain())})}function g(b,c){var d={min:a.trait.utils.extentMin(b),max:a.trait.utils.extentMax(b)};if(d.max instanceof Date){var e=d.min.getTime(),f=d.max.getTime();d.isDate=!0,d.span=Math.abs(f-e),d.spanEpsilon=.025*d.span,d.isExtentMax=Math.abs(f-c.getTime())<d.spanEpsilon}else d.isDate=!1,d.span=Math.abs(d.max-d.min),d.spanEpsilon=.025*d.span,d.isExtentMax=Math.abs(d.max-c)<d.spanEpsilon;return d}function h(a,b){return b instanceof Date?new Date(b.getTime()-a.span):b-a.span}var i,j,k=c.axis,l=k.charAt(0),m=b[k](),n=c.target,o=c.targetAxis,p=(n[c.targetAxis](),a.svg.brush()[l](m));p.on("brush",d);var q=a.dispatch("customHover");return f.update=function(b,c){if(this._super(b,c),p.empty())d();else{var f=p.extent(),k=g(f,j);if(k.isExtentMax){var l=a.trait.utils.extentMax(m.domain()),n=h(k,l);p.extent([n,l])}else p.extent(f),f=p.extent();e(f,"trend",250)}return i.call(p),j=a.trait.utils.extentMax(m.domain()),this},a.rebind(f,q,"on"),f}b.control.brush=c}(d3,d3.trait),function(a,b){function c(b,c){function d(a){var c=b.chartHeight(),d=b.marginLeft(),e=b.marginTop();if(!a||a.x!==h){if(a){0===j.length&&(j[0]=[]);var k=j[0];k[0]=[a.x+d,e],k[1]=[a.x+d,c+e],h=a.x}else j.length>0&&j.splice(0,1),h=void 0;g=f.selectAll(".crosshair").data(j),g.enter().append("g").attr("class","crosshair").append("path").attr({"class":"line",d:function(a){return i(a)}}),g.selectAll("path").attr("d",function(a){return i(a)}),g.exit().style({opacity:0}).remove()}}function e(a){var b=e;a.each(function(){var a=this;f||(f=a._container.append("g").attr({"class":"crosshair-group"}),b.onChartMouseMove(d,a),b.onChartMouseOut(d,a))})}{var f,g,h,i=a.svg.line(),j=[];c.axis||"x1"}return e}b.focus.crosshair=c}(d3,d3.trait),function(a,b){function c(a,b){return"l"+a+","+b}function d(a,b,c,d){return"q"+a+","+b+" "+c+","+d}function e(a,b){return"m"+a+","+b}function f(a){return Math.max(.16*a,6)}function g(a,b,f,g,h,i){var j=h.x<.5?1:-1,k=Math.floor(b/2-g-f),l=2*k+2*g,m=Math.floor(a-f-f),n=e(0,0+i)+c(j*g*2,-g-i)+c(0,-k)+d(0,-f,j*f,-f)+c(j*m,0)+d(j*f,0,j*f,f)+c(0,l)+d(0,f,j*-f,f)+c(j*-m,0)+d(j*-f,0,j*-f,-f)+c(0,-k)+"z";return n}function h(a){a.forEach(function(a){a&&(a.remove=!0)})}function i(a){a.forEach(function(b,c){b&&b.remove&&(b.group.remove(),a[c]=null)})}function j(a){delete a.lastFoci,a.tooltips&&a.tooltips.forEach(function(b,c){b&&(b.group.remove(),a.tooltips[c]=null)})}function k(c,d,e){function k(c){var p=k;c.each(function(c){function k(e){if(e.length<=0)return void j(r);if(c.length<=0)return void console.error("tooltipDiscrete.focusChange foci.length="+e.length+" but _data.length="+c.length);var k=new b.Point(0,.5);h(r.tooltips),e.forEach(function(a){var e,g=c.indexOf(a.series),h=g>=0?r.tooltips[g]:null,i=o(d.x1(a.item)),j=d.y1(a.item);if(0>g)return void console.error("tooltipDiscrete.focusChange forci.forEach seriesIndex="+g+" but should have found a series.");d.formatY&&(j=d.formatY(j)),e=i+" "+j,h||(h={newby:!0},h.group=q._container.append("g").attr({id:"tooltip",opacity:0}),h.path=h.group.append("path").attr("fill","darkgray"),h.text=h.group.append("text").attr({"font-family":"monospace","font-size":10,fill:"black","text-rendering":"geometric-precision"}),r.tooltips[g]=h),h.remove=!1,h.text.text(e);var l=h.text.node().getBBox();l.height=2*l.height+2*n,l.width+=2*n+f(l.height),a.rect=new b.Rect(a.point,l,k)}),b.layout.verticalAnchorLeftRight(e,p.chartRect()),e.forEach(function(b){var d=c.indexOf(b.series),e=r.tooltips[d],h=a.rgb(b.color).darker(1.4).toString(),i=b.point.y-b.rect.origin.y,j=f(b.rect.size.height),k=g(b.rect.size.width,b.rect.size.height,m,j,b.rect.anchor,i),o=2*j+n+m,p=b.rect.anchor.x<.5?o:-b.rect.size.width-n-m;e.text.attr("transform","translate("+p+",0)"),e.newby?(e.group.attr("transform","translate("+b.rect.origin.x+","+b.rect.origin.y+")"),e.group.transition().attr("opacity",1)):e.group.transition().attr({opacity:1,transform:"translate("+b.rect.origin.x+","+b.rect.origin.y+")"}),e.path.transition().duration(l).attr({opacity:.72,fill:b.color,stroke:h,d:k}),e.newby=!1}),i(r.tooltips),r.lastFoci=e}if(0!==c.length){var q=this,r=b.utils.getTraitCache(q,e);r.tooltips=c.map(function(){return null}),p.onChartMouseOut(function(){j(r)},q),p.onFocusChange(k,q)}})}var l=(d.axis,b.utils.configFloat(d.transitionDuration,100)),m=6,n=3,o=d.formatX||q;return k}function l(a,b){if(!b)return a;var c=a.filter(function(a){return b(a.series)});return c}function m(a,c){this.config=a,this.group=c,this.rect=new b.Rect(0,0,0,0,0,.5),this.children=[],this.dirtyRows=[],this.radius=2,this.element=c.append("rect").attr({x:0,y:0,rx:this.radius,ry:this.radius})}function n(a,c,d){this.focusTable=a,this.focus=c,this.rect=new b.Rect,this.children=d,this.config=a.config,this.item=c.item,this.group=this.focusTable.group.append("g").attr({"class":"d3-trait-tooltip-row"}),this.setFocus(c)}function o(a){return a}function p(a,c){function d(a){var b=c.y1(a.item);return c.formatY&&(b=c.formatY(b)),b}function e(a,c,d){var e=8,f=c.x+d.origin.x,g=c.y+d.origin.y;a.rect.origin.x=f,a.rect.origin.y=g,a.rect.size.width+=e,b.layout.verticalAnchorLeftRight([a],d),a.rect.size.width-=e,a.rect.anchor.x<.5?a.rect.origin.x+=e:a.rect.origin.x-=e}function f(a,c){var d=a[0][0].getBBox(),e=c?c.x*d.width:0,f=0;return new b.Rect(e,f,d.width,d.height,c?c.x:0,0)}function g(a,b){var c=0===b?x.top+1:x.top+(x.top+x.bottom+1)*b+1;return c+"em"}function h(a,b){var c=0===b?x.top+.64:x.top+(x.top+x.bottom+1)*b+.64;return c+"em"}function i(a,b){var c=0,d=0,e=a.rect.size;return b>0&&(c=1===b?e.height/(1+x.top):e.height/(x.top+1+(x.top+x.bottom+1)*(b-1)),d=c*x.bottom,e.height+=d),c}function j(a,b){var c;return c=a.group.selectAll("text").data(b),c.enter().append("text").attr("y",g).attr("x",0).style("text-anchor",a.textAnchor).text(a.accessValue),c.text(a.accessValue),c.exit().remove(),a.rect=f(a.group,a.anchor),a.em=i(a,b.length),a.em}function k(a,b,c){var d;return d=a.group.selectAll("circle").data(b),d.enter().append("circle").attr("cy",h).attr("cx","0.5em").attr("r","0.4em").style("fill",function(a){return c(a.series)}),d.style("fill",function(a){return c(a.series)}),d.exit().remove(),a.rect=f(a.group,a.anchor),a.em=i(a,b.length),a.em}function m(a,b,c){var d,e=10;a.limit&&(b=b.slice(0,a.limit)),a.children.forEach(function(a){"text"===a.type?e=j(a,b):d=a}),d&&k(d,b,c)}function n(b,d,f){var g;b=b.reverse(),g=l(b,c.seriesFilter),v.children.forEach(function(a){m(a,g,f)}),C(v),e(v,d,a.chartRect()),u.attr("transform","translate("+v.rect.minX()+","+v.rect.minY()+")"),B.attr({x:.5,y:Math.round(v.em*-.25)+.5,rx:w,ry:w,width:Math.round(v.rect.size.width+.1*v.em),height:Math.round(v.rect.size.height+.25*v.em)}),u.style("opacity",1)}function p(a){a.children.forEach(function(a){a.group=u.append("g").classed(a.klass,!0),a.children.forEach(function(b){b.group=a.group.append("g").classed(b.klass,!0).attr("transform","translate(0,0)")})})}function q(a){function b(a,b){n(a,b,d.color)}function c(){u&&u.transition().duration(100).style("opacity",0)}var d=q;a.each(function(){var a=this;u||(u=a._container.append("g").attr({"class":"d3-trait-tooltip"}),B=u.append("rect").classed(D.box,!0),p(v),d.onFocusChange(b,a),d.onChartMouseOut(c,a))})}var u,v,w=(c.axis,b.utils.configFloat(c.transitionDuration,100),b.utils.configFloat(c.radius,3)),x=c.padding||new b.Margin(0,.6,.25),y=10,z=c.formatHeader||o,A=c.target;A&&!Array.isArray(A)&&(A=[A]);var B,C=b.layout.tilestack().paddingEm(x).translate(function(a,b,c){a.group.attr("transform","translate("+b+","+c+")")}),D={main:c["class"]||"d3-trait-tooltip"};return D.box=D.main+"-box",v={group:void 0,klass:D.main+"-table",layoutChildren:"TopToBottom",em:y,children:[{group:void 0,klass:D.main+"-header",limit:1,anchor:t,layoutChildren:"LeftToRight",em:y,children:[{type:"text",group:void 0,klass:D.main+"-header-td",anchor:r,textAnchor:"start",accessValue:function(a){return z(c.x1(a.item))},em:y}]},{group:void 0,klass:D.main+"-body",anchor:t,layoutChildren:"LeftToRight",em:y,children:[{type:"mark",group:void 0,klass:D.main+"-mark",anchor:s,textAnchor:"end",accessValue:d,em:y},{type:"text",group:void 0,klass:D.main+"-value",anchor:s,textAnchor:"end",accessValue:d,em:y},{type:"text",group:void 0,klass:D.main+"-label",anchor:r,textAnchor:"start",accessValue:function(a){return c.seriesLabel(a.series)},em:y}]}]},q}{var q=a.time.format("%Y-%m-%d"),r=new b.Point(0,1),s=new b.Point(1,1),t=(new b.Point(.5,1),new b.Point(0,0));new b.Point(0,.5),new b.Point(.5,.5)}m.prototype.addRow=function(a){var b=[{anchor:s,accessValue:function(a,b){return b.y1(a.item)},format:this.config.formatY},{anchor:r,accessValue:function(a,b){return b.seriesLabel(a.series)}}],c=new n(this,a,b);return this.children.push(c),c},m.prototype.getRow=function(a){return this.children[a]},m.prototype.rowCount=function(){return this.children.length},m.prototype.rowDirty=function(a){this.dirtyRows.push(a)},m.prototype.truncateRows=function(){},m.prototype.setHeaderRow=function(a){if(this.header)this.header.setFocus(a);else{var b=[{colspan:2,anchor:r,accessValue:function(a,b){return b.x1(a.item)},format:this.config.formatHeader}];this.header=new n(this,a,b),this.children.unshift(this.header)}return this.header},m.prototype.render=function(a,b,c){0!==this.dirtyRows.length&&(a(this),this.setOrigin(b,c),this.group.attr("transform","translate("+this.rect.minX()+","+this.rect.minY()+")"),this.renderTableBox(),this.children.forEach(function(a){a.render()}),this.dirtyRows=[])},m.prototype.setOrigin=function(a,c){var d=8,e=a.x+c.origin.x,f=a.y+c.origin.y;this.rect.origin.x=e,this.rect.origin.y=f,this.rect.size.width+=d,b.layout.verticalAnchorLeftRight([this],c),this.rect.size.width-=d,this.rect.anchor.x<.5?this.rect.origin.x+=d:this.rect.origin.x-=d},m.prototype.renderTableBox=function(){this.element.attr({width:this.rect.size.width,height:this.rect.size.height+2}),this.group.transition().style("opacity",1)},n.prototype.setFocus=function(a){var b=this,c=!1;return b.focus=a,b.item=a.item,b.children.forEach(function(a){a.element||(a.element=b.group.append("text"),a.anchor===s&&a.element.style("text-anchor","end")),c=c||b.setCol(a,a.accessValue,a.anchor,a.format)}),c&&b.focusTable.rowDirty(b),c},n.prototype.setCol=function(a,c,d,e){var f=a.accessValue(this.focus,this.config);return a.value&&a.value===f&&!a.rect&&console.error("how did we get here!"),a.value&&a.value===f?!1:(a.value=f,a.text=e?e(f):f,a.element.text(a.text),a.bbox=a.element.node().getBBox(),a.rect=new b.Rect(0,0,a.bbox.width,a.bbox.height,d.x,d.y),!0)},n.prototype.render=function(){var a=this.rect.origin;this.group.attr("transform","translate("+this.rect.minX()+","+this.rect.minY()+")"),this.children.forEach(function(b){a=b.rect.origin,b.element.attr("transform","translate("+a.x+","+a.y+")")})};({transition:{duration:100},radius:3,paddingEm:new b.Margin(0,.6,.25),offsetX:8,em:void 0,formatHeader:o,targets:void 0});b.focus.tooltip||(b.focus.tooltip={}),b.focus.tooltip.discrete=k,b.focus.tooltip.unified=p}(d3,d3.trait),function(a,b){function c(a){return a.children}var d=new b.Margin;b.layout.table=function(){function e(a,b,c){if(!(!a||0>b||b>100))for(;a.length<b;)a.push(c)}function f(a){var b=[],c=[];return a.forEach(function(a,d){var f=p.call(o,a,a.depth);e(b,f.length,0);var h=0;f.forEach(function(a,e){var f=e+h;if(a.colspan)c.push({node:a,row:d,col:f}),h+=a.colspan;else{var i=g(a,d,f);b[f]=b[f]?Math.max(b[f],i):i}})}),c.sort(function(a,b){return a.node.colspan-b.node.colspan}),c.forEach(function(a){var c=a.node,d=h(a.col,c.colspan,b),e=g(c,c.row,c.col);
  e>d&&i(e,d,a.col,c.colspan,b)}),b}function g(a,b,c){var d=q.get(a,b,c),e=d.left+a.rect.size.width+d.right;return e}function h(a,b,c){var d=0;for(b--;b>=0;b--)d+=c[a+b];return d}function i(a,b,c,d,e){var f=a-b,g=f/d,h=0;for(d--;d>=0;d--){var i=c+d;e[i]=Math.round(e[i]+g),h+=e[i]}a>h&&e[c]++}function j(a,b){a.depth=b;var c=p.call(o,a,b);c&&c.length>0&&(b++,c.forEach(function(a){j(a,b)}))}function k(a,b){var c=0,d=p.call(o,a,a.depth);return d.forEach(function(a,d){var e=q.get(a,b,d),f=e.top+a.rect.size.height+e.bottom;c=Math.max(c,f)}),c}function l(a,c,d,e){var f=q.get(a,c,d),g=r.get(a,c,d),h=s.get(a,c,d),i=new b.Point;return i.x="right"===g?e.maxX()-f.right:"center"===g?Math.round(e.midX()+(f.left-f.right)/2):e.minX()+f.left,i.y="top"===h?e.minY()+f.top:"middle"===h?Math.round(e.midY()+(f.top-f.bottom)/2):e.maxY()-f.bottom,i}function m(a,c,d){var e=p.call(o,a,a.depth),f=a.rect.size.height,g=0,h=0;e.forEach(function(a,e){var i=new b.Rect(g,h,d[e],f);a.rect.origin=l(a,c,e,i),g+=i.size.width}),a.rect.size.width=g}function n(a,b){function c(c,d,e){var f=b.call(o,c,c.depth,d,e);return null==f?a.getNull(c):a.expandConstantType&&typeof f===a.expandConstantType?a.expandConstant(f):f}function d(){return b}var e;a.get=null==(a.arg=b)?a.getNull:"function"==(e=typeof b)?c:a.expandConstantType&&e===a.expandConstantType?(b=a.expandConstant(b),d):d}function o(b){var c=b;j(c,0);var d=c.rect,e=p.call(o,c,c.depth),g=f(e),h=0;return e.forEach(function(a,b){var c=k(a,b);a.rect.origin.x=0,a.rect.origin.y=h,a.rect.size.height=c,m(a,b,g),h+=c}),d.size.width=a.sum(g),d.size.height=h-0,c}var p=c,q={arg:null,getNull:function(){return d},expandConstantType:"number",expandConstant:function(a){return new b.Margin(a)}},r={arg:"left",getNull:function(){return"left"}},s={arg:null,getNull:function(){return"bottom"}};return q.get=q.getNull,r.get=r.getNull,s.get=s.getNull,o.padding=function(a){return arguments.length?(n(q,a),o):q.arg},o.textAlign=function(a){return arguments.length?(n(r,a),o):r.arg},o.verticalAlign=function(a){return arguments.length?(n(s,a),o):s.arg},o.children=function(a){return arguments.length?(p=a,o):p},o.utils={setDepthOnNodes:j,calculateColWidths:f,calculateRowHeight:k,nodeOriginInCellRect:l,layoutRow:m},o}}(d3,d3.trait),function(a,b){var c=new b.Margin,d=function(){};b.layout.tilestack=function(){function a(d){var e=0,g=new b.Point;d.children.forEach(function(b){b.children&&a(b),g=f[d.layoutChildren](b,g,c),e+=b.em}),d.rect=new b.Rect(0,0,g.x,g.y);var h=d.children.length;d.em=0===h?0:e/h}function e(b){return a(b),b}var f={LeftToRight:function(a,b){var e=a.rect;return b.x+=c.left*a.em,e.anchor.x<.5?(e.origin.x=b.x,d(a,e.minX(),e.origin.y),b.x+=e.size.width):(b.x+=e.size.width,e.origin.x=b.x,d(a,e.maxX(),e.origin.y)),b.x+=c.right*a.em,b.y=Math.max(b.y,e.maxY()),b},TopToBottom:function(a,b){var e=a.rect;return b.y+=c.top*a.em,e.anchor.y<.5?(e.origin.y=b.y,d(a,e.origin.x,e.minY()),b.y+=e.size.height):(b.y+=e.size.height,e.origin.y=b.y,d(a,e.origin.x,e.maxY())),b.x=Math.max(b.x,e.maxX()),b.y+=c.bottom*a.em,b}};return e.paddingEm=function(a){return arguments.length?(c=a,e):c},e.translate=function(a){return arguments.length?(d=a,e):d},e.utils={pack:a},e.layouts=f,e}}(d3,d3.trait),function(a,b){function c(b,c){function d(){return"top"===g||"bottom"===g}function e(){var a,d={left:10,right:10};return c.legendMargin&&(d.left=c.legendMargin.left||d.left,d.right=c.legendMargin.right||d.right,d.top=c.legendMargin.top,d.bottom=c.legendMargin.bottom),d.left+=b.marginLeft(),d.right+=b.marginRight(),a="margin-left:"+d.left+"px;",a+="margin-right:"+d.right+"px;",d.top&&(a+="margin-top:"+d.top+"px;"),d.bottom&&(a+="margin-bottom:"+d.bottom+"px;"),a+="top:"+Math.max(0,b.marginTop()-5)+"px;"}function f(b){var h=f;b.each(function(b){if(!this._legend){var f=c.legendClass?"legend "+c.legendClass:"legend";if(d()){var i=a.select(this);this._legend="top"===g?i.insert("ul","svg"):i.append("ul"),this._legend.attr("style",e()).attr("class",f)}else this._legend=this._container.append("g").classed(f,!0)}var j=c.legendFilter?b.filter(c.legendFilter):b;if(d()){var k=this._legend.selectAll("li").data(j),l=k.enter().append("li").classed("legend-item",!0).style("border-bottom-color",h.color);l.append("span").classed("legend-mark",!0).style("background-color",h.color),l.append("span").text(c.seriesLabel)}else{var m=this._legend.selectAll(".legend").data(j);m.enter().append("g").attr("class","legend").attr("transform",function(a,b){return"translate(0,"+20*b+")"}),m.append("rect").attr("x",h.chartWidth()-18).attr("width",18).attr("height",18).style("fill",h.color),m.append("text").attr("x",h.chartWidth()-24).attr("y",9).attr("dy",".35em").style("text-anchor","end").text(c.seriesLabel)}})}var g=c.orient||"top",h=a.dispatch("customHover");return a.rebind(f,h,"on"),f}b.legend.series=c}(d3,d3.trait),function(a,b){function c(a,b){function c(i){var j=c;i.each(function(c){var i,k,l=this,m=a.marginLeft()+20,n=a.marginTop()+20;d||(d=l._container.append("g").attr({"class":h.main}),f=d.append("rect").classed(h.box,!0),e=d.append("g").classed(h.items,!0).attr("transform","translate("+m+","+n+")"));var o=b.legendFilter?c.filter(b.legendFilter):c;i=e.selectAll("."+h.item).data(o),k=i.enter(),k.append("text").classed(h.item,!0).attr("y",function(a,b){return b+"em"}).attr("x","1em").text(b.seriesLabel),k.append("circle").attr("cy",function(a,b){return b-.3+"em"}).attr("cx",0).attr("r","0.4em").style("fill",j.color),i.exit().remove();var p=e[0][0].getBBox();f.attr("x",Math.floor(m+p.x-g)+.5).attr("y",Math.floor(n+p.y-g)+.5).attr("height",Math.ceil(p.height+2*g)).attr("width",Math.ceil(p.width+2*g))})}var d,e,f,g=5,h={main:b["class"]||"d3-trait-legend"};return h.box=h.main+"-box",h.items=h.main+"-items",h.item=h.main+"-item",c}b.legend.standard=c}(d3,d3.trait),function(a,b){function c(a){return o.indexOf(a)>=0}function d(a,c,d){return{series:a.seriesData,data:function(a){return b.murts.utils.getOrElse(a,d)},value:a[c],scaleName:c,axisChar:c.charAt(0),scale:d}}function e(b){var c=a.trait.utils.configFloat(b.domainMin,null),d=a.trait.utils.configFloat(b.domainMax,null),e={trend:b.trend,padding:a.trait.utils.configFloat(b.domainPadding,0)};return null!==c&&null!==d?e.domain=[c,d]:null!==c||null!=d?(e.domainMin=c,e.domainMax=d):e.domain=b.domain,e}function f(a,b){var d,e=b.count||1;return d=c(b.interval)?b.interval.offset(a,0-e):a instanceof Date?a.getTime()-b.interval*e:a-b.interval*e}function g(a,c,d,e){var g,h,i;return a.track===n?(h=new Date,g=f(h,a.domain),i=[g,h]):a.domain&&a.domain.interval?(h=b.utils.maxFromData(c,d),g=f(h,a.domain),i=[g,h]):i=b.utils.extentFromData(c,d,e),i}function h(a,c,d,e){return c.domain?c.domain:c.minDomainFromData?(b.utils.isExtentExtended(a,c.minDomainFromData)&&(a=b.utils.extendExtent(a,c.minDomainFromData)),a):(d=b.murts.utils.getOrElse(d),a=c.trend?g(c,d,e,c.padding):null!=c.domainMin?[c.domainMin,b.utils.maxFromData(d,e)]:null!=c.domainMax?[b.utils.minFromData(d,e),c.domainMax]:b.utils.extentFromData(d,e,c.padding))}function i(a,c,d,e,g){var h,i,j,k,l,m;if(a.range(c),d.domain)return void a.domain(d.domain);if(k=a.domain(),l=k[k.length-1],d.trend){var o=d.trend;o.track===n?(i=new Date,h=f(i,o.domain),a.domain([h,i])):o.domain&&o.domain.interval?(i=b.utils.maxFromData(e,g),h=f(l,o.domain),a.domain([h,l]),m=a(i),h=f(i,o.domain),a.domain([h,i]),a.range([c[0],m])):(j=b.utils.extentFromData(e,g,d.padding),a.domain(j))}else j=b.utils.extentFromData(e,g,d.padding),a.domain(j)}function j(b,c){function d(a){var b=d;a.each(function(a){var d;e=c.seriesFilter?a.filter(c.seriesFilter):a;var f="x"===g?b.chartWidth():b.chartHeight();i.rangeRoundBands([0,f],.1),d=e[0].map(h),i.domain(d)})}var e,f=c.axis,g=f.charAt(0),h=c[f],i=a.scale.ordinal();return d[f]=function(){return i},d}function k(b,c){function f(b){var d=f;b.each(function(b){g=c.seriesFilter?b.filter(c.seriesFilter):b,k.domain(h(k.domain(),m,g,l)),c.nice&&k.nice(c.nice),k.range(a.trait.utils.getScaleRange(d,j))})}var g,j=c.axis,k=(j.charAt(0),a.time.scale()),l=d(c,j,k),m=e(c);return b.minRangeMargin(j,c.minRangeMargin),f[j]=function(){return k},f[j+"Domain"]=function(a){m.domain=a,k.domain(a)},f.update=function(c,d){this._super(c,d);var e=a.trait.utils.getScaleRange(b,j);return i(k,e,m,g,l),this},b.onRangeMarginChanged("scaleTime-"+j,f),f}function l(c,f){function g(b){var c=g;b.each(function(b){j=f.seriesFilter?b.filter(f.seriesFilter):b;var d=h(l.domain(),o,j,n);l.domain(d);var e=a.trait.utils.getScaleRange(c,k);l.range(e),m&&console.log("scaleLinear.each "+k+" range:"+e+" domain:"+d)})}var j,k=f.axis,l=(k.charAt(0),a.scale.linear()),n=d(f,k,l),o=e(f);return c.minRangeMargin(f.axis,f.minRangeMargin),g[k]=function(){return l},g[k+"Domain"]=function(a){o.domain=a,l.domain(a)},g[k+"MinDomainExtent"]=function(a){if(!arguments.length)return o.minDomain;if(b.utils.isExtentExtended(o.minDomain,a)){o.minDomain=b.utils.extendExtent(o.minDomain,a);var c=l.domain();b.utils.isExtentExtended(c,o.minDomain)&&(c=b.utils.extendExtent(c,o.minDomain),l.domain(c))}},g[k+"MinDomainExtentFromData"]=function(a){if(!arguments.length)return o.minDomainFromData;if(b.utils.isExtentExtended(o.minDomainFromData,a)){o.minDomainFromData=b.utils.extendExtent(o.minDomainFromData,a);var c=l.domain();b.utils.isExtentExtended(c,o.minDomainFromData)&&(c=b.utils.extendExtent(c,o.minDomainFromData),l.domain(c))}},g.update=function(b,d){this._super(b,d);var e=a.trait.utils.getScaleRange(c,k);return m&&console.log("scaleLinear.update1 "+k+" range:"+e+" domain:"+l.domain()),delete o.minDomainFromData,i(l,e,o,j,n),m&&console.log("scaleLinear.update2 "+k+" range:"+e+" domain:"+l.domain()),this},c.onRangeMarginChanged("scaleLinear-"+k,g),g}var m=!1,n="current-time",o=[a.time.second,a.time.minute,a.time.hour,a.time.day,a.time.week,a.time.month,a.time.year];b.scale.ordinal||(b.scale.ordinal={}),b.scale.linear=l,b.scale.ordinal.bars=j,b.scale.time=k}(d3,d3.trait);