From 1c88fc2fc5da7f8ea5e46f91b6c9d10990bdd1e5 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Thu, 15 Aug 2013 10:03:30 -0700 Subject: [PATCH] Allow submillisecond transition timing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although submillisecond timing probably isn’t important for a single transition, error can accumulate over time with chained transitions, so it’s important to allow submillisecond timing for long-running looped transitions. --- d3.js | 8 ++++---- d3.min.js | 2 +- src/transition/delay.js | 4 ++-- src/transition/duration.js | 4 ++-- test/transition/transition-test-delay.js | 18 ++++++++--------- test/transition/transition-test-duration.js | 22 +++++++++++---------- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/d3.js b/d3.js index 43d108b7dce85..3acacd746e8d9 100644 --- a/d3.js +++ b/d3.js @@ -7777,16 +7777,16 @@ d3 = function() { d3_transitionPrototype.delay = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0; - } : (value |= 0, function(node) { + node.__transition__[id].delay = +value.call(node, node.__data__, i, j); + } : (value = +value, function(node) { node.__transition__[id].delay = value; })); }; d3_transitionPrototype.duration = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0); - } : (value = Math.max(1, value | 0), function(node) { + node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j)); + } : (value = Math.max(1, value), function(node) { node.__transition__[id].duration = value; })); }; diff --git a/d3.min.js b/d3.min.js index a3e92a2a1fb95..cc5e1709178b7 100644 --- a/d3.min.js +++ b/d3.min.js @@ -2,4 +2,4 @@ d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.len return er(n)}function or(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function ar(n,t,e){n.push("C",or(pc,t),",",or(pc,e),",",or(mc,t),",",or(mc,e),",",or(dc,t),",",or(dc,e))}function cr(n,t){return(t[1]-n[1])/(t[0]-n[0])}function lr(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],o=r[0]=cr(i,u);++t9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;++a<=c;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function fr(n){return n.length<3?Xe(n):n[0]+nr(n,sr(n))}function hr(n,t,e,r){var i,u,o,a,c,l,s;return i=r[n],u=i[0],o=i[1],i=r[t],a=i[0],c=i[1],i=r[e],l=i[0],s=i[1],(s-o)*(a-u)-(c-o)*(l-u)>0}function gr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function pr(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-u))/(f*o-a*s);return[i+h*o,c+h*s]}function mr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function dr(n,t){var e={list:n.map(function(n,t){return{index:t,x:n[0],y:n[1]}}).sort(function(n,t){return n.yt.y?1:n.xt.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(n,t){return{edge:n,side:t,vertex:null,l:null,r:null}},insert:function(n,t){t.l=n,t.r=n.r,n.r.l=t,n.r=t},leftBound:function(n){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,n));return t=t.l},del:function(n){n.l.r=n.r,n.r.l=n.l,n.edge=null},right:function(n){return n.r},left:function(n){return n.l},leftRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[n.side]},rightRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[yc[n.side]]}},i={bisect:function(n,t){var e={region:{l:n,r:t},ep:{l:null,r:null}},r=t.x-n.x,i=t.y-n.y,u=r>0?r:-r,o=i>0?i:-i;return e.c=n.x*r+n.y*i+.5*(r*r+i*i),u>o?(e.a=1,e.b=i/r,e.c/=r):(e.b=1,e.a=r/i,e.c/=i),e},intersect:function(n,t){var e=n.edge,r=t.edge;if(!e||!r||e.region.r==r.region.r)return null;var i=e.a*r.b-e.b*r.a;if(Math.abs(i)<1e-10)return null;var u,o,a=(e.c*r.b-r.c*e.b)/i,c=(r.c*e.a-e.c*r.a)/i,l=e.region.r,s=r.region.r;l.y=o.region.r.x;return f&&"l"===u.side||!f&&"r"===u.side?null:{x:a,y:c}},rightOf:function(n,t){var e=n.edge,r=e.region.r,i=t.x>r.x;if(i&&"l"===n.side)return 1;if(!i&&"r"===n.side)return 0;if(1===e.a){var u=t.y-r.y,o=t.x-r.x,a=0,c=0;if(!i&&e.b<0||i&&e.b>=0?c=a=u>=e.b*o:(c=t.x+t.y*e.b>e.c,e.b<0&&(c=!c),c||(a=1)),!a){var l=r.x-e.region.l.x;c=e.b*(o*o-u*u)h*h+g*g}return"l"===n.side?c:!c},endPoint:function(n,e,r){n.ep[e]=r,n.ep[yc[e]]&&t(n)},distance:function(n,t){var e=n.x-t.x,r=n.y-t.y;return Math.sqrt(e*e+r*r)}},u={list:[],insert:function(n,t,e){n.vertex=t,n.ystar=t.y+e;for(var r=0,i=u.list,o=i.length;o>r;r++){var a=i[r];if(!(n.ystar>a.ystar||n.ystar==a.ystar&&t.x>a.vertex.x))break}i.splice(r,0,n)},del:function(n){for(var t=0,e=u.list,r=e.length;r>t&&e[t]!=n;++t);e.splice(t,1)},empty:function(){return 0===u.list.length},nextEvent:function(n){for(var t=0,e=u.list,r=e.length;r>t;++t)if(e[t]==n)return e[t+1];return null},min:function(){var n=u.list[0];return{x:n.vertex.x,y:n.ystar}},extractMin:function(){return u.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var o,a,c,l,s,f,h,g,p,m,d,v,y,M=e.list.shift();;)if(u.empty()||(o=u.min()),M&&(u.empty()||M.yg.y&&(p=h,h=g,g=p,y="r"),v=i.bisect(h,g),f=r.createHalfEdge(v,y),r.insert(l,f),i.endPoint(v,yc[y],d),m=i.intersect(l,f),m&&(u.del(l),u.insert(l,m,i.distance(m,h))),m=i.intersect(f,s),m&&u.insert(f,m,i.distance(m,h))}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function vr(n){return n.x}function yr(n){return n.y}function Mr(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function xr(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var o=.5*(e+i),a=.5*(r+u),c=t.nodes;c[0]&&xr(n,c[0],e,r,o,a),c[1]&&xr(n,c[1],o,r,i,a),c[2]&&xr(n,c[2],e,a,o,u),c[3]&&xr(n,c[3],o,a,i,u)}}function br(n,t){n=Mo.rgb(n),t=Mo.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+lt(Math.round(e+u*n))+lt(Math.round(r+o*n))+lt(Math.round(i+a*n))}}function _r(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Er(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function wr(n,t){return t-=n=+n,function(e){return n+t*e}}function Sr(n,t){var e,r,i,u,o,a=0,c=0,l=[],s=[];for(n+="",t+="",Mc.lastIndex=0,r=0;e=Mc.exec(t);++r)e.index&&l.push(t.substring(a,c=e.index)),s.push({i:l.length,x:e[0]}),l.push(null),a=Mc.lastIndex;for(ar;++r)if(o=s[r],o.x==e[0]){if(o.i)if(null==l[o.i+1])for(l[o.i-1]+=o.x,l.splice(o.i,1),i=r+1;u>i;++i)s[i].i--;else for(l[o.i-1]+=o.x+l[o.i+1],l.splice(o.i,2),i=r+1;u>i;++i)s[i].i-=2;else if(null==l[o.i+1])l[o.i]=o.x;else for(l[o.i]=o.x+l[o.i+1],l.splice(o.i+1,1),i=r+1;u>i;++i)s[i].i--;s.splice(r,1),u--,r--}else o.x=wr(parseFloat(e[0]),parseFloat(o.x));for(;u>r;)o=s.pop(),null==l[o.i+1]?l[o.i]=o.x:(l[o.i]=o.x+l[o.i+1],l.splice(o.i+1,1)),u--;return 1===l.length?null==l[0]?(o=s[0].x,function(n){return o(n)+""}):function(){return t}:function(n){for(r=0;u>r;++r)l[(o=s[r]).i]=o.x(n);return l.join("")}}function Er(n,t){for(var e,r=Mo.interpolators.length;--r>=0&&!(e=Mo.interpolators[r](n,t)););return e}function kr(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(Er(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function Ar(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function Nr(n){return function(t){return 1-n(1-t)}}function Tr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function qr(n){return n*n}function zr(n){return n*n*n}function Cr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Dr(n){return function(t){return Math.pow(t,n)}}function jr(n){return 1-Math.cos(n*Wo/2)}function Lr(n){return Math.pow(2,10*(n-1))}function Hr(n){return 1-Math.sqrt(1-n*n)}function Fr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/(2*Wo)*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Wo/t)}}function Pr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Or(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=Mo.hcl(n),t=Mo.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return G(e+u*n,r+o*n,i+a*n)+""}}function Yr(n,t){n=Mo.hsl(n),t=Mo.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return $(e+u*n,r+o*n,i+a*n)+""}}function Ur(n,t){n=Mo.lab(n),t=Mo.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return nt(e+u*n,r+o*n,i+a*n)+""}}function Ir(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Vr(n){var t=[n.a,n.b],e=[n.c,n.d],r=Xr(t),i=Zr(t,e),u=Xr(Br(e,t,-i))||0;t[0]*e[1]180?s+=360:s-l>180&&(l+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:wr(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:wr(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:e-4,x:wr(g[0],p[0])},{i:e-2,x:wr(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=i.length,function(n){for(var t,u=-1;++ue;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function di(n){return n.reduce(vi,0)}function vi(n,t){return n+t[1]}function yi(n,t){return Mi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Mi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function xi(n){return[Mo.min(n),Mo.max(n)]}function bi(n,t){return n.parent==t.parent?1:2}function _i(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function wi(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function Si(n,t){var e=n.children;if(e&&(i=e.length))for(var r,i,u=-1;++u0&&(n=r);return n}function Ei(n,t){return n.x-t.x}function ki(n,t){return t.x-n.x}function Ai(n,t){return n.depth-t.depth}function Ni(n,t){function e(n,r){var i=n.children;if(i&&(o=i.length))for(var u,o,a=null,c=-1;++c=0;)t=i[u]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function qi(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function zi(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function Ci(n,t){return n.value-t.value}function Di(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function ji(n,t){n._pack_next=t,t._pack_prev=n}function Li(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Hi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,i,u,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(Fi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(u=e[2],Ri(r,i,u),t(u),Di(r,u),r._pack_prev=u,Di(u,i),i=r._pack_next,o=3;l>o;o++){Ri(r,i,u=e[o]);var p=0,m=1,d=1;for(a=i._pack_next;a!==i;a=a._pack_next,m++)if(Li(a,u)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!Li(c,u);c=c._pack_prev,d++);p?(d>m||m==d&&i.ro;o++)u=e[o],u.x-=v,u.y-=y,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Pi)}}function Fi(n){n._pack_next=n._pack_prev=n}function Pi(n){delete n._pack_next,delete n._pack_prev}function Oi(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;++ui&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Bi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function $i(n){return n.rangeExtent?n.rangeExtent():Bi(n.range())}function Wi(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Ji(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function Gi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:Tc}function Ki(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Ki:Wi,c=r?Jr:Wr;return o=i(n,t,c,e),a=i(t,n,c,Er),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Ir)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return ru(n,t)},u.tickFormat=function(t,e){return iu(n,t,e)},u.nice=function(t){return tu(n,t),i()},u.copy=function(){return Qi(n,t,e,r)},i()}function nu(n,t){return Mo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function tu(n,t){return Ji(n,Gi(eu(n,t)[2]))}function eu(n,t){null==t&&(t=10);var e=Bi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function ru(n,t){return Mo.range.apply(Mo,eu(n,t))}function iu(n,t,e){var r=-Math.floor(Math.log(eu(n,t)[2])/Math.LN10+.01);return Mo.format(e?e.replace(ka,function(n,t,e,i,u,o,a,c,l,s){return[t,e,i,u,o,a,c,l||"."+(r-2*("%"===s)),s].join("")}):",."+r+"f")}function uu(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Ji(r.map(i),e?Math:zc);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Bi(r),o=[],a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(u(l)*h);o.push(u(l))}else for(o.push(u(l));l++0;h--)o.push(u(l)*h);for(l=0;o[l]c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return qc;arguments.length<2?t=qc:"function"!=typeof t&&(t=Mo.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/u(c(i(n)+r))<=a?t(n):""}},o.copy=function(){return uu(n.copy(),t,e,r)},nu(o,n)}function ou(n,t,e){function r(t){return n(i(t))}var i=au(t),u=au(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return ru(e,n)},r.tickFormat=function(n,t){return iu(e,n,t)},r.nice=function(n){return r.domain(tu(e,n))},r.exponent=function(o){return arguments.length?(i=au(t=o),u=au(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return ou(n.copy(),t,e)},nu(r,n)}function au(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function cu(n,t){function e(t){return o[((u.get(t)||u.set(t,n.push(t)))-1)%o.length]}function r(t,e){return Mo.range(n.length).map(function(n){return t+e*n})}var u,o,a;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new i;for(var o,a=-1,c=r.length;++ae?[0/0,0/0]:[e>0?i[e-1]:n[0],et?0/0:t/u+n,[t,t+1/u]},r.copy=function(){return su(n,t,e)},i()}function fu(n,t){function e(e){return e>=e?t[Mo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return fu(n,t)},e}function hu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return ru(n,t)},t.tickFormat=function(t,e){return iu(n,t,e)},t.copy=function(){return hu(n)},t}function gu(n){return n.innerRadius}function pu(n){return n.outerRadius}function mu(n){return n.startAngle}function du(n){return n.endAngle}function vu(n){for(var t,e,r,i=-1,u=n.length;++ie?l():(u.active=e,o.event&&o.event.start.call(n,s,t),o.tween.forEach(function(e,r){(r=r.call(n,s,t))&&p.push(r)}),c(r)?1:(bt(c,0,a),void 0))}function c(r){if(u.active!==e)return l();for(var i=(r-h)/g,a=f(i),c=p.length;c>0;)p[--c].call(n,a);return i>=1?(o.event&&o.event.end.call(n,s,t),l()):void 0}function l(){return--u.count?delete u[e]:delete n.__transition__,1}var s=n.__data__,f=o.ease,h=o.delay,g=o.duration,p=[];return r>=h?i(r):(bt(i,h,a),void 0)},0,a)}}function qu(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function zu(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Cu(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Du(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new Wc(e-1)),1),e}function u(n,e){return t(n=new Wc(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{Wc=Cu;var r=new Cu;return r._=n,o(r,t,e)}finally{Wc=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var c=n.utc=ju(n);return c.floor=c,c.round=ju(r),c.ceil=ju(i),c.offset=ju(u),c.range=a,n}function ju(n){return function(t,e){try{Wc=Cu;var r=new Cu;return r._=t,n(r,e)._}finally{Wc=Date}}}function Lu(n,t,e,r){for(var i,u,o=0,a=t.length,c=e.length;a>o;){if(r>=c)return-1;if(i=t.charCodeAt(o++),37===i){if(u=dl[t.charAt(o++)],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function Hu(n){return new RegExp("^(?:"+n.map(Mo.requote).join("|")+")","i")}function Fu(n){for(var t=new i,e=-1,r=n.length;++en?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Ou(n,t,e){al.lastIndex=0;var r=al.exec(t.substring(e));return r?(n.w=cl.get(r[0].toLowerCase()),e+r[0].length):-1}function Ru(n,t,e){ul.lastIndex=0;var r=ul.exec(t.substring(e));return r?(n.w=ol.get(r[0].toLowerCase()),e+r[0].length):-1}function Yu(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Uu(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function Iu(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function Vu(n,t,e){fl.lastIndex=0;var r=fl.exec(t.substring(e));return r?(n.m=hl.get(r[0].toLowerCase()),e+r[0].length):-1}function Zu(n,t,e){ll.lastIndex=0;var r=ll.exec(t.substring(e));return r?(n.m=sl.get(r[0].toLowerCase()),e+r[0].length):-1}function Xu(n,t,e){return Lu(n,ml.c.toString(),t,e)}function Bu(n,t,e){return Lu(n,ml.x.toString(),t,e)}function $u(n,t,e){return Lu(n,ml.X.toString(),t,e)}function Wu(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Ju(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.y=Gu(+r[0]),e+r[0].length):-1}function Gu(n){return n+(n>68?1900:2e3)}function Ku(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qu(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function no(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function to(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function eo(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ro(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function io(n,t,e){vl.lastIndex=0;var r=vl.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function uo(n,t,e){var r=yl.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}function oo(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return e+Pu(r,"0",2)+Pu(i,"0",2)}function ao(n,t,e){gl.lastIndex=0;var r=gl.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function co(n){return n.toISOString()}function lo(n,t,e){function r(t){return n(t)}return r.invert=function(t){return so(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(so)},r.nice=function(n){return r.domain(Ji(r.domain(),n))},r.ticks=function(e,i){var u=Bi(r.domain());if("function"!=typeof e){var o=u[1]-u[0],a=o/e,c=Mo.bisect(xl,a);if(c==xl.length)return t.year(u,e);if(!c)return n.ticks(e).map(so);a/xl[c-1]n?-1:n>t?1:n>=t?0:0/0},Mo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},Mo.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=e);)e=void 0;for(;++ir&&(e=r)}else{for(;++i=e);)e=void 0;for(;++ir&&(e=r)}return e},Mo.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=e);)e=void 0;for(;++ie&&(e=r)}else{for(;++i=e);)e=void 0;for(;++ie&&(e=r)}return e},Mo.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;++u=e);)e=i=void 0;for(;++ur&&(e=r),r>i&&(i=r))}else{for(;++u=e);)e=void 0;for(;++ur&&(e=r),r>i&&(i=r))}return[e,i]},Mo.sum=function(n,t){var e,r=0,i=n.length,u=-1;if(1===arguments.length)for(;++u1&&(t=t.map(e)),t=t.filter(n),t.length?Mo.quantile(t.sort(Mo.ascending),.5):void 0},Mo.bisector=function(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n.call(t,t[u],u)r;){var u=r+i>>>1;er)for(;(i=n+r*++a)>t;)u.push(i/o);else for(;(i=n+r*++a)=o.length)return r?r.call(u,a):e?a.sort(e):a;for(var l,s,f,h,g=-1,p=a.length,m=o[c++],d=new i;++g=o.length)return n;var r=[],i=a[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,u={},o=[],a=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(Mo.map,e,0),0)},u.key=function(n){return o.push(n),u},u.sortKeys=function(n){return a[o.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},Mo.set=function(n){var t=new u;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},r(u,{has:function(n){return qo+n in this},add:function(n){return this[qo+n]=!0,n},remove:function(n){return n=qo+n,n in this&&delete this[n]},values:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===zo&&n.call(this,t.substring(1))}}),Mo.behavior={},Mo.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},Mo.event=null,Mo.requote=function(n){return n.replace(Lo,"\\$&")};var Lo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ho={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Fo=function(n,t){return t.querySelector(n)},Po=function(n,t){return t.querySelectorAll(n)},Oo=bo[a(bo,"matchesSelector")],Ro=function(n,t){return Oo.call(n,t)};"function"==typeof Sizzle&&(Fo=function(n,t){return Sizzle(n,t)[0]||null},Po=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},Ro=Sizzle.matchesSelector),Mo.selection=function(){return Vo};var Yo=Mo.selection.prototype=[];Yo.select=function(n){var t,e,r,i,u=[];n=v(n);for(var o=-1,a=this.length;++o=0&&(e=n.substring(0,t),n=n.substring(t+1)),Uo.hasOwnProperty(e)?{space:Uo[e],local:n}:n}},Yo.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=Mo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(M(t,n[t]));return this}return this.each(M(n,t))},Yo.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=n.trim().split(/^|\s+/g)).length,i=-1;if(t=e.classList){for(;++ir){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(S(e,n[e],t));return this}if(2>r)return _o.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(S(n,t,e))},Yo.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(E(t,n[t]));return this}return this.each(E(n,t))},Yo.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Yo.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Yo.append=function(n){return n=k(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Yo.insert=function(n,t){return n=k(n),t=v(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments))})},Yo.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},Yo.data=function(n,t){function e(n,e){var r,u,o,a=n.length,f=e.length,h=Math.min(a,f),g=new Array(f),p=new Array(f),m=new Array(a);if(t){var d,v=new i,y=new i,M=[];for(r=-1;++rr;++r)p[r]=A(e[r]);for(;a>r;++r)m[r]=n[r]}p.update=g,p.parentNode=g.parentNode=m.parentNode=n.parentNode,c.push(p),l.push(g),s.push(m)}var r,u,o=-1,a=this.length;if(!arguments.length){for(n=new Array(a=(r=this[0]).length);++ou;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a)&&t.push(r)}return d(i)},Yo.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Yo.sort=function(n){n=T.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Yo.size=function(){var n=0;return this.each(function(){++n}),n};var Io=[];Mo.selection.enter=z,Mo.selection.enter.prototype=Io,Io.append=Yo.append,Io.empty=Yo.empty,Io.node=Yo.node,Io.call=Yo.call,Io.size=Yo.size,Io.select=function(n){for(var t,e,r,i,u,o=[],a=-1,c=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(D(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(D(n,t,e))};var Zo=Mo.map({mouseenter:"mouseover",mouseleave:"mouseout"});Zo.forEach(function(n){"on"+n in xo&&Zo.remove(n)});var Xo=a(bo.style,"userSelect"),Bo=0;Mo.mouse=function(n){return F(n,p())};var $o=/WebKit/.test(_o.navigator.userAgent)?-1:0;Mo.touches=function(n,t){return arguments.length<2&&(t=p().touches),t?Do(t).map(function(t){var e=F(n,t);return e.identifier=t.identifier,e}):[]},Mo.behavior.drag=function(){function n(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function t(){return Mo.event.changedTouches[0].identifier}function e(n,t){return Mo.touches(n).filter(function(n){return n.identifier===t})[0]}function r(n,t,e,r){return function(){function o(){if(!s)return a();var n=t(s,g),e=n[0]-m[0],r=n[1]-m[1];d|=e|r,m=n,f({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:e,dy:r})}function a(){v.on(e+"."+p,null).on(r+"."+p,null),y(d&&Mo.event.target===h),f({type:"dragend"})}var c,l=this,s=l.parentNode,f=i.of(l,arguments),h=Mo.event.target,g=n(),p=null==g?"drag":"drag-"+g,m=t(s,g),d=0,v=Mo.select(_o).on(e+"."+p,o).on(r+"."+p,a),y=H();u?(c=u.apply(l,arguments),c=[c.x-m[0],c.y-m[1]]):c=[0,0],f({type:"dragstart"})}}var i=m(n,"drag","dragstart","dragend"),u=null,o=r(s,Mo.mouse,"mousemove","mouseup"),a=r(t,e,"touchmove","touchend");return n.origin=function(t){return arguments.length?(u=t,n):u},Mo.rebind(n,i,"on")};var Wo=Math.PI,Jo=1e-6,Go=Jo*Jo,Ko=Wo/180,Qo=180/Wo,na=Math.SQRT2,ta=2,ea=4;Mo.interpolateZoom=function(n,t){function e(n){var t=n*y;if(v){var e=U(m),o=u/(ta*h)*(e*I(na*t+m)-Y(m));return[r+o*l,i+o*s,u*e/U(na*t+m)]}return[r+n*l,i+n*s,u*Math.exp(na*t)]}var r=n[0],i=n[1],u=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-i,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-u*u+ea*f)/(2*u*ta*h),p=(c*c-u*u-ea*f)/(2*c*ta*h),m=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),v=d-m,y=(v||Math.log(c/u))/na;return e.duration=1e3*y,e},Mo.behavior.zoom=function(){function n(n){n.on(A,l).on(ua+".zoom",f).on(N,h).on("dblclick.zoom",p).on(q,s)}function t(n){return[(n[0]-S.x)/S.k,(n[1]-S.y)/S.k]}function e(n){return[n[0]*S.k+S.x,n[1]*S.k+S.y]}function r(n){S.k=Math.max(k[0],Math.min(k[1],n))}function i(n,t){t=e(t),S.x+=n[0]-t[0],S.y+=n[1]-t[1]}function u(){b&&b.domain(x.range().map(function(n){return(n-S.x)/S.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-S.y)/S.k}).map(_.invert))}function o(n){n({type:"zoomstart"})}function a(n){u(),n({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function c(n){n({type:"zoomend"})}function l(){function n(){s=1,i(Mo.mouse(r),g),a(u)}function e(){f.on(N,_o===r?h:null).on(T,null),p(s&&Mo.event.target===l),c(u)}var r=this,u=D.of(r,arguments),l=Mo.event.target,s=0,f=Mo.select(_o).on(N,n).on(T,e),g=t(Mo.mouse(r)),p=H();ku.call(r),o(u)}function s(){function n(){var n=Mo.touches(m);return p=S.k,h={},n.forEach(function(n){h[n.identifier]=t(n)}),n}function e(){var t=Date.now(),e=n();if(1===e.length){if(500>t-M){var u=e[0],o=h[u.identifier];r(2*S.k),i(u,o),g(),a(d)}M=t}else if(e.length>1){var u=e[0],c=e[1],l=u[0]-c[0],s=u[1]-c[1];v=l*l+s*s}}function u(){var n=Mo.touches(m),t=n[0],e=h[t.identifier];if(u=n[1]){var u,o=h[u.identifier],c=Mo.event.scale;if(null==c){var l=(l=u[0]-t[0])*l+(l=u[1]-t[1])*l;c=v&&Math.sqrt(l/v)}t=[(t[0]+u[0])/2,(t[1]+u[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(c*p)}M=null,i(t,e),a(d)}function f(){Mo.event.touches.length?n():(y.on(z,null).on(C,null),x.on(A,l).on(q,s),b(),c(d))}var h,p,m=this,d=D.of(m,arguments),v=0,y=Mo.select(_o).on(z,u).on(C,f),x=Mo.select(m).on(A,null).on(q,e),b=H();ku.call(m),e(),o(d)}function f(){var n=D.of(this,arguments);y?clearTimeout(y):(ku.call(this),o(n)),y=setTimeout(function(){y=null,c(n)},50),g();var e=v||Mo.mouse(this);d||(d=t(e)),r(Math.pow(2,.002*ra())*S.k),i(e,d),a(n)}function h(){d=null}function p(){var n=D.of(this,arguments),e=Mo.mouse(this),u=t(e),l=Math.log(S.k)/Math.LN2;o(n),r(Math.pow(2,Mo.event.shiftKey?Math.ceil(l)-1:Math.floor(l)+1)),i(e,u),a(n),c(n)}var d,v,y,M,x,b,_,w,S={x:0,y:0,k:1},E=[960,500],k=ia,A="mousedown.zoom",N="mousemove.zoom",T="mouseup.zoom",q="touchstart.zoom",z="touchmove.zoom",C="touchend.zoom",D=m(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=S;Oc?Mo.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1},o(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],i=e/2,u=r/2,o=Mo.interpolateZoom([(i-S.x)/S.k,(u-S.y)/S.k,e/S.k],[(i-t.x)/t.k,(u-t.y)/t.k,e/t.k]);return function(t){var r=o(t),c=e/r[2];this.__chart__=S={x:i-r[0]*c,y:u-r[1]*c,k:c},a(n)}}).each("end.zoom",function(){c(n)}):(this.__chart__=S,o(n),a(n),c(n))})},n.translate=function(t){return arguments.length?(S={x:+t[0],y:+t[1],k:S.k},u(),n):[S.x,S.y]},n.scale=function(t){return arguments.length?(S={x:S.x,y:S.y,k:+t},u(),n):S.k},n.scaleExtent=function(t){return arguments.length?(k=null==t?ia:[+t[0],+t[1]],n):k},n.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],n):v},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.x=function(t){return arguments.length?(b=t,x=t.copy(),S={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),S={x:0,y:0,k:1},n):w},Mo.rebind(n,D,"on")};var ra,ia=[0,1/0],ua="onwheel"in xo?(ra=function(){return-Mo.event.deltaY*(Mo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in xo?(ra=function(){return Mo.event.wheelDelta},"mousewheel"):(ra=function(){return-Mo.event.detail},"MozMousePixelScroll");Z.prototype.toString=function(){return this.rgb()+""},Mo.hsl=function(n,t,e){return 1===arguments.length?n instanceof B?X(n.h,n.s,n.l):st(""+n,ft,X):X(+n,+t,+e)};var oa=B.prototype=new Z;oa.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),X(this.h,this.s,this.l/n)},oa.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),X(this.h,this.s,n*this.l)},oa.rgb=function(){return $(this.h,this.s,this.l)},Mo.hcl=function(n,t,e){return 1===arguments.length?n instanceof J?W(n.h,n.c,n.l):n instanceof Q?tt(n.l,n.a,n.b):tt((n=ht((n=Mo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):W(+n,+t,+e)};var aa=J.prototype=new Z;aa.brighter=function(n){return W(this.h,this.c,Math.min(100,this.l+ca*(arguments.length?n:1)))},aa.darker=function(n){return W(this.h,this.c,Math.max(0,this.l-ca*(arguments.length?n:1)))},aa.rgb=function(){return G(this.h,this.c,this.l).rgb()},Mo.lab=function(n,t,e){return 1===arguments.length?n instanceof Q?K(n.l,n.a,n.b):n instanceof J?G(n.l,n.c,n.h):ht((n=Mo.rgb(n)).r,n.g,n.b):K(+n,+t,+e)};var ca=18,la=.95047,sa=1,fa=1.08883,ha=Q.prototype=new Z;ha.brighter=function(n){return K(Math.min(100,this.l+ca*(arguments.length?n:1)),this.a,this.b)},ha.darker=function(n){return K(Math.max(0,this.l-ca*(arguments.length?n:1)),this.a,this.b)},ha.rgb=function(){return nt(this.l,this.a,this.b)},Mo.rgb=function(n,t,e){return 1===arguments.length?n instanceof ct?at(n.r,n.g,n.b):st(""+n,at,$):at(~~n,~~t,~~e)};var ga=ct.prototype=new Z;ga.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),at(Math.min(255,~~(t/n)),Math.min(255,~~(e/n)),Math.min(255,~~(r/n)))):at(i,i,i)},ga.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),at(~~(n*this.r),~~(n*this.g),~~(n*this.b))},ga.hsl=function(){return ft(this.r,this.g,this.b)},ga.toString=function(){return"#"+lt(this.r)+lt(this.g)+lt(this.b)};var pa=Mo.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});pa.forEach(function(n,t){pa.set(n,ut(t))}),Mo.functor=mt,Mo.xhr=vt(dt),Mo.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var o=Mo.xhr(n,t,u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o.row(e)}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function o(t){return t.map(a).join(n)}function a(n){return c.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var c=new RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(s>=c)return o;if(i)return i=!1,u;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++s;){var r=n.charCodeAt(s++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==l)continue;return n.substring(t,s-a)}return n.substring(t)}for(var r,i,u={},o={},a=[],c=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new u,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(a).join(n)].concat(t.map(function(t){return i.map(function(n){return a(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(o).join("\n")},e},Mo.csv=Mo.dsv(",","text/csv"),Mo.tsv=Mo.dsv(" ","text/tab-separated-values");var ma,da,va,ya,Ma,xa=_o[a(_o,"requestAnimationFrame")]||function(n){setTimeout(n,17)};Mo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={callback:n,time:i,next:null};da?da.next=u:ma=u,da=u,va||(ya=clearTimeout(ya),va=1,xa(xt))},Mo.timer.flush=function(){_t(),wt()};var ba=".",_a=",",wa=[3,3],Sa="$",Ea=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(St);Mo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=Mo.round(n,Et(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),Ea[8+e/3]},Mo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)},Mo.format=function(n){var t=ka.exec(n),e=t[1]||" ",r=t[2]||">",i=t[3]||"",u=t[4]||"",o=t[5],a=+t[6],c=t[7],l=t[8],s=t[9],f=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(o||"0"===e&&"="===r)&&(o=e="0",r="=",c&&(a-=Math.floor((a-1)/4))),s){case"n":c=!0,s="g";break;case"%":f=100,h="%",s="f";break;case"p":f=100,h="%",s="r";break;case"b":case"o":case"x":case"X":"#"===u&&(u="0"+s.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":f=-1,s="r"}"#"===u?u="":"$"===u&&(u=Sa),"r"!=s||l||(s="g"),null!=l&&("g"==s?l=Math.max(1,Math.min(21,l)):("e"==s||"f"==s)&&(l=Math.max(0,Math.min(20,l)))),s=Aa.get(s)||kt;var p=o&&c;return function(n){if(g&&n%1)return"";var t=0>n||0===n&&0>1/n?(n=-n,"-"):i;if(0>f){var m=Mo.formatPrefix(n,l);n=m.scale(n),h=m.symbol}else n*=f;n=s(n,l);var d=n.lastIndexOf("."),v=0>d?n:n.substring(0,d),y=0>d?"":ba+n.substring(d+1);!o&&c&&(v=Na(v));var M=u.length+v.length+y.length+(p?0:t.length),x=a>M?new Array(M=a-M+1).join(e):"";return p&&(v=Na(x+v)),t+=u,n=v+y,("<"===r?t+n+x:">"===r?x+t+n:"^"===r?x.substring(0,M>>=1)+t+n+x.substring(M):t+(p?n:x+n))+h}};var ka=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Aa=Mo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=Mo.round(n,Et(n,t))).toFixed(Math.max(0,Math.min(20,Et(n*(1+1e-15),t))))}}),Na=dt;if(wa){var Ta=wa.length;Na=function(n){for(var t=n.length,e=[],r=0,i=wa[0];t>0&&i>0;)e.push(n.substring(t-=i,t+i)),i=wa[r=(r+1)%Ta];return e.reverse().join(_a)}}Mo.geo={},At.prototype={s:0,t:0,add:function(n){Nt(n,this.t,qa),Nt(qa.s,this.s,this),this.s?this.t+=qa.t:this.s=qa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var qa=new At;Mo.geo.stream=function(n,t){n&&za.hasOwnProperty(n.type)?za[n.type](n,t):Tt(n,t)};var za={Feature:function(n,t){Tt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rn?4*Wo+n:n,La.lineStart=La.lineEnd=La.point=s}};Mo.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=Dt([t*Ko,e*Ko]);if(v){var i=Lt(v,r),u=[i[1],-i[0],0],o=Lt(u,i);Pt(o),o=Ot(o);var c=t-p,l=c>0?1:-1,m=o[0]*Qo*l,d=Math.abs(c)>180;if(d^(m>l*p&&l*t>m)){var y=o[1]*Qo;y>g&&(g=y)}else if(m=(m+360)%360-180,d^(m>l*p&&l*t>m)){var y=-o[1]*Qo;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);v=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,v=null}function i(n,e){if(v){var r=n-p;y+=Math.abs(r)>180?r+(r>0?360:-360):r}else m=n,d=e;La.point(n,e),t(n,e)}function u(){La.lineStart()}function o(){i(m,d),La.lineEnd(),Math.abs(y)>Jo&&(s=-(h=180)),x[0]=s,x[1]=h,v=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nja?(s=-(h=180),f=-(g=90)):y>Jo?g=90:-Jo>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],Mo.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,i=M[0],u=[i];t>r;++r)e=M[r],l(e[0],i)||l(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,p=-1/0,t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>p&&(p=o,s=e[0],h=i[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),Mo.geo.centroid=function(n){Ha=Fa=Pa=Oa=Ra=Ya=Ua=Ia=Va=Za=Xa=0,Mo.geo.stream(n,Ba);var t=Va,e=Za,r=Xa,i=t*t+e*e+r*r;return Go>i&&(t=Ya,e=Ua,r=Ia,Jo>Fa&&(t=Pa,e=Oa,r=Ra),i=t*t+e*e+r*r,Go>i)?[0/0,0/0]:[Math.atan2(e,t)*Qo,R(r/Math.sqrt(i))*Qo]};var Ha,Fa,Pa,Oa,Ra,Ya,Ua,Ia,Va,Za,Xa,Ba={sphere:s,point:Yt,lineStart:It,lineEnd:Vt,polygonStart:function(){Ba.lineStart=Zt},polygonEnd:function(){Ba.lineStart=It}},$a=Wt(Xt,ne,ee,re),Wa=[-Wo,0],Ja=1e9;(Mo.geo.conicEqualArea=function(){return ce(le)}).raw=le,Mo.geo.albers=function(){return Mo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Mo.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=Mo.geo.albers(),o=Mo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Mo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var l=u.scale(),s=+t[0],f=+t[1];return e=u.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Jo,f+.12*l+Jo],[s-.214*l-Jo,f+.234*l-Jo]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Jo,f+.166*l+Jo],[s-.115*l-Jo,f+.234*l-Jo]]).stream(c).point,n},n.scale(1070)};var Ga,Ka,Qa,nc,tc,ec,rc={point:s,lineStart:s,lineEnd:s,polygonStart:function(){Ka=0,rc.lineStart=se},polygonEnd:function(){rc.lineStart=rc.lineEnd=rc.point=s,Ga+=Math.abs(Ka/2)}},ic={point:fe,lineStart:s,lineEnd:s,polygonStart:s,polygonEnd:s},uc={point:pe,lineStart:me,lineEnd:de,polygonStart:function(){uc.lineStart=ve},polygonEnd:function(){uc.point=pe,uc.lineStart=me,uc.lineEnd=de}};Mo.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),Mo.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return Ga=0,Mo.geo.stream(n,i(rc)),Ga},n.centroid=function(n){return Pa=Oa=Ra=Ya=Ua=Ia=Va=Za=Xa=0,Mo.geo.stream(n,i(uc)),Xa?[Va/Xa,Za/Xa]:Ia?[Ya/Ia,Ua/Ia]:Ra?[Pa/Ra,Oa/Ra]:[0/0,0/0]},n.bounds=function(n){return tc=ec=-(Qa=nc=1/0),Mo.geo.stream(n,i(ic)),[[Qa,nc],[tc,ec]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||xe(n):dt,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new he:new ye(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(Mo.geo.albersUsa()).context(null)},Mo.geo.projection=be,Mo.geo.projectionMutator=_e,(Mo.geo.equirectangular=function(){return be(Se)}).raw=Se.invert=Se,Mo.geo.rotation=function(n){function t(t){return t=n(t[0]*Ko,t[1]*Ko),t[0]*=Qo,t[1]*=Qo,t}return n=Ee(n[0]%360*Ko,n[1]*Ko,n.length>2?n[2]*Ko:0),t.invert=function(t){return t=n.invert(t[0]*Ko,t[1]*Ko),t[0]*=Qo,t[1]*=Qo,t},t},Mo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=Ee(-n[0]*Ko,-n[1]*Ko,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Qo,n[1]*=Qo}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=Te((t=+r)*Ko,i*Ko),n):t},n.precision=function(r){return arguments.length?(e=Te(t*Ko,(i=+r)*Ko),n):i},n.angle(90)},Mo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Ko,i=n[1]*Ko,u=t[1]*Ko,o=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(u),f=Math.cos(u);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},Mo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return Mo.range(Math.ceil(u/d)*d,i,d).map(h).concat(Mo.range(Math.ceil(l/v)*v,c,v).map(g)).concat(Mo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return Math.abs(n%d)>Jo}).map(s)).concat(Mo.range(Math.ceil(a/m)*m,o,m).filter(function(n){return Math.abs(n%v)>Jo}).map(f))}var e,r,i,u,o,a,c,l,s,f,h,g,p=10,m=p,d=90,v=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],u>i&&(t=u,u=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[u,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],v=+t[1],n):[d,v]},n.minorStep=function(t){return arguments.length?(p=+t[0],m=+t[1],n):[p,m]},n.precision=function(t){return arguments.length?(y=+t,s=ze(a,o,90),f=Ce(r,e,y),h=ze(l,c,90),g=Ce(u,i,y),n):y},n.majorExtent([[-180,-90+Jo],[180,90-Jo]]).minorExtent([[-180,-80-Jo],[180,80+Jo]])},Mo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=De,i=je;return n.distance=function(){return Mo.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},Mo.geo.interpolate=function(n,t){return Le(n[0]*Ko,n[1]*Ko,t[0]*Ko,t[1]*Ko)},Mo.geo.length=function(n){return oc=0,Mo.geo.stream(n,ac),oc};var oc,ac={sphere:s,point:s,lineStart:He,lineEnd:s,polygonStart:s,polygonEnd:s},cc=Fe(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(Mo.geo.azimuthalEqualArea=function(){return be(cc) }).raw=cc;var lc=Fe(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},dt);(Mo.geo.azimuthalEquidistant=function(){return be(lc)}).raw=lc,(Mo.geo.conicConformal=function(){return ce(Pe)}).raw=Pe,(Mo.geo.conicEquidistant=function(){return ce(Oe)}).raw=Oe;var sc=Fe(function(n){return 1/n},Math.atan);(Mo.geo.gnomonic=function(){return be(sc)}).raw=sc,Mo.geo.identity=function(){function n(n){return n}var t,e=null,r=dt;return n.invert=dt,n.stream=function(n){return t&&(t.valid=!1),t=r(n),t.valid=!0,t},n.clipExtent=function(i){return arguments.length?(e=i,r=i?ue(i[0][0],i[0][1],i[1][0],i[1][1]):dt,t&&(t.valid=!1,t=null),n):e},n},Re.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Wo/2]},(Mo.geo.mercator=function(){return Ye(Re)}).raw=Re;var fc=Fe(function(){return 1},Math.asin);(Mo.geo.orthographic=function(){return be(fc)}).raw=fc;var hc=Fe(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(Mo.geo.stereographic=function(){return be(hc)}).raw=hc,Ue.invert=function(n,t){return[Math.atan2(Y(n),Math.cos(t)),R(Math.sin(t)/U(n))]},(Mo.geo.transverseMercator=function(){return Ye(Ue)}).raw=Ue,Mo.geom={},Mo.svg={},Mo.svg.line=function(){return Ie(dt)};var gc=Mo.map({linear:Xe,"linear-closed":Be,step:$e,"step-before":We,"step-after":Je,basis:er,"basis-open":rr,"basis-closed":ir,bundle:ur,cardinal:Qe,"cardinal-open":Ge,"cardinal-closed":Ke,monotone:fr});gc.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var pc=[0,2/3,1/3,0],mc=[0,1/3,2/3,0],dc=[0,1/6,2/3,1/6];Mo.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i,u,o,a,c,l,s,f,h,g,p,m=mt(e),d=mt(r),v=n.length,y=v-1,M=[],x=[],b=0;if(m===Ve&&r===Ze)t=n;else for(u=0,t=[];v>u;++u)t.push([+m.call(this,i=n[u],u),+d.call(this,i,u)]);for(u=1;v>u;++u)(t[u][1]u;++u)u!==b&&(c=t[u][1]-t[b][1],a=t[u][0]-t[b][0],M.push({angle:Math.atan2(c,a),index:u}));for(M.sort(function(n,t){return n.angle-t.angle}),g=M[0].angle,h=M[0].index,f=0,u=1;y>u;++u){if(o=M[u].index,g==M[u].angle){if(a=t[h][0]-t[b][0],c=t[h][1]-t[b][1],l=t[o][0]-t[b][0],s=t[o][1]-t[b][1],a*a+c*c>=l*l+s*s){M[u].index=-1;continue}M[f].index=-1}g=M[u].angle,f=u,h=o}for(x.push(b),u=0,o=0;2>u;++o)M[o].index>-1&&(x.push(M[o].index),u++);for(p=x.length;y>o;++o)if(!(M[o].index<0)){for(;!hr(x[p-2],x[p-1],M[o].index,t);)--p;x[p++]=M[o].index}var _=[];for(u=p-1;u>=0;--u)_.push(n[x[u]]);return _}var e=Ve,r=Ze;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},Mo.geom.polygon=function(n){return Ho(n,vc),n};var vc=Mo.geom.polygon.prototype=[];vc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],i=0;++ta;a++)e.push([i,t[a],t[a+1]])}),e},Mo.geom.voronoi=function(n){function t(n){var t,u,o,a=n.map(function(){return[]}),c=mt(e),l=mt(r),s=n.length,f=1e6;if(c===Ve&&l===Ze)t=n;else for(t=new Array(s),o=0;s>o;++o)t[o]=[+c.call(this,u=n[o],o),+l.call(this,u,o)];if(dr(t,function(n){var t,e,r,i,u,o;1===n.a&&n.b>=0?(t=n.ep.r,e=n.ep.l):(t=n.ep.l,e=n.ep.r),1===n.a?(u=t?t.y:-f,r=n.c-n.b*u,o=e?e.y:f,i=n.c-n.b*o):(r=t?t.x:-f,u=n.c-n.a*r,i=e?e.x:f,o=n.c-n.a*i);var c=[r,u],l=[i,o];a[n.region.l.index].push(c,l),a[n.region.r.index].push(c,l)}),a=a.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(n){return Math.atan2(n[0]-r,n[1]-i)}),o=Mo.range(n.length).sort(function(n,t){return u[n]-u[t]});return o.filter(function(n,t){return!t||u[n]-u[o[t-1]]>Jo}).map(function(t){return n[t]})}),a.forEach(function(n,e){var r=n.length;if(!r)return n.push([-f,-f],[-f,f],[f,f],[f,-f]);if(!(r>2)){var i=t[e],u=n[0],o=n[1],a=i[0],c=i[1],l=u[0],s=u[1],h=o[0],g=o[1],p=Math.abs(h-l),m=g-s;if(Math.abs(m)c?-f:f;n.push([-f,d],[f,d])}else if(Jo>p){var v=l>a?-f:f;n.push([v,-f],[v,f])}else{var d=(l-a)*(g-s)>(h-l)*(s-c)?f:-f,y=Math.abs(m)-p;Math.abs(y)m?d:-d,d]):(y>0&&(d*=-1),n.push([-f,d],[f,d]))}}}),i)for(o=0;s>o;++o)i.clip(a[o]);for(o=0;s>o;++o)a[o].point=n[o];return a}var e=Ve,r=Ze,i=null;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.clipExtent=function(n){if(!arguments.length)return i&&[i[0],i[2]];if(null==n)i=null;else{var e=+n[0][0],r=+n[0][1],u=+n[1][0],o=+n[1][1];i=Mo.geom.polygon([[e,r],[e,o],[u,o],[u,r]])}return t},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):i&&i[2]},t.links=function(n){var t,i,u,o=n.map(function(){return[]}),a=[],c=mt(e),l=mt(r),s=n.length;if(c===Ve&&l===Ze)t=n;else for(t=new Array(s),u=0;s>u;++u)t[u]=[+c.call(this,i=n[u],u),+l.call(this,i,u)];return dr(t,function(t){var e=t.region.l.index,r=t.region.r.index;o[e][r]||(o[e][r]=o[r][e]=!0,a.push({source:n[e],target:n[r]}))}),a},t.triangles=function(n){if(e===Ve&&r===Ze)return Mo.geom.delaunay(n);for(var t,i=new Array(c),u=mt(e),o=mt(r),a=-1,c=n.length;++a=l,h=r>=s,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=Mr()),f?i=l:a=l,h?o=s:c=s,u(n,t,e,r,i,o,a,c)}var s,f,h,g,p,m,d,v,y,M=mt(a),x=mt(c);if(null!=t)m=t,d=e,v=r,y=i;else if(v=y=-(m=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.xv&&(v=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);m>b&&(m=b),d>_&&(d=_),b>v&&(v=b),_>y&&(y=_),f.push(b),h.push(_)}var w=v-m,S=y-d;w>S?y=d+w:v=m+S;var E=Mr();if(E.add=function(n){u(E,n,+M(n,++g),+x(n,g),m,d,v,y)},E.visit=function(n){xr(n,E,m,d,v,y)},g=-1,null==t){for(;++g=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=bc.get(e)||xc,r=_c.get(r)||dt,Ar(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},Mo.interpolateHcl=Rr,Mo.interpolateHsl=Yr,Mo.interpolateLab=Ur,Mo.interpolateRound=Ir,Mo.transform=function(n){var t=xo.createElementNS(Mo.ns.prefix.svg,"g");return(Mo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Vr(e?e.matrix:wc)})(n)},Vr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var wc={a:1,b:0,c:0,d:1,e:0,f:0};Mo.interpolateTransform=$r,Mo.layout={},Mo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e(i-e)*a){var c=t.charge*a*a;return n.px-=u*c,n.py-=o*c,!0}if(t.point&&isFinite(a)){var c=t.pointCharge*a*a;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=Mo.event.x,n.py=Mo.event.y,a.resume()}var e,r,i,u,o,a={},c=Mo.dispatch("start","tick","end"),l=[1,1],s=.9,f=Sc,h=Ec,g=-30,p=.1,m=.8,d=[],v=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,m,y,M,x,b=d.length,_=v.length;for(e=0;_>e;++e)a=v[e],f=a.source,h=a.target,M=h.x-f.x,x=h.y-f.y,(m=M*M+x*x)&&(m=r*u[e]*((m=Math.sqrt(m))-i[e])/m,M*=m,x*=m,h.x-=M*(y=f.weight/(h.weight+f.weight)),h.y-=x*y,f.x+=M*(y=1-y),f.y+=x*y);if((y=r*p)&&(M=l[0]/2,x=l[1]/2,e=-1,y))for(;++e0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),Mo.timer(a.tick)),a):r},a.start=function(){function n(n,r){for(var i,u=t(e),o=-1,a=u.length;++or;++r)c[r]=[];for(r=0;m>r;++r){var n=v[r];c[n.source.index].push(n.target),c[n.target.index].push(n.source)}}return c[e]}var e,r,c,s,p=d.length,m=v.length,y=l[0],M=l[1];for(e=0;p>e;++e)(s=d[e]).index=e,s.weight=0;for(e=0;m>e;++e)s=v[e],"number"==typeof s.source&&(s.source=d[s.source]),"number"==typeof s.target&&(s.target=d[s.target]),++s.source.weight,++s.target.weight;for(e=0;p>e;++e)s=d[e],isNaN(s.x)&&(s.x=n("x",y)),isNaN(s.y)&&(s.y=n("y",M)),isNaN(s.px)&&(s.px=s.x),isNaN(s.py)&&(s.py=s.y);if(i=[],"function"==typeof f)for(e=0;m>e;++e)i[e]=+f.call(this,v[e],e);else for(e=0;m>e;++e)i[e]=f;if(u=[],"function"==typeof h)for(e=0;m>e;++e)u[e]=+h.call(this,v[e],e);else for(e=0;m>e;++e)u[e]=h;if(o=[],"function"==typeof g)for(e=0;p>e;++e)o[e]=+g.call(this,d[e],e);else for(e=0;p>e;++e)o[e]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Mo.behavior.drag().origin(dt).on("dragstart.force",ni).on("drag.force",t).on("dragend.force",ti)),arguments.length?(this.on("mouseover.force",ei).on("mouseout.force",ri).call(e),void 0):e},Mo.rebind(a,c,"on")};var Sc=20,Ec=1;Mo.layout.hierarchy=function(){function n(t,o,a){var c=i.call(e,t,o);if(t.depth=o,a.push(t),c&&(l=c.length)){for(var l,s,f=-1,h=t.children=[],g=0,p=o+1;++fg;++g)for(i.call(n,l[0][g],p=m[g],s[0][g][1]),h=1;d>h;++h)i.call(n,l[h][g],p+=s[h-1][g][1],s[h][g][1]);return a}var t=dt,e=gi,r=pi,i=hi,u=si,o=fi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ac.get(t)||gi,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:Nc.get(t)||pi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var Ac=Mo.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(mi),u=n.map(di),o=Mo.range(r).sort(function(n,t){return i[n]-i[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=u[e],l.push(e)):(c+=u[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return Mo.range(n.length).reverse()},"default":gi}),Nc=Mo.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,c=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,i,u,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,i=0;s>t;++t)i+=n[t][e][1];for(t=0,u=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}g[e]=c-=i?u/i*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:pi});Mo.layout.histogram=function(){function n(n,u){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,u),f=i.call(this,s,l,u),u=-1,h=l.length,g=f.length-1,p=t?1:1/h;++u0)for(u=-1;++u=s[0]&&a<=s[1]&&(o=c[Mo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[u]));return c}var t=!0,e=Number,r=xi,i=yi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=mt(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return Mi(n,t)}:mt(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},Mo.layout.tree=function(){function n(n,u){function o(n,t){var r=n.children,i=n._tree;if(r&&(u=r.length)){for(var u,a,l,s=r[0],f=s,h=-1;++h0&&(qi(zi(a,n,r),n,i),l+=i,s+=i),f+=a._tree.mod,l+=u._tree.mod,h+=c._tree.mod,s+=o._tree.mod;a&&!wi(o)&&(o._tree.thread=a,o._tree.mod+=f-s),u&&!_i(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=n)}return r}var l=t.call(this,n,u),s=l[0];Ni(s,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),o(s),a(s,-s._tree.prelim);var f=Si(s,ki),h=Si(s,Ei),g=Si(s,Ai),p=f.x-e(f,h)/2,m=h.x+e(h,f)/2,d=g.depth||1;return Ni(s,i?function(n){n.x*=r[0],n.y=n.depth*r[1],delete n._tree}:function(n){n.x=(n.x-p)/(m-p)*r[0],n.y=n.depth/d*r[1],delete n._tree}),l}var t=Mo.layout.hierarchy().sort(null).value(null),e=bi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},Mo.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Ni(a,function(n){n.r=+s(n.value)}),Ni(a,Hi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;Ni(a,function(n){n.r+=f}),Ni(a,Hi),Ni(a,function(n){n.r-=f})}return Oi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=Mo.layout.hierarchy().sort(Ci),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ui(n,e)},Mo.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),c=a[0],l=0;Ni(c,function(n){var t=n.children;t&&t.length?(n.x=Ui(t),n.y=Yi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Ii(c),f=Vi(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Ni(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=Mo.layout.hierarchy().sort(null).value(null),e=bi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},Mo.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++it?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,c,l=f(e),s=[],h=u.slice(),p=1/0,m="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,m))<=p?(h.pop(),p=a):(s.area-=s.pop().area,i(s,m,l,!1),m=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(i(s,m,l,!0),s.length=s.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;u=a.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++oe&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*p/r,r/(t*u*p)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++ue.dx)&&(s=e.dx);++ue&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=Mo.random.normal.apply(Mo,arguments);return function(){return Math.exp(n())}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t/n}}},Mo.scale={};var Tc={floor:dt,ceil:dt};Mo.scale.linear=function(){return Qi([0,1],[0,1],Er,!1)},Mo.scale.log=function(){return uu(Mo.scale.linear().domain([0,1]),10,!0,[1,10])};var qc=Mo.format(".0e"),zc={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};Mo.scale.pow=function(){return ou(Mo.scale.linear(),1,[0,1])},Mo.scale.sqrt=function(){return Mo.scale.pow().exponent(.5)},Mo.scale.ordinal=function(){return cu([],{t:"range",a:[[]]})},Mo.scale.category10=function(){return Mo.scale.ordinal().range(Cc)},Mo.scale.category20=function(){return Mo.scale.ordinal().range(Dc)},Mo.scale.category20b=function(){return Mo.scale.ordinal().range(jc)},Mo.scale.category20c=function(){return Mo.scale.ordinal().range(Lc)};var Cc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ot),Dc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ot),jc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ot),Lc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ot);Mo.scale.quantile=function(){return lu([],[])},Mo.scale.quantize=function(){return su(0,1,[0,1])},Mo.scale.threshold=function(){return fu([.5],[0,1])},Mo.scale.identity=function(){return hu([0,1])},Mo.svg.arc=function(){function n(){var n=t.apply(this,arguments),u=e.apply(this,arguments),o=r.apply(this,arguments)+Hc,a=i.apply(this,arguments)+Hc,c=(o>a&&(c=o,o=a,a=c),a-o),l=Wo>c?"0":"1",s=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a);return c>=Fc?n?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":n?"M"+u*s+","+u*f+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+l+",0 "+n*s+","+n*f+"Z":"M"+u*s+","+u*f+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L0,0"+"Z"}var t=gu,e=pu,r=mu,i=du;return n.innerRadius=function(e){return arguments.length?(t=mt(e),n):t},n.outerRadius=function(t){return arguments.length?(e=mt(t),n):e},n.startAngle=function(t){return arguments.length?(r=mt(t),n):r},n.endAngle=function(t){return arguments.length?(i=mt(t),n):i},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+Hc;return[Math.cos(u)*n,Math.sin(u)*n]},n};var Hc=-Wo/2,Fc=2*Wo-1e-6;Mo.svg.line.radial=function(){var n=Ie(vu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},We.reverse=Je,Je.reverse=We,Mo.svg.area=function(){return yu(dt)},Mo.svg.area.radial=function(){var n=yu(vu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},Mo.svg.chord=function(){function n(n,a){var c=t(this,u,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?i(c.r,c.p1,c.r,c.p0):i(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+i(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=c.call(n,i,r)+Hc,s=l.call(n,i,r)+Hc;return{r:u,a0:o,a1:s,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(s),u*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Wo)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=De,o=je,a=Mu,c=mu,l=du;return n.radius=function(t){return arguments.length?(a=mt(t),n):a},n.source=function(t){return arguments.length?(u=mt(t),n):u},n.target=function(t){return arguments.length?(o=mt(t),n):o},n.startAngle=function(t){return arguments.length?(c=mt(t),n):c},n.endAngle=function(t){return arguments.length?(l=mt(t),n):l},n},Mo.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,c=[u,{x:u.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=De,e=je,r=xu;return n.source=function(e){return arguments.length?(t=mt(e),n):t},n.target=function(t){return arguments.length?(e=mt(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},Mo.svg.diagonal.radial=function(){var n=Mo.svg.diagonal(),t=xu,e=n.projection;return n.projection=function(n){return arguments.length?e(bu(t=n)):t},n},Mo.svg.symbol=function(){function n(n,r){return(Pc.get(t.call(this,n,r))||Su)(e.call(this,n,r))}var t=wu,e=_u;return n.type=function(e){return arguments.length?(t=mt(e),n):t},n.size=function(t){return arguments.length?(e=mt(t),n):e},n};var Pc=Mo.map({circle:Su,cross:function(n){var t=Math.sqrt(n/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(n){var t=Math.sqrt(n/(2*Uc)),e=t*Uc;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Yc),e=t*Yc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Yc),e=t*Yc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});Mo.svg.symbolTypes=Pc.keys();var Oc,Rc,Yc=Math.sqrt(3),Uc=Math.tan(30*Ko),Ic=[],Vc=0;Ic.call=Yo.call,Ic.empty=Yo.empty,Ic.node=Yo.node,Ic.size=Yo.size,Mo.transition=function(n){return arguments.length?Oc?n.transition():n:Vo.transition()},Mo.transition.prototype=Ic,Yo.transition=function(){for(var n,t,e=Oc||++Vc,r=[],i=Rc||{time:Date.now(),ease:Cr,delay:0,duration:250},u=-1,o=this.length;++uu;u++){i.push(t=[]);for(var e=this[u],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a)&&t.push(r)}return Eu(i,this.id)},Ic.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):q(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Ic.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?$r:Er,a=Mo.ns.qualify(n);return Au(this,"attr."+n,t,a.local?u:i)},Ic.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=Mo.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Ic.style=function(n,t,e){function r(){this.style.removeProperty(n)}function i(t){return null==t?r:(t+="",function(){var r,i=_o.getComputedStyle(this,null).getPropertyValue(n);return i!==t&&(r=Er(i,t),function(t){this.style.setProperty(n,r(t),e)})})}var u=arguments.length;if(3>u){if("string"!=typeof n){2>u&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Au(this,"style."+n,t,i)},Ic.styleTween=function(n,t,e){function r(r,i){var u=t.call(this,r,i,_o.getComputedStyle(this,null).getPropertyValue(n));return u&&function(t){this.style.setProperty(n,u(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Ic.text=function(n){return Au(this,"text",n,Nu)},Ic.remove=function(){return this.each("end.transition",function(){var n;this.__transition__.count<2&&(n=this.parentNode)&&n.removeChild(this)})},Ic.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=Mo.ease.apply(Mo,arguments)),q(this,function(e){e.__transition__[t].ease=n -}))},Ic.delay=function(n){var t=this.id;return q(this,"function"==typeof n?function(e,r,i){e.__transition__[t].delay=0|n.call(e,e.__data__,r,i)}:(n|=0,function(e){e.__transition__[t].delay=n}))},Ic.duration=function(n){var t=this.id;return q(this,"function"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,0|n.call(e,e.__data__,r,i))}:(n=Math.max(1,0|n),function(e){e.__transition__[t].duration=n}))},Ic.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Rc,i=Oc;Oc=e,q(this,function(t,r,i){Rc=t.__transition__[e],n.call(t,t.__data__,r,i)}),Rc=r,Oc=i}else q(this,function(r){var i=r.__transition__[e];(i.event||(i.event=Mo.dispatch("start","end"))).on(n,t)});return this},Ic.transition=function(){for(var n,t,e,r,i=this.id,u=++Vc,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],l=0,s=t.length;s>l;l++)(e=t[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Tu(e,l,u,r)),n.push(e)}return Eu(o,u)},Mo.svg.axis=function(){function n(n){n.each(function(){var n,l=Mo.select(this),s=null==c?e.ticks?e.ticks.apply(e,a):e.domain():c,f=null==t?e.tickFormat?e.tickFormat.apply(e,a):dt:t,h=l.selectAll(".tick.major").data(s,dt),g=h.enter().insert("g",".domain").attr("class","tick major").style("opacity",1e-6),p=Mo.transition(h.exit()).style("opacity",1e-6).remove(),m=Mo.transition(h).style("opacity",1),d=$i(e),v=l.selectAll(".domain").data([0]),y=(v.enter().append("path").attr("class","domain"),Mo.transition(v)),M=e.copy(),x=this.__chart__||M;this.__chart__=M,g.append("line"),g.append("text");var b=g.select("line"),_=m.select("line"),w=h.select("text").text(f),S=g.select("text"),E=m.select("text");switch(r){case"bottom":n=qu,b.attr("y2",i),S.attr("y",Math.max(i,0)+o),_.attr("x2",0).attr("y2",i),E.attr("x",0).attr("y",Math.max(i,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),y.attr("d","M"+d[0]+","+u+"V0H"+d[1]+"V"+u);break;case"top":n=qu,b.attr("y2",-i),S.attr("y",-(Math.max(i,0)+o)),_.attr("x2",0).attr("y2",-i),E.attr("x",0).attr("y",-(Math.max(i,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),y.attr("d","M"+d[0]+","+-u+"V0H"+d[1]+"V"+-u);break;case"left":n=zu,b.attr("x2",-i),S.attr("x",-(Math.max(i,0)+o)),_.attr("x2",-i).attr("y2",0),E.attr("x",-(Math.max(i,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),y.attr("d","M"+-u+","+d[0]+"H0V"+d[1]+"H"+-u);break;case"right":n=zu,b.attr("x2",i),S.attr("x",Math.max(i,0)+o),_.attr("x2",i).attr("y2",0),E.attr("x",Math.max(i,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),y.attr("d","M"+u+","+d[0]+"H0V"+d[1]+"H"+u)}if(e.rangeBand){var k=M.rangeBand()/2,A=function(n){return M(n)+k};g.call(n,A),m.call(n,A)}else g.call(n,x),m.call(n,M),p.call(n,M)})}var t,e=Mo.scale.linear(),r=Zc,i=6,u=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Xc?t+"":Zc,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Zc="bottom",Xc={top:1,right:1,bottom:1,left:1};Mo.svg.brush=function(){function n(u){u.each(function(){var u=Mo.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=u.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),u.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=u.selectAll(".resize").data(d,dt);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Bc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=Mo.transition(u),h=Mo.transition(o);c&&(s=$i(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=$i(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){var n=Mo.event.changedTouches;return n?Mo.touches(_,n)[0]:Mo.mouse(_)}function m(){32==Mo.event.keyCode&&(T||(x=null,z[0]-=s[1],z[1]-=f[1],T=2),g())}function d(){32==Mo.event.keyCode&&2==T&&(z[0]+=s[1],z[1]+=f[1],T=0,g())}function v(){var n=i(),u=!1;b&&(n[0]+=b[0],n[1]+=b[1]),T||(Mo.event.altKey?(x||(x=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]g?(i=r,r=g):i=g),m[0]^r|m[1]^i?(e?o=null:u=null,m[0]=r,m[1]=i,!0):void 0}function M(){v(),E.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Mo.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),q(),S({type:"brushend"})}var x,b,_=this,w=Mo.select(Mo.event.target),S=a.of(_,arguments),E=Mo.select(_),k=w.datum(),A=!/^(n|s)$/.test(k)&&c,N=!/^(e|w)$/.test(k)&&l,T=w.classed("extent"),q=H(),z=i(),C=Mo.select(_o).on("keydown.brush",m).on("keyup.brush",d);if(Mo.event.changedTouches?C.on("touchmove.brush",v).on("touchend.brush",M):C.on("mousemove.brush",v).on("mouseup.brush",M),E.interrupt().selectAll("*").interrupt(),T)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var D=+/w$/.test(k),j=+/^n/.test(k);b=[s[1-D]-z[0],f[1-j]-z[1]],z[0]=s[D],z[1]=f[j]}else Mo.event.altKey&&(x=z.slice());E.style("pointer-events","none").selectAll(".resize").style("display",null),Mo.select("body").style("cursor",w.style("cursor")),S({type:"brushstart"}),v()}var u,o,a=m(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,p=!0,d=$c[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:u,j:o},e=this.__chart__||t;this.__chart__=t,Oc?Mo.select(this).transition().each("start.brush",function(){u=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=kr(s,t.x),r=kr(f,t.y);return u=o=null,function(i){s=t.x=e(i),f=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){u=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,d=$c[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,d=$c[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],p=!!t[1]):c?h=!!t:l&&(p=!!t),n):c&&l?[h,p]:c?h:l?p:null},n.extent=function(t){var e,r,i,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),u=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),e^s[0]|r^s[1]&&(s=[0|e,0|r])),l&&(i=t[0],a=t[1],c&&(i=i[1],a=a[1]),o=[i,a],l.invert&&(i=l(i),a=l(a)),i>a&&(h=i,i=a,a=h),i^f[0]|a^f[1]&&(f=[0|i,0|a])),n):(c&&(u?(e=u[0],r=u[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(i=o[0],a=o[1]):(i=f[0],a=f[1],l.invert&&(i=l.invert(i),a=l.invert(a)),i>a&&(h=i,i=a,a=h))),c&&l?[[e,i],[r,a]]:c?[e,r]:l&&[i,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],u=o=null),n},n.empty=function(){return!!c&&s[0]===s[1]||!!l&&f[0]===f[1]},Mo.rebind(n,a,"on")};var Bc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$c=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];Mo.time={};var Wc=Date,Jc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Cu.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(){Gc.setUTCDate.apply(this._,arguments)},setDay:function(){Gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){Gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){Gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){Gc.setTime.apply(this._,arguments)}};var Gc=Date.prototype,Kc="%a %b %e %X %Y",Qc="%m/%d/%Y",nl="%H:%M:%S",tl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],el=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rl=["January","February","March","April","May","June","July","August","September","October","November","December"],il=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Mo.time.year=Du(function(n){return n=Mo.time.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),Mo.time.years=Mo.time.year.range,Mo.time.years.utc=Mo.time.year.utc.range,Mo.time.day=Du(function(n){var t=new Wc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),Mo.time.days=Mo.time.day.range,Mo.time.days.utc=Mo.time.day.utc.range,Mo.time.dayOfYear=function(n){var t=Mo.time.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},Jc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var e=Mo.time[n]=Du(function(n){return(n=Mo.time.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=Mo.time.year(n).getDay();return Math.floor((Mo.time.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});Mo.time[n+"s"]=e.range,Mo.time[n+"s"].utc=e.utc.range,Mo.time[n+"OfYear"]=function(n){var e=Mo.time.year(n).getDay();return Math.floor((Mo.time.dayOfYear(n)+(e+t)%7)/7)}}),Mo.time.week=Mo.time.sunday,Mo.time.weeks=Mo.time.sunday.range,Mo.time.weeks.utc=Mo.time.sunday.utc.range,Mo.time.weekOfYear=Mo.time.sundayOfYear,Mo.time.format=function(n){function t(t){for(var r,i,u,o=[],a=-1,c=0;++a=12?"PM":"AM"},S:function(n,t){return Pu(n.getSeconds(),t,2)},U:function(n,t){return Pu(Mo.time.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Pu(Mo.time.mondayOfYear(n),t,2)},x:Mo.time.format(Qc),X:Mo.time.format(nl),y:function(n,t){return Pu(n.getFullYear()%100,t,2)},Y:function(n,t){return Pu(n.getFullYear()%1e4,t,4)},Z:oo,"%":function(){return"%"}},dl={a:Ou,A:Ru,b:Vu,B:Zu,c:Xu,d:Qu,e:Qu,H:to,I:to,j:no,L:io,m:Ku,M:eo,p:uo,S:ro,U:Uu,w:Yu,W:Iu,x:Bu,X:$u,y:Ju,Y:Wu,"%":ao},vl=/^\s*\d+/,yl=Mo.map({am:0,pm:1});Mo.time.format.utc=function(n){function t(n){try{Wc=Cu;var t=new Wc;return t._=n,e(t)}finally{Wc=Date}}var e=Mo.time.format(n);return t.parse=function(n){try{Wc=Cu;var t=e.parse(n);return t&&t._}finally{Wc=Date}},t.toString=e.toString,t};var Ml=Mo.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");Mo.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?co:Ml,co.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},co.toString=Ml.toString,Mo.time.second=Du(function(n){return new Wc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),Mo.time.seconds=Mo.time.second.range,Mo.time.seconds.utc=Mo.time.second.utc.range,Mo.time.minute=Du(function(n){return new Wc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),Mo.time.minutes=Mo.time.minute.range,Mo.time.minutes.utc=Mo.time.minute.utc.range,Mo.time.hour=Du(function(n){var t=n.getTimezoneOffset()/60;return new Wc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),Mo.time.hours=Mo.time.hour.range,Mo.time.hours.utc=Mo.time.hour.utc.range,Mo.time.month=Du(function(n){return n=Mo.time.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),Mo.time.months=Mo.time.month.range,Mo.time.months.utc=Mo.time.month.utc.range;var xl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],bl=[[Mo.time.second,1],[Mo.time.second,5],[Mo.time.second,15],[Mo.time.second,30],[Mo.time.minute,1],[Mo.time.minute,5],[Mo.time.minute,15],[Mo.time.minute,30],[Mo.time.hour,1],[Mo.time.hour,3],[Mo.time.hour,6],[Mo.time.hour,12],[Mo.time.day,1],[Mo.time.day,2],[Mo.time.week,1],[Mo.time.month,1],[Mo.time.month,3],[Mo.time.year,1]],_l=[[Mo.time.format("%Y"),Xt],[Mo.time.format("%B"),function(n){return n.getMonth()}],[Mo.time.format("%b %d"),function(n){return 1!=n.getDate()}],[Mo.time.format("%a %d"),function(n){return n.getDay()&&1!=n.getDate()}],[Mo.time.format("%I %p"),function(n){return n.getHours()}],[Mo.time.format("%I:%M"),function(n){return n.getMinutes()}],[Mo.time.format(":%S"),function(n){return n.getSeconds()}],[Mo.time.format(".%L"),function(n){return n.getMilliseconds()}]],wl=Mo.scale.linear(),Sl=fo(_l);bl.year=function(n,t){return wl.domain(n.map(go)).ticks(t).map(ho)},Mo.time.scale=function(){return lo(Mo.scale.linear(),bl,Sl)};var El=bl.map(function(n){return[n[0].utc,n[1]]}),kl=[[Mo.time.format.utc("%Y"),Xt],[Mo.time.format.utc("%B"),function(n){return n.getUTCMonth()}],[Mo.time.format.utc("%b %d"),function(n){return 1!=n.getUTCDate()}],[Mo.time.format.utc("%a %d"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[Mo.time.format.utc("%I %p"),function(n){return n.getUTCHours()}],[Mo.time.format.utc("%I:%M"),function(n){return n.getUTCMinutes()}],[Mo.time.format.utc(":%S"),function(n){return n.getUTCSeconds()}],[Mo.time.format.utc(".%L"),function(n){return n.getUTCMilliseconds()}]],Al=fo(kl);return El.year=function(n,t){return wl.domain(n.map(mo)).ticks(t).map(po)},Mo.time.scale.utc=function(){return lo(Mo.scale.linear(),El,Al)},Mo.text=vt(function(n){return n.responseText}),Mo.json=function(n,t){return yt(n,"application/json",vo,t)},Mo.html=function(n,t){return yt(n,"text/html",yo,t)},Mo.xml=vt(function(n){return n.responseXML}),Mo}(); \ No newline at end of file +}))},Ic.delay=function(n){var t=this.id;return q(this,"function"==typeof n?function(e,r,i){e.__transition__[t].delay=+n.call(e,e.__data__,r,i)}:(n=+n,function(e){e.__transition__[t].delay=n}))},Ic.duration=function(n){var t=this.id;return q(this,"function"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,n.call(e,e.__data__,r,i))}:(n=Math.max(1,n),function(e){e.__transition__[t].duration=n}))},Ic.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Rc,i=Oc;Oc=e,q(this,function(t,r,i){Rc=t.__transition__[e],n.call(t,t.__data__,r,i)}),Rc=r,Oc=i}else q(this,function(r){var i=r.__transition__[e];(i.event||(i.event=Mo.dispatch("start","end"))).on(n,t)});return this},Ic.transition=function(){for(var n,t,e,r,i=this.id,u=++Vc,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],l=0,s=t.length;s>l;l++)(e=t[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Tu(e,l,u,r)),n.push(e)}return Eu(o,u)},Mo.svg.axis=function(){function n(n){n.each(function(){var n,l=Mo.select(this),s=null==c?e.ticks?e.ticks.apply(e,a):e.domain():c,f=null==t?e.tickFormat?e.tickFormat.apply(e,a):dt:t,h=l.selectAll(".tick.major").data(s,dt),g=h.enter().insert("g",".domain").attr("class","tick major").style("opacity",1e-6),p=Mo.transition(h.exit()).style("opacity",1e-6).remove(),m=Mo.transition(h).style("opacity",1),d=$i(e),v=l.selectAll(".domain").data([0]),y=(v.enter().append("path").attr("class","domain"),Mo.transition(v)),M=e.copy(),x=this.__chart__||M;this.__chart__=M,g.append("line"),g.append("text");var b=g.select("line"),_=m.select("line"),w=h.select("text").text(f),S=g.select("text"),E=m.select("text");switch(r){case"bottom":n=qu,b.attr("y2",i),S.attr("y",Math.max(i,0)+o),_.attr("x2",0).attr("y2",i),E.attr("x",0).attr("y",Math.max(i,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),y.attr("d","M"+d[0]+","+u+"V0H"+d[1]+"V"+u);break;case"top":n=qu,b.attr("y2",-i),S.attr("y",-(Math.max(i,0)+o)),_.attr("x2",0).attr("y2",-i),E.attr("x",0).attr("y",-(Math.max(i,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),y.attr("d","M"+d[0]+","+-u+"V0H"+d[1]+"V"+-u);break;case"left":n=zu,b.attr("x2",-i),S.attr("x",-(Math.max(i,0)+o)),_.attr("x2",-i).attr("y2",0),E.attr("x",-(Math.max(i,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),y.attr("d","M"+-u+","+d[0]+"H0V"+d[1]+"H"+-u);break;case"right":n=zu,b.attr("x2",i),S.attr("x",Math.max(i,0)+o),_.attr("x2",i).attr("y2",0),E.attr("x",Math.max(i,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),y.attr("d","M"+u+","+d[0]+"H0V"+d[1]+"H"+u)}if(e.rangeBand){var k=M.rangeBand()/2,A=function(n){return M(n)+k};g.call(n,A),m.call(n,A)}else g.call(n,x),m.call(n,M),p.call(n,M)})}var t,e=Mo.scale.linear(),r=Zc,i=6,u=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Xc?t+"":Zc,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Zc="bottom",Xc={top:1,right:1,bottom:1,left:1};Mo.svg.brush=function(){function n(u){u.each(function(){var u=Mo.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=u.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),u.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=u.selectAll(".resize").data(d,dt);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Bc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=Mo.transition(u),h=Mo.transition(o);c&&(s=$i(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=$i(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){var n=Mo.event.changedTouches;return n?Mo.touches(_,n)[0]:Mo.mouse(_)}function m(){32==Mo.event.keyCode&&(T||(x=null,z[0]-=s[1],z[1]-=f[1],T=2),g())}function d(){32==Mo.event.keyCode&&2==T&&(z[0]+=s[1],z[1]+=f[1],T=0,g())}function v(){var n=i(),u=!1;b&&(n[0]+=b[0],n[1]+=b[1]),T||(Mo.event.altKey?(x||(x=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]g?(i=r,r=g):i=g),m[0]^r|m[1]^i?(e?o=null:u=null,m[0]=r,m[1]=i,!0):void 0}function M(){v(),E.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Mo.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),q(),S({type:"brushend"})}var x,b,_=this,w=Mo.select(Mo.event.target),S=a.of(_,arguments),E=Mo.select(_),k=w.datum(),A=!/^(n|s)$/.test(k)&&c,N=!/^(e|w)$/.test(k)&&l,T=w.classed("extent"),q=H(),z=i(),C=Mo.select(_o).on("keydown.brush",m).on("keyup.brush",d);if(Mo.event.changedTouches?C.on("touchmove.brush",v).on("touchend.brush",M):C.on("mousemove.brush",v).on("mouseup.brush",M),E.interrupt().selectAll("*").interrupt(),T)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var D=+/w$/.test(k),j=+/^n/.test(k);b=[s[1-D]-z[0],f[1-j]-z[1]],z[0]=s[D],z[1]=f[j]}else Mo.event.altKey&&(x=z.slice());E.style("pointer-events","none").selectAll(".resize").style("display",null),Mo.select("body").style("cursor",w.style("cursor")),S({type:"brushstart"}),v()}var u,o,a=m(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,p=!0,d=$c[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:u,j:o},e=this.__chart__||t;this.__chart__=t,Oc?Mo.select(this).transition().each("start.brush",function(){u=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=kr(s,t.x),r=kr(f,t.y);return u=o=null,function(i){s=t.x=e(i),f=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){u=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,d=$c[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,d=$c[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],p=!!t[1]):c?h=!!t:l&&(p=!!t),n):c&&l?[h,p]:c?h:l?p:null},n.extent=function(t){var e,r,i,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),u=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),e^s[0]|r^s[1]&&(s=[0|e,0|r])),l&&(i=t[0],a=t[1],c&&(i=i[1],a=a[1]),o=[i,a],l.invert&&(i=l(i),a=l(a)),i>a&&(h=i,i=a,a=h),i^f[0]|a^f[1]&&(f=[0|i,0|a])),n):(c&&(u?(e=u[0],r=u[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(i=o[0],a=o[1]):(i=f[0],a=f[1],l.invert&&(i=l.invert(i),a=l.invert(a)),i>a&&(h=i,i=a,a=h))),c&&l?[[e,i],[r,a]]:c?[e,r]:l&&[i,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],u=o=null),n},n.empty=function(){return!!c&&s[0]===s[1]||!!l&&f[0]===f[1]},Mo.rebind(n,a,"on")};var Bc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$c=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];Mo.time={};var Wc=Date,Jc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Cu.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(){Gc.setUTCDate.apply(this._,arguments)},setDay:function(){Gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){Gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){Gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){Gc.setTime.apply(this._,arguments)}};var Gc=Date.prototype,Kc="%a %b %e %X %Y",Qc="%m/%d/%Y",nl="%H:%M:%S",tl=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],el=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rl=["January","February","March","April","May","June","July","August","September","October","November","December"],il=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Mo.time.year=Du(function(n){return n=Mo.time.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),Mo.time.years=Mo.time.year.range,Mo.time.years.utc=Mo.time.year.utc.range,Mo.time.day=Du(function(n){var t=new Wc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),Mo.time.days=Mo.time.day.range,Mo.time.days.utc=Mo.time.day.utc.range,Mo.time.dayOfYear=function(n){var t=Mo.time.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},Jc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var e=Mo.time[n]=Du(function(n){return(n=Mo.time.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=Mo.time.year(n).getDay();return Math.floor((Mo.time.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});Mo.time[n+"s"]=e.range,Mo.time[n+"s"].utc=e.utc.range,Mo.time[n+"OfYear"]=function(n){var e=Mo.time.year(n).getDay();return Math.floor((Mo.time.dayOfYear(n)+(e+t)%7)/7)}}),Mo.time.week=Mo.time.sunday,Mo.time.weeks=Mo.time.sunday.range,Mo.time.weeks.utc=Mo.time.sunday.utc.range,Mo.time.weekOfYear=Mo.time.sundayOfYear,Mo.time.format=function(n){function t(t){for(var r,i,u,o=[],a=-1,c=0;++a=12?"PM":"AM"},S:function(n,t){return Pu(n.getSeconds(),t,2)},U:function(n,t){return Pu(Mo.time.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Pu(Mo.time.mondayOfYear(n),t,2)},x:Mo.time.format(Qc),X:Mo.time.format(nl),y:function(n,t){return Pu(n.getFullYear()%100,t,2)},Y:function(n,t){return Pu(n.getFullYear()%1e4,t,4)},Z:oo,"%":function(){return"%"}},dl={a:Ou,A:Ru,b:Vu,B:Zu,c:Xu,d:Qu,e:Qu,H:to,I:to,j:no,L:io,m:Ku,M:eo,p:uo,S:ro,U:Uu,w:Yu,W:Iu,x:Bu,X:$u,y:Ju,Y:Wu,"%":ao},vl=/^\s*\d+/,yl=Mo.map({am:0,pm:1});Mo.time.format.utc=function(n){function t(n){try{Wc=Cu;var t=new Wc;return t._=n,e(t)}finally{Wc=Date}}var e=Mo.time.format(n);return t.parse=function(n){try{Wc=Cu;var t=e.parse(n);return t&&t._}finally{Wc=Date}},t.toString=e.toString,t};var Ml=Mo.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");Mo.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?co:Ml,co.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},co.toString=Ml.toString,Mo.time.second=Du(function(n){return new Wc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),Mo.time.seconds=Mo.time.second.range,Mo.time.seconds.utc=Mo.time.second.utc.range,Mo.time.minute=Du(function(n){return new Wc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),Mo.time.minutes=Mo.time.minute.range,Mo.time.minutes.utc=Mo.time.minute.utc.range,Mo.time.hour=Du(function(n){var t=n.getTimezoneOffset()/60;return new Wc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),Mo.time.hours=Mo.time.hour.range,Mo.time.hours.utc=Mo.time.hour.utc.range,Mo.time.month=Du(function(n){return n=Mo.time.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),Mo.time.months=Mo.time.month.range,Mo.time.months.utc=Mo.time.month.utc.range;var xl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],bl=[[Mo.time.second,1],[Mo.time.second,5],[Mo.time.second,15],[Mo.time.second,30],[Mo.time.minute,1],[Mo.time.minute,5],[Mo.time.minute,15],[Mo.time.minute,30],[Mo.time.hour,1],[Mo.time.hour,3],[Mo.time.hour,6],[Mo.time.hour,12],[Mo.time.day,1],[Mo.time.day,2],[Mo.time.week,1],[Mo.time.month,1],[Mo.time.month,3],[Mo.time.year,1]],_l=[[Mo.time.format("%Y"),Xt],[Mo.time.format("%B"),function(n){return n.getMonth()}],[Mo.time.format("%b %d"),function(n){return 1!=n.getDate()}],[Mo.time.format("%a %d"),function(n){return n.getDay()&&1!=n.getDate()}],[Mo.time.format("%I %p"),function(n){return n.getHours()}],[Mo.time.format("%I:%M"),function(n){return n.getMinutes()}],[Mo.time.format(":%S"),function(n){return n.getSeconds()}],[Mo.time.format(".%L"),function(n){return n.getMilliseconds()}]],wl=Mo.scale.linear(),Sl=fo(_l);bl.year=function(n,t){return wl.domain(n.map(go)).ticks(t).map(ho)},Mo.time.scale=function(){return lo(Mo.scale.linear(),bl,Sl)};var El=bl.map(function(n){return[n[0].utc,n[1]]}),kl=[[Mo.time.format.utc("%Y"),Xt],[Mo.time.format.utc("%B"),function(n){return n.getUTCMonth()}],[Mo.time.format.utc("%b %d"),function(n){return 1!=n.getUTCDate()}],[Mo.time.format.utc("%a %d"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[Mo.time.format.utc("%I %p"),function(n){return n.getUTCHours()}],[Mo.time.format.utc("%I:%M"),function(n){return n.getUTCMinutes()}],[Mo.time.format.utc(":%S"),function(n){return n.getUTCSeconds()}],[Mo.time.format.utc(".%L"),function(n){return n.getUTCMilliseconds()}]],Al=fo(kl);return El.year=function(n,t){return wl.domain(n.map(mo)).ticks(t).map(po)},Mo.time.scale.utc=function(){return lo(Mo.scale.linear(),El,Al)},Mo.text=vt(function(n){return n.responseText}),Mo.json=function(n,t){return yt(n,"application/json",vo,t)},Mo.html=function(n,t){return yt(n,"text/html",yo,t)},Mo.xml=vt(function(n){return n.responseXML}),Mo}(); \ No newline at end of file diff --git a/src/transition/delay.js b/src/transition/delay.js index 4da3ae20ce6b2..8f12707a06637 100644 --- a/src/transition/delay.js +++ b/src/transition/delay.js @@ -4,6 +4,6 @@ import "transition"; d3_transitionPrototype.delay = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" - ? function(node, i, j) { node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0; } - : (value |= 0, function(node) { node.__transition__[id].delay = value; })); + ? function(node, i, j) { node.__transition__[id].delay = +value.call(node, node.__data__, i, j); } + : (value = +value, function(node) { node.__transition__[id].delay = value; })); }; diff --git a/src/transition/duration.js b/src/transition/duration.js index c121b1a5c14af..dd45c37230989 100644 --- a/src/transition/duration.js +++ b/src/transition/duration.js @@ -4,6 +4,6 @@ import "transition"; d3_transitionPrototype.duration = function(value) { var id = this.id; return d3_selection_each(this, typeof value === "function" - ? function(node, i, j) { node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0); } - : (value = Math.max(1, value | 0), function(node) { node.__transition__[id].duration = value; })); + ? function(node, i, j) { node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j)); } + : (value = Math.max(1, value), function(node) { node.__transition__[id].duration = value; })); }; diff --git a/test/transition/transition-test-delay.js b/test/transition/transition-test-delay.js index 8b869accc2b77..e721c3619e13e 100644 --- a/test/transition/transition-test-delay.js +++ b/test/transition/transition-test-delay.js @@ -25,18 +25,18 @@ module.exports = { assert.strictEqual(t[0][0].__transition__[t.id].delay, -250); assert.strictEqual(t[0][1].__transition__[t.id].delay, -250); }, - "NaN delays are treated as 0ms": function(selection) { - var t = selection.transition().delay(NaN); - assert.strictEqual(t[0][0].__transition__[t.id].delay, 0); - assert.strictEqual(t[0][1].__transition__[t.id].delay, 0); + "delay is coerced to a number": function(selection) { + var t = selection.transition().delay("520"); + assert.strictEqual(t[0][0].__transition__[t.id].delay, 520); + assert.strictEqual(t[0][1].__transition__[t.id].delay, 520); }, - "floating-point durations are floored to integers": function(selection) { + "floating-point durations are not floored to integers": function(selection) { var t = selection.transition().delay(14.6); - assert.strictEqual(t[0][0].__transition__[t.id].delay, 14); - assert.strictEqual(t[0][1].__transition__[t.id].delay, 14); + assert.strictEqual(t[0][0].__transition__[t.id].delay, 14.6); + assert.strictEqual(t[0][1].__transition__[t.id].delay, 14.6); var t = selection.transition().delay("16.99"); - assert.strictEqual(t[0][0].__transition__[t.id].delay, 16); - assert.strictEqual(t[0][1].__transition__[t.id].delay, 16); + assert.strictEqual(t[0][0].__transition__[t.id].delay, 16.99); + assert.strictEqual(t[0][1].__transition__[t.id].delay, 16.99); }, "can specify delay as a function": function(selection) { var dd = [], ii = [], tt = [], t = selection.transition().delay(f); diff --git a/test/transition/transition-test-duration.js b/test/transition/transition-test-duration.js index 94e697ffcc8d5..34fc2dc6de85c 100644 --- a/test/transition/transition-test-duration.js +++ b/test/transition/transition-test-duration.js @@ -20,11 +20,8 @@ module.exports = { assert.strictEqual(t[0][0].__transition__[t.id].duration, 50); assert.strictEqual(t[0][1].__transition__[t.id].duration, 50); }, - "NaN, zero, or negative durations are treated as 1ms": function(selection) { - var t = selection.transition().duration(NaN); - assert.strictEqual(t[0][0].__transition__[t.id].duration, 1); - assert.strictEqual(t[0][1].__transition__[t.id].duration, 1); - t.duration(0); + "zero or negative durations are treated as 1ms": function(selection) { + var t = selection.transition().duration(0); assert.strictEqual(t[0][0].__transition__[t.id].duration, 1); assert.strictEqual(t[0][1].__transition__[t.id].duration, 1); t.duration(-10); @@ -34,13 +31,18 @@ module.exports = { assert.strictEqual(t[0][0].__transition__[t.id].duration, 1); assert.strictEqual(t[0][1].__transition__[t.id].duration, 1); }, - "floating-point durations are floored to integers": function(selection) { + "duration is coerced to a number": function(selection) { + var t = selection.transition().duration("520"); + assert.strictEqual(t[0][0].__transition__[t.id].duration, 520); + assert.strictEqual(t[0][1].__transition__[t.id].duration, 520); + }, + "floating-point durations are not floored to integers": function(selection) { var t = selection.transition().duration(14.6); - assert.strictEqual(t[0][0].__transition__[t.id].duration, 14); - assert.strictEqual(t[0][1].__transition__[t.id].duration, 14); + assert.strictEqual(t[0][0].__transition__[t.id].duration, 14.6); + assert.strictEqual(t[0][1].__transition__[t.id].duration, 14.6); var t = selection.transition().duration("16.99"); - assert.strictEqual(t[0][0].__transition__[t.id].duration, 16); - assert.strictEqual(t[0][1].__transition__[t.id].duration, 16); + assert.strictEqual(t[0][0].__transition__[t.id].duration, 16.99); + assert.strictEqual(t[0][1].__transition__[t.id].duration, 16.99); }, "can specify duration as a function": function(selection) { var dd = [], ii = [], tt = [], t = selection.transition().duration(f);