=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,c,h,d,f=-1,p=o.length,m=a[u++],g=new s;++f=a.length)return e;var n=[],i=o[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),i?n.sort(function(e,t){return i(e.key,t.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(t,r){return e(r,t,0)},i.entries=function(r){return t(e(Ka.map,r,0),0)},i.key=function(e){return a.push(e),i},i.sortKeys=function(e){return o[a.length-1]=e,i},i.sortValues=function(e){return r=e,i},i.rollup=function(e){return n=e,i},i},Ka.set=function(e){var t=new m;if(e)for(var r=0,n=e.length;n>r;++r)t.add(e[r]);return t},o(m,{has:c,add:function(e){return this._[u(e+="")]=!0,e},remove:h,values:d,size:f,empty:p,forEach:function(e){for(var t in this._)e.call(this,l(t))}}),Ka.behavior={},Ka.rebind=function(e,t){for(var r,n=1,i=arguments.length;++n=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},Ka.event=null,Ka.requote=function(e){return e.replace(fo,"\\$&")};var fo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,po={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]},mo=function(e,t){return t.querySelector(e)},go=function(e,t){return t.querySelectorAll(e)},vo=Za.matches||Za[v(Za,"matchesSelector")],yo=function(e,t){return vo.call(e,t)};"function"==typeof Sizzle&&(mo=function(e,t){return Sizzle(e,t)[0]||null},go=Sizzle,yo=Sizzle.matchesSelector),Ka.selection=function(){return wo};var bo=Ka.selection.prototype=[];bo.select=function(e){var t,r,n,i,a=[];e=E(e);for(var o=-1,s=this.length;++o=0&&(r=e.slice(0,t),e=e.slice(t+1)),_o.hasOwnProperty(r)?{space:_o[r],local:e}:e}},bo.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node();return e=Ka.ns.qualify(e),e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}for(t in e)this.each(S(t,e[t]));return this}return this.each(S(e,t))},bo.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=R(e)).length,i=-1;if(t=r.classList){for(;++in){if("string"!=typeof e){2>n&&(t="");for(r in e)this.each(P(r,e[r],t));return this}if(2>n)return Ja.getComputedStyle(this.node(),null).getPropertyValue(e);r=""}return this.each(P(e,t,r))},bo.property=function(e,t){if(arguments.length<2){if("string"==typeof e)return this.node()[e];for(t in e)this.each(L(t,e[t]));return this}return this.each(L(e,t))},bo.text=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}:null==e?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},bo.html=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}:null==e?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},bo.append=function(e){return e=D(e),this.select(function(){return this.appendChild(e.apply(this,arguments))})},bo.insert=function(e,t){return e=D(e),t=E(t),this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})},bo.remove=function(){return this.each(function(){var e=this.parentNode;e&&e.removeChild(this)})},bo.data=function(e,t){function r(e,r){var n,i,a,o=e.length,h=r.length,d=Math.min(o,h),f=new Array(h),p=new Array(h),m=new Array(o);if(t){var g,v=new s,y=new Array(o);for(n=-1;++nn;++n)p[n]=F(r[n]);for(;o>n;++n)m[n]=e[n]}p.update=f,p.parentNode=f.parentNode=m.parentNode=e.parentNode,u.push(p),l.push(f),c.push(m)}var n,i,a=-1,o=this.length;if(!arguments.length){for(e=new Array(o=(n=this[0]).length);++aa;a++){i.push(t=[]),t.parentNode=(r=this[a]).parentNode;for(var s=0,u=r.length;u>s;s++)(n=r[s])&&e.call(n,n.__data__,s,a)&&t.push(n)}return T(i)},bo.order=function(){for(var e=-1,t=this.length;++e=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},bo.sort=function(e){e=j.apply(this,arguments);for(var t=-1,r=this.length;++te;e++)for(var r=this[e],n=0,i=r.length;i>n;n++){var a=r[n];if(a)return a}return null},bo.size=function(){var e=0;return z(this,function(){++e}),e};var xo=[];Ka.selection.enter=V,Ka.selection.enter.prototype=xo,xo.append=bo.append,xo.empty=bo.empty,xo.node=bo.node,xo.call=bo.call,xo.size=bo.size,xo.select=function(e){for(var t,r,n,i,a,o=[],s=-1,u=this.length;++sn){if("string"!=typeof e){2>n&&(t=!1);for(r in e)this.each(q(r,e[r],t));return this}if(2>n)return(n=this.node()["__on"+e])&&n._;r=!1}return this.each(q(e,t,r))};var Co=Ka.map({mouseenter:"mouseover",mouseleave:"mouseout"});Co.forEach(function(e){"on"+e in Qa&&Co.remove(e)});var To="onselectstart"in Qa?null:v(Za.style,"userSelect"),Eo=0;Ka.mouse=function(e){return Y(e,w())};var Ao=/WebKit/.test(Ja.navigator.userAgent)?-1:0;Ka.touch=function(e,t,r){if(arguments.length<3&&(r=t,t=w().changedTouches),t)for(var n,i=0,a=t.length;a>i;++i)if((n=t[i]).identifier===r)return Y(e,n)},Ka.behavior.drag=function(){function e(){this.on("mousedown.drag",i).on("touchstart.drag",a)}function t(e,t,i,a,o){return function(){function s(){var e,r,n=t(d,m);n&&(e=n[0]-b[0],r=n[1]-b[1],p|=e|r,b=n,f({type:"drag",x:n[0]+l[0],y:n[1]+l[1],dx:e,dy:r}))}function u(){t(d,m)&&(v.on(a+g,null).on(o+g,null),y(p&&Ka.event.target===h),f({type:"dragend"}))}var l,c=this,h=Ka.event.target,d=c.parentNode,f=r.of(c,arguments),p=0,m=e(),g=".drag"+(null==m?"":"-"+m),v=Ka.select(i()).on(a+g,s).on(o+g,u),y=X(),b=t(d,m);n?(l=n.apply(c,arguments),l=[l.x-b[0],l.y-b[1]]):l=[0,0],f({type:"dragstart"})}}var r=C(e,"drag","dragstart","dragend"),n=null,i=t(y,Ka.mouse,G,"mousemove","mouseup"),a=t(K,Ka.touch,$,"touchmove","touchend");return e.origin=function(t){return arguments.length?(n=t,e):n},Ka.rebind(e,r,"on")},Ka.touches=function(e,t){return arguments.length<2&&(t=w().touches),t?Ga(t).map(function(t){var r=Y(e,t);return r.identifier=t.identifier,r}):[]};var So=Math.PI,ko=2*So,Mo=So/2,Ro=1e-6,Oo=Ro*Ro,No=So/180,Po=180/So,Lo=Math.SQRT2,Do=2,Fo=4;Ka.interpolateZoom=function(e,t){function r(e){var t=e*y;if(v){var r=re(m),o=a/(Do*d)*(r*ne(Lo*t+m)-te(m));return[n+o*l,i+o*c,a*r/re(Lo*t+m)]}return[n+e*l,i+e*c,a*Math.exp(Lo*t)]}var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2],l=o-n,c=s-i,h=l*l+c*c,d=Math.sqrt(h),f=(u*u-a*a+Fo*h)/(2*a*Do*d),p=(u*u-a*a-Fo*h)/(2*u*Do*d),m=Math.log(Math.sqrt(f*f+1)-f),g=Math.log(Math.sqrt(p*p+1)-p),v=g-m,y=(v||Math.log(u/a))/Lo;return r.duration=1e3*y,r},Ka.behavior.zoom=function(){function e(e){e.on(S,l).on(zo+".zoom",h).on("dblclick.zoom",d).on(R,c)}function t(e){return[(e[0]-T.x)/T.k,(e[1]-T.y)/T.k]}function r(e){return[e[0]*T.k+T.x,e[1]*T.k+T.y]}function n(e){T.k=Math.max(A[0],Math.min(A[1],e))}function i(e,t){t=r(t),T.x+=e[0]-t[0],T.y+=e[1]-t[1]}function a(){b&&b.domain(y.range().map(function(e){return(e-T.x)/T.k}).map(y.invert)),w&&w.domain(_.range().map(function(e){return(e-T.y)/T.k}).map(_.invert))}function o(e){e({type:"zoomstart"})}function s(e){a(),e({type:"zoom",scale:T.k,translate:[T.x,T.y]})}function u(e){e({type:"zoomend"})}function l(){function e(){c=1,i(Ka.mouse(n),d),s(l)}function r(){h.on(k,null).on(M,null),f(c&&Ka.event.target===a),u(l)}var n=this,a=Ka.event.target,l=O.of(n,arguments),c=0,h=Ka.select(Ja).on(k,e).on(M,r),d=t(Ka.mouse(n)),f=X();H.call(n),o(l)}function c(){function e(){var e=Ka.touches(f);return d=T.k,e.forEach(function(e){e.identifier in m&&(m[e.identifier]=t(e))}),e}function r(){var t=Ka.event.target;Ka.select(t).on(b,a).on(_,h),w.push(t);for(var r=Ka.event.changedTouches,o=0,u=r.length;u>o;++o)m[r[o].identifier]=null;var l=e(),c=Date.now();if(1===l.length){if(500>c-v){var d=l[0],f=m[d.identifier];n(2*T.k),i(d,f),x(),s(p)}v=c}else if(l.length>1){var d=l[0],y=l[1],C=d[0]-y[0],E=d[1]-y[1];g=C*C+E*E}}function a(){for(var e,t,r,a,o=Ka.touches(f),u=0,l=o.length;l>u;++u,a=null)if(r=o[u],a=m[r.identifier]){if(t)break;e=r,t=a}if(a){var c=(c=r[0]-e[0])*c+(c=r[1]-e[1])*c,h=g&&Math.sqrt(c/g);e=[(e[0]+r[0])/2,(e[1]+r[1])/2],t=[(t[0]+a[0])/2,(t[1]+a[1])/2],n(h*d)}v=null,i(e,t),s(p)}function h(){if(Ka.event.touches.length){for(var t=Ka.event.changedTouches,r=0,n=t.length;n>r;++r)delete m[t[r].identifier];for(var i in m)return void e()}Ka.selectAll(w).on(y,null),C.on(S,l).on(R,c),E(),u(p)}var d,f=this,p=O.of(f,arguments),m={},g=0,y=".zoom-"+Ka.event.changedTouches[0].identifier,b="touchmove"+y,_="touchend"+y,w=[],C=Ka.select(f),E=X();H.call(f),r(),o(p),C.on(S,null).on(R,r)}function h(){var e=O.of(this,arguments);g?clearTimeout(g):(f=t(p=m||Ka.mouse(this)),H.call(this),o(e)),g=setTimeout(function(){g=null,u(e)},50),x(),n(Math.pow(2,.002*Io())*T.k),i(p,f),s(e)}function d(){var e=O.of(this,arguments),r=Ka.mouse(this),a=t(r),l=Math.log(T.k)/Math.LN2;o(e),n(Math.pow(2,Ka.event.shiftKey?Math.ceil(l)-1:Math.floor(l)+1)),i(r,a),s(e),u(e)}var f,p,m,g,v,y,b,_,w,T={x:0,y:0,k:1},E=[960,500],A=jo,S="mousedown.zoom",k="mousemove.zoom",M="mouseup.zoom",R="touchstart.zoom",O=C(e,"zoomstart","zoom","zoomend");return e.event=function(e){e.each(function(){var e=O.of(this,arguments),t=T;Mu?Ka.select(this).transition().each("start.zoom",function(){T=this.__chart__||{x:0,y:0,k:1},o(e)}).tween("zoom:zoom",function(){var r=E[0],n=E[1],i=r/2,a=n/2,o=Ka.interpolateZoom([(i-T.x)/T.k,(a-T.y)/T.k,r/T.k],[(i-t.x)/t.k,(a-t.y)/t.k,r/t.k]);return function(t){var n=o(t),u=r/n[2];this.__chart__=T={x:i-n[0]*u,y:a-n[1]*u,k:u},s(e)}}).each("end.zoom",function(){u(e)}):(this.__chart__=T,o(e),s(e),u(e))})},e.translate=function(t){return arguments.length?(T={x:+t[0],y:+t[1],k:T.k},a(),e):[T.x,T.y]},e.scale=function(t){return arguments.length?(T={x:T.x,y:T.y,k:+t},a(),e):T.k},e.scaleExtent=function(t){return arguments.length?(A=null==t?jo:[+t[0],+t[1]],e):A},e.center=function(t){return arguments.length?(m=t&&[+t[0],+t[1]],e):m},e.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],e):E},e.x=function(t){return arguments.length?(b=t,y=t.copy(),T={x:0,y:0,k:1},e):b},e.y=function(t){return arguments.length?(w=t,_=t.copy(),T={x:0,y:0,k:1},e):w},Ka.rebind(e,O,"on")};var Io,jo=[0,1/0],zo="onwheel"in Qa?(Io=function(){return-Ka.event.deltaY*(Ka.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Qa?(Io=function(){return Ka.event.wheelDelta},"mousewheel"):(Io=function(){return-Ka.event.detail},"MozMousePixelScroll");Ka.color=ae,ae.prototype.toString=function(){return this.rgb()+""},Ka.hsl=oe;var Vo=oe.prototype=new ae;Vo.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new oe(this.h,this.s,this.l/e)},Vo.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new oe(this.h,this.s,e*this.l)},Vo.rgb=function(){return se(this.h,this.s,this.l)},Ka.hcl=ue;var Bo=ue.prototype=new ae;Bo.brighter=function(e){return new ue(this.h,this.c,Math.min(100,this.l+Ho*(arguments.length?e:1)))},Bo.darker=function(e){return new ue(this.h,this.c,Math.max(0,this.l-Ho*(arguments.length?e:1)))},Bo.rgb=function(){return le(this.h,this.c,this.l).rgb()},Ka.lab=ce;var Ho=18,qo=.95047,Uo=1,Wo=1.08883,Xo=ce.prototype=new ae;Xo.brighter=function(e){return new ce(Math.min(100,this.l+Ho*(arguments.length?e:1)),this.a,this.b)},Xo.darker=function(e){return new ce(Math.max(0,this.l-Ho*(arguments.length?e:1)),this.a,this.b)},Xo.rgb=function(){return he(this.l,this.a,this.b)},Ka.rgb=ge;var Yo=ge.prototype=new ae;Yo.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,i=30;return t||r||n?(t&&i>t&&(t=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new ge(Math.min(255,t/e),Math.min(255,r/e),Math.min(255,n/e))):new ge(i,i,i)},Yo.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new ge(e*this.r,e*this.g,e*this.b)},Yo.hsl=function(){return xe(this.r,this.g,this.b)},Yo.toString=function(){return"#"+be(this.r)+be(this.g)+be(this.b)};var Ko=Ka.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Ko.forEach(function(e,t){Ko.set(e,ve(t))}),Ka.functor=Ee,Ka.xhr=Se(Ae),Ka.dsv=function(e,t){function r(e,r,a){arguments.length<3&&(a=r,r=null);var o=ke(e,t,null==r?n:i(r),a);return o.row=function(e){return arguments.length?o.response(null==(r=e)?n:i(e)):r},o}function n(e){return r.parse(e.responseText)}function i(e){return function(t){return r.parse(t.responseText,e)}}function a(t){return t.map(o).join(e)}function o(e){return s.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return r.parse=function(e,t){var n;return r.parseRows(e,function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");n=t?function(e,r){return t(i(e),r)}:i})},r.parseRows=function(e,t){function r(){if(c>=l)return o;if(i)return i=!1,a;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++c;){var n=e.charCodeAt(c++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===e.charCodeAt(c)&&(++c,++s);else if(n!==u)continue;return e.slice(t,c-s)}return e.slice(t)}for(var n,i,a={},o={},s=[],l=e.length,c=0,h=0;(n=r())!==o;){for(var d=[];n!==a&&n!==o;)d.push(n),n=r();t&&null==(d=t(d,h++))||s.push(d)}return s},r.format=function(t){if(Array.isArray(t[0]))return r.formatRows(t);var n=new m,i=[];return t.forEach(function(e){for(var t in e)n.has(t)||i.push(n.add(t))}),[i.map(o).join(e)].concat(t.map(function(t){return i.map(function(e){return o(t[e])}).join(e)})).join("\n")},r.formatRows=function(e){return e.map(a).join("\n")},r},Ka.csv=Ka.dsv(",","text/csv"),Ka.tsv=Ka.dsv(" ","text/tab-separated-values");var $o,Go,Qo,Zo,Jo,es=Ja[v(Ja,"requestAnimationFrame")]||function(e){setTimeout(e,17)};Ka.timer=function(e,t,r){var n=arguments.length;2>n&&(t=0),3>n&&(r=Date.now());var i=r+t,a={c:e,t:i,f:!1,n:null};Go?Go.n=a:$o=a,Go=a,Qo||(Zo=clearTimeout(Zo),Qo=1,es(Oe))},Ka.timer.flush=function(){Ne(),Pe()},Ka.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};var ts=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(De);Ka.formatPrefix=function(e,t){var r=0;return e&&(0>e&&(e*=-1),t&&(e=Ka.round(e,Le(e,t))),r=1+Math.floor(1e-12+Math.log(e)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),ts[8+r/3]};var rs=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ns=Ka.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=Ka.round(e,Le(e,t))).toFixed(Math.max(0,Math.min(20,Le(e*(1+1e-15),t))))}}),is=Ka.time={},as=Date;je.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){os.setUTCDate.apply(this._,arguments)},setDay:function(){os.setUTCDay.apply(this._,arguments)},setFullYear:function(){os.setUTCFullYear.apply(this._,arguments)},setHours:function(){os.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){os.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){os.setUTCMinutes.apply(this._,arguments)},setMonth:function(){os.setUTCMonth.apply(this._,arguments)},setSeconds:function(){os.setUTCSeconds.apply(this._,arguments)},setTime:function(){os.setTime.apply(this._,arguments)}};var os=Date.prototype;is.year=ze(function(e){return e=is.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),is.years=is.year.range,is.years.utc=is.year.utc.range,is.day=ze(function(e){var t=new as(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),is.days=is.day.range,is.days.utc=is.day.utc.range,is.dayOfYear=function(e){var t=is.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(e,t){t=7-t;var r=is[e]=ze(function(e){return(e=is.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+7*Math.floor(t))},function(e){var r=is.year(e).getDay();return Math.floor((is.dayOfYear(e)+(r+t)%7)/7)-(r!==t)});is[e+"s"]=r.range,is[e+"s"].utc=r.utc.range,is[e+"OfYear"]=function(e){var r=is.year(e).getDay();return Math.floor((is.dayOfYear(e)+(r+t)%7)/7)}}),is.week=is.sunday,is.weeks=is.sunday.range,is.weeks.utc=is.sunday.utc.range,is.weekOfYear=is.sundayOfYear;var ss={"-":"",_:" ",0:"0"},us=/^\s*\d+/,ls=/^%/;Ka.locale=function(e){return{numberFormat:Fe(e),timeFormat:Be(e)}};var cs=Ka.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Ka.format=cs.numberFormat,Ka.geo={},ut.prototype={s:0,t:0,add:function(e){lt(e,this.t,hs),lt(hs.s,this.s,this),this.s?this.t+=hs.t:this.s=hs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var hs=new ut;Ka.geo.stream=function(e,t){e&&ds.hasOwnProperty(e.type)?ds[e.type](e,t):ct(e,t)};var ds={Feature:function(e,t){ct(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++ne?4*So+e:e,gs.lineStart=gs.lineEnd=gs.point=y}};Ka.geo.bounds=function(){function e(e,t){b.push(_=[c=e,d=e]),h>t&&(h=t),t>f&&(f=t)}function t(t,r){var n=pt([t*No,r*No]);if(v){var i=gt(v,n),a=[i[1],-i[0],0],o=gt(a,i);bt(o),o=_t(o);var u=t-p,l=u>0?1:-1,m=o[0]*Po*l,g=uo(u)>180;if(g^(m>l*p&&l*t>m)){var y=o[1]*Po;y>f&&(f=y)}else if(m=(m+360)%360-180,g^(m>l*p&&l*t>m)){var y=-o[1]*Po;h>y&&(h=y)}else h>r&&(h=r),r>f&&(f=r);g?p>t?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t):d>=c?(c>t&&(c=t),t>d&&(d=t)):t>p?s(c,t)>s(c,d)&&(d=t):s(t,d)>s(c,d)&&(c=t)}else e(t,r);v=n,p=t}function r(){x.point=t}function n(){_[0]=c,_[1]=d,x.point=e,v=null}function i(e,r){if(v){var n=e-p;y+=uo(n)>180?n+(n>0?360:-360):n}else m=e,g=r;gs.point(e,r),t(e,r)}function a(){gs.lineStart()}function o(){i(m,g),gs.lineEnd(),uo(y)>Ro&&(c=-(d=180)),_[0]=c,_[1]=d,v=null}function s(e,t){return(t-=e)<0?t+360:t}function u(e,t){return e[0]-t[0]}function l(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ems?(c=-(d=180),h=-(f=90)):y>Ro?f=90:-Ro>y&&(h=-90),_[0]=c,_[1]=d}};return function(e){f=d=-(c=h=1/0),b=[],Ka.geo.stream(e,x);var t=b.length;if(t){b.sort(u);for(var r,n=1,i=b[0],a=[i];t>n;++n)r=b[n],l(r[0],i)||l(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(var o,r,p=-1/0,t=a.length-1,n=0,i=a[t];t>=n;i=r,++n)r=a[n],(o=s(i[1],r[0]))>p&&(p=o,c=r[0],d=i[1])}return b=_=null,1/0===c||1/0===h?[[NaN,NaN],[NaN,NaN]]:[[c,h],[d,f]]}}(),Ka.geo.centroid=function(e){vs=ys=bs=_s=xs=ws=Cs=Ts=Es=As=Ss=0,Ka.geo.stream(e,ks);var t=Es,r=As,n=Ss,i=t*t+r*r+n*n;return Oo>i&&(t=ws,r=Cs,n=Ts,Ro>ys&&(t=bs,r=_s,n=xs),i=t*t+r*r+n*n,Oo>i)?[NaN,NaN]:[Math.atan2(r,t)*Po,ee(n/Math.sqrt(i))*Po]};var vs,ys,bs,_s,xs,ws,Cs,Ts,Es,As,Ss,ks={sphere:y,point:wt,lineStart:Tt,lineEnd:Et,polygonStart:function(){ks.lineStart=At},polygonEnd:function(){ks.lineStart=Tt}},Ms=Ot(St,Dt,It,[-So,-So/2]),Rs=1e9;Ka.geo.clipExtent=function(){var e,t,r,n,i,a,o={stream:function(e){return i&&(i.valid=!1),i=a(e),i.valid=!0,i},extent:function(s){return arguments.length?(a=Bt(e=+s[0][0],t=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(Ka.geo.conicEqualArea=function(){return qt(Ut)}).raw=Ut,Ka.geo.albers=function(){return Ka.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Ka.geo.albersUsa=function(){function e(e){var a=e[0],o=e[1];return t=null,r(a,o),t||(n(a,o),t)||i(a,o),t}var t,r,n,i,a=Ka.geo.albers(),o=Ka.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Ka.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,r){t=[e,r]}};return e.invert=function(e){var t=a.scale(),r=a.translate(),n=(e[0]-r[0])/t,i=(e[1]-r[1])/t;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?o:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:a).invert(e)},e.stream=function(e){var t=a.stream(e),r=o.stream(e),n=s.stream(e);return{point:function(e,i){t.point(e,i),r.point(e,i),n.point(e,i)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},e.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),e):a.precision()},e.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),e.translate(a.translate())):a.scale()},e.translate=function(t){if(!arguments.length)return a.translate();var l=a.scale(),c=+t[0],h=+t[1];return r=a.translate(t).clipExtent([[c-.455*l,h-.238*l],[c+.455*l,h+.238*l]]).stream(u).point,n=o.translate([c-.307*l,h+.201*l]).clipExtent([[c-.425*l+Ro,h+.12*l+Ro],[c-.214*l-Ro,h+.234*l-Ro]]).stream(u).point,i=s.translate([c-.205*l,h+.212*l]).clipExtent([[c-.214*l+Ro,h+.166*l+Ro],[c-.115*l-Ro,h+.234*l-Ro]]).stream(u).point,e},e.scale(1070)};var Os,Ns,Ps,Ls,Ds,Fs,Is={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Ns=0,Is.lineStart=Wt},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=y,Os+=uo(Ns/2)}},js={point:Xt,lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},zs={point:$t,lineStart:Gt,lineEnd:Qt,polygonStart:function(){zs.lineStart=Zt},polygonEnd:function(){zs.point=$t,zs.lineStart=Gt,zs.lineEnd=Qt}};Ka.geo.path=function(){function e(e){return e&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),Ka.geo.stream(e,o)),a.result()}function t(){return o=null,e}var r,n,i,a,o,s=4.5;return e.area=function(e){return Os=0,Ka.geo.stream(e,i(Is)),Os},e.centroid=function(e){return bs=_s=xs=ws=Cs=Ts=Es=As=Ss=0,Ka.geo.stream(e,i(zs)),Ss?[Es/Ss,As/Ss]:Ts?[ws/Ts,Cs/Ts]:xs?[bs/xs,_s/xs]:[NaN,NaN]},e.bounds=function(e){return Ds=Fs=-(Ps=Ls=1/0),Ka.geo.stream(e,i(js)),[[Ps,Ls],[Ds,Fs]]},e.projection=function(e){return arguments.length?(i=(r=e)?e.stream||tr(e):Ae,t()):r},e.context=function(e){return arguments.length?(a=null==(n=e)?new Yt:new Jt(e),"function"!=typeof s&&a.pointRadius(s),t()):n},e.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(a.pointRadius(+t),+t),e):s},e.projection(Ka.geo.albersUsa()).context(null)},Ka.geo.transform=function(e){return{stream:function(t){var r=new rr(t);for(var n in e)r[n]=e[n];return r}}},rr.prototype={point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Ka.geo.projection=ir,Ka.geo.projectionMutator=ar,(Ka.geo.equirectangular=function(){return ir(sr)}).raw=sr.invert=sr,Ka.geo.rotation=function(e){function t(t){return t=e(t[0]*No,t[1]*No),t[0]*=Po,t[1]*=Po,t}return e=lr(e[0]%360*No,e[1]*No,e.length>2?e[2]*No:0),t.invert=function(t){return t=e.invert(t[0]*No,t[1]*No),t[0]*=Po,t[1]*=Po,t},t},ur.invert=sr,Ka.geo.circle=function(){function e(){var e="function"==typeof n?n.apply(this,arguments):n,t=lr(-e[0]*No,-e[1]*No,0).invert,i=[];return r(null,null,1,{point:function(e,r){i.push(e=t(e,r)),e[0]*=Po,e[1]*=Po}}),{type:"Polygon",coordinates:[i]}}var t,r,n=[0,0],i=6;return e.origin=function(t){return arguments.length?(n=t,e):n},e.angle=function(n){return arguments.length?(r=fr((t=+n)*No,i*No),e):t},e.precision=function(n){return arguments.length?(r=fr(t*No,(i=+n)*No),e):i},e.angle(90)},Ka.geo.distance=function(e,t){var r,n=(t[0]-e[0])*No,i=e[1]*No,a=t[1]*No,o=Math.sin(n),s=Math.cos(n),u=Math.sin(i),l=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=l*c-u*h*s)*r),u*c+l*h*s)},Ka.geo.graticule=function(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return Ka.range(Math.ceil(a/g)*g,i,g).map(d).concat(Ka.range(Math.ceil(l/v)*v,u,v).map(f)).concat(Ka.range(Math.ceil(n/p)*p,r,p).filter(function(e){return uo(e%g)>Ro}).map(c)).concat(Ka.range(Math.ceil(s/m)*m,o,m).filter(function(e){return uo(e%v)>Ro}).map(h))}var r,n,i,a,o,s,u,l,c,h,d,f,p=10,m=p,g=90,v=360,y=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[d(a).concat(f(u).slice(1),d(i).reverse().slice(1),f(l).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(a=+t[0][0],i=+t[1][0],l=+t[0][1],u=+t[1][1],a>i&&(t=a,a=i,i=t),l>u&&(t=l,l=u,u=t),e.precision(y)):[[a,l],[i,u]]},e.minorExtent=function(t){return arguments.length?(n=+t[0][0],r=+t[1][0],s=+t[0][1],o=+t[1][1],n>r&&(t=n,n=r,r=t),s>o&&(t=s,s=o,o=t),e.precision(y)):[[n,s],[r,o]]},e.step=function(t){return arguments.length?e.majorStep(t).minorStep(t):e.minorStep()},e.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],e):[g,v]},e.minorStep=function(t){return arguments.length?(p=+t[0],m=+t[1],e):[p,m]},e.precision=function(t){return arguments.length?(y=+t,c=mr(s,o,90),h=gr(n,r,y),d=mr(l,u,90),f=gr(a,i,y),e):y},e.majorExtent([[-180,-90+Ro],[180,90-Ro]]).minorExtent([[-180,-80-Ro],[180,80+Ro]])},Ka.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||i.apply(this,arguments)]}}var t,r,n=vr,i=yr;return e.distance=function(){return Ka.geo.distance(t||n.apply(this,arguments),r||i.apply(this,arguments))},e.source=function(r){return arguments.length?(n=r,t="function"==typeof r?null:r,e):n},e.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,e):i},e.precision=function(){return arguments.length?e:0},e},Ka.geo.interpolate=function(e,t){return br(e[0]*No,e[1]*No,t[0]*No,t[1]*No)},Ka.geo.length=function(e){return Vs=0,Ka.geo.stream(e,Bs),Vs};var Vs,Bs={sphere:y,point:y,lineStart:_r,lineEnd:y,polygonStart:y,polygonEnd:y},Hs=xr(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(Ka.geo.azimuthalEqualArea=function(){return ir(Hs)}).raw=Hs;var qs=xr(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Ae);(Ka.geo.azimuthalEquidistant=function(){return ir(qs)}).raw=qs,(Ka.geo.conicConformal=function(){return qt(wr)}).raw=wr,(Ka.geo.conicEquidistant=function(){return qt(Cr)}).raw=Cr;var Us=xr(function(e){return 1/e},Math.atan);(Ka.geo.gnomonic=function(){return ir(Us)}).raw=Us,Tr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-Mo]},(Ka.geo.mercator=function(){return Er(Tr)}).raw=Tr;var Ws=xr(function(){return 1},Math.asin);(Ka.geo.orthographic=function(){return ir(Ws)}).raw=Ws;var Xs=xr(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(Ka.geo.stereographic=function(){return ir(Xs)}).raw=Xs,Ar.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Mo]},(Ka.geo.transverseMercator=function(){var e=Er(Ar),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):(e=r(),[e[0],e[1],e[2]-90])},r([0,0,90])}).raw=Ar,Ka.geom={},Ka.geom.hull=function(e){function t(e){if(e.length<3)return[];var t,i=Ee(r),a=Ee(n),o=e.length,s=[],u=[];for(t=0;o>t;t++)s.push([+i.call(this,e[t],t),+a.call(this,e[t],t),t]);for(s.sort(Rr),t=0;o>t;t++)u.push([s[t][0],-s[t][1]]);var l=Mr(s),c=Mr(u),h=c[0]===l[0],d=c[c.length-1]===l[l.length-1],f=[];for(t=l.length-1;t>=0;--t)f.push(e[s[l[t]][2]]);for(t=+h;t=n&&l.x<=a&&l.y>=i&&l.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[];c.point=e[s]}),t}function r(e){return e.map(function(e,t){return{x:Math.round(a(e,t)/Ro)*Ro,y:Math.round(o(e,t)/Ro)*Ro,i:t}})}var n=Sr,i=kr,a=n,o=i,s=tu;return e?t(e):(t.links=function(e){return on(r(e)).edges.filter(function(e){return e.l&&e.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},t.triangles=function(e){var t=[];return on(r(e)).cells.forEach(function(r,n){for(var i,a,o=r.site,s=r.edges.sort(qr),u=-1,l=s.length,c=s[l-1].edge,h=c.l===o?c.r:c.l;++u=l,d=n>=c,f=(d<<1)+h;e.leaf=!1,e=e.nodes[f]||(e.nodes[f]=hn()),h?i=l:s=l,d?o=c:u=c,a(e,t,r,n,i,o,s,u)}var c,h,d,f,p,m,g,v,y,b=Ee(s),_=Ee(u);if(null!=t)m=t,g=r,v=n,y=i;else if(v=y=-(m=g=1/0),h=[],d=[],p=e.length,o)for(f=0;p>f;++f)c=e[f],c.xv&&(v=c.x),c.y>y&&(y=c.y),h.push(c.x),d.push(c.y);else for(f=0;p>f;++f){var x=+b(c=e[f],f),w=+_(c,f);m>x&&(m=x),g>w&&(g=w),x>v&&(v=x),w>y&&(y=w),h.push(x),d.push(w)}var C=v-m,T=y-g;C>T?y=g+C:v=m+T;var E=hn();if(E.add=function(e){a(E,e,+b(e,++f),+_(e,f),m,g,v,y)},E.visit=function(e){dn(e,E,m,g,v,y)},f=-1,null==t){for(;++f=0?e.slice(0,t):e,n=t>=0?e.slice(t+1):"in";return r=au.get(r)||iu,n=ou.get(n)||Ae,bn(n(r.apply(null,$a.call(arguments,1))))},Ka.interpolateHcl=Nn,Ka.interpolateHsl=Pn,Ka.interpolateLab=Ln,Ka.interpolateRound=Dn,Ka.transform=function(e){var t=Qa.createElementNS(Ka.ns.prefix.svg,"g");return(Ka.transform=function(e){if(null!=e){t.setAttribute("transform",e);var r=t.transform.baseVal.consolidate()}return new Fn(r?r.matrix:su)})(e)},Fn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var su={a:1,b:0,c:0,d:1,e:0,f:0};Ka.interpolateTransform=Vn,Ka.layout={},Ka.layout.bundle=function(){return function(e){for(var t=[],r=-1,n=e.length;++rs*s/g){if(p>u){var l=t.charge/u;e.px-=a*l,e.py-=o*l}return!0}if(t.point&&u&&p>u){var l=t.pointCharge/u;e.px-=a*l,e.py-=o*l}}return!t.charge}}function t(e){e.px=Ka.event.x,e.py=Ka.event.y,s.resume()}var r,n,i,a,o,s={},u=Ka.dispatch("start","tick","end"),l=[1,1],c=.9,h=uu,d=lu,f=-30,p=cu,m=.1,g=.64,v=[],y=[];return s.tick=function(){if((n*=.99)<.005)return u.end({type:"end",alpha:n=0}),!0;var t,r,s,h,d,p,g,b,_,x=v.length,w=y.length;for(r=0;w>r;++r)s=y[r],h=s.source,d=s.target,b=d.x-h.x,_=d.y-h.y,(p=b*b+_*_)&&(p=n*a[r]*((p=Math.sqrt(p))-i[r])/p,b*=p,_*=p,d.x-=b*(g=h.weight/(d.weight+h.weight)),d.y-=_*g,h.x+=b*(g=1-g),h.y+=_*g);if((g=n*m)&&(b=l[0]/2,_=l[1]/2,r=-1,g))for(;++r0?e:0:e>0&&(u.start({type:"start",alpha:n=e}),Ka.timer(s.tick)),s):n},s.start=function(){function e(e,n){if(!r){for(r=new Array(u),s=0;u>s;++s)r[s]=[];for(s=0;l>s;++s){var i=y[s];r[i.source.index].push(i.target),r[i.target.index].push(i.source)}}for(var a,o=r[t],s=-1,l=o.length;++st;++t)(n=v[t]).index=t,n.weight=0;for(t=0;c>t;++t)n=y[t],"number"==typeof n.source&&(n.source=v[n.source]),"number"==typeof n.target&&(n.target=v[n.target]),++n.source.weight,++n.target.weight;for(t=0;u>t;++t)n=v[t],isNaN(n.x)&&(n.x=e("x",p)),isNaN(n.y)&&(n.y=e("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(i=[],"function"==typeof h)for(t=0;c>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;c>t;++t)i[t]=h;if(a=[],"function"==typeof d)for(t=0;c>t;++t)a[t]=+d.call(this,y[t],t);else for(t=0;c>t;++t)a[t]=d;if(o=[],"function"==typeof f)for(t=0;u>t;++t)o[t]=+f.call(this,v[t],t);else for(t=0;u>t;++t)o[t]=f;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return r||(r=Ka.behavior.drag().origin(Ae).on("dragstart.force",Xn).on("drag.force",t).on("dragend.force",Yn)),arguments.length?void this.on("mouseover.force",Kn).on("mouseout.force",$n).call(r):r},Ka.rebind(s,u,"on")};var uu=20,lu=1,cu=1/0;Ka.layout.hierarchy=function(){function e(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(l=r.call(e,a,a.depth))&&(u=l.length)){for(var u,l,c;--u>=0;)o.push(c=l[u]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=l}else n&&(a.value=+n.call(e,a,a.depth)||0),delete a.children;return Jn(i,function(e){var r,i;t&&(r=e.children)&&r.sort(t),n&&(i=e.parent)&&(i.value+=e.value)}),s}var t=ri,r=ei,n=ti;return e.sort=function(r){return arguments.length?(t=r,e):t},e.children=function(t){return arguments.length?(r=t,e):r},e.value=function(t){return arguments.length?(n=t,e):n},e.revalue=function(t){return n&&(Zn(t,function(e){e.children&&(e.value=0)}),Jn(t,function(t){var r;t.children||(t.value=+n.call(e,t,t.depth)||0),(r=t.parent)&&(r.value+=t.value)})),t},e},Ka.layout.partition=function(){function e(t,r,n,i){var a=t.children;if(t.x=r,t.y=t.depth*i,t.dx=n,t.dy=i,a&&(o=a.length)){var o,s,u,l=-1;for(n=t.value?n/t.value:0;++lp;++p)for(i.call(e,l[0][p],m=g[p],c[0][p][1]),f=1;d>f;++f)i.call(e,l[f][p],m+=c[f-1][p][1],c[f][p][1]);return s}var t=Ae,r=si,n=ui,i=oi,a=ii,o=ai;return e.values=function(r){return arguments.length?(t=r,e):t},e.order=function(t){return arguments.length?(r="function"==typeof t?t:du.get(t)||si,e):r},e.offset=function(t){return arguments.length?(n="function"==typeof t?t:fu.get(t)||ui,e):n},e.x=function(t){return arguments.length?(a=t,e):a},e.y=function(t){return arguments.length?(o=t,e):o},e.out=function(t){return arguments.length?(i=t,e):i},e};var du=Ka.map({"inside-out":function(e){var t,r,n=e.length,i=e.map(li),a=e.map(ci),o=Ka.range(n).sort(function(e,t){return i[e]-i[t]}),s=0,u=0,l=[],c=[];for(t=0;n>t;++t)r=o[t],u>s?(s+=a[r],l.push(r)):(u+=a[r],c.push(r));return c.reverse().concat(l)},reverse:function(e){return Ka.range(e.length).reverse()},"default":si}),fu=Ka.map({silhouette:function(e){var t,r,n,i=e.length,a=e[0].length,o=[],s=0,u=[];for(r=0;a>r;++r){for(t=0,n=0;i>t;t++)n+=e[t][r][1];n>s&&(s=n),o.push(n)}for(r=0;a>r;++r)u[r]=(s-o[r])/2;return u},wiggle:function(e){var t,r,n,i,a,o,s,u,l,c=e.length,h=e[0],d=h.length,f=[];for(f[0]=u=l=0,r=1;d>r;++r){for(t=0,i=0;c>t;++t)i+=e[t][r][1];for(t=0,a=0,s=h[r][0]-h[r-1][0];c>t;++t){for(n=0,o=(e[t][r][1]-e[t][r-1][1])/(2*s);t>n;++n)o+=(e[n][r][1]-e[n][r-1][1])/s;a+=o*e[t][r][1]}f[r]=u-=i?a/i*s:0,l>u&&(l=u)}for(r=0;d>r;++r)f[r]-=l;return f},expand:function(e){var t,r,n,i=e.length,a=e[0].length,o=1/i,s=[];for(r=0;a>r;++r){for(t=0,n=0;i>t;t++)n+=e[t][r][1];if(n)for(t=0;i>t;t++)e[t][r][1]/=n;else for(t=0;i>t;t++)e[t][r][1]=o}for(r=0;a>r;++r)s[r]=0;return s},zero:ui});Ka.layout.histogram=function(){function e(e,a){for(var o,s,u=[],l=e.map(r,this),c=n.call(this,l,a),h=i.call(this,c,l,a),a=-1,d=l.length,f=h.length-1,p=t?1:1/d;++a0)for(a=-1;++a=c[0]&&s<=c[1]&&(o=u[Ka.bisect(h,s,1,f)-1],o.y+=p,o.push(e[a]));return u}var t=!0,r=Number,n=pi,i=di;return e.value=function(t){return arguments.length?(r=t,e):r},e.range=function(t){return arguments.length?(n=Ee(t),e):n},e.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return fi(e,t)}:Ee(t),e):i},e.frequency=function(r){return arguments.length?(t=!!r,e):t},e},Ka.layout.pack=function(){function e(e,a){var o=r.call(this,e,a),s=o[0],u=i[0],l=i[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,Jn(s,function(e){e.r=+c(e.value)}),Jn(s,bi),n){var h=n*(t?1:Math.max(2*s.r/u,2*s.r/l))/2;Jn(s,function(e){e.r+=h}),Jn(s,bi),Jn(s,function(e){e.r-=h})}return wi(s,u/2,l/2,t?1:1/Math.max(2*s.r/u,2*s.r/l)),o}var t,r=Ka.layout.hierarchy().sort(mi),n=0,i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},e.radius=function(r){return arguments.length?(t=null==r||"function"==typeof r?r:+r,e):t},e.padding=function(t){return arguments.length?(n=+t,e):n},Qn(e,r)},Ka.layout.tree=function(){function e(e,i){var c=o.call(this,e,i),h=c[0],d=t(h);if(Jn(d,r),d.parent.m=-d.z,Zn(d,n),l)Zn(h,a);else{var f=h,p=h,m=h;Zn(h,function(e){e.xp.x&&(p=e),e.depth>m.depth&&(m=e)});var g=s(f,p)/2-f.x,v=u[0]/(p.x+s(p,f)/2+g),y=u[1]/(m.depth||1);Zn(h,function(e){e.x=(e.x+g)*v,e.y=e.depth*y})}return c}function t(e){for(var t,r={A:null,children:[e]},n=[r];null!=(t=n.pop());)for(var i,a=t.children,o=0,s=a.length;s>o;++o)n.push((a[o]=i={_:a[o],parent:t,children:(i=a[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return r.children[0]}function r(e){var t=e.children,r=e.parent.children,n=e.i?r[e.i-1]:null;if(t.length){ki(e);var a=(t[0].z+t[t.length-1].z)/2;n?(e.z=n.z+s(e._,n._),e.m=e.z-a):e.z=a}else n&&(e.z=n.z+s(e._,n._));e.parent.A=i(e,n,e.parent.A||r[0])}function n(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function i(e,t,r){if(t){for(var n,i=e,a=e,o=t,u=i.parent.children[0],l=i.m,c=a.m,h=o.m,d=u.m;o=Ai(o),i=Ei(i),o&&i;)u=Ei(u),a=Ai(a),a.a=e,n=o.z+h-i.z-l+s(o._,i._),n>0&&(Si(Mi(o,e,r),e,n),l+=n,c+=n),h+=o.m,l+=i.m,d+=u.m,c+=a.m;o&&!Ai(a)&&(a.t=o,a.m+=h-c),i&&!Ei(u)&&(u.t=i,u.m+=l-d,r=e)}return r}function a(e){e.x*=u[0],e.y=e.depth*u[1]}var o=Ka.layout.hierarchy().sort(null).value(null),s=Ti,u=[1,1],l=null;return e.separation=function(t){return arguments.length?(s=t,e):s},e.size=function(t){return arguments.length?(l=null==(u=t)?a:null,e):l?null:u},e.nodeSize=function(t){return arguments.length?(l=null==(u=t)?null:a,e):l?u:null},Qn(e,o)},Ka.layout.cluster=function(){function e(e,a){var o,s=t.call(this,e,a),u=s[0],l=0;Jn(u,function(e){var t=e.children;t&&t.length?(e.x=Oi(t),e.y=Ri(t)):(e.x=o?l+=r(e,o):0,e.y=0,o=e)});var c=Ni(u),h=Pi(u),d=c.x-r(c,h)/2,f=h.x+r(h,c)/2;return Jn(u,i?function(e){e.x=(e.x-u.x)*n[0],e.y=(u.y-e.y)*n[1]}:function(e){e.x=(e.x-d)/(f-d)*n[0],e.y=(1-(u.y?e.y/u.y:1))*n[1]}),s}var t=Ka.layout.hierarchy().sort(null).value(null),r=Ti,n=[1,1],i=!1;return e.separation=function(t){return arguments.length?(r=t,e):r},e.size=function(t){return arguments.length?(i=null==(n=t),e):i?null:n},e.nodeSize=function(t){return arguments.length?(i=null!=(n=t),e):i?n:null},Qn(e,t)},Ka.layout.treemap=function(){function e(e,t){for(var r,n,i=-1,a=e.length;++it?0:t),r.area=isNaN(n)||0>=n?0:n}function t(r){var a=r.children;if(a&&a.length){var o,s,u,l=h(r),c=[],d=a.slice(),p=1/0,m="slice"===f?l.dx:"dice"===f?l.dy:"slice-dice"===f?1&r.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(e(d,l.dx*l.dy/r.value),c.area=0;(u=d.length)>0;)c.push(o=d[u-1]),c.area+=o.area,"squarify"!==f||(s=n(c,m))<=p?(d.pop(),p=s):(c.area-=c.pop().area,i(c,m,l,!1),m=Math.min(l.dx,l.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,m,l,!0),c.length=c.area=0),a.forEach(t)}}function r(t){var n=t.children;if(n&&n.length){var a,o=h(t),s=n.slice(),u=[];for(e(s,o.dx*o.dy/t.value),u.area=0;a=s.pop();)u.push(a),u.area+=a.area,null!=a.z&&(i(u,a.z?o.dx:o.dy,o,!s.length),u.length=u.area=0);n.forEach(r)}}function n(e,t){for(var r,n=e.area,i=0,a=1/0,o=-1,s=e.length;++or&&(a=r),r>i&&(i=r));return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*a*p)):1/0}function i(e,t,r,n){var i,a=-1,o=e.length,s=r.x,l=r.y,c=t?u(e.area/t):0;if(t==r.dx){for((n||c>r.dy)&&(c=r.dy);++ar.dx)&&(c=r.dx);++ar&&(t=1),1>r&&(e=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return e+t*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=Ka.random.normal.apply(Ka,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=Ka.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,r=0;e>r;r++)t+=Math.random();return t}}},Ka.scale={};var pu={floor:Ae,ceil:Ae};Ka.scale.linear=function(){return Hi([0,1],[0,1],vn,!1)};var mu={s:1,g:1,p:1,r:1,e:1};Ka.scale.log=function(){return Gi(Ka.scale.linear().domain([0,1]),10,!0,[1,10])};var gu=Ka.format(".0e"),vu={floor:function(e){return-Math.ceil(-e)},ceil:function(e){return-Math.floor(-e)}};Ka.scale.pow=function(){return Qi(Ka.scale.linear(),1,[0,1])},Ka.scale.sqrt=function(){return Ka.scale.pow().exponent(.5)},Ka.scale.ordinal=function(){return Ji([],{t:"range",a:[[]]})},Ka.scale.category10=function(){return Ka.scale.ordinal().range(yu)},Ka.scale.category20=function(){return Ka.scale.ordinal().range(bu)},Ka.scale.category20b=function(){return Ka.scale.ordinal().range(_u)},Ka.scale.category20c=function(){return Ka.scale.ordinal().range(xu)};var yu=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ye),bu=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ye),_u=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ye),xu=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ye);
+Ka.scale.quantile=function(){return ea([],[])},Ka.scale.quantize=function(){return ta(0,1,[0,1])},Ka.scale.threshold=function(){return ra([.5],[0,1])},Ka.scale.identity=function(){return na([0,1])},Ka.svg={},Ka.svg.arc=function(){function e(){var e=t.apply(this,arguments),a=r.apply(this,arguments),o=n.apply(this,arguments)+wu,s=i.apply(this,arguments)+wu,u=(o>s&&(u=o,o=s,s=u),s-o),l=So>u?"0":"1",c=Math.cos(o),h=Math.sin(o),d=Math.cos(s),f=Math.sin(s);return u>=Cu?e?"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+-e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z":e?"M"+a*c+","+a*h+"A"+a+","+a+" 0 "+l+",1 "+a*d+","+a*f+"L"+e*d+","+e*f+"A"+e+","+e+" 0 "+l+",0 "+e*c+","+e*h+"Z":"M"+a*c+","+a*h+"A"+a+","+a+" 0 "+l+",1 "+a*d+","+a*f+"L0,0Z"}var t=ia,r=aa,n=oa,i=sa;return e.innerRadius=function(r){return arguments.length?(t=Ee(r),e):t},e.outerRadius=function(t){return arguments.length?(r=Ee(t),e):r},e.startAngle=function(t){return arguments.length?(n=Ee(t),e):n},e.endAngle=function(t){return arguments.length?(i=Ee(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+r.apply(this,arguments))/2,a=(n.apply(this,arguments)+i.apply(this,arguments))/2+wu;return[Math.cos(a)*e,Math.sin(a)*e]},e};var wu=-Mo,Cu=ko-Ro;Ka.svg.line=function(){return ua(Ae)};var Tu=Ka.map({linear:la,"linear-closed":ca,step:ha,"step-before":da,"step-after":fa,basis:ba,"basis-open":_a,"basis-closed":xa,bundle:wa,cardinal:ga,"cardinal-open":pa,"cardinal-closed":ma,monotone:ka});Tu.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Eu=[0,2/3,1/3,0],Au=[0,1/3,2/3,0],Su=[0,1/6,2/3,1/6];Ka.svg.line.radial=function(){var e=ua(Ma);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},da.reverse=fa,fa.reverse=da,Ka.svg.area=function(){return Ra(Ae)},Ka.svg.area.radial=function(){var e=Ra(Ma);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},Ka.svg.chord=function(){function e(e,s){var u=t(this,a,e,s),l=t(this,o,e,s);return"M"+u.p0+n(u.r,u.p1,u.a1-u.a0)+(r(u,l)?i(u.r,u.p1,u.r,u.p0):i(u.r,u.p1,l.r,l.p0)+n(l.r,l.p1,l.a1-l.a0)+i(l.r,l.p1,u.r,u.p0))+"Z"}function t(e,t,r,n){var i=t.call(e,r,n),a=s.call(e,i,n),o=u.call(e,i,n)+wu,c=l.call(e,i,n)+wu;return{r:a,a0:o,a1:c,p0:[a*Math.cos(o),a*Math.sin(o)],p1:[a*Math.cos(c),a*Math.sin(c)]}}function r(e,t){return e.a0==t.a0&&e.a1==t.a1}function n(e,t,r){return"A"+e+","+e+" 0 "+ +(r>So)+",1 "+t}function i(e,t,r,n){return"Q 0,0 "+n}var a=vr,o=yr,s=Oa,u=oa,l=sa;return e.radius=function(t){return arguments.length?(s=Ee(t),e):s},e.source=function(t){return arguments.length?(a=Ee(t),e):a},e.target=function(t){return arguments.length?(o=Ee(t),e):o},e.startAngle=function(t){return arguments.length?(u=Ee(t),e):u},e.endAngle=function(t){return arguments.length?(l=Ee(t),e):l},e},Ka.svg.diagonal=function(){function e(e,i){var a=t.call(this,e,i),o=r.call(this,e,i),s=(a.y+o.y)/2,u=[a,{x:a.x,y:s},{x:o.x,y:s},o];return u=u.map(n),"M"+u[0]+"C"+u[1]+" "+u[2]+" "+u[3]}var t=vr,r=yr,n=Na;return e.source=function(r){return arguments.length?(t=Ee(r),e):t},e.target=function(t){return arguments.length?(r=Ee(t),e):r},e.projection=function(t){return arguments.length?(n=t,e):n},e},Ka.svg.diagonal.radial=function(){var e=Ka.svg.diagonal(),t=Na,r=e.projection;return e.projection=function(e){return arguments.length?r(Pa(t=e)):t},e},Ka.svg.symbol=function(){function e(e,n){return(ku.get(t.call(this,e,n))||Fa)(r.call(this,e,n))}var t=Da,r=La;return e.type=function(r){return arguments.length?(t=Ee(r),e):t},e.size=function(t){return arguments.length?(r=Ee(t),e):r},e};var ku=Ka.map({circle:Fa,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Nu)),r=t*Nu;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ou),r=t*Ou/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ou),r=t*Ou/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});Ka.svg.symbolTypes=ku.keys();var Mu,Ru,Ou=Math.sqrt(3),Nu=Math.tan(30*No),Pu=[],Lu=0;Pu.call=bo.call,Pu.empty=bo.empty,Pu.node=bo.node,Pu.size=bo.size,Ka.transition=function(e){return arguments.length?Mu?e.transition():e:wo.transition()},Ka.transition.prototype=Pu,Pu.select=function(e){var t,r,n,i=this.id,a=[];e=E(e);for(var o=-1,s=this.length;++oa;a++){i.push(t=[]);for(var r=this[a],s=0,u=r.length;u>s;s++)(n=r[s])&&e.call(n,n.__data__,s,a)&&t.push(n)}return Ia(i,this.id)},Pu.tween=function(e,t){var r=this.id;return arguments.length<2?this.node().__transition__[r].tween.get(e):z(this,null==t?function(t){t.__transition__[r].tween.remove(e)}:function(n){n.__transition__[r].tween.set(e,t)})},Pu.attr=function(e,t){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(e){return null==e?r:(e+="",function(){var t,r=this.getAttribute(s);return r!==e&&(t=o(r,e),function(e){this.setAttribute(s,t(e))})})}function a(e){return null==e?n:(e+="",function(){var t,r=this.getAttributeNS(s.space,s.local);return r!==e&&(t=o(r,e),function(e){this.setAttributeNS(s.space,s.local,t(e))})})}if(arguments.length<2){for(t in e)this.attr(t,e[t]);return this}var o="transform"==e?Vn:vn,s=Ka.ns.qualify(e);return ja(this,"attr."+e,t,s.local?a:i)},Pu.attrTween=function(e,t){function r(e,r){var n=t.call(this,e,r,this.getAttribute(i));return n&&function(e){this.setAttribute(i,n(e))}}function n(e,r){var n=t.call(this,e,r,this.getAttributeNS(i.space,i.local));return n&&function(e){this.setAttributeNS(i.space,i.local,n(e))}}var i=Ka.ns.qualify(e);return this.tween("attr."+e,i.local?n:r)},Pu.style=function(e,t,r){function n(){this.style.removeProperty(e)}function i(t){return null==t?n:(t+="",function(){var n,i=Ja.getComputedStyle(this,null).getPropertyValue(e);return i!==t&&(n=vn(i,t),function(t){this.style.setProperty(e,n(t),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof e){2>a&&(t="");for(r in e)this.style(r,e[r],t);return this}r=""}return ja(this,"style."+e,t,i)},Pu.styleTween=function(e,t,r){function n(n,i){var a=t.call(this,n,i,Ja.getComputedStyle(this,null).getPropertyValue(e));return a&&function(t){this.style.setProperty(e,a(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+e,n)},Pu.text=function(e){return ja(this,"text",e,za)},Pu.remove=function(){return this.each("end.transition",function(){var e;this.__transition__.count<2&&(e=this.parentNode)&&e.removeChild(this)})},Pu.ease=function(e){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof e&&(e=Ka.ease.apply(Ka,arguments)),z(this,function(r){r.__transition__[t].ease=e}))},Pu.delay=function(e){var t=this.id;return arguments.length<1?this.node().__transition__[t].delay:z(this,"function"==typeof e?function(r,n,i){r.__transition__[t].delay=+e.call(r,r.__data__,n,i)}:(e=+e,function(r){r.__transition__[t].delay=e}))},Pu.duration=function(e){var t=this.id;return arguments.length<1?this.node().__transition__[t].duration:z(this,"function"==typeof e?function(r,n,i){r.__transition__[t].duration=Math.max(1,e.call(r,r.__data__,n,i))}:(e=Math.max(1,e),function(r){r.__transition__[t].duration=e}))},Pu.each=function(e,t){var r=this.id;if(arguments.length<2){var n=Ru,i=Mu;Mu=r,z(this,function(t,n,i){Ru=t.__transition__[r],e.call(t,t.__data__,n,i)}),Ru=n,Mu=i}else z(this,function(n){var i=n.__transition__[r];(i.event||(i.event=Ka.dispatch("start","end"))).on(e,t)});return this},Pu.transition=function(){for(var e,t,r,n,i=this.id,a=++Lu,o=[],s=0,u=this.length;u>s;s++){o.push(e=[]);for(var t=this[s],l=0,c=t.length;c>l;l++)(r=t[l])&&(n=Object.create(r.__transition__[i]),n.delay+=n.duration,Va(r,l,a,n)),e.push(r)}return Ia(o,a)},Ka.svg.axis=function(){function e(e){e.each(function(){var e,l=Ka.select(this),c=this.__chart__||r,h=this.__chart__=r.copy(),d=null==u?h.ticks?h.ticks.apply(h,s):h.domain():u,f=null==t?h.tickFormat?h.tickFormat.apply(h,s):Ae:t,p=l.selectAll(".tick").data(d,h),m=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ro),g=Ka.transition(p.exit()).style("opacity",Ro).remove(),v=Ka.transition(p.order()).style("opacity",1),y=Math.max(i,0)+o,b=Ii(h),_=l.selectAll(".domain").data([0]),x=(_.enter().append("path").attr("class","domain"),Ka.transition(_));m.append("line"),m.append("text");var w,C,T,E,A=m.select("line"),S=v.select("line"),k=p.select("text").text(f),M=m.select("text"),R=v.select("text"),O="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(e=Ba,w="x",T="y",C="x2",E="y2",k.attr("dy",0>O?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+b[0]+","+O*a+"V0H"+b[1]+"V"+O*a)):(e=Ha,w="y",T="x",C="y2",E="x2",k.attr("dy",".32em").style("text-anchor",0>O?"end":"start"),x.attr("d","M"+O*a+","+b[0]+"H0V"+b[1]+"H"+O*a)),A.attr(E,O*i),M.attr(T,O*y),S.attr(C,0).attr(E,O*i),R.attr(w,0).attr(T,O*y),h.rangeBand){var N=h,P=N.rangeBand()/2;c=h=function(e){return N(e)+P}}else c.rangeBand?c=h:g.call(e,h,c);m.call(e,c,h),v.call(e,h,h)})}var t,r=Ka.scale.linear(),n=Du,i=6,a=6,o=3,s=[10],u=null;return e.scale=function(t){return arguments.length?(r=t,e):r},e.orient=function(t){return arguments.length?(n=t in Fu?t+"":Du,e):n},e.ticks=function(){return arguments.length?(s=arguments,e):s},e.tickValues=function(t){return arguments.length?(u=t,e):u},e.tickFormat=function(r){return arguments.length?(t=r,e):t},e.tickSize=function(t){var r=arguments.length;return r?(i=+t,a=+arguments[r-1],e):i},e.innerTickSize=function(t){return arguments.length?(i=+t,e):i},e.outerTickSize=function(t){return arguments.length?(a=+t,e):a},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(){return arguments.length&&e},e};var Du="bottom",Fu={top:1,right:1,bottom:1,left:1};Ka.svg.brush=function(){function e(a){a.each(function(){var a=Ka.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),o=a.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),a.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=a.selectAll(".resize").data(p,Ae);s.exit().remove(),s.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Iu[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",e.empty()?"none":null);var c,h=Ka.transition(a),d=Ka.transition(o);u&&(c=Ii(u),d.attr("x",c[0]).attr("width",c[1]-c[0]),r(h)),l&&(c=Ii(l),d.attr("y",c[0]).attr("height",c[1]-c[0]),n(h)),t(h)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+c[+/e$/.test(e)]+","+h[+/^s/.test(e)]+")"})}function r(e){e.select(".extent").attr("x",c[0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",c[1]-c[0])}function n(e){e.select(".extent").attr("y",h[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==Ka.event.keyCode&&(k||(y=null,R[0]-=c[1],R[1]-=h[1],k=2),x())}function p(){32==Ka.event.keyCode&&2==k&&(R[0]+=c[1],R[1]+=h[1],k=0,x())}function m(){var e=Ka.mouse(_),i=!1;b&&(e[0]+=b[0],e[1]+=b[1]),k||(Ka.event.altKey?(y||(y=[(c[0]+c[1])/2,(h[0]+h[1])/2]),R[0]=c[+(e[0]p?(i=n,n=p):i=p),m[0]!=n||m[1]!=i?(r?o=null:a=null,m[0]=n,m[1]=i,!0):void 0}function v(){m(),T.style("pointer-events","all").selectAll(".resize").style("display",e.empty()?"none":null),Ka.select("body").style("cursor",null),O.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),M(),C({type:"brushend"})}var y,b,_=this,w=Ka.select(Ka.event.target),C=s.of(_,arguments),T=Ka.select(_),E=w.datum(),A=!/^(n|s)$/.test(E)&&u,S=!/^(e|w)$/.test(E)&&l,k=w.classed("extent"),M=X(),R=Ka.mouse(_),O=Ka.select(Ja).on("keydown.brush",i).on("keyup.brush",p);if(Ka.event.changedTouches?O.on("touchmove.brush",m).on("touchend.brush",v):O.on("mousemove.brush",m).on("mouseup.brush",v),T.interrupt().selectAll("*").interrupt(),k)R[0]=c[0]-R[0],R[1]=h[0]-R[1];else if(E){var N=+/w$/.test(E),P=+/^n/.test(E);b=[c[1-N]-R[0],h[1-P]-R[1]],R[0]=c[N],R[1]=h[P]}else Ka.event.altKey&&(y=R.slice());T.style("pointer-events","none").selectAll(".resize").style("display",null),Ka.select("body").style("cursor",w.style("cursor")),C({type:"brushstart"}),m()}var a,o,s=C(e,"brushstart","brush","brushend"),u=null,l=null,c=[0,0],h=[0,0],d=!0,f=!0,p=ju[0];return e.event=function(e){e.each(function(){var e=s.of(this,arguments),t={x:c,y:h,i:a,j:o},r=this.__chart__||t;this.__chart__=t,Mu?Ka.select(this).transition().each("start.brush",function(){a=r.i,o=r.j,c=r.x,h=r.y,e({type:"brushstart"})}).tween("brush:brush",function(){var r=yn(c,t.x),n=yn(h,t.y);return a=o=null,function(i){c=t.x=r(i),h=t.y=n(i),e({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=t.i,o=t.j,e({type:"brush",mode:"resize"}),e({type:"brushend"})}):(e({type:"brushstart"}),e({type:"brush",mode:"resize"}),e({type:"brushend"}))})},e.x=function(t){return arguments.length?(u=t,p=ju[!u<<1|!l],e):u},e.y=function(t){return arguments.length?(l=t,p=ju[!u<<1|!l],e):l},e.clamp=function(t){return arguments.length?(u&&l?(d=!!t[0],f=!!t[1]):u?d=!!t:l&&(f=!!t),e):u&&l?[d,f]:u?d:l?f:null},e.extent=function(t){var r,n,i,s,d;return arguments.length?(u&&(r=t[0],n=t[1],l&&(r=r[0],n=n[0]),a=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(d=r,r=n,n=d),(r!=c[0]||n!=c[1])&&(c=[r,n])),l&&(i=t[0],s=t[1],u&&(i=i[1],s=s[1]),o=[i,s],l.invert&&(i=l(i),s=l(s)),i>s&&(d=i,i=s,s=d),(i!=h[0]||s!=h[1])&&(h=[i,s])),e):(u&&(a?(r=a[0],n=a[1]):(r=c[0],n=c[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(d=r,r=n,n=d))),l&&(o?(i=o[0],s=o[1]):(i=h[0],s=h[1],l.invert&&(i=l.invert(i),s=l.invert(s)),i>s&&(d=i,i=s,s=d))),u&&l?[[r,i],[n,s]]:u?[r,n]:l&&[i,s])},e.clear=function(){return e.empty()||(c=[0,0],h=[0,0],a=o=null),e},e.empty=function(){return!!u&&c[0]==c[1]||!!l&&h[0]==h[1]},Ka.rebind(e,s,"on")};var Iu={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ju=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],zu=is.format=cs.timeFormat,Vu=zu.utc,Bu=Vu("%Y-%m-%dT%H:%M:%S.%LZ");zu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?qa:Bu,qa.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},qa.toString=Bu.toString,is.second=ze(function(e){return new as(1e3*Math.floor(e/1e3))},function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))},function(e){return e.getSeconds()}),is.seconds=is.second.range,is.seconds.utc=is.second.utc.range,is.minute=ze(function(e){return new as(6e4*Math.floor(e/6e4))},function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))},function(e){return e.getMinutes()}),is.minutes=is.minute.range,is.minutes.utc=is.minute.utc.range,is.hour=ze(function(e){var t=e.getTimezoneOffset()/60;return new as(36e5*(Math.floor(e/36e5-t)+t))},function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))},function(e){return e.getHours()}),is.hours=is.hour.range,is.hours.utc=is.hour.utc.range,is.month=ze(function(e){return e=is.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),is.months=is.month.range,is.months.utc=is.month.utc.range;var Hu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qu=[[is.second,1],[is.second,5],[is.second,15],[is.second,30],[is.minute,1],[is.minute,5],[is.minute,15],[is.minute,30],[is.hour,1],[is.hour,3],[is.hour,6],[is.hour,12],[is.day,1],[is.day,2],[is.week,1],[is.month,1],[is.month,3],[is.year,1]],Uu=zu.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",St]]),Wu={range:function(e,t,r){return Ka.range(Math.ceil(e/r)*r,+t,r).map(Wa)},floor:Ae,ceil:Ae};qu.year=is.year,is.scale=function(){return Ua(Ka.scale.linear(),qu,Uu)};var Xu=qu.map(function(e){return[e[0].utc,e[1]]}),Yu=Vu.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",St]]);Xu.year=is.year.utc,is.scale.utc=function(){return Ua(Ka.scale.linear(),Xu,Yu)},Ka.text=Se(function(e){return e.responseText}),Ka.json=function(e,t){return ke(e,"application/json",Xa,t)},Ka.html=function(e,t){return ke(e,"text/html",Ya,t)},Ka.xml=Se(function(e){return e.responseXML}),"function"==typeof define&&define.amd?define(Ka):"object"==typeof module&&module.exports&&(module.exports=Ka),this.d3=Ka}(),!function(e){"use strict";function t(e){this.owner=e}function r(e,t){if(Object.create)t.prototype=Object.create(e.prototype);else{var r=function(){};r.prototype=e.prototype,t.prototype=new r}return t.prototype.constructor=t,t}function n(e){var t=this.internal=new i(this);t.loadConfig(e),t.init(),function r(e,t,n){Object.keys(e).forEach(function(i){t[i]=e[i].bind(n),Object.keys(e[i]).length>0&&r(e[i],t[i],n)})}(s,this,this)}function i(t){var r=this;r.d3=e.d3?e.d3:"undefined"!=typeof require?require("d3"):void 0,r.api=t,r.config=r.getDefaultConfig(),r.data={},r.cache={},r.axes={}}function a(e){t.call(this,e)}function o(e,t){function r(e,t){e.attr("transform",function(e){return"translate("+Math.ceil(t(e)+_)+", 0)"})}function n(e,t){e.attr("transform",function(e){return"translate(0,"+Math.ceil(t(e))+")"})}function i(e){var t=e[0],r=e[e.length-1];return r>t?[t,r]:[r,t]}function a(e){var t,r,n=[];if(e.ticks)return e.ticks.apply(e,f);for(r=e.domain(),t=Math.ceil(r[0]);t0&&n[0]>0&&n.unshift(n[0]-(n[1]-n[0])),n}function o(){var e,r=m.copy();return t.isCategory&&(e=m.domain(),r.domain([e[0],e[1]-1])),r}function s(e){var t=d?d(e):e;return"undefined"!=typeof t?t:""}function u(e){if(E)return E;var t={h:11.5,w:5.5};return e.select("text").text(s).each(function(e){var r=this.getBoundingClientRect(),n=s(e),i=r.height,a=n?r.width/n.length:void 0;i&&a&&(t.h=i,t.w=a)}).text(""),E=t,t}function l(r){return t.withoutTransition?r:e.transition(r)}function c(d){d.each(function(){function d(e,r){function n(e,t){a=void 0;for(var s=1;sr)return n(e.concat(t.substr(0,a?a:s)),t.slice(a?a+1:s));return e.concat(t)}var i,a,o,u=s(e),l=[];return"[object Array]"===Object.prototype.toString.call(u)?u:((!r||0>=r)&&(r=$?95:t.isCategory?Math.ceil(O(N[1])-O(N[0]))-12:110),n(l,u+""))}function f(e,t){var r=X.h;return 0===t&&(r="left"===g||"right"===g?-((Y[e.index]-1)*(X.h/2)-3):".71em"),r}function x(e){var t=m(e)+(p?0:_);return I[0]0?"start":"end":"middle"}function C(e){return e?"rotate("+e+")":""}function T(e){return e?8*Math.sin(Math.PI*(e/180)):0}function E(e){return e?11.5-2.5*(e/15)*(e>0?1:-1):K}var A,S,k,M=c.g=e.select(this),R=this.__chart__||m,O=this.__chart__=o(),N=b?b:a(O),P=M.selectAll(".tick").data(N,O),L=P.enter().insert("g",".domain").attr("class","tick").style("opacity",1e-6),D=P.exit().remove(),F=l(P).style("opacity",1),I=m.rangeExtent?m.rangeExtent():i(m.range()),j=M.selectAll(".domain").data([0]),z=(j.enter().append("path").attr("class","domain"),l(j));L.append("line"),L.append("text");var V=L.select("line"),B=F.select("line"),H=L.select("text"),q=F.select("text");t.isCategory?(_=Math.ceil((O(1)-O(0))/2),S=p?0:_,k=p?_:0):_=S=0;var U,W,X=u(M.select(".tick")),Y=[],K=Math.max(v,0)+y,$="left"===g||"right"===g;U=P.select("text"),W=U.selectAll("tspan").data(function(e,r){var n=t.tickMultiline?d(e,t.tickWidth):[].concat(s(e));return Y[r]=n.length,n.map(function(e){return{index:r,splitted:e}})}),W.enter().append("tspan"),W.exit().remove(),W.text(function(e){return e.splitted});var G=t.tickTextRotate;switch(g){case"bottom":A=r,V.attr("y2",v),H.attr("y",K),B.attr("x1",S).attr("x2",S).attr("y2",x),q.attr("x",0).attr("y",E(G)).style("text-anchor",w(G)).attr("transform",C(G)),W.attr("x",0).attr("dy",f).attr("dx",T(G)),z.attr("d","M"+I[0]+","+h+"V0H"+I[1]+"V"+h);break;case"top":A=r,V.attr("y2",-v),H.attr("y",-K),B.attr("x2",0).attr("y2",-v),q.attr("x",0).attr("y",-K),U.style("text-anchor","middle"),W.attr("x",0).attr("dy","0em"),z.attr("d","M"+I[0]+","+-h+"V0H"+I[1]+"V"+-h);break;case"left":A=n,V.attr("x2",-v),H.attr("x",-K),B.attr("x2",-v).attr("y1",k).attr("y2",k),q.attr("x",-K).attr("y",_),U.style("text-anchor","end"),W.attr("x",-K).attr("dy",f),z.attr("d","M"+-h+","+I[0]+"H0V"+I[1]+"H"+-h);break;case"right":A=n,V.attr("x2",v),H.attr("x",K),B.attr("x2",v).attr("y2",0),q.attr("x",K).attr("y",0),U.style("text-anchor","start"),W.attr("x",K).attr("dy",f),z.attr("d","M"+h+","+I[0]+"H0V"+I[1]+"H"+h)}if(O.rangeBand){var Q=O,Z=Q.rangeBand()/2;R=O=function(e){return Q(e)+Z}}else R.rangeBand?R=O:D.call(A,O);L.call(A,R),F.call(A,O)})}var h,d,f,p,m=e.scale.linear(),g="bottom",v=6,y=3,b=null,_=0,x=!0;return t=t||{},h=t.withOuterTick?6:0,c.scale=function(e){return arguments.length?(m=e,c):m},c.orient=function(e){return arguments.length?(g=e in{top:1,right:1,bottom:1,left:1}?e+"":"bottom",c):g},c.tickFormat=function(e){return arguments.length?(d=e,c):d},c.tickCentered=function(e){return arguments.length?(p=e,c):p},c.tickOffset=function(){return _},c.tickInterval=function(){var e,r;return t.isCategory?e=2*_:(r=c.g.select("path.domain").node().getTotalLength()-2*h,e=r/c.g.selectAll("line").size()),1/0===e?0:e},c.ticks=function(){return arguments.length?(f=arguments,c):f},c.tickCulling=function(e){return arguments.length?(x=e,c):x},c.tickValues=function(e){if("function"==typeof e)b=function(){return e(m.domain())};else{if(!arguments.length)return b;b=e}return c},c}var s,u,l,c={version:"0.4.10"};c.generate=function(e){return new n(e)},c.chart={fn:n.prototype,internal:{fn:i.prototype,axis:{fn:a.prototype}}},s=c.chart.fn,u=c.chart.internal.fn,l=c.chart.internal.axis.fn,u.init=function(){var e=this,t=e.config;if(e.initParams(),t.data_url)e.convertUrlToData(t.data_url,t.data_mimeType,t.data_keys,e.initWithData);else if(t.data_json)e.initWithData(e.convertJsonToData(t.data_json,t.data_keys));else if(t.data_rows)e.initWithData(e.convertRowsToData(t.data_rows));else{if(!t.data_columns)throw Error("url or json or rows or columns is required.");e.initWithData(e.convertColumnsToData(t.data_columns))}},u.initParams=function(){var e=this,t=e.d3,r=e.config;e.clipId="c3-"+ +new Date+"-clip",e.clipIdForXAxis=e.clipId+"-xaxis",e.clipIdForYAxis=e.clipId+"-yaxis",e.clipIdForGrid=e.clipId+"-grid",e.clipIdForSubchart=e.clipId+"-subchart",e.clipPath=e.getClipPath(e.clipId),e.clipPathForXAxis=e.getClipPath(e.clipIdForXAxis),e.clipPathForYAxis=e.getClipPath(e.clipIdForYAxis),e.clipPathForGrid=e.getClipPath(e.clipIdForGrid),e.clipPathForSubchart=e.getClipPath(e.clipIdForSubchart),e.dragStart=null,e.dragging=!1,e.flowing=!1,e.cancelClick=!1,e.mouseover=!1,e.transiting=!1,e.color=e.generateColor(),e.levelColor=e.generateLevelColor(),e.dataTimeFormat=r.data_xLocaltime?t.time.format:t.time.format.utc,e.axisTimeFormat=r.axis_x_localtime?t.time.format:t.time.format.utc,e.defaultAxisTimeFormat=e.axisTimeFormat.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%-m/%-d",function(e){return e.getDay()&&1!==e.getDate()}],["%-m/%-d",function(e){return 1!==e.getDate()}],["%-m/%-d",function(e){return e.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),e.hiddenTargetIds=[],e.hiddenLegendIds=[],e.focusedTargetIds=[],e.defocusedTargetIds=[],e.xOrient=r.axis_rotated?"left":"bottom",e.yOrient=r.axis_rotated?r.axis_y_inner?"top":"bottom":r.axis_y_inner?"right":"left",e.y2Orient=r.axis_rotated?r.axis_y2_inner?"bottom":"top":r.axis_y2_inner?"left":"right",e.subXOrient=r.axis_rotated?"left":"bottom",e.isLegendRight="right"===r.legend_position,e.isLegendInset="inset"===r.legend_position,e.isLegendTop="top-left"===r.legend_inset_anchor||"top-right"===r.legend_inset_anchor,e.isLegendLeft="top-left"===r.legend_inset_anchor||"bottom-left"===r.legend_inset_anchor,e.legendStep=0,e.legendItemWidth=0,e.legendItemHeight=0,e.currentMaxTickWidths={x:0,y:0,y2:0},e.rotated_padding_left=30,e.rotated_padding_right=r.axis_rotated&&!r.axis_x_show?0:30,e.rotated_padding_top=5,e.withoutFadeIn={},e.intervalForObserveInserted=void 0,e.axes.subx=t.selectAll([])},u.initChartElements=function(){this.initBar&&this.initBar(),this.initLine&&this.initLine(),this.initArc&&this.initArc(),this.initGauge&&this.initGauge(),this.initText&&this.initText()},u.initWithData=function(t){var r,n,i=this,o=i.d3,s=i.config,u=!0;i.axis=new a(i),i.initPie&&i.initPie(),i.initBrush&&i.initBrush(),i.initZoom&&i.initZoom(),i.selectChart=s.bindto?"function"==typeof s.bindto.node?s.bindto:o.select(s.bindto):o.selectAll([]),i.selectChart.empty()&&(i.selectChart=o.select(document.createElement("div")).style("opacity",0),i.observeInserted(i.selectChart),u=!1),i.selectChart.html("").classed("c3",!0),i.data.xs={},i.data.targets=i.convertDataToTargets(t),s.data_filter&&(i.data.targets=i.data.targets.filter(s.data_filter)),s.data_hide&&i.addHiddenTargetIds(s.data_hide===!0?i.mapToIds(i.data.targets):s.data_hide),s.legend_hide&&i.addHiddenLegendIds(s.legend_hide===!0?i.mapToIds(i.data.targets):s.legend_hide),i.hasType("gauge")&&(s.legend_show=!1),i.updateSizes(),i.updateScales(),i.x.domain(o.extent(i.getXDomain(i.data.targets))),i.y.domain(i.getYDomain(i.data.targets,"y")),i.y2.domain(i.getYDomain(i.data.targets,"y2")),i.subX.domain(i.x.domain()),i.subY.domain(i.y.domain()),i.subY2.domain(i.y2.domain()),i.orgXDomain=i.x.domain(),i.brush&&i.brush.scale(i.subX),s.zoom_enabled&&i.zoom.scale(i.x),i.svg=i.selectChart.append("svg").style("overflow","hidden").on("mouseenter",function(){return s.onmouseover.call(i)}).on("mouseleave",function(){return s.onmouseout.call(i)}),r=i.svg.append("defs"),i.clipChart=i.appendClip(r,i.clipId),i.clipXAxis=i.appendClip(r,i.clipIdForXAxis),i.clipYAxis=i.appendClip(r,i.clipIdForYAxis),i.clipGrid=i.appendClip(r,i.clipIdForGrid),i.clipSubchart=i.appendClip(r,i.clipIdForSubchart),i.updateSvgSize(),n=i.main=i.svg.append("g").attr("transform",i.getTranslate("main")),i.initSubchart&&i.initSubchart(),i.initTooltip&&i.initTooltip(),i.initLegend&&i.initLegend(),n.append("text").attr("class",h.text+" "+h.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),i.initRegion(),i.initGrid(),n.append("g").attr("clip-path",i.clipPath).attr("class",h.chart),s.grid_lines_front&&i.initGridLines(),i.initEventRect(),i.initChartElements(),n.insert("rect",s.zoom_privileged?null:"g."+h.regions).attr("class",h.zoomRect).attr("width",i.width).attr("height",i.height).style("opacity",0).on("dblclick.zoom",null),s.axis_x_extent&&i.brush.extent(i.getDefaultExtent()),i.axis.init(),i.updateTargets(i.data.targets),u&&(i.updateDimension(),i.config.oninit.call(i),i.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1})),null==e.onresize&&(e.onresize=i.generateResize()),e.onresize.add&&(e.onresize.add(function(){s.onresize.call(i)}),e.onresize.add(function(){i.api.flush()}),e.onresize.add(function(){s.onresized.call(i)})),i.api.element=i.selectChart.node()},u.smoothLines=function(e,t){var r=this;"grid"===t&&e.each(function(){var e=r.d3.select(this),t=e.attr("x1"),n=e.attr("x2"),i=e.attr("y1"),a=e.attr("y2");e.attr({x1:Math.ceil(t),x2:Math.ceil(n),y1:Math.ceil(i),y2:Math.ceil(a)})})},u.updateSizes=function(){var e=this,t=e.config,r=e.legend?e.getLegendHeight():0,n=e.legend?e.getLegendWidth():0,i=e.isLegendRight||e.isLegendInset?0:r,a=e.hasArcType(),o=t.axis_rotated||a?0:e.getHorizontalAxisHeight("x"),s=t.subchart_show&&!a?t.subchart_size_height+o:0;e.currentWidth=e.getCurrentWidth(),e.currentHeight=e.getCurrentHeight(),e.margin=t.axis_rotated?{top:e.getHorizontalAxisHeight("y2")+e.getCurrentPaddingTop(),right:a?0:e.getCurrentPaddingRight(),bottom:e.getHorizontalAxisHeight("y")+i+e.getCurrentPaddingBottom(),left:s+(a?0:e.getCurrentPaddingLeft())}:{top:4+e.getCurrentPaddingTop(),right:a?0:e.getCurrentPaddingRight(),bottom:o+s+i+e.getCurrentPaddingBottom(),left:a?0:e.getCurrentPaddingLeft()},e.margin2=t.axis_rotated?{top:e.margin.top,right:NaN,bottom:20+i,left:e.rotated_padding_left}:{top:e.currentHeight-s-i,right:NaN,bottom:o+i,left:e.margin.left},e.margin3={top:0,right:NaN,bottom:0,left:0},e.updateSizeForLegend&&e.updateSizeForLegend(r,n),e.width=e.currentWidth-e.margin.left-e.margin.right,e.height=e.currentHeight-e.margin.top-e.margin.bottom,e.width<0&&(e.width=0),e.height<0&&(e.height=0),e.width2=t.axis_rotated?e.margin.left-e.rotated_padding_left-e.rotated_padding_right:e.width,e.height2=t.axis_rotated?e.height:e.currentHeight-e.margin2.top-e.margin2.bottom,e.width2<0&&(e.width2=0),e.height2<0&&(e.height2=0),e.arcWidth=e.width-(e.isLegendRight?n+10:0),e.arcHeight=e.height-(e.isLegendRight?0:10),e.hasType("gauge")&&(e.arcHeight+=e.height-e.getGaugeLabelHeight()),e.updateRadius&&e.updateRadius(),e.isLegendRight&&a&&(e.margin3.left=e.arcWidth/2+1.1*e.radiusExpanded)},u.updateTargets=function(e){var t=this;t.updateTargetsForText(e),t.updateTargetsForBar(e),t.updateTargetsForLine(e),t.hasArcType()&&t.updateTargetsForArc&&t.updateTargetsForArc(e),t.updateTargetsForSubchart&&t.updateTargetsForSubchart(e),t.showTargets()},u.showTargets=function(){var e=this;e.svg.selectAll("."+h.target).filter(function(t){return e.isTargetToShow(t.id)}).transition().duration(e.config.transition_duration).style("opacity",1)},u.redraw=function(e,t){var r,n,i,a,o,s,u,l,c,d,f,p,m,g,v,y,b,_,x,C,T,E,A,S,k,M,R,O,N,P=this,L=P.main,D=P.d3,F=P.config,I=P.getShapeIndices(P.isAreaType),j=P.getShapeIndices(P.isBarType),z=P.getShapeIndices(P.isLineType),V=P.hasArcType(),B=P.filterTargetsToShow(P.data.targets),H=P.xv.bind(P);if(e=e||{},r=w(e,"withY",!0),n=w(e,"withSubchart",!0),i=w(e,"withTransition",!0),s=w(e,"withTransform",!1),u=w(e,"withUpdateXDomain",!1),l=w(e,"withUpdateOrgXDomain",!1),c=w(e,"withTrimXDomain",!0),m=w(e,"withUpdateXAxis",u),d=w(e,"withLegend",!1),f=w(e,"withEventRect",!0),p=w(e,"withDimension",!0),a=w(e,"withTransitionForExit",i),o=w(e,"withTransitionForAxis",i),x=i?F.transition_duration:0,C=a?x:0,T=o?x:0,t=t||P.axis.generateTransitions(T),
+d&&F.legend_show?P.updateLegend(P.mapToIds(P.data.targets),e,t):p&&P.updateDimension(!0),P.isCategorized()&&0===B.length&&P.x.domain([0,P.axes.x.selectAll(".tick").size()]),B.length?(P.updateXDomain(B,u,l,c),F.axis_x_tick_values||(S=P.axis.updateXAxisTickValues(B))):(P.xAxis.tickValues([]),P.subXAxis.tickValues([])),F.zoom_rescale&&!e.flow&&(R=P.x.orgDomain()),P.y.domain(P.getYDomain(B,"y",R)),P.y2.domain(P.getYDomain(B,"y2",R)),!F.axis_y_tick_values&&F.axis_y_tick_count&&P.yAxis.tickValues(P.axis.generateTickValues(P.y.domain(),F.axis_y_tick_count)),!F.axis_y2_tick_values&&F.axis_y2_tick_count&&P.y2Axis.tickValues(P.axis.generateTickValues(P.y2.domain(),F.axis_y2_tick_count)),P.axis.redraw(t,V),P.axis.updateLabels(i),(u||m)&&B.length)if(F.axis_x_tick_culling&&S){for(k=1;k=0&&D.select(this).style("display",t%M?"none":"block")})}else P.svg.selectAll("."+h.axisX+" .tick text").style("display","block");g=P.generateDrawArea?P.generateDrawArea(I,!1):void 0,v=P.generateDrawBar?P.generateDrawBar(j):void 0,y=P.generateDrawLine?P.generateDrawLine(z,!1):void 0,b=P.generateXYForText(I,j,z,!0),_=P.generateXYForText(I,j,z,!1),r&&(P.subY.domain(P.getYDomain(B,"y")),P.subY2.domain(P.getYDomain(B,"y2"))),P.tooltip.style("display","none"),P.updateXgridFocus(),L.select("text."+h.text+"."+h.empty).attr("x",P.width/2).attr("y",P.height/2).text(F.data_empty_label_text).transition().style("opacity",B.length?0:1),P.updateGrid(x),P.updateRegion(x),P.updateBar(C),P.updateLine(C),P.updateArea(C),P.updateCircle(),P.hasDataLabel()&&P.updateText(C),P.redrawArc&&P.redrawArc(x,C,s),P.redrawSubchart&&P.redrawSubchart(n,t,x,C,I,j,z),L.selectAll("."+h.selectedCircles).filter(P.isBarType.bind(P)).selectAll("circle").remove(),F.interaction_enabled&&!e.flow&&f&&(P.redrawEventRect(),P.updateZoom&&P.updateZoom()),P.updateCircleY(),O=(P.config.axis_rotated?P.circleY:P.circleX).bind(P),N=(P.config.axis_rotated?P.circleX:P.circleY).bind(P),e.flow&&(A=P.generateFlow({targets:B,flow:e.flow,duration:e.flow.duration,drawBar:v,drawLine:y,drawArea:g,cx:O,cy:N,xv:H,xForText:b,yForText:_})),(x||A)&&P.isTabVisible()?D.transition().duration(x).each(function(){var t=[];[P.redrawBar(v,!0),P.redrawLine(y,!0),P.redrawArea(g,!0),P.redrawCircle(O,N,!0),P.redrawText(b,_,e.flow,!0),P.redrawRegion(!0),P.redrawGrid(!0)].forEach(function(e){e.forEach(function(e){t.push(e)})}),E=P.generateWait(),t.forEach(function(e){E.add(e)})}).call(E,function(){A&&A(),F.onrendered&&F.onrendered.call(P)}):(P.redrawBar(v),P.redrawLine(y),P.redrawArea(g),P.redrawCircle(O,N),P.redrawText(b,_,e.flow),P.redrawRegion(),P.redrawGrid(),F.onrendered&&F.onrendered.call(P)),P.mapToIds(P.data.targets).forEach(function(e){P.withoutFadeIn[e]=!0})},u.updateAndRedraw=function(e){var t,r=this,n=r.config;e=e||{},e.withTransition=w(e,"withTransition",!0),e.withTransform=w(e,"withTransform",!1),e.withLegend=w(e,"withLegend",!1),e.withUpdateXDomain=!0,e.withUpdateOrgXDomain=!0,e.withTransitionForExit=!1,e.withTransitionForTransform=w(e,"withTransitionForTransform",e.withTransition),r.updateSizes(),e.withLegend&&n.legend_show||(t=r.axis.generateTransitions(e.withTransitionForAxis?n.transition_duration:0),r.updateScales(),r.updateSvgSize(),r.transformAll(e.withTransitionForTransform,t)),r.redraw(e,t)},u.redrawWithoutRescale=function(){this.redraw({withY:!1,withSubchart:!1,withEventRect:!1,withTransitionForAxis:!1})},u.isTimeSeries=function(){return"timeseries"===this.config.axis_x_type},u.isCategorized=function(){return this.config.axis_x_type.indexOf("categor")>=0},u.isCustomX=function(){var e=this,t=e.config;return!e.isTimeSeries()&&(t.data_x||x(t.data_xs))},u.isTimeSeriesY=function(){return"timeseries"===this.config.axis_y_type},u.getTranslate=function(e){var t,r,n=this,i=n.config;return"main"===e?(t=y(n.margin.left),r=y(n.margin.top)):"context"===e?(t=y(n.margin2.left),r=y(n.margin2.top)):"legend"===e?(t=n.margin3.left,r=n.margin3.top):"x"===e?(t=0,r=i.axis_rotated?0:n.height):"y"===e?(t=0,r=i.axis_rotated?n.height:0):"y2"===e?(t=i.axis_rotated?0:n.width,r=i.axis_rotated?1:0):"subx"===e?(t=0,r=i.axis_rotated?0:n.height2):"arc"===e&&(t=n.arcWidth/2,r=n.arcHeight/2),"translate("+t+","+r+")"},u.initialOpacity=function(e){return null!==e.value&&this.withoutFadeIn[e.id]?1:0},u.initialOpacityForCircle=function(e){return null!==e.value&&this.withoutFadeIn[e.id]?this.opacityForCircle(e):0},u.opacityForCircle=function(e){var t=this.config.point_show?1:0;return d(e.value)?this.isScatterType(e)?.5:t:0},u.opacityForText=function(){return this.hasDataLabel()?1:0},u.xx=function(e){return e?this.x(e.x):null},u.xv=function(e){var t=this,r=e.value;return t.isTimeSeries()?r=t.parseDate(e.value):t.isCategorized()&&"string"==typeof e.value&&(r=t.config.axis_x_categories.indexOf(e.value)),Math.ceil(t.x(r))},u.yv=function(e){var t=this,r=e.axis&&"y2"===e.axis?t.y2:t.y;return Math.ceil(r(e.value))},u.subxx=function(e){return e?this.subX(e.x):null},u.transformMain=function(e,t){var r,n,i,a=this;t&&t.axisX?r=t.axisX:(r=a.main.select("."+h.axisX),e&&(r=r.transition())),t&&t.axisY?n=t.axisY:(n=a.main.select("."+h.axisY),e&&(n=n.transition())),t&&t.axisY2?i=t.axisY2:(i=a.main.select("."+h.axisY2),e&&(i=i.transition())),(e?a.main.transition():a.main).attr("transform",a.getTranslate("main")),r.attr("transform",a.getTranslate("x")),n.attr("transform",a.getTranslate("y")),i.attr("transform",a.getTranslate("y2")),a.main.select("."+h.chartArcs).attr("transform",a.getTranslate("arc"))},u.transformAll=function(e,t){var r=this;r.transformMain(e,t),r.config.subchart_show&&r.transformContext(e,t),r.legend&&r.transformLegend(e)},u.updateSvgSize=function(){var e=this,t=e.svg.select(".c3-brush .background");e.svg.attr("width",e.currentWidth).attr("height",e.currentHeight),e.svg.selectAll(["#"+e.clipId,"#"+e.clipIdForGrid]).select("rect").attr("width",e.width).attr("height",e.height),e.svg.select("#"+e.clipIdForXAxis).select("rect").attr("x",e.getXAxisClipX.bind(e)).attr("y",e.getXAxisClipY.bind(e)).attr("width",e.getXAxisClipWidth.bind(e)).attr("height",e.getXAxisClipHeight.bind(e)),e.svg.select("#"+e.clipIdForYAxis).select("rect").attr("x",e.getYAxisClipX.bind(e)).attr("y",e.getYAxisClipY.bind(e)).attr("width",e.getYAxisClipWidth.bind(e)).attr("height",e.getYAxisClipHeight.bind(e)),e.svg.select("#"+e.clipIdForSubchart).select("rect").attr("width",e.width).attr("height",t.size()?t.attr("height"):0),e.svg.select("."+h.zoomRect).attr("width",e.width).attr("height",e.height),e.selectChart.style("max-height",e.currentHeight+"px")},u.updateDimension=function(e){var t=this;e||(t.config.axis_rotated?(t.axes.x.call(t.xAxis),t.axes.subx.call(t.subXAxis)):(t.axes.y.call(t.yAxis),t.axes.y2.call(t.y2Axis))),t.updateSizes(),t.updateScales(),t.updateSvgSize(),t.transformAll(!1)},u.observeInserted=function(t){var r,n=this;return"undefined"==typeof MutationObserver?void e.console.error("MutationObserver not defined."):(r=new MutationObserver(function(i){i.forEach(function(i){"childList"===i.type&&i.previousSibling&&(r.disconnect(),n.intervalForObserveInserted=e.setInterval(function(){t.node().parentNode&&(e.clearInterval(n.intervalForObserveInserted),n.updateDimension(),n.config.oninit.call(n),n.redraw({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransition:!1,withTransitionForTransform:!1,withLegend:!0}),t.transition().style("opacity",1))},10))})}),void r.observe(t.node(),{attributes:!0,childList:!0,characterData:!0}))},u.generateResize=function(){function e(){t.forEach(function(e){e()})}var t=[];return e.add=function(e){t.push(e)},e},u.endall=function(e,t){var r=0;e.each(function(){++r}).each("end",function(){--r||t.apply(this,arguments)})},u.generateWait=function(){var e=[],t=function(t,r){var n=setInterval(function(){var t=0;e.forEach(function(e){if(e.empty())return void(t+=1);try{e.transition()}catch(r){t+=1}}),t===e.length&&(clearInterval(n),r&&r())},10)};return t.add=function(t){e.push(t)},t},u.parseDate=function(t){var r,n=this;return t instanceof Date?r=t:"string"==typeof t?r=n.dataTimeFormat(n.config.data_xFormat).parse(t):"number"!=typeof t&&isNaN(t)||(r=new Date(+t)),(!r||isNaN(+r))&&e.console.error("Failed to parse x '"+t+"' to Date object"),r},u.isTabVisible=function(){var e;return"undefined"!=typeof document.hidden?e="hidden":"undefined"!=typeof document.mozHidden?e="mozHidden":"undefined"!=typeof document.msHidden?e="msHidden":"undefined"!=typeof document.webkitHidden&&(e="webkitHidden"),document[e]?!1:!0},u.getDefaultConfig=function(){var e={bindto:"#chart",size_width:void 0,size_height:void 0,padding_left:void 0,padding_right:void 0,padding_top:void 0,padding_bottom:void 0,zoom_enabled:!1,zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:function(){},zoom_onzoomstart:function(){},zoom_onzoomend:function(){},interaction_enabled:!0,onmouseover:function(){},onmouseout:function(){},onresize:function(){},onresized:function(){},oninit:function(){},onrendered:function(){},transition_duration:350,data_x:void 0,data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_idConverter:function(e){return e},data_names:{},data_classes:{},data_groups:[],data_axes:{},data_type:void 0,data_types:{},data_labels:{},data_order:"desc",data_regions:{},data_color:void 0,data_colors:{},data_hide:!1,data_filter:void 0,data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function(){return!0},data_selection_multiple:!0,data_selection_draggable:!1,data_onclick:function(){},data_onmouseover:function(){},data_onmouseout:function(){},data_onselected:function(){},data_onunselected:function(){},data_url:void 0,data_json:void 0,data_rows:void 0,data_columns:void 0,data_mimeType:void 0,data_keys:void 0,data_empty_label_text:"",subchart_show:!1,subchart_size_height:60,subchart_onbrush:function(){},color_pattern:[],color_threshold:{},legend_show:!0,legend_hide:!1,legend_position:"bottom",legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_onclick:void 0,legend_item_onmouseover:void 0,legend_item_onmouseout:void 0,legend_equally:!1,axis_rotated:!1,axis_x_show:!0,axis_x_type:"indexed",axis_x_localtime:!0,axis_x_categories:[],axis_x_tick_centered:!1,axis_x_tick_format:void 0,axis_x_tick_culling:{},axis_x_tick_culling_max:10,axis_x_tick_count:void 0,axis_x_tick_fit:!0,axis_x_tick_values:null,axis_x_tick_rotate:0,axis_x_tick_outer:!0,axis_x_tick_multiline:!0,axis_x_tick_width:null,axis_x_max:void 0,axis_x_min:void 0,axis_x_padding:{},axis_x_height:void 0,axis_x_extent:void 0,axis_x_label:{},axis_y_show:!0,axis_y_type:void 0,axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:void 0,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_count:void 0,axis_y_tick_time_value:void 0,axis_y_tick_time_interval:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y2_show:!1,axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:void 0,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_count:void 0,axis_y2_padding:{},axis_y2_default:void 0,grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:10,grid_focus_show:!0,grid_lines_front:!0,point_show:!0,point_r:2.5,point_focus_expand_enabled:!0,point_focus_expand_r:void 0,point_select_r:void 0,line_connectNull:!1,line_step_type:"step",bar_width:void 0,bar_width_ratio:.6,bar_width_max:void 0,bar_zerobased:!0,area_zerobased:!0,pie_label_show:!0,pie_label_format:void 0,pie_label_threshold:.05,pie_expand:!0,gauge_label_show:!0,gauge_label_format:void 0,gauge_expand:!0,gauge_min:0,gauge_max:100,gauge_units:void 0,gauge_width:void 0,donut_label_show:!0,donut_label_format:void 0,donut_label_threshold:.05,donut_width:void 0,donut_expand:!0,donut_title:"",regions:[],tooltip_show:!0,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:function(e,t,r,n){return this.getTooltipContent?this.getTooltipContent(e,t,r,n):""},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:{top:"0px",left:"50px"}};return Object.keys(this.additionalConfig).forEach(function(t){e[t]=this.additionalConfig[t]},this),e},u.additionalConfig={},u.loadConfig=function(e){function t(){var e=n.shift();return e&&r&&"object"==typeof r&&e in r?(r=r[e],t()):e?void 0:r}var r,n,i,a=this.config;Object.keys(a).forEach(function(o){r=e,n=o.split("_"),i=t(),g(i)&&(a[o]=i)})},u.getScale=function(e,t,r){return(r?this.d3.time.scale():this.d3.scale.linear()).range([e,t])},u.getX=function(e,t,r,n){var i,a=this,o=a.getScale(e,t,a.isTimeSeries()),s=r?o.domain(r):o;a.isCategorized()?(n=n||function(){return 0},o=function(e,t){var r=s(e)+n(e);return t?r:Math.ceil(r)}):o=function(e,t){var r=s(e);return t?r:Math.ceil(r)};for(i in s)o[i]=s[i];return o.orgDomain=function(){return s.domain()},a.isCategorized()&&(o.domain=function(e){return arguments.length?(s.domain(e),o):(e=this.orgDomain(),[e[0],e[1]+1])}),o},u.getY=function(e,t,r){var n=this.getScale(e,t,this.isTimeSeriesY());return r&&n.domain(r),n},u.getYScale=function(e){return"y2"===this.axis.getId(e)?this.y2:this.y},u.getSubYScale=function(e){return"y2"===this.axis.getId(e)?this.subY2:this.subY},u.updateScales=function(){var e=this,t=e.config,r=!e.x;e.xMin=t.axis_rotated?1:0,e.xMax=t.axis_rotated?e.height:e.width,e.yMin=t.axis_rotated?0:e.height,e.yMax=t.axis_rotated?e.width:1,e.subXMin=e.xMin,e.subXMax=e.xMax,e.subYMin=t.axis_rotated?0:e.height2,e.subYMax=t.axis_rotated?e.width2:1,e.x=e.getX(e.xMin,e.xMax,r?void 0:e.x.orgDomain(),function(){return e.xAxis.tickOffset()}),e.y=e.getY(e.yMin,e.yMax,r?t.axis_y_default:e.y.domain()),e.y2=e.getY(e.yMin,e.yMax,r?t.axis_y2_default:e.y2.domain()),e.subX=e.getX(e.xMin,e.xMax,e.orgXDomain,function(t){return t%1?0:e.subXAxis.tickOffset()}),e.subY=e.getY(e.subYMin,e.subYMax,r?t.axis_y_default:e.subY.domain()),e.subY2=e.getY(e.subYMin,e.subYMax,r?t.axis_y2_default:e.subY2.domain()),e.xAxisTickFormat=e.axis.getXAxisTickFormat(),e.xAxisTickValues=e.axis.getXAxisTickValues(),e.yAxisTickValues=e.axis.getYAxisTickValues(),e.y2AxisTickValues=e.axis.getY2AxisTickValues(),e.xAxis=e.axis.getXAxis(e.x,e.xOrient,e.xAxisTickFormat,e.xAxisTickValues,t.axis_x_tick_outer),e.subXAxis=e.axis.getXAxis(e.subX,e.subXOrient,e.xAxisTickFormat,e.xAxisTickValues,t.axis_x_tick_outer),e.yAxis=e.axis.getYAxis(e.y,e.yOrient,t.axis_y_tick_format,e.yAxisTickValues,t.axis_y_tick_outer),e.y2Axis=e.axis.getYAxis(e.y2,e.y2Orient,t.axis_y2_tick_format,e.y2AxisTickValues,t.axis_y2_tick_outer),r||(e.brush&&e.brush.scale(e.subX),t.zoom_enabled&&e.zoom.scale(e.x)),e.updateArc&&e.updateArc()},u.getYDomainMin=function(e){var t,r,n,i,a,o,s=this,u=s.config,l=s.mapToIds(e),c=s.getValuesAsIdKeyed(e);if(u.data_groups.length>0)for(o=s.hasNegativeValueInTargets(e),t=0;t=0}),0!==i.length)for(n=i[0],o&&c[n]&&c[n].forEach(function(e,t){c[n][t]=0>e?e:0}),r=1;r0||(c[n][t]+=+e)});return s.d3.min(Object.keys(c).map(function(e){return s.d3.min(c[e])}))},u.getYDomainMax=function(e){var t,r,n,i,a,o,s=this,u=s.config,l=s.mapToIds(e),c=s.getValuesAsIdKeyed(e);if(u.data_groups.length>0)for(o=s.hasPositiveValueInTargets(e),t=0;t=0}),0!==i.length)for(n=i[0],o&&c[n]&&c[n].forEach(function(e,t){c[n][t]=e>0?e:0}),r=1;r+e||(c[n][t]+=+e)});return s.d3.max(Object.keys(c).map(function(e){return s.d3.max(c[e])}))},u.getYDomain=function(e,t,r){var n,i,a,o,s,u,l,c,h,f,p,m=this,g=m.config,v=e.filter(function(e){return m.axis.getId(e.id)===t}),y=r?m.filterByXDomain(v,r):v,_="y2"===t?g.axis_y2_min:g.axis_y_min,w="y2"===t?g.axis_y2_max:g.axis_y_max,C=m.getYDomainMin(y),T=m.getYDomainMax(y),E="y2"===t?g.axis_y2_center:g.axis_y_center,A=m.hasType("bar",y)&&g.bar_zerobased||m.hasType("area",y)&&g.area_zerobased,S="y2"===t?g.axis_y2_inverted:g.axis_y_inverted,k=m.hasDataLabel()&&g.axis_rotated,M=m.hasDataLabel()&&!g.axis_rotated;return C=d(_)?_:d(w)?w>C?C:w-10:C,T=d(w)?w:d(_)?T>_?T:_+10:T,0===y.length?"y2"===t?m.y2.domain():m.y.domain():(isNaN(C)&&(C=0),isNaN(T)&&(T=C),C===T&&(0>C?T=0:C=0),f=C>=0&&T>=0,p=0>=C&&0>=T,(d(_)&&f||d(w)&&p)&&(A=!1),A&&(f&&(C=0),p&&(T=0)),i=Math.abs(T-C),a=o=s=.1*i,"undefined"!=typeof E&&(u=Math.max(Math.abs(C),Math.abs(T)),T=E+u,C=E-u),k?(l=m.getDataLabelLength(C,T,"width"),c=b(m.y.range()),h=[l[0]/c,l[1]/c],o+=i*(h[1]/(1-h[0]-h[1])),s+=i*(h[0]/(1-h[0]-h[1]))):M&&(l=m.getDataLabelLength(C,T,"height"),o+=m.axis.convertPixelsToAxisPadding(l[1],i),s+=m.axis.convertPixelsToAxisPadding(l[0],i)),"y"===t&&x(g.axis_y_padding)&&(o=m.axis.getPadding(g.axis_y_padding,"top",o,i),s=m.axis.getPadding(g.axis_y_padding,"bottom",s,i)),"y2"===t&&x(g.axis_y2_padding)&&(o=m.axis.getPadding(g.axis_y2_padding,"top",o,i),s=m.axis.getPadding(g.axis_y2_padding,"bottom",s,i)),A&&(f&&(s=C),p&&(o=-T)),n=[C-s,T+o],S?n.reverse():n)},u.getXDomainMin=function(e){var t=this,r=t.config;return g(r.axis_x_min)?t.isTimeSeries()?this.parseDate(r.axis_x_min):r.axis_x_min:t.d3.min(e,function(e){return t.d3.min(e.values,function(e){return e.x})})},u.getXDomainMax=function(e){var t=this,r=t.config;return g(r.axis_x_max)?t.isTimeSeries()?this.parseDate(r.axis_x_max):r.axis_x_max:t.d3.max(e,function(e){return t.d3.max(e.values,function(e){return e.x})})},u.getXDomainPadding=function(e){var t,r,n,i,a=this,o=a.config,s=e[1]-e[0];return a.isCategorized()?r=0:a.hasType("bar")?(t=a.getMaxDataCount(),r=t>1?s/(t-1)/2:.5):r=.01*s,"object"==typeof o.axis_x_padding&&x(o.axis_x_padding)?(n=d(o.axis_x_padding.left)?o.axis_x_padding.left:r,i=d(o.axis_x_padding.right)?o.axis_x_padding.right:r):n=i="number"==typeof o.axis_x_padding?o.axis_x_padding:r,{left:n,right:i}},u.getXDomain=function(e){var t=this,r=[t.getXDomainMin(e),t.getXDomainMax(e)],n=r[0],i=r[1],a=t.getXDomainPadding(r),o=0,s=0;return n-i!==0||t.isCategorized()||(t.isTimeSeries()?(n=new Date(.5*n.getTime()),i=new Date(1.5*i.getTime())):(n=0===n?1:.5*n,i=0===i?-1:1.5*i)),(n||0===n)&&(o=t.isTimeSeries()?new Date(n.getTime()-a.left):n-a.left),(i||0===i)&&(s=t.isTimeSeries()?new Date(i.getTime()+a.right):i+a.right),[o,s]},u.updateXDomain=function(e,t,r,n,i){var a=this,o=a.config;return r&&(a.x.domain(i?i:a.d3.extent(a.getXDomain(e))),a.orgXDomain=a.x.domain(),o.zoom_enabled&&a.zoom.scale(a.x).updateScaleExtent(),a.subX.domain(a.x.domain()),a.brush&&a.brush.scale(a.subX)),t&&(a.x.domain(i?i:!a.brush||a.brush.empty()?a.orgXDomain:a.brush.extent()),o.zoom_enabled&&a.zoom.scale(a.x).updateScaleExtent()),n&&a.x.domain(a.trimXDomain(a.x.orgDomain())),a.x.domain()},u.trimXDomain=function(e){var t=this;return e[0]<=t.orgXDomain[0]&&(e[1]=+e[1]+(t.orgXDomain[0]-e[0]),e[0]=t.orgXDomain[0]),t.orgXDomain[1]<=e[1]&&(e[0]=+e[0]-(e[1]-t.orgXDomain[1]),e[1]=t.orgXDomain[1]),e},u.isX=function(e){var t=this,r=t.config;return r.data_x&&e===r.data_x||x(r.data_xs)&&C(r.data_xs,e)},u.isNotX=function(e){return!this.isX(e)},u.getXKey=function(e){var t=this,r=t.config;return r.data_x?r.data_x:x(r.data_xs)?r.data_xs[e]:null},u.getXValuesOfXKey=function(e,t){var r,n=this,i=t&&x(t)?n.mapToIds(t):[];return i.forEach(function(t){n.getXKey(t)===e&&(r=n.data.xs[t])}),r},u.getIndexByX=function(e){var t=this,r=t.filterByX(t.data.targets,e);return r.length?r[0].index:null},u.getXValue=function(e,t){var r=this;return e in r.data.xs&&r.data.xs[e]&&d(r.data.xs[e][t])?r.data.xs[e][t]:t},u.getOtherTargetXs=function(){var e=this,t=Object.keys(e.data.xs);return t.length?e.data.xs[t[0]]:null},u.getOtherTargetX=function(e){var t=this.getOtherTargetXs();return t&&e1},u.isMultipleX=function(){return x(this.config.data_xs)||!this.config.data_xSort||this.hasType("scatter")},u.addName=function(e){var t,r=this;return e&&(t=r.config.data_names[e.id],e.name=t?t:e.id),e},u.getValueOnIndex=function(e,t){var r=e.filter(function(e){return e.index===t});return r.length?r[0]:null},u.updateTargetX=function(e,t){var r=this;e.forEach(function(e){e.values.forEach(function(n,i){n.x=r.generateTargetX(t[i],e.id,i)}),r.data.xs[e.id]=t})},u.updateTargetXs=function(e,t){var r=this;e.forEach(function(e){t[e.id]&&r.updateTargetX([e],t[e.id])})},u.generateTargetX=function(e,t,r){var n,i=this;return n=i.isTimeSeries()?i.parseDate(e?e:i.getXValue(t,r)):i.isCustomX()&&!i.isCategorized()?d(e)?+e:i.getXValue(t,r):r},u.cloneTarget=function(e){return{id:e.id,id_org:e.id_org,values:e.values.map(function(e){return{x:e.x,value:e.value,id:e.id}})}},u.updateXs=function(){var e=this;e.data.targets.length&&(e.xs=[],e.data.targets[0].values.forEach(function(t){e.xs[t.index]=t.x}))},u.getPrevX=function(e){var t=this.xs[e-1];return"undefined"!=typeof t?t:null},u.getNextX=function(e){var t=this.xs[e+1];return"undefined"!=typeof t?t:null},u.getMaxDataCount=function(){var e=this;return e.d3.max(e.data.targets,function(e){return e.values.length})},u.getMaxDataCountTarget=function(e){var t,r=e.length,n=0;return r>1?e.forEach(function(e){e.values.length>n&&(t=e,n=e.values.length)}):t=r?e[0]:null,t},u.getEdgeX=function(e){var t=this;return e.length?[t.d3.min(e,function(e){return e.values[0].x}),t.d3.max(e,function(e){return e.values[e.values.length-1].x})]:[0,0]},u.mapToIds=function(e){return e.map(function(e){return e.id})},u.mapToTargetIds=function(e){var t=this;return e?p(e)?[e]:e:t.mapToIds(t.data.targets)},u.hasTarget=function(e,t){var r,n=this.mapToIds(e);for(r=0;re})},u.hasPositiveValueInTargets=function(e){return this.checkValueInTargets(e,function(e){return e>0})},u.isOrderDesc=function(){var e=this.config;return"string"==typeof e.data_order&&"desc"===e.data_order.toLowerCase()},u.isOrderAsc=function(){var e=this.config;return"string"==typeof e.data_order&&"asc"===e.data_order.toLowerCase()},u.orderTargets=function(e){var t=this,r=t.config,n=t.isOrderAsc(),i=t.isOrderDesc();return n||i?e.sort(function(e,t){var r=function(e,t){return e+Math.abs(t.value)},i=e.values.reduce(r,0),a=t.values.reduce(r,0);return n?a-i:i-a}):f(r.data_order)&&e.sort(r.data_order),e},u.filterByX=function(e,t){return this.d3.merge(e.map(function(e){return e.values})).filter(function(e){return e.x-t===0})},u.filterRemoveNull=function(e){return e.filter(function(e){return d(e.value)})},u.filterByXDomain=function(e,t){return e.map(function(e){return{id:e.id,id_org:e.id_org,values:e.values.filter(function(e){return t[0]<=e.x&&e.x<=t[1]})}})},u.hasDataLabel=function(){var e=this.config;return"boolean"==typeof e.data_labels&&e.data_labels?!0:"object"==typeof e.data_labels&&x(e.data_labels)?!0:!1},u.getDataLabelLength=function(e,t,r){var n=this,i=[0,0],a=1.3;return n.selectChart.select("svg").selectAll(".dummy").data([e,t]).enter().append("text").text(function(e){return n.dataLabelFormat(e.id)(e)}).each(function(e,t){i[t]=this.getBoundingClientRect()[r]*a}).remove(),i},u.isNoneArc=function(e){return this.hasTarget(this.data.targets,e.id)},u.isArc=function(e){return"data"in e&&this.hasTarget(this.data.targets,e.data.id)},u.findSameXOfValues=function(e,t){var r,n=e[t].x,i=[];for(r=t-1;r>=0&&n===e[r].x;r--)i.push(e[r]);for(r=t;ra&&(i=a,r=e)}),r},u.dist=function(e,t){var r=this,n=r.config,i=n.axis_rotated?1:0,a=n.axis_rotated?0:1,o=r.circleY(e,e.index),s=r.x(e.x);return Math.pow(s-t[i],2)+Math.pow(o-t[a],2)},u.convertValuesToStep=function(e){var t,r=[].concat(e);if(!this.isCategorized())return e;for(t=e.length+1;t>0;t--)r[t]=r[t-1];return r[0]={x:r[0].x-1,value:r[0].value,id:r[0].id},r[e.length+1]={x:r[e.length].x+1,value:r[e.length].value,id:r[e.length].id},r},u.updateDataAttributes=function(e,t){var r=this,n=r.config,i=n["data_"+e];return"undefined"==typeof t?i:(Object.keys(t).forEach(function(e){i[e]=t[e]}),r.redraw({withLegend:!0}),i)},u.convertUrlToData=function(e,t,r,n){var i=this,a=t?t:"csv";i.d3.xhr(e,function(e,t){var o;if(!t)throw new Error(e.responseURL+" "+e.status+" ("+e.statusText+")");o="json"===a?i.convertJsonToData(JSON.parse(t.response),r):"tsv"===a?i.convertTsvToData(t.response):i.convertCsvToData(t.response),n.call(i,o)})},u.convertXsvToData=function(e,t){var r,n=t.parseRows(e);return 1===n.length?(r=[{}],n[0].forEach(function(e){r[0][e]=null})):r=t.parse(e),r},u.convertCsvToData=function(e){return this.convertXsvToData(e,this.d3.csv)},u.convertTsvToData=function(e){return this.convertXsvToData(e,this.d3.tsv)},u.convertJsonToData=function(e,t){var r,n,i=this,a=[];return t?(t.x?(r=t.value.concat(t.x),i.config.data_x=t.x):r=t.value,a.push(r),e.forEach(function(e){var t=[];r.forEach(function(r){var n=m(e[r])?null:e[r];t.push(n)}),a.push(t)}),n=i.convertRowsToData(a)):(Object.keys(e).forEach(function(t){a.push([t].concat(e[t]))}),n=i.convertColumnsToData(a)),n},u.convertRowsToData=function(e){var t,r,n=e[0],i={},a=[];for(t=1;t=0?n.data.xs[r]=(t&&n.data.xs[r]?n.data.xs[r]:[]).concat(e.map(function(e){return e[a]}).filter(d).map(function(e,t){return n.generateTargetX(e,r,t)})):i.data_x?n.data.xs[r]=n.getOtherTargetXs():x(i.data_xs)&&(n.data.xs[r]=n.getXValuesOfXKey(a,n.data.targets)):n.data.xs[r]=e.map(function(e,t){return t})}),a.forEach(function(e){if(!n.data.xs[e])throw new Error('x is not defined for id = "'+e+'".')}),r=a.map(function(t,r){var a=i.data_idConverter(t);return{id:a,id_org:t,values:e.map(function(e,o){var s=n.getXKey(t),u=e[s],l=n.generateTargetX(u,t,o);return n.isCustomX()&&n.isCategorized()&&0===r&&u&&(0===o&&(i.axis_x_categories=[]),i.axis_x_categories.push(u)),(m(e[t])||n.data.xs[t].length<=o)&&(l=void 0),{x:l,value:null===e[t]||isNaN(e[t])?null:+e[t],id:a}}).filter(function(e){return g(e.x)})}}),r.forEach(function(e){var t;i.data_xSort&&(e.values=e.values.sort(function(e,t){var r=e.x||0===e.x?e.x:1/0,n=t.x||0===t.x?t.x:1/0;return r-n})),t=0,e.values.forEach(function(e){e.index=t++}),n.data.xs[e.id].sort(function(e,t){return e-t})}),i.data_type&&n.setTargetType(n.mapToIds(r).filter(function(e){return!(e in i.data_types)}),i.data_type),r.forEach(function(e){n.addCache(e.id_org,e)}),r},u.load=function(e,t){var r=this;e&&(t.filter&&(e=e.filter(t.filter)),(t.type||t.types)&&e.forEach(function(e){var n=t.types&&t.types[e.id]?t.types[e.id]:t.type;r.setTargetType(e.id,n)}),r.data.targets.forEach(function(t){for(var r=0;r0?r:320/(e.hasType("gauge")?2:1)},u.getCurrentPaddingTop=function(){var e=this.config;return d(e.padding_top)?e.padding_top:0},u.getCurrentPaddingBottom=function(){var e=this.config;return d(e.padding_bottom)?e.padding_bottom:0},u.getCurrentPaddingLeft=function(e){var t=this,r=t.config;return d(r.padding_left)?r.padding_left:r.axis_rotated?r.axis_x_show?Math.max(v(t.getAxisWidthByAxisId("x",e)),40):1:!r.axis_y_show||r.axis_y_inner?t.axis.getYAxisLabelPosition().isOuter?30:1:v(t.getAxisWidthByAxisId("y",e))},u.getCurrentPaddingRight=function(){var e=this,t=e.config,r=10,n=e.isLegendRight?e.getLegendWidth()+20:0;return d(t.padding_right)?t.padding_right+1:t.axis_rotated?r+n:!t.axis_y2_show||t.axis_y2_inner?2+n+(e.axis.getY2AxisLabelPosition().isOuter?20:0):v(e.getAxisWidthByAxisId("y2"))+n},u.getParentRectValue=function(e){for(var t,r=this.selectChart.node();r&&"BODY"!==r.tagName;){try{t=r.getBoundingClientRect()[e]}catch(n){"width"===e&&(t=r.offsetWidth)}if(t)break;r=r.parentNode}return t},u.getParentWidth=function(){return this.getParentRectValue("width")},u.getParentHeight=function(){var e=this.selectChart.style("height");return e.indexOf("px")>0?+e.replace("px",""):0},u.getSvgLeft=function(e){var t=this,r=t.config,n=r.axis_rotated||!r.axis_rotated&&!r.axis_y_inner,i=r.axis_rotated?h.axisX:h.axisY,a=t.main.select("."+i).node(),o=a&&n?a.getBoundingClientRect():{right:0},s=t.selectChart.node().getBoundingClientRect(),u=t.hasArcType(),l=o.right-s.left-(u?0:t.getCurrentPaddingLeft(e));return l>0?l:0},u.getAxisWidthByAxisId=function(e,t){var r=this,n=r.axis.getLabelPositionById(e);return r.axis.getMaxTickWidth(e,t)+(n.isInner?20:40)},u.getHorizontalAxisHeight=function(e){var t=this,r=t.config,n=30;return"x"!==e||r.axis_x_show?"x"===e&&r.axis_x_height?r.axis_x_height:"y"!==e||r.axis_y_show?"y2"!==e||r.axis_y2_show?("x"===e&&!r.axis_rotated&&r.axis_x_tick_rotate&&(n=30+t.axis.getMaxTickWidth(e)*Math.cos(Math.PI*(90-r.axis_x_tick_rotate)/180)),n+(t.axis.getLabelPositionById(e).isInner?0:10)+("y2"===e?-10:0)):t.rotated_padding_top:!r.legend_show||t.isLegendRight||t.isLegendInset?1:10:8},u.getEventRectWidth=function(){return Math.max(0,this.xAxis.tickInterval())},u.getShapeIndices=function(e){var t,r,n=this,i=n.config,a={},o=0;return n.filterTargetsToShow(n.data.targets.filter(e,n)).forEach(function(e){for(t=0;t=0&&(l+=s(i[o].value)-u)}),l}},u.isWithinShape=function(e,t){var r,n=this,i=n.d3.select(e);return n.isTargetToShow(t.id)?"circle"===e.nodeName?r=n.isStepType(t)?n.isWithinStep(e,n.getYScale(t.id)(t.value)):n.isWithinCircle(e,1.5*n.pointSelectR(t)):"path"===e.nodeName&&(r=i.classed(h.bar)?n.isWithinBar(e):!0):r=!1,r},u.getInterpolate=function(e){var t=this;return t.isSplineType(e)?"cardinal":t.isStepType(e)?t.config.line_step_type:"linear"},u.initLine=function(){var e=this;e.main.select("."+h.chart).append("g").attr("class",h.chartLines)},u.updateTargetsForLine=function(e){var t,r,n=this,i=n.config,a=n.classChartLine.bind(n),o=n.classLines.bind(n),s=n.classAreas.bind(n),u=n.classCircles.bind(n),l=n.classFocus.bind(n);t=n.main.select("."+h.chartLines).selectAll("."+h.chartLine).data(e).attr("class",function(e){return a(e)+l(e)}),r=t.enter().append("g").attr("class",a).style("opacity",0).style("pointer-events","none"),r.append("g").attr("class",o),r.append("g").attr("class",s),r.append("g").attr("class",function(e){return n.generateClass(h.selectedCircles,e.id)}),r.append("g").attr("class",u).style("cursor",function(e){return i.data_selection_isselectable(e)?"pointer":null}),e.forEach(function(e){n.main.selectAll("."+h.selectedCircles+n.getTargetSelectorSuffix(e.id)).selectAll("."+h.selectedCircle).each(function(t){t.value=e.values[t.index].value})})},u.updateLine=function(e){var t=this;t.mainLine=t.main.selectAll("."+h.lines).selectAll("."+h.line).data(t.lineData.bind(t)),t.mainLine.enter().append("path").attr("class",t.classLine.bind(t)).style("stroke",t.color),t.mainLine.style("opacity",t.initialOpacity.bind(t)).style("shape-rendering",function(e){return t.isStepType(e)?"crispEdges":""}).attr("transform",null),t.mainLine.exit().transition().duration(e).style("opacity",0).remove()},u.redrawLine=function(e,t){return[(t?this.mainLine.transition():this.mainLine).attr("d",e).style("stroke",this.color).style("opacity",1)]},u.generateDrawLine=function(e,t){var r=this,n=r.config,i=r.d3.svg.line(),a=r.generateGetLinePoints(e,t),o=t?r.getSubYScale:r.getYScale,s=function(e){return(t?r.subxx:r.xx).call(r,e)},u=function(e,t){return n.data_groups.length>0?a(e,t)[0][1]:o.call(r,e.id)(e.value)};return i=n.axis_rotated?i.x(u).y(s):i.x(s).y(u),n.line_connectNull||(i=i.defined(function(e){return null!=e.value})),function(e){var a,s=n.line_connectNull?r.filterRemoveNull(e.values):e.values,u=t?r.x:r.subX,l=o.call(r,e.id),c=0,h=0;return r.isLineType(e)?n.data_regions[e.id]?a=r.lineWithRegions(s,u,l,n.data_regions[e.id]):(r.isStepType(e)&&(s=r.convertValuesToStep(s)),a=i.interpolate(r.getInterpolate(e))(s)):(s[0]&&(c=u(s[0].x),h=l(s[0].value)),a=n.axis_rotated?"M "+h+" "+c:"M "+c+" "+h),a?a:"M 0 0"}},u.generateGetLinePoints=function(e,t){var r=this,n=r.config,i=e.__max__+1,a=r.getShapeX(0,i,e,!!t),o=r.getShapeY(!!t),s=r.getShapeOffset(r.isLineType,e,!!t),u=t?r.getSubYScale:r.getYScale;return function(e,t){var i=u.call(r,e.id)(0),l=s(e,t)||i,c=a(e),h=o(e);return n.axis_rotated&&(0h||e.value<0&&h>i)&&(h=i),[[c,h-(i-l)],[c,h-(i-l)],[c,h-(i-l)],[c,h-(i-l)]]}},u.lineWithRegions=function(e,t,r,n){function i(e,t){var r;for(r=0;r=s;s+=v)C+=u(e[o-1],e[o],s,p);w=e[o].x}return C},u.updateArea=function(e){var t=this,r=t.d3;t.mainArea=t.main.selectAll("."+h.areas).selectAll("."+h.area).data(t.lineData.bind(t)),t.mainArea.enter().append("path").attr("class",t.classArea.bind(t)).style("fill",t.color).style("opacity",function(){return t.orgAreaOpacity=+r.select(this).style("opacity"),0}),t.mainArea.style("opacity",t.orgAreaOpacity),t.mainArea.exit().transition().duration(e).style("opacity",0).remove()},u.redrawArea=function(e,t){return[(t?this.mainArea.transition():this.mainArea).attr("d",e).style("fill",this.color).style("opacity",this.orgAreaOpacity)]},u.generateDrawArea=function(e,t){var r=this,n=r.config,i=r.d3.svg.area(),a=r.generateGetAreaPoints(e,t),o=t?r.getSubYScale:r.getYScale,s=function(e){return(t?r.subxx:r.xx).call(r,e)},u=function(e,t){return n.data_groups.length>0?a(e,t)[0][1]:o.call(r,e.id)(r.getAreaBaseValue(e.id))},l=function(e,t){return n.data_groups.length>0?a(e,t)[1][1]:o.call(r,e.id)(e.value)};return i=n.axis_rotated?i.x0(u).x1(l).y(s):i.x(s).y0(u).y1(l),n.line_connectNull||(i=i.defined(function(e){return null!==e.value})),function(e){var t,a=n.line_connectNull?r.filterRemoveNull(e.values):e.values,o=0,s=0;return r.isAreaType(e)?(r.isStepType(e)&&(a=r.convertValuesToStep(a)),t=i.interpolate(r.getInterpolate(e))(a)):(a[0]&&(o=r.x(a[0].x),s=r.getYScale(e.id)(a[0].value)),t=n.axis_rotated?"M "+s+" "+o:"M "+o+" "+s),t?t:"M 0 0"}},u.getAreaBaseValue=function(){return 0},u.generateGetAreaPoints=function(e,t){var r=this,n=r.config,i=e.__max__+1,a=r.getShapeX(0,i,e,!!t),o=r.getShapeY(!!t),s=r.getShapeOffset(r.isAreaType,e,!!t),u=t?r.getSubYScale:r.getYScale;return function(e,t){var i=u.call(r,e.id)(0),l=s(e,t)||i,c=a(e),h=o(e);return n.axis_rotated&&(0h||e.value<0&&h>i)&&(h=i),[[c,l],[c,h-(i-l)],[c,h-(i-l)],[c,l]]}},u.updateCircle=function(){var e=this;e.mainCircle=e.main.selectAll("."+h.circles).selectAll("."+h.circle).data(e.lineOrScatterData.bind(e)),e.mainCircle.enter().append("circle").attr("class",e.classCircle.bind(e)).attr("r",e.pointR.bind(e)).style("fill",e.color),e.mainCircle.style("opacity",e.initialOpacityForCircle.bind(e)),e.mainCircle.exit().remove()},u.redrawCircle=function(e,t,r){var n=this.main.selectAll("."+h.selectedCircle);return[(r?this.mainCircle.transition():this.mainCircle).style("opacity",this.opacityForCircle.bind(this)).style("fill",this.color).attr("cx",e).attr("cy",t),(r?n.transition():n).attr("cx",e).attr("cy",t)]},u.circleX=function(e){return e.x||0===e.x?this.x(e.x):null},u.updateCircleY=function(){var e,t,r=this;r.config.data_groups.length>0?(e=r.getShapeIndices(r.isLineType),t=r.generateGetLinePoints(e),r.circleY=function(e,r){return t(e,r)[0][1]}):r.circleY=function(e){return r.getYScale(e.id)(e.value)}},u.getCircles=function(e,t){var r=this;return(t?r.main.selectAll("."+h.circles+r.getTargetSelectorSuffix(t)):r.main).selectAll("."+h.circle+(d(e)?"-"+e:""))},u.expandCircles=function(e,t,r){var n=this,i=n.pointExpandedR.bind(n);r&&n.unexpandCircles(),n.getCircles(e,t).classed(h.EXPANDED,!0).attr("r",i)},u.unexpandCircles=function(e){var t=this,r=t.pointR.bind(t);t.getCircles(e).filter(function(){return t.d3.select(this).classed(h.EXPANDED)}).classed(h.EXPANDED,!1).attr("r",r)},u.pointR=function(e){var t=this,r=t.config;return t.isStepType(e)?0:f(r.point_r)?r.point_r(e):r.point_r},u.pointExpandedR=function(e){var t=this,r=t.config;return r.point_focus_expand_enabled?r.point_focus_expand_r?r.point_focus_expand_r:1.75*t.pointR(e):t.pointR(e)},u.pointSelectR=function(e){var t=this,r=t.config;return r.point_select_r?r.point_select_r:4*t.pointR(e)},u.isWithinCircle=function(e,t){var r=this.d3,n=r.mouse(e),i=r.select(e),a=+i.attr("cx"),o=+i.attr("cy");return Math.sqrt(Math.pow(a-n[0],2)+Math.pow(o-n[1],2))n.bar_width_max?n.bar_width_max:i},u.getBars=function(e,t){var r=this;return(t?r.main.selectAll("."+h.bars+r.getTargetSelectorSuffix(t)):r.main).selectAll("."+h.bar+(d(e)?"-"+e:""))},u.expandBars=function(e,t,r){var n=this;r&&n.unexpandBars(),n.getBars(e,t).classed(h.EXPANDED,!0)},u.unexpandBars=function(e){var t=this;t.getBars(e).classed(h.EXPANDED,!1)},u.generateDrawBar=function(e,t){var r=this,n=r.config,i=r.generateGetBarPoints(e,t);return function(e,t){var r=i(e,t),a=n.axis_rotated?1:0,o=n.axis_rotated?0:1,s="M "+r[0][a]+","+r[0][o]+" L"+r[1][a]+","+r[1][o]+" L"+r[2][a]+","+r[2][o]+" L"+r[3][a]+","+r[3][o]+" z";return s}},u.generateGetBarPoints=function(e,t){var r=this,n=t?r.subXAxis:r.xAxis,i=e.__max__+1,a=r.getBarW(n,i),o=r.getShapeX(a,i,e,!!t),s=r.getShapeY(!!t),u=r.getShapeOffset(r.isBarType,e,!!t),l=t?r.getSubYScale:r.getYScale;return function(e,t){var n=l.call(r,e.id)(0),i=u(e,t)||n,c=o(e),h=s(e);return r.config.axis_rotated&&(0h||e.value<0&&h>n)&&(h=n),[[c,i],[c,h-(n-i)],[c+a,h-(n-i)],[c+a,i]]}},u.isWithinBar=function(e){var t=this.d3.mouse(e),r=e.getBoundingClientRect(),n=e.pathSegList.getItem(0),i=e.pathSegList.getItem(1),a=Math.min(n.x,i.x),o=Math.min(n.y,i.y),s=r.width,u=r.height,l=2,c=a-l,h=a+s+l,d=o+u+l,f=o-l;return ca.width?n=a.width-o.width:0>n&&(n=4)),n},u.getYForText=function(e,t,r){var n,i=this,a=r.getBoundingClientRect();return i.config.axis_rotated?n=(e[0][0]+e[2][0]+.6*a.height)/2:(n=e[2][1],t.value<0?(n+=a.height,i.isBarType(t)&&i.isSafari()?n-=3:!i.isBarType(t)&&i.isChrome()&&(n+=3)):n+=i.isBarType(t)?-3:-6),null!==t.value||i.config.axis_rotated||(nthis.height&&(n=this.height-4)),n},u.setTargetType=function(e,t){var r=this,n=r.config;r.mapToTargetIds(e).forEach(function(e){r.withoutFadeIn[e]=t===n.data_types[e],n.data_types[e]=t}),e||(n.data_type=t)},u.hasType=function(e,t){var r=this,n=r.config.data_types,i=!1;return t=t||r.data.targets,t&&t.length?t.forEach(function(t){var r=n[t.id];(r&&r.indexOf(e)>=0||!r&&"line"===e)&&(i=!0)}):Object.keys(n).length?Object.keys(n).forEach(function(t){n[t]===e&&(i=!0)}):i=r.config.data_type===e,i},u.hasArcType=function(e){return this.hasType("pie",e)||this.hasType("donut",e)||this.hasType("gauge",e)},u.isLineType=function(e){var t=this.config,r=p(e)?e:e.id;return!t.data_types[r]||["line","spline","area","area-spline","step","area-step"].indexOf(t.data_types[r])>=0},u.isStepType=function(e){var t=p(e)?e:e.id;return["step","area-step"].indexOf(this.config.data_types[t])>=0},u.isSplineType=function(e){var t=p(e)?e:e.id;return["spline","area-spline"].indexOf(this.config.data_types[t])>=0},u.isAreaType=function(e){var t=p(e)?e:e.id;return["area","area-spline","area-step"].indexOf(this.config.data_types[t])>=0},u.isBarType=function(e){var t=p(e)?e:e.id;return"bar"===this.config.data_types[t]},u.isScatterType=function(e){var t=p(e)?e:e.id;return"scatter"===this.config.data_types[t]},u.isPieType=function(e){var t=p(e)?e:e.id;return"pie"===this.config.data_types[t]},u.isGaugeType=function(e){var t=p(e)?e:e.id;return"gauge"===this.config.data_types[t]},u.isDonutType=function(e){var t=p(e)?e:e.id;return"donut"===this.config.data_types[t]},u.isArcType=function(e){return this.isPieType(e)||this.isDonutType(e)||this.isGaugeType(e)},u.lineData=function(e){return this.isLineType(e)?[e]:[]},u.arcData=function(e){return this.isArcType(e.data)?[e]:[]},u.barData=function(e){return this.isBarType(e)?e.values:[]},u.lineOrScatterData=function(e){return this.isLineType(e)||this.isScatterType(e)?e.values:[]},u.barOrLineData=function(e){return this.isBarType(e)||this.isLineType(e)?e.values:[]},u.initGrid=function(){var e=this,t=e.config,r=e.d3;e.grid=e.main.append("g").attr("clip-path",e.clipPathForGrid).attr("class",h.grid),t.grid_x_show&&e.grid.append("g").attr("class",h.xgrids),t.grid_y_show&&e.grid.append("g").attr("class",h.ygrids),t.grid_focus_show&&e.grid.append("g").attr("class",h.xgridFocus).append("line").attr("class",h.xgridFocus),e.xgrid=r.selectAll([]),t.grid_lines_front||e.initGridLines()},u.initGridLines=function(){var e=this,t=e.d3;e.gridLines=e.main.append("g").attr("clip-path",e.clipPathForGrid).attr("class",h.grid+" "+h.gridLines),e.gridLines.append("g").attr("class",h.xgridLines),e.gridLines.append("g").attr("class",h.ygridLines),e.xgridLines=t.selectAll([])},u.updateXGrid=function(e){var t=this,r=t.config,n=t.d3,i=t.generateGridData(r.grid_x_type,t.x),a=t.isCategorized()?t.xAxis.tickOffset():0;t.xgridAttr=r.axis_rotated?{x1:0,x2:t.width,y1:function(e){return t.x(e)-a},y2:function(e){return t.x(e)-a}}:{x1:function(e){return t.x(e)+a},x2:function(e){return t.x(e)+a},y1:0,y2:t.height},t.xgrid=t.main.select("."+h.xgrids).selectAll("."+h.xgrid).data(i),t.xgrid.enter().append("line").attr("class",h.xgrid),e||t.xgrid.attr(t.xgridAttr).style("opacity",function(){return+n.select(this).attr(r.axis_rotated?"y1":"x1")===(r.axis_rotated?t.height:0)?0:1}),t.xgrid.exit().remove()},u.updateYGrid=function(){var e=this,t=e.config,r=e.yAxis.tickValues()||e.y.ticks(t.grid_y_ticks);e.ygrid=e.main.select("."+h.ygrids).selectAll("."+h.ygrid).data(r),e.ygrid.enter().append("line").attr("class",h.ygrid),e.ygrid.attr("x1",t.axis_rotated?e.y:0).attr("x2",t.axis_rotated?e.y:e.width).attr("y1",t.axis_rotated?0:e.y).attr("y2",t.axis_rotated?e.height:e.y),e.ygrid.exit().remove(),e.smoothLines(e.ygrid,"grid")},u.gridTextAnchor=function(e){return e.position?e.position:"end"},u.gridTextDx=function(e){return"start"===e.position?4:"middle"===e.position?0:-4},u.xGridTextX=function(e){return"start"===e.position?-this.height:"middle"===e.position?-this.height/2:0},u.yGridTextX=function(e){return"start"===e.position?0:"middle"===e.position?this.width/2:this.width},u.updateGrid=function(e){var t,r,n,i=this,a=i.main,o=i.config;i.grid.style("visibility",i.hasArcType()?"hidden":"visible"),a.select("line."+h.xgridFocus).style("visibility","hidden"),o.grid_x_show&&i.updateXGrid(),i.xgridLines=a.select("."+h.xgridLines).selectAll("."+h.xgridLine).data(o.grid_x_lines),t=i.xgridLines.enter().append("g").attr("class",function(e){return h.xgridLine+(e["class"]?" "+e["class"]:"")}),t.append("line").style("opacity",0),t.append("text").attr("text-anchor",i.gridTextAnchor).attr("transform",o.axis_rotated?"":"rotate(-90)").attr("dx",i.gridTextDx).attr("dy",-5).style("opacity",0),i.xgridLines.exit().transition().duration(e).style("opacity",0).remove(),o.grid_y_show&&i.updateYGrid(),i.ygridLines=a.select("."+h.ygridLines).selectAll("."+h.ygridLine).data(o.grid_y_lines),r=i.ygridLines.enter().append("g").attr("class",function(e){return h.ygridLine+(e["class"]?" "+e["class"]:"")}),r.append("line").style("opacity",0),r.append("text").attr("text-anchor",i.gridTextAnchor).attr("transform",o.axis_rotated?"rotate(-90)":"").attr("dx",i.gridTextDx).attr("dy",-5).style("opacity",0),n=i.yv.bind(i),i.ygridLines.select("line").transition().duration(e).attr("x1",o.axis_rotated?n:0).attr("x2",o.axis_rotated?n:i.width).attr("y1",o.axis_rotated?0:n).attr("y2",o.axis_rotated?i.height:n).style("opacity",1),i.ygridLines.select("text").transition().duration(e).attr("x",o.axis_rotated?i.xGridTextX.bind(i):i.yGridTextX.bind(i)).attr("y",n).text(function(e){return e.text}).style("opacity",1),i.ygridLines.exit().transition().duration(e).style("opacity",0).remove()},u.redrawGrid=function(e){var t=this,r=t.config,n=t.xv.bind(t),i=t.xgridLines.select("line"),a=t.xgridLines.select("text");return[(e?i.transition():i).attr("x1",r.axis_rotated?0:n).attr("x2",r.axis_rotated?t.width:n).attr("y1",r.axis_rotated?n:0).attr("y2",r.axis_rotated?n:t.height).style("opacity",1),(e?a.transition():a).attr("x",r.axis_rotated?t.yGridTextX.bind(t):t.xGridTextX.bind(t)).attr("y",n).text(function(e){return e.text}).style("opacity",1)]},u.showXGridFocus=function(e){var t=this,r=t.config,n=e.filter(function(e){return e&&d(e.value)}),i=t.main.selectAll("line."+h.xgridFocus),a=t.xx.bind(t);r.tooltip_show&&(t.hasType("scatter")||t.hasArcType()||(i.style("visibility","visible").data([n[0]]).attr(r.axis_rotated?"y1":"x1",a).attr(r.axis_rotated?"y2":"x2",a),t.smoothLines(i,"grid")))},u.hideXGridFocus=function(){this.main.select("line."+h.xgridFocus).style("visibility","hidden")},u.updateXgridFocus=function(){var e=this,t=e.config;e.main.select("line."+h.xgridFocus).attr("x1",t.axis_rotated?0:-10).attr("x2",t.axis_rotated?e.width:-10).attr("y1",t.axis_rotated?-10:0).attr("y2",t.axis_rotated?-10:e.height)},u.generateGridData=function(e,t){var r,n,i,a,o=this,s=[],u=o.main.select("."+h.axisX).selectAll(".tick").size();if("year"===e)for(r=o.getXDomain(),n=r[0].getFullYear(),i=r[1].getFullYear(),a=n;i>=a;a++)s.push(new Date(a+"-01-01 00:00:00"));else s=t.ticks(10),s.length>u&&(s=s.filter(function(e){return(""+e).indexOf(".")<0}));return s},u.getGridFilterToRemove=function(e){return e?function(t){var r=!1;return[].concat(e).forEach(function(e){("value"in e&&t.value===e.value||"class"in e&&t["class"]===e["class"])&&(r=!0)}),r}:function(){return!0}},u.removeGridLines=function(e,t){var r=this,n=r.config,i=r.getGridFilterToRemove(e),a=function(e){return!i(e)},o=t?h.xgridLines:h.ygridLines,s=t?h.xgridLine:h.ygridLine;r.main.select("."+o).selectAll("."+s).filter(i).transition().duration(n.transition_duration).style("opacity",0).remove(),t?n.grid_x_lines=n.grid_x_lines.filter(a):n.grid_y_lines=n.grid_y_lines.filter(a)},u.initTooltip=function(){var e,t=this,r=t.config;if(t.tooltip=t.selectChart.style("position","relative").append("div").attr("class",h.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),r.tooltip_init_show){if(t.isTimeSeries()&&p(r.tooltip_init_x)){for(r.tooltip_init_x=t.parseDate(r.tooltip_init_x),e=0;e"+(o||0===o?""+o+" |
":"")),s=m(e[a].value,e[a].ratio,e[a].id,e[a].index),void 0!==s&&(u=p(e[a].name,e[a].ratio,e[a].id,e[a].index),l=c.levelColor?c.levelColor(e[a].value):n(e[a].id),i+="",i+=""+u+" | ",i+=""+s+" | ",i+="
"));return i+"