From a9c92fcff23863e71bb40d6ba790ee5926c4dea4 Mon Sep 17 00:00:00 2001 From: lxsang Date: Tue, 12 Jan 2021 14:58:49 +0100 Subject: [PATCH] rename JarvisControl to SystemControl --- JarvisControl/assets/scheme.html | 22 - JarvisControl/build/debug/main.js | 1 - JarvisControl/build/debug/scheme.html | 22 - JarvisControl/build/release/JarvisControl.zip | Bin 292705 -> 0 bytes JarvisControl/coffees/JarvisService.coffee | 90 - JarvisControl/coffees/main.coffee | 99 - JarvisControl/project.json | 7 - {JarvisControl => SystemControl}/README.md | 0 SystemControl/assets/scheme.html | 33 + .../build/debug/README.md | 0 .../build/debug/main.css | 39 + SystemControl/build/debug/main.js | 13769 ++++++++++++++++ .../build/debug}/package.json | 13 +- SystemControl/build/debug/scheme.html | 33 + SystemControl/coffees/SysmondService.coffee | 77 + SystemControl/coffees/main.coffee | 146 + .../css/epoch.css | 0 SystemControl/css/main.css | 38 + .../javascripts/d3.v3.js | 0 .../javascripts/d3.v5.js | 0 .../javascripts/epoch.js | 0 .../debug => SystemControl}/package.json | 13 +- SystemControl/project.json | 7 + 23 files changed, 14158 insertions(+), 251 deletions(-) delete mode 100644 JarvisControl/assets/scheme.html delete mode 100644 JarvisControl/build/debug/main.js delete mode 100644 JarvisControl/build/debug/scheme.html delete mode 100644 JarvisControl/build/release/JarvisControl.zip delete mode 100644 JarvisControl/coffees/JarvisService.coffee delete mode 100644 JarvisControl/coffees/main.coffee delete mode 100644 JarvisControl/project.json rename {JarvisControl => SystemControl}/README.md (100%) create mode 100644 SystemControl/assets/scheme.html rename {JarvisControl => SystemControl}/build/debug/README.md (100%) rename {JarvisControl => SystemControl}/build/debug/main.css (98%) create mode 100644 SystemControl/build/debug/main.js rename {JarvisControl => SystemControl/build/debug}/package.json (51%) create mode 100644 SystemControl/build/debug/scheme.html create mode 100644 SystemControl/coffees/SysmondService.coffee create mode 100644 SystemControl/coffees/main.coffee rename {JarvisControl => SystemControl}/css/epoch.css (100%) create mode 100644 SystemControl/css/main.css rename {JarvisControl => SystemControl}/javascripts/d3.v3.js (100%) rename {JarvisControl => SystemControl}/javascripts/d3.v5.js (100%) rename {JarvisControl => SystemControl}/javascripts/epoch.js (100%) rename {JarvisControl/build/debug => SystemControl}/package.json (51%) create mode 100644 SystemControl/project.json diff --git a/JarvisControl/assets/scheme.html b/JarvisControl/assets/scheme.html deleted file mode 100644 index 38e48dd..0000000 --- a/JarvisControl/assets/scheme.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -
- -
-
- - -
- -
- -
-
-
-
- -
-
\ No newline at end of file diff --git a/JarvisControl/build/debug/main.js b/JarvisControl/build/debug/main.js deleted file mode 100644 index 9bdacd9..0000000 --- a/JarvisControl/build/debug/main.js +++ /dev/null @@ -1 +0,0 @@ -var t,n,e;(function(){var t,n;n=class extends OS.application.BaseService{constructor(t){super("JarvisService",t),this.text=__("Jarvis({0}%)",(0).toString()),this.iconclass="fa fa-android",this.nodes=[{text:__("Status"),id:1},{text:__("Shutdown"),id:3},{text:__("Reboot"),id:4},{text:__("Exit service"),id:2}],this.onchildselect=t=>this.action(t)}init(){var t;return t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.sub=new Antunnel.Subscriber("notification"),this.sub.onopen=()=>console.log("Subscribed to notification channel"),this.sub.onerror=t=>this.error(__("Error: {0}",new TextDecoder("utf-8").decode(t.data)),t),this.sub.onmessage=t=>{var n;return t.data&&(n=JSON.parse(new TextDecoder("utf-8").decode(t.data))),this.text=__("Jarvis({0}%)",Math.round(n.battery_percent).toString()),this.update()},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Unsubscribed to the notification service")),this.quit()),Antunnel.tunnel.subscribe(this.sub)):(this.error(__("The Antunnel service is not started, please start it first")),this._gui.pushService("Antunnel/AntunnelService").catch(t=>this.error(t.toString(),t)),this.quit()),window.Antunnel?t():(console.log("require Antunnel"),this._api.requires("pkg://Antunnel/main.js").then(()=>t()).catch(t=>(this.error(__("Unable to load Antunnel: {0}",t.toString()),t),this.quit())))}action(t){switch(t.data.item.data.id){case 1:return this._gui.launch("JarvisControl",[]);case 2:return this.quit();case 3:return this.execute("poweroff");case 4:return this.execute("reboot")}}execute(t){var n;if(this.tunnel)return(n=new Antunnel.Subscriber("jarvis_control")).onopen=()=>(console.log("Subscribed to jarvis_control channel. Send the command"),n.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t)),n.close()),n.onerror=t=>this.error(__("Error: {0}",new TextDecoder("utf-8").decode(t.data)),t),n.onclose=()=>this.notify(__("Unsubscribed to the jarvis_control service")),this.tunnel.subscribe(n)}awake(){}cleanup(){if(this.sub)return this.sub.close()}},this.OS.register("JarvisService",n),(t=class extends this.OS.application.BaseApplication{constructor(t){super("JarvisControl",t)}main(){var t;return this.batterychart=$(this.find("battery-area")).epoch({type:"time.line",axes:["bottom","left","right"],range:[2500,4300],data:[{label:"Battery",values:[]}]}),this.tempchart=$(this.find("temp-area")).epoch({type:"time.line",axes:["bottom","left","right"],range:[0,100],data:[{label:"Temperature",values:[]}]}),this.memchart=$(this.find("mem-area")).epoch({type:"time.gauge",value:0}),this.diskchart=$(this.find("disk-area")).epoch({type:"time.gauge",value:0}),this.cpuchart=$(this.find("cpu-area")).epoch({type:"time.gauge",value:0}),t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.sub=new Antunnel.Subscriber("notification"),this.sub.onopen=()=>(console.log("Subscribed to notification channel"),this._gui.pushService("JarvisControl/JarvisService")),this.sub.onerror=t=>this.error(__("Error: {0}",new TextDecoder("utf-8").decode(t.data)),t),this.sub.onmessage=t=>{var n;return t.data&&(n=JSON.parse(new TextDecoder("utf-8").decode(t.data))),this.display(n)},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Unsubscribed to the notification service")),this.quit()),Antunnel.tunnel.subscribe(this.sub)):(this.error(__("The Antunnel service is not started, please start it first")).catch(t=>this.error(t.toString(),t)),this.quit()),this.on("resize",()=>{var t;return t=this.find("battery-area"),this.batterychart.option("width",$(t).width()),this.batterychart.option("height",$(t).height()),t=this.find("temp-area"),this.tempchart.option("width",$(t).width()),this.tempchart.option("height",$(t).height())}),t()}display(t){var n,e,r;return r=parseFloat(t.mem.match(/([0-9\.]+)%/)[1]),this.memchart.push(r/100),this.find("mem-text").text=t.mem,e=parseFloat(t.disk.match(/([0-9\.]+)%/)[1]),this.diskchart.push(e/100),this.find("disk-text").text=t.disk,n=parseFloat(t.cpu.match(/([0-9\.]+)$/)[1]),this.cpuchart.push(n/100),this.find("cpu-text").text=t.cpu,this.batterychart.push([{time:(new Date).timestamp(),y:t.battery}]),this.find("bat-text").text=__("Battery Usage: {0} mv ({1}%)",t.battery,Math.round(t.battery_percent)),this.tempchart.push([{time:(new Date).timestamp(),y:t.temp}]),this.find("temp-text").text=__("CPU temperature: {0} C",t.temp)}cleanup(){if(this.sub)return this.sub.close()}}).singleton=!0,this.OS.register("JarvisControl",t)}).call(this),function(){var t={version:"3.5.17"},n=[].slice,e=function(t){return n.call(t)},r=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(r)try{e(r.documentElement.childNodes)[0].nodeType}catch(t){e=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),r)try{r.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var a=this.Element.prototype,u=a.setAttribute,s=a.setAttributeNS,l=this.CSSStyleDeclaration.prototype,c=l.setProperty;a.setAttribute=function(t,n){u.call(this,t,n+"")},a.setAttributeNS=function(t,n,e){s.call(this,t,n,e+"")},l.setProperty=function(t,n,e){c.call(this,t,n+"",e)}}function h(t,n){return tn?1:t>=n?0:NaN}function f(t){return null===t?NaN:+t}function p(t){return!isNaN(t)}function g(t){return{left:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}t.ascending=h,t.descending=function(t,n){return nt?1:n>=t?0:NaN},t.min=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},t.max=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},t.extent=function(t,n){var e,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return a/(s-1)},t.deviation=function(){var n=t.variance.apply(this,arguments);return n?Math.sqrt(n):n};var d=g(h);function y(t){return t.length}t.bisectLeft=d.left,t.bisect=t.bisectRight=d.right,t.bisector=function(t){return g(1===t.length?function(n,e){return h(t(n),e)}:t)},t.shuffle=function(t,n,e){(o=arguments.length)<3&&(e=t.length,o<2&&(n=0));for(var r,i,o=e-n;o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},t.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},t.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],i=new Array(e<0?0:e);n=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e};var v=Math.abs;function m(t){for(var n=1;t*n%1;)n*=10;return n}function x(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function _(){this._=Object.create(null)}function w(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function b(t){return"\0"===(t+="")[0]?t.slice(1):t}function M(t){return w(t)in this._}function k(t){return(t=w(t))in this._&&delete this._[t]}function E(){var t=[];for(var n in this._)t.push(b(n));return t}function S(){var t=0;for(var n in this._)++t;return t}function A(){for(var t in this._)return!1;return!0}function C(){this._=Object.create(null)}function N(t){return t}function T(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function F(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.slice(1);for(var e=0,r=L.length;en;)i.push(r/o);else for(;(r=t+e*++a)=i.length)return e?e.call(r,o):n?o.sort(n):o;for(var s,l,c,h,f=-1,p=o.length,g=i[u++],d=new _;++f=i.length)return n;var r=[],a=o[e++];return n.forEach((function(n,i){r.push({key:n,values:t(i,e)})})),a?r.sort((function(t,n){return a(t.key,n.key)})):r}(a(t.map,n,0),0)},r.key=function(t){return i.push(t),r},r.sortKeys=function(t){return o[i.length-1]=t,r},r.sortValues=function(t){return n=t,r},r.rollup=function(t){return e=t,r},r},t.set=function(t){var n=new C;if(t)for(var e=0,r=t.length;e=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},t.event=null,t.requote=function(t){return t.replace(O,"\\$&")};var O=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,I={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function j(t){return I(t,Y),t}var H=function(t,n){return n.querySelector(t)},V=function(t,n){return n.querySelectorAll(t)},B=function(t,n){var e=t.matches||t[F(t,"matchesSelector")];return(B=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(H=function(t,n){return Sizzle(t,n)[0]||null},V=Sizzle,B=Sizzle.matchesSelector),t.selection=function(){return t.select(r.documentElement)};var Y=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return H(t,this)}}function Z(t){return"function"==typeof t?t:function(){return V(t,this)}}Y.select=function(t){var n,e,r,i,o=[];t=W(t);for(var a=-1,u=this.length;++a=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),X.hasOwnProperty(e)?{space:X[e],local:t}:t}},Y.attr=function(n,e){if(arguments.length<2){if("string"==typeof n){var r=this.node();return(n=t.ns.qualify(n)).local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}for(e in n)this.each(J(e,n[e]));return this}return this.each(J(n,e))},Y.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=K(t)).length,i=-1;if(n=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Y.sort=function(t){t=st.apply(this,arguments);for(var n=-1,e=this.length;++n=n&&(n=i+1);!(a=u[n])&&++n0&&(n=n.slice(0,a));var s=gt.get(n);function l(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}return s&&(n=s,u=yt),a?r?function(){var t=u(r,e(arguments));l.call(this),this.addEventListener(n,this[o]=t,t.$=i),t._=r}:l:r?D:function(){var e,r=new RegExp("^__on([^.]+)"+t.requote(n)+"$");for(var i in this)if(e=i.match(r)){var o=this[i];this.removeEventListener(e[1],o,o.$),delete this[i]}}}t.selection.enter=ct,t.selection.enter.prototype=ht,ht.append=Y.append,ht.empty=Y.empty,ht.node=Y.node,ht.call=Y.call,ht.size=Y.size,ht.select=function(t){for(var n,e,r,i,o,a=[],u=-1,s=this.length;++u0?1:t<0?-1:0}function Lt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function Dt(t){return t>1?0:t<-1?Et:Math.acos(t)}function zt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Pt(t){return(t=Math.sin(t/2))*t}var qt=Math.SQRT2;t.interpolateZoom=function(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],s=n[1],l=n[2],c=u-i,h=s-o,f=c*c+h*h;if(f0&&(n=n.transition().duration(d)),n.call(b.event)}function A(){l&&l.domain(s.range().map((function(t){return(t-f.x)/f.k})).map(s.invert)),h&&h.domain(c.range().map((function(t){return(t-f.y)/f.k})).map(c.invert))}function C(t){y++||t({type:"zoomstart"})}function N(t){A(),t({type:"zoom",scale:f.k,translate:[f.x,f.y]})}function T(t){--y||(t({type:"zoomend"}),e=null)}function F(){var n=this,e=w.of(n,arguments),r=0,i=t.select(o(n)).on(m,s).on(x,l),a=M(t.mouse(n)),u=xt(n);function s(){r=1,E(t.mouse(n),a),N(e)}function l(){i.on(m,null).on(x,null),u(r),T(e)}du.call(n),C(e)}function L(){var n,e=this,r=w.of(e,arguments),i={},o=0,a=".zoom-"+t.event.changedTouches[0].identifier,s="touchmove"+a,l="touchend"+a,c=[],h=t.select(e),p=xt(e);function g(){var r=t.touches(e);return n=f.k,r.forEach((function(t){t.identifier in i&&(i[t.identifier]=M(t))})),r}function d(){var n=t.event.target;t.select(n).on(s,y).on(l,m),c.push(n);for(var r=t.event.changedTouches,a=0,h=r.length;a1){v=p[0];var x=p[1],_=v[0]-x[0],w=v[1]-x[1];o=_*_+w*w}}function y(){var a,s,l,c,h=t.touches(e);du.call(e);for(var f=0,p=h.length;f360?t-=360:t<0&&(t+=360),t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)||n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(i=e<=.5?e*(1+n):e+n-e*n),new en(o(t+120),o(t),o(t-120))}function Yt(n,e,r){return this instanceof Yt?(this.h=+n,this.c=+e,void(this.l=+r)):arguments.length<2?n instanceof Yt?new Yt(n.h,n.c,n.l):Qt(n instanceof $t?n.l:(n=cn((n=t.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new Yt(n,e,r)}Vt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,this.l/t)},Vt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,t*this.l)},Vt.rgb=function(){return Bt(this.h,this.s,this.l)},t.hcl=Yt;var Wt=Yt.prototype=new jt;function Zt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new $t(e,Math.cos(t*=Nt)*n,Math.sin(t)*n)}function $t(t,n,e){return this instanceof $t?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof $t?new $t(t.l,t.a,t.b):t instanceof Yt?Zt(t.h,t.c,t.l):cn((t=en(t)).r,t.g,t.b):new $t(t,n,e)}Wt.brighter=function(t){return new Yt(this.h,this.c,Math.min(100,this.l+Xt*(arguments.length?t:1)))},Wt.darker=function(t){return new Yt(this.h,this.c,Math.max(0,this.l-Xt*(arguments.length?t:1)))},Wt.rgb=function(){return Zt(this.h,this.c,this.l).rgb()},t.lab=$t;var Xt=18,Jt=$t.prototype=new jt;function Gt(t,n,e){var r=(t+16)/116,i=r+n/500,o=r-e/200;return new en(nn(3.2404542*(i=.95047*Kt(i))-1.5371385*(r=1*Kt(r))-.4985314*(o=1.08883*Kt(o))),nn(-.969266*i+1.8760108*r+.041556*o),nn(.0556434*i-.2040259*r+1.0572252*o))}function Qt(t,n,e){return t>0?new Yt(Math.atan2(e,n)*Tt,Math.sqrt(n*n+e*e),t):new Yt(NaN,NaN,t)}function Kt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function tn(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function nn(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function en(t,n,e){return this instanceof en?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof en?new en(t.r,t.g,t.b):sn(""+t,en,Bt):new en(t,n,e)}function rn(t){return new en(t>>16,t>>8&255,255&t)}function on(t){return rn(t)+""}Jt.brighter=function(t){return new $t(Math.min(100,this.l+Xt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new $t(Math.max(0,this.l-Xt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return Gt(this.l,this.a,this.b)},t.rgb=en;var an=en.prototype=new jt;function un(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function sn(t,n,e){var r,i,o,a=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return n(fn(i[0]),fn(i[1]),fn(i[2]))}return(o=pn.get(t))?n(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a|=a>>4,u=240&o,u|=u>>4,s=15&o,s|=s<<4):7===t.length&&(a=(16711680&o)>>16,u=(65280&o)>>8,s=255&o)),n(a,u,s))}function ln(t,n,e){var r,i,o=Math.min(t/=255,n/=255,e/=255),a=Math.max(t,n,e),u=a-o,s=(a+o)/2;return u?(i=s<.5?u/(a+o):u/(2-a-o),r=t==a?(n-e)/u+(n0&&s<1?0:r),new Ht(r,i,s)}function cn(t,n,e){var r=tn((.4124564*(t=hn(t))+.3575761*(n=hn(n))+.1804375*(e=hn(e)))/.95047),i=tn((.2126729*t+.7151522*n+.072175*e)/1);return $t(116*i-16,500*(r-i),200*(i-tn((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function hn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}an.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,i=30;return n||e||r?(n&&n=200&&n<300||304===n){try{t=i.call(a,l)}catch(t){return void u.error.call(a,t)}u.load.call(a,t)}else u.error.call(a,l)}return this.XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(n)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=h:l.onreadystatechange=function(){l.readyState>3&&h()},l.onprogress=function(n){var e=t.event;t.event=n;try{u.progress.call(a,l)}finally{t.event=e}},a.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==n?delete s[t]:s[t]=n+"",a)},a.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",a):r},a.responseType=function(t){return arguments.length?(c=t,a):c},a.response=function(t){return i=t,a},["get","post"].forEach((function(t){a[t]=function(){return a.send.apply(a,[t].concat(e(arguments)))}})),a.send=function(t,e,i){if(2===arguments.length&&"function"==typeof e&&(i=e,e=null),l.open(t,n,!0),null==r||"accept"in s||(s.accept=r+",*/*"),l.setRequestHeader)for(var o in s)l.setRequestHeader(o,s[o]);return null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=c&&(l.responseType=c),null!=i&&a.on("error",i).on("load",(function(t){i(null,t)})),u.beforesend.call(a,l),l.send(null==e?null:e),a},a.abort=function(){return l.abort(),a},t.rebind(a,u,"on"),null==o?a:a.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(o))}pn.forEach((function(t,n){pn.set(t,rn(n))})),t.functor=gn,t.xhr=dn(N),t.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function i(t,e,r){arguments.length<3&&(r=e,e=null);var i=yn(t,n,null==e?o:a(e),r);return i.row=function(t){return arguments.length?i.response(null==(e=t)?o:a(t)):e},i}function o(t){return i.parse(t.responseText)}function a(t){return function(n){return i.parse(n.responseText,t)}}function u(n){return n.map(s).join(t)}function s(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,n){var e;return i.parseRows(t,(function(t,r){if(e)return e(t,r-1);var i=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(i(t),e)}:i}))},i.parseRows=function(t,n){var e,i,o={},a={},u=[],s=t.length,l=0,c=0;function h(){if(l>=s)return a;if(i)return i=!1,o;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++24?(isFinite(n)&&(clearTimeout(_n),_n=setTimeout(Mn,n)),xn=0):(xn=1,wn(Mn))}function kn(){for(var t=Date.now(),n=vn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function En(){for(var t,n=vn,e=1/0;n;)n.c?(n.t8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function Cn(n){var e=n.decimal,r=n.thousands,i=n.grouping,o=n.currency,a=i&&r?function(t,n){for(var e=t.length,o=[],a=0,u=i[0],s=0;e>0&&u>0&&(s+u+1>n&&(u=Math.max(1,n-s)),o.push(t.substring(e-=u,e+u)),!((s+=u+1)>n));)u=i[a=(a+1)%i.length];return o.reverse().join(r)}:N;return function(n){var r=Nn.exec(n),i=r[1]||" ",u=r[2]||">",s=r[3]||"-",l=r[4]||"",c=r[5],h=+r[6],f=r[7],p=r[8],g=r[9],d=1,y="",v="",m=!1,x=!0;switch(p&&(p=+p.substring(1)),(c||"0"===i&&"="===u)&&(c=i="0",u="="),g){case"n":f=!0,g="g";break;case"%":d=100,v="%",g="f";break;case"p":d=100,v="%",g="r";break;case"b":case"o":case"x":case"X":"#"===l&&(y="0"+g.toLowerCase());case"c":x=!1;case"d":m=!0,p=0;break;case"s":d=-1,g="r"}"$"===l&&(y=o[0],v=o[1]),"r"!=g||p||(g="g"),null!=p&&("g"==g?p=Math.max(1,Math.min(21,p)):"e"!=g&&"f"!=g||(p=Math.max(0,Math.min(20,p)))),g=Tn.get(g)||Fn;var _=c&&f;return function(n){var r=v;if(m&&n%1)return"";var o=n<0||0===n&&1/n<0?(n=-n,"-"):"-"===s?"":s;if(d<0){var l=t.formatPrefix(n,p);n=l.scale(n),r=l.symbol+v}else n*=d;var w,b,M=(n=g(n,p)).lastIndexOf(".");if(M<0){var k=x?n.lastIndexOf("e"):-1;k<0?(w=n,b=""):(w=n.substring(0,k),b=n.substring(k))}else w=n.substring(0,M),b=e+n.substring(M+1);!c&&f&&(w=a(w,1/0));var E=y.length+w.length+b.length+(_?0:o.length),S=E"===u?S+o+n:"^"===u?S.substring(0,E>>=1)+o+n+S.substring(E):o+(_?n:S+n))+r}}}t.formatPrefix=function(n,e){var r=0;return(n=+n)&&(n<0&&(n*=-1),e&&(n=t.round(n,Sn(n,e))),r=1+Math.floor(1e-12+Math.log(n)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),An[8+r/3]};var Nn=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Tn=t.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(n,e){return(n=t.round(n,Sn(n,e))).toFixed(Math.max(0,Math.min(20,Sn(n*(1+1e-15),e))))}});function Fn(t){return t+""}var Ln=t.time={},Dn=Date;function zn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}zn.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(){Rn.setUTCDate.apply(this._,arguments)},setDay:function(){Rn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Rn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Rn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Rn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Rn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Rn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Rn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Rn.setTime.apply(this._,arguments)}};var Rn=Date.prototype;function Pn(t,n,e){function r(n){var e=t(n),r=o(e,1);return n-e1)for(;a=l)return-1;if(37===(i=n.charCodeAt(u++))){if(a=n.charAt(u++),!(o=b[a in On?n.charAt(u++):a])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}c.utc=function(t){var n=c(t);function e(t){try{var e=new(Dn=zn);return e._=t,n(e)}finally{Dn=Date}}return e.parse=function(t){try{Dn=zn;var e=n.parse(t);return e&&e._}finally{Dn=Date}},e.toString=n.toString,e},c.multi=c.utc.multi=ae;var f=t.map(),p=Vn(a),g=Bn(a),d=Vn(u),y=Bn(u),v=Vn(s),m=Bn(s),x=Vn(l),_=Bn(l);o.forEach((function(t,n){f.set(t.toLowerCase(),n)}));var w={a:function(t){return u[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:c(e),d:function(t,n){return Hn(t.getDate(),n,2)},e:function(t,n){return Hn(t.getDate(),n,2)},H:function(t,n){return Hn(t.getHours(),n,2)},I:function(t,n){return Hn(t.getHours()%12||12,n,2)},j:function(t,n){return Hn(1+Ln.dayOfYear(t),n,3)},L:function(t,n){return Hn(t.getMilliseconds(),n,3)},m:function(t,n){return Hn(t.getMonth()+1,n,2)},M:function(t,n){return Hn(t.getMinutes(),n,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,n){return Hn(t.getSeconds(),n,2)},U:function(t,n){return Hn(Ln.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Hn(Ln.mondayOfYear(t),n,2)},x:c(r),X:c(i),y:function(t,n){return Hn(t.getFullYear()%100,n,2)},Y:function(t,n){return Hn(t.getFullYear()%1e4,n,4)},Z:ie,"%":function(){return"%"}},b={a:function(t,n,e){d.lastIndex=0;var r=d.exec(n.slice(e));return r?(t.w=y.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=g.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){x.lastIndex=0;var r=x.exec(n.slice(e));return r?(t.m=_.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){v.lastIndex=0;var r=v.exec(n.slice(e));return r?(t.m=m.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return h(t,w.c.toString(),n,e)},d:Qn,e:Qn,H:te,I:te,j:Kn,L:re,m:Gn,M:ne,p:function(t,n,e){var r=f.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:ee,U:Wn,w:Yn,W:Zn,x:function(t,n,e){return h(t,w.x.toString(),n,e)},X:function(t,n,e){return h(t,w.X.toString(),n,e)},y:Xn,Y:$n,Z:Jn,"%":oe};return c}Ln.year=Pn((function(t){return(t=Ln.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),Ln.years=Ln.year.range,Ln.years.utc=Ln.year.utc.range,Ln.day=Pn((function(t){var n=new Dn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),Ln.days=Ln.day.range,Ln.days.utc=Ln.day.utc.range,Ln.dayOfYear=function(t){var n=Ln.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=Ln[t]=Pn((function(t){return(t=Ln.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=Ln.year(t).getDay();return Math.floor((Ln.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));Ln[t+"s"]=e.range,Ln[t+"s"].utc=e.utc.range,Ln[t+"OfYear"]=function(t){var e=Ln.year(t).getDay();return Math.floor((Ln.dayOfYear(t)+(e+n)%7)/7)}})),Ln.week=Ln.sunday,Ln.weeks=Ln.sunday.range,Ln.weeks.utc=Ln.sunday.utc.range,Ln.weekOfYear=Ln.sundayOfYear;var On={"-":"",_:" ",0:"0"},In=/^\s*\d+/,jn=/^%/;function Hn(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+i[0].length):-1}function Jn(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function Gn(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Qn(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Kn(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function te(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ne(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ee(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function re(t,n,e){In.lastIndex=0;var r=In.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ie(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=v(n)/60|0,i=v(n)%60;return e+Hn(r,"0",2)+Hn(i,"0",2)}function oe(t,n,e){jn.lastIndex=0;var r=jn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function ae(t){for(var n=t.length,e=-1;++e=0?1:-1,u=a*o,s=Math.cos(n),l=Math.sin(n),c=i*l,h=r*s+c*Math.cos(u),f=c*a*Math.sin(u);Ce.add(Math.atan2(f,h)),e=t,r=s,i=l}Ne.point=function(a,u){Ne.point=o,e=(t=a)*Nt,r=Math.cos(u=(n=u)*Nt/2+Et/4),i=Math.sin(u)},Ne.lineEnd=function(){o(t,n)}}function Fe(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function Le(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function De(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function ze(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Re(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Pe(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function qe(t){return[Math.atan2(t[1],t[0]),zt(t[2])]}function Ue(t,n){return v(t[0]-n[0])Mt?i=90:l<-Mt&&(e=-90),h[0]=n,h[1]=r}};function p(t,o){c.push(h=[n=t,r=t]),oi&&(i=o)}function g(t,a){var u=Fe([t*Nt,a*Nt]);if(s){var l=De(s,u),c=De([l[1],-l[0],0],l);Pe(c),c=qe(c);var h=t-o,f=h>0?1:-1,g=c[0]*Tt*f,d=v(h)>180;if(d^(f*oi&&(i=y);else if(d^(f*o<(g=(g+360)%360-180)&&gi&&(i=a);d?tw(n,r)&&(r=t):w(t,r)>w(n,r)&&(n=t):r>=n?(tr&&(r=t)):t>o?w(n,t)>w(n,r)&&(r=t):w(t,r)>w(n,r)&&(n=t)}else p(t,a);s=u,o=t}function d(){f.point=g}function y(){h[0]=n,h[1]=r,f.point=p,s=null}function m(t,n){if(s){var e=t-o;l+=v(e)>180?e+(e>0?360:-360):e}else a=t,u=n;Ne.point(t,n),g(t,n)}function x(){Ne.lineStart()}function _(){m(a,u),Ne.lineEnd(),v(l)>Mt&&(n=-(r=180)),h[0]=n,h[1]=r,s=null}function w(t,n){return(n-=t)<0?n+360:n}function b(t,n){return t[0]-n[0]}function M(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:tw(d[0],d[1])&&(d[1]=p[1]),w(p[0],d[1])>w(d[0],d[1])&&(d[0]=p[0])):u.push(d=p);for(var s,l,p,g=-1/0,d=(a=0,u[l=u.length-1]);a<=l;d=p,++a)p=u[a],(s=w(d[1],p[0]))>g&&(g=s,n=p[0],r=d[1])}return c=h=null,n===1/0||e===1/0?[[NaN,NaN],[NaN,NaN]]:[[n,e],[r,i]]}}(),t.geo.centroid=function(n){ve=me=xe=_e=we=be=Me=ke=Ee=Se=Ae=0,t.geo.stream(n,Oe);var e=Ee,r=Se,i=Ae,o=e*e+r*r+i*i;return o=0;--u)i.point((h=c[u])[0],h[1]);else r(p.x,p.p.x,-1,i);p=p.p}c=(p=p.o).z,g=!g}while(!p.v);i.lineEnd()}}}function $e(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,M=b*w,k=M>Et,E=g*x;if(Ce.add(Math.atan2(E*b*Math.sin(M),d*_+E*Math.cos(M))),o+=k?w+b*St:w,k^f>=e^v>=e){var S=De(Fe(h),Fe(t));Pe(S);var A=De(i,S);Pe(A);var C=(k^w>=0?-1:1)*zt(A[2]);(r>C||r===C&&(S[0]||S[1]))&&(a+=k^w>=0?1:-1)}if(!y++)break;f=v,g=x,d=_,h=t}}return(o<-Mt||o0){for(x||(a.polygonStart(),x=!0),a.lineStart();++o1&&2&n&&e.push(e.pop().concat(e.shift())),u.push(e.filter(Ge))}return c}}function Ge(t){return t.length>1}function Qe(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:D,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function Ke(t,n){return((t=t.x)[0]<0?t[1]-Ct-Mt:Ct-t[1])-((n=n.x)[0]<0?n[1]-Ct-Mt:Ct-n[1])}var tr=Je(We,(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?Et:-Et,s=v(o-e);v(s-Et)0?Ct:-Ct),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&s>=Et&&(v(e-i)Mt?Math.atan((Math.sin(n)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(n))*Math.sin(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*Ct,r.point(-Et,i),r.point(0,i),r.point(Et,i),r.point(Et,0),r.point(Et,-i),r.point(0,-i),r.point(-Et,-i),r.point(-Et,0),r.point(-Et,i);else if(v(t[0]-n[0])>Mt){var o=t[0]0,r=v(n)>Mt;return Je(i,(function(t){var n,u,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(h,f){var p,g=[h,f],d=i(h,f),y=e?d?0:a(h,f):d?a(h+(h<0?Et:-Et),f):0;if(!n&&(l=s=d)&&t.lineStart(),d!==s&&(p=o(n,g),(Ue(n,p)||Ue(g,p))&&(g[0]+=Mt,g[1]+=Mt,d=i(g[0],g[1]))),d!==s)c=0,d?(t.lineStart(),p=o(g,n),t.point(p[0],p[1])):(p=o(n,g),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^d){var v;y&u||!(v=o(g,n,!0))||(c=0,e?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!d||n&&Ue(n,g)||t.point(g[0],g[1]),n=g,s=d,u=y},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),qr(t,6*Nt),e?[0,-t]:[-Et,t-Et]);function i(t,e){return Math.cos(t)*Math.cos(e)>n}function o(t,e,r){var i=[1,0,0],o=De(Fe(t),Fe(e)),a=Le(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var l=n*a/s,c=-n*u/s,h=De(i,o),f=Re(i,l);ze(f,Re(o,c));var p=h,g=Le(f,p),d=Le(p,p),y=g*g-d*(Le(f,f)-1);if(!(y<0)){var m=Math.sqrt(y),x=Re(p,(-g-m)/d);if(ze(x,f),x=qe(x),!r)return x;var _,w=t[0],b=e[0],M=t[1],k=e[1];b0^x[1]<(v(x[0]-w)Et^(w<=x[0]&&x[0]<=b)){var A=Re(p,(-g+m)/d);return ze(A,f),[x,qe(A)]}}}function a(n,r){var i=e?t:Et-t,o=0;return n<-i?o|=1:n>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}}function er(t,n,e,r){return function(i){var o,a=i.a,u=i.b,s=a.x,l=a.y,c=0,h=1,f=u.x-s,p=u.y-l;if(o=t-s,f||!(o>0)){if(o/=f,f<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=e-s,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o0)){if(o/=p,p<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=r-l,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o0&&(i.a={x:s+c*f,y:l+c*p}),h<1&&(i.b={x:s+h*f,y:l+h*p}),i}}}}}}function rr(n,e,r,i){return function(s){var l,c,h,f,p,g,d,y,v,m,x,_=s,w=Qe(),b=er(n,e,r,i),M={point:S,lineStart:function(){M.point=A,c&&c.push(h=[]),m=!0,v=!1,d=y=NaN},lineEnd:function(){l&&(A(f,p),g&&v&&w.rejoin(),l.push(w.buffer())),M.point=S,v&&s.lineEnd()},polygonStart:function(){s=w,l=[],c=[],x=!0},polygonEnd:function(){s=_,l=t.merge(l);var e=function(t){for(var n=0,e=c.length,r=t[1],i=0;ir&&Lt(l,o,t)>0&&++n:o[1]<=r&&Lt(l,o,t)<0&&--n,l=o;return 0!==n}([n,i]),r=x&&e,o=l.length;(r||o)&&(s.polygonStart(),r&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),o&&Ze(l,a,e,k,s),s.polygonEnd()),l=c=h=null}};function k(t,a,s,l){var c=0,h=0;if(null==t||(c=o(t,s))!==(h=o(a,s))||u(t,a)<0^s>0)do{l.point(0===c||3===c?n:r,c>1?i:e)}while((c=(c+s+4)%4)!==h);else l.point(a[0],a[1])}function E(t,o){return n<=t&&t<=r&&e<=o&&o<=i}function S(t,n){E(t,n)&&s.point(t,n)}function A(t,n){var e=E(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(c&&h.push([t,n]),m)f=t,p=n,g=e,m=!1,e&&(s.lineStart(),s.point(t,n));else if(e&&v)s.point(t,n);else{var r={a:{x:d,y:y},b:{x:t,y:n}};b(r)?(v||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),e||s.lineEnd(),x=!1):e&&(s.lineStart(),s.point(t,n),x=!1)}d=t,y=n,v=e}return M};function o(t,i){return v(t[0]-n)0?0:3:v(t[0]-r)0?2:1:v(t[1]-e)0?1:0:i>0?3:2}function a(t,n){return u(t.x,n.x)}function u(t,n){var e=o(t,1),r=o(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function ir(t){var n=0,e=Et/3,r=Nr(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Et/180,e=t[1]*Et/180):[n/Et*180,e/Et*180]},i}function or(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,i=1+e*(2*r-e),o=Math.sqrt(i)/r;function a(t,n){var e=Math.sqrt(i-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),o-e*Math.cos(t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,zt((i-(t*t+e*e)*r*r)/(2*r))]},a}t.geo.clipExtent=function(){var t,n,e,r,i,o,a={stream:function(t){return i&&(i.valid=!1),(i=o(t)).valid=!0,i},extent:function(u){return arguments.length?(o=rr(t=+u[0][0],n=+u[0][1],e=+u[1][0],r=+u[1][1]),i&&(i.valid=!1,i=null),a):[[t,n],[e,r]]}};return a.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return ir(or)}).raw=or,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var n,e,r,i,o=t.geo.albers(),a=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,e){n=[t,e]}};function l(t){var o=t[0],a=t[1];return n=null,e(o,a),n||(r(o,a),n)||i(o,a),n}return l.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?a:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:o).invert(t)},l.stream=function(t){var n=o.stream(t),e=a.stream(t),r=u.stream(t);return{point:function(t,i){n.point(t,i),e.point(t,i),r.point(t,i)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},l.precision=function(t){return arguments.length?(o.precision(t),a.precision(t),u.precision(t),l):o.precision()},l.scale=function(t){return arguments.length?(o.scale(t),a.scale(.35*t),u.scale(t),l.translate(o.translate())):o.scale()},l.translate=function(t){if(!arguments.length)return o.translate();var n=o.scale(),c=+t[0],h=+t[1];return e=o.translate(t).clipExtent([[c-.455*n,h-.238*n],[c+.455*n,h+.238*n]]).stream(s).point,r=a.translate([c-.307*n,h+.201*n]).clipExtent([[c-.425*n+Mt,h+.12*n+Mt],[c-.214*n-Mt,h+.234*n-Mt]]).stream(s).point,i=u.translate([c-.205*n,h+.212*n]).clipExtent([[c-.214*n+Mt,h+.166*n+Mt],[c-.115*n-Mt,h+.234*n-Mt]]).stream(s).point,l},l.scale(1070)};var ar,ur,sr,lr,cr,hr,fr={point:D,lineStart:D,lineEnd:D,polygonStart:function(){ur=0,fr.lineStart=pr},polygonEnd:function(){fr.lineStart=fr.lineEnd=fr.point=D,ar+=v(ur/2)}};function pr(){var t,n,e,r;function i(t,n){ur+=r*t-e*n,e=t,r=n}fr.point=function(o,a){fr.point=i,t=e=o,n=r=a},fr.lineEnd=function(){i(t,n)}}var gr={point:function(t,n){tcr&&(cr=t),nhr&&(hr=n)},lineStart:D,lineEnd:D,polygonStart:D,polygonEnd:D};function dr(){var t=yr(4.5),n=[],e={point:r,lineStart:function(){e.point=i},lineEnd:a,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=a,e.point=r},pointRadius:function(n){return t=yr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function i(t,r){n.push("M",t,",",r),e.point=o}function o(t,e){n.push("L",t,",",e)}function a(){e.point=r}function u(){n.push("Z")}return e}function yr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var vr,mr={point:xr,lineStart:_r,lineEnd:wr,polygonStart:function(){mr.lineStart=br},polygonEnd:function(){mr.point=xr,mr.lineStart=_r,mr.lineEnd=wr}};function xr(t,n){xe+=t,_e+=n,++we}function _r(){var t,n;function e(e,r){var i=e-t,o=r-n,a=Math.sqrt(i*i+o*o);be+=a*(t+e)/2,Me+=a*(n+r)/2,ke+=a,xr(t=e,n=r)}mr.point=function(r,i){mr.point=e,xr(t=r,n=i)}}function wr(){mr.point=xr}function br(){var t,n,e,r;function i(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);be+=a*(e+t)/2,Me+=a*(r+n)/2,ke+=a,Ee+=(a=r*t-e*n)*(e+t),Se+=a*(r+n),Ae+=3*a,xr(e=t,r=n)}mr.point=function(o,a){mr.point=i,xr(t=e=o,n=r=a)},mr.lineEnd=function(){i(t,n)}}function Mr(t){var n=4.5,e={point:r,lineStart:function(){e.point=i},lineEnd:a,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=a,e.point=r},pointRadius:function(t){return n=t,e},result:D};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,St)}function i(n,r){t.moveTo(n,r),e.point=o}function o(n,e){t.lineTo(n,e)}function a(){e.point=r}function u(){t.closePath()}return e}function kr(t){var n=.5,e=Math.cos(30*Nt),r=16;function i(t){return(r?a:o)(t)}function o(n){return Ar(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function a(n){var e,i,o,a,s,l,c,h,f,p,g,d,y={point:v,lineStart:m,lineEnd:_,polygonStart:function(){n.polygonStart(),y.lineStart=w},polygonEnd:function(){n.polygonEnd(),y.lineStart=m}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function m(){h=NaN,y.point=x,n.lineStart()}function x(e,i){var o=Fe([e,i]),a=t(e,i);u(h,f,c,p,g,d,h=a[0],f=a[1],c=e,p=o[0],g=o[1],d=o[2],r,n),n.point(h,f)}function _(){y.point=v,n.lineEnd()}function w(){m(),y.point=b,y.lineEnd=M}function b(t,n){x(e=t,n),i=h,o=f,a=p,s=g,l=d,y.point=x}function M(){u(h,f,c,p,g,d,i,o,e,a,s,l,r,n),y.lineEnd=_,_()}return y}function u(r,i,o,a,s,l,c,h,f,p,g,d,y,m){var x=c-r,_=h-i,w=x*x+_*_;if(w>4*n&&y--){var b=a+p,M=s+g,k=l+d,E=Math.sqrt(b*b+M*M+k*k),S=Math.asin(k/=E),A=v(v(k)-1)n||v((x*F+_*L)/w-.5)>.3||a*p+s*g+l*d0&&16,i):Math.sqrt(n)},i}function Er(t){var n=kr((function(n,e){return t([n*Tt,e*Tt])}));return function(t){return Tr(n(t))}}function Sr(t){this.stream=t}function Ar(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Cr(t){return Nr((function(){return t}))()}function Nr(n){var e,r,i,o,a,u,s=kr((function(t,n){return[(t=e(t,n))[0]*l+o,a-t[1]*l]})),l=150,c=480,h=250,f=0,p=0,g=0,d=0,y=0,v=tr,m=N,x=null,_=null;function w(t){return[(t=i(t[0]*Nt,t[1]*Nt))[0]*l+o,a-t[1]*l]}function b(t){return(t=i.invert((t[0]-o)/l,(a-t[1])/l))&&[t[0]*Tt,t[1]*Tt]}function M(){i=Ye(r=Dr(g,d,y),e);var t=e(f,p);return o=c-t[0]*l,a=h+t[1]*l,k()}function k(){return u&&(u.valid=!1,u=null),w}return w.stream=function(t){return u&&(u.valid=!1),(u=Tr(v(r,s(m(t))))).valid=!0,u},w.clipAngle=function(t){return arguments.length?(v=null==t?(x=t,tr):nr((x=+t)*Nt),k()):x},w.clipExtent=function(t){return arguments.length?(_=t,m=t?rr(t[0][0],t[0][1],t[1][0],t[1][1]):N,k()):_},w.scale=function(t){return arguments.length?(l=+t,M()):l},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],M()):[c,h]},w.center=function(t){return arguments.length?(f=t[0]%360*Nt,p=t[1]%360*Nt,M()):[f*Tt,p*Tt]},w.rotate=function(t){return arguments.length?(g=t[0]%360*Nt,d=t[1]%360*Nt,y=t.length>2?t[2]%360*Nt:0,M()):[g*Tt,d*Tt,y*Tt]},t.rebind(w,s,"precision"),function(){return e=n.apply(this,arguments),w.invert=e.invert&&b,M()}}function Tr(t){return Ar(t,(function(n,e){t.point(n*Nt,e*Nt)}))}function Fr(t,n){return[t,n]}function Lr(t,n){return[t>Et?t-St:t<-Et?t+St:t,n]}function Dr(t,n,e){return t?n||e?Ye(Rr(t),Pr(n,e)):Rr(t):n||e?Pr(n,e):Lr}function zr(t){return function(n,e){return[(n+=t)>Et?n-St:n<-Et?n+St:n,e]}}function Rr(t){var n=zr(t);return n.invert=zr(-t),n}function Pr(t,n){var e=Math.cos(t),r=Math.sin(t),i=Math.cos(n),o=Math.sin(n);function a(t,n){var a=Math.cos(n),u=Math.cos(t)*a,s=Math.sin(t)*a,l=Math.sin(n),c=l*e+u*r;return[Math.atan2(s*i-c*o,u*e-l*r),zt(c*i+s*o)]}return a.invert=function(t,n){var a=Math.cos(n),u=Math.cos(t)*a,s=Math.sin(t)*a,l=Math.sin(n),c=l*i-s*o;return[Math.atan2(s*i+l*o,u*e+c*r),zt(c*e-u*r)]},a}function qr(t,n){var e=Math.cos(t),r=Math.sin(t);return function(i,o,a,u){var s=a*n;null!=i?(i=Ur(e,i),o=Ur(e,o),(a>0?io)&&(i+=a*St)):(i=t+a*St,o=t-.5*s);for(var l,c=i;a>0?c>o:c2?t[2]*Nt:0),n.invert=function(n){return(n=t.invert(n[0]*Nt,n[1]*Nt))[0]*=Tt,n[1]*=Tt,n},n},Lr.invert=Fr,t.geo.circle=function(){var t,n,e=[0,0],r=6;function i(){var t="function"==typeof e?e.apply(this,arguments):e,r=Dr(-t[0]*Nt,-t[1]*Nt,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=r(t,n)),t[0]*=Tt,t[1]*=Tt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(e=t,i):e},i.angle=function(e){return arguments.length?(n=qr((t=+e)*Nt,r*Nt),i):t},i.precision=function(e){return arguments.length?(n=qr(t*Nt,(r=+e)*Nt),i):r},i.angle(90)},t.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Nt,i=t[1]*Nt,o=n[1]*Nt,a=Math.sin(r),u=Math.cos(r),s=Math.sin(i),l=Math.cos(i),c=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((e=h*a)*e+(e=l*c-s*h*u)*e),s*c+l*h*u)},t.geo.graticule=function(){var n,e,r,i,o,a,u,s,l,c,h,f,p=10,g=p,d=90,y=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:_()}}function _(){return t.range(Math.ceil(i/d)*d,r,d).map(h).concat(t.range(Math.ceil(s/y)*y,u,y).map(f)).concat(t.range(Math.ceil(e/p)*p,n,p).filter((function(t){return v(t%d)>Mt})).map(l)).concat(t.range(Math.ceil(a/g)*g,o,g).filter((function(t){return v(t%y)>Mt})).map(c))}return x.lines=function(){return _().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(f(u).slice(1),h(r).reverse().slice(1),f(s).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(i=+t[0][0],r=+t[1][0],s=+t[0][1],u=+t[1][1],i>r&&(t=i,i=r,r=t),s>u&&(t=s,s=u,u=t),x.precision(m)):[[i,s],[r,u]]},x.minorExtent=function(t){return arguments.length?(e=+t[0][0],n=+t[1][0],a=+t[0][1],o=+t[1][1],e>n&&(t=e,e=n,n=t),a>o&&(t=a,a=o,o=t),x.precision(m)):[[e,a],[n,o]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(d=+t[0],y=+t[1],x):[d,y]},x.minorStep=function(t){return arguments.length?(p=+t[0],g=+t[1],x):[p,g]},x.precision=function(t){return arguments.length?(m=+t,l=Or(a,o,90),c=Ir(e,n,m),h=Or(s,u,90),f=Ir(i,r,m),x):m},x.majorExtent([[-180,-90+Mt],[180,90-Mt]]).minorExtent([[-180,-80-Mt],[180,80+Mt]])},t.geo.greatArc=function(){var n,e,r=jr,i=Hr;function o(){return{type:"LineString",coordinates:[n||r.apply(this,arguments),e||i.apply(this,arguments)]}}return o.distance=function(){return t.geo.distance(n||r.apply(this,arguments),e||i.apply(this,arguments))},o.source=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,o):r},o.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,o):i},o.precision=function(){return arguments.length?o:0},o},t.geo.interpolate=function(t,n){return e=t[0]*Nt,r=t[1]*Nt,i=n[0]*Nt,o=n[1]*Nt,a=Math.cos(r),u=Math.sin(r),s=Math.cos(o),l=Math.sin(o),c=a*Math.cos(e),h=a*Math.sin(e),f=s*Math.cos(i),p=s*Math.sin(i),g=2*Math.asin(Math.sqrt(Pt(o-r)+a*s*Pt(i-e))),d=1/Math.sin(g),(y=g?function(t){var n=Math.sin(t*=g)*d,e=Math.sin(g-t)*d,r=e*c+n*f,i=e*h+n*p,o=e*u+n*l;return[Math.atan2(i,r)*Tt,Math.atan2(o,Math.sqrt(r*r+i*i))*Tt]}:function(){return[e*Tt,r*Tt]}).distance=g,y;var e,r,i,o,a,u,s,l,c,h,f,p,g,d,y},t.geo.length=function(n){return vr=0,t.geo.stream(n,Vr),vr};var Vr={sphere:D,point:D,lineStart:function(){var t,n,e;function r(r,i){var o=Math.sin(i*=Nt),a=Math.cos(i),u=v((r*=Nt)-t),s=Math.cos(u);vr+=Math.atan2(Math.sqrt((u=a*Math.sin(u))*u+(u=e*o-n*a*s)*u),n*o+e*a*s),t=r,n=o,e=a}Vr.point=function(i,o){t=i*Nt,n=Math.sin(o*=Nt),e=Math.cos(o),Vr.point=r},Vr.lineEnd=function(){Vr.point=Vr.lineEnd=D}},lineEnd:D,polygonStart:D,polygonEnd:D};function Br(t,n){function e(n,e){var r=Math.cos(n),i=Math.cos(e),o=t(r*i);return[o*i*Math.sin(n),o*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),i=n(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&e*o/r)]},e}var Yr=Br((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cr(Yr)}).raw=Yr;var Wr=Br((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),N);function Zr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Et/4+t/2)},i=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),o=e*Math.pow(r(t),i)/i;if(!i)return Jr;function a(t,n){o>0?n<-Ct+Mt&&(n=-Ct+Mt):n>Ct-Mt&&(n=Ct-Mt);var e=o/Math.pow(r(n),i);return[e*Math.sin(i*t),o-e*Math.cos(i*t)]}return a.invert=function(t,n){var e=o-n,r=Ft(i)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Ct]},a}function $r(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),i=e/r+t;if(v(r)1&&Lt(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function ii(t,n){return t[0]-n[0]||t[1]-n[1]}(t.geo.stereographic=function(){return Cr(Kr)}).raw=Kr,ti.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=Gr(ti),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=ti,t.geom={},t.geom.hull=function(t){var n=ni,e=ei;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,i=gn(n),o=gn(e),a=t.length,u=[],s=[];for(r=0;r=0;--r)p.push(t[u[l[r]][2]]);for(r=+h;rMt)u=u.L;else{if(!((i=o-bi(u,a))>Mt)){r>-Mt?(n=u.P,e=u):i>-Mt?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}var s=vi(t);if(hi.insert(n,s),n||e){if(n===e)return Ai(n),e=vi(n.site),hi.insert(s,e),s.edge=e.edge=Ti(n.site,s.site),Si(n),void Si(e);if(e){Ai(n),Ai(e);var l=n.site,c=l.x,h=l.y,f=t.x-c,p=t.y-h,g=e.site,d=g.x-c,y=g.y-h,v=2*(f*y-p*d),m=f*f+p*p,x=d*d+y*y,_={x:(y*m-p*x)/v+c,y:(f*x-d*m)/v+h};Fi(e.edge,l,g,_),s.edge=Ti(l,t,null,_),e.edge=Ti(t,g,null,_),Si(n),Si(e)}else s.edge=Ti(n.site,s.site)}}function wi(t,n){var e=t.site,r=e.x,i=e.y,o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(e=a.site).x,s=e.y,l=s-n;if(!l)return u;var c=u-r,h=1/o-1/l,f=c/l;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*l)-s+l/2+i-o/2)))/h+r:(r+u)/2}function bi(t,n){var e=t.N;if(e)return wi(e,n);var r=t.site;return r.y===n?r.x:1/0}function Mi(t){this.site=t,this.edges=[]}function ki(t,n){return n.angle-t.angle}function Ei(){zi(this),this.x=this.y=this.arc=this.site=this.cy=null}function Si(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i.x,u=i.y,s=r.x-a,l=r.y-u,c=o.x-a,h=2*(s*(y=o.y-u)-l*c);if(!(h>=-kt)){var f=s*s+l*l,p=c*c+y*y,g=(y*f-l*p)/h,d=(s*p-c*f)/h,y=d+u,v=di.pop()||new Ei;v.arc=t,v.site=i,v.x=g+a,v.y=y+Math.sqrt(g*g+d*d),v.cy=y,t.circle=v;for(var m=null,x=pi._;x;)if(v.y=u)return;if(f>g){if(o){if(o.y>=l)return}else o={x:y,y:s};e={x:y,y:l}}else{if(o){if(o.y1)if(f>g){if(o){if(o.y>=l)return}else o={x:(s-i)/r,y:s};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=u)return}else o={x:a,y:r*a+i};e={x:u,y:r*u+i}}else{if(o){if(o.xMt||v(i-e)>Mt)&&(u.splice(a,0,new Li((m=o.site,x=c,_=v(r-h)Mt?{x:h,y:v(n-h)Mt?{x:v(e-g)Mt?{x:f,y:v(n-f)Mt?{x:v(e-p)=e&&l.x<=i&&l.y>=r&&l.y<=a?[[e,a],[i,a],[i,r],[e,r]]:[]).point=t[u]})),n}function u(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Mt)*Mt,y:Math.round(i(t,n)/Mt)*Mt,i:n}}))}return a.links=function(t){return Ui(u(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},a.triangles=function(t){var n=[];return Ui(u(t)).cells.forEach((function(e,r){for(var i,o,a,u,s=e.site,l=e.edges.sort(ki),c=-1,h=l.length,f=l[h-1].edge,p=f.l===s?f.r:f.l;++co||h>a||f=w)<<1|n>=_,M=b+4;bo&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Zi(e,r)})),o=Ji.lastIndex;return od&&(d=s.x),s.y>y&&(y=s.y),l.push(s.x),c.push(s.y);else for(h=0;hd&&(d=_),w>y&&(y=w),l.push(_),c.push(w)}var b=d-p,M=y-g;function k(t,n,e,r,i,o,a,u){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(v(s-e)+v(l-r)<.01)E(t,n,e,r,i,o,a,u);else{var c=t.point;t.x=t.y=t.point=null,E(t,c,s,l,i,o,a,u),E(t,n,e,r,i,o,a,u)}else t.x=e,t.y=r,t.point=n}else E(t,n,e,r,i,o,a,u)}function E(t,n,e,r,i,o,a,u){var s=.5*(i+a),l=.5*(o+u),c=e>=s,h=r>=l,f=h<<1|c;t.leaf=!1,c?i=s:a=s,h?o=l:u=l,k(t=t.nodes[f]||(t.nodes[f]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,i,o,a,u)}b>M?y=g+b:d=p+M;var S={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(S,t,+m(t,++h),+x(t,h),p,g,d,y)},visit:function(t){Vi(t,S,p,g,d,y)},find:function(t){return Bi(S,t[0],t[1],p,g,d,y)}};if(h=-1,null==n){for(;++h=0&&!(r=t.interpolators[i](n,e)););return r}function Qi(t,n){var e,r=[],i=[],o=t.length,a=n.length,u=Math.min(t.length,n.length);for(e=0;e=1?1:t(n)}}function ro(t){return function(n){return 1-t(1-n)}}function io(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function oo(t){return t*t}function ao(t){return t*t*t}function uo(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function so(t){return 1-Math.cos(t*Ct)}function lo(t){return Math.pow(2,10*(t-1))}function co(t){return 1-Math.sqrt(1-t*t)}function ho(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function fo(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function po(t){var n,e,r,i=[t.a,t.b],o=[t.c,t.d],a=yo(i),u=go(i,o),s=yo(((n=o)[0]+=(r=-u)*(e=i)[0],n[1]+=r*e[1],n))||0;i[0]*o[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return r=to.get(r)||Ki,eo((i=no.get(i)||N)(r.apply(null,n.call(arguments,1))))},t.interpolateHcl=function(n,e){n=t.hcl(n),e=t.hcl(e);var r=n.h,i=n.c,o=n.l,a=e.h-r,u=e.c-i,s=e.l-o;return isNaN(u)&&(u=0,i=isNaN(i)?e.c:i),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return Zt(r+a*t,i+u*t,o+s*t)+""}},t.interpolateHsl=function(n,e){n=t.hsl(n),e=t.hsl(e);var r=n.h,i=n.s,o=n.l,a=e.h-r,u=e.s-i,s=e.l-o;return isNaN(u)&&(u=0,i=isNaN(i)?e.s:i),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return Bt(r+a*t,i+u*t,o+s*t)+""}},t.interpolateLab=function(n,e){n=t.lab(n),e=t.lab(e);var r=n.l,i=n.a,o=n.b,a=e.l-r,u=e.a-i,s=e.b-o;return function(t){return Gt(r+a*t,i+u*t,o+s*t)+""}},t.interpolateRound=fo,t.transform=function(n){var e=r.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new po(n?n.matrix:vo)})(n)},po.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vo={a:1,b:0,c:0,d:1,e:0,f:0};function mo(t){return t.length?t.pop()+",":""}function xo(n,e){var r=[],i=[];return n=t.transform(n),e=t.transform(e),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var i=e.push("translate(",null,",",null,")");r.push({i:i-4,x:Zi(t[0],n[0])},{i:i-2,x:Zi(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(n.translate,e.translate,r,i),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(mo(e)+"rotate(",null,")")-2,x:Zi(t,n)})):n&&e.push(mo(e)+"rotate("+n+")")}(n.rotate,e.rotate,r,i),function(t,n,e,r){t!==n?r.push({i:e.push(mo(e)+"skewX(",null,")")-2,x:Zi(t,n)}):n&&e.push(mo(e)+"skewX("+n+")")}(n.skew,e.skew,r,i),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var i=e.push(mo(e)+"scale(",null,",",null,")");r.push({i:i-4,x:Zi(t[0],n[0])},{i:i-2,x:Zi(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(mo(e)+"scale("+n+")")}(n.scale,e.scale,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e0?r=t:(n.c=null,n.t=NaN,n=null,s.end({type:"end",alpha:r=0})):t>0&&(s.start({type:"start",alpha:r=t}),n=bn(u.tick)),u):r},u.start=function(){var t,n,e,r=v.length,s=m.length,c=l[0],g=l[1];for(t=0;t=0;)e.push(i[r])}function Do(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a=0;)a.push(c=l[s]),c.parent=o,c.depth=o.depth+1;e&&(o.value=0),o.children=l}else e&&(o.value=+e.call(r,o,o.depth)||0),delete o.children;return Do(i,(function(n){var r,i;t&&(r=n.children)&&r.sort(t),e&&(i=n.parent)&&(i.value+=n.value)})),u}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(Lo(t,(function(t){t.children&&(t.value=0)})),Do(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},t.layout.partition=function(){var n=t.layout.hierarchy(),e=[1,1];function r(t,r){var i=n.call(this,t,r);return function t(n,e,r,i){var o=n.children;if(n.x=e,n.y=n.depth*i,n.dx=r,n.dy=i,o&&(a=o.length)){var a,u,s,l=-1;for(r=n.value?r/n.value:0;++lu&&(u=r),a.push(r)}for(e=0;ei&&(r=e,i=n);return r}function Zo(t){return t.reduce($o,0)}function $o(t,n){return t+n[1]}function Xo(t,n){return Jo(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function Jo(t,n){for(var e=-1,r=+t[0],i=(t[1]-r)/n,o=[];++e<=n;)o[e]=i*e+r;return o}function Go(n){return[t.min(n),t.max(n)]}function Qo(t,n){return t.value-n.value}function Ko(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function ta(t,n){t._pack_next=n,n._pack_prev=t}function na(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return.999*i*i>e*e+r*r}function ea(t){if((n=t.children)&&(s=n.length)){var n,e,r,i,o,a,u,s,l=1/0,c=-1/0,h=1/0,f=-1/0;if(n.forEach(ra),(e=n[0]).x=-e.r,e.y=0,x(e),s>1&&((r=n[1]).x=r.r,r.y=0,x(r),s>2))for(oa(e,r,i=n[2]),x(i),Ko(e,i),e._pack_prev=i,Ko(i,r),r=e._pack_next,o=3;o0)for(a=-1;++a=h[0]&&s<=h[1]&&((u=l[t.bisect(f,s,1,g)-1]).y+=d,u.push(o[a]));return l}return o.value=function(t){return arguments.length?(e=t,o):e},o.range=function(t){return arguments.length?(r=gn(t),o):r},o.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return Jo(n,t)}:gn(t),o):i},o.frequency=function(t){return arguments.length?(n=!!t,o):n},o},t.layout.pack=function(){var n,e=t.layout.hierarchy().sort(Qo),r=0,i=[1,1];function o(t,o){var a=e.call(this,t,o),u=a[0],s=i[0],l=i[1],c=null==n?Math.sqrt:"function"==typeof n?n:function(){return n};if(u.x=u.y=0,Do(u,(function(t){t.r=+c(t.value)})),Do(u,ea),r){var h=r*(n?1:Math.max(2*u.r/s,2*u.r/l))/2;Do(u,(function(t){t.r+=h})),Do(u,ea),Do(u,(function(t){t.r-=h}))}return function t(n,e,r,i){var o=n.children;if(n.x=e+=i*n.x,n.y=r+=i*n.y,n.r*=i,o)for(var a=-1,u=o.length;++ap.x&&(p=t),t.depth>g.depth&&(g=t)}));var d=e(f,p)/2-f.x,y=r[0]/(p.x+e(p,f)/2+d),v=r[1]/(g.depth||1);Lo(c,(function(t){t.x=(t.x+d)*y,t.y=t.depth*v}))}return l}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n.length){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,u=n,s=o.parent.children[0],l=o.m,c=a.m,h=u.m,f=s.m;u=sa(u),o=ua(o),u&&o;)s=ua(s),(a=sa(a)).a=t,(i=u.z+h-o.z-l+e(u._,o._))>0&&(la(ca(u,t,r),t,i),l+=i,c+=i),h+=u.m,l+=o.m,f+=s.m,c+=a.m;u&&!sa(a)&&(a.t=u,a.m+=h-c),o&&!ua(s)&&(s.t=o,s.m+=l-f,r=t)}return r}(t,i,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=r[0],t.y=t.depth*r[1]}return o.separation=function(t){return arguments.length?(e=t,o):e},o.size=function(t){return arguments.length?(i=null==(r=t)?s:null,o):i?null:r},o.nodeSize=function(t){return arguments.length?(i=null==(r=t)?null:s,o):i?r:null},Fo(o,n)},t.layout.cluster=function(){var n=t.layout.hierarchy().sort(null).value(null),e=aa,r=[1,1],i=!1;function o(o,a){var u,s=n.call(this,o,a),l=s[0],c=0;Do(l,(function(n){var r=n.children;r&&r.length?(n.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(r),n.y=function(n){return 1+t.max(n,(function(t){return t.y}))}(r)):(n.x=u?c+=e(n,u):0,n.y=0,u=n)}));var h=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),f=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=h.x-e(h,f)/2,g=f.x+e(f,h)/2;return Do(l,i?function(t){t.x=(t.x-l.x)*r[0],t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-p)/(g-p)*r[0],t.y=(1-(l.y?t.y/l.y:1))*r[1]}),s}return o.separation=function(t){return arguments.length?(e=t,o):e},o.size=function(t){return arguments.length?(i=null==(r=t),o):i?null:r},o.nodeSize=function(t){return arguments.length?(i=null!=(r=t),o):i?r:null},Fo(o,n)},t.layout.treemap=function(){var n,e=t.layout.hierarchy(),r=Math.round,i=[1,1],o=null,a=ha,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,i=-1,o=t.length;++i0;)u.push(e=l[i-1]),u.area+=e.area,"squarify"!==s||(r=p(u,d))<=f?(l.pop(),f=r):(u.area-=u.pop().area,g(u,d,o,!1),d=Math.min(o.dx,o.dy),u.length=u.area=0,f=1/0);u.length&&(g(u,d,o,!0),u.length=u.area=0),n.forEach(h)}}function f(t){var n=t.children;if(n&&n.length){var e,r=a(t),i=n.slice(),o=[];for(c(i,r.dx*r.dy/t.value),o.area=0;e=i.pop();)o.push(e),o.area+=e.area,null!=e.z&&(g(o,e.z?r.dx:r.dy,r,!i.length),o.length=o.area=0);n.forEach(f)}}function p(t,n){for(var e,r=t.area,i=0,o=1/0,a=-1,u=t.length;++ai&&(i=e));return n*=n,(r*=r)?Math.max(n*i*l/r,r/(n*o*l)):1/0}function g(t,n,e,i){var o,a=-1,u=t.length,s=e.x,l=e.y,c=n?r(t.area/n):0;if(n==e.dx){for((i||c>e.dy)&&(c=e.dy);++ae.dx)&&(c=e.dx);++a1);return t+n*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=t.random.normal.apply(t,arguments);return function(){return Math.exp(n())}},bates:function(n){var e=t.random.irwinHall(n);return function(){return e()/n}},irwinHall:function(t){return function(){for(var n=0,e=0;e2?xa:da,u=i?wo:_o;return o=t(n,e,u,r),a=t(e,n,u,Gi),s}function s(t){return o(t)}return s.invert=function(t){return a(t)},s.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},s.range=function(t){return arguments.length?(e=t,u()):e},s.rangeRound=function(t){return s.range(t).interpolate(fo)},s.clamp=function(t){return arguments.length?(i=t,u()):i},s.interpolate=function(t){return arguments.length?(r=t,u()):r},s.ticks=function(t){return Ma(n,t)},s.tickFormat=function(t,e){return ka(n,t,e)},s.nice=function(t){return wa(n,t),u()},s.copy=function(){return t(n,e,r,i)},u()}([0,1],[0,1],Gi,!1)};var Ea={s:1,g:1,p:1,r:1,e:1};function Sa(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function n(e,r,i,o){function a(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(r)}function u(t){return i?Math.pow(r,t):-Math.pow(r,-t)}function s(t){return e(a(t))}return s.invert=function(t){return u(e.invert(t))},s.domain=function(t){return arguments.length?(i=t[0]>=0,e.domain((o=t.map(Number)).map(a)),s):o},s.base=function(t){return arguments.length?(r=+t,e.domain(o.map(a)),s):r},s.nice=function(){var t=ya(o.map(a),i?Math:Ca);return e.domain(t),o=t.map(u),s},s.ticks=function(){var t=pa(o),n=[],e=t[0],s=t[1],l=Math.floor(a(e)),c=Math.ceil(a(s)),h=r%1?2:r;if(isFinite(c-l)){if(i){for(;l0;f--)n.push(u(l)*f);for(l=0;n[l]s;c--);n=n.slice(l,c)}return n},s.tickFormat=function(n,e){if(!arguments.length)return Aa;arguments.length<2?e=Aa:"function"!=typeof e&&(e=t.format(e));var i=Math.max(1,r*n/s.ticks().length);return function(t){var n=t/u(Math.round(a(t)));return n*r0?i[t-1]:e[0],th?0:1;if(l=At)return s(l,p)+(u?s(u,1-p):"")+"Z";var g,d,y,v,m,x,_,w,b,M,k,E,S=0,A=0,C=[];if((v=(+a.apply(this,arguments)||0)/2)&&(y=r===Ra?Math.sqrt(u*u+l*l):+r.apply(this,arguments),p||(A*=-1),l&&(A=zt(y/l*Math.sin(v))),u&&(S=zt(y/u*Math.sin(v)))),l){m=l*Math.cos(c+A),x=l*Math.sin(c+A),_=l*Math.cos(h-A),w=l*Math.sin(h-A);var N=Math.abs(h-c-2*A)<=Et?0:1;if(A&&ja(m,x,_,w)===p^N){var T=(c+h)/2;m=l*Math.cos(T),x=l*Math.sin(T),_=w=null}}else m=x=0;if(u){b=u*Math.cos(h-S),M=u*Math.sin(h-S),k=u*Math.cos(c+S),E=u*Math.sin(c+S);var F=Math.abs(c-h+2*S)<=Et?0:1;if(S&&ja(b,M,k,E)===1-p^F){var L=(c+h)/2;b=u*Math.cos(L),M=u*Math.sin(L),k=E=null}}else b=M=0;if(f>Mt&&(g=Math.min(Math.abs(l-u)/2,+e.apply(this,arguments)))>.001){d=u0?0:1}function Ha(t,n,e,r,i){var o=t[0]-n[0],a=t[1]-n[1],u=(i?r:-r)/Math.sqrt(o*o+a*a),s=u*a,l=-u*o,c=t[0]+s,h=t[1]+l,f=n[0]+s,p=n[1]+l,g=(c+f)/2,d=(h+p)/2,y=f-c,v=p-h,m=y*y+v*v,x=e-r,_=c*p-f*h,w=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-_*_)),b=(_*v-y*w)/m,M=(-_*y-v*w)/m,k=(_*v+y*w)/m,E=(-_*y+v*w)/m,S=b-g,A=M-d,C=k-g,N=E-d;return S*S+A*A>C*C+N*N&&(b=k,M=E),[[b-s,M-l],[b*e/x,M*e/x]]}function Va(t){var n=ni,e=ei,r=We,i=Ya,o=i.key,a=.7;function u(o){var u,s=[],l=[],c=-1,h=o.length,f=gn(n),p=gn(e);function g(){s.push("M",i(t(l),a))}for(;++c1&&i.push("H",r[0]),i.join("")},"step-before":Za,"step-after":$a,basis:Ga,"basis-open":function(t){if(t.length<4)return Ya(t);for(var n,e=[],r=-1,i=t.length,o=[0],a=[0];++r<3;)n=t[r],o.push(n[0]),a.push(n[1]);for(e.push(Qa(nu,o)+","+Qa(nu,a)),--r;++r9&&(i=3*n/Math.sqrt(i),a[u]=i*e,a[u+1]=i*r);for(u=-1;++u<=s;)i=(t[Math.min(s,u+1)][0]-t[Math.max(0,u-1)][0])/(6*(1+a[u]*a[u])),o.push([i||0,a[u]*i||0]);return o}(t))}});function Ya(t){return t.length>1?t.join("L"):t+"Z"}function Wa(t){return t.join("L")+"Z"}function Za(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];++n1){u=n[1],o=t[s],s++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-u[0])+","+(o[1]-u[1])+","+o[0]+","+o[1];for(var l=2;lEt)+",1 "+n}function s(t,n,e,r){return"Q 0,0 "+r}return o.radius=function(t){return arguments.length?(e=gn(t),o):e},o.source=function(n){return arguments.length?(t=gn(n),o):t},o.target=function(t){return arguments.length?(n=gn(t),o):n},o.startAngle=function(t){return arguments.length?(r=gn(t),o):r},o.endAngle=function(t){return arguments.length?(i=gn(t),o):i},o},t.svg.diagonal=function(){var t=jr,n=Hr,e=uu;function r(r,i){var o=t.call(this,r,i),a=n.call(this,r,i),u=(o.y+a.y)/2,s=[o,{x:o.x,y:u},{x:a.x,y:u},a];return"M"+(s=s.map(e))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(n){return arguments.length?(t=gn(n),r):t},r.target=function(t){return arguments.length?(n=gn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},t.svg.diagonal.radial=function(){var n=t.svg.diagonal(),e=uu,r=n.projection;return n.projection=function(t){return arguments.length?r(su(e=t)):e},n},t.svg.symbol=function(){var t=cu,n=lu;function e(e,r){return(fu.get(t.call(this,e,r))||hu)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=gn(n),e):t},e.size=function(t){return arguments.length?(n=gn(t),e):n},e};var fu=t.map({circle:hu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*gu)),e=n*gu;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/pu),e=n*pu/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/pu),e=n*pu/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});t.svg.symbolTypes=fu.keys();var pu=Math.sqrt(3),gu=Math.tan(30*Nt);Y.transition=function(t){for(var n,e,r=mu||++wu,i=ku(t),o=[],a=xu||{time:Date.now(),ease:uo,delay:0,duration:250},u=-1,s=this.length;++u0;)l[--f].call(t,a);if(o>=1)return h.event&&h.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}h||(o=i.time,a=bn((function(t){var n=h.delay;if(a.t=n+o,n<=t)return f(t-n);a.c=f}),0,o),h=c[r]={tween:new _,time:o,timer:a,delay:i.delay,duration:i.duration,ease:i.ease,index:n},i=null,++c.count)}_u.call=Y.call,_u.empty=Y.empty,_u.node=Y.node,_u.size=Y.size,t.transition=function(n,e){return n&&n.transition?mu?n.transition(e):n:t.selection().transition(n)},t.transition.prototype=_u,_u.select=function(t){var n,e,r,i=this.id,o=this.namespace,a=[];t=W(t);for(var u=-1,s=this.length;++urect,.s>rect").attr("width",u[1]-u[0])}function d(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function y(){var h,y,v=this,m=t.select(t.event.target),x=r.of(v,arguments),_=t.select(v),w=m.datum(),b=!/^(n|s)$/.test(w)&&i,M=!/^(e|w)$/.test(w)&&a,k=m.classed("extent"),E=xt(v),S=t.mouse(v),A=t.select(o(v)).on("keydown.brush",T).on("keyup.brush",F);if(t.event.changedTouches?A.on("touchmove.brush",L).on("touchend.brush",z):A.on("mousemove.brush",L).on("mouseup.brush",z),_.interrupt().selectAll("*").interrupt(),k)S[0]=u[0]-S[0],S[1]=s[0]-S[1];else if(w){var C=+/w$/.test(w),N=+/^n/.test(w);y=[u[1-C]-S[0],s[1-N]-S[1]],S[0]=u[C],S[1]=s[N]}else t.event.altKey&&(h=S.slice());function T(){32==t.event.keyCode&&(k||(h=null,S[0]-=u[1],S[1]-=s[1],k=2),P())}function F(){32==t.event.keyCode&&2==k&&(S[0]+=u[1],S[1]+=s[1],k=0,P())}function L(){var n=t.mouse(v),e=!1;y&&(n[0]+=y[0],n[1]+=y[1]),k||(t.event.altKey?(h||(h=[(u[0]+u[1])/2,(s[0]+s[1])/2]),S[0]=u[+(n[0]1?{floor:function(n){for(;u(n=t.floor(n));)n=qu(n-1);return n},ceil:function(n){for(;u(n=t.ceil(n));)n=qu(+n+1);return n}}:t))},i.ticks=function(t,n){var e=pa(i.domain()),r=null==t?o(e,10):"number"==typeof t?o(e,t):!t.range&&[{range:t},n];return r&&(t=r[0],n=r[1]),t.range(e[0],qu(+e[1]+1),n<1?1:n)},i.tickFormat=function(){return r},i.copy=function(){return Pu(n.copy(),e,r)},_a(i,n)}function qu(t){return new Date(t)}Lu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ru:zu,Ru.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Ru.toString=zu.toString,Ln.second=Pn((function(t){return new Dn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),Ln.seconds=Ln.second.range,Ln.seconds.utc=Ln.second.utc.range,Ln.minute=Pn((function(t){return new Dn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),Ln.minutes=Ln.minute.range,Ln.minutes.utc=Ln.minute.utc.range,Ln.hour=Pn((function(t){var n=t.getTimezoneOffset()/60;return new Dn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),Ln.hours=Ln.hour.range,Ln.hours.utc=Ln.hour.utc.range,Ln.month=Pn((function(t){return(t=Ln.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),Ln.months=Ln.month.range,Ln.months.utc=Ln.month.utc.range;var Uu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ou=[[Ln.second,1],[Ln.second,5],[Ln.second,15],[Ln.second,30],[Ln.minute,1],[Ln.minute,5],[Ln.minute,15],[Ln.minute,30],[Ln.hour,1],[Ln.hour,3],[Ln.hour,6],[Ln.hour,12],[Ln.day,1],[Ln.day,2],[Ln.week,1],[Ln.month,1],[Ln.month,3],[Ln.year,1]],Iu=Lu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",We]]),ju={range:function(n,e,r){return t.range(Math.ceil(n/r)*r,+e,r).map(qu)},floor:N,ceil:N};Ou.year=Ln.year,Ln.scale=function(){return Pu(t.scale.linear(),Ou,Iu)};var Hu=Ou.map((function(t){return[t[0].utc,t[1]]})),Vu=Du.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",We]]);function Bu(t){return JSON.parse(t.responseText)}function Yu(t){var n=r.createRange();return n.selectNode(r.body),n.createContextualFragment(t.responseText)}Hu.year=Ln.year.utc,Ln.scale.utc=function(){return Pu(t.scale.linear(),Hu,Vu)},t.text=dn((function(t){return t.responseText})),t.json=function(t,n){return yn(t,"application/json",Bu,n)},t.html=function(t,n){return yn(t,"text/html",Yu,n)},t.xml=dn((function(t){return t.responseXML})),"function"==typeof define&&define.amd?(this.d3=t,define(t)):"object"==typeof module&&module.exports?module.exports=t:this.d3=t}(),null==window.Epoch&&(window.Epoch={}),null==(c=window.Epoch).Chart&&(c.Chart={}),null==(t=window.Epoch).Time&&(t.Time={}),null==(n=window.Epoch).Util&&(n.Util={}),null==(e=window.Epoch).Formats&&(e.Formats={}),Epoch.warn=function(t){return(console.warn||console.log)("Epoch Warning: "+t)},Epoch.exception=function(t){throw"Epoch Error: "+t},Epoch.TestContext=function(){var t;function n(){var n,e,r;for(this._log=[],n=0,e=t.length;n0},Epoch.Util.copy=function(t){var n,e,r;if(null==t)return null;for(e in n={},t)a.call(t,e)&&(r=t[e],n[e]=r);return n},Epoch.Util.defaults=function(t,n){var e,r,i,o,u;for(i in u=Epoch.Util.copy(t),n)a.call(n,i)&&(n[i],o=t[i],r=n[i],e=Epoch.isObject(o)&&Epoch.isObject(r),null!=o&&null!=r?e&&!Epoch.isArray(o)?u[i]=Epoch.Util.defaults(o,r):u[i]=o:u[i]=null!=o?o:r);return u},Epoch.Util.formatSI=function(t,n,e){var r,i,o,u,s;if(null==n&&(n=1),null==e&&(e=!1),t<1e3)return((0|(u=t))!==u||e)&&(u=u.toFixed(n)),u;for(i in s=["K","M","G","T","P","E","Z","Y"])if(a.call(s,i)&&(o=s[i],t>=(r=Math.pow(10,3*(1+(0|i))))&&t=(r=Math.pow(1024,1+(0|i)))&&t=0;)r.push(this._events[t].splice(e,1));return r}},t.prototype.offAll=function(t){var n,e,r,i,o,u;if(Epoch.isArray(t)){for(o=[],e=0,r=t.length;en;i=1<=n?++t:--t)e.push(arguments[i]);return e}.apply(this,arguments),s=[],o=0,a=(u=this._events[t]).length;o=this.data.length||(i=this.data[e]));return i},r.prototype.showLayer=function(t){var n;if((n=this._findLayer(t))&&!n.visible)return n.visible=!0,this.trigger("layer:shown")},r.prototype.hideLayer=function(t){var n;if((n=this._findLayer(t))&&n.visible)return n.visible=!1,this.trigger("layer:hidden")},r.prototype.toggleLayer=function(t){var n;if(n=this._findLayer(t))return n.visible=!n.visible,n.visible?this.trigger("layer:shown"):this.trigger("layer:hidden")},r.prototype.isLayerVisible=function(t){var n;return(n=this._findLayer(t))?n.visible:null},r.prototype.getVisibleLayers=function(){return this.data.filter((function(t){return t.visible}))},r.prototype.update=function(t,n){if(null==n&&(n=!0),this.setData(t),n)return this.draw()},r.prototype.draw=function(){return this.trigger("draw")},r.prototype._getScaleDomain=function(t){var n,e,r,i;return Array.isArray(t)?t:Epoch.isString(t)&&null!=(n=this.getVisibleLayers().filter((function(n){return n.range===t})).map((function(t){return t.values})))&&n.length?(r=function(t,n){return nt?n:t},[(i=Epoch.Util.flatten(n).map((function(t){return t.y}))).reduce(r,i[0]),i.reduce(e,i[0])]):Array.isArray(this.options.range)?this.options.range:this.options.range&&Array.isArray(this.options.range.left)?this.options.range.left:this.options.range&&Array.isArray(this.options.range.right)?this.options.range.right:this.extent((function(t){return t.y}))},r.prototype.extent=function(t){return[d3.min(this.getVisibleLayers(),(function(n){return d3.min(n.values,t)})),d3.max(this.getVisibleLayers(),(function(n){return d3.max(n.values,t)}))]},r.prototype.dimensionsChanged=function(){return this.width=this.option("width")||this.width,this.height=this.option("height")||this.height,this.el.width(this.width),this.el.height(this.height)},r.prototype.layerChanged=function(){return this.draw()},r}(Epoch.Events),Epoch.Chart.SVG=function(t){function n(t){this.options=null!=t?t:{},n.__super__.constructor.call(this,this.options),null!=this.el?this.svg=this.el.append("svg"):this.svg=d3.select(document.createElement("svg")),this.svg.attr({xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height})}return s(n,t),n.prototype.dimensionsChanged=function(){return n.__super__.dimensionsChanged.call(this),this.svg.attr("width",this.width).attr("height",this.height)},n}(Epoch.Chart.Base),Epoch.Chart.Canvas=function(t){function n(t){this.options=null!=t?t:{},n.__super__.constructor.call(this,this.options),null!=this.options.pixelRatio?this.pixelRatio=this.options.pixelRatio:null!=window.devicePixelRatio?this.pixelRatio=window.devicePixelRatio:this.pixelRatio=1,this.canvas=d3.select(document.createElement("CANVAS")),this.canvas.style({width:this.width+"px",height:this.height+"px"}),this.canvas.attr({width:this.getWidth(),height:this.getHeight()}),null!=this.el&&this.el.node().appendChild(this.canvas.node()),this.ctx=Epoch.Util.getContext(this.canvas.node())}return s(n,t),n.prototype.getWidth=function(){return this.width*this.pixelRatio},n.prototype.getHeight=function(){return this.height*this.pixelRatio},n.prototype.clear=function(){return this.ctx.clearRect(0,0,this.getWidth(),this.getHeight())},n.prototype.getStyles=function(t){return Epoch.QueryCSS.getStyles(t,this.el)},n.prototype.dimensionsChanged=function(){return n.__super__.dimensionsChanged.call(this),this.canvas.style({width:this.width+"px",height:this.height+"px"}),this.canvas.attr({width:this.getWidth(),height:this.getHeight()})},n.prototype.redraw=function(){return Epoch.QueryCSS.purge(),this.draw()},n}(Epoch.Chart.Base),u=function(){var t,n,e,r,i;function o(){}return n=0,r=function(){return"epoch-container-"+n++},t=/^([^#. ]+)?(#[^. ]+)?(\.[^# ]+)?$/,e=!1,i=function(n){var e,r,i,o,a;return null==(o=n.match(t))?Epoch.error("Query CSS cannot match given selector: "+n):(o[0],a=o[1],i=o[2],e=o[3],a=(null!=a?a:"div").toUpperCase(),r=document.createElement(a),null!=i&&(r.id=i.substr(1)),null!=e&&(r.className=e.substr(1).replace(/\./g," ")),r)},o.log=function(t){return e=t},o.cache={},o.styleList=["fill","stroke","stroke-width"],o.container=null,o.purge=function(){return o.cache={}},o.getContainer=function(){var t;return null!=o.container?o.container:((t=document.createElement("DIV")).id="_canvas_css_reference",document.body.appendChild(t),o.container=d3.select(t))},o.hash=function(t,n){var e;return null==(e=n.attr("data-epoch-container-id"))&&(e=r(),n.attr("data-epoch-container-id",e)),e+"__"+t},o.getStyles=function(t,n){var r,a,u,s,l,c,h,f,p,g,d,y,v,m,x,_,w,b,M,k,E,S;if(a=o.hash(t,n),null!=(r=o.cache[a]))return r;for(m=[],v=n.node().parentNode;null!=v&&"body"!==v.nodeName.toLowerCase();)m.unshift(v),v=v.parentNode;for(m.push(n.node()),k=[],l=0,f=m.length;l0&&(M+="#"+s.id),null!=s.className&&s.className.length>0&&(M+="."+Epoch.Util.trim(s.className).replace(/\s+/g,".")),k.push(M);for(k.push("svg"),c=0,p=(_=Epoch.Util.trim(t).split(/\s+/)).length;ce)t.label=u[e];else if(o&&r.length>e)t.label=r[e];else if(i){for(a=[];e>=0;)a.push(String.fromCharCode(65+e%26)),e-=26;t.label=a.join("")}return t},Epoch.Data.Format.array=(f={x:function(t,n){return n},y:function(t,n){return t},time:function(t,n,e){return parseInt(e)+parseInt(n)},type:"area",autoLabels:!1,labels:[],startTime:parseInt((new Date).getTime()/1e3)},h=function(t,n,e){var r,i,o;if(i=[],Epoch.isArray(t[0]))for(r in t)a.call(t,r)&&(o=t[r],i.push(l({values:o.map(e)},n,parseInt(r))));else i.push(l({values:t.map(e)},n,0));return i},g=function(t,n){return h(t,n,(function(t,e){return{x:n.x(t,e),y:n.y(t,e)}}))},v=function(t,n){return h(t,n,(function(t,e){return{time:n.time(t,e,n.startTime),y:n.y(t,e)}}))},d=function(t,n){return h(t,n,(function(t,e){return{time:n.time(t,e,n.startTime),histogram:t}}))},y=function(t,n){var e,r,i;for(e in r=[],t)if(a.call(t,e)){if(i=t[e],!Epoch.isNumber(t[0]))return[];r.push(l({value:i},n,e))}return r},(p=function(t,n){var e;return null==t&&(t=[]),null==n&&(n={}),Epoch.isNonEmptyArray(t)?"time.heatmap"===(e=Epoch.Util.defaults(n,f)).type?d(t,e):e.type.match(/^time\./)?v(t,e):"pie"===e.type?y(t,e):g(t,e):[]}).entry=function(t,n){var e,r,i,o,a,u,s,l;if(null==n&&(n={}),"time.gauge"===n.type)return null==t?0:(u=Epoch.Util.defaults(n,f),e=Epoch.isArray(t)?t[0]:t,u.y(e,0));if(null==t)return[];for(null==n.startTime&&(n.startTime=parseInt((new Date).getTime()/1e3)),r=Epoch.isArray(t)?t.map((function(t){return[t]})):[t],l=[],i=0,a=(s=p(r,n)).length;i-1},i.prototype.innerWidth=function(){return this.width-(this.margins.left+this.margins.right)},i.prototype.innerHeight=function(){return this.height-(this.margins.top+this.margins.bottom)},i.prototype.x=function(){var t,n;return t=null!=(n=this.options.domain)?n:this.extent((function(t){return t.x})),d3.scale.linear().domain(t).range([0,this.innerWidth()])},i.prototype.y=function(t){return d3.scale.linear().domain(this._getScaleDomain(t)).range([this.innerHeight(),0])},i.prototype.bottomAxis=function(){return d3.svg.axis().scale(this.x()).orient("bottom").ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom)},i.prototype.topAxis=function(){return d3.svg.axis().scale(this.x()).orient("top").ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top)},i.prototype.leftAxis=function(){var t;return t=this.options.range?this.options.range.left:null,d3.svg.axis().scale(this.y(t)).orient("left").ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left)},i.prototype.rightAxis=function(){var t;return t=this.options.range?this.options.range.right:null,d3.svg.axis().scale(this.y(t)).orient("right").ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right)},i.prototype.draw=function(){return this._axesDrawn?this._redrawAxes():this._drawAxes(),i.__super__.draw.call(this)},i.prototype._redrawAxes=function(){if(this.hasAxis("bottom")&&this.g.selectAll(".x.axis.bottom").transition().duration(500).ease("linear").call(this.bottomAxis()),this.hasAxis("top")&&this.g.selectAll(".x.axis.top").transition().duration(500).ease("linear").call(this.topAxis()),this.hasAxis("left")&&this.g.selectAll(".y.axis.left").transition().duration(500).ease("linear").call(this.leftAxis()),this.hasAxis("right"))return this.g.selectAll(".y.axis.right").transition().duration(500).ease("linear").call(this.rightAxis())},i.prototype._drawAxes=function(){return this.hasAxis("bottom")&&this.g.append("g").attr("class","x axis bottom").attr("transform","translate(0, "+this.innerHeight()+")").call(this.bottomAxis()),this.hasAxis("top")&&this.g.append("g").attr("class","x axis top").call(this.topAxis()),this.hasAxis("left")&&this.g.append("g").attr("class","y axis left").call(this.leftAxis()),this.hasAxis("right")&&this.g.append("g").attr("class","y axis right").attr("transform","translate("+this.innerWidth()+", 0)").call(this.rightAxis()),this._axesDrawn=!0},i.prototype.dimensionsChanged=function(){return i.__super__.dimensionsChanged.call(this),this.g.selectAll(".axis").remove(),this._axesDrawn=!1,this.draw()},i.prototype.marginsChanged=function(){var t,n,e;if(null!=this.options.margins){for(t in n=this.options.margins)a.call(n,t)&&(e=n[t],this.margins[t]=null==e?6:e);return this.g.transition().duration(750).attr("transform","translate("+this.margins.left+", "+this.margins.top+")"),this.draw()}},i.prototype.axesChanged=function(){var t,e,r,i;for(t=0,e=(i=["top","right","bottom","left"]).length;t0?tn;e=t+=o)a.push(this.data[0].values[e].x);return a}.call(this))},o.prototype.bottomAxis=function(){var t;return t=d3.svg.axis().scale(this.x()).orient("bottom").ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom),this._isVertical()&&null!=this.options.ticks.bottom&&t.tickValues(this._getTickValues(this.options.ticks.bottom)),t},o.prototype.topAxis=function(){var t;return t=d3.svg.axis().scale(this.x()).orient("top").ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top),this._isVertical()&&null!=this.options.ticks.top&&t.tickValues(this._getTickValues(this.options.ticks.top)),t},o.prototype.leftAxis=function(){var t;return t=d3.svg.axis().scale(this.y()).orient("left").ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left),this._isHorizontal()&&null!=this.options.ticks.left&&t.tickValues(this._getTickValues(this.options.ticks.left)),t},o.prototype.rightAxis=function(){var t;return t=d3.svg.axis().scale(this.y()).orient("right").ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right),this._isHorizontal()&&null!=this.options.ticks.right&&t.tickValues(this._getTickValues(this.options.ticks.right)),t},o.prototype.orientationChanged=function(){var t,n,e,r;return r=this.options.tickFormats.top,t=this.options.tickFormats.bottom,n=this.options.tickFormats.left,e=this.options.tickFormats.right,this.options.tickFormats.left=r,this.options.tickFormats.right=t,this.options.tickFormats.top=n,this.options.tickFormats.bottom=e,this.draw()},o.prototype.paddingChanged=function(){return this.draw()},o}(Epoch.Chart.Plot),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Chart.Histogram=function(t){var n,e;function r(t){this.options=null!=t?t:{},r.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,n)),this.onAll(e),this.draw()}return s(r,t),n={type:"histogram",domain:[0,100],bucketRange:[0,100],buckets:10,cutOutliers:!1},e={"option:bucketRange":"bucketRangeChanged","option:buckets":"bucketsChanged","option:cutOutliers":"cutOutliersChanged"},r.prototype._prepareData=function(t){var n,e,r,i,o,u,s,l,c,h,f,p,g,d;for(n=(this.options.bucketRange[1]-this.options.bucketRange[0])/this.options.buckets,f=[],i=0,l=t.length;in;0<=n?++t:--t)e.push(0);return e}.call(this),u=0,c=(g=s.values).length;u=this.options.buckets)||(r<0?r=0:r>=this.options.buckets&&(r=this.options.buckets-1),e[r]+=parseInt(h.y));for(o in p={values:e.map((function(t,e){return{x:parseInt(e)*n,y:t}}))},s)a.call(s,o)&&(d=s[o],"values"!==o&&(p[o]=d));f.push(p)}return f},r.prototype.resetData=function(){return this.setData(this.rawData),this.draw()},r.prototype.bucketRangeChanged=function(){return this.resetData()},r.prototype.bucketsChanged=function(){return this.resetData()},r.prototype.cutOutliersChanged=function(){return this.resetData()},r}(Epoch.Chart.Bar),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Chart.Line=function(t){function n(t){var e;this.options=null!=t?t:{},null==(e=this.options).type&&(e.type="line"),n.__super__.constructor.call(this,this.options),this.draw()}return s(n,t),n.prototype.line=function(t){var n,e,r;return n=[this.x(),this.y(t.range)],e=n[0],r=n[1],d3.svg.line().x((function(t){return e(t.x)})).y((function(t){return r(t.y)}))},n.prototype.draw=function(){var t,e,r;return 0===(this.x(),this.y(),e=this.getVisibleLayers()).length?this.g.selectAll(".layer").remove():((t=this.g.selectAll(".layer").data(e,(function(t){return t.category}))).select(".line").transition().duration(500).attr("d",(r=this,function(t){return r.line(t)(t.values)})),t.enter().append("g").attr("class",(function(t){return t.className})).append("path").attr("class","line").attr("d",function(t){return function(n){return t.line(n)(n.values)}}(this)),t.exit().transition().duration(750).style("opacity","0").remove(),n.__super__.draw.call(this))},n}(Epoch.Chart.Plot),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Chart.Pie=function(t){var n;function e(t){var r;this.options=null!=t?t:{},e.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,n)),this.pie=d3.layout.pie().sort(null).value((function(t){return t.value})),this.arc=d3.svg.arc().outerRadius((r=this,function(){return Math.max(r.width,r.height)/2-r.options.margin})).innerRadius(function(t){return function(){return t.options.inner}}(this)),this.g=this.svg.append("g").attr("transform","translate("+this.width/2+", "+this.height/2+")"),this.on("option:margin","marginChanged"),this.on("option:inner","innerChanged"),this.draw()}return s(e,t),n={type:"pie",margin:10,inner:0},e.prototype.draw=function(){var t,n;return this.g.selectAll(".arc").remove(),(t=this.g.selectAll(".arc").data(this.pie(this.getVisibleLayers()),(function(t){return t.data.category}))).enter().append("g").attr("class",(function(t){return"arc pie "+t.data.className})),t.select("path").attr("d",this.arc),t.select("text").attr("transform",(n=this,function(t){return"translate("+n.arc.centroid(t)+")"})).text((function(t){return t.data.label||t.data.category})),t.append("path").attr("d",this.arc).each((function(t){return this._current=t})),t.append("text").attr("transform",function(t){return function(n){return"translate("+t.arc.centroid(n)+")"}}(this)).attr("dy",".35em").style("text-anchor","middle").text((function(t){return t.data.label||t.data.category})),e.__super__.draw.call(this)},e.prototype.marginChanged=function(){return this.draw()},e.prototype.innerChanged=function(){return this.draw()},e}(Epoch.Chart.SVG),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Chart.Scatter=function(t){var n;function e(t){this.options=null!=t?t:{},e.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,n)),this.on("option:radius","radiusChanged"),this.draw()}return s(e,t),n={type:"scatter",radius:3.5,axes:["top","bottom","left","right"]},e.prototype.draw=function(){var t,n,r,i,o,a,u;return o=[this.x(),this.y(),this.getVisibleLayers()],a=o[0],u=o[1],r=o[2],i=this.options.radius,0===r.length?this.g.selectAll(".layer").remove():((n=this.g.selectAll(".layer").data(r,(function(t){return t.category}))).enter().append("g").attr("class",(function(t){return t.className})),(t=n.selectAll(".dot").data((function(t){return t.values}))).transition().duration(500).attr("r",(function(t){var n;return null!=(n=t.r)?n:i})).attr("cx",(function(t){return a(t.x)})).attr("cy",(function(t){return u(t.y)})),t.enter().append("circle").attr("class","dot").attr("r",(function(t){var n;return null!=(n=t.r)?n:i})).attr("cx",(function(t){return a(t.x)})).attr("cy",(function(t){return u(t.y)})),t.exit().transition().duration(750).style("opacity",0).remove(),n.exit().transition().duration(750).style("opacity",0).remove(),e.__super__.draw.call(this))},e.prototype.radiusChanged=function(){return this.draw()},e}(Epoch.Chart.Plot),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Time.Plot=function(t){var n,e,r;function i(t){var o,a,u,s,l;for(this.options=t,Epoch.Util.copy(this.options.margins),i.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,e)),this.options.model&&this.options.model.on("data:push",(l=this,function(){return l.pushFromModel()})),this._queue=[],this.margins={},o=0,a=(s=["top","right","bottom","left"]).length;o=0&&n>=0;)this._pushTick(t,r.values[n].time,!1,!0),t-=s,n-=s;break}return u},i.prototype._prepareRangeAxes=function(){if(this.hasAxis("left")&&this.svg.append("g").attr("class","y axis left").attr("transform","translate("+(this.margins.left-1)+", "+this.margins.top+")").call(this.leftAxis()),this.hasAxis("right"))return this.svg.append("g").attr("class","y axis right").attr("transform","translate("+(this.width-this.margins.right)+", "+this.margins.top+")").call(this.rightAxis())},i.prototype.leftAxis=function(){var t,n;return n=this.options.ticks.left,t=d3.svg.axis().scale(this.ySvgLeft()).orient("left").tickFormat(this.options.tickFormats.left),2===n?t.tickValues(this.extent((function(t){return t.y}))):t.ticks(n)},i.prototype.rightAxis=function(){var t,n;return this.extent((function(t){return t.y})),n=this.options.ticks.right,t=d3.svg.axis().scale(this.ySvgRight()).orient("right").tickFormat(this.options.tickFormats.right),2===n?t.tickValues(this.extent((function(t){return t.y}))):t.ticks(n)},i.prototype.hasAxis=function(t){return this.options.axes.indexOf(t)>-1},i.prototype.innerWidth=function(){return(this.width-(this.margins.left+this.margins.right))*this.pixelRatio},i.prototype.innerHeight=function(){return(this.height-(this.margins.top+this.margins.bottom))*this.pixelRatio},i.prototype._prepareEntry=function(t){return t},i.prototype._prepareLayers=function(t){return t},i.prototype._startTransition=function(){if(!0!==this.animation.active&&0!==this._queue.length)return this.trigger("transition:start"),this._shift(),this.animation.active=!0,this.animation.interval=setInterval(this.animationCallback,1e3/this.options.fps)},i.prototype._stopTransition=function(){var t,n,e,r,i,o,a;if(this.inTransition()){for(n=0,i=(o=this.data).length;nthis.options.windowSize+1&&r.values.shift();return t=(a=[this._ticks[0],this._ticks[this._ticks.length-1]])[0],null!=(e=a[1])&&e.enter&&(e.enter=!1,e.opacity=1),null!=t&&t.exit&&this._shiftTick(),this.animation.frame=0,this.trigger("transition:end"),this._queue.length>0?this._shift():(this.animation.active=!1,clearInterval(this.animation.interval))}},i.prototype.inTransition=function(){return this.animation.active},i.prototype.push=function(t){return t=this._prepareLayers(t),this._queue.length>this.options.queueSize&&this._queue.splice(this.options.queueSize,this._queue.length-this.options.queueSize),this._queue.length!==this.options.queueSize&&(this._queue.push(t.map((n=this,function(t){return n._prepareEntry(t)}))),this.trigger("push"),this.inTransition()?void 0:this._startTransition());var n},i.prototype.pushFromModel=function(){return this.push(this.options.model.getNext(this.options.type,this.options.dataFormat))},i.prototype._shift=function(){var t,n,e;for(n in this.trigger("before:shift"),t=this._queue.shift(),e=this.data)a.call(e,n)&&e[n].values.push(t[n]);return this._updateTicks(t[0].time),this._transitionRangeAxes(),this.trigger("after:shift")},i.prototype._transitionRangeAxes=function(){if(this.hasAxis("left")&&this.svg.selectAll(".y.axis.left").transition().duration(500).ease("linear").call(this.leftAxis()),this.hasAxis("right"))return this.svg.selectAll(".y.axis.right").transition().duration(500).ease("linear").call(this.rightAxis())},i.prototype._animate=function(){if(this.inTransition())return++this.animation.frame===this.animation.duration&&this._stopTransition(),this.draw(this.animation.frame*this.animation.delta()),this._updateTimeAxes()},i.prototype.y=function(t){return d3.scale.linear().domain(this._getScaleDomain(t)).range([this.innerHeight(),0])},i.prototype.ySvg=function(t){return d3.scale.linear().domain(this._getScaleDomain(t)).range([this.innerHeight()/this.pixelRatio,0])},i.prototype.ySvgLeft=function(){return null!=this.options.range?this.ySvg(this.options.range.left):this.ySvg()},i.prototype.ySvgRight=function(){return null!=this.options.range?this.ySvg(this.options.range.right):this.ySvg()},i.prototype.w=function(){return this.innerWidth()/this.options.windowSize},i.prototype._updateTicks=function(t){if((this.hasAxis("top")||this.hasAxis("bottom"))&&(++this._tickTimer%this.options.ticks.time||this._pushTick(this.options.windowSize,t,!0),this._ticks.length>0))return this._ticks[0].x-this.w()/this.pixelRatio>=0?void 0:this._ticks[0].exit=!0},i.prototype._pushTick=function(t,n,e,r){var i,o;if(null==e&&(e=!1),null==r&&(r=!1),this.hasAxis("top")||this.hasAxis("bottom"))return o={time:n,x:t*(this.w()/this.pixelRatio)+this._offsetX(),opacity:e?0:1,enter:!!e,exit:!1},this.hasAxis("bottom")&&((i=this.bottomAxis.append("g").attr("class","tick major").attr("transform","translate("+(o.x+1)+",0)").style("opacity",o.opacity)).append("line").attr("y2",6),i.append("text").attr("text-anchor","middle").attr("dy",19).text(this.options.tickFormats.bottom(o.time)),o.bottomEl=i),this.hasAxis("top")&&((i=this.topAxis.append("g").attr("class","tick major").attr("transform","translate("+(o.x+1)+",0)").style("opacity",o.opacity)).append("line").attr("y2",-6),i.append("text").attr("text-anchor","middle").attr("dy",-10).text(this.options.tickFormats.top(o.time)),o.topEl=i),r?this._ticks.unshift(o):this._ticks.push(o),o},i.prototype._shiftTick=function(){var t;if(this._ticks.length>0)return null!=(t=this._ticks.shift()).topEl&&t.topEl.remove(),null!=t.bottomEl?t.bottomEl.remove():void 0},i.prototype._updateTimeAxes=function(){var t,n,e,r,i,o,a,u;if(this.hasAxis("top")||this.hasAxis("bottom")){for(n=(i=[this.animation.tickDelta(),1/this.options.fps])[0],t=i[1],a=[],e=0,r=(o=this._ticks).length;e0){for(o=[],t=n=0,i=r[0].values.length;0<=i?ni;t=0<=i?++n:--n)a=0,o.push(function(){var n,i,o;for(o=[],i=0,n=r.length;iu;t=0<=u?++e:--e){for(l=0,n=i=0,s=r.length;0<=s?is;n=0<=s?++i:--i)l+=r[n].values[t].y;l>o&&(o=l)}return[0,o]},n.prototype.layerChanged=function(){var t,e,r,i;for(this._stackLayers(),t=0,r=(i=this._queue).length;t=0;i=h<=0?++u:--u)if(s=l[i]){for(this.setStyles(s),this.ctx.beginPath(),o=(f=[this.options.windowSize,s.values.length,this.inTransition()])[0],a=f[1],g=f[2];--o>=-2&&--a>=0;)n=[(o+1)*d+t,y((r=s.values[a]).y+r.y0)],g&&(n[0]+=d),i===this.options.windowSize-1?this.ctx.moveTo.apply(this.ctx,n):this.ctx.lineTo.apply(this.ctx,n);e=g?(o+3)*d+t:(o+2)*d+t,this.ctx.lineTo(e,this.innerHeight()),this.ctx.lineTo(this.width*this.pixelRatio+d+t,this.innerHeight()),this.ctx.closePath(),p.push(this.ctx.fill())}return p},n.prototype._drawStrokes=function(t){var n,e,r,i,o,a,u,s,l,c,h,f,p,g;for(null==t&&(t=0),g=(s=[this.y(),this.w(),this.getVisibleLayers()])[0],p=s[1],h=[],r=o=l=(u=s[2]).length-1;l<=0?o<=0:o>=0;r=l<=0?++o:--o)if(a=u[r]){for(this.setStyles(a),this.ctx.beginPath(),r=(c=[this.options.windowSize,a.values.length,this.inTransition()])[0],i=c[1],f=c[2];--r>=-2&&--i>=0;)n=[(r+1)*p+t,g((e=a.values[i]).y+e.y0)],f&&(n[0]+=p),r===this.options.windowSize-1?this.ctx.moveTo.apply(this.ctx,n):this.ctx.lineTo.apply(this.ctx,n);h.push(this.ctx.stroke())}return h},n.prototype.draw=function(t){return null==t&&(t=0),this.clear(),this._drawAreas(t),this._drawStrokes(t),n.__super__.draw.call(this)},n}(Epoch.Time.Stack),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Time.Bar=function(t){function n(t){var e;this.options=null!=t?t:{},null==(e=this.options).type&&(e.type="time.bar"),n.__super__.constructor.call(this,this.options),this.draw()}return s(n,t),n.prototype._offsetX=function(){return.5*this.w()/this.pixelRatio},n.prototype.setStyles=function(t){var n;if(n=this.getStyles("rect.bar."+t.replace(/\s/g,".")),this.ctx.fillStyle=n.fill,null==n.stroke||"none"===n.stroke?this.ctx.strokeStyle="transparent":this.ctx.strokeStyle=n.stroke,null!=n["stroke-width"])return this.ctx.lineWidth=n["stroke-width"].replace("px","")},n.prototype.draw=function(t){var e,r,i,o,a,u,s,l,c,h,f,p,g,d,y,v,m;for(null==t&&(t=0),this.clear(),m=(f=[this.y(),this.w()])[0],v=f[1],s=0,h=(p=this.getVisibleLayers()).length;s=u&&--l>=0;)i=(d=[a*v+t,(r=c.values[l]).y,r.y0])[0],y&&(i+=v),e=[i+1,m((o=d[1])+d[2]),v-2,this.innerHeight()-m(o)+.5*this.pixelRatio],this.ctx.fillRect.apply(this.ctx,e),this.ctx.strokeRect.apply(this.ctx,e);return n.__super__.draw.call(this)},n}(Epoch.Time.Stack),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Time.Gauge=function(t){var n,e;function r(t){var i;this.options=null!=t?t:{},r.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,n)),this.value=this.options.value||0,this.options.model&&this.options.model.on("data:push",(i=this,function(){return i.pushFromModel()})),"absolute"!==this.el.style("position")&&"relative"!==this.el.style("position")&&this.el.style("position","relative"),this.svg=this.el.insert("svg",":first-child").attr("width",this.width).attr("height",this.height).attr("class","gauge-labels"),this.svg.style({position:"absolute","z-index":"1"}),this.svg.append("g").attr("transform","translate("+this.textX()+", "+this.textY()+")").append("text").attr("class","value").text(this.options.format(this.value)),this.animation={interval:null,active:!1,delta:0,target:0},this._animate=function(t){return function(){return Math.abs(t.animation.target-t.value)=c;o=0<=c?++a:--a)t=p(o),y=(n=(h=[Math.cos(t),Math.sin(t)])[0])*(u-g)+e,m=(f=h[1])*(u-g)+i,v=n*(u-g-d)+e,x=f*(u-g-d)+i,this.ctx.moveTo(y,m),this.ctx.lineTo(v,x);return this.ctx.stroke(),this.setStyles(".epoch .gauge .arc.outer"),this.ctx.beginPath(),this.ctx.arc(e,i,u,-9/8*Math.PI,1/8*Math.PI,!1),this.ctx.stroke(),this.setStyles(".epoch .gauge .arc.inner"),this.ctx.beginPath(),this.ctx.arc(e,i,u-10,-9/8*Math.PI,1/8*Math.PI,!1),this.ctx.stroke(),this.drawNeedle(),r.__super__.draw.call(this)},r.prototype.drawNeedle=function(){var t,n,e,r;return t=(r=[this.centerX(),this.centerY(),this.radius()])[0],n=r[1],e=r[2],this.value,this.options.domain[1],this.setStyles(".epoch .gauge .needle"),this.ctx.beginPath(),this.ctx.save(),this.ctx.translate(t,n),this.ctx.rotate(this.getAngle(this.value)),this.ctx.moveTo(4*this.pixelRatio,0),this.ctx.lineTo(-4*this.pixelRatio,0),this.ctx.lineTo(-1*this.pixelRatio,19-e),this.ctx.lineTo(1,19-e),this.ctx.fill(),this.setStyles(".epoch .gauge .needle-base"),this.ctx.beginPath(),this.ctx.arc(0,0,this.getWidth()/25,0,2*Math.PI),this.ctx.fill(),this.ctx.restore()},r.prototype.domainChanged=function(){return this.draw()},r.prototype.ticksChanged=function(){return this.draw()},r.prototype.tickSizeChanged=function(){return this.draw()},r.prototype.tickOffsetChanged=function(){return this.draw()},r.prototype.formatChanged=function(){return this.svg.select("text.value").text(this.options.format(this.value))},r}(Epoch.Chart.Canvas),s=function(t,n){for(var e in n)a.call(n,e)&&(t[e]=n[e]);function r(){this.constructor=t}return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},a={}.hasOwnProperty,Epoch.Time.Heatmap=function(t){var n,e,r;function i(t){this.options=null!=t?t:{},i.__super__.constructor.call(this,this.options=Epoch.Util.defaults(this.options,e)),this._setOpacityFunction(),this._setupPaintCanvas(),this.onAll(r),this.draw()}return s(i,t),e={type:"time.heatmap",buckets:10,bucketRange:[0,100],opacity:"linear",bucketPadding:2,paintZeroValues:!1,cutOutliers:!1},n={root:function(t,n){return Math.pow(t/n,.5)},linear:function(t,n){return t/n},quadratic:function(t,n){return Math.pow(t/n,2)},cubic:function(t,n){return Math.pow(t/n,3)},quartic:function(t,n){return Math.pow(t/n,4)},quintic:function(t,n){return Math.pow(t/n,5)}},r={"option:buckets":"bucketsChanged","option:bucketRange":"bucketRangeChanged","option:opacity":"opacityChanged","option:bucketPadding":"bucketPaddingChanged","option:paintZeroValues":"paintZeroValuesChanged","option:cutOutliers":"cutOutliersChanged"},i.prototype._setOpacityFunction=function(){return Epoch.isString(this.options.opacity)?(this._opacityFn=n[this.options.opacity],null==this._opacityFn?Epoch.exception("Unknown coloring function provided '"+this.options.opacity+"'"):void 0):Epoch.isFunction(this.options.opacity)?this._opacityFn=this.options.opacity:Epoch.exception("Unknown type for provided coloring function.")},i.prototype.setData=function(t){var n,e,r,o,a;for(i.__super__.setData.call(this,t),a=[],n=0,r=(o=this.data).length;nn;r=0<=n?++t:--t)e.push(0);return e}.call(this)},n=(this.options.bucketRange[1]-this.options.bucketRange[0])/this.options.buckets,s=t.histogram)a.call(s,c)&&(e=s[c],i=parseInt((c-this.options.bucketRange[0])/n),this.options.cutOutliers&&(i<0||i>=this.options.buckets)||(i<0?i=0:i>=this.options.buckets&&(i=this.options.buckets-1),u.buckets[i]+=parseInt(e)));for(r=o=0,l=u.buckets.length;0<=l?ol;r=0<=l?++o:--o)u.max=Math.max(u.max,u.buckets[r]);return u},i.prototype.y=function(){return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight(),0])},i.prototype.ySvg=function(){return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight()/this.pixelRatio,0])},i.prototype.h=function(){return this.innerHeight()/this.options.buckets},i.prototype._offsetX=function(){return.5*this.w()/this.pixelRatio},i.prototype._setupPaintCanvas=function(){return this.paintWidth=(this.options.windowSize+1)*this.w(),this.paintHeight=this.height*this.pixelRatio,this.paint=document.createElement("CANVAS"),this.paint.width=this.paintWidth,this.paint.height=this.paintHeight,this.p=Epoch.Util.getContext(this.paint),this.redraw(),this.on("after:shift","_paintEntry"),this.on("transition:end","_shiftPaintCanvas"),this.on("transition:end",(t=this,function(){return t.draw(t.animation.frame*t.animation.delta())}));var t},i.prototype.redraw=function(){var t,n;if(Epoch.isNonEmptyArray(this.data)&&Epoch.isNonEmptyArray(this.data[0].values)){for(n=this.data[0].values.length,t=this.options.windowSize,this.inTransition()&&t++;--n>=0&&--t>=0;)this._paintEntry(n,t);return this.draw(this.animation.frame*this.animation.delta())}},i.prototype._computeColor=function(t,n,e){return Epoch.Util.toRGBA(e,this._opacityFn(t,n))},i.prototype._paintEntry=function(t,n){var e,r,i,o,u,s,l,c,h,f,p,g,d,y,v,m,x,_,w,b,M,k,E;for(null==t&&(t=null),null==n&&(n=null),k=(m=[this.w(),this.h()])[0],l=m[1],null==t&&(t=this.data[0].values.length-1),null==n&&(n=this.options.windowSize),u=[],r=function(){var t,n,e;for(e=[],t=0,n=this.options.buckets;0<=n?tn;0<=n?++t:--t)e.push(0);return e}.call(this),v=0,h=0,p=(x=this.getVisibleLayers()).length;h0||this.options.paintZeroValues)&&(this.p.fillStyle=this._computeColor(M,y,i),this.p.fillRect(E,(c-1)*l,k-this.options.bucketPadding,l-this.options.bucketPadding)),w.push(c--)}return w},i.prototype._shiftPaintCanvas=function(){var t;return t=this.p.getImageData(this.w(),0,this.paintWidth-this.w(),this.paintHeight),this.p.putImageData(t,0,0)},i.prototype._avgLab=function(t,n){var e,r,i,o,u,s,l,c,h,f,p;for(l=(f=[0,0,0,0])[0],e=f[1],r=f[2],p=f[3],s=0,c=t.length;s=-2&&--o>=0;)e=[(r+1)*h+t,f(a.values[o].y)],c&&(e[0]+=h),r===this.options.windowSize-1?this.ctx.moveTo.apply(this.ctx,e):this.ctx.lineTo.apply(this.ctx,e);this.ctx.stroke()}return n.__super__.draw.call(this)},n}(Epoch.Time.Plot),Epoch._typeMap={area:Epoch.Chart.Area,bar:Epoch.Chart.Bar,line:Epoch.Chart.Line,pie:Epoch.Chart.Pie,scatter:Epoch.Chart.Scatter,histogram:Epoch.Chart.Histogram,"time.area":Epoch.Time.Area,"time.bar":Epoch.Time.Bar,"time.line":Epoch.Time.Line,"time.gauge":Epoch.Time.Gauge,"time.heatmap":Epoch.Time.Heatmap},m=function(t){return t.fn.epoch=function(t){var n,e;return t.el=this.get(0),null==(n=this.data("epoch-chart"))&&(null==(e=Epoch._typeMap[t.type])&&Epoch.exception("Unknown chart type '"+t.type+"'"),this.data("epoch-chart",n=new e(t))),n}},null!=window.jQuery&&m(jQuery),x=function(){return Element.implement("epoch",(function(t){var n,e,r;return null==(n=(r=$$(this)).retrieve("epoch-chart")[0])&&(t.el=this,null==(e=Epoch._typeMap[t.type])&&Epoch.exception("Unknown chart type '"+t.type+"'"),r.store("epoch-chart",n=new e(t))),n}))},null!=window.MooTools&&x(),_=function(t){var n,e,r;return e={},n=0,r=function(){return"epoch-chart-"+ ++n},t.extend(t.fn,{epoch:function(t){var n,i,o;return null!=(i=this.data("epoch-chart"))?e[i]:(t.el=this.get(0),null==(o=Epoch._typeMap[t.type])&&Epoch.exception("Unknown chart type '"+t.type+"'"),this.data("epoch-chart",i=r()),n=new o(t),e[i]=n,n)}})},null!=window.Zepto&&_(Zepto); \ No newline at end of file diff --git a/JarvisControl/build/debug/scheme.html b/JarvisControl/build/debug/scheme.html deleted file mode 100644 index 38e48dd..0000000 --- a/JarvisControl/build/debug/scheme.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -
- -
-
- - -
- -
- -
-
-
-
- -
-
\ No newline at end of file diff --git a/JarvisControl/build/release/JarvisControl.zip b/JarvisControl/build/release/JarvisControl.zip deleted file mode 100644 index 3abe50dcafa913f4c87a44d33cb6485c42f19092..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292705 zcmdqK-FDkZ@+a7H=6}x4*3~=$&8l*fB1rL@B4t?X54o$l%dYB@tN&Gh*{uOdP(qmk zSOBOG%bG{neVV=4yWP2-SJ-p*VjpCGksm-J0gxc1nccHpZJPixBO@asBO@XsGk^Nq zzyFu7{zU)#uV4MgzyI$qtImJ3hjAidRuwnhCiNEUfWmp(pz2HZdm!7 z6Mps8*I!q@^R7eht6u`U5?)iTK>5W3jDaTIlTWQYPNn4Joi6U77l2cLQ+BxecNW(So8V5 zZ(n*>_E#$03VP&&B(2Jcb;T)50KfX`tDh2#{y+ckfBB#Pmp}cxKhdB607hS0j@z0A z!B_ixmE)B+yQsXif)Hdmd3ACEBF>iUxeXqG0W;6HD?xa>#52*wS}xgpe7mF~9+7{( zp7GYfPY4J2Vl${{g7pxDy{-Iw3-LJt49~Cp?947Ke;z;(R=2)$ei2r>?M|=q252mA z4ML$++1n@lUJ(Ku$rFwSd%sutix51Hr$EuQ?KwmdXwB_~WBiv+5LSMmzkol(h;fLJClIy;PK#D<<61(9Dksk8sN;^iT89;aC-|^e$;Xo; zDDjB_Z$U@)m*iJ+pa3o{E?X_@1{!H)g%?I8@oGtIzpDfn*2->T%wxENT$9SocY@XN z{M-%>EB9Z0rPgW9EceO^Dy`6&eL}CZ0i4_3rH%16`^mRwP5_O>0FjLH>Oww$wih4l86jb{%?`77)Qmy9Lsu=H`{_3y3Tq1*o$0 zEJ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nv<%L_VjELJ&~%BARtq_2BWBfW&_epiLGpq$W^k^5!}CxWODE*Y%ahzf~bq{t2$ z74GL*su}*Ga>RL~tbdYs<`g+|qPL%zFc0>k&a+c%Fp=e1$vg7e2w&0Mc9Z zM#whAy^mLv?(a#RdqIvUK)=qR&9suGk+8)&fJ_(5M)6o>6)U9b+)IsR>m=&u1}xl{ z`^NHs5YCcH5~_X96hV&k%o56$YJdHUMK*;k|0t2C2AQTf#hw8}#X{|TG%*1Ye^gZ# zK-NjSjKZ+%5MNePkG&NzO<@8}>iKBwGLT4Q z5P@m0D849);q3Np%E*4?K@=(|3@Komism4+f#kyQDjc>|Z`KfI0oKTfK{SWZ3g3P* zPG2%;y)54iLE#nxz=EyU8{qP)HyXPcXf`6}8Z=7?TBtPc?c!eEfkGXdf>E#l3Z^tG z1c@U3NEybzf|?8d|3?WwG`19?5SkK>CTcf{!j56q;pX1in z{(4r7U%p$zpZeta=@_}X>f5#YUv#I4=0GCGX)&y)@*bAwPyklGl6Ly8HY$)mf;DW` z6gl6{5QrB!nQ8~z84oC3eJ=0nTz;ry^|M)TnzP<+)tLGCq^NJp+_}5%Vou3?F?}7D zOEcIs54n&Bc&!7RA(IVco#=d{z1hCo>e^IYhM4X8XLDqIvGN=on3&naJh@vt=^}Y> zpHeMbg%JodKJY+X!|X$b1=;Xn{FkraeeIXz-?1eB^xOaaJQ zv(eCCFVbZ#YuO*Kpf(mO`39XTYG1X{{A3p@;~T^d|2AO*{s~^ zUw-?WAN<$wyKD6K`%$aE|IRzo>g%OO - super "JarvisService", args - @text = __("Jarvis({0}%)", 0.toString()) - @iconclass = "fa fa-android" - - @nodes = [ - {text: __("Status"), id: 1}, - {text: __("Shutdown"), id: 3}, - {text: __("Reboot"), id: 4}, - {text: __("Exit service"), id: 2} - ] - @onchildselect = (e) => @action e - - init: () -> - checklib = () => - if not Antunnel.tunnel - @error __("The Antunnel service is not started, please start it first") - @_gui.pushService("Antunnel/AntunnelService") - .catch (e) => - @error e.toString(), e - @quit() - else - @tunnel = Antunnel.tunnel - @sub = new Antunnel.Subscriber("notification") - @sub.onopen = () => - #@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") - console.log("Subscribed to notification channel") - - @sub.onerror = (e) => - @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e - #@sub = undefined - - @sub.onmessage = (e) => - obj = JSON.parse(new TextDecoder("utf-8").decode(e.data)) if e.data - # update the battery - @text = __("Jarvis({0}%)", Math.round(obj.battery_percent).toString()) - @update() - - @sub.onclose = () => - @sub = undefined - @notify __("Unsubscribed to the notification service") - @quit() - Antunnel.tunnel.subscribe @sub - - if not window.Antunnel - console.log "require Antunnel" - @_api.requires("pkg://Antunnel/main.js").then () => - checklib() - .catch (e) => - @error __("Unable to load Antunnel: {0}",e.toString()), e - @quit() - else - checklib() - - - action: (e) -> - switch e.data.item.data.id - when 1 - @_gui.launch "JarvisControl", [] - when 2 - @quit() - when 3 - @execute("poweroff") - when 4 - @execute("reboot") - - execute: (cmd) -> - return unless @tunnel - sub = new Antunnel.Subscriber("jarvis_control") - sub.onopen = () => - console.log("Subscribed to jarvis_control channel. Send the command") - sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(cmd) - sub.close() - - sub.onerror = (e) => - @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e - #@sub = undefined - - sub.onclose = () => - @notify __("Unsubscribed to the jarvis_control service") - @tunnel.subscribe sub - - awake: () -> - - cleanup: () -> - @sub.close() if @sub - - -this.OS.register "JarvisService", JarvisService \ No newline at end of file diff --git a/JarvisControl/coffees/main.coffee b/JarvisControl/coffees/main.coffee deleted file mode 100644 index 0ba6333..0000000 --- a/JarvisControl/coffees/main.coffee +++ /dev/null @@ -1,99 +0,0 @@ - - -class JarvisControl extends this.OS.application.BaseApplication - constructor: ( args ) -> - super "JarvisControl", args - - main: () -> - @batterychart = $(@find("battery-area")).epoch({ - type: 'time.line', - axes: ['bottom', 'left', "right"], - range: [2500, 4300] - data: [{ - label: "Battery", - values: [] - }] - }) - @tempchart = $(@find("temp-area")).epoch({ - type: 'time.line', - axes: ['bottom', 'left', "right"], - range: [0, 100], - data: [{ - label: "Temperature", - values: [] - }] - }) - @memchart = $(@find("mem-area")).epoch({ - type: 'time.gauge', - value: 0 - }) - @diskchart = $(@find("disk-area")).epoch({ - type: 'time.gauge', - value: 0 - }) - @cpuchart = $(@find("cpu-area")).epoch({ - type: 'time.gauge', - value: 0 - }) - checklib = () => - if not Antunnel.tunnel - @error __("The Antunnel service is not started, please start it first") - .catch (e) => - @error e.toString(), e - @quit() - else - @tunnel = Antunnel.tunnel - @sub = new Antunnel.Subscriber("notification") - @sub.onopen = () => - #@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") - console.log("Subscribed to notification channel") - @_gui.pushService("JarvisControl/JarvisService") - - @sub.onerror = (e) => - @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e - #@sub = undefined - - @sub.onmessage = (e) => - obj = JSON.parse(new TextDecoder("utf-8").decode(e.data)) if e.data - # update the battery - @display obj - - @sub.onclose = () => - @sub = undefined - @notify __("Unsubscribed to the notification service") - @quit() - Antunnel.tunnel.subscribe @sub - @on "resize", () => - el = @find("battery-area") - @batterychart.option("width", $(el).width()) - @batterychart.option("height", $(el).height()) - el = @find("temp-area") - @tempchart.option("width", $(el).width()) - @tempchart.option("height", $(el).height()) - checklib() - - display: (data) -> - mem_percent = parseFloat(data.mem.match(/([0-9\.]+)%/)[1]) - @memchart.push mem_percent / 100.0 - @find("mem-text").text = data.mem - - disk_percent = parseFloat(data.disk.match(/([0-9\.]+)%/)[1]) - @diskchart.push disk_percent / 100.0 - @find("disk-text").text = data.disk - - cpu_percent = parseFloat(data.cpu.match(/([0-9\.]+)$/)[1]) - @cpuchart.push cpu_percent / 100.0 - @find("cpu-text").text = data.cpu - - @batterychart.push [{time: (new Date()).timestamp(), y: data.battery}] - @find("bat-text").text = __("Battery Usage: {0} mv ({1}%)", data.battery, Math.round(data.battery_percent)) - - @tempchart.push [{time: (new Date()).timestamp(), y: data.temp}] - @find("temp-text").text = __("CPU temperature: {0} C", data.temp) - cleanup: () -> - return unless @sub - @sub.close() - -JarvisControl.singleton = true - -this.OS.register "JarvisControl", JarvisControl \ No newline at end of file diff --git a/JarvisControl/project.json b/JarvisControl/project.json deleted file mode 100644 index 1965934..0000000 --- a/JarvisControl/project.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "JarvisControl", - "css": ["css/epoch.css"], - "javascripts": ["javascripts/d3.v3.js", "javascripts/epoch.js"], - "coffees": ["coffees/JarvisService.coffee", "coffees/main.coffee"], - "copies": ["assets/scheme.html", "package.json", "README.md"] -} \ No newline at end of file diff --git a/JarvisControl/README.md b/SystemControl/README.md similarity index 100% rename from JarvisControl/README.md rename to SystemControl/README.md diff --git a/SystemControl/assets/scheme.html b/SystemControl/assets/scheme.html new file mode 100644 index 0000000..6d6f3b7 --- /dev/null +++ b/SystemControl/assets/scheme.html @@ -0,0 +1,33 @@ + + + + +
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+ +
+
+ + +
+
+
+
+ +
+
\ No newline at end of file diff --git a/JarvisControl/build/debug/README.md b/SystemControl/build/debug/README.md similarity index 100% rename from JarvisControl/build/debug/README.md rename to SystemControl/build/debug/README.md diff --git a/JarvisControl/build/debug/main.css b/SystemControl/build/debug/main.css similarity index 98% rename from JarvisControl/build/debug/main.css rename to SystemControl/build/debug/main.css index 9aeb2a6..91a91ec 100644 --- a/JarvisControl/build/debug/main.css +++ b/SystemControl/build/debug/main.css @@ -1493,3 +1493,42 @@ div#_canvas_css_reference svg { position: absolute; width: 0; height: 0; top: -1 .epoch-theme-dark .epoch.category20c .arc.category20 path { fill: #52447F; } .epoch-theme-dark .epoch.category20c .bar.category20 { fill: #52447F; } + +afx-app-window[data-id="SystemControl"] .legend-color { + display: block; + height: 20px; + width: 20px; + border-radius: 25px; +} +afx-app-window[data-id="SystemControl"] .afx-window-content { + color: black; + background-color: whitesmoke; +} + +afx-app-window[data-id="SystemControl"] afx-label[data-id="disk-text"] i.label-text +{ + font-weight: bold; + padding-left: 10px; +} + + +afx-app-window[data-id="SystemControl"] .legend +{ + padding-left: 20px; +} +afx-app-window[data-id="SystemControl"] .legend div { + float: left; + font-size: 12px; + margin-right: 3px; +} + +afx-app-window[data-id="SystemControl"] .legend div.legend-label { + padding-top: 3px; + font-weight: bold; +} + +afx-app-window[data-id="SystemControl"] .legend div.legend-value { + padding-top: 4px; + margin-right: 5px; + min-width: 30px; +} \ No newline at end of file diff --git a/SystemControl/build/debug/main.js b/SystemControl/build/debug/main.js new file mode 100644 index 0000000..302bc52 --- /dev/null +++ b/SystemControl/build/debug/main.js @@ -0,0 +1,13769 @@ +(function() { + var SysmondService, SystemControl; + + SysmondService = class SysmondService extends OS.application.BaseService { + constructor(args) { + super("SysmondService", args); + this.text = __("{0}%", 0..toString()); + this.iconclass = "fa fa-android"; + this.app = void 0; + //@nodes = [ + // {text: __("Status"), id: 1}, + // {text: __("Shutdown"), id: 3}, + // {text: __("Reboot"), id: 4}, + // {text: __("Exit service"), id: 2} + //] + this.onmenuselect = (e) => { + return this.openApp(); + }; + } + + init() { + var checklib; + checklib = () => { + if (!Antunnel.tunnel) { + this.error(__("The Antunnel service is not started, please start it first")); + this._gui.pushService("Antunnel/AntunnelService").catch((e) => { + return this.error(e.toString(), e); + }); + return this.quit(); + } else { + this.tunnel = Antunnel.tunnel; + this.sub = new Antunnel.Subscriber("fbf070ddea3ea90d07f456540b405d302554ec82"); + this.sub.onopen = () => { + //@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") + return console.log("Subscribed to notification channel"); + }; + this.sub.onerror = (e) => { + return this.error(__("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e); + }; + //@sub = undefined + this.sub.onmessage = (e) => { + var obj; + if (e.data) { + obj = JSON.parse(new TextDecoder("utf-8").decode(e.data)); + } + // update the battery + this.text = __("{0}%", Math.round(obj.battery_percent).toString()); + if (this.app) { + this.app.feed(obj); + } + return this.update(); + }; + this.sub.onclose = () => { + this.sub = void 0; + this.notify(__("Unsubscribed to the notification service")); + return this.quit(); + }; + return Antunnel.tunnel.subscribe(this.sub); + } + }; + return checklib(); + } + + openApp() { + if (this.app) { + return; + } + return this._gui.launch("SystemControl", []); + } + + execute(cmd) {} + + //return unless @tunnel + //sub = new Antunnel.Subscriber("jarvis_control") + //sub.onopen = () => + // console.log("Subscribed to jarvis_control channel. Send the command") + // sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(cmd) + // sub.close() + + //sub.onerror = (e) => + // @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e + //@sub = undefined + + //sub.onclose = () => + // @notify __("Unsubscribed to the jarvis_control service") + //@tunnel.subscribe sub + awake() {} + + cleanup() { + if (this.sub) { + return this.sub.close(); + } + } + + }; + + this.OS.register("SysmondService", SysmondService); + + SystemControl = class SystemControl extends this.OS.application.BaseApplication { + constructor(args) { + super("SystemControl", args); + } + + main() { + this.diskchart = $(this.find("disk-area")).epoch({ + type: 'time.gauge', + value: 0 + }); + this.on("resize", () => { + var el; + el = this.find("cpu-area"); + if (this.cpu) { + $(el).children().hide(); + this.cpu.option("width", $(el).width()); + this.cpu.option("height", $(el).height()); + $(el).children().show(); + } + el = this.find("battery-area"); + el = this.find("memory-area"); + if (this.memory) { + $(el).children().hide(); + this.memory.option("width", $(el).width()); + this.memory.option("height", $(el).height()); + $(el).children().show(); + } + el = this.find("network-area"); + if (this.network) { + $(el).children().hide(); + this.network.option("width", $(el).width()); + this.network.option("height", $(el).height()); + $(el).children().show(); + } + el = this.find("temp-area"); + if (this.temp) { + $(el).children().hide(); + this.temp.option("width", $(el).width()); + this.temp.option("height", $(el).height()); + $(el).children().show(); + } + el = this.find("battery-area"); + if (this.battery) { + $(el).children().hide(); + this.battery.option("width", $(el).width()); + this.battery.option("height", $(el).height()); + return $(el).children().show(); + } + }); + return this._gui.pushService("SystemControl/SysmondService", []).then((p) => { + this.service = p; + return p.app = this; + }).catch((e) => { + return this.error(__("Unable to start sysmond service"), e); + }); + } + + streamline(name, data, range, labels) { + var dobj, i, item, j, k, legend, len, len1, options; + i = 0; + legend = $(this.find(`${name}-text`)); + if (!this[name]) { + options = { + type: 'time.line', + axes: ['bottom', 'left', "right"] + }; + if (range) { + options.range = range; + } + dobj = []; + for (j = 0, len = data.length; j < len; j++) { + item = data[j]; + dobj.push({ + label: `label-${i}`, + values: [] + }); + $("
").addClass('legend-color').addClass('ref').addClass('category' + (i + 1)).appendTo(legend); + $("
").addClass('legend-label').appendTo(legend).text(labels ? labels[i] : `${name}-${i}`); + $("
").addClass('legend-value').appendTo(legend); + i = i + 1; + } + options.data = dobj; + this[name] = $(this.find(`${name}-area`)).epoch(options); + } + for (k = 0, len1 = data.length; k < len1; k++) { + item = data[k]; + $(legend.children()[i * 3 + 2]).text(item.y.toString()); + i = i + 1; + } + return this[name].push(data); + } + + feed(data) { + var battery_range, cpu_data, disk_used, j, k, len, len1, mem_data, mem_range, net_data, net_rx, net_tx, now, ref, ref1, temp_data, total_mem, total_swap, used_mem, used_swap, v; + //mem_percent = parseFloat(data.mem.match(/([0-9\.]+)%/)[1]) + //@memchart.push mem_percent / 100.0 + //@find("mem-text").text = data.mem + disk_used = data.disk_total - data.disk_free; + this.diskchart.push(disk_used / data.disk_total); + this.find("disk-text").text = "Disk: " + (Math.round(disk_used / 1024 / 1024 / 1024)) + "/" + (Math.round(data.disk_total / 1024 / 1024 / 1024)) + " GB"; + now = data.stamp_sec; + data.cpu_usages.shift(); + cpu_data = (function() { + var j, len, ref, results; + ref = data.cpu_usages; + results = []; + for (j = 0, len = ref.length; j < len; j++) { + v = ref[j]; + results.push({ + time: now, + y: v.toFixed(2) + }); + } + return results; + })(); + this.streamline("cpu", cpu_data, [0, 100]); + total_mem = data.mem_total / 1024.0 / 1024.0; + used_mem = data.mem_used / 1024.0 / 1024.0; + total_swap = data.mem_swap_total / 1024.0 / 1024.0; + used_swap = (data.mem_swap_total - data.mem_swap_free) / 1024.0 / 1024.0; + mem_data = [ + { + time: now, + y: used_mem.toFixed(3) + }, + { + time: now, + y: used_swap.toFixed(3) + } + ]; + mem_range = [0, total_mem > total_swap ? total_mem : total_swap]; + this.streamline("memory", mem_data, mem_range, ["RAM (GB)", "SWAP (GB)"]); + net_rx = 0; + net_tx = 0; + ref = data.net; + for (j = 0, len = ref.length; j < len; j++) { + v = ref[j]; + net_rx = net_rx + v.rx_rate; + } + ref1 = data.net; + for (k = 0, len1 = ref1.length; k < len1; k++) { + v = ref1[k]; + net_tx = net_tx + v.tx_rate; + } + net_data = [ + { + time: now, + y: (net_rx / 1024.0).toFixed(3) + }, + { + time: now, + y: (net_tx / 1024.0).toFixed(3) + } + ]; + this.streamline("network", net_data, void 0, ["RX (Kb/s)", "TX (Kb/s)"]); + temp_data = [ + { + time: now, + y: (data.cpu_temp / 1000.0).toFixed(2) + }, + { + time: now, + y: (data.gpu_temp / 1000.0).toFixed(2) + } + ]; + this.streamline("temp", temp_data, void 0, ["CPU temp (C)", "GPU temp (C)"]); + battery_range = [(data.battery_min_voltage / 1000.0).toFixed(2), (data.battery_max_voltage / 1000.0).toFixed(2)]; + return this.streamline("battery", [ + { + time: now, + y: (data.battery / 1000.0).toFixed(2) + } + ], battery_range, ["Baterry (v)"]); + } + + cleanup() { + if (!this.service) { + return; + } + this.service.app = void 0; + return this.service = void 0; + } + + }; + + SystemControl.singleton = true; + + SystemControl.dependencies = ["pkg://Antunnel/main.js"]; + + this.OS.register("SystemControl", SystemControl); + +}).call(this); + +!function() { + var d3 = { + version: "3.5.17" + }; + var d3_arraySlice = [].slice, d3_array = function(list) { + return d3_arraySlice.call(list); + }; + var d3_document = this.document; + function d3_documentElement(node) { + return node && (node.ownerDocument || node.document || node).documentElement; + } + function d3_window(node) { + return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); + } + if (d3_document) { + try { + d3_array(d3_document.documentElement.childNodes)[0].nodeType; + } catch (e) { + d3_array = function(list) { + var i = list.length, array = new Array(i); + while (i--) array[i] = list[i]; + return array; + }; + } + } + if (!Date.now) Date.now = function() { + return +new Date(); + }; + if (d3_document) { + try { + d3_document.createElement("DIV").style.setProperty("opacity", 0, ""); + } catch (error) { + var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; + d3_element_prototype.setAttribute = function(name, value) { + d3_element_setAttribute.call(this, name, value + ""); + }; + d3_element_prototype.setAttributeNS = function(space, local, value) { + d3_element_setAttributeNS.call(this, space, local, value + ""); + }; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; + } + } + d3.ascending = d3_ascending; + function d3_ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + } + d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + }; + d3.min = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; + }; + d3.max = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; + }; + d3.extent = function(array, f) { + var i = -1, n = array.length, a, b, c; + if (arguments.length === 1) { + while (++i < n) if ((b = array[i]) != null && b >= b) { + a = c = b; + break; + } + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { + a = c = b; + break; + } + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [ a, c ]; + }; + function d3_number(x) { + return x === null ? NaN : +x; + } + function d3_numeric(x) { + return !isNaN(x); + } + d3.sum = function(array, f) { + var s = 0, n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = +array[i])) s += a; + } else { + while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a; + } + return s; + }; + d3.mean = function(array, f) { + var s = 0, n = array.length, a, i = -1, j = n; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j; + } else { + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j; + } + if (j) return s / j; + }; + d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; + return e ? v + e * (values[h] - v) : v; + }; + d3.median = function(array, f) { + var numbers = [], n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a); + } else { + while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a); + } + if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), .5); + }; + d3.variance = function(array, f) { + var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0; + if (arguments.length === 1) { + while (++i < n) { + if (d3_numeric(a = d3_number(array[i]))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } + } else { + while (++i < n) { + if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) { + d = a - m; + m += d / ++j; + s += d * (a - m); + } + } + } + if (j > 1) return s / (j - 1); + }; + d3.deviation = function() { + var v = d3.variance.apply(this, arguments); + return v ? Math.sqrt(v) : v; + }; + function d3_bisector(compare) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; + } + return lo; + } + }; + } + var d3_bisect = d3_bisector(d3_ascending); + d3.bisectLeft = d3_bisect.left; + d3.bisect = d3.bisectRight = d3_bisect.right; + d3.bisector = function(f) { + return d3_bisector(f.length === 1 ? function(d, x) { + return d3_ascending(f(d), x); + } : f); + }; + d3.shuffle = function(array, i0, i1) { + if ((m = arguments.length) < 3) { + i1 = array.length; + if (m < 2) i0 = 0; + } + var m = i1 - i0, t, i; + while (m) { + i = Math.random() * m-- | 0; + t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t; + } + return array; + }; + d3.permute = function(array, indexes) { + var i = indexes.length, permutes = new Array(i); + while (i--) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.pairs = function(array) { + var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); + while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; + return pairs; + }; + d3.transpose = function(matrix) { + if (!(n = matrix.length)) return []; + for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) { + for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) { + row[j] = matrix[j][i]; + } + } + return transpose; + }; + function d3_transposeLength(d) { + return d.length; + } + d3.zip = function() { + return d3.transpose(arguments); + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.merge = function(arrays) { + var n = arrays.length, m, i = -1, j = 0, merged, array; + while (++i < n) j += arrays[i].length; + merged = new Array(j); + while (--n >= 0) { + array = arrays[n]; + m = array.length; + while (--m >= 0) { + merged[--j] = array[m]; + } + } + return merged; + }; + var abs = Math.abs; + d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], k = d3_range_integerScale(abs(step)), i = -1, j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; + }; + function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; + } + function d3_class(ctor, properties) { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } + d3.map = function(object, f) { + var map = new d3_Map(); + if (object instanceof d3_Map) { + object.forEach(function(key, value) { + map.set(key, value); + }); + } else if (Array.isArray(object)) { + var i = -1, n = object.length, o; + if (arguments.length === 1) while (++i < n) map.set(i, object[i]); else while (++i < n) map.set(f.call(object, o = object[i], i), o); + } else { + for (var key in object) map.set(key, object[key]); + } + return map; + }; + function d3_Map() { + this._ = Object.create(null); + } + var d3_map_proto = "__proto__", d3_map_zero = "\x00"; + d3_class(d3_Map, { + has: d3_map_has, + get: function(key) { + return this._[d3_map_escape(key)]; + }, + set: function(key, value) { + return this._[d3_map_escape(key)] = value; + }, + remove: d3_map_remove, + keys: d3_map_keys, + values: function() { + var values = []; + for (var key in this._) values.push(this._[key]); + return values; + }, + entries: function() { + var entries = []; + for (var key in this._) entries.push({ + key: d3_map_unescape(key), + value: this._[key] + }); + return entries; + }, + size: d3_map_size, + empty: d3_map_empty, + forEach: function(f) { + for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]); + } + }); + function d3_map_escape(key) { + return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key; + } + function d3_map_unescape(key) { + return (key += "")[0] === d3_map_zero ? key.slice(1) : key; + } + function d3_map_has(key) { + return d3_map_escape(key) in this._; + } + function d3_map_remove(key) { + return (key = d3_map_escape(key)) in this._ && delete this._[key]; + } + function d3_map_keys() { + var keys = []; + for (var key in this._) keys.push(d3_map_unescape(key)); + return keys; + } + function d3_map_size() { + var size = 0; + for (var key in this._) ++size; + return size; + } + function d3_map_empty() { + for (var key in this._) return false; + return true; + } + d3.nest = function() { + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + function map(mapType, array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + if (mapType) { + object = mapType(); + setter = function(keyValue, values) { + object.set(keyValue, map(mapType, values, depth)); + }; + } else { + object = {}; + setter = function(keyValue, values) { + object[keyValue] = map(mapType, values, depth); + }; + } + valuesByKey.forEach(setter); + return object; + } + function entries(map, depth) { + if (depth >= keys.length) return map; + var array = [], sortKey = sortKeys[depth++]; + map.forEach(function(key, keyMap) { + array.push({ + key: key, + values: entries(keyMap, depth) + }); + }); + return sortKey ? array.sort(function(a, b) { + return sortKey(a.key, b.key); + }) : array; + } + nest.map = function(array, mapType) { + return map(mapType, array, 0); + }; + nest.entries = function(array) { + return entries(map(d3.map, array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.set = function(array) { + var set = new d3_Set(); + if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); + return set; + }; + function d3_Set() { + this._ = Object.create(null); + } + d3_class(d3_Set, { + has: d3_map_has, + add: function(key) { + this._[d3_map_escape(key += "")] = true; + return key; + }, + remove: d3_map_remove, + values: d3_map_keys, + size: d3_map_size, + empty: d3_map_empty, + forEach: function(f) { + for (var key in this._) f.call(this, d3_map_unescape(key)); + } + }); + d3.behavior = {}; + function d3_identity(d) { + return d; + } + d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; + }; + function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return value === source ? target : value; + }; + } + function d3_vendorSymbol(object, name) { + if (name in object) return name; + name = name.charAt(0).toUpperCase() + name.slice(1); + for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) { + var prefixName = d3_vendorPrefixes[i] + name; + if (prefixName in object) return prefixName; + } + } + var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ]; + function d3_noop() {} + d3.dispatch = function() { + var dispatch = new d3_dispatch(), i = -1, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; + }; + function d3_dispatch() {} + d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), name = ""; + if (i >= 0) { + name = type.slice(i + 1); + type = type.slice(0, i); + } + if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); + if (arguments.length === 2) { + if (listener == null) for (type in this) { + if (this.hasOwnProperty(type)) this[type].on(name, null); + } + return this; + } + }; + function d3_dispatch_event(dispatch) { + var listeners = [], listenerByName = new d3_Map(); + function event() { + var z = listeners, i = -1, n = z.length, l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + event.on = function(name, listener) { + var l = listenerByName.get(name), i; + if (arguments.length < 2) return l && l.on; + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + if (listener) listeners.push(listenerByName.set(name, { + on: listener + })); + return dispatch; + }; + return event; + } + d3.event = null; + function d3_eventPreventDefault() { + d3.event.preventDefault(); + } + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; + } + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; + } + d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); + }; + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + var d3_subclass = {}.__proto__ ? function(object, prototype) { + object.__proto__ = prototype; + } : function(object, prototype) { + for (var property in prototype) object[property] = prototype[property]; + }; + function d3_selection(groups) { + d3_subclass(groups, d3_selectionPrototype); + return groups; + } + var d3_select = function(s, n) { + return n.querySelector(s); + }, d3_selectAll = function(s, n) { + return n.querySelectorAll(s); + }, d3_selectMatches = function(n, s) { + var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")]; + d3_selectMatches = function(n, s) { + return d3_selectMatcher.call(n, s); + }; + return d3_selectMatches(n, s); + }; + if (typeof Sizzle === "function") { + d3_select = function(s, n) { + return Sizzle(s, n)[0] || null; + }; + d3_selectAll = Sizzle; + d3_selectMatches = Sizzle.matchesSelector; + } + d3.selection = function() { + return d3.select(d3_document.documentElement); + }; + var d3_selectionPrototype = d3.selection.prototype = []; + d3_selectionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, group, node; + selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i, j)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selector(selector) { + return typeof selector === "function" ? selector : function() { + return d3_select(selector, this); + }; + } + d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, node; + selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j))); + subgroup.parentNode = node; + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selectorAll(selector) { + return typeof selector === "function" ? selector : function() { + return d3_selectAll(selector, this); + }; + } + var d3_nsXhtml = "http://www.w3.org/1999/xhtml"; + var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: d3_nsXhtml, + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), prefix = name; + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); + return d3_nsPrefix.hasOwnProperty(prefix) ? { + space: d3_nsPrefix[prefix], + local: name + } : name; + } + }; + d3_selectionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(); + name = d3.ns.qualify(name); + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); + } + for (value in name) this.each(d3_selection_attr(value, name[value])); + return this; + } + return this.each(d3_selection_attr(name, value)); + }; + function d3_selection_attr(name, value) { + name = d3.ns.qualify(name); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrConstant() { + this.setAttribute(name, value); + } + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); + } + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); + } + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; + } + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); + } + d3_selectionPrototype.classed = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1; + if (value = node.classList) { + while (++i < n) if (!value.contains(name[i])) return false; + } else { + value = node.getAttribute("class"); + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; + } + return true; + } + for (value in name) this.each(d3_selection_classed(value, name[value])); + return this; + } + return this.each(d3_selection_classed(name, value)); + }; + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); + } + function d3_selection_classes(name) { + return (name + "").trim().split(/^|\s+/); + } + function d3_selection_classed(name, value) { + name = d3_selection_classes(name).map(d3_selection_classedName); + var n = name.length; + function classedConstant() { + var i = -1; + while (++i < n) name[i](this, value); + } + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); + } + return typeof value === "function" ? classedFunction : classedConstant; + } + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.getAttribute("class") || ""; + if (value) { + re.lastIndex = 0; + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); + } else { + node.setAttribute("class", d3_collapse(c.replace(re, " "))); + } + }; + } + d3_selectionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); + return this; + } + if (n < 2) { + var node = this.node(); + return d3_window(node).getComputedStyle(node, null).getPropertyValue(name); + } + priority = ""; + } + return this.each(d3_selection_style(name, value, priority)); + }; + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); + } + function styleConstant() { + this.style.setProperty(name, value, priority); + } + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + } + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + } + d3_selectionPrototype.property = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") return this.node()[name]; + for (value in name) this.each(d3_selection_property(value, name[value])); + return this; + } + return this.each(d3_selection_property(name, value)); + }; + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; + } + function propertyConstant() { + this[name] = value; + } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; + } + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + } + d3_selectionPrototype.text = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + } : value == null ? function() { + this.textContent = ""; + } : function() { + this.textContent = value; + }) : this.node().textContent; + }; + d3_selectionPrototype.html = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + } : value == null ? function() { + this.innerHTML = ""; + } : function() { + this.innerHTML = value; + }) : this.node().innerHTML; + }; + d3_selectionPrototype.append = function(name) { + name = d3_selection_creator(name); + return this.select(function() { + return this.appendChild(name.apply(this, arguments)); + }); + }; + function d3_selection_creator(name) { + function create() { + var document = this.ownerDocument, namespace = this.namespaceURI; + return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.createElementNS(namespace, name); + } + function createNS() { + return this.ownerDocument.createElementNS(name.space, name.local); + } + return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? createNS : create; + } + d3_selectionPrototype.insert = function(name, before) { + name = d3_selection_creator(name); + before = d3_selection_selector(before); + return this.select(function() { + return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null); + }); + }; + d3_selectionPrototype.remove = function() { + return this.each(d3_selectionRemove); + }; + function d3_selectionRemove() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + } + d3_selectionPrototype.data = function(value, key) { + var i = -1, n = this.length, group, node; + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue; + for (i = -1; ++i < n; ) { + if (node = group[i]) { + if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) { + exitNodes[i] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues[i] = keyValue; + } + } + for (i = -1; ++i < m; ) { + if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) { + enterNodes[i] = d3_selection_dataNode(nodeData); + } else if (node !== true) { + updateNodes[i] = node; + node.__data__ = nodeData; + } + nodeByKeyValue.set(keyValue, true); + } + for (i = -1; ++i < n; ) { + if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + } + } + for (;i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + } + for (;i < n; ++i) { + exitNodes[i] = group[i]; + } + } + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + update.enter = function() { + return enter; + }; + update.exit = function() { + return exit; + }; + return update; + }; + function d3_selection_dataNode(data) { + return { + __data__: data + }; + } + d3_selectionPrototype.datum = function(value) { + return arguments.length ? this.property("__data__", value) : this.property("__data__"); + }; + d3_selectionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; + } + d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; + }; + d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); + return this.order(); + }; + function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3_ascending; + return function(a, b) { + return a && b ? comparator(a.__data__, b.__data__) : !a - !b; + }; + } + d3_selectionPrototype.each = function(callback) { + return d3_selection_each(this, function(node, i, j) { + callback.call(node, node.__data__, i, j); + }); + }; + function d3_selection_each(groups, callback) { + for (var j = 0, m = groups.length; j < m; j++) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { + if (node = group[i]) callback(node, i, j); + } + } + return groups; + } + d3_selectionPrototype.call = function(callback) { + var args = d3_array(arguments); + callback.apply(args[0] = this, args); + return this; + }; + d3_selectionPrototype.empty = function() { + return !this.node(); + }; + d3_selectionPrototype.node = function() { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; + }; + d3_selectionPrototype.size = function() { + var n = 0; + d3_selection_each(this, function() { + ++n; + }); + return n; + }; + function d3_selection_enter(selection) { + d3_subclass(selection, d3_selection_enterPrototype); + return selection; + } + var d3_selection_enterPrototype = []; + d3.selection.enter = d3_selection_enter; + d3.selection.enter.prototype = d3_selection_enterPrototype; + d3_selection_enterPrototype.append = d3_selectionPrototype.append; + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; + d3_selection_enterPrototype.node = d3_selectionPrototype.node; + d3_selection_enterPrototype.call = d3_selectionPrototype.call; + d3_selection_enterPrototype.size = d3_selectionPrototype.size; + d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, upgroup, group, node; + for (var j = -1, m = this.length; ++j < m; ) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + d3_selection_enterPrototype.insert = function(name, before) { + if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); + return d3_selectionPrototype.insert.call(this, name, before); + }; + function d3_selection_enterInsertBefore(enter) { + var i0, j0; + return function(d, i, j) { + var group = enter[j].update, n = group.length, node; + if (j != j0) j0 = j, i0 = 0; + if (i >= i0) i0 = i + 1; + while (!(node = group[i0]) && ++i0 < n) ; + return node; + }; + } + d3.select = function(node) { + var group; + if (typeof node === "string") { + group = [ d3_select(node, d3_document) ]; + group.parentNode = d3_document.documentElement; + } else { + group = [ node ]; + group.parentNode = d3_documentElement(node); + } + return d3_selection([ group ]); + }; + d3.selectAll = function(nodes) { + var group; + if (typeof nodes === "string") { + group = d3_array(d3_selectAll(nodes, d3_document)); + group.parentNode = d3_document.documentElement; + } else { + group = d3_array(nodes); + group.parentNode = null; + } + return d3_selection([ group ]); + }; + d3_selectionPrototype.on = function(type, listener, capture) { + var n = arguments.length; + if (n < 3) { + if (typeof type !== "string") { + if (n < 2) listener = false; + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); + return this; + } + if (n < 2) return (n = this.node()["__on" + type]) && n._; + capture = false; + } + return this.each(d3_selection_on(type, listener, capture)); + }; + function d3_selection_on(type, listener, capture) { + var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; + if (i > 0) type = type.slice(0, i); + var filter = d3_selection_onFilters.get(type); + if (filter) type = filter, wrap = d3_selection_onFilter; + function onRemove() { + var l = this[name]; + if (l) { + this.removeEventListener(type, l, l.$); + delete this[name]; + } + } + function onAdd() { + var l = wrap(listener, d3_array(arguments)); + onRemove.call(this); + this.addEventListener(type, this[name] = l, l.$ = capture); + l._ = listener; + } + function removeAll() { + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; + for (var name in this) { + if (match = name.match(re)) { + var l = this[name]; + this.removeEventListener(match[1], l, l.$); + delete this[name]; + } + } + } + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; + } + var d3_selection_onFilters = d3.map({ + mouseenter: "mouseover", + mouseleave: "mouseout" + }); + if (d3_document) { + d3_selection_onFilters.forEach(function(k) { + if ("on" + k in d3_document) d3_selection_onFilters.remove(k); + }); + } + function d3_selection_onListener(listener, argumentz) { + return function(e) { + var o = d3.event; + d3.event = e; + argumentz[0] = this.__data__; + try { + listener.apply(this, argumentz); + } finally { + d3.event = o; + } + }; + } + function d3_selection_onFilter(listener, argumentz) { + var l = d3_selection_onListener(listener, argumentz); + return function(e) { + var target = this, related = e.relatedTarget; + if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { + l.call(target, e); + } + }; + } + var d3_event_dragSelect, d3_event_dragId = 0; + function d3_event_dragSuppress(node) { + var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault); + if (d3_event_dragSelect == null) { + d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect"); + } + if (d3_event_dragSelect) { + var style = d3_documentElement(node).style, select = style[d3_event_dragSelect]; + style[d3_event_dragSelect] = "none"; + } + return function(suppressClick) { + w.on(name, null); + if (d3_event_dragSelect) style[d3_event_dragSelect] = select; + if (suppressClick) { + var off = function() { + w.on(click, null); + }; + w.on(click, function() { + d3_eventPreventDefault(); + off(); + }, true); + setTimeout(off, 0); + } + }; + } + d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); + }; + var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0; + function d3_mousePoint(container, e) { + if (e.changedTouches) e = e.changedTouches[0]; + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if (d3_mouse_bug44083 < 0) { + var window = d3_window(container); + if (window.scrollX || window.scrollY) { + svg = d3.select("body").append("svg").style({ + position: "absolute", + top: 0, + left: 0, + margin: 0, + padding: 0, + border: "none" + }, "important"); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + } + if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, + point.y = e.clientY; + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [ point.x, point.y ]; + } + var rect = container.getBoundingClientRect(); + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; + } + d3.touch = function(container, touches, identifier) { + if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches; + if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) { + if ((touch = touches[i]).identifier === identifier) { + return d3_mousePoint(container, touch); + } + } + }; + d3.behavior.drag = function() { + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend"); + function drag() { + this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); + } + function dragstart(id, position, subject, move, end) { + return function() { + var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId); + if (origin) { + dragOffset = origin.apply(that, arguments); + dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ]; + } else { + dragOffset = [ 0, 0 ]; + } + dispatch({ + type: "dragstart" + }); + function moved() { + var position1 = position(parent, dragId), dx, dy; + if (!position1) return; + dx = position1[0] - position0[0]; + dy = position1[1] - position0[1]; + dragged |= dx | dy; + position0 = position1; + dispatch({ + type: "drag", + x: position1[0] + dragOffset[0], + y: position1[1] + dragOffset[1], + dx: dx, + dy: dy + }); + } + function ended() { + if (!position(parent, dragId)) return; + dragSubject.on(move + dragName, null).on(end + dragName, null); + dragRestore(dragged); + dispatch({ + type: "dragend" + }); + } + }; + } + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); + }; + function d3_behavior_dragTouchId() { + return d3.event.changedTouches[0].identifier; + } + d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; + }; + var ฮต = 1e-6, ฮต2 = ฮต * ฮต, ฯ€ = Math.PI, ฯ„ = 2 * ฯ€, ฯ„ฮต = ฯ„ - ฮต, halfฯ€ = ฯ€ / 2, d3_radians = ฯ€ / 180, d3_degrees = 180 / ฯ€; + function d3_sgn(x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; + } + function d3_cross2d(a, b, c) { + return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); + } + function d3_acos(x) { + return x > 1 ? 0 : x < -1 ? ฯ€ : Math.acos(x); + } + function d3_asin(x) { + return x > 1 ? halfฯ€ : x < -1 ? -halfฯ€ : Math.asin(x); + } + function d3_sinh(x) { + return ((x = Math.exp(x)) - 1 / x) / 2; + } + function d3_cosh(x) { + return ((x = Math.exp(x)) + 1 / x) / 2; + } + function d3_tanh(x) { + return ((x = Math.exp(2 * x)) - 1) / (x + 1); + } + function d3_haversin(x) { + return (x = Math.sin(x / 2)) * x; + } + var ฯ = Math.SQRT2, ฯ2 = 2, ฯ4 = 4; + d3.interpolateZoom = function(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < ฮต2) { + S = Math.log(w1 / w0) / ฯ; + i = function(t) { + return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ฯ * t * S) ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ฯ4 * d2) / (2 * w0 * ฯ2 * d1), b1 = (w1 * w1 - w0 * w0 - ฯ4 * d2) / (2 * w1 * ฯ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / ฯ; + i = function(t) { + var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ฯ2 * d1) * (coshr0 * d3_tanh(ฯ * s + r0) - d3_sinh(r0)); + return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ฯ * s + r0) ]; + }; + } + i.duration = S * 1e3; + return i; + }; + d3.behavior.zoom = function() { + var view = { + x: 0, + y: 0, + k: 1 + }, translate0, center0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1; + if (!d3_behavior_zoomWheel) { + d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); + }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return d3.event.wheelDelta; + }, "mousewheel") : (d3_behavior_zoomDelta = function() { + return -d3.event.detail; + }, "MozMousePixelScroll"); + } + function zoom(g) { + g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); + } + zoom.event = function(g) { + g.each(function() { + var dispatch = event.of(this, arguments), view1 = view; + if (d3_transitionInheritId) { + d3.select(this).transition().each("start.zoom", function() { + view = this.__chart__ || { + x: 0, + y: 0, + k: 1 + }; + zoomstarted(dispatch); + }).tween("zoom:zoom", function() { + var dx = size[0], dy = size[1], cx = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]); + return function(t) { + var l = i(t), k = dx / l[2]; + this.__chart__ = view = { + x: cx - l[0] * k, + y: cy - l[1] * k, + k: k + }; + zoomed(dispatch); + }; + }).each("interrupt.zoom", function() { + zoomended(dispatch); + }).each("end.zoom", function() { + zoomended(dispatch); + }); + } else { + this.__chart__ = view; + zoomstarted(dispatch); + zoomed(dispatch); + zoomended(dispatch); + } + }); + }; + zoom.translate = function(_) { + if (!arguments.length) return [ view.x, view.y ]; + view = { + x: +_[0], + y: +_[1], + k: view.k + }; + rescale(); + return zoom; + }; + zoom.scale = function(_) { + if (!arguments.length) return view.k; + view = { + x: view.x, + y: view.y, + k: null + }; + scaleTo(+_); + rescale(); + return zoom; + }; + zoom.scaleExtent = function(_) { + if (!arguments.length) return scaleExtent; + scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ]; + return zoom; + }; + zoom.center = function(_) { + if (!arguments.length) return center; + center = _ && [ +_[0], +_[1] ]; + return zoom; + }; + zoom.size = function(_) { + if (!arguments.length) return size; + size = _ && [ +_[0], +_[1] ]; + return zoom; + }; + zoom.duration = function(_) { + if (!arguments.length) return duration; + duration = +_; + return zoom; + }; + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 + }; + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + view = { + x: 0, + y: 0, + k: 1 + }; + return zoom; + }; + function location(p) { + return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; + } + function point(l) { + return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; + } + function scaleTo(s) { + view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + function translateTo(p, l) { + l = point(l); + view.x += p[0] - l[0]; + view.y += p[1] - l[1]; + } + function zoomTo(that, p, l, k) { + that.__chart__ = { + x: view.x, + y: view.y, + k: view.k + }; + scaleTo(Math.pow(2, k)); + translateTo(center0 = p, l); + that = d3.select(that); + if (duration > 0) that = that.transition().duration(duration); + that.call(zoom.event); + } + function rescale() { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - view.x) / view.k; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - view.y) / view.k; + }).map(y0.invert)); + } + function zoomstarted(dispatch) { + if (!zooming++) dispatch({ + type: "zoomstart" + }); + } + function zoomed(dispatch) { + rescale(); + dispatch({ + type: "zoom", + scale: view.k, + translate: [ view.x, view.y ] + }); + } + function zoomended(dispatch) { + if (!--zooming) dispatch({ + type: "zoomend" + }), center0 = null; + } + function mousedowned() { + var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that); + d3_selection_interrupt.call(that); + zoomstarted(dispatch); + function moved() { + dragged = 1; + translateTo(d3.mouse(that), location0); + zoomed(dispatch); + } + function ended() { + subject.on(mousemove, null).on(mouseup, null); + dragRestore(dragged); + zoomended(dispatch); + } + } + function touchstarted() { + var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that); + started(); + zoomstarted(dispatch); + subject.on(mousedown, null).on(touchstart, started); + function relocate() { + var touches = d3.touches(that); + scale0 = view.k; + touches.forEach(function(t) { + if (t.identifier in locations0) locations0[t.identifier] = location(t); + }); + return touches; + } + function started() { + var target = d3.event.target; + d3.select(target).on(touchmove, moved).on(touchend, ended); + targets.push(target); + var changed = d3.event.changedTouches; + for (var i = 0, n = changed.length; i < n; ++i) { + locations0[changed[i].identifier] = null; + } + var touches = relocate(), now = Date.now(); + if (touches.length === 1) { + if (now - touchtime < 500) { + var p = touches[0]; + zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1); + d3_eventPreventDefault(); + } + touchtime = now; + } else if (touches.length > 1) { + var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1]; + distance0 = dx * dx + dy * dy; + } + } + function moved() { + var touches = d3.touches(that), p0, l0, p1, l1; + d3_selection_interrupt.call(that); + for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { + p1 = touches[i]; + if (l1 = locations0[p1.identifier]) { + if (l0) break; + p0 = p1, l0 = l1; + } + } + if (l1) { + var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(scale1 * scale0); + } + touchtime = null; + translateTo(p0, l0); + zoomed(dispatch); + } + function ended() { + if (d3.event.touches.length) { + var changed = d3.event.changedTouches; + for (var i = 0, n = changed.length; i < n; ++i) { + delete locations0[changed[i].identifier]; + } + for (var identifier in locations0) { + return void relocate(); + } + } + d3.selectAll(targets).on(zoomName, null); + subject.on(mousedown, mousedowned).on(touchstart, touchstarted); + dragRestore(); + zoomended(dispatch); + } + } + function mousewheeled() { + var dispatch = event.of(this, arguments); + if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), + translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch); + mousewheelTimer = setTimeout(function() { + mousewheelTimer = null; + zoomended(dispatch); + }, 50); + d3_eventPreventDefault(); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k); + translateTo(center0, translate0); + zoomed(dispatch); + } + function dblclicked() { + var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2; + zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1); + } + return d3.rebind(zoom, event, "on"); + }; + var d3_behavior_zoomInfinity = [ 0, Infinity ], d3_behavior_zoomDelta, d3_behavior_zoomWheel; + d3.color = d3_color; + function d3_color() {} + d3_color.prototype.toString = function() { + return this.rgb() + ""; + }; + d3.hsl = d3_hsl; + function d3_hsl(h, s, l) { + return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l); + } + var d3_hslPrototype = d3_hsl.prototype = new d3_color(); + d3_hslPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, this.l / k); + }; + d3_hslPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_hsl(this.h, this.s, k * this.l); + }; + d3_hslPrototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); + }; + function d3_hsl_rgb(h, s, l) { + var m1, m2; + h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; + s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + function vv(h) { + return Math.round(v(h) * 255); + } + return new d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + } + d3.hcl = d3_hcl; + function d3_hcl(h, c, l) { + return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l) : h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : new d3_hcl(h, c, l); + } + var d3_hclPrototype = d3_hcl.prototype = new d3_color(); + d3_hclPrototype.brighter = function(k) { + return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.darker = function(k) { + return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); + }; + function d3_hcl_lab(h, c, l) { + if (isNaN(h)) h = 0; + if (isNaN(c)) c = 0; + return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); + } + d3.lab = d3_lab; + function d3_lab(l, a, b) { + return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b); + } + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + var d3_labPrototype = d3_lab.prototype = new d3_color(); + d3_labPrototype.brighter = function(k) { + return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.darker = function(k) { + return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); + }; + function d3_lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = d3_lab_xyz(x) * d3_lab_X; + y = d3_lab_xyz(y) * d3_lab_Y; + z = d3_lab_xyz(z) * d3_lab_Z; + return new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + } + function d3_lab_hcl(l, a, b) { + return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l); + } + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + function d3_xyz_lab(x) { + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + function d3_xyz_rgb(r) { + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + } + d3.rgb = d3_rgb; + function d3_rgb(r, g, b) { + return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b); + } + function d3_rgbNumber(value) { + return new d3_rgb(value >> 16, value >> 8 & 255, value & 255); + } + function d3_rgbString(value) { + return d3_rgbNumber(value) + ""; + } + var d3_rgbPrototype = d3_rgb.prototype = new d3_color(); + d3_rgbPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + var r = this.r, g = this.g, b = this.b, i = 30; + if (!r && !g && !b) return new d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k)); + }; + d3_rgbPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return new d3_rgb(k * this.r, k * this.g, k * this.b); + }; + d3_rgbPrototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); + }; + d3_rgbPrototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); + }; + function d3_rgb_hex(v) { + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); + } + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, color; + m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase()); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + } + + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + } + } + if (color = d3_rgb_names.get(format)) { + return rgb(color.r, color.g, color.b); + } + if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) { + if (format.length === 4) { + r = (color & 3840) >> 4; + r = r >> 4 | r; + g = color & 240; + g = g >> 4 | g; + b = color & 15; + b = b << 4 | b; + } else if (format.length === 7) { + r = (color & 16711680) >> 16; + g = (color & 65280) >> 8; + b = color & 255; + } + } + return rgb(r, g, b); + } + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; + } else { + h = NaN; + s = l > 0 && l < 1 ? 0 : h; + } + return new d3_hsl(h, s, l); + } + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + } + function d3_rgb_parseNumber(c) { + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + } + var d3_rgb_names = d3.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, + rebeccapurple: 6697881, + 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 + }); + d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgbNumber(value)); + }); + function d3_functor(v) { + return typeof v === "function" ? v : function() { + return v; + }; + } + d3.functor = d3_functor; + d3.xhr = d3_xhrType(d3_identity); + function d3_xhrType(response) { + return function(url, mimeType, callback) { + if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, + mimeType = null; + return d3_xhr(url, mimeType, response, callback); + }; + } + function d3_xhr(url, mimeType, response, callback) { + var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; + if (this.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest(); + "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { + request.readyState > 3 && respond(); + }; + function respond() { + var status = request.status, result; + if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) { + try { + result = response.call(xhr, request); + } catch (e) { + dispatch.error.call(xhr, e); + return; + } + dispatch.load.call(xhr, result); + } else { + dispatch.error.call(xhr, request); + } + } + request.onprogress = function(event) { + var o = d3.event; + d3.event = event; + try { + dispatch.progress.call(xhr, request); + } finally { + d3.event = o; + } + }; + xhr.header = function(name, value) { + name = (name + "").toLowerCase(); + if (arguments.length < 2) return headers[name]; + if (value == null) delete headers[name]; else headers[name] = value + ""; + return xhr; + }; + xhr.mimeType = function(value) { + if (!arguments.length) return mimeType; + mimeType = value == null ? null : value + ""; + return xhr; + }; + xhr.responseType = function(value) { + if (!arguments.length) return responseType; + responseType = value; + return xhr; + }; + xhr.response = function(value) { + response = value; + return xhr; + }; + [ "get", "post" ].forEach(function(method) { + xhr[method] = function() { + return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); + }; + }); + xhr.send = function(method, data, callback) { + if (arguments.length === 2 && typeof data === "function") callback = data, data = null; + request.open(method, url, true); + if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; + if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); + if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); + if (responseType != null) request.responseType = responseType; + if (callback != null) xhr.on("error", callback).on("load", function(request) { + callback(null, request); + }); + dispatch.beforesend.call(xhr, request); + request.send(data == null ? null : data); + return xhr; + }; + xhr.abort = function() { + request.abort(); + return xhr; + }; + d3.rebind(xhr, dispatch, "on"); + return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); + } + function d3_xhr_fixCallback(callback) { + return callback.length === 1 ? function(error, request) { + callback(error == null ? request : null); + } : callback; + } + function d3_xhrHasResponse(request) { + var type = request.responseType; + return type && type !== "text" ? request.response : request.responseText; + } + d3.dsv = function(delimiter, mimeType) { + var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); + function dsv(url, row, callback) { + if (arguments.length < 3) callback = row, row = null; + var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback); + xhr.row = function(_) { + return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; + }; + return xhr; + } + function response(request) { + return dsv.parse(request.responseText); + } + function typedResponse(f) { + return function(request) { + return dsv.parse(request.responseText, f); + }; + } + dsv.parse = function(text, f) { + var o; + return dsv.parseRows(text, function(row, i) { + if (o) return o(row, i - 1); + var a = new Function("d", "return {" + row.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + "]"; + }).join(",") + "}"); + o = f ? function(row, i) { + return f(a(row), i); + } : a; + }); + }; + dsv.parseRows = function(text, f) { + var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; + function token() { + if (I >= N) return EOF; + if (eol) return eol = false, EOL; + var j = I; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < N) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + ++i; + } + } + I = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) ++I; + } else if (c === 10) { + eol = true; + } + return text.slice(j + 1, i).replace(/""/g, '"'); + } + while (I < N) { + var c = text.charCodeAt(I++), k = 1; + if (c === 10) eol = true; else if (c === 13) { + eol = true; + if (text.charCodeAt(I) === 10) ++I, ++k; + } else if (c !== delimiterCode) continue; + return text.slice(j, I - k); + } + return text.slice(j); + } + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && (a = f(a, n++)) == null) continue; + rows.push(a); + } + return rows; + }; + dsv.format = function(rows) { + if (Array.isArray(rows[0])) return dsv.formatRows(rows); + var fieldSet = new d3_Set(), fields = []; + rows.forEach(function(row) { + for (var field in row) { + if (!fieldSet.has(field)) { + fields.push(fieldSet.add(field)); + } + } + }); + return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { + return fields.map(function(field) { + return formatValue(row[field]); + }).join(delimiter); + })).join("\n"); + }; + dsv.formatRows = function(rows) { + return rows.map(formatRow).join("\n"); + }; + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + function formatValue(text) { + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + } + return dsv; + }; + d3.csv = d3.dsv(",", "text/csv"); + d3.tsv = d3.dsv(" ", "text/tab-separated-values"); + var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { + setTimeout(callback, 17); + }; + d3.timer = function() { + d3_timer.apply(this, arguments); + }; + function d3_timer(callback, delay, then) { + var n = arguments.length; + if (n < 2) delay = 0; + if (n < 3) then = Date.now(); + var time = then + delay, timer = { + c: callback, + t: time, + n: null + }; + if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; + d3_timer_queueTail = timer; + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + return timer; + } + function d3_timer_step() { + var now = d3_timer_mark(), delay = d3_timer_sweep() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + } + d3.timer.flush = function() { + d3_timer_mark(); + d3_timer_sweep(); + }; + function d3_timer_mark() { + var now = Date.now(), timer = d3_timer_queueHead; + while (timer) { + if (now >= timer.t && timer.c(now - timer.t)) timer.c = null; + timer = timer.n; + } + return now; + } + function d3_timer_sweep() { + var t0, t1 = d3_timer_queueHead, time = Infinity; + while (t1) { + if (t1.c) { + if (t1.t < time) time = t1.t; + t1 = (t0 = t1).n; + } else { + t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; + } + } + d3_timer_queueTail = t0; + return time; + } + function d3_format_precision(x, p) { + return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); + } + d3.round = function(x, n) { + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + }; + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "ยต", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); + d3.formatPrefix = function(value, precision) { + var i = 0; + if (value = +value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; + }; + function d3_formatPrefix(d, i) { + var k = Math.pow(10, abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; + } + function d3_locale_numberFormat(locale) { + var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) { + var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0; + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = locale_grouping[j = (j + 1) % locale_grouping.length]; + } + return t.reverse().join(locale_thousands); + } : d3_identity; + return function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true; + if (precision) precision = +precision.substring(1); + if (zfill || fill === "0" && align === "=") { + zfill = fill = "0"; + align = "="; + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; + + case "%": + scale = 100; + suffix = "%"; + type = "f"; + break; + + case "p": + scale = 100; + suffix = "%"; + type = "r"; + break; + + case "b": + case "o": + case "x": + case "X": + if (symbol === "#") prefix = "0" + type.toLowerCase(); + + case "c": + exponent = false; + + case "d": + integer = true; + precision = 0; + break; + + case "s": + scale = -1; + type = "r"; + break; + } + if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; + if (type == "r" && !precision) type = "g"; + if (precision != null) { + if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision)); + } + type = d3_format_types.get(type) || d3_format_typeDefault; + var zcomma = zfill && comma; + return function(value) { + var fullSuffix = suffix; + if (integer && value % 1) return ""; + var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign; + if (scale < 0) { + var unit = d3.formatPrefix(value, precision); + value = unit.scale(value); + fullSuffix = unit.symbol + suffix; + } else { + value *= scale; + } + value = type(value, precision); + var i = value.lastIndexOf("."), before, after; + if (i < 0) { + var j = exponent ? value.lastIndexOf("e") : -1; + if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j); + } else { + before = value.substring(0, i); + after = locale_decimal + value.substring(i + 1); + } + if (!zfill && comma) before = formatGroup(before, Infinity); + var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; + if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity); + negative += prefix; + value = before + after; + return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix; + }; + }; + } + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; + var d3_format_types = d3.map({ + b: function(x) { + return x.toString(2); + }, + c: function(x) { + return String.fromCharCode(x); + }, + o: function(x) { + return x.toString(8); + }, + x: function(x) { + return x.toString(16); + }, + X: function(x) { + return x.toString(16).toUpperCase(); + }, + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); + } + }); + function d3_format_typeDefault(x) { + return x + ""; + } + var d3_time = d3.time = {}, d3_date = Date; + function d3_date_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + } + d3_date_utc.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() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); + } + }; + var d3_time_prototype = Date.prototype; + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + function ceil(date) { + step(date = local(new d3_date(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_date(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + function range_utc(t0, t1, dt) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_date = Date; + } + } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; + } + function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_date = d3_date_utc; + var utc = new d3_date_utc(); + utc._ = date; + return method(utc, k)._; + } finally { + d3_date = Date; + } + }; + } + d3_time.year = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3_time.years = d3_time.year.range; + d3_time.years.utc = d3_time.year.utc.range; + d3_time.day = d3_time_interval(function(date) { + var day = new d3_date(2e3, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3_time.days = d3_time.day.range; + d3_time.days.utc = d3_time.day.utc.range; + d3_time.dayOfYear = function(date) { + var year = d3_time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { + i = 7 - i; + var interval = d3_time[day] = d3_time_interval(function(date) { + (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3_time[day + "s"] = interval.range; + d3_time[day + "s"].utc = interval.utc.range; + d3_time[day + "OfYear"] = function(date) { + var day = d3_time.year(date).getDay(); + return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3_time.week = d3_time.sunday; + d3_time.weeks = d3_time.sunday.range; + d3_time.weeks.utc = d3_time.sunday.utc.range; + d3_time.weekOfYear = d3_time.sundayOfYear; + function d3_locale_timeFormat(locale) { + var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; + function d3_time_format(template) { + var n = template.length; + function format(date) { + var string = [], i = -1, j = 0, c, p, f; + while (++i < n) { + if (template.charCodeAt(i) === 37) { + string.push(template.slice(j, i)); + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); + string.push(c); + j = i + 1; + } + } + string.push(template.slice(j, i)); + return string.join(""); + } + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0, + Z: null + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); + if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + date.setFullYear(d.y, 0, 1); + date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7); + } else date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L); + return localZ ? date._ : date; + }; + format.toString = function() { + return template; + }; + return format; + } + function d3_time_parse(date, template, string, j) { + var c, p, t, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c === 37) { + t = template.charAt(i++); + p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; + } + d3_time_format.utc = function(template) { + var local = d3_time_format(template); + function format(date) { + try { + d3_date = d3_date_utc; + var utc = new d3_date(); + utc._ = date; + return local(utc); + } finally { + d3_date = Date; + } + } + format.parse = function(string) { + try { + d3_date = d3_date_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_date = Date; + } + }; + format.toString = local.toString; + return format; + }; + d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; + var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths); + locale_periods.forEach(function(p, i) { + d3_time_periodLookup.set(p.toLowerCase(), i); + }); + var d3_time_formats = { + a: function(d) { + return locale_shortDays[d.getDay()]; + }, + A: function(d) { + return locale_days[d.getDay()]; + }, + b: function(d) { + return locale_shortMonths[d.getMonth()]; + }, + B: function(d) { + return locale_months[d.getMonth()]; + }, + c: d3_time_format(locale_dateTime), + d: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + e: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + H: function(d, p) { + return d3_time_formatPad(d.getHours(), p, 2); + }, + I: function(d, p) { + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); + }, + j: function(d, p) { + return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); + }, + L: function(d, p) { + return d3_time_formatPad(d.getMilliseconds(), p, 3); + }, + m: function(d, p) { + return d3_time_formatPad(d.getMonth() + 1, p, 2); + }, + M: function(d, p) { + return d3_time_formatPad(d.getMinutes(), p, 2); + }, + p: function(d) { + return locale_periods[+(d.getHours() >= 12)]; + }, + S: function(d, p) { + return d3_time_formatPad(d.getSeconds(), p, 2); + }, + U: function(d, p) { + return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d, p) { + return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); + }, + x: d3_time_format(locale_date), + X: d3_time_format(locale_time), + y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 100, p, 2); + }, + Y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); + }, + Z: d3_time_zone, + "%": function() { + return "%"; + } + }; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + j: d3_time_parseDayOfYear, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + U: d3_time_parseWeekNumberSunday, + w: d3_time_parseWeekdayNumber, + W: d3_time_parseWeekNumberMonday, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear, + Z: d3_time_parseZone, + "%": d3_time_parseLiteralPercent + }; + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.slice(i)); + return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.slice(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + return d3_time_format; + } + var d3_time_formatPads = { + "-": "", + _: " ", + "0": "0" + }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; + function d3_time_formatPad(value, fill, width) { + var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); + } + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); + } + function d3_time_formatLookup(names) { + var map = new d3_Map(), i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; + } + function d3_time_parseWeekdayNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 1)); + return n ? (date.w = +n[0], i + n[0].length) : -1; + } + function d3_time_parseWeekNumberSunday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.U = +n[0], i + n[0].length) : -1; + } + function d3_time_parseWeekNumberMonday(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i)); + return n ? (date.W = +n[0], i + n[0].length) : -1; + } + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 4)); + return n ? (date.y = +n[0], i + n[0].length) : -1; + } + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; + } + function d3_time_parseZone(date, string, i) { + return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string, + i + 5) : -1; + } + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); + } + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.m = n[0] - 1, i + n[0].length) : -1; + } + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.d = +n[0], i + n[0].length) : -1; + } + function d3_time_parseDayOfYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.j = +n[0], i + n[0].length) : -1; + } + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.H = +n[0], i + n[0].length) : -1; + } + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.M = +n[0], i + n[0].length) : -1; + } + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 2)); + return n ? (date.S = +n[0], i + n[0].length) : -1; + } + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.slice(i, i + 3)); + return n ? (date.L = +n[0], i + n[0].length) : -1; + } + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60; + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); + } + function d3_time_parseLiteralPercent(date, string, i) { + d3_time_percentRe.lastIndex = 0; + var n = d3_time_percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + function d3_time_formatMulti(formats) { + var n = formats.length, i = -1; + while (++i < n) formats[i][0] = this(formats[i][0]); + return function(date) { + var i = 0, f = formats[i]; + while (!f[1](date)) f = formats[++i]; + return f[0](date); + }; + } + d3.locale = function(locale) { + return { + numberFormat: d3_locale_numberFormat(locale), + timeFormat: d3_locale_timeFormat(locale) + }; + }; + var d3_locale_enUS = d3.locale({ + decimal: ".", + thousands: ",", + grouping: [ 3 ], + currency: [ "$", "" ], + dateTime: "%a %b %e %X %Y", + date: "%m/%d/%Y", + time: "%H:%M:%S", + periods: [ "AM", "PM" ], + days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], + shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], + shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] + }); + d3.format = d3_locale_enUS.numberFormat; + d3.geo = {}; + function d3_adder() {} + d3_adder.prototype = { + s: 0, + t: 0, + add: function(y) { + d3_adderSum(y, this.t, d3_adderTemp); + d3_adderSum(d3_adderTemp.s, this.s, this); + if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; + }, + reset: function() { + this.s = this.t = 0; + }, + valueOf: function() { + return this.s; + } + }; + var d3_adderTemp = new d3_adder(); + function d3_adderSum(a, b, o) { + var x = o.s = a + b, bv = x - a, av = x - bv; + o.t = a - av + (b - bv); + } + d3.geo.stream = function(object, listener) { + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { + d3_geo_streamObjectType[object.type](object, listener); + } else { + d3_geo_streamGeometry(object, listener); + } + }; + function d3_geo_streamGeometry(geometry, listener) { + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { + d3_geo_streamGeometryType[geometry.type](geometry, listener); + } + } + var d3_geo_streamObjectType = { + Feature: function(feature, listener) { + d3_geo_streamGeometry(feature.geometry, listener); + }, + FeatureCollection: function(object, listener) { + var features = object.features, i = -1, n = features.length; + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); + } + }; + var d3_geo_streamGeometryType = { + Sphere: function(object, listener) { + listener.sphere(); + }, + Point: function(object, listener) { + object = object.coordinates; + listener.point(object[0], object[1], object[2]); + }, + MultiPoint: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); + }, + LineString: function(object, listener) { + d3_geo_streamLine(object.coordinates, listener, 0); + }, + MultiLineString: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); + }, + Polygon: function(object, listener) { + d3_geo_streamPolygon(object.coordinates, listener); + }, + MultiPolygon: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); + }, + GeometryCollection: function(object, listener) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); + } + }; + function d3_geo_streamLine(coordinates, listener, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + listener.lineStart(); + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); + listener.lineEnd(); + } + function d3_geo_streamPolygon(coordinates, listener) { + var i = -1, n = coordinates.length; + listener.polygonStart(); + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); + listener.polygonEnd(); + } + d3.geo.area = function(object) { + d3_geo_areaSum = 0; + d3.geo.stream(object, d3_geo_area); + return d3_geo_areaSum; + }; + var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); + var d3_geo_area = { + sphere: function() { + d3_geo_areaSum += 4 * ฯ€; + }, + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_areaRingSum.reset(); + d3_geo_area.lineStart = d3_geo_areaRingStart; + }, + polygonEnd: function() { + var area = 2 * d3_geo_areaRingSum; + d3_geo_areaSum += area < 0 ? 4 * ฯ€ + area : area; + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; + } + }; + function d3_geo_areaRingStart() { + var ฮป00, ฯ†00, ฮป0, cosฯ†0, sinฯ†0; + d3_geo_area.point = function(ฮป, ฯ†) { + d3_geo_area.point = nextPoint; + ฮป0 = (ฮป00 = ฮป) * d3_radians, cosฯ†0 = Math.cos(ฯ† = (ฯ†00 = ฯ†) * d3_radians / 2 + ฯ€ / 4), + sinฯ†0 = Math.sin(ฯ†); + }; + function nextPoint(ฮป, ฯ†) { + ฮป *= d3_radians; + ฯ† = ฯ† * d3_radians / 2 + ฯ€ / 4; + var dฮป = ฮป - ฮป0, sdฮป = dฮป >= 0 ? 1 : -1, adฮป = sdฮป * dฮป, cosฯ† = Math.cos(ฯ†), sinฯ† = Math.sin(ฯ†), k = sinฯ†0 * sinฯ†, u = cosฯ†0 * cosฯ† + k * Math.cos(adฮป), v = k * sdฮป * Math.sin(adฮป); + d3_geo_areaRingSum.add(Math.atan2(v, u)); + ฮป0 = ฮป, cosฯ†0 = cosฯ†, sinฯ†0 = sinฯ†; + } + d3_geo_area.lineEnd = function() { + nextPoint(ฮป00, ฯ†00); + }; + } + function d3_geo_cartesian(spherical) { + var ฮป = spherical[0], ฯ† = spherical[1], cosฯ† = Math.cos(ฯ†); + return [ cosฯ† * Math.cos(ฮป), cosฯ† * Math.sin(ฮป), Math.sin(ฯ†) ]; + } + function d3_geo_cartesianDot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + function d3_geo_cartesianCross(a, b) { + return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; + } + function d3_geo_cartesianAdd(a, b) { + a[0] += b[0]; + a[1] += b[1]; + a[2] += b[2]; + } + function d3_geo_cartesianScale(vector, k) { + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; + } + function d3_geo_cartesianNormalize(d) { + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l; + d[1] /= l; + d[2] /= l; + } + function d3_geo_spherical(cartesian) { + return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; + } + function d3_geo_sphericalEqual(a, b) { + return abs(a[0] - b[0]) < ฮต && abs(a[1] - b[1]) < ฮต; + } + d3.geo.bounds = function() { + var ฮป0, ฯ†0, ฮป1, ฯ†1, ฮป_, ฮป__, ฯ†__, p0, dฮปSum, ranges, range; + var bound = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + bound.point = ringPoint; + bound.lineStart = ringStart; + bound.lineEnd = ringEnd; + dฮปSum = 0; + d3_geo_area.polygonStart(); + }, + polygonEnd: function() { + d3_geo_area.polygonEnd(); + bound.point = point; + bound.lineStart = lineStart; + bound.lineEnd = lineEnd; + if (d3_geo_areaRingSum < 0) ฮป0 = -(ฮป1 = 180), ฯ†0 = -(ฯ†1 = 90); else if (dฮปSum > ฮต) ฯ†1 = 90; else if (dฮปSum < -ฮต) ฯ†0 = -90; + range[0] = ฮป0, range[1] = ฮป1; + } + }; + function point(ฮป, ฯ†) { + ranges.push(range = [ ฮป0 = ฮป, ฮป1 = ฮป ]); + if (ฯ† < ฯ†0) ฯ†0 = ฯ†; + if (ฯ† > ฯ†1) ฯ†1 = ฯ†; + } + function linePoint(ฮป, ฯ†) { + var p = d3_geo_cartesian([ ฮป * d3_radians, ฯ† * d3_radians ]); + if (p0) { + var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); + d3_geo_cartesianNormalize(inflection); + inflection = d3_geo_spherical(inflection); + var dฮป = ฮป - ฮป_, s = dฮป > 0 ? 1 : -1, ฮปi = inflection[0] * d3_degrees * s, antimeridian = abs(dฮป) > 180; + if (antimeridian ^ (s * ฮป_ < ฮปi && ฮปi < s * ฮป)) { + var ฯ†i = inflection[1] * d3_degrees; + if (ฯ†i > ฯ†1) ฯ†1 = ฯ†i; + } else if (ฮปi = (ฮปi + 360) % 360 - 180, antimeridian ^ (s * ฮป_ < ฮปi && ฮปi < s * ฮป)) { + var ฯ†i = -inflection[1] * d3_degrees; + if (ฯ†i < ฯ†0) ฯ†0 = ฯ†i; + } else { + if (ฯ† < ฯ†0) ฯ†0 = ฯ†; + if (ฯ† > ฯ†1) ฯ†1 = ฯ†; + } + if (antimeridian) { + if (ฮป < ฮป_) { + if (angle(ฮป0, ฮป) > angle(ฮป0, ฮป1)) ฮป1 = ฮป; + } else { + if (angle(ฮป, ฮป1) > angle(ฮป0, ฮป1)) ฮป0 = ฮป; + } + } else { + if (ฮป1 >= ฮป0) { + if (ฮป < ฮป0) ฮป0 = ฮป; + if (ฮป > ฮป1) ฮป1 = ฮป; + } else { + if (ฮป > ฮป_) { + if (angle(ฮป0, ฮป) > angle(ฮป0, ฮป1)) ฮป1 = ฮป; + } else { + if (angle(ฮป, ฮป1) > angle(ฮป0, ฮป1)) ฮป0 = ฮป; + } + } + } + } else { + point(ฮป, ฯ†); + } + p0 = p, ฮป_ = ฮป; + } + function lineStart() { + bound.point = linePoint; + } + function lineEnd() { + range[0] = ฮป0, range[1] = ฮป1; + bound.point = point; + p0 = null; + } + function ringPoint(ฮป, ฯ†) { + if (p0) { + var dฮป = ฮป - ฮป_; + dฮปSum += abs(dฮป) > 180 ? dฮป + (dฮป > 0 ? 360 : -360) : dฮป; + } else ฮป__ = ฮป, ฯ†__ = ฯ†; + d3_geo_area.point(ฮป, ฯ†); + linePoint(ฮป, ฯ†); + } + function ringStart() { + d3_geo_area.lineStart(); + } + function ringEnd() { + ringPoint(ฮป__, ฯ†__); + d3_geo_area.lineEnd(); + if (abs(dฮปSum) > ฮต) ฮป0 = -(ฮป1 = 180); + range[0] = ฮป0, range[1] = ฮป1; + p0 = null; + } + function angle(ฮป0, ฮป1) { + return (ฮป1 -= ฮป0) < 0 ? ฮป1 + 360 : ฮป1; + } + function compareRanges(a, b) { + return a[0] - b[0]; + } + function withinRange(x, range) { + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; + } + return function(feature) { + ฯ†1 = ฮป1 = -(ฮป0 = ฯ†0 = Infinity); + ranges = []; + d3.geo.stream(feature, bound); + var n = ranges.length; + if (n) { + ranges.sort(compareRanges); + for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { + b = ranges[i]; + if (withinRange(b[0], a) || withinRange(b[1], a)) { + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; + } else { + merged.push(a = b); + } + } + var best = -Infinity, dฮป; + for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { + b = merged[i]; + if ((dฮป = angle(a[1], b[0])) > best) best = dฮป, ฮป0 = b[0], ฮป1 = a[1]; + } + } + ranges = range = null; + return ฮป0 === Infinity || ฯ†0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ ฮป0, ฯ†0 ], [ ฮป1, ฯ†1 ] ]; + }; + }(); + d3.geo.centroid = function(object) { + d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, d3_geo_centroid); + var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; + if (m < ฮต2) { + x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; + if (d3_geo_centroidW1 < ฮต) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; + m = x * x + y * y + z * z; + if (m < ฮต2) return [ NaN, NaN ]; + } + return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; + }; + var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2; + var d3_geo_centroid = { + sphere: d3_noop, + point: d3_geo_centroidPoint, + lineStart: d3_geo_centroidLineStart, + lineEnd: d3_geo_centroidLineEnd, + polygonStart: function() { + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; + }, + polygonEnd: function() { + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; + } + }; + function d3_geo_centroidPoint(ฮป, ฯ†) { + ฮป *= d3_radians; + var cosฯ† = Math.cos(ฯ† *= d3_radians); + d3_geo_centroidPointXYZ(cosฯ† * Math.cos(ฮป), cosฯ† * Math.sin(ฮป), Math.sin(ฯ†)); + } + function d3_geo_centroidPointXYZ(x, y, z) { + ++d3_geo_centroidW0; + d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; + d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; + d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; + } + function d3_geo_centroidLineStart() { + var x0, y0, z0; + d3_geo_centroid.point = function(ฮป, ฯ†) { + ฮป *= d3_radians; + var cosฯ† = Math.cos(ฯ† *= d3_radians); + x0 = cosฯ† * Math.cos(ฮป); + y0 = cosฯ† * Math.sin(ฮป); + z0 = Math.sin(ฯ†); + d3_geo_centroid.point = nextPoint; + d3_geo_centroidPointXYZ(x0, y0, z0); + }; + function nextPoint(ฮป, ฯ†) { + ฮป *= d3_radians; + var cosฯ† = Math.cos(ฯ† *= d3_radians), x = cosฯ† * Math.cos(ฮป), y = cosฯ† * Math.sin(ฮป), z = Math.sin(ฯ†), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); + d3_geo_centroidW1 += w; + d3_geo_centroidX1 += w * (x0 + (x0 = x)); + d3_geo_centroidY1 += w * (y0 + (y0 = y)); + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); + d3_geo_centroidPointXYZ(x0, y0, z0); + } + } + function d3_geo_centroidLineEnd() { + d3_geo_centroid.point = d3_geo_centroidPoint; + } + function d3_geo_centroidRingStart() { + var ฮป00, ฯ†00, x0, y0, z0; + d3_geo_centroid.point = function(ฮป, ฯ†) { + ฮป00 = ฮป, ฯ†00 = ฯ†; + d3_geo_centroid.point = nextPoint; + ฮป *= d3_radians; + var cosฯ† = Math.cos(ฯ† *= d3_radians); + x0 = cosฯ† * Math.cos(ฮป); + y0 = cosฯ† * Math.sin(ฮป); + z0 = Math.sin(ฯ†); + d3_geo_centroidPointXYZ(x0, y0, z0); + }; + d3_geo_centroid.lineEnd = function() { + nextPoint(ฮป00, ฯ†00); + d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; + d3_geo_centroid.point = d3_geo_centroidPoint; + }; + function nextPoint(ฮป, ฯ†) { + ฮป *= d3_radians; + var cosฯ† = Math.cos(ฯ† *= d3_radians), x = cosฯ† * Math.cos(ฮป), y = cosฯ† * Math.sin(ฮป), z = Math.sin(ฯ†), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u); + d3_geo_centroidX2 += v * cx; + d3_geo_centroidY2 += v * cy; + d3_geo_centroidZ2 += v * cz; + d3_geo_centroidW1 += w; + d3_geo_centroidX1 += w * (x0 + (x0 = x)); + d3_geo_centroidY1 += w * (y0 + (y0 = y)); + d3_geo_centroidZ1 += w * (z0 + (z0 = z)); + d3_geo_centroidPointXYZ(x0, y0, z0); + } + } + function d3_geo_compose(a, b) { + function compose(x, y) { + return x = a(x, y), b(x[0], x[1]); + } + if (a.invert && b.invert) compose.invert = function(x, y) { + return x = b.invert(x, y), x && a.invert(x[0], x[1]); + }; + return compose; + } + function d3_true() { + return true; + } + function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { + var subject = [], clip = []; + segments.forEach(function(segment) { + if ((n = segment.length - 1) <= 0) return; + var n, p0 = segment[0], p1 = segment[n]; + if (d3_geo_sphericalEqual(p0, p1)) { + listener.lineStart(); + for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); + listener.lineEnd(); + return; + } + var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); + a.o = b; + subject.push(a); + clip.push(b); + a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); + b = new d3_geo_clipPolygonIntersection(p1, null, a, true); + a.o = b; + subject.push(a); + clip.push(b); + }); + clip.sort(compare); + d3_geo_clipPolygonLinkCircular(subject); + d3_geo_clipPolygonLinkCircular(clip); + if (!subject.length) return; + for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { + clip[i].e = entry = !entry; + } + var start = subject[0], points, point; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points = current.z; + listener.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.n.x, 1, listener); + } + current = current.n; + } else { + if (isSubject) { + points = current.p.z; + for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.p.x, -1, listener); + } + current = current.p; + } + current = current.o; + points = current.z; + isSubject = !isSubject; + } while (!current.v); + listener.lineEnd(); + } + } + function d3_geo_clipPolygonLinkCircular(array) { + if (!(n = array.length)) return; + var n, i = 0, a = array[0], b; + while (++i < n) { + a.n = b = array[i]; + b.p = a; + a = b; + } + a.n = b = array[0]; + b.p = a; + } + function d3_geo_clipPolygonIntersection(point, points, other, entry) { + this.x = point; + this.z = points; + this.o = other; + this.e = entry; + this.v = false; + this.n = this.p = null; + } + function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { + return function(rotate, listener) { + var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + clip.point = pointRing; + clip.lineStart = ringStart; + clip.lineEnd = ringEnd; + segments = []; + polygon = []; + }, + polygonEnd: function() { + clip.point = point; + clip.lineStart = lineStart; + clip.lineEnd = lineEnd; + segments = d3.merge(segments); + var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); + if (segments.length) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); + } else if (clipStartInside) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + if (polygonStarted) listener.polygonEnd(), polygonStarted = false; + segments = polygon = null; + }, + sphere: function() { + listener.polygonStart(); + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + listener.polygonEnd(); + } + }; + function point(ฮป, ฯ†) { + var point = rotate(ฮป, ฯ†); + if (pointVisible(ฮป = point[0], ฯ† = point[1])) listener.point(ฮป, ฯ†); + } + function pointLine(ฮป, ฯ†) { + var point = rotate(ฮป, ฯ†); + line.point(point[0], point[1]); + } + function lineStart() { + clip.point = pointLine; + line.lineStart(); + } + function lineEnd() { + clip.point = point; + line.lineEnd(); + } + var segments; + var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygonStarted = false, polygon, ring; + function pointRing(ฮป, ฯ†) { + ring.push([ ฮป, ฯ† ]); + var point = rotate(ฮป, ฯ†); + ringListener.point(point[0], point[1]); + } + function ringStart() { + ringListener.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringListener.lineEnd(); + var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + var n = segment.length - 1, i = -1, point; + if (n > 0) { + if (!polygonStarted) listener.polygonStart(), polygonStarted = true; + listener.lineStart(); + while (++i < n) listener.point((point = segment[i])[0], point[1]); + listener.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); + } + return clip; + }; + } + function d3_geo_clipSegmentLength1(segment) { + return segment.length > 1; + } + function d3_geo_clipBufferListener() { + var lines = [], line; + return { + lineStart: function() { + lines.push(line = []); + }, + point: function(ฮป, ฯ†) { + line.push([ ฮป, ฯ† ]); + }, + lineEnd: d3_noop, + buffer: function() { + var buffer = lines; + lines = []; + line = null; + return buffer; + }, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + } + }; + } + function d3_geo_clipSort(a, b) { + return ((a = a.x)[0] < 0 ? a[1] - halfฯ€ - ฮต : halfฯ€ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfฯ€ - ฮต : halfฯ€ - b[1]); + } + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -ฯ€, -ฯ€ / 2 ]); + function d3_geo_clipAntimeridianLine(listener) { + var ฮป0 = NaN, ฯ†0 = NaN, sฮป0 = NaN, clean; + return { + lineStart: function() { + listener.lineStart(); + clean = 1; + }, + point: function(ฮป1, ฯ†1) { + var sฮป1 = ฮป1 > 0 ? ฯ€ : -ฯ€, dฮป = abs(ฮป1 - ฮป0); + if (abs(dฮป - ฯ€) < ฮต) { + listener.point(ฮป0, ฯ†0 = (ฯ†0 + ฯ†1) / 2 > 0 ? halfฯ€ : -halfฯ€); + listener.point(sฮป0, ฯ†0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sฮป1, ฯ†0); + listener.point(ฮป1, ฯ†0); + clean = 0; + } else if (sฮป0 !== sฮป1 && dฮป >= ฯ€) { + if (abs(ฮป0 - sฮป0) < ฮต) ฮป0 -= sฮป0 * ฮต; + if (abs(ฮป1 - sฮป1) < ฮต) ฮป1 -= sฮป1 * ฮต; + ฯ†0 = d3_geo_clipAntimeridianIntersect(ฮป0, ฯ†0, ฮป1, ฯ†1); + listener.point(sฮป0, ฯ†0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sฮป1, ฯ†0); + clean = 0; + } + listener.point(ฮป0 = ฮป1, ฯ†0 = ฯ†1); + sฮป0 = sฮป1; + }, + lineEnd: function() { + listener.lineEnd(); + ฮป0 = ฯ†0 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function d3_geo_clipAntimeridianIntersect(ฮป0, ฯ†0, ฮป1, ฯ†1) { + var cosฯ†0, cosฯ†1, sinฮป0_ฮป1 = Math.sin(ฮป0 - ฮป1); + return abs(sinฮป0_ฮป1) > ฮต ? Math.atan((Math.sin(ฯ†0) * (cosฯ†1 = Math.cos(ฯ†1)) * Math.sin(ฮป1) - Math.sin(ฯ†1) * (cosฯ†0 = Math.cos(ฯ†0)) * Math.sin(ฮป0)) / (cosฯ†0 * cosฯ†1 * sinฮป0_ฮป1)) : (ฯ†0 + ฯ†1) / 2; + } + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { + var ฯ†; + if (from == null) { + ฯ† = direction * halfฯ€; + listener.point(-ฯ€, ฯ†); + listener.point(0, ฯ†); + listener.point(ฯ€, ฯ†); + listener.point(ฯ€, 0); + listener.point(ฯ€, -ฯ†); + listener.point(0, -ฯ†); + listener.point(-ฯ€, -ฯ†); + listener.point(-ฯ€, 0); + listener.point(-ฯ€, ฯ†); + } else if (abs(from[0] - to[0]) > ฮต) { + var s = from[0] < to[0] ? ฯ€ : -ฯ€; + ฯ† = direction * s / 2; + listener.point(-s, ฯ†); + listener.point(0, ฯ†); + listener.point(s, ฯ†); + } else { + listener.point(to[0], to[1]); + } + } + function d3_geo_pointInPolygon(point, polygon) { + var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; + d3_geo_areaRingSum.reset(); + for (var i = 0, n = polygon.length; i < n; ++i) { + var ring = polygon[i], m = ring.length; + if (!m) continue; + var point0 = ring[0], ฮป0 = point0[0], ฯ†0 = point0[1] / 2 + ฯ€ / 4, sinฯ†0 = Math.sin(ฯ†0), cosฯ†0 = Math.cos(ฯ†0), j = 1; + while (true) { + if (j === m) j = 0; + point = ring[j]; + var ฮป = point[0], ฯ† = point[1] / 2 + ฯ€ / 4, sinฯ† = Math.sin(ฯ†), cosฯ† = Math.cos(ฯ†), dฮป = ฮป - ฮป0, sdฮป = dฮป >= 0 ? 1 : -1, adฮป = sdฮป * dฮป, antimeridian = adฮป > ฯ€, k = sinฯ†0 * sinฯ†; + d3_geo_areaRingSum.add(Math.atan2(k * sdฮป * Math.sin(adฮป), cosฯ†0 * cosฯ† + k * Math.cos(adฮป))); + polarAngle += antimeridian ? dฮป + sdฮป * ฯ„ : dฮป; + if (antimeridian ^ ฮป0 >= meridian ^ ฮป >= meridian) { + var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); + d3_geo_cartesianNormalize(arc); + var intersection = d3_geo_cartesianCross(meridianNormal, arc); + d3_geo_cartesianNormalize(intersection); + var ฯ†arc = (antimeridian ^ dฮป >= 0 ? -1 : 1) * d3_asin(intersection[2]); + if (parallel > ฯ†arc || parallel === ฯ†arc && (arc[0] || arc[1])) { + winding += antimeridian ^ dฮป >= 0 ? 1 : -1; + } + } + if (!j++) break; + ฮป0 = ฮป, sinฯ†0 = sinฯ†, cosฯ†0 = cosฯ†, point0 = point; + } + } + return (polarAngle < -ฮต || polarAngle < ฮต && d3_geo_areaRingSum < -ฮต) ^ winding & 1; + } + function d3_geo_clipCircle(radius) { + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ฮต, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); + return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -ฯ€, radius - ฯ€ ]); + function visible(ฮป, ฯ†) { + return Math.cos(ฮป) * Math.cos(ฯ†) > cr; + } + function clipLine(listener) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(ฮป, ฯ†) { + var point1 = [ ฮป, ฯ† ], point2, v = visible(ฮป, ฯ†), c = smallRadius ? v ? 0 : code(ฮป, ฯ†) : v ? code(ฮป + (ฮป < 0 ? ฯ€ : -ฯ€), ฯ†) : 0; + if (!point0 && (v00 = v0 = v)) listener.lineStart(); + if (v !== v0) { + point2 = intersect(point0, point1); + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { + point1[0] += ฮต; + point1[1] += ฮต; + v = visible(point1[0], point1[1]); + } + } + if (v !== v0) { + clean = 0; + if (v) { + listener.lineStart(); + point2 = intersect(point1, point0); + listener.point(point2[0], point2[1]); + } else { + point2 = intersect(point0, point1); + listener.point(point2[0], point2[1]); + listener.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c & c0) && (t = intersect(point1, point0, true))) { + clean = 0; + if (smallRadius) { + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + } else { + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + } + } + } + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { + listener.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c; + }, + lineEnd: function() { + if (v0) listener.lineEnd(); + point0 = null; + }, + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect(a, b, two) { + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); + var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a; + var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); + d3_geo_cartesianAdd(A, B); + var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); + if (t2 < 0) return; + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); + d3_geo_cartesianAdd(q, A); + q = d3_geo_spherical(q); + if (!two) return q; + var ฮป0 = a[0], ฮป1 = b[0], ฯ†0 = a[1], ฯ†1 = b[1], z; + if (ฮป1 < ฮป0) z = ฮป0, ฮป0 = ฮป1, ฮป1 = z; + var ฮดฮป = ฮป1 - ฮป0, polar = abs(ฮดฮป - ฯ€) < ฮต, meridian = polar || ฮดฮป < ฮต; + if (!polar && ฯ†1 < ฯ†0) z = ฯ†0, ฯ†0 = ฯ†1, ฯ†1 = z; + if (meridian ? polar ? ฯ†0 + ฯ†1 > 0 ^ q[1] < (abs(q[0] - ฮป0) < ฮต ? ฯ†0 : ฯ†1) : ฯ†0 <= q[1] && q[1] <= ฯ†1 : ฮดฮป > ฯ€ ^ (ฮป0 <= q[0] && q[0] <= ฮป1)) { + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); + d3_geo_cartesianAdd(q1, A); + return [ q, d3_geo_spherical(q1) ]; + } + } + function code(ฮป, ฯ†) { + var r = smallRadius ? radius : ฯ€ - radius, code = 0; + if (ฮป < -r) code |= 1; else if (ฮป > r) code |= 2; + if (ฯ† < -r) code |= 4; else if (ฯ† > r) code |= 8; + return code; + } + } + function d3_geom_clipLine(x0, y0, x1, y1) { + return function(line) { + var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; + r = x0 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dx > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = x1 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dx > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + r = y0 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dy > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + r = y1 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dy > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + if (t0 > 0) line.a = { + x: ax + t0 * dx, + y: ay + t0 * dy + }; + if (t1 < 1) line.b = { + x: ax + t1 * dx, + y: ay + t1 * dy + }; + return line; + }; + } + var d3_geo_clipExtentMAX = 1e9; + d3.geo.clipExtent = function() { + var x0, y0, x1, y1, stream, clip, clipExtent = { + stream: function(output) { + if (stream) stream.valid = false; + stream = clip(output); + stream.valid = true; + return stream; + }, + extent: function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); + if (stream) stream.valid = false, stream = null; + return clipExtent; + } + }; + return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); + }; + function d3_geo_clipExtent(x0, y0, x1, y1) { + return function(listener) { + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + listener = bufferListener; + segments = []; + polygon = []; + clean = true; + }, + polygonEnd: function() { + listener = listener_; + segments = d3.merge(segments); + var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; + if (inside || visible) { + listener.polygonStart(); + if (inside) { + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + if (visible) { + d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); + } + listener.polygonEnd(); + } + segments = polygon = ring = null; + } + }; + function insidePolygon(p) { + var wn = 0, n = polygon.length, y = p[1]; + for (var i = 0; i < n; ++i) { + for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { + b = v[j]; + if (a[1] <= y) { + if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; + } else { + if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; + } + a = b; + } + } + return wn !== 0; + } + function interpolate(from, to, direction, listener) { + var a = 0, a1 = 0; + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { + do { + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + } while ((a = (a + direction + 4) % 4) !== a1); + } else { + listener.point(to[0], to[1]); + } + } + function pointVisible(x, y) { + return x0 <= x && x <= x1 && y0 <= y && y <= y1; + } + function point(x, y) { + if (pointVisible(x, y)) listener.point(x, y); + } + var x__, y__, v__, x_, y_, v_, first, clean; + function lineStart() { + clip.point = linePoint; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments) { + linePoint(x__, y__); + if (v__ && v_) bufferListener.rejoin(); + segments.push(bufferListener.buffer()); + } + clip.point = point; + if (v_) listener.lineEnd(); + } + function linePoint(x, y) { + x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); + y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); + var v = pointVisible(x, y); + if (polygon) ring.push([ x, y ]); + if (first) { + x__ = x, y__ = y, v__ = v; + first = false; + if (v) { + listener.lineStart(); + listener.point(x, y); + } + } else { + if (v && v_) listener.point(x, y); else { + var l = { + a: { + x: x_, + y: y_ + }, + b: { + x: x, + y: y + } + }; + if (clipLine(l)) { + if (!v_) { + listener.lineStart(); + listener.point(l.a.x, l.a.y); + } + listener.point(l.b.x, l.b.y); + if (!v) listener.lineEnd(); + clean = false; + } else if (v) { + listener.lineStart(); + listener.point(x, y); + clean = false; + } + } + } + x_ = x, y_ = y, v_ = v; + } + return clip; + }; + function corner(p, direction) { + return abs(p[0] - x0) < ฮต ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ฮต ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ฮต ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compare(a, b) { + return comparePoints(a.x, b.x); + } + function comparePoints(a, b) { + var ca = corner(a, 1), cb = corner(b, 1); + return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; + } + } + function d3_geo_conic(projectAt) { + var ฯ†0 = 0, ฯ†1 = ฯ€ / 3, m = d3_geo_projectionMutator(projectAt), p = m(ฯ†0, ฯ†1); + p.parallels = function(_) { + if (!arguments.length) return [ ฯ†0 / ฯ€ * 180, ฯ†1 / ฯ€ * 180 ]; + return m(ฯ†0 = _[0] * ฯ€ / 180, ฯ†1 = _[1] * ฯ€ / 180); + }; + return p; + } + function d3_geo_conicEqualArea(ฯ†0, ฯ†1) { + var sinฯ†0 = Math.sin(ฯ†0), n = (sinฯ†0 + Math.sin(ฯ†1)) / 2, C = 1 + sinฯ†0 * (2 * n - sinฯ†0), ฯ0 = Math.sqrt(C) / n; + function forward(ฮป, ฯ†) { + var ฯ = Math.sqrt(C - 2 * n * Math.sin(ฯ†)) / n; + return [ ฯ * Math.sin(ฮป *= n), ฯ0 - ฯ * Math.cos(ฮป) ]; + } + forward.invert = function(x, y) { + var ฯ0_y = ฯ0 - y; + return [ Math.atan2(x, ฯ0_y) / n, d3_asin((C - (x * x + ฯ0_y * ฯ0_y) * n * n) / (2 * n)) ]; + }; + return forward; + } + (d3.geo.conicEqualArea = function() { + return d3_geo_conic(d3_geo_conicEqualArea); + }).raw = d3_geo_conicEqualArea; + d3.geo.albers = function() { + return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); + }; + d3.geo.albersUsa = function() { + var lower48 = d3.geo.albers(); + var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); + var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); + var point, pointStream = { + point: function(x, y) { + point = [ x, y ]; + } + }, lower48Point, alaskaPoint, hawaiiPoint; + function albersUsa(coordinates) { + var x = coordinates[0], y = coordinates[1]; + point = null; + (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); + return point; + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; + return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream) { + var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); + return { + point: function(x, y) { + lower48Stream.point(x, y); + alaskaStream.point(x, y); + hawaiiStream.point(x, y); + }, + sphere: function() { + lower48Stream.sphere(); + alaskaStream.sphere(); + hawaiiStream.sphere(); + }, + lineStart: function() { + lower48Stream.lineStart(); + alaskaStream.lineStart(); + hawaiiStream.lineStart(); + }, + lineEnd: function() { + lower48Stream.lineEnd(); + alaskaStream.lineEnd(); + hawaiiStream.lineEnd(); + }, + polygonStart: function() { + lower48Stream.polygonStart(); + alaskaStream.polygonStart(); + hawaiiStream.polygonStart(); + }, + polygonEnd: function() { + lower48Stream.polygonEnd(); + alaskaStream.polygonEnd(); + hawaiiStream.polygonEnd(); + } + }; + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_); + alaska.precision(_); + hawaii.precision(_); + return albersUsa; + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_); + alaska.scale(_ * .35); + hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x = +_[0], y = +_[1]; + lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; + alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ฮต, y + .12 * k + ฮต ], [ x - .214 * k - ฮต, y + .234 * k - ฮต ] ]).stream(pointStream).point; + hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ฮต, y + .166 * k + ฮต ], [ x - .115 * k - ฮต, y + .234 * k - ฮต ] ]).stream(pointStream).point; + return albersUsa; + }; + return albersUsa.scale(1070); + }; + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_pathAreaPolygon = 0; + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; + }, + polygonEnd: function() { + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; + d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); + } + }; + function d3_geo_pathAreaRingStart() { + var x00, y00, x0, y0; + d3_geo_pathArea.point = function(x, y) { + d3_geo_pathArea.point = nextPoint; + x00 = x0 = x, y00 = y0 = y; + }; + function nextPoint(x, y) { + d3_geo_pathAreaPolygon += y0 * x - x0 * y; + x0 = x, y0 = y; + } + d3_geo_pathArea.lineEnd = function() { + nextPoint(x00, y00); + }; + } + var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; + var d3_geo_pathBounds = { + point: d3_geo_pathBoundsPoint, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop + }; + function d3_geo_pathBoundsPoint(x, y) { + if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; + if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; + if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; + if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; + } + function d3_geo_pathBuffer() { + var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointCircle = d3_geo_pathBufferCircle(_); + return stream; + }, + result: function() { + if (buffer.length) { + var result = buffer.join(""); + buffer = []; + return result; + } + } + }; + function point(x, y) { + buffer.push("M", x, ",", y, pointCircle); + } + function pointLineStart(x, y) { + buffer.push("M", x, ",", y); + stream.point = pointLine; + } + function pointLine(x, y) { + buffer.push("L", x, ",", y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + buffer.push("Z"); + } + return stream; + } + function d3_geo_pathBufferCircle(radius) { + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; + } + var d3_geo_pathCentroid = { + point: d3_geo_pathCentroidPoint, + lineStart: d3_geo_pathCentroidLineStart, + lineEnd: d3_geo_pathCentroidLineEnd, + polygonStart: function() { + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; + }, + polygonEnd: function() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; + } + }; + function d3_geo_pathCentroidPoint(x, y) { + d3_geo_centroidX0 += x; + d3_geo_centroidY0 += y; + ++d3_geo_centroidZ0; + } + function d3_geo_pathCentroidLineStart() { + var x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + } + } + function d3_geo_pathCentroidLineEnd() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + } + function d3_geo_pathCentroidRingStart() { + var x00, y00, x0, y0; + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX1 += z * (x0 + x) / 2; + d3_geo_centroidY1 += z * (y0 + y) / 2; + d3_geo_centroidZ1 += z; + z = y0 * x - x0 * y; + d3_geo_centroidX2 += z * (x0 + x); + d3_geo_centroidY2 += z * (y0 + y); + d3_geo_centroidZ2 += z * 3; + d3_geo_pathCentroidPoint(x0 = x, y0 = y); + } + d3_geo_pathCentroid.lineEnd = function() { + nextPoint(x00, y00); + }; + } + function d3_geo_pathContext(context) { + var pointRadius = 4.5; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointRadius = _; + return stream; + }, + result: d3_noop + }; + function point(x, y) { + context.moveTo(x + pointRadius, y); + context.arc(x, y, pointRadius, 0, ฯ„); + } + function pointLineStart(x, y) { + context.moveTo(x, y); + stream.point = pointLine; + } + function pointLine(x, y) { + context.lineTo(x, y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + context.closePath(); + } + return stream; + } + function d3_geo_resample(project) { + var ฮด2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; + function resample(stream) { + return (maxDepth ? resampleRecursive : resampleNone)(stream); + } + function resampleNone(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + }); + } + function resampleRecursive(stream) { + var ฮป00, ฯ†00, x00, y00, a00, b00, c00, ฮป0, x0, y0, a0, b0, c0; + var resample = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + stream.polygonStart(); + resample.lineStart = ringStart; + }, + polygonEnd: function() { + stream.polygonEnd(); + resample.lineStart = lineStart; + } + }; + function point(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + } + function lineStart() { + x0 = NaN; + resample.point = linePoint; + stream.lineStart(); + } + function linePoint(ฮป, ฯ†) { + var c = d3_geo_cartesian([ ฮป, ฯ† ]), p = project(ฮป, ฯ†); + resampleLineTo(x0, y0, ฮป0, a0, b0, c0, x0 = p[0], y0 = p[1], ฮป0 = ฮป, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); + stream.point(x0, y0); + } + function lineEnd() { + resample.point = point; + stream.lineEnd(); + } + function ringStart() { + lineStart(); + resample.point = ringPoint; + resample.lineEnd = ringEnd; + } + function ringPoint(ฮป, ฯ†) { + linePoint(ฮป00 = ฮป, ฯ†00 = ฯ†), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; + resample.point = linePoint; + } + function ringEnd() { + resampleLineTo(x0, y0, ฮป0, a0, b0, c0, x00, y00, ฮป00, a00, b00, c00, maxDepth, stream); + resample.lineEnd = lineEnd; + lineEnd(); + } + return resample; + } + function resampleLineTo(x0, y0, ฮป0, a0, b0, c0, x1, y1, ฮป1, a1, b1, c1, depth, stream) { + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; + if (d2 > 4 * ฮด2 && depth--) { + var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), ฯ†2 = Math.asin(c /= m), ฮป2 = abs(abs(c) - 1) < ฮต || abs(ฮป0 - ฮป1) < ฮต ? (ฮป0 + ฮป1) / 2 : Math.atan2(b, a), p = project(ฮป2, ฯ†2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > ฮด2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x0, y0, ฮป0, a0, b0, c0, x2, y2, ฮป2, a /= m, b /= m, c, depth, stream); + stream.point(x2, y2); + resampleLineTo(x2, y2, ฮป2, a, b, c, x1, y1, ฮป1, a1, b1, c1, depth, stream); + } + } + } + resample.precision = function(_) { + if (!arguments.length) return Math.sqrt(ฮด2); + maxDepth = (ฮด2 = _ * _) > 0 && 16; + return resample; + }; + return resample; + } + d3.geo.path = function() { + var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; + function path(object) { + if (object) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); + d3.geo.stream(object, cacheStream); + } + return contextStream.result(); + } + path.area = function(object) { + d3_geo_pathAreaSum = 0; + d3.geo.stream(object, projectStream(d3_geo_pathArea)); + return d3_geo_pathAreaSum; + }; + path.centroid = function(object) { + d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); + return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ]; + }; + path.bounds = function(object) { + d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); + d3.geo.stream(object, projectStream(d3_geo_pathBounds)); + return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; + }; + path.projection = function(_) { + if (!arguments.length) return projection; + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; + return reset(); + }; + path.context = function(_) { + if (!arguments.length) return context; + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return reset(); + }; + path.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path; + }; + function reset() { + cacheStream = null; + return path; + } + return path.projection(d3.geo.albersUsa()).context(null); + }; + function d3_geo_pathProjectStream(project) { + var resample = d3_geo_resample(function(x, y) { + return project([ x * d3_degrees, y * d3_degrees ]); + }); + return function(stream) { + return d3_geo_projectionRadians(resample(stream)); + }; + } + d3.geo.transform = function(methods) { + return { + stream: function(stream) { + var transform = new d3_geo_transform(stream); + for (var k in methods) transform[k] = methods[k]; + return transform; + } + }; + }; + function d3_geo_transform(stream) { + this.stream = stream; + } + d3_geo_transform.prototype = { + point: function(x, y) { + this.stream.point(x, y); + }, + sphere: function() { + this.stream.sphere(); + }, + lineStart: function() { + this.stream.lineStart(); + }, + lineEnd: function() { + this.stream.lineEnd(); + }, + polygonStart: function() { + this.stream.polygonStart(); + }, + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function d3_geo_transformPoint(stream, point) { + return { + point: point, + sphere: function() { + stream.sphere(); + }, + lineStart: function() { + stream.lineStart(); + }, + lineEnd: function() { + stream.lineEnd(); + }, + polygonStart: function() { + stream.polygonStart(); + }, + polygonEnd: function() { + stream.polygonEnd(); + } + }; + } + d3.geo.projection = d3_geo_projection; + d3.geo.projectionMutator = d3_geo_projectionMutator; + function d3_geo_projection(project) { + return d3_geo_projectionMutator(function() { + return project; + })(); + } + function d3_geo_projectionMutator(projectAt) { + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { + x = project(x, y); + return [ x[0] * k + ฮดx, ฮดy - x[1] * k ]; + }), k = 150, x = 480, y = 250, ฮป = 0, ฯ† = 0, ฮดฮป = 0, ฮดฯ† = 0, ฮดฮณ = 0, ฮดx, ฮดy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream; + function projection(point) { + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); + return [ point[0] * k + ฮดx, ฮดy - point[1] * k ]; + } + function invert(point) { + point = projectRotate.invert((point[0] - ฮดx) / k, (ฮดy - point[1]) / k); + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; + } + projection.stream = function(output) { + if (stream) stream.valid = false; + stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); + stream.valid = true; + return stream; + }; + projection.clipAngle = function(_) { + if (!arguments.length) return clipAngle; + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); + return invalidate(); + }; + projection.clipExtent = function(_) { + if (!arguments.length) return clipExtent; + clipExtent = _; + postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; + return invalidate(); + }; + projection.scale = function(_) { + if (!arguments.length) return k; + k = +_; + return reset(); + }; + projection.translate = function(_) { + if (!arguments.length) return [ x, y ]; + x = +_[0]; + y = +_[1]; + return reset(); + }; + projection.center = function(_) { + if (!arguments.length) return [ ฮป * d3_degrees, ฯ† * d3_degrees ]; + ฮป = _[0] % 360 * d3_radians; + ฯ† = _[1] % 360 * d3_radians; + return reset(); + }; + projection.rotate = function(_) { + if (!arguments.length) return [ ฮดฮป * d3_degrees, ฮดฯ† * d3_degrees, ฮดฮณ * d3_degrees ]; + ฮดฮป = _[0] % 360 * d3_radians; + ฮดฯ† = _[1] % 360 * d3_radians; + ฮดฮณ = _.length > 2 ? _[2] % 360 * d3_radians : 0; + return reset(); + }; + d3.rebind(projection, projectResample, "precision"); + function reset() { + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(ฮดฮป, ฮดฯ†, ฮดฮณ), project); + var center = project(ฮป, ฯ†); + ฮดx = x - center[0] * k; + ฮดy = y + center[1] * k; + return invalidate(); + } + function invalidate() { + if (stream) stream.valid = false, stream = null; + return projection; + } + return function() { + project = projectAt.apply(this, arguments); + projection.invert = project.invert && invert; + return reset(); + }; + } + function d3_geo_projectionRadians(stream) { + return d3_geo_transformPoint(stream, function(x, y) { + stream.point(x * d3_radians, y * d3_radians); + }); + } + function d3_geo_equirectangular(ฮป, ฯ†) { + return [ ฮป, ฯ† ]; + } + (d3.geo.equirectangular = function() { + return d3_geo_projection(d3_geo_equirectangular); + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; + d3.geo.rotation = function(rotate) { + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); + function forward(coordinates) { + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + }; + return forward; + }; + function d3_geo_identityRotation(ฮป, ฯ†) { + return [ ฮป > ฯ€ ? ฮป - ฯ„ : ฮป < -ฯ€ ? ฮป + ฯ„ : ฮป, ฯ† ]; + } + d3_geo_identityRotation.invert = d3_geo_equirectangular; + function d3_geo_rotation(ฮดฮป, ฮดฯ†, ฮดฮณ) { + return ฮดฮป ? ฮดฯ† || ฮดฮณ ? d3_geo_compose(d3_geo_rotationฮป(ฮดฮป), d3_geo_rotationฯ†ฮณ(ฮดฯ†, ฮดฮณ)) : d3_geo_rotationฮป(ฮดฮป) : ฮดฯ† || ฮดฮณ ? d3_geo_rotationฯ†ฮณ(ฮดฯ†, ฮดฮณ) : d3_geo_identityRotation; + } + function d3_geo_forwardRotationฮป(ฮดฮป) { + return function(ฮป, ฯ†) { + return ฮป += ฮดฮป, [ ฮป > ฯ€ ? ฮป - ฯ„ : ฮป < -ฯ€ ? ฮป + ฯ„ : ฮป, ฯ† ]; + }; + } + function d3_geo_rotationฮป(ฮดฮป) { + var rotation = d3_geo_forwardRotationฮป(ฮดฮป); + rotation.invert = d3_geo_forwardRotationฮป(-ฮดฮป); + return rotation; + } + function d3_geo_rotationฯ†ฮณ(ฮดฯ†, ฮดฮณ) { + var cosฮดฯ† = Math.cos(ฮดฯ†), sinฮดฯ† = Math.sin(ฮดฯ†), cosฮดฮณ = Math.cos(ฮดฮณ), sinฮดฮณ = Math.sin(ฮดฮณ); + function rotation(ฮป, ฯ†) { + var cosฯ† = Math.cos(ฯ†), x = Math.cos(ฮป) * cosฯ†, y = Math.sin(ฮป) * cosฯ†, z = Math.sin(ฯ†), k = z * cosฮดฯ† + x * sinฮดฯ†; + return [ Math.atan2(y * cosฮดฮณ - k * sinฮดฮณ, x * cosฮดฯ† - z * sinฮดฯ†), d3_asin(k * cosฮดฮณ + y * sinฮดฮณ) ]; + } + rotation.invert = function(ฮป, ฯ†) { + var cosฯ† = Math.cos(ฯ†), x = Math.cos(ฮป) * cosฯ†, y = Math.sin(ฮป) * cosฯ†, z = Math.sin(ฯ†), k = z * cosฮดฮณ - y * sinฮดฮณ; + return [ Math.atan2(y * cosฮดฮณ + z * sinฮดฮณ, x * cosฮดฯ† + k * sinฮดฯ†), d3_asin(k * cosฮดฯ† - x * sinฮดฯ†) ]; + }; + return rotation; + } + d3.geo.circle = function() { + var origin = [ 0, 0 ], angle, precision = 6, interpolate; + function circle() { + var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; + interpolate(null, null, 1, { + point: function(x, y) { + ring.push(x = rotate(x, y)); + x[0] *= d3_degrees, x[1] *= d3_degrees; + } + }); + return { + type: "Polygon", + coordinates: [ ring ] + }; + } + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return angle; + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); + return circle; + }; + circle.precision = function(_) { + if (!arguments.length) return precision; + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); + return circle; + }; + return circle.angle(90); + }; + function d3_geo_circleInterpolate(radius, precision) { + var cr = Math.cos(radius), sr = Math.sin(radius); + return function(from, to, direction, listener) { + var step = direction * precision; + if (from != null) { + from = d3_geo_circleAngle(cr, from); + to = d3_geo_circleAngle(cr, to); + if (direction > 0 ? from < to : from > to) from += direction * ฯ„; + } else { + from = radius + direction * ฯ„; + to = radius - .5 * step; + } + for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); + } + }; + } + function d3_geo_circleAngle(cr, point) { + var a = d3_geo_cartesian(point); + a[0] -= cr; + d3_geo_cartesianNormalize(a); + var angle = d3_acos(-a[1]); + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ฮต) % (2 * Math.PI); + } + d3.geo.distance = function(a, b) { + var ฮ”ฮป = (b[0] - a[0]) * d3_radians, ฯ†0 = a[1] * d3_radians, ฯ†1 = b[1] * d3_radians, sinฮ”ฮป = Math.sin(ฮ”ฮป), cosฮ”ฮป = Math.cos(ฮ”ฮป), sinฯ†0 = Math.sin(ฯ†0), cosฯ†0 = Math.cos(ฯ†0), sinฯ†1 = Math.sin(ฯ†1), cosฯ†1 = Math.cos(ฯ†1), t; + return Math.atan2(Math.sqrt((t = cosฯ†1 * sinฮ”ฮป) * t + (t = cosฯ†0 * sinฯ†1 - sinฯ†0 * cosฯ†1 * cosฮ”ฮป) * t), sinฯ†0 * sinฯ†1 + cosฯ†0 * cosฯ†1 * cosฮ”ฮป); + }; + d3.geo.graticule = function() { + var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; + function graticule() { + return { + type: "MultiLineString", + coordinates: lines() + }; + } + function lines() { + return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { + return abs(x % DX) > ฮต; + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { + return abs(y % DY) > ฮต; + }).map(y)); + } + graticule.lines = function() { + return lines().map(function(coordinates) { + return { + type: "LineString", + coordinates: coordinates + }; + }); + }; + graticule.outline = function() { + return { + type: "Polygon", + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] + }; + }; + graticule.extent = function(_) { + if (!arguments.length) return graticule.minorExtent(); + return graticule.majorExtent(_).minorExtent(_); + }; + graticule.majorExtent = function(_) { + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; + X0 = +_[0][0], X1 = +_[1][0]; + Y0 = +_[0][1], Y1 = +_[1][1]; + if (X0 > X1) _ = X0, X0 = X1, X1 = _; + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; + return graticule.precision(precision); + }; + graticule.minorExtent = function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + x0 = +_[0][0], x1 = +_[1][0]; + y0 = +_[0][1], y1 = +_[1][1]; + if (x0 > x1) _ = x0, x0 = x1, x1 = _; + if (y0 > y1) _ = y0, y0 = y1, y1 = _; + return graticule.precision(precision); + }; + graticule.step = function(_) { + if (!arguments.length) return graticule.minorStep(); + return graticule.majorStep(_).minorStep(_); + }; + graticule.majorStep = function(_) { + if (!arguments.length) return [ DX, DY ]; + DX = +_[0], DY = +_[1]; + return graticule; + }; + graticule.minorStep = function(_) { + if (!arguments.length) return [ dx, dy ]; + dx = +_[0], dy = +_[1]; + return graticule; + }; + graticule.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x = d3_geo_graticuleX(y0, y1, 90); + y = d3_geo_graticuleY(x0, x1, precision); + X = d3_geo_graticuleX(Y0, Y1, 90); + Y = d3_geo_graticuleY(X0, X1, precision); + return graticule; + }; + return graticule.majorExtent([ [ -180, -90 + ฮต ], [ 180, 90 - ฮต ] ]).minorExtent([ [ -180, -80 - ฮต ], [ 180, 80 + ฮต ] ]); + }; + function d3_geo_graticuleX(y0, y1, dy) { + var y = d3.range(y0, y1 - ฮต, dy).concat(y1); + return function(x) { + return y.map(function(y) { + return [ x, y ]; + }); + }; + } + function d3_geo_graticuleY(x0, x1, dx) { + var x = d3.range(x0, x1 - ฮต, dx).concat(x1); + return function(y) { + return x.map(function(x) { + return [ x, y ]; + }); + }; + } + function d3_source(d) { + return d.source; + } + function d3_target(d) { + return d.target; + } + d3.geo.greatArc = function() { + var source = d3_source, source_, target = d3_target, target_; + function greatArc() { + return { + type: "LineString", + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] + }; + } + greatArc.distance = function() { + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _, source_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _, target_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.precision = function() { + return arguments.length ? greatArc : 0; + }; + return greatArc; + }; + d3.geo.interpolate = function(source, target) { + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); + }; + function d3_geo_interpolate(x0, y0, x1, y1) { + var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); + var interpolate = d ? function(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; + } : function() { + return [ x0 * d3_degrees, y0 * d3_degrees ]; + }; + interpolate.distance = d; + return interpolate; + } + d3.geo.length = function(object) { + d3_geo_lengthSum = 0; + d3.geo.stream(object, d3_geo_length); + return d3_geo_lengthSum; + }; + var d3_geo_lengthSum; + var d3_geo_length = { + sphere: d3_noop, + point: d3_noop, + lineStart: d3_geo_lengthLineStart, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop + }; + function d3_geo_lengthLineStart() { + var ฮป0, sinฯ†0, cosฯ†0; + d3_geo_length.point = function(ฮป, ฯ†) { + ฮป0 = ฮป * d3_radians, sinฯ†0 = Math.sin(ฯ† *= d3_radians), cosฯ†0 = Math.cos(ฯ†); + d3_geo_length.point = nextPoint; + }; + d3_geo_length.lineEnd = function() { + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; + }; + function nextPoint(ฮป, ฯ†) { + var sinฯ† = Math.sin(ฯ† *= d3_radians), cosฯ† = Math.cos(ฯ†), t = abs((ฮป *= d3_radians) - ฮป0), cosฮ”ฮป = Math.cos(t); + d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosฯ† * Math.sin(t)) * t + (t = cosฯ†0 * sinฯ† - sinฯ†0 * cosฯ† * cosฮ”ฮป) * t), sinฯ†0 * sinฯ† + cosฯ†0 * cosฯ† * cosฮ”ฮป); + ฮป0 = ฮป, sinฯ†0 = sinฯ†, cosฯ†0 = cosฯ†; + } + } + function d3_geo_azimuthal(scale, angle) { + function azimuthal(ฮป, ฯ†) { + var cosฮป = Math.cos(ฮป), cosฯ† = Math.cos(ฯ†), k = scale(cosฮป * cosฯ†); + return [ k * cosฯ† * Math.sin(ฮป), k * Math.sin(ฯ†) ]; + } + azimuthal.invert = function(x, y) { + var ฯ = Math.sqrt(x * x + y * y), c = angle(ฯ), sinc = Math.sin(c), cosc = Math.cos(c); + return [ Math.atan2(x * sinc, ฯ * cosc), Math.asin(ฯ && y * sinc / ฯ) ]; + }; + return azimuthal; + } + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosฮปcosฯ†) { + return Math.sqrt(2 / (1 + cosฮปcosฯ†)); + }, function(ฯ) { + return 2 * Math.asin(ฯ / 2); + }); + (d3.geo.azimuthalEqualArea = function() { + return d3_geo_projection(d3_geo_azimuthalEqualArea); + }).raw = d3_geo_azimuthalEqualArea; + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosฮปcosฯ†) { + var c = Math.acos(cosฮปcosฯ†); + return c && c / Math.sin(c); + }, d3_identity); + (d3.geo.azimuthalEquidistant = function() { + return d3_geo_projection(d3_geo_azimuthalEquidistant); + }).raw = d3_geo_azimuthalEquidistant; + function d3_geo_conicConformal(ฯ†0, ฯ†1) { + var cosฯ†0 = Math.cos(ฯ†0), t = function(ฯ†) { + return Math.tan(ฯ€ / 4 + ฯ† / 2); + }, n = ฯ†0 === ฯ†1 ? Math.sin(ฯ†0) : Math.log(cosฯ†0 / Math.cos(ฯ†1)) / Math.log(t(ฯ†1) / t(ฯ†0)), F = cosฯ†0 * Math.pow(t(ฯ†0), n) / n; + if (!n) return d3_geo_mercator; + function forward(ฮป, ฯ†) { + if (F > 0) { + if (ฯ† < -halfฯ€ + ฮต) ฯ† = -halfฯ€ + ฮต; + } else { + if (ฯ† > halfฯ€ - ฮต) ฯ† = halfฯ€ - ฮต; + } + var ฯ = F / Math.pow(t(ฯ†), n); + return [ ฯ * Math.sin(n * ฮป), F - ฯ * Math.cos(n * ฮป) ]; + } + forward.invert = function(x, y) { + var ฯ0_y = F - y, ฯ = d3_sgn(n) * Math.sqrt(x * x + ฯ0_y * ฯ0_y); + return [ Math.atan2(x, ฯ0_y) / n, 2 * Math.atan(Math.pow(F / ฯ, 1 / n)) - halfฯ€ ]; + }; + return forward; + } + (d3.geo.conicConformal = function() { + return d3_geo_conic(d3_geo_conicConformal); + }).raw = d3_geo_conicConformal; + function d3_geo_conicEquidistant(ฯ†0, ฯ†1) { + var cosฯ†0 = Math.cos(ฯ†0), n = ฯ†0 === ฯ†1 ? Math.sin(ฯ†0) : (cosฯ†0 - Math.cos(ฯ†1)) / (ฯ†1 - ฯ†0), G = cosฯ†0 / n + ฯ†0; + if (abs(n) < ฮต) return d3_geo_equirectangular; + function forward(ฮป, ฯ†) { + var ฯ = G - ฯ†; + return [ ฯ * Math.sin(n * ฮป), G - ฯ * Math.cos(n * ฮป) ]; + } + forward.invert = function(x, y) { + var ฯ0_y = G - y; + return [ Math.atan2(x, ฯ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ฯ0_y * ฯ0_y) ]; + }; + return forward; + } + (d3.geo.conicEquidistant = function() { + return d3_geo_conic(d3_geo_conicEquidistant); + }).raw = d3_geo_conicEquidistant; + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosฮปcosฯ†) { + return 1 / cosฮปcosฯ†; + }, Math.atan); + (d3.geo.gnomonic = function() { + return d3_geo_projection(d3_geo_gnomonic); + }).raw = d3_geo_gnomonic; + function d3_geo_mercator(ฮป, ฯ†) { + return [ ฮป, Math.log(Math.tan(ฯ€ / 4 + ฯ† / 2)) ]; + } + d3_geo_mercator.invert = function(x, y) { + return [ x, 2 * Math.atan(Math.exp(y)) - halfฯ€ ]; + }; + function d3_geo_mercatorProjection(project) { + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; + m.scale = function() { + var v = scale.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.translate = function() { + var v = translate.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.clipExtent = function(_) { + var v = clipExtent.apply(m, arguments); + if (v === m) { + if (clipAuto = _ == null) { + var k = ฯ€ * scale(), t = translate(); + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); + } + } else if (clipAuto) { + v = null; + } + return v; + }; + return m.clipExtent(null); + } + (d3.geo.mercator = function() { + return d3_geo_mercatorProjection(d3_geo_mercator); + }).raw = d3_geo_mercator; + var d3_geo_orthographic = d3_geo_azimuthal(function() { + return 1; + }, Math.asin); + (d3.geo.orthographic = function() { + return d3_geo_projection(d3_geo_orthographic); + }).raw = d3_geo_orthographic; + var d3_geo_stereographic = d3_geo_azimuthal(function(cosฮปcosฯ†) { + return 1 / (1 + cosฮปcosฯ†); + }, function(ฯ) { + return 2 * Math.atan(ฯ); + }); + (d3.geo.stereographic = function() { + return d3_geo_projection(d3_geo_stereographic); + }).raw = d3_geo_stereographic; + function d3_geo_transverseMercator(ฮป, ฯ†) { + return [ Math.log(Math.tan(ฯ€ / 4 + ฯ† / 2)), -ฮป ]; + } + d3_geo_transverseMercator.invert = function(x, y) { + return [ -y, 2 * Math.atan(Math.exp(x)) - halfฯ€ ]; + }; + (d3.geo.transverseMercator = function() { + var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; + projection.center = function(_) { + return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ _[1], -_[0] ]); + }; + projection.rotate = function(_) { + return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), + [ _[0], _[1], _[2] - 90 ]); + }; + return rotate([ 0, 0, 90 ]); + }).raw = d3_geo_transverseMercator; + d3.geom = {}; + function d3_geom_pointX(d) { + return d[0]; + } + function d3_geom_pointY(d) { + return d[1]; + } + d3.geom.hull = function(vertices) { + var x = d3_geom_pointX, y = d3_geom_pointY; + if (arguments.length) return hull(vertices); + function hull(data) { + if (data.length < 3) return []; + var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; + for (i = 0; i < n; i++) { + points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); + } + points.sort(d3_geom_hullOrder); + for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]); + var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints); + var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = []; + for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]); + for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]); + return polygon; + } + hull.x = function(_) { + return arguments.length ? (x = _, hull) : x; + }; + hull.y = function(_) { + return arguments.length ? (y = _, hull) : y; + }; + return hull; + }; + function d3_geom_hullUpper(points) { + var n = points.length, hull = [ 0, 1 ], hs = 2; + for (var i = 2; i < n; i++) { + while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; + hull[hs++] = i; + } + return hull.slice(0, hs); + } + function d3_geom_hullOrder(a, b) { + return a[0] - b[0] || a[1] - b[1]; + } + d3.geom.polygon = function(coordinates) { + d3_subclass(coordinates, d3_geom_polygonPrototype); + return coordinates; + }; + var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; + d3_geom_polygonPrototype.area = function() { + var i = -1, n = this.length, a, b = this[n - 1], area = 0; + while (++i < n) { + a = b; + b = this[i]; + area += a[1] * b[0] - a[0] * b[1]; + } + return area * .5; + }; + d3_geom_polygonPrototype.centroid = function(k) { + var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; + if (!arguments.length) k = -1 / (6 * this.area()); + while (++i < n) { + a = b; + b = this[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [ x * k, y * k ]; + }; + d3_geom_polygonPrototype.clip = function(subject) { + var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = this[i]; + c = input[(m = input.length - closed) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + if (closed) subject.push(subject[0]); + a = b; + } + return subject; + }; + function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); + } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; + } + function d3_geom_polygonClosed(coordinates) { + var a = coordinates[0], b = coordinates[coordinates.length - 1]; + return !(a[0] - b[0] || a[1] - b[1]); + } + var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; + function d3_geom_voronoiBeach() { + d3_geom_voronoiRedBlackNode(this); + this.edge = this.site = this.circle = null; + } + function d3_geom_voronoiCreateBeach(site) { + var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); + beach.site = site; + return beach; + } + function d3_geom_voronoiDetachBeach(beach) { + d3_geom_voronoiDetachCircle(beach); + d3_geom_voronoiBeaches.remove(beach); + d3_geom_voronoiBeachPool.push(beach); + d3_geom_voronoiRedBlackNode(beach); + } + function d3_geom_voronoiRemoveBeach(beach) { + var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { + x: x, + y: y + }, previous = beach.P, next = beach.N, disappearing = [ beach ]; + d3_geom_voronoiDetachBeach(beach); + var lArc = previous; + while (lArc.circle && abs(x - lArc.circle.x) < ฮต && abs(y - lArc.circle.cy) < ฮต) { + previous = lArc.P; + disappearing.unshift(lArc); + d3_geom_voronoiDetachBeach(lArc); + lArc = previous; + } + disappearing.unshift(lArc); + d3_geom_voronoiDetachCircle(lArc); + var rArc = next; + while (rArc.circle && abs(x - rArc.circle.x) < ฮต && abs(y - rArc.circle.cy) < ฮต) { + next = rArc.N; + disappearing.push(rArc); + d3_geom_voronoiDetachBeach(rArc); + rArc = next; + } + disappearing.push(rArc); + d3_geom_voronoiDetachCircle(rArc); + var nArcs = disappearing.length, iArc; + for (iArc = 1; iArc < nArcs; ++iArc) { + rArc = disappearing[iArc]; + lArc = disappearing[iArc - 1]; + d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); + } + lArc = disappearing[0]; + rArc = disappearing[nArcs - 1]; + rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + } + function d3_geom_voronoiAddBeach(site) { + var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; + while (node) { + dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; + if (dxl > ฮต) node = node.L; else { + dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); + if (dxr > ฮต) { + if (!node.R) { + lArc = node; + break; + } + node = node.R; + } else { + if (dxl > -ฮต) { + lArc = node.P; + rArc = node; + } else if (dxr > -ฮต) { + lArc = node; + rArc = node.N; + } else { + lArc = rArc = node; + } + break; + } + } + } + var newArc = d3_geom_voronoiCreateBeach(site); + d3_geom_voronoiBeaches.insert(lArc, newArc); + if (!lArc && !rArc) return; + if (lArc === rArc) { + d3_geom_voronoiDetachCircle(lArc); + rArc = d3_geom_voronoiCreateBeach(lArc.site); + d3_geom_voronoiBeaches.insert(newArc, rArc); + newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + return; + } + if (!rArc) { + newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); + return; + } + d3_geom_voronoiDetachCircle(lArc); + d3_geom_voronoiDetachCircle(rArc); + var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = { + x: (cy * hb - by * hc) / d + ax, + y: (bx * hc - cx * hb) / d + ay + }; + d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); + newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); + rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); + d3_geom_voronoiAttachCircle(lArc); + d3_geom_voronoiAttachCircle(rArc); + } + function d3_geom_voronoiLeftBreakPoint(arc, directrix) { + var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix; + if (!pby2) return rfocx; + var lArc = arc.P; + if (!lArc) return -Infinity; + site = lArc.site; + var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix; + if (!plby2) return lfocx; + var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; + if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; + return (rfocx + lfocx) / 2; + } + function d3_geom_voronoiRightBreakPoint(arc, directrix) { + var rArc = arc.N; + if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix); + var site = arc.site; + return site.y === directrix ? site.x : Infinity; + } + function d3_geom_voronoiCell(site) { + this.site = site; + this.edges = []; + } + d3_geom_voronoiCell.prototype.prepare = function() { + var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge; + while (iHalfEdge--) { + edge = halfEdges[iHalfEdge].edge; + if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1); + } + halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); + return halfEdges.length; + }; + function d3_geom_voronoiCloseCells(extent) { + var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end; + while (iCell--) { + cell = cells[iCell]; + if (!cell || !cell.prepare()) continue; + halfEdges = cell.edges; + nHalfEdges = halfEdges.length; + iHalfEdge = 0; + while (iHalfEdge < nHalfEdges) { + end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; + start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; + if (abs(x3 - x2) > ฮต || abs(y3 - y2) > ฮต) { + halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ฮต && y1 - y3 > ฮต ? { + x: x0, + y: abs(x2 - x0) < ฮต ? y2 : y1 + } : abs(y3 - y1) < ฮต && x1 - x3 > ฮต ? { + x: abs(y2 - y1) < ฮต ? x2 : x1, + y: y1 + } : abs(x3 - x1) < ฮต && y3 - y0 > ฮต ? { + x: x1, + y: abs(x2 - x1) < ฮต ? y2 : y0 + } : abs(y3 - y0) < ฮต && x3 - x0 > ฮต ? { + x: abs(y2 - y0) < ฮต ? x2 : x0, + y: y0 + } : null), cell.site, null)); + ++nHalfEdges; + } + } + } + } + function d3_geom_voronoiHalfEdgeOrder(a, b) { + return b.angle - a.angle; + } + function d3_geom_voronoiCircle() { + d3_geom_voronoiRedBlackNode(this); + this.x = this.y = this.arc = this.site = this.cy = null; + } + function d3_geom_voronoiAttachCircle(arc) { + var lArc = arc.P, rArc = arc.N; + if (!lArc || !rArc) return; + var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; + if (lSite === rSite) return; + var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; + var d = 2 * (ax * cy - ay * cx); + if (d >= -ฮต2) return; + var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by; + var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); + circle.arc = arc; + circle.site = cSite; + circle.x = x + bx; + circle.y = cy + Math.sqrt(x * x + y * y); + circle.cy = cy; + arc.circle = circle; + var before = null, node = d3_geom_voronoiCircles._; + while (node) { + if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { + if (node.L) node = node.L; else { + before = node.P; + break; + } + } else { + if (node.R) node = node.R; else { + before = node; + break; + } + } + } + d3_geom_voronoiCircles.insert(before, circle); + if (!before) d3_geom_voronoiFirstCircle = circle; + } + function d3_geom_voronoiDetachCircle(arc) { + var circle = arc.circle; + if (circle) { + if (!circle.P) d3_geom_voronoiFirstCircle = circle.N; + d3_geom_voronoiCircles.remove(circle); + d3_geom_voronoiCirclePool.push(circle); + d3_geom_voronoiRedBlackNode(circle); + arc.circle = null; + } + } + function d3_geom_voronoiClipEdges(extent) { + var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e; + while (i--) { + e = edges[i]; + if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ฮต && abs(e.a.y - e.b.y) < ฮต) { + e.a = e.b = null; + edges.splice(i, 1); + } + } + } + function d3_geom_voronoiConnectEdge(edge, extent) { + var vb = edge.b; + if (vb) return true; + var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; + if (ry === ly) { + if (fx < x0 || fx >= x1) return; + if (lx > rx) { + if (!va) va = { + x: fx, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: fx, + y: y1 + }; + } else { + if (!va) va = { + x: fx, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: fx, + y: y0 + }; + } + } else { + fm = (lx - rx) / (ry - ly); + fb = fy - fm * fx; + if (fm < -1 || fm > 1) { + if (lx > rx) { + if (!va) va = { + x: (y0 - fb) / fm, + y: y0 + }; else if (va.y >= y1) return; + vb = { + x: (y1 - fb) / fm, + y: y1 + }; + } else { + if (!va) va = { + x: (y1 - fb) / fm, + y: y1 + }; else if (va.y < y0) return; + vb = { + x: (y0 - fb) / fm, + y: y0 + }; + } + } else { + if (ly < ry) { + if (!va) va = { + x: x0, + y: fm * x0 + fb + }; else if (va.x >= x1) return; + vb = { + x: x1, + y: fm * x1 + fb + }; + } else { + if (!va) va = { + x: x1, + y: fm * x1 + fb + }; else if (va.x < x0) return; + vb = { + x: x0, + y: fm * x0 + fb + }; + } + } + } + edge.a = va; + edge.b = vb; + return true; + } + function d3_geom_voronoiEdge(lSite, rSite) { + this.l = lSite; + this.r = rSite; + this.a = this.b = null; + } + function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, rSite); + d3_geom_voronoiEdges.push(edge); + if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); + if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); + d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); + d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); + return edge; + } + function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { + var edge = new d3_geom_voronoiEdge(lSite, null); + edge.a = va; + edge.b = vb; + d3_geom_voronoiEdges.push(edge); + return edge; + } + function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) { + if (!edge.a && !edge.b) { + edge.a = vertex; + edge.l = lSite; + edge.r = rSite; + } else if (edge.l === rSite) { + edge.b = vertex; + } else { + edge.a = vertex; + } + } + function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { + var va = edge.a, vb = edge.b; + this.edge = edge; + this.site = lSite; + this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y); + } + d3_geom_voronoiHalfEdge.prototype = { + start: function() { + return this.edge.l === this.site ? this.edge.a : this.edge.b; + }, + end: function() { + return this.edge.l === this.site ? this.edge.b : this.edge.a; + } + }; + function d3_geom_voronoiRedBlackTree() { + this._ = null; + } + function d3_geom_voronoiRedBlackNode(node) { + node.U = node.C = node.L = node.R = node.P = node.N = null; + } + d3_geom_voronoiRedBlackTree.prototype = { + insert: function(after, node) { + var parent, grandpa, uncle; + if (after) { + node.P = after; + node.N = after.N; + if (after.N) after.N.P = node; + after.N = node; + if (after.R) { + after = after.R; + while (after.L) after = after.L; + after.L = node; + } else { + after.R = node; + } + parent = after; + } else if (this._) { + after = d3_geom_voronoiRedBlackFirst(this._); + node.P = null; + node.N = after; + after.P = after.L = node; + parent = after; + } else { + node.P = node.N = null; + this._ = node; + parent = null; + } + node.L = node.R = null; + node.U = parent; + node.C = true; + after = node; + while (parent && parent.C) { + grandpa = parent.U; + if (parent === grandpa.L) { + uncle = grandpa.R; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.R) { + d3_geom_voronoiRedBlackRotateLeft(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + d3_geom_voronoiRedBlackRotateRight(this, grandpa); + } + } else { + uncle = grandpa.L; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.L) { + d3_geom_voronoiRedBlackRotateRight(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, grandpa); + } + } + parent = after.U; + } + this._.C = false; + }, + remove: function(node) { + if (node.N) node.N.P = node.P; + if (node.P) node.P.N = node.N; + node.N = node.P = null; + var parent = node.U, sibling, left = node.L, right = node.R, next, red; + if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right); + if (parent) { + if (parent.L === node) parent.L = next; else parent.R = next; + } else { + this._ = next; + } + if (left && right) { + red = next.C; + next.C = node.C; + next.L = left; + left.U = next; + if (next !== right) { + parent = next.U; + next.U = node.U; + node = next.R; + parent.L = node; + next.R = right; + right.U = next; + } else { + next.U = parent; + parent = next; + node = next.R; + } + } else { + red = node.C; + node = next; + } + if (node) node.U = parent; + if (red) return; + if (node && node.C) { + node.C = false; + return; + } + do { + if (node === this._) break; + if (node === parent.L) { + sibling = parent.R; + if (sibling.C) { + sibling.C = false; + parent.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, parent); + sibling = parent.R; + } + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { + if (!sibling.R || !sibling.R.C) { + sibling.L.C = false; + sibling.C = true; + d3_geom_voronoiRedBlackRotateRight(this, sibling); + sibling = parent.R; + } + sibling.C = parent.C; + parent.C = sibling.R.C = false; + d3_geom_voronoiRedBlackRotateLeft(this, parent); + node = this._; + break; + } + } else { + sibling = parent.L; + if (sibling.C) { + sibling.C = false; + parent.C = true; + d3_geom_voronoiRedBlackRotateRight(this, parent); + sibling = parent.L; + } + if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { + if (!sibling.L || !sibling.L.C) { + sibling.R.C = false; + sibling.C = true; + d3_geom_voronoiRedBlackRotateLeft(this, sibling); + sibling = parent.L; + } + sibling.C = parent.C; + parent.C = sibling.L.C = false; + d3_geom_voronoiRedBlackRotateRight(this, parent); + node = this._; + break; + } + } + sibling.C = true; + node = parent; + parent = parent.U; + } while (!node.C); + if (node) node.C = false; + } + }; + function d3_geom_voronoiRedBlackRotateLeft(tree, node) { + var p = node, q = node.R, parent = p.U; + if (parent) { + if (parent.L === p) parent.L = q; else parent.R = q; + } else { + tree._ = q; + } + q.U = parent; + p.U = q; + p.R = q.L; + if (p.R) p.R.U = p; + q.L = p; + } + function d3_geom_voronoiRedBlackRotateRight(tree, node) { + var p = node, q = node.L, parent = p.U; + if (parent) { + if (parent.L === p) parent.L = q; else parent.R = q; + } else { + tree._ = q; + } + q.U = parent; + p.U = q; + p.L = q.R; + if (p.L) p.L.U = p; + q.R = p; + } + function d3_geom_voronoiRedBlackFirst(node) { + while (node.L) node = node.L; + return node; + } + function d3_geom_voronoi(sites, bbox) { + var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; + d3_geom_voronoiEdges = []; + d3_geom_voronoiCells = new Array(sites.length); + d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); + d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); + while (true) { + circle = d3_geom_voronoiFirstCircle; + if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { + if (site.x !== x0 || site.y !== y0) { + d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); + d3_geom_voronoiAddBeach(site); + x0 = site.x, y0 = site.y; + } + site = sites.pop(); + } else if (circle) { + d3_geom_voronoiRemoveBeach(circle.arc); + } else { + break; + } + } + if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox); + var diagram = { + cells: d3_geom_voronoiCells, + edges: d3_geom_voronoiEdges + }; + d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null; + return diagram; + } + function d3_geom_voronoiVertexOrder(a, b) { + return b.y - a.y || b.x - a.x; + } + d3.geom.voronoi = function(points) { + var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; + if (points) return voronoi(points); + function voronoi(data) { + var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; + d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { + var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { + var s = e.start(); + return [ s.x, s.y ]; + }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; + polygon.point = data[i]; + }); + return polygons; + } + function sites(data) { + return data.map(function(d, i) { + return { + x: Math.round(fx(d, i) / ฮต) * ฮต, + y: Math.round(fy(d, i) / ฮต) * ฮต, + i: i + }; + }); + } + voronoi.links = function(data) { + return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { + return edge.l && edge.r; + }).map(function(edge) { + return { + source: data[edge.l.i], + target: data[edge.r.i] + }; + }); + }; + voronoi.triangles = function(data) { + var triangles = []; + d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { + var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l; + while (++j < m) { + e0 = e1; + s0 = s1; + e1 = edges[j].edge; + s1 = e1.l === site ? e1.r : e1.l; + if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { + triangles.push([ data[i], data[s0.i], data[s1.i] ]); + } + } + }); + return triangles; + }; + voronoi.x = function(_) { + return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; + }; + voronoi.y = function(_) { + return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; + }; + voronoi.clipExtent = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; + clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; + return voronoi; + }; + voronoi.size = function(_) { + if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; + return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); + }; + return voronoi; + }; + var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; + function d3_geom_voronoiTriangleArea(a, b, c) { + return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); + } + d3.geom.delaunay = function(vertices) { + return d3.geom.voronoi().triangles(vertices); + }; + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var x = d3_geom_pointX, y = d3_geom_pointY, compat; + if (compat = arguments.length) { + x = d3_geom_quadtreeCompatX; + y = d3_geom_quadtreeCompatY; + if (compat === 3) { + y2 = y1; + x2 = x1; + y1 = x1 = 0; + } + return quadtree(points); + } + function quadtree(data) { + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; + if (x1 != null) { + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; + } else { + x2_ = y2_ = -(x1_ = y1_ = Infinity); + xs = [], ys = []; + n = data.length; + if (compat) for (i = 0; i < n; ++i) { + d = data[i]; + if (d.x < x1_) x1_ = d.x; + if (d.y < y1_) y1_ = d.y; + if (d.x > x2_) x2_ = d.x; + if (d.y > y2_) y2_ = d.y; + xs.push(d.x); + ys.push(d.y); + } else for (i = 0; i < n; ++i) { + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); + if (x_ < x1_) x1_ = x_; + if (y_ < y1_) y1_ = y_; + if (x_ > x2_) x2_ = x_; + if (y_ > y2_) y2_ = y_; + xs.push(x_); + ys.push(y_); + } + } + var dx = x2_ - x1_, dy = y2_ - y1_; + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; + function insert(n, d, x, y, x1, y1, x2, y2) { + if (isNaN(x) || isNaN(y)) return; + if (n.leaf) { + var nx = n.x, ny = n.y; + if (nx != null) { + if (abs(nx - x) + abs(ny - y) < .01) { + insertChild(n, d, x, y, x1, y1, x2, y2); + } else { + var nPoint = n.point; + n.x = n.y = n.point = null; + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } else { + n.x = x, n.y = y, n.point = d; + } + } else { + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } + function insertChild(n, d, x, y, x1, y1, x2, y2) { + var xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym, i = below << 1 | right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = xm; else x2 = xm; + if (below) y1 = ym; else y2 = ym; + insert(n, d, x, y, x1, y1, x2, y2); + } + var root = d3_geom_quadtreeNode(); + root.add = function(d) { + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); + }; + root.find = function(point) { + return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); + }; + i = -1; + if (x1 == null) { + while (++i < n) { + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); + } + --i; + } else data.forEach(root.add); + xs = ys = data = d = null; + return root; + } + quadtree.x = function(_) { + return arguments.length ? (x = _, quadtree) : x; + }; + quadtree.y = function(_) { + return arguments.length ? (y = _, quadtree) : y; + }; + quadtree.extent = function(_) { + if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], + y2 = +_[1][1]; + return quadtree; + }; + quadtree.size = function(_) { + if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; + if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; + return quadtree; + }; + return quadtree; + }; + function d3_geom_quadtreeCompatX(d) { + return d.x; + } + function d3_geom_quadtreeCompatY(d) { + return d.y; + } + function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null, + x: null, + y: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + function d3_geom_quadtreeFind(root, x, y, x0, y0, x3, y3) { + var minDistance2 = Infinity, closestPoint; + (function find(node, x1, y1, x2, y2) { + if (x1 > x3 || y1 > y3 || x2 < x0 || y2 < y0) return; + if (point = node.point) { + var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy; + if (distance2 < minDistance2) { + var distance = Math.sqrt(minDistance2 = distance2); + x0 = x - distance, y0 = y - distance; + x3 = x + distance, y3 = y + distance; + closestPoint = point; + } + } + var children = node.nodes, xm = (x1 + x2) * .5, ym = (y1 + y2) * .5, right = x >= xm, below = y >= ym; + for (var i = below << 1 | right, j = i + 4; i < j; ++i) { + if (node = children[i & 3]) switch (i & 3) { + case 0: + find(node, x1, y1, xm, ym); + break; + + case 1: + find(node, xm, y1, x2, ym); + break; + + case 2: + find(node, x1, ym, xm, y2); + break; + + case 3: + find(node, xm, ym, x2, y2); + break; + } + } + })(root, x0, y0, x3, y3); + return closestPoint; + } + d3.interpolateRgb = d3_interpolateRgb; + function d3_interpolateRgb(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); + }; + } + d3.interpolateObject = d3_interpolateObject; + function d3_interpolateObject(a, b) { + var i = {}, c = {}, k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolate(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } + d3.interpolateNumber = d3_interpolateNumber; + function d3_interpolateNumber(a, b) { + a = +a, b = +b; + return function(t) { + return a * (1 - t) + b * t; + }; + } + d3.interpolateString = d3_interpolateString; + function d3_interpolateString(a, b) { + var bi = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a = a + "", b = b + ""; + while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { + if ((bs = bm.index) > bi) { + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s[i]) s[i] += bm; else s[++i] = bm; + } else { + s[++i] = null; + q.push({ + i: i, + x: d3_interpolateNumber(am, bm) + }); + } + bi = d3_interpolate_numberB.lastIndex; + } + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; else s[++i] = bs; + } + return s.length < 2 ? q[0] ? (b = q[0].x, function(t) { + return b(t) + ""; + }) : function() { + return b; + } : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } + var d3_interpolate_numberA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, "g"); + d3.interpolate = d3_interpolate; + function d3_interpolate(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; + return f; + } + d3.interpolators = [ function(a, b) { + var t = typeof b; + return (t === "string" ? d3_rgb_names.has(b.toLowerCase()) || /^(#|rgb\(|hsl\()/i.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b); + } ]; + d3.interpolateArray = d3_interpolateArray; + function d3_interpolateArray(a, b) { + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); + for (;i < na; ++i) c[i] = a[i]; + for (;i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + } + var d3_ease_default = function() { + return d3_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; + }, + cubic: function() { + return d3_ease_cubic; + }, + sin: function() { + return d3_ease_sin; + }, + exp: function() { + return d3_ease_exp; + }, + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; + } + }); + var d3_ease_mode = d3.map({ + "in": d3_identity, + out: d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { + return d3_ease_reflect(d3_ease_reverse(f)); + } + }); + d3.ease = function(name) { + var i = name.indexOf("-"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_identity; + return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1)))); + }; + function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; + } + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; + } + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; + } + function d3_ease_quad(t) { + return t * t; + } + function d3_ease_cubic(t) { + return t * t * t; + } + function d3_ease_cubicInOut(t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + var t2 = t * t, t3 = t2 * t; + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); + } + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * halfฯ€); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length) s = p / ฯ„ * Math.asin(1 / a); else a = 1, s = p / 4; + return function(t) { + return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * ฯ„ / p); + }; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; + } + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; + } + d3.interpolateHcl = d3_interpolateHcl; + function d3_interpolateHcl(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; + }; + } + d3.interpolateHsl = d3_interpolateHsl; + function d3_interpolateHsl(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; + if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; + if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; + }; + } + d3.interpolateLab = d3_interpolateLab; + function d3_interpolateLab(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + } + d3.interpolateRound = d3_interpolateRound; + function d3_interpolateRound(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); + }; + } + d3.transform = function(string) { + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + if (string != null) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + } + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); + }; + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; + } + d3_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; + }; + function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; + } + function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; + } + var d3_transformIdentity = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + d3.interpolateTransform = d3_interpolateTransform; + function d3_interpolateTransformPop(s) { + return s.length ? s.pop() + "," : ""; + } + function d3_interpolateTranslate(ta, tb, s, q) { + if (ta[0] !== tb[0] || ta[1] !== tb[1]) { + var i = s.push("translate(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ta[0], tb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } + } + function d3_interpolateRotate(ra, rb, s, q) { + if (ra !== rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, + x: d3_interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); + } + } + function d3_interpolateSkew(wa, wb, s, q) { + if (wa !== wb) { + q.push({ + i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, + x: d3_interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); + } + } + function d3_interpolateScale(ka, kb, s, q) { + if (ka[0] !== kb[0] || ka[1] !== kb[1]) { + var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); + q.push({ + i: i - 4, + x: d3_interpolateNumber(ka[0], kb[0]) + }, { + i: i - 2, + x: d3_interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] !== 1 || kb[1] !== 1) { + s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); + } + } + function d3_interpolateTransform(a, b) { + var s = [], q = []; + a = d3.transform(a), b = d3.transform(b); + d3_interpolateTranslate(a.translate, b.translate, s, q); + d3_interpolateRotate(a.rotate, b.rotate, s, q); + d3_interpolateSkew(a.skew, b.skew, s, q); + d3_interpolateScale(a.scale, b.scale, s, q); + a = b = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + } + function d3_uninterpolateNumber(a, b) { + b = (b -= a = +a) || 1 / b; + return function(x) { + return (x - a) / b; + }; + } + function d3_uninterpolateClamp(a, b) { + b = (b -= a = +a) || 1 / b; + return function(x) { + return Math.max(0, Math.min(1, (x - a) / b)); + }; + } + d3.layout = {}; + d3.layout.bundle = function() { + return function(links) { + var paths = [], i = -1, n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; + }; + function d3_layout_bundlePath(link) { + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; + } + function d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; + } + function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; + } + d3.layout.chord = function() { + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; + while (++i < n) { + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (ฯ„ - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: groupSums[di] + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); + } + } + } + if (sortChords) resort(); + } + function resort() { + chords.sort(function(a, b) { + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); + }); + } + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + return chord; + }; + d3.layout.force = function() { + var force = {}, event = d3.dispatch("start", "tick", "end"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges; + function repulse(node) { + return function(quad, x1, _, x2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; + if (dw * dw / theta2 < dn) { + if (dn < chargeDistance2) { + var k = quad.charge / dn; + node.px -= dx * k; + node.py -= dy * k; + } + return true; + } + if (quad.point && dn && dn < chargeDistance2) { + var k = quad.pointCharge / dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + force.tick = function() { + if ((alpha *= .99) < .005) { + timer = null; + event.end({ + type: "end", + alpha: alpha = 0 + }); + return true; + } + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = x * x + y * y) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; + if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; + while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + i = -1; + while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + event.tick({ + type: "tick", + alpha: alpha + }); + }; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = typeof x === "function" ? x : +x; + return force; + }; + force.distance = force.linkDistance; + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = typeof x === "function" ? x : +x; + return force; + }; + force.friction = function(x) { + if (!arguments.length) return friction; + friction = +x; + return force; + }; + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + force.chargeDistance = function(x) { + if (!arguments.length) return Math.sqrt(chargeDistance2); + chargeDistance2 = x * x; + return force; + }; + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = +x; + return force; + }; + force.theta = function(x) { + if (!arguments.length) return Math.sqrt(theta2); + theta2 = x * x; + return force; + }; + force.alpha = function(x) { + if (!arguments.length) return alpha; + x = +x; + if (alpha) { + if (x > 0) { + alpha = x; + } else { + timer.c = null, timer.t = NaN, timer = null; + event.end({ + type: "end", + alpha: alpha = 0 + }); + } + } else if (x > 0) { + event.start({ + type: "start", + alpha: alpha = x + }); + timer = d3_timer(force.tick); + } + return force; + }; + force.start = function() { + var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + distances = []; + if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; + strengths = []; + if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; + charges = []; + if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; + function position(dimension, size) { + if (!neighbors) { + neighbors = new Array(n); + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + var candidates = neighbors[i], j = -1, l = candidates.length, x; + while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; + return Math.random() * size; + } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); + if (!arguments.length) return drag; + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + function dragmove(d) { + d.px = d3.event.x, d.py = d3.event.y; + force.resume(); + } + return d3.rebind(force, event, "on"); + }; + function d3_layout_forceDragstart(d) { + d.fixed |= 2; + } + function d3_layout_forceDragend(d) { + d.fixed &= ~6; + } + function d3_layout_forceMouseover(d) { + d.fixed |= 4; + d.px = d.x, d.py = d.y; + } + function d3_layout_forceMouseout(d) { + d.fixed &= ~4; + } + function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, n = nodes.length, i = -1, c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; + } + var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; + d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; + function hierarchy(root) { + var stack = [ root ], nodes = [], node; + root.depth = 0; + while ((node = stack.pop()) != null) { + nodes.push(node); + if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) { + var n, childs, child; + while (--n >= 0) { + stack.push(child = childs[n]); + child.parent = node; + child.depth = node.depth + 1; + } + if (value) node.value = 0; + node.children = childs; + } else { + if (value) node.value = +value.call(hierarchy, node, node.depth) || 0; + delete node.children; + } + } + d3_layout_hierarchyVisitAfter(root, function(node) { + var childs, parent; + if (sort && (childs = node.children)) childs.sort(sort); + if (value && (parent = node.parent)) parent.value += node.value; + }); + return nodes; + } + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + hierarchy.revalue = function(root) { + if (value) { + d3_layout_hierarchyVisitBefore(root, function(node) { + if (node.children) node.value = 0; + }); + d3_layout_hierarchyVisitAfter(root, function(node) { + var parent; + if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0; + if (parent = node.parent) parent.value += node.value; + }); + } + return root; + }; + return hierarchy; + }; + function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + object.nodes = object; + object.links = d3_layout_hierarchyLinks; + return object; + } + function d3_layout_hierarchyVisitBefore(node, callback) { + var nodes = [ node ]; + while ((node = nodes.pop()) != null) { + callback(node); + if ((children = node.children) && (n = children.length)) { + var n, children; + while (--n >= 0) nodes.push(children[n]); + } + } + } + function d3_layout_hierarchyVisitAfter(node, callback) { + var nodes = [ node ], nodes2 = []; + while ((node = nodes.pop()) != null) { + nodes2.push(node); + if ((children = node.children) && (n = children.length)) { + var i = -1, n, children; + while (++i < n) nodes.push(children[i]); + } + } + while ((node = nodes2.pop()) != null) { + callback(node); + } + } + function d3_layout_hierarchyChildren(d) { + return d.children; + } + function d3_layout_hierarchyValue(d) { + return d.value; + } + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; + } + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child + }; + }); + })); + } + d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, n, c, d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + function depth(node) { + var children = node.children, d = 0; + if (children && (n = children.length)) { + var i = -1, n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + return d3_layout_hierarchyRebind(partition, hierarchy); + }; + d3.layout.pie = function() { + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = ฯ„, padAngle = 0; + function pie(data) { + var n = data.length, values = data.map(function(d, i) { + return +value.call(pie, d, i); + }), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v; + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { + return values[j] - values[i]; + } : function(i, j) { + return sort(data[i], data[j]); + }); + index.forEach(function(i) { + arcs[i] = { + data: data[i], + value: v = values[i], + startAngle: a, + endAngle: a += v * k + pa, + padAngle: p + }; + }); + return arcs; + } + pie.value = function(_) { + if (!arguments.length) return value; + value = _; + return pie; + }; + pie.sort = function(_) { + if (!arguments.length) return sort; + sort = _; + return pie; + }; + pie.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return pie; + }; + pie.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return pie; + }; + pie.padAngle = function(_) { + if (!arguments.length) return padAngle; + padAngle = _; + return pie; + }; + return pie; + }; + var d3_layout_pieSortByValue = {}; + d3.layout.stack = function() { + var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; + function stack(data, index) { + if (!(n = data.length)) return data; + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; + }); + }); + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + var offsets = offset.call(stack, points, index); + var m = series[0].length, n, i, j, o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + return data; + } + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; + }; + function d3_layout_stackX(d) { + return d.x; + } + function d3_layout_stackY(d) { + return d.y; + } + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; + } + var d3_layout_stackOrders = d3.map({ + "inside-out": function(data) { + var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { + return max[a] - max[b]; + }), top = 0, bottom = 0, tops = [], bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (;i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + d3.layout.histogram = function() { + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + return bins; + } + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" ? function(range) { + return d3_layout_histogramBinFixed(range, x); + } : d3_functor(x); + return histogram; + }; + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + return histogram; + }; + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); + } + function d3_layout_histogramBinFixed(range, n) { + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; + while (++x <= n) f[x] = m * x + b; + return f; + } + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; + } + d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius; + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() { + return radius; + }; + root.x = root.y = 0; + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r = +r(d.value); + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + if (padding) { + var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); + d3_layout_hierarchyVisitAfter(root, function(d) { + d.r -= dr; + }); + } + d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); + return nodes; + } + pack.size = function(_) { + if (!arguments.length) return size; + size = _; + return pack; + }; + pack.radius = function(_) { + if (!arguments.length) return radius; + radius = _ == null || typeof _ === "function" ? _ : +_; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); + }; + function d3_layout_packSort(a, b) { + return a.value - b.value; + } + function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; + } + function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; + } + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return .999 * dr * dr > dx * dx + dy * dy; + } + function d3_layout_packSiblings(node) { + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); + } + function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; + } + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; + } + function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = x += k * node.x; + node.y = y += k * node.y; + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } + } + function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } + } + d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = null; + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0); + d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z; + d3_layout_hierarchyVisitBefore(root1, secondWalk); + if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else { + var left = root0, right = root0, bottom = root0; + d3_layout_hierarchyVisitBefore(root0, function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1); + d3_layout_hierarchyVisitBefore(root0, function(node) { + node.x = (node.x + tx) * kx; + node.y = node.depth * ky; + }); + } + return nodes; + } + function wrapTree(root0) { + var root1 = { + A: null, + children: [ root0 ] + }, queue = [ root1 ], node1; + while ((node1 = queue.pop()) != null) { + for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) { + queue.push((children[i] = child = { + _: children[i], + parent: node1, + children: (child = children[i].children) && child.slice() || [], + A: null, + a: null, + z: 0, + m: 0, + c: 0, + s: 0, + t: null, + i: i + }).a = child); + } + } + return root1.children[0]; + } + function firstWalk(v) { + var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; + if (children.length) { + d3_layout_treeShift(v); + var midpoint = (children[0].z + children[children.length - 1].z) / 2; + if (w) { + v.z = w.z + separation(v._, w._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w) { + v.z = w.z + separation(v._, w._); + } + v.parent.A = apportion(v, w, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w, ancestor) { + if (w) { + var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !d3_layout_treeRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } + function sizeNode(node) { + node.x *= size[0]; + node.y = node.depth * size[1]; + } + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + tree.size = function(x) { + if (!arguments.length) return nodeSize ? null : size; + nodeSize = (size = x) == null ? sizeNode : null; + return tree; + }; + tree.nodeSize = function(x) { + if (!arguments.length) return nodeSize ? size : null; + nodeSize = (size = x) == null ? null : sizeNode; + return tree; + }; + return d3_layout_hierarchyRebind(tree, hierarchy); + }; + function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; + } + function d3_layout_treeLeft(v) { + var children = v.children; + return children.length ? children[0] : v.t; + } + function d3_layout_treeRight(v) { + var children = v.children, n; + return (n = children.length) ? children[n - 1] : v.t; + } + function d3_layout_treeMove(wm, wp, shift) { + var change = shift / (wp.i - wm.i); + wp.c -= change; + wp.s += shift; + wm.c += change; + wp.z += shift; + wp.m += shift; + } + function d3_layout_treeShift(v) { + var shift = 0, change = 0, children = v.children, i = children.length, w; + while (--i >= 0) { + w = children[i]; + w.z += shift; + w.m += shift; + shift += w.s + (change += w.c); + } + } + function d3_layout_treeAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; + d3_layout_hierarchyVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_hierarchyVisitAfter(root, nodeSize ? function(node) { + node.x = (node.x - root.x) * size[0]; + node.y = (root.y - node.y) * size[1]; + } : function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + cluster.size = function(x) { + if (!arguments.length) return nodeSize ? null : size; + nodeSize = (size = x) == null; + return cluster; + }; + cluster.nodeSize = function(x) { + if (!arguments.length) return nodeSize ? size : null; + nodeSize = (size = x) != null; + return cluster; + }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); + } + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; + } + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; + } + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if (mode !== "squarify" || (score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + function worst(row, u) { + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; + } + function position(row, u, rect, flush) { + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; + if (u == rect.dx) { + if (flush || v > rect.dy) v = rect.dy; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; + rect.y += v; + rect.dy -= v; + } else { + if (flush || v > rect.dx) v = rect.dx; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; + rect.x += v; + rect.dx -= v; + } + } + function treemap(d) { + var nodes = stickies || hierarchy(d), root = nodes[0]; + root.x = root.y = 0; + if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0; + if (stickies) hierarchy.revalue(root); + scale([ root ], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + treemap.padding = function(x) { + if (!arguments.length) return padding; + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], + padConstant) : padConstant; + return treemap; + }; + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + treemap.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return treemap; + }; + return d3_layout_hierarchyRebind(treemap, hierarchy); + }; + function d3_layout_treemapPadNull(node) { + return { + x: node.x, + y: node.y, + dx: node.dx, + dy: node.dy + }; + } + function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { + x += dx / 2; + dx = 0; + } + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + d3.random = { + normal: function(ยต, ฯƒ) { + var n = arguments.length; + if (n < 2) ฯƒ = 1; + if (n < 1) ยต = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return ยต + ฯƒ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function() { + var random = d3.random.normal.apply(d3, arguments); + return function() { + return Math.exp(random()); + }; + }, + bates: function(m) { + var random = d3.random.irwinHall(m); + return function() { + return random() / m; + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s; + }; + } + }; + d3.scale = {}; + function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); + } + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; + } + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + return domain; + } + function d3_scale_niceStep(step) { + return step ? { + floor: function(x) { + return Math.floor(x / step) * step; + }, + ceil: function(x) { + return Math.ceil(x / step) * step; + } + } : d3_scale_niceIdentity; + } + var d3_scale_niceIdentity = { + floor: d3_identity, + ceil: d3_identity + }; + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; + } + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); + }; + function d3_scale_linear(domain, range, interpolate, clamp) { + var output, input; + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3_interpolate); + return scale; + } + function scale(x) { + return output(x); + } + scale.invert = function(y) { + return input(y); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3_interpolateRound); + }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + d3_scale_linearNice(domain, m); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); + } + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_scale_linearNice(domain, m) { + d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); + d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); + return domain; + } + function d3_scale_linearTickRange(domain, m) { + if (m == null) m = 10; + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m, format) { + var range = d3_scale_linearTickRange(domain, m); + if (format) { + var match = d3_format_re.exec(format); + match.shift(); + if (match[8] === "s") { + var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); + if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); + match[8] = "f"; + format = d3.format(match.join("")); + return function(d) { + return format(prefix.scale(d)) + prefix.symbol; + }; + } + if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); + format = match.join(""); + } else { + format = ",." + d3_scale_linearPrecision(range[2]) + "f"; + } + return d3.format(format); + } + var d3_scale_linearFormatSignificant = { + s: 1, + g: 1, + p: 1, + r: 1, + e: 1 + }; + function d3_scale_linearPrecision(value) { + return -Math.floor(Math.log(value) / Math.LN10 + .01); + } + function d3_scale_linearFormatPrecision(type, range) { + var p = d3_scale_linearPrecision(range[2]); + return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; + } + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); + }; + function d3_scale_log(linear, base, positive, domain) { + function log(x) { + return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); + } + function pow(x) { + return positive ? Math.pow(base, x) : -Math.pow(base, -x); + } + function scale(x) { + return linear(log(x)); + } + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + positive = x[0] >= 0; + linear.domain((domain = x.map(Number)).map(log)); + return scale; + }; + scale.base = function(_) { + if (!arguments.length) return base; + base = +_; + linear.domain(domain.map(log)); + return scale; + }; + scale.nice = function() { + var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); + linear.domain(niced); + domain = niced.map(pow); + return scale; + }; + scale.ticks = function() { + var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base; + if (isFinite(j - i)) { + if (positive) { + for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } else { + ticks.push(pow(i)); + for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); + } + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); + } + return ticks; + }; + scale.tickFormat = function(n, format) { + if (!arguments.length) return d3_scale_logFormat; + if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); + var k = Math.max(1, base * n / scale.ticks().length); + return function(d) { + var i = d / pow(Math.round(log(d))); + if (i * base < base - .5) i *= base; + return i <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), base, positive, domain); + }; + return d3_scale_linearRebind(scale, linear); + } + var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { + floor: function(x) { + return -Math.ceil(-x); + }, + ceil: function(x) { + return -Math.floor(-x); + } + }; + d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); + }; + function d3_scale_pow(linear, exponent, domain) { + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); + function scale(x) { + return linear(powp(x)); + } + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + linear.domain((domain = x.map(Number)).map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function(m) { + return scale.domain(d3_scale_linearNice(domain, m)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + linear.domain(domain.map(powp)); + return scale; + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent, domain); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; + } + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); + }; + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] + }); + }; + function d3_scale_ordinal(domain, ranger) { + var index, range, rangeBand; + function scale(x) { + return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map(); + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments + }; + return scale; + }; + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = (start + stop) / 2, + 0) : (stop - start) / (domain.length - 1 + padding); + range = steps(start + step * padding / 2, step); + rangeBand = 0; + ranger = { + t: "rangePoints", + a: arguments + }; + return scale; + }; + scale.rangeRoundPoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), + 0) : (stop - start) / (domain.length - 1 + padding) | 0; + range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step); + rangeBand = 0; + ranger = { + t: "rangeRoundPoints", + a: arguments + }; + return scale; + }; + scale.rangeBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); + range = steps(start + step * outerPadding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = { + t: "rangeBands", + a: arguments + }; + return scale; + }; + scale.rangeRoundBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)); + range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = { + t: "rangeRoundBands", + a: arguments + }; + return scale; + }; + scale.rangeBand = function() { + return rangeBand; + }; + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.a[0]); + }; + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + return scale.domain(domain); + } + d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); + }; + d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); + }; + d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); + }; + d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); + }; + var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString); + var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString); + var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString); + var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString); + d3.scale.quantile = function() { + return d3_scale_quantile([], []); + }; + function d3_scale_quantile(domain, range) { + var thresholds; + function rescale() { + var k = 0, q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + function scale(x) { + if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.quantiles = function() { + return thresholds; + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ]; + }; + scale.copy = function() { + return d3_scale_quantile(domain, range); + }; + return rescale(); + } + d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [ 0, 1 ]); + }; + function d3_scale_quantize(x0, x1, range) { + var kx, i; + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + y = y < 0 ? NaN : y / kx + x0; + return [ y, y + 1 / kx ]; + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); + }; + return rescale(); + } + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); + }; + function d3_scale_threshold(domain, range) { + function scale(x) { + if (x <= x) return range[d3.bisect(domain, x)]; + } + scale.domain = function(_) { + if (!arguments.length) return domain; + domain = _; + return scale; + }; + scale.range = function(_) { + if (!arguments.length) return range; + range = _; + return scale; + }; + scale.invertExtent = function(y) { + y = range.indexOf(y); + return [ domain[y - 1], domain[y] ]; + }; + scale.copy = function() { + return d3_scale_threshold(domain, range); + }; + return scale; + } + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); + }; + function d3_scale_identity(domain) { + function identity(x) { + return +x; + } + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + identity.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; + } + d3.svg = {}; + function d3_zero() { + return 0; + } + d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle; + function arc() { + var r0 = Math.max(0, +innerRadius.apply(this, arguments)), r1 = Math.max(0, +outerRadius.apply(this, arguments)), a0 = startAngle.apply(this, arguments) - halfฯ€, a1 = endAngle.apply(this, arguments) - halfฯ€, da = Math.abs(a1 - a0), cw = a0 > a1 ? 0 : 1; + if (r1 < r0) rc = r1, r1 = r0, r0 = rc; + if (da >= ฯ„ฮต) return circleSegment(r1, cw) + (r0 ? circleSegment(r0, 1 - cw) : "") + "Z"; + var rc, cr, rp, ap, p0 = 0, p1 = 0, x0, y0, x1, y1, x2, y2, x3, y3, path = []; + if (ap = (+padAngle.apply(this, arguments) || 0) / 2) { + rp = padRadius === d3_svg_arcAuto ? Math.sqrt(r0 * r0 + r1 * r1) : +padRadius.apply(this, arguments); + if (!cw) p1 *= -1; + if (r1) p1 = d3_asin(rp / r1 * Math.sin(ap)); + if (r0) p0 = d3_asin(rp / r0 * Math.sin(ap)); + } + if (r1) { + x0 = r1 * Math.cos(a0 + p1); + y0 = r1 * Math.sin(a0 + p1); + x1 = r1 * Math.cos(a1 - p1); + y1 = r1 * Math.sin(a1 - p1); + var l1 = Math.abs(a1 - a0 - 2 * p1) <= ฯ€ ? 0 : 1; + if (p1 && d3_svg_arcSweep(x0, y0, x1, y1) === cw ^ l1) { + var h1 = (a0 + a1) / 2; + x0 = r1 * Math.cos(h1); + y0 = r1 * Math.sin(h1); + x1 = y1 = null; + } + } else { + x0 = y0 = 0; + } + if (r0) { + x2 = r0 * Math.cos(a1 - p0); + y2 = r0 * Math.sin(a1 - p0); + x3 = r0 * Math.cos(a0 + p0); + y3 = r0 * Math.sin(a0 + p0); + var l0 = Math.abs(a0 - a1 + 2 * p0) <= ฯ€ ? 0 : 1; + if (p0 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l0) { + var h0 = (a0 + a1) / 2; + x2 = r0 * Math.cos(h0); + y2 = r0 * Math.sin(h0); + x3 = y3 = null; + } + } else { + x2 = y2 = 0; + } + if (da > ฮต && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) { + cr = r0 < r1 ^ cw ? 0 : 1; + var rc1 = rc, rc0 = rc; + if (da < ฯ€) { + var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); + rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); + } + if (x1 != null) { + var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw); + if (rc === rc1) { + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]); + } else { + path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr, " ", t12[0]); + } + } else { + path.push("M", x0, ",", y0); + } + if (x3 != null) { + var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw); + if (rc === rc0) { + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); + } else { + path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]); + } + } else { + path.push("L", x2, ",", y2); + } + } else { + path.push("M", x0, ",", y0); + if (x1 != null) path.push("A", r1, ",", r1, " 0 ", l1, ",", cw, " ", x1, ",", y1); + path.push("L", x2, ",", y2); + if (x3 != null) path.push("A", r0, ",", r0, " 0 ", l0, ",", 1 - cw, " ", x3, ",", y3); + } + path.push("Z"); + return path.join(""); + } + function circleSegment(r1, cw) { + return "M0," + r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + -r1 + "A" + r1 + "," + r1 + " 0 1," + cw + " 0," + r1; + } + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + arc.cornerRadius = function(v) { + if (!arguments.length) return cornerRadius; + cornerRadius = d3_functor(v); + return arc; + }; + arc.padRadius = function(v) { + if (!arguments.length) return padRadius; + padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : d3_functor(v); + return arc; + }; + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + arc.padAngle = function(v) { + if (!arguments.length) return padAngle; + padAngle = d3_functor(v); + return arc; + }; + arc.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - halfฯ€; + return [ Math.cos(a) * r, Math.sin(a) * r ]; + }; + return arc; + }; + var d3_svg_arcAuto = "auto"; + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; + } + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; + } + function d3_svg_arcStartAngle(d) { + return d.startAngle; + } + function d3_svg_arcEndAngle(d) { + return d.endAngle; + } + function d3_svg_arcPadAngle(d) { + return d && d.padAngle; + } + function d3_svg_arcSweep(x0, y0, x1, y1) { + return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1; + } + function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) { + var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ]; + } + function d3_svg_line(projection) { + var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + function line(data) { + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + function segment() { + segments.push("M", interpolate(projection(points), tension)); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); + } else if (points.length) { + segment(); + points = []; + } + } + if (points.length) segment(); + return segments.length ? segments.join("") : null; + } + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + line.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + return line; + }; + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + return line; + } + d3.svg.line = function() { + return d3_svg_line(d3_identity); + }; + var d3_svg_lineInterpolators = d3.map({ + linear: d3_svg_lineLinear, + "linear-closed": d3_svg_lineLinearClosed, + step: d3_svg_lineStep, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + basis: d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + bundle: d3_svg_lineBundle, + cardinal: d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + monotone: d3_svg_lineMonotone + }); + d3_svg_lineInterpolators.forEach(function(key, value) { + value.key = key; + value.closed = /-closed$/.test(key); + }); + function d3_svg_lineLinear(points) { + return points.length > 1 ? points.join("L") : points + "Z"; + } + function d3_svg_lineLinearClosed(points) { + return points.join("L") + "Z"; + } + function d3_svg_lineStep(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]); + if (n > 1) path.push("H", p[0]); + return path.join(""); + } + function d3_svg_lineStepBefore(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); + } + function d3_svg_lineStepAfter(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); + } + function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), + points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); + } + function d3_svg_lineCardinal(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { + return d3_svg_lineLinear(points); + } + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } + } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; + } + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); + } + return tangents; + } + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + points.push(points[n - 1]); + while (++i <= n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + points.pop(); + path.push("L", pi); + return path.join(""); + } + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); + } + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; + function d3_svg_lineBasisBezier(path, x, y) { + path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); + } + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; + } + m[i] = d; + return m; + } + function d3_svg_lineMonotoneTangents(points) { + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + if (abs(d) < ฮต) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + i = -1; + while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([ s || 0, m[i] * s || 0 ]); + } + return tangents; + } + function d3_svg_lineMonotone(points) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); + } + d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; + }; + function d3_svg_lineRadial(points) { + var point, i = -1, n = points.length, r, a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] - halfฯ€; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; + } + function d3_svg_area(projection) { + var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + function area(data) { + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; + } + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); + }; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; + } + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) - halfฯ€, a1 = endAngle.call(self, subgroup, i) - halfฯ€; + return { + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] + }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > ฯ€) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + return chord; + }; + function d3_svg_chordRadius(d) { + return d.radius; + } + d3.svg.diagonal = function() { + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + return diagonal; + }; + function d3_svg_diagonalProjection(d) { + return [ d.x, d.y ]; + } + d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; + diagonal.projection = function(x) { + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; + }; + return diagonal; + }; + function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), r = d[0], a = d[1] - halfฯ€; + return [ r * Math.cos(a), r * Math.sin(a) ]; + }; + } + d3.svg.symbol = function() { + var type = d3_svg_symbolType, size = d3_svg_symbolSize; + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); + } + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + return symbol; + }; + function d3_svg_symbolSize() { + return 64; + } + function d3_svg_symbolType() { + return "circle"; + } + function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / ฯ€); + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; + } + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); + d3_selectionPrototype.transition = function(name) { + var id = d3_transitionInheritId || ++d3_transitionId, ns = d3_transitionNamespace(name), subgroups = [], subgroup, node, transition = d3_transitionInherit || { + time: Date.now(), + ease: d3_ease_cubicInOut, + delay: 0, + duration: 250 + }; + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) d3_transitionNode(node, i, ns, id, transition); + subgroup.push(node); + } + } + return d3_transition(subgroups, ns, id); + }; + d3_selectionPrototype.interrupt = function(name) { + return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name))); + }; + var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace()); + function d3_selection_interruptNS(ns) { + return function() { + var lock, activeId, active; + if ((lock = this[ns]) && (active = lock[activeId = lock.active])) { + active.timer.c = null; + active.timer.t = NaN; + if (--lock.count) delete lock[activeId]; else delete this[ns]; + lock.active += .5; + active.event && active.event.interrupt.call(this, this.__data__, active.index); + } + }; + } + function d3_transition(groups, ns, id) { + d3_subclass(groups, d3_transitionPrototype); + groups.namespace = ns; + groups.id = id; + return groups; + } + var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; + d3_transitionPrototype.call = d3_selectionPrototype.call; + d3_transitionPrototype.empty = d3_selectionPrototype.empty; + d3_transitionPrototype.node = d3_selectionPrototype.node; + d3_transitionPrototype.size = d3_selectionPrototype.size; + d3.transition = function(selection, name) { + return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection); + }; + d3.transition.prototype = d3_transitionPrototype; + d3_transitionPrototype.select = function(selector) { + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnode, node; + selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + d3_transitionNode(subnode, i, ns, id, node[ns][id]); + subgroup.push(subnode); + } else { + subgroup.push(null); + } + } + } + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.selectAll = function(selector) { + var id = this.id, ns = this.namespace, subgroups = [], subgroup, subnodes, node, subnode, transition; + selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + transition = node[ns][id]; + subnodes = selector.call(node, node.__data__, i, j); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + if (subnode = subnodes[k]) d3_transitionNode(subnode, k, ns, id, transition); + subgroup.push(subnode); + } + } + } + } + return d3_transition(subgroups, ns, id); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { + subgroup.push(node); + } + } + } + return d3_transition(subgroups, this.namespace, this.id); + }; + d3_transitionPrototype.tween = function(name, tween) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) return this.node()[ns][id].tween.get(name); + return d3_selection_each(this, tween == null ? function(node) { + node[ns][id].tween.remove(name); + } : function(node) { + node[ns][id].tween.set(name, tween); + }); + }; + function d3_transition_tween(groups, name, value, tween) { + var id = groups.id, ns = groups.namespace; + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { + node[ns][id].tween.set(name, tween(value.call(node, node.__data__, i, j))); + } : (value = tween(value), function(node) { + node[ns][id].tween.set(name, value); + })); + } + d3_transitionPrototype.attr = function(nameNS, value) { + if (arguments.length < 2) { + for (value in nameNS) this.attr(value, nameNS[value]); + return this; + } + var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrTween(b) { + return b == null ? attrNull : (b += "", function() { + var a = this.getAttribute(name), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttribute(name, i(t)); + }); + }); + } + function attrTweenNS(b) { + return b == null ? attrNullNS : (b += "", function() { + var a = this.getAttributeNS(name.space, name.local), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttributeNS(name.space, name.local, i(t)); + }); + }); + } + return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f && function(t) { + this.setAttribute(name, f(t)); + }; + } + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f && function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.style(priority, name[priority], value); + return this; + } + priority = ""; + } + function styleNull() { + this.style.removeProperty(name); + } + function styleString(b) { + return b == null ? styleNull : (b += "", function() { + var a = d3_window(this).getComputedStyle(this, null).getPropertyValue(name), i; + return a !== b && (i = d3_interpolate(a, b), function(t) { + this.style.setProperty(name, i(t), priority); + }); + }); + } + return d3_transition_tween(this, "style." + name, value, styleString); + }; + d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + function styleTween(d, i) { + var f = tween.call(this, d, i, d3_window(this).getComputedStyle(this, null).getPropertyValue(name)); + return f && function(t) { + this.style.setProperty(name, f(t), priority); + }; + } + return this.tween("style." + name, styleTween); + }; + d3_transitionPrototype.text = function(value) { + return d3_transition_tween(this, "text", value, d3_transition_text); + }; + function d3_transition_text(b) { + if (b == null) b = ""; + return function() { + this.textContent = b; + }; + } + d3_transitionPrototype.remove = function() { + var ns = this.namespace; + return this.each("end.transition", function() { + var p; + if (this[ns].count < 2 && (p = this.parentNode)) p.removeChild(this); + }); + }; + d3_transitionPrototype.ease = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].ease; + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); + return d3_selection_each(this, function(node) { + node[ns][id].ease = value; + }); + }; + d3_transitionPrototype.delay = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].delay; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].delay = +value.call(node, node.__data__, i, j); + } : (value = +value, function(node) { + node[ns][id].delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + var id = this.id, ns = this.namespace; + if (arguments.length < 1) return this.node()[ns][id].duration; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node[ns][id].duration = Math.max(1, value.call(node, node.__data__, i, j)); + } : (value = Math.max(1, value), function(node) { + node[ns][id].duration = value; + })); + }; + d3_transitionPrototype.each = function(type, listener) { + var id = this.id, ns = this.namespace; + if (arguments.length < 2) { + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; + try { + d3_transitionInheritId = id; + d3_selection_each(this, function(node, i, j) { + d3_transitionInherit = node[ns][id]; + type.call(node, node.__data__, i, j); + }); + } finally { + d3_transitionInherit = inherit; + d3_transitionInheritId = inheritId; + } + } else { + d3_selection_each(this, function(node) { + var transition = node[ns][id]; + (transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener); + }); + } + return this; + }; + d3_transitionPrototype.transition = function() { + var id0 = this.id, id1 = ++d3_transitionId, ns = this.namespace, subgroups = [], subgroup, group, node, transition; + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + transition = node[ns][id0]; + d3_transitionNode(node, i, ns, id1, { + time: transition.time, + ease: transition.ease, + delay: transition.delay + transition.duration, + duration: transition.duration + }); + } + subgroup.push(node); + } + } + return d3_transition(subgroups, ns, id1); + }; + function d3_transitionNamespace(name) { + return name == null ? "__transition__" : "__transition_" + name + "__"; + } + function d3_transitionNode(node, i, ns, id, inherit) { + var lock = node[ns] || (node[ns] = { + active: 0, + count: 0 + }), transition = lock[id], time, timer, duration, ease, tweens; + function schedule(elapsed) { + var delay = transition.delay; + timer.t = delay + time; + if (delay <= elapsed) return start(elapsed - delay); + timer.c = start; + } + function start(elapsed) { + var activeId = lock.active, active = lock[activeId]; + if (active) { + active.timer.c = null; + active.timer.t = NaN; + --lock.count; + delete lock[activeId]; + active.event && active.event.interrupt.call(node, node.__data__, active.index); + } + for (var cancelId in lock) { + if (+cancelId < id) { + var cancel = lock[cancelId]; + cancel.timer.c = null; + cancel.timer.t = NaN; + --lock.count; + delete lock[cancelId]; + } + } + timer.c = tick; + d3_timer(function() { + if (timer.c && tick(elapsed || 1)) { + timer.c = null; + timer.t = NaN; + } + return 1; + }, 0, time); + lock.active = id; + transition.event && transition.event.start.call(node, node.__data__, i); + tweens = []; + transition.tween.forEach(function(key, value) { + if (value = value.call(node, node.__data__, i)) { + tweens.push(value); + } + }); + ease = transition.ease; + duration = transition.duration; + } + function tick(elapsed) { + var t = elapsed / duration, e = ease(t), n = tweens.length; + while (n > 0) { + tweens[--n].call(node, e); + } + if (t >= 1) { + transition.event && transition.event.end.call(node, node.__data__, i); + if (--lock.count) delete lock[id]; else delete node[ns]; + return 1; + } + } + if (!transition) { + time = inherit.time; + timer = d3_timer(schedule, 0, time); + transition = lock[id] = { + tween: new d3_Map(), + time: time, + timer: timer, + delay: inherit.delay, + duration: inherit.duration, + ease: inherit.ease, + index: i + }; + inherit = null; + ++lock.count; + } + } + d3.svg.axis = function() { + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; + function axis(g) { + g.each(function() { + var g = d3.select(this); + var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); + var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ฮต), tickExit = d3.transition(tick.exit()).style("opacity", ฮต).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; + var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), + d3.transition(path)); + tickEnter.append("line"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2; + if (orient === "bottom" || orient === "top") { + tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2"; + text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize); + } else { + tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2"; + text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start"); + pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize); + } + lineEnter.attr(y2, sign * innerTickSize); + textEnter.attr(y1, sign * tickSpacing); + lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); + textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing); + if (scale1.rangeBand) { + var x = scale1, dx = x.rangeBand() / 2; + scale0 = scale1 = function(d) { + return x(d) + dx; + }; + } else if (scale0.rangeBand) { + scale0 = scale1; + } else { + tickExit.call(tickTransform, scale1, scale0); + } + tickEnter.call(tickTransform, scale0, scale1); + tickUpdate.call(tickTransform, scale1, scale1); + }); + } + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; + return axis; + }; + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = d3_array(arguments); + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + axis.tickSize = function(x) { + var n = arguments.length; + if (!n) return innerTickSize; + innerTickSize = +x; + outerTickSize = +arguments[n - 1]; + return axis; + }; + axis.innerTickSize = function(x) { + if (!arguments.length) return innerTickSize; + innerTickSize = +x; + return axis; + }; + axis.outerTickSize = function(x) { + if (!arguments.length) return outerTickSize; + outerTickSize = +x; + return axis; + }; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + axis.tickSubdivide = function() { + return arguments.length && axis; + }; + return axis; + }; + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { + top: 1, + right: 1, + bottom: 1, + left: 1 + }; + function d3_svg_axisX(selection, x0, x1) { + selection.attr("transform", function(d) { + var v0 = x0(d); + return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)"; + }); + } + function d3_svg_axisY(selection, y0, y1) { + selection.attr("transform", function(d) { + var v0 = y0(d); + return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")"; + }); + } + d3.svg.brush = function() { + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0]; + function brush(g) { + g.each(function() { + var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + var background = g.selectAll(".background").data([ 0 ]); + background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); + var resize = g.selectAll(".resize").data(resizes, d3_identity); + resize.exit().remove(); + resize.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + resize.style("display", brush.empty() ? "none" : null); + var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; + if (x) { + range = d3_scaleRange(x); + backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); + redrawX(gUpdate); + } + if (y) { + range = d3_scaleRange(y); + backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); + redrawY(gUpdate); + } + redraw(gUpdate); + }); + } + brush.event = function(g) { + g.each(function() { + var event_ = event.of(this, arguments), extent1 = { + x: xExtent, + y: yExtent, + i: xExtentDomain, + j: yExtentDomain + }, extent0 = this.__chart__ || extent1; + this.__chart__ = extent1; + if (d3_transitionInheritId) { + d3.select(this).transition().each("start.brush", function() { + xExtentDomain = extent0.i; + yExtentDomain = extent0.j; + xExtent = extent0.x; + yExtent = extent0.y; + event_({ + type: "brushstart" + }); + }).tween("brush:brush", function() { + var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); + xExtentDomain = yExtentDomain = null; + return function(t) { + xExtent = extent1.x = xi(t); + yExtent = extent1.y = yi(t); + event_({ + type: "brush", + mode: "resize" + }); + }; + }).each("end.brush", function() { + xExtentDomain = extent1.i; + yExtentDomain = extent1.j; + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + }); + } else { + event_({ + type: "brushstart" + }); + event_({ + type: "brush", + mode: "resize" + }); + event_({ + type: "brushend" + }); + } + }); + }; + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; + }); + } + function redrawX(g) { + g.select(".extent").attr("x", xExtent[0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); + } + function redrawY(g) { + g.select(".extent").attr("y", yExtent[0]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); + } + function brushstart() { + var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(target), center, origin = d3.mouse(target), offset; + var w = d3.select(d3_window(target)).on("keydown.brush", keydown).on("keyup.brush", keyup); + if (d3.event.changedTouches) { + w.on("touchmove.brush", brushmove).on("touchend.brush", brushend); + } else { + w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); + } + g.interrupt().selectAll("*").interrupt(); + if (dragging) { + origin[0] = xExtent[0] - origin[0]; + origin[1] = yExtent[0] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; + origin[0] = xExtent[ex]; + origin[1] = yExtent[ey]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= xExtent[1]; + origin[1] -= yExtent[1]; + dragging = 2; + } + d3_eventPreventDefault(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += xExtent[1]; + origin[1] += yExtent[1]; + dragging = 0; + d3_eventPreventDefault(); + } + } + function brushmove() { + var point = d3.mouse(target), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; + origin[0] = xExtent[+(point[0] < center[0])]; + origin[1] = yExtent[+(point[1] < center[1])]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0] != min || extent[1] != max) { + if (i) yExtentDomain = null; else xExtentDomain = null; + extent[0] = min; + extent[1] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + dragRestore(); + event_({ + type: "brushend" + }); + } + } + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.clamp = function(z) { + if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; + if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; + return brush; + }; + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + if (x) { + if (xExtentDomain) { + x0 = xExtentDomain[0], x1 = xExtentDomain[1]; + } else { + x0 = xExtent[0], x1 = xExtent[1]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + if (yExtentDomain) { + y0 = yExtentDomain[0], y1 = yExtentDomain[1]; + } else { + y0 = yExtent[0], y1 = yExtent[1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; + } + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + xExtentDomain = [ x0, x1 ]; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + yExtentDomain = [ y0, y1 ]; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; + } + return brush; + }; + brush.clear = function() { + if (!brush.empty()) { + xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; + xExtentDomain = yExtentDomain = null; + } + return brush; + }; + brush.empty = function() { + return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; + }; + return d3.rebind(brush, event, "on"); + }; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; + var d3_time_formatUtc = d3_time_format.utc; + var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; + function d3_time_formatIsoNative(date) { + return date.toISOString(); + } + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + }; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3_time.second = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3_time.seconds = d3_time.second.range; + d3_time.seconds.utc = d3_time.second.utc.range; + d3_time.minute = d3_time_interval(function(date) { + return new d3_date(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3_time.minutes = d3_time.minute.range; + d3_time.minutes.utc = d3_time.minute.utc.range; + d3_time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3_time.hours = d3_time.hour.range; + d3_time.hours.utc = d3_time.hour.utc.range; + d3_time.month = d3_time_interval(function(date) { + date = d3_time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3_time.months = d3_time.month.range; + d3_time.months.utc = d3_time.month.utc.range; + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); + } + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + function tickMethod(extent, count) { + var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); + return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { + return d / 31536e6; + }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i]; + } + scale.nice = function(interval, skip) { + var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); + if (method) interval = method[0], skip = method[1]; + function skipped(date) { + return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; + } + return scale.domain(d3_scale_nice(domain, skip > 1 ? { + floor: function(date) { + while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); + return date; + }, + ceil: function(date) { + while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); + return date; + } + } : interval)); + }; + scale.ticks = function(interval, skip) { + var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { + range: interval + }, skip ]; + if (method) interval = method[0], skip = method[1]; + return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_time_scaleDate(t) { + return new Date(t); + } + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ]; + var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { + return d.getMilliseconds(); + } ], [ ":%S", function(d) { + return d.getSeconds(); + } ], [ "%I:%M", function(d) { + return d.getMinutes(); + } ], [ "%I %p", function(d) { + return d.getHours(); + } ], [ "%a %d", function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ "%b %d", function(d) { + return d.getDate() != 1; + } ], [ "%B", function(d) { + return d.getMonth(); + } ], [ "%Y", d3_true ] ]); + var d3_time_scaleMilliseconds = { + range: function(start, stop, step) { + return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); + }, + floor: d3_identity, + ceil: d3_identity + }; + d3_time_scaleLocalMethods.year = d3_time.year; + d3_time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { + return d.getUTCMilliseconds(); + } ], [ ":%S", function(d) { + return d.getUTCSeconds(); + } ], [ "%I:%M", function(d) { + return d.getUTCMinutes(); + } ], [ "%I %p", function(d) { + return d.getUTCHours(); + } ], [ "%a %d", function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ "%b %d", function(d) { + return d.getUTCDate() != 1; + } ], [ "%B", function(d) { + return d.getUTCMonth(); + } ], [ "%Y", d3_true ] ]); + d3_time_scaleUtcMethods.year = d3_time.year.utc; + d3_time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); + }; + d3.text = d3_xhrType(function(request) { + return request.responseText; + }); + d3.json = function(url, callback) { + return d3_xhr(url, "application/json", d3_json, callback); + }; + function d3_json(request) { + return JSON.parse(request.responseText); + } + d3.html = function(url, callback) { + return d3_xhr(url, "text/html", d3_html, callback); + }; + function d3_html(request) { + var range = d3_document.createRange(); + range.selectNode(d3_document.body); + return range.createContextualFragment(request.responseText); + } + d3.xml = d3_xhrType(function(request) { + return request.responseXML; + }); + if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; +}(); +var base, base1, base2, base3; + +if (window.Epoch == null) { + window.Epoch = {}; +} + +if ((base = window.Epoch).Chart == null) { + base.Chart = {}; +} + +if ((base1 = window.Epoch).Time == null) { + base1.Time = {}; +} + +if ((base2 = window.Epoch).Util == null) { + base2.Util = {}; +} + +if ((base3 = window.Epoch).Formats == null) { + base3.Formats = {}; +} + +Epoch.warn = function(msg) { + return (console.warn || console.log)("Epoch Warning: " + msg); +}; + +Epoch.exception = function(msg) { + throw "Epoch Error: " + msg; +}; + +Epoch.TestContext = (function() { + var VOID_METHODS; + + VOID_METHODS = ['arc', 'arcTo', 'beginPath', 'bezierCurveTo', 'clearRect', 'clip', 'closePath', 'drawImage', 'fill', 'fillRect', 'fillText', 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'scrollPathIntoView', 'setLineDash', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate', 'lineTo']; + + function TestContext() { + var i, len, method; + this._log = []; + for (i = 0, len = VOID_METHODS.length; i < len; i++) { + method = VOID_METHODS[i]; + this._makeFauxMethod(method); + } + } + + TestContext.prototype._makeFauxMethod = function(name) { + return this[name] = function() { + var arg; + return this._log.push(name + "(" + (((function() { + var i, len, results; + results = []; + for (i = 0, len = arguments.length; i < len; i++) { + arg = arguments[i]; + results.push(arg.toString()); + } + return results; + }).apply(this, arguments)).join(',')) + ")"); + }; + }; + + TestContext.prototype.getImageData = function() { + var arg; + this._log.push("getImageData(" + (((function() { + var i, len, results; + results = []; + for (i = 0, len = arguments.length; i < len; i++) { + arg = arguments[i]; + results.push(arg.toString()); + } + return results; + }).apply(this, arguments)).join(',')) + ")"); + return { + width: 0, + height: 0, + resolution: 1.0, + data: [] + }; + }; + + return TestContext; + +})(); + +var ref, typeFunction, + hasProp = {}.hasOwnProperty; + +typeFunction = function(objectName) { + return function(v) { + return Object.prototype.toString.call(v) === ("[object " + objectName + "]"); + }; +}; + +Epoch.isArray = (ref = Array.isArray) != null ? ref : typeFunction('Array'); + +Epoch.isObject = typeFunction('Object'); + +Epoch.isString = typeFunction('String'); + +Epoch.isFunction = typeFunction('Function'); + +Epoch.isNumber = typeFunction('Number'); + +Epoch.isElement = function(v) { + if (typeof HTMLElement !== "undefined" && HTMLElement !== null) { + return v instanceof HTMLElement; + } else { + return (v != null) && Epoch.isObject(v) && v.nodeType === 1 && Epoch.isString(v.nodeName); + } +}; + +Epoch.isNonEmptyArray = function(v) { + return Epoch.isArray(v) && v.length > 0; +}; + +Epoch.Util.copy = function(original) { + var copy, k, v; + if (original == null) { + return null; + } + copy = {}; + for (k in original) { + if (!hasProp.call(original, k)) continue; + v = original[k]; + copy[k] = v; + } + return copy; +}; + +Epoch.Util.defaults = function(options, defaults) { + var bothAreObjects, def, k, opt, result, v; + result = Epoch.Util.copy(options); + for (k in defaults) { + if (!hasProp.call(defaults, k)) continue; + v = defaults[k]; + opt = options[k]; + def = defaults[k]; + bothAreObjects = Epoch.isObject(opt) && Epoch.isObject(def); + if ((opt != null) && (def != null)) { + if (bothAreObjects && !Epoch.isArray(opt)) { + result[k] = Epoch.Util.defaults(opt, def); + } else { + result[k] = opt; + } + } else if (opt != null) { + result[k] = opt; + } else { + result[k] = def; + } + } + return result; +}; + +Epoch.Util.formatSI = function(v, fixed, fixIntegers) { + var base, i, label, q, ref1; + if (fixed == null) { + fixed = 1; + } + if (fixIntegers == null) { + fixIntegers = false; + } + if (v < 1000) { + q = v; + if (!((q | 0) === q && !fixIntegers)) { + q = q.toFixed(fixed); + } + return q; + } + ref1 = ['K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + for (i in ref1) { + if (!hasProp.call(ref1, i)) continue; + label = ref1[i]; + base = Math.pow(10, ((i | 0) + 1) * 3); + if (v >= base && v < Math.pow(10, ((i | 0) + 2) * 3)) { + q = v / base; + if (!((q % 1) === 0 && !fixIntegers)) { + q = q.toFixed(fixed); + } + return q + " " + label; + } + } +}; + +Epoch.Util.formatBytes = function(v, fixed, fix_integers) { + var base, i, label, q, ref1; + if (fixed == null) { + fixed = 1; + } + if (fix_integers == null) { + fix_integers = false; + } + if (v < 1024) { + q = v; + if (!((q % 1) === 0 && !fix_integers)) { + q = q.toFixed(fixed); + } + return q + " B"; + } + ref1 = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + for (i in ref1) { + if (!hasProp.call(ref1, i)) continue; + label = ref1[i]; + base = Math.pow(1024, (i | 0) + 1); + if (v >= base && v < Math.pow(1024, (i | 0) + 2)) { + q = v / base; + if (!((q % 1) === 0 && !fix_integers)) { + q = q.toFixed(fixed); + } + return q + " " + label; + } + } +}; + +Epoch.Util.dasherize = function(str) { + return Epoch.Util.trim(str).replace("\n", '').replace(/\s+/g, '-').toLowerCase(); +}; + +Epoch.Util.domain = function(layers, key) { + var domain, entry, j, l, layer, len, len1, ref1, set; + if (key == null) { + key = 'x'; + } + set = {}; + domain = []; + for (j = 0, len = layers.length; j < len; j++) { + layer = layers[j]; + ref1 = layer.values; + for (l = 0, len1 = ref1.length; l < len1; l++) { + entry = ref1[l]; + if (set[entry[key]] != null) { + continue; + } + domain.push(entry[key]); + set[entry[key]] = true; + } + } + return domain; +}; + +Epoch.Util.trim = function(string) { + if (!Epoch.isString(string)) { + return null; + } + return string.replace(/^\s+/g, '').replace(/\s+$/g, ''); +}; + +Epoch.Util.getComputedStyle = function(element, pseudoElement) { + if (Epoch.isFunction(window.getComputedStyle)) { + return window.getComputedStyle(element, pseudoElement); + } else if (element.currentStyle != null) { + return element.currentStyle; + } +}; + +Epoch.Util.toRGBA = function(color, opacity) { + var all, b, g, parts, r, result, v; + if ((parts = color.match(/^rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*[0-9\.]+\)/))) { + all = parts[0], r = parts[1], g = parts[2], b = parts[3]; + result = "rgba(" + r + "," + g + "," + b + "," + opacity + ")"; + } else if ((v = d3.rgb(color))) { + result = "rgba(" + v.r + "," + v.g + "," + v.b + "," + opacity + ")"; + } + return result; +}; + +Epoch.Util.getContext = function(node, type) { + if (type == null) { + type = '2d'; + } + return node.getContext(type); +}; + +Epoch.Events = (function() { + function Events() { + this._events = {}; + } + + Events.prototype.on = function(name, callback) { + var base1; + if (callback == null) { + return; + } + if ((base1 = this._events)[name] == null) { + base1[name] = []; + } + return this._events[name].push(callback); + }; + + Events.prototype.onAll = function(map) { + var callback, name, results; + if (!Epoch.isObject(map)) { + return; + } + results = []; + for (name in map) { + if (!hasProp.call(map, name)) continue; + callback = map[name]; + results.push(this.on(name, callback)); + } + return results; + }; + + Events.prototype.off = function(name, callback) { + var i, results; + if (!Epoch.isArray(this._events[name])) { + return; + } + if (callback == null) { + return delete this._events[name]; + } + results = []; + while ((i = this._events[name].indexOf(callback)) >= 0) { + results.push(this._events[name].splice(i, 1)); + } + return results; + }; + + Events.prototype.offAll = function(mapOrList) { + var callback, j, len, name, results, results1; + if (Epoch.isArray(mapOrList)) { + results = []; + for (j = 0, len = mapOrList.length; j < len; j++) { + name = mapOrList[j]; + results.push(this.off(name)); + } + return results; + } else if (Epoch.isObject(mapOrList)) { + results1 = []; + for (name in mapOrList) { + if (!hasProp.call(mapOrList, name)) continue; + callback = mapOrList[name]; + results1.push(this.off(name, callback)); + } + return results1; + } + }; + + Events.prototype.trigger = function(name) { + var args, callback, fn, i, j, len, ref1, results; + if (this._events[name] == null) { + return; + } + args = (function() { + var j, ref1, results; + results = []; + for (i = j = 1, ref1 = arguments.length; 1 <= ref1 ? j < ref1 : j > ref1; i = 1 <= ref1 ? ++j : --j) { + results.push(arguments[i]); + } + return results; + }).apply(this, arguments); + ref1 = this._events[name]; + results = []; + for (j = 0, len = ref1.length; j < len; j++) { + callback = ref1[j]; + fn = null; + if (Epoch.isString(callback)) { + fn = this[callback]; + } else if (Epoch.isFunction(callback)) { + fn = callback; + } + if (fn == null) { + Epoch.exception("Callback for event '" + name + "' is not a function or reference to a method."); + } + results.push(fn.apply(this, args)); + } + return results; + }; + + return Events; + +})(); + +Epoch.Util.flatten = function(multiarray) { + var array, item, j, l, len, len1, result; + if (!Array.isArray(multiarray)) { + throw new Error('Epoch.Util.flatten only accepts arrays'); + } + result = []; + for (j = 0, len = multiarray.length; j < len; j++) { + array = multiarray[j]; + if (Array.isArray(array)) { + for (l = 0, len1 = array.length; l < len1; l++) { + item = array[l]; + result.push(item); + } + } else { + result.push(array); + } + } + return result; +}; + +d3.selection.prototype.width = function(value) { + if ((value != null) && Epoch.isString(value)) { + return this.style('width', value); + } else if ((value != null) && Epoch.isNumber(value)) { + return this.style('width', value + "px"); + } else { + return +Epoch.Util.getComputedStyle(this.node(), null).width.replace('px', ''); + } +}; + +d3.selection.prototype.height = function(value) { + if ((value != null) && Epoch.isString(value)) { + return this.style('height', value); + } else if ((value != null) && Epoch.isNumber(value)) { + return this.style('height', value + "px"); + } else { + return +Epoch.Util.getComputedStyle(this.node(), null).height.replace('px', ''); + } +}; + +var d3Seconds; + +Epoch.Formats.regular = function(d) { + return d; +}; + +Epoch.Formats.si = function(d) { + return Epoch.Util.formatSI(d); +}; + +Epoch.Formats.percent = function(d) { + return (d * 100).toFixed(1) + "%"; +}; + +Epoch.Formats.seconds = function(t) { + return d3Seconds(new Date(t * 1000)); +}; + +d3Seconds = d3.time.format('%I:%M:%S %p'); + +Epoch.Formats.bytes = function(d) { + return Epoch.Util.formatBytes(d); +}; + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Base = (function(superClass) { + var defaults, optionListeners; + + extend(Base, superClass); + + defaults = { + width: 320, + height: 240, + dataFormat: null + }; + + optionListeners = { + 'option:width': 'dimensionsChanged', + 'option:height': 'dimensionsChanged', + 'layer:shown': 'layerChanged', + 'layer:hidden': 'layerChanged' + }; + + function Base(options1) { + this.options = options1 != null ? options1 : {}; + Base.__super__.constructor.call(this); + if (this.options.model) { + if (this.options.model.hasData() != null) { + this.setData(this.options.model.getData(this.options.type, this.options.dataFormat)); + } else { + this.setData(this.options.data || []); + } + this.options.model.on('data:updated', (function(_this) { + return function() { + return _this.setDataFromModel(); + }; + })(this)); + } else { + this.setData(this.options.data || []); + } + if (this.options.el != null) { + this.el = d3.select(this.options.el); + } + this.width = this.options.width; + this.height = this.options.height; + if (this.el != null) { + if (this.width == null) { + this.width = this.el.width(); + } + if (this.height == null) { + this.height = this.el.height(); + } + } else { + if (this.width == null) { + this.width = defaults.width; + } + if (this.height == null) { + this.height = defaults.height; + } + this.el = d3.select(document.createElement('DIV')).attr('width', this.width).attr('height', this.height); + } + this.onAll(optionListeners); + } + + Base.prototype._getAllOptions = function() { + return Epoch.Util.defaults({}, this.options); + }; + + Base.prototype._getOption = function(key) { + var parts, scope, subkey; + parts = key.split('.'); + scope = this.options; + while (parts.length && (scope != null)) { + subkey = parts.shift(); + scope = scope[subkey]; + } + return scope; + }; + + Base.prototype._setOption = function(key, value) { + var parts, scope, subkey; + parts = key.split('.'); + scope = this.options; + while (parts.length) { + subkey = parts.shift(); + if (parts.length === 0) { + scope[subkey] = arguments[1]; + this.trigger("option:" + arguments[0]); + return; + } + if (scope[subkey] == null) { + scope[subkey] = {}; + } + scope = scope[subkey]; + } + }; + + Base.prototype._setManyOptions = function(options, prefix) { + var key, results, value; + if (prefix == null) { + prefix = ''; + } + results = []; + for (key in options) { + if (!hasProp.call(options, key)) continue; + value = options[key]; + if (Epoch.isObject(value)) { + results.push(this._setManyOptions(value, (prefix + key) + ".")); + } else { + results.push(this._setOption(prefix + key, value)); + } + } + return results; + }; + + Base.prototype.option = function() { + if (arguments.length === 0) { + return this._getAllOptions(); + } else if (arguments.length === 1 && Epoch.isString(arguments[0])) { + return this._getOption(arguments[0]); + } else if (arguments.length === 2 && Epoch.isString(arguments[0])) { + return this._setOption(arguments[0], arguments[1]); + } else if (arguments.length === 1 && Epoch.isObject(arguments[0])) { + return this._setManyOptions(arguments[0]); + } + }; + + Base.prototype.setDataFromModel = function() { + var prepared; + prepared = this._prepareData(this.options.model.getData(this.options.type, this.options.dataFormat)); + this.data = this._annotateLayers(prepared); + return this.draw(); + }; + + Base.prototype.setData = function(data, options) { + var prepared; + if (options == null) { + options = {}; + } + prepared = this._prepareData((this.rawData = this._formatData(data))); + return this.data = this._annotateLayers(prepared); + }; + + Base.prototype._prepareData = function(data) { + return data; + }; + + Base.prototype._formatData = function(data) { + return Epoch.Data.formatData(data, this.options.type, this.options.dataFormat); + }; + + Base.prototype._annotateLayers = function(data) { + var category, classes, i, layer, len; + category = 1; + for (i = 0, len = data.length; i < len; i++) { + layer = data[i]; + classes = ['layer']; + classes.push("category" + category); + layer.category = category; + layer.visible = true; + if (layer.label != null) { + classes.push(Epoch.Util.dasherize(layer.label)); + } + layer.className = classes.join(' '); + category++; + } + return data; + }; + + Base.prototype._findLayer = function(labelOrIndex) { + var i, index, l, layer, len, ref; + layer = null; + if (Epoch.isString(labelOrIndex)) { + ref = this.data; + for (i = 0, len = ref.length; i < len; i++) { + l = ref[i]; + if (l.label === labelOrIndex) { + layer = l; + break; + } + } + } else if (Epoch.isNumber(labelOrIndex)) { + index = parseInt(labelOrIndex); + if (!(index < 0 || index >= this.data.length)) { + layer = this.data[index]; + } + } + return layer; + }; + + Base.prototype.showLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + if (layer.visible) { + return; + } + layer.visible = true; + return this.trigger('layer:shown'); + }; + + Base.prototype.hideLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + if (!layer.visible) { + return; + } + layer.visible = false; + return this.trigger('layer:hidden'); + }; + + Base.prototype.toggleLayer = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return; + } + layer.visible = !layer.visible; + if (layer.visible) { + return this.trigger('layer:shown'); + } else { + return this.trigger('layer:hidden'); + } + }; + + Base.prototype.isLayerVisible = function(labelOrIndex) { + var layer; + if (!(layer = this._findLayer(labelOrIndex))) { + return null; + } + return layer.visible; + }; + + Base.prototype.getVisibleLayers = function() { + return this.data.filter(function(layer) { + return layer.visible; + }); + }; + + Base.prototype.update = function(data, draw) { + if (draw == null) { + draw = true; + } + this.setData(data); + if (draw) { + return this.draw(); + } + }; + + Base.prototype.draw = function() { + return this.trigger('draw'); + }; + + Base.prototype._getScaleDomain = function(givenDomain) { + var layers, maxFn, minFn, values; + if (Array.isArray(givenDomain)) { + return givenDomain; + } + if (Epoch.isString(givenDomain)) { + layers = this.getVisibleLayers().filter(function(l) { + return l.range === givenDomain; + }).map(function(l) { + return l.values; + }); + if ((layers != null) && layers.length) { + values = Epoch.Util.flatten(layers).map(function(d) { + return d.y; + }); + minFn = function(memo, curr) { + if (curr < memo) { + return curr; + } else { + return memo; + } + }; + maxFn = function(memo, curr) { + if (curr > memo) { + return curr; + } else { + return memo; + } + }; + return [values.reduce(minFn, values[0]), values.reduce(maxFn, values[0])]; + } + } + if (Array.isArray(this.options.range)) { + return this.options.range; + } else if (this.options.range && Array.isArray(this.options.range.left)) { + return this.options.range.left; + } else if (this.options.range && Array.isArray(this.options.range.right)) { + return this.options.range.right; + } else { + return this.extent(function(d) { + return d.y; + }); + } + }; + + Base.prototype.extent = function(cmp) { + return [ + d3.min(this.getVisibleLayers(), function(layer) { + return d3.min(layer.values, cmp); + }), d3.max(this.getVisibleLayers(), function(layer) { + return d3.max(layer.values, cmp); + }) + ]; + }; + + Base.prototype.dimensionsChanged = function() { + this.width = this.option('width') || this.width; + this.height = this.option('height') || this.height; + this.el.width(this.width); + return this.el.height(this.height); + }; + + Base.prototype.layerChanged = function() { + return this.draw(); + }; + + return Base; + +})(Epoch.Events); + +Epoch.Chart.SVG = (function(superClass) { + extend(SVG, superClass); + + function SVG(options1) { + this.options = options1 != null ? options1 : {}; + SVG.__super__.constructor.call(this, this.options); + if (this.el != null) { + this.svg = this.el.append('svg'); + } else { + this.svg = d3.select(document.createElement('svg')); + } + this.svg.attr({ + xmlns: 'http://www.w3.org/2000/svg', + width: this.width, + height: this.height + }); + } + + SVG.prototype.dimensionsChanged = function() { + SVG.__super__.dimensionsChanged.call(this); + return this.svg.attr('width', this.width).attr('height', this.height); + }; + + return SVG; + +})(Epoch.Chart.Base); + +Epoch.Chart.Canvas = (function(superClass) { + extend(Canvas, superClass); + + function Canvas(options1) { + this.options = options1 != null ? options1 : {}; + Canvas.__super__.constructor.call(this, this.options); + if (this.options.pixelRatio != null) { + this.pixelRatio = this.options.pixelRatio; + } else if (window.devicePixelRatio != null) { + this.pixelRatio = window.devicePixelRatio; + } else { + this.pixelRatio = 1; + } + this.canvas = d3.select(document.createElement('CANVAS')); + this.canvas.style({ + 'width': this.width + "px", + 'height': this.height + "px" + }); + this.canvas.attr({ + width: this.getWidth(), + height: this.getHeight() + }); + if (this.el != null) { + this.el.node().appendChild(this.canvas.node()); + } + this.ctx = Epoch.Util.getContext(this.canvas.node()); + } + + Canvas.prototype.getWidth = function() { + return this.width * this.pixelRatio; + }; + + Canvas.prototype.getHeight = function() { + return this.height * this.pixelRatio; + }; + + Canvas.prototype.clear = function() { + return this.ctx.clearRect(0, 0, this.getWidth(), this.getHeight()); + }; + + Canvas.prototype.getStyles = function(selector) { + return Epoch.QueryCSS.getStyles(selector, this.el); + }; + + Canvas.prototype.dimensionsChanged = function() { + Canvas.__super__.dimensionsChanged.call(this); + this.canvas.style({ + 'width': this.width + "px", + 'height': this.height + "px" + }); + return this.canvas.attr({ + width: this.getWidth(), + height: this.getHeight() + }); + }; + + Canvas.prototype.redraw = function() { + Epoch.QueryCSS.purge(); + return this.draw(); + }; + + return Canvas; + +})(Epoch.Chart.Base); + +var QueryCSS; + +QueryCSS = (function() { + var CONTAINER_HASH_ATTR, PUT_EXPR, REFERENCE_CONTAINER_ID, containerCount, logging, nextContainerId, put; + + function QueryCSS() {} + + REFERENCE_CONTAINER_ID = '_canvas_css_reference'; + + CONTAINER_HASH_ATTR = 'data-epoch-container-id'; + + containerCount = 0; + + nextContainerId = function() { + return "epoch-container-" + (containerCount++); + }; + + PUT_EXPR = /^([^#. ]+)?(#[^. ]+)?(\.[^# ]+)?$/; + + logging = false; + + put = function(selector) { + var classNames, element, id, match, tag, whole; + match = selector.match(PUT_EXPR); + if (match == null) { + return Epoch.error('Query CSS cannot match given selector: ' + selector); + } + whole = match[0], tag = match[1], id = match[2], classNames = match[3]; + tag = (tag != null ? tag : 'div').toUpperCase(); + element = document.createElement(tag); + if (id != null) { + element.id = id.substr(1); + } + if (classNames != null) { + element.className = classNames.substr(1).replace(/\./g, ' '); + } + return element; + }; + + QueryCSS.log = function(b) { + return logging = b; + }; + + QueryCSS.cache = {}; + + QueryCSS.styleList = ['fill', 'stroke', 'stroke-width']; + + QueryCSS.container = null; + + QueryCSS.purge = function() { + return QueryCSS.cache = {}; + }; + + QueryCSS.getContainer = function() { + var container; + if (QueryCSS.container != null) { + return QueryCSS.container; + } + container = document.createElement('DIV'); + container.id = REFERENCE_CONTAINER_ID; + document.body.appendChild(container); + return QueryCSS.container = d3.select(container); + }; + + QueryCSS.hash = function(selector, container) { + var containerId; + containerId = container.attr(CONTAINER_HASH_ATTR); + if (containerId == null) { + containerId = nextContainerId(); + container.attr(CONTAINER_HASH_ATTR, containerId); + } + return containerId + "__" + selector; + }; + + QueryCSS.getStyles = function(selector, container) { + var cache, cacheKey, el, element, i, j, k, len, len1, len2, name, parent, parentNode, parents, ref, ref1, ref2, root, sel, selectorList, styles, subSelector; + cacheKey = QueryCSS.hash(selector, container); + cache = QueryCSS.cache[cacheKey]; + if (cache != null) { + return cache; + } + parents = []; + parentNode = container.node().parentNode; + while ((parentNode != null) && parentNode.nodeName.toLowerCase() !== 'body') { + parents.unshift(parentNode); + parentNode = parentNode.parentNode; + } + parents.push(container.node()); + selectorList = []; + for (i = 0, len = parents.length; i < len; i++) { + element = parents[i]; + sel = element.nodeName.toLowerCase(); + if ((element.id != null) && element.id.length > 0) { + sel += '#' + element.id; + } + if ((element.className != null) && element.className.length > 0) { + sel += '.' + Epoch.Util.trim(element.className).replace(/\s+/g, '.'); + } + selectorList.push(sel); + } + selectorList.push('svg'); + ref1 = Epoch.Util.trim(selector).split(/\s+/); + for (j = 0, len1 = ref1.length; j < len1; j++) { + subSelector = ref1[j]; + selectorList.push(subSelector); + } + if (logging) { + console.log(selectorList); + } + parent = root = put(selectorList.shift()); + while (selectorList.length) { + el = put(selectorList.shift()); + parent.appendChild(el); + parent = el; + } + if (logging) { + console.log(root); + } + QueryCSS.getContainer().node().appendChild(root); + ref = d3.select('#' + REFERENCE_CONTAINER_ID + ' ' + selector); + styles = {}; + ref2 = QueryCSS.styleList; + for (k = 0, len2 = ref2.length; k < len2; k++) { + name = ref2[k]; + styles[name] = ref.style(name); + } + QueryCSS.cache[cacheKey] = styles; + QueryCSS.getContainer().html(''); + return styles; + }; + + return QueryCSS; + +})(); + +Epoch.QueryCSS = QueryCSS; + +var applyLayerLabel, base, + hasProp = {}.hasOwnProperty, + slice = [].slice; + +if (Epoch.Data == null) { + Epoch.Data = {}; +} + +if ((base = Epoch.Data).Format == null) { + base.Format = {}; +} + +applyLayerLabel = function(layer, options, i, keys) { + var autoLabels, keyLabels, label, labels, ref; + if (keys == null) { + keys = []; + } + ref = [options.labels, options.autoLabels, options.keyLabels], labels = ref[0], autoLabels = ref[1], keyLabels = ref[2]; + if ((labels != null) && Epoch.isArray(labels) && labels.length > i) { + layer.label = labels[i]; + } else if (keyLabels && keys.length > i) { + layer.label = keys[i]; + } else if (autoLabels) { + label = []; + while (i >= 0) { + label.push(String.fromCharCode(65 + (i % 26))); + i -= 26; + } + layer.label = label.join(''); + } + return layer; +}; + +Epoch.Data.Format.array = (function() { + var buildLayers, defaultOptions, format, formatBasicPlot, formatHeatmap, formatPie, formatTimePlot; + defaultOptions = { + x: function(d, i) { + return i; + }, + y: function(d, i) { + return d; + }, + time: function(d, i, startTime) { + return parseInt(startTime) + parseInt(i); + }, + type: 'area', + autoLabels: false, + labels: [], + startTime: parseInt(new Date().getTime() / 1000) + }; + buildLayers = function(data, options, mapFn) { + var i, result, series; + result = []; + if (Epoch.isArray(data[0])) { + for (i in data) { + if (!hasProp.call(data, i)) continue; + series = data[i]; + result.push(applyLayerLabel({ + values: series.map(mapFn) + }, options, parseInt(i))); + } + } else { + result.push(applyLayerLabel({ + values: data.map(mapFn) + }, options, 0)); + } + return result; + }; + formatBasicPlot = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + x: options.x(d, i), + y: options.y(d, i) + }; + }); + }; + formatTimePlot = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + time: options.time(d, i, options.startTime), + y: options.y(d, i) + }; + }); + }; + formatHeatmap = function(data, options) { + return buildLayers(data, options, function(d, i) { + return { + time: options.time(d, i, options.startTime), + histogram: d + }; + }); + }; + formatPie = function(data, options) { + var i, result, v; + result = []; + for (i in data) { + if (!hasProp.call(data, i)) continue; + v = data[i]; + if (!Epoch.isNumber(data[0])) { + return []; + } + result.push(applyLayerLabel({ + value: v + }, options, i)); + } + return result; + }; + format = function(data, options) { + var opt; + if (data == null) { + data = []; + } + if (options == null) { + options = {}; + } + if (!Epoch.isNonEmptyArray(data)) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'time.heatmap') { + return formatHeatmap(data, opt); + } else if (opt.type.match(/^time\./)) { + return formatTimePlot(data, opt); + } else if (opt.type === 'pie') { + return formatPie(data, opt); + } else { + return formatBasicPlot(data, opt); + } + }; + format.entry = function(datum, options) { + var d, data, k, layer, len, opt, ref, results; + if (options == null) { + options = {}; + } + if (options.type === 'time.gauge') { + if (datum == null) { + return 0; + } + opt = Epoch.Util.defaults(options, defaultOptions); + d = Epoch.isArray(datum) ? datum[0] : datum; + return opt.y(d, 0); + } + if (datum == null) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + if (Epoch.isArray(datum)) { + data = datum.map(function(d) { + return [d]; + }); + } else { + data = [datum]; + } + ref = format(data, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.Data.Format.tuple = (function() { + var buildLayers, defaultOptions, format; + defaultOptions = { + x: function(d, i) { + return d; + }, + y: function(d, i) { + return d; + }, + time: function(d, i) { + return d; + }, + type: 'area', + autoLabels: false, + labels: [] + }; + buildLayers = function(data, options, mapFn) { + var i, result, series; + if (!Epoch.isArray(data[0])) { + return []; + } + result = []; + if (Epoch.isArray(data[0][0])) { + for (i in data) { + if (!hasProp.call(data, i)) continue; + series = data[i]; + result.push(applyLayerLabel({ + values: series.map(mapFn) + }, options, parseInt(i))); + } + } else { + result.push(applyLayerLabel({ + values: data.map(mapFn) + }, options, 0)); + } + return result; + }; + format = function(data, options) { + var opt; + if (data == null) { + data = []; + } + if (options == null) { + options = {}; + } + if (!Epoch.isNonEmptyArray(data)) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'pie' || opt.type === 'time.heatmap' || opt.type === 'time.gauge') { + return []; + } else if (opt.type.match(/^time\./)) { + return buildLayers(data, opt, function(d, i) { + return { + time: opt.time(d[0], parseInt(i)), + y: opt.y(d[1], parseInt(i)) + }; + }); + } else { + return buildLayers(data, opt, function(d, i) { + return { + x: opt.x(d[0], parseInt(i)), + y: opt.y(d[1], parseInt(i)) + }; + }); + } + }; + format.entry = function(datum, options) { + var data, k, layer, len, ref, results; + if (options == null) { + options = {}; + } + if (datum == null) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + if (Epoch.isArray(datum) && Epoch.isArray(datum[0])) { + data = datum.map(function(d) { + return [d]; + }); + } else { + data = [datum]; + } + ref = format(data, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.Data.Format.keyvalue = (function() { + var buildLayers, defaultOptions, format, formatBasicPlot, formatTimePlot; + defaultOptions = { + type: 'area', + x: function(d, i) { + return parseInt(i); + }, + y: function(d, i) { + return d; + }, + time: function(d, i, startTime) { + return parseInt(startTime) + parseInt(i); + }, + labels: [], + autoLabels: false, + keyLabels: true, + startTime: parseInt(new Date().getTime() / 1000) + }; + buildLayers = function(data, keys, options, mapFn) { + var d, i, j, key, result, values; + result = []; + for (j in keys) { + if (!hasProp.call(keys, j)) continue; + key = keys[j]; + values = []; + for (i in data) { + if (!hasProp.call(data, i)) continue; + d = data[i]; + values.push(mapFn(d, key, parseInt(i))); + } + result.push(applyLayerLabel({ + values: values + }, options, parseInt(j), keys)); + } + return result; + }; + formatBasicPlot = function(data, keys, options) { + return buildLayers(data, keys, options, function(d, key, i) { + var x; + if (Epoch.isString(options.x)) { + x = d[options.x]; + } else { + x = options.x(d, parseInt(i)); + } + return { + x: x, + y: options.y(d[key], parseInt(i)) + }; + }); + }; + formatTimePlot = function(data, keys, options, rangeName) { + if (rangeName == null) { + rangeName = 'y'; + } + return buildLayers(data, keys, options, function(d, key, i) { + var value; + if (Epoch.isString(options.time)) { + value = { + time: d[options.time] + }; + } else { + value = { + time: options.time(d, parseInt(i), options.startTime) + }; + } + value[rangeName] = options.y(d[key], parseInt(i)); + return value; + }); + }; + format = function(data, keys, options) { + var opt; + if (data == null) { + data = []; + } + if (keys == null) { + keys = []; + } + if (options == null) { + options = {}; + } + if (!(Epoch.isNonEmptyArray(data) && Epoch.isNonEmptyArray(keys))) { + return []; + } + opt = Epoch.Util.defaults(options, defaultOptions); + if (opt.type === 'pie' || opt.type === 'time.gauge') { + return []; + } else if (opt.type === 'time.heatmap') { + return formatTimePlot(data, keys, opt, 'histogram'); + } else if (opt.type.match(/^time\./)) { + return formatTimePlot(data, keys, opt); + } else { + return formatBasicPlot(data, keys, opt); + } + }; + format.entry = function(datum, keys, options) { + var k, layer, len, ref, results; + if (keys == null) { + keys = []; + } + if (options == null) { + options = {}; + } + if (!((datum != null) && Epoch.isNonEmptyArray(keys))) { + return []; + } + if (options.startTime == null) { + options.startTime = parseInt(new Date().getTime() / 1000); + } + ref = format([datum], keys, options); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values[0]); + } + return results; + }; + return format; +})(); + +Epoch.data = function() { + var args, formatFn, formatter; + formatter = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; + if ((formatFn = Epoch.Data.Format[formatter]) == null) { + return []; + } + return formatFn.apply(formatFn, args); +}; + +Epoch.Data.formatData = function(data, type, dataFormat) { + var a, args, k, len, opts, ref; + if (data == null) { + data = []; + } + if (!Epoch.isNonEmptyArray(data)) { + return data; + } + if (Epoch.isString(dataFormat)) { + opts = { + type: type + }; + return Epoch.data(dataFormat, data, opts); + } + if (!Epoch.isObject(dataFormat)) { + return data; + } + if (!((dataFormat.name != null) && Epoch.isString(dataFormat.name))) { + return data; + } + if (Epoch.Data.Format[dataFormat.name] == null) { + return data; + } + args = [dataFormat.name, data]; + if ((dataFormat["arguments"] != null) && Epoch.isArray(dataFormat["arguments"])) { + ref = dataFormat["arguments"]; + for (k = 0, len = ref.length; k < len; k++) { + a = ref[k]; + args.push(a); + } + } + if (dataFormat.options != null) { + opts = dataFormat.options; + if (type != null) { + if (opts.type == null) { + opts.type = type; + } + } + args.push(opts); + } else if (type != null) { + args.push({ + type: type + }); + } + return Epoch.data.apply(Epoch.data, args); +}; + +Epoch.Data.formatEntry = function(datum, type, format) { + var a, args, dataFormat, entry, k, len, opts, ref; + if (format == null) { + return datum; + } + if (Epoch.isString(format)) { + opts = { + type: type + }; + return Epoch.Data.Format[format].entry(datum, opts); + } + if (!Epoch.isObject(format)) { + return datum; + } + if (!((format.name != null) && Epoch.isString(format.name))) { + return datum; + } + if (Epoch.Data.Format[format.name] == null) { + return datum; + } + dataFormat = Epoch.Util.defaults(format, {}); + args = [datum]; + if ((dataFormat["arguments"] != null) && Epoch.isArray(dataFormat["arguments"])) { + ref = dataFormat["arguments"]; + for (k = 0, len = ref.length; k < len; k++) { + a = ref[k]; + args.push(a); + } + } + if (dataFormat.options != null) { + opts = dataFormat.options; + opts.type = type; + args.push(opts); + } else if (type != null) { + args.push({ + type: type + }); + } + entry = Epoch.Data.Format[dataFormat.name].entry; + return entry.apply(entry, args); +}; + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Model = (function(superClass) { + var defaults; + + extend(Model, superClass); + + defaults = { + dataFormat: null + }; + + function Model(options) { + if (options == null) { + options = {}; + } + Model.__super__.constructor.call(this); + options = Epoch.Util.defaults(options, defaults); + this.dataFormat = options.dataFormat; + this.data = options.data; + this.loading = false; + } + + Model.prototype.setData = function(data) { + this.data = data; + return this.trigger('data:updated'); + }; + + Model.prototype.push = function(entry) { + this.entry = entry; + return this.trigger('data:push'); + }; + + Model.prototype.hasData = function() { + return this.data != null; + }; + + Model.prototype.getData = function(type, dataFormat) { + if (dataFormat == null) { + dataFormat = this.dataFormat; + } + return Epoch.Data.formatData(this.data, type, dataFormat); + }; + + Model.prototype.getNext = function(type, dataFormat) { + if (dataFormat == null) { + dataFormat = this.dataFormat; + } + return Epoch.Data.formatEntry(this.entry, type, dataFormat); + }; + + return Model; + +})(Epoch.Events); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Plot = (function(superClass) { + var defaultAxisMargins, defaults, optionListeners; + + extend(Plot, superClass); + + defaults = { + domain: null, + range: null, + axes: ['left', 'bottom'], + ticks: { + top: 14, + bottom: 14, + left: 5, + right: 5 + }, + tickFormats: { + top: Epoch.Formats.regular, + bottom: Epoch.Formats.regular, + left: Epoch.Formats.si, + right: Epoch.Formats.si + } + }; + + defaultAxisMargins = { + top: 25, + right: 50, + bottom: 25, + left: 50 + }; + + optionListeners = { + 'option:margins.top': 'marginsChanged', + 'option:margins.right': 'marginsChanged', + 'option:margins.bottom': 'marginsChanged', + 'option:margins.left': 'marginsChanged', + 'option:axes': 'axesChanged', + 'option:ticks.top': 'ticksChanged', + 'option:ticks.right': 'ticksChanged', + 'option:ticks.bottom': 'ticksChanged', + 'option:ticks.left': 'ticksChanged', + 'option:tickFormats.top': 'tickFormatsChanged', + 'option:tickFormats.right': 'tickFormatsChanged', + 'option:tickFormats.bottom': 'tickFormatsChanged', + 'option:tickFormats.left': 'tickFormatsChanged', + 'option:domain': 'domainChanged', + 'option:range': 'rangeChanged' + }; + + function Plot(options) { + var givenMargins, i, len, pos, ref; + this.options = options != null ? options : {}; + givenMargins = Epoch.Util.copy(this.options.margins) || {}; + Plot.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.margins = {}; + ref = ['top', 'right', 'bottom', 'left']; + for (i = 0, len = ref.length; i < len; i++) { + pos = ref[i]; + this.margins[pos] = (this.options.margins != null) && (this.options.margins[pos] != null) ? this.options.margins[pos] : this.hasAxis(pos) ? defaultAxisMargins[pos] : 6; + } + this.g = this.svg.append("g").attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + this.onAll(optionListeners); + } + + Plot.prototype.setTickFormat = function(axis, fn) { + return this.options.tickFormats[axis] = fn; + }; + + Plot.prototype.hasAxis = function(axis) { + return this.options.axes.indexOf(axis) > -1; + }; + + Plot.prototype.innerWidth = function() { + return this.width - (this.margins.left + this.margins.right); + }; + + Plot.prototype.innerHeight = function() { + return this.height - (this.margins.top + this.margins.bottom); + }; + + Plot.prototype.x = function() { + var domain, ref; + domain = (ref = this.options.domain) != null ? ref : this.extent(function(d) { + return d.x; + }); + return d3.scale.linear().domain(domain).range([0, this.innerWidth()]); + }; + + Plot.prototype.y = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight(), 0]); + }; + + Plot.prototype.bottomAxis = function() { + return d3.svg.axis().scale(this.x()).orient('bottom').ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom); + }; + + Plot.prototype.topAxis = function() { + return d3.svg.axis().scale(this.x()).orient('top').ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top); + }; + + Plot.prototype.leftAxis = function() { + var range; + range = this.options.range ? this.options.range.left : null; + return d3.svg.axis().scale(this.y(range)).orient('left').ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left); + }; + + Plot.prototype.rightAxis = function() { + var range; + range = this.options.range ? this.options.range.right : null; + return d3.svg.axis().scale(this.y(range)).orient('right').ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right); + }; + + Plot.prototype.draw = function() { + if (this._axesDrawn) { + this._redrawAxes(); + } else { + this._drawAxes(); + } + return Plot.__super__.draw.call(this); + }; + + Plot.prototype._redrawAxes = function() { + if (this.hasAxis('bottom')) { + this.g.selectAll('.x.axis.bottom').transition().duration(500).ease('linear').call(this.bottomAxis()); + } + if (this.hasAxis('top')) { + this.g.selectAll('.x.axis.top').transition().duration(500).ease('linear').call(this.topAxis()); + } + if (this.hasAxis('left')) { + this.g.selectAll('.y.axis.left').transition().duration(500).ease('linear').call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.g.selectAll('.y.axis.right').transition().duration(500).ease('linear').call(this.rightAxis()); + } + }; + + Plot.prototype._drawAxes = function() { + if (this.hasAxis('bottom')) { + this.g.append("g").attr("class", "x axis bottom").attr("transform", "translate(0, " + (this.innerHeight()) + ")").call(this.bottomAxis()); + } + if (this.hasAxis('top')) { + this.g.append("g").attr('class', 'x axis top').call(this.topAxis()); + } + if (this.hasAxis('left')) { + this.g.append("g").attr("class", "y axis left").call(this.leftAxis()); + } + if (this.hasAxis('right')) { + this.g.append('g').attr('class', 'y axis right').attr('transform', "translate(" + (this.innerWidth()) + ", 0)").call(this.rightAxis()); + } + return this._axesDrawn = true; + }; + + Plot.prototype.dimensionsChanged = function() { + Plot.__super__.dimensionsChanged.call(this); + this.g.selectAll('.axis').remove(); + this._axesDrawn = false; + return this.draw(); + }; + + Plot.prototype.marginsChanged = function() { + var pos, ref, size; + if (this.options.margins == null) { + return; + } + ref = this.options.margins; + for (pos in ref) { + if (!hasProp.call(ref, pos)) continue; + size = ref[pos]; + if (size == null) { + this.margins[pos] = 6; + } else { + this.margins[pos] = size; + } + } + this.g.transition().duration(750).attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + return this.draw(); + }; + + Plot.prototype.axesChanged = function() { + var i, len, pos, ref; + ref = ['top', 'right', 'bottom', 'left']; + for (i = 0, len = ref.length; i < len; i++) { + pos = ref[i]; + if ((this.options.margins != null) && (this.options.margins[pos] != null)) { + continue; + } + if (this.hasAxis(pos)) { + this.margins[pos] = defaultAxisMargins[pos]; + } else { + this.margins[pos] = 6; + } + } + this.g.transition().duration(750).attr("transform", "translate(" + this.margins.left + ", " + this.margins.top + ")"); + this.g.selectAll('.axis').remove(); + this._axesDrawn = false; + return this.draw(); + }; + + Plot.prototype.ticksChanged = function() { + return this.draw(); + }; + + Plot.prototype.tickFormatsChanged = function() { + return this.draw(); + }; + + Plot.prototype.domainChanged = function() { + return this.draw(); + }; + + Plot.prototype.rangeChanged = function() { + return this.draw(); + }; + + return Plot; + +})(Epoch.Chart.SVG); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Area = (function(superClass) { + extend(Area, superClass); + + function Area(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'area'; + } + Area.__super__.constructor.call(this, this.options); + this.draw(); + } + + Area.prototype.y = function() { + var a, i, k, layer, len, ref, ref1, ref2, v; + a = []; + ref = this.getVisibleLayers(); + for (i = 0, len = ref.length; i < len; i++) { + layer = ref[i]; + ref1 = layer.values; + for (k in ref1) { + if (!hasProp.call(ref1, k)) continue; + v = ref1[k]; + if (a[k] != null) { + a[k] += v.y; + } + if (a[k] == null) { + a[k] = v.y; + } + } + } + return d3.scale.linear().domain((ref2 = this.options.range) != null ? ref2 : [0, d3.max(a)]).range([this.height - this.margins.top - this.margins.bottom, 0]); + }; + + Area.prototype.draw = function() { + var area, data, layer, layers, ref, stack, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + this.g.selectAll('.layer').remove(); + if (layers.length === 0) { + return; + } + area = d3.svg.area().x(function(d) { + return x(d.x); + }).y0(function(d) { + return y(d.y0); + }).y1(function(d) { + return y(d.y0 + d.y); + }); + stack = d3.layout.stack().values(function(d) { + return d.values; + }); + data = stack(layers); + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.select('.area').attr('d', function(d) { + return area(d.values); + }); + layer.enter().append('g').attr('class', function(d) { + return d.className; + }); + layer.append('path').attr('class', 'area').attr('d', function(d) { + return area(d.values); + }); + return Area.__super__.draw.call(this); + }; + + return Area; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Bar = (function(superClass) { + var defaults, horizontal_defaults, horizontal_specific, optionListeners; + + extend(Bar, superClass); + + defaults = { + type: 'bar', + style: 'grouped', + orientation: 'vertical', + padding: { + bar: 0.08, + group: 0.1 + }, + outerPadding: { + bar: 0.08, + group: 0.1 + } + }; + + horizontal_specific = { + tickFormats: { + top: Epoch.Formats.si, + bottom: Epoch.Formats.si, + left: Epoch.Formats.regular, + right: Epoch.Formats.regular + } + }; + + horizontal_defaults = Epoch.Util.defaults(horizontal_specific, defaults); + + optionListeners = { + 'option:orientation': 'orientationChanged', + 'option:padding': 'paddingChanged', + 'option:outerPadding': 'paddingChanged', + 'option:padding:bar': 'paddingChanged', + 'option:padding:group': 'paddingChanged', + 'option:outerPadding:bar': 'paddingChanged', + 'option:outerPadding:group': 'paddingChanged' + }; + + function Bar(options) { + this.options = options != null ? options : {}; + if (this._isHorizontal()) { + this.options = Epoch.Util.defaults(this.options, horizontal_defaults); + } else { + this.options = Epoch.Util.defaults(this.options, defaults); + } + Bar.__super__.constructor.call(this, this.options); + this.onAll(optionListeners); + this.draw(); + } + + Bar.prototype._isVertical = function() { + return this.options.orientation === 'vertical'; + }; + + Bar.prototype._isHorizontal = function() { + return this.options.orientation === 'horizontal'; + }; + + Bar.prototype.x = function() { + var extent; + if (this._isVertical()) { + return d3.scale.ordinal().domain(Epoch.Util.domain(this.getVisibleLayers())).rangeRoundBands([0, this.innerWidth()], this.options.padding.group, this.options.outerPadding.group); + } else { + extent = this.extent(function(d) { + return d.y; + }); + extent[0] = Math.min(0, extent[0]); + return d3.scale.linear().domain(extent).range([0, this.width - this.margins.left - this.margins.right]); + } + }; + + Bar.prototype.x1 = function(x0) { + var layer; + return d3.scale.ordinal().domain((function() { + var j, len, ref, results; + ref = this.getVisibleLayers(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + results.push(layer.category); + } + return results; + }).call(this)).rangeRoundBands([0, x0.rangeBand()], this.options.padding.bar, this.options.outerPadding.bar); + }; + + Bar.prototype.y = function() { + var extent; + if (this._isVertical()) { + extent = this.extent(function(d) { + return d.y; + }); + extent[0] = Math.min(0, extent[0]); + return d3.scale.linear().domain(extent).range([this.height - this.margins.top - this.margins.bottom, 0]); + } else { + return d3.scale.ordinal().domain(Epoch.Util.domain(this.getVisibleLayers())).rangeRoundBands([0, this.innerHeight()], this.options.padding.group, this.options.outerPadding.group); + } + }; + + Bar.prototype.y1 = function(y0) { + var layer; + return d3.scale.ordinal().domain((function() { + var j, len, ref, results; + ref = this.getVisibleLayers(); + results = []; + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + results.push(layer.category); + } + return results; + }).call(this)).rangeRoundBands([0, y0.rangeBand()], this.options.padding.bar, this.options.outerPadding.bar); + }; + + Bar.prototype._remapData = function() { + var className, entry, j, k, l, layer, len, len1, map, name, ref, ref1, results, v; + map = {}; + ref = this.getVisibleLayers(); + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + className = 'bar ' + layer.className.replace(/\s*layer\s*/, ''); + ref1 = layer.values; + for (l = 0, len1 = ref1.length; l < len1; l++) { + entry = ref1[l]; + if (map[name = entry.x] == null) { + map[name] = []; + } + map[entry.x].push({ + label: layer.category, + y: entry.y, + className: className + }); + } + } + results = []; + for (k in map) { + if (!hasProp.call(map, k)) continue; + v = map[k]; + results.push({ + group: k, + values: v + }); + } + return results; + }; + + Bar.prototype.draw = function() { + if (this._isVertical()) { + this._drawVertical(); + } else { + this._drawHorizontal(); + } + return Bar.__super__.draw.call(this); + }; + + Bar.prototype._drawVertical = function() { + var data, height, layer, rects, ref, x0, x1, y; + ref = [this.x(), this.y()], x0 = ref[0], y = ref[1]; + x1 = this.x1(x0); + height = this.height - this.margins.top - this.margins.bottom; + data = this._remapData(); + layer = this.g.selectAll(".layer").data(data, function(d) { + return d.group; + }); + layer.transition().duration(750).attr("transform", function(d) { + return "translate(" + (x0(d.group)) + ", 0)"; + }); + layer.enter().append("g").attr('class', 'layer').attr("transform", function(d) { + return "translate(" + (x0(d.group)) + ", 0)"; + }); + rects = layer.selectAll('rect').data(function(group) { + return group.values; + }); + rects.attr('class', function(d) { + return d.className; + }); + rects.transition().duration(600).attr('x', function(d) { + return x1(d.label); + }).attr('y', function(d) { + return y(d.y); + }).attr('width', x1.rangeBand()).attr('height', function(d) { + return height - y(d.y); + }); + rects.enter().append('rect').attr('class', function(d) { + return d.className; + }).attr('x', function(d) { + return x1(d.label); + }).attr('y', function(d) { + return y(d.y); + }).attr('width', x1.rangeBand()).attr('height', function(d) { + return height - y(d.y); + }); + rects.exit().transition().duration(150).style('opacity', '0').remove(); + return layer.exit().transition().duration(750).style('opacity', '0').remove(); + }; + + Bar.prototype._drawHorizontal = function() { + var data, layer, rects, ref, width, x, y0, y1; + ref = [this.x(), this.y()], x = ref[0], y0 = ref[1]; + y1 = this.y1(y0); + width = this.width - this.margins.left - this.margins.right; + data = this._remapData(); + layer = this.g.selectAll(".layer").data(data, function(d) { + return d.group; + }); + layer.transition().duration(750).attr("transform", function(d) { + return "translate(0, " + (y0(d.group)) + ")"; + }); + layer.enter().append("g").attr('class', 'layer').attr("transform", function(d) { + return "translate(0, " + (y0(d.group)) + ")"; + }); + rects = layer.selectAll('rect').data(function(group) { + return group.values; + }); + rects.attr('class', function(d) { + return d.className; + }); + rects.transition().duration(600).attr('x', function(d) { + return 0; + }).attr('y', function(d) { + return y1(d.label); + }).attr('height', y1.rangeBand()).attr('width', function(d) { + return x(d.y); + }); + rects.enter().append('rect').attr('class', function(d) { + return d.className; + }).attr('x', function(d) { + return 0; + }).attr('y', function(d) { + return y1(d.label); + }).attr('height', y1.rangeBand()).attr('width', function(d) { + return x(d.y); + }); + rects.exit().transition().duration(150).style('opacity', '0').remove(); + return layer.exit().transition().duration(750).style('opacity', '0').remove(); + }; + + Bar.prototype._getTickValues = function(numTicks, dataKey) { + var i, step, tickValues, total; + if (dataKey == null) { + dataKey = 'x'; + } + if (this.data[0] == null) { + return []; + } + total = this.data[0].values.length; + step = Math.ceil(total / numTicks) | 0; + return tickValues = (function() { + var j, ref, ref1, results; + results = []; + for (i = j = 0, ref = total, ref1 = step; ref1 > 0 ? j < ref : j > ref; i = j += ref1) { + results.push(this.data[0].values[i].x); + } + return results; + }).call(this); + }; + + Bar.prototype.bottomAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.x()).orient('bottom').ticks(this.options.ticks.bottom).tickFormat(this.options.tickFormats.bottom); + if (this._isVertical() && (this.options.ticks.bottom != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.bottom)); + } + return axis; + }; + + Bar.prototype.topAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.x()).orient('top').ticks(this.options.ticks.top).tickFormat(this.options.tickFormats.top); + if (this._isVertical() && (this.options.ticks.top != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.top)); + } + return axis; + }; + + Bar.prototype.leftAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.y()).orient('left').ticks(this.options.ticks.left).tickFormat(this.options.tickFormats.left); + if (this._isHorizontal() && (this.options.ticks.left != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.left)); + } + return axis; + }; + + Bar.prototype.rightAxis = function() { + var axis; + axis = d3.svg.axis().scale(this.y()).orient('right').ticks(this.options.ticks.right).tickFormat(this.options.tickFormats.right); + if (this._isHorizontal() && (this.options.ticks.right != null)) { + axis.tickValues(this._getTickValues(this.options.ticks.right)); + } + return axis; + }; + + Bar.prototype.orientationChanged = function() { + var bottom, left, right, top; + top = this.options.tickFormats.top; + bottom = this.options.tickFormats.bottom; + left = this.options.tickFormats.left; + right = this.options.tickFormats.right; + this.options.tickFormats.left = top; + this.options.tickFormats.right = bottom; + this.options.tickFormats.top = left; + this.options.tickFormats.bottom = right; + return this.draw(); + }; + + Bar.prototype.paddingChanged = function() { + return this.draw(); + }; + + return Bar; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Histogram = (function(superClass) { + var defaults, optionListeners; + + extend(Histogram, superClass); + + defaults = { + type: 'histogram', + domain: [0, 100], + bucketRange: [0, 100], + buckets: 10, + cutOutliers: false + }; + + optionListeners = { + 'option:bucketRange': 'bucketRangeChanged', + 'option:buckets': 'bucketsChanged', + 'option:cutOutliers': 'cutOutliersChanged' + }; + + function Histogram(options) { + this.options = options != null ? options : {}; + Histogram.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.onAll(optionListeners); + this.draw(); + } + + Histogram.prototype._prepareData = function(data) { + var bucketSize, buckets, i, index, j, k, l, layer, len, len1, point, prepared, preparedLayer, ref, v; + bucketSize = (this.options.bucketRange[1] - this.options.bucketRange[0]) / this.options.buckets; + prepared = []; + for (j = 0, len = data.length; j < len; j++) { + layer = data[j]; + buckets = (function() { + var l, ref, results; + results = []; + for (i = l = 0, ref = this.options.buckets; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) { + results.push(0); + } + return results; + }).call(this); + ref = layer.values; + for (l = 0, len1 = ref.length; l < len1; l++) { + point = ref[l]; + index = parseInt((point.x - this.options.bucketRange[0]) / bucketSize); + if (this.options.cutOutliers && ((index < 0) || (index >= this.options.buckets))) { + continue; + } + if (index < 0) { + index = 0; + } else if (index >= this.options.buckets) { + index = this.options.buckets - 1; + } + buckets[index] += parseInt(point.y); + } + preparedLayer = { + values: buckets.map(function(d, i) { + return { + x: parseInt(i) * bucketSize, + y: d + }; + }) + }; + for (k in layer) { + if (!hasProp.call(layer, k)) continue; + v = layer[k]; + if (k !== 'values') { + preparedLayer[k] = v; + } + } + prepared.push(preparedLayer); + } + return prepared; + }; + + Histogram.prototype.resetData = function() { + this.setData(this.rawData); + return this.draw(); + }; + + Histogram.prototype.bucketRangeChanged = function() { + return this.resetData(); + }; + + Histogram.prototype.bucketsChanged = function() { + return this.resetData(); + }; + + Histogram.prototype.cutOutliersChanged = function() { + return this.resetData(); + }; + + return Histogram; + +})(Epoch.Chart.Bar); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Line = (function(superClass) { + extend(Line, superClass); + + function Line(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'line'; + } + Line.__super__.constructor.call(this, this.options); + this.draw(); + } + + Line.prototype.line = function(layer) { + var ref, x, y; + ref = [this.x(), this.y(layer.range)], x = ref[0], y = ref[1]; + return d3.svg.line().x(function(d) { + return x(d.x); + }).y(function(d) { + return y(d.y); + }); + }; + + Line.prototype.draw = function() { + var layer, layers, ref, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + if (layers.length === 0) { + return this.g.selectAll('.layer').remove(); + } + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.select('.line').transition().duration(500).attr('d', (function(_this) { + return function(l) { + return _this.line(l)(l.values); + }; + })(this)); + layer.enter().append('g').attr('class', function(l) { + return l.className; + }).append('path').attr('class', 'line').attr('d', (function(_this) { + return function(l) { + return _this.line(l)(l.values); + }; + })(this)); + layer.exit().transition().duration(750).style('opacity', '0').remove(); + return Line.__super__.draw.call(this); + }; + + return Line; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Pie = (function(superClass) { + var defaults; + + extend(Pie, superClass); + + defaults = { + type: 'pie', + margin: 10, + inner: 0 + }; + + function Pie(options) { + this.options = options != null ? options : {}; + Pie.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.pie = d3.layout.pie().sort(null).value(function(d) { + return d.value; + }); + this.arc = d3.svg.arc().outerRadius((function(_this) { + return function() { + return (Math.max(_this.width, _this.height) / 2) - _this.options.margin; + }; + })(this)).innerRadius((function(_this) { + return function() { + return _this.options.inner; + }; + })(this)); + this.g = this.svg.append('g').attr("transform", "translate(" + (this.width / 2) + ", " + (this.height / 2) + ")"); + this.on('option:margin', 'marginChanged'); + this.on('option:inner', 'innerChanged'); + this.draw(); + } + + Pie.prototype.draw = function() { + var arcs, path, text; + this.g.selectAll('.arc').remove(); + arcs = this.g.selectAll(".arc").data(this.pie(this.getVisibleLayers()), function(d) { + return d.data.category; + }); + arcs.enter().append('g').attr('class', function(d) { + return "arc pie " + d.data.className; + }); + arcs.select('path').attr('d', this.arc); + arcs.select('text').attr("transform", (function(_this) { + return function(d) { + return "translate(" + (_this.arc.centroid(d)) + ")"; + }; + })(this)).text(function(d) { + return d.data.label || d.data.category; + }); + path = arcs.append("path").attr("d", this.arc).each(function(d) { + return this._current = d; + }); + text = arcs.append("text").attr("transform", (function(_this) { + return function(d) { + return "translate(" + (_this.arc.centroid(d)) + ")"; + }; + })(this)).attr("dy", ".35em").style("text-anchor", "middle").text(function(d) { + return d.data.label || d.data.category; + }); + return Pie.__super__.draw.call(this); + }; + + Pie.prototype.marginChanged = function() { + return this.draw(); + }; + + Pie.prototype.innerChanged = function() { + return this.draw(); + }; + + return Pie; + +})(Epoch.Chart.SVG); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Chart.Scatter = (function(superClass) { + var defaults; + + extend(Scatter, superClass); + + defaults = { + type: 'scatter', + radius: 3.5, + axes: ['top', 'bottom', 'left', 'right'] + }; + + function Scatter(options) { + this.options = options != null ? options : {}; + Scatter.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.on('option:radius', 'radiusChanged'); + this.draw(); + } + + Scatter.prototype.draw = function() { + var dots, layer, layers, radius, ref, x, y; + ref = [this.x(), this.y(), this.getVisibleLayers()], x = ref[0], y = ref[1], layers = ref[2]; + radius = this.options.radius; + if (layers.length === 0) { + return this.g.selectAll('.layer').remove(); + } + layer = this.g.selectAll('.layer').data(layers, function(d) { + return d.category; + }); + layer.enter().append('g').attr('class', function(d) { + return d.className; + }); + dots = layer.selectAll('.dot').data(function(l) { + return l.values; + }); + dots.transition().duration(500).attr("r", function(d) { + var ref1; + return (ref1 = d.r) != null ? ref1 : radius; + }).attr("cx", function(d) { + return x(d.x); + }).attr("cy", function(d) { + return y(d.y); + }); + dots.enter().append('circle').attr('class', 'dot').attr("r", function(d) { + var ref1; + return (ref1 = d.r) != null ? ref1 : radius; + }).attr("cx", function(d) { + return x(d.x); + }).attr("cy", function(d) { + return y(d.y); + }); + dots.exit().transition().duration(750).style('opacity', 0).remove(); + layer.exit().transition().duration(750).style('opacity', 0).remove(); + return Scatter.__super__.draw.call(this); + }; + + Scatter.prototype.radiusChanged = function() { + return this.draw(); + }; + + return Scatter; + +})(Epoch.Chart.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Plot = (function(superClass) { + var defaultAxisMargins, defaults, optionListeners; + + extend(Plot, superClass); + + defaults = { + range: null, + fps: 24, + historySize: 120, + windowSize: 40, + queueSize: 10, + axes: ['bottom'], + ticks: { + time: 15, + left: 5, + right: 5 + }, + tickFormats: { + top: Epoch.Formats.seconds, + bottom: Epoch.Formats.seconds, + left: Epoch.Formats.si, + right: Epoch.Formats.si + } + }; + + defaultAxisMargins = { + top: 25, + right: 50, + bottom: 25, + left: 50 + }; + + optionListeners = { + 'option:margins': 'marginsChanged', + 'option:margins.top': 'marginsChanged', + 'option:margins.right': 'marginsChanged', + 'option:margins.bottom': 'marginsChanged', + 'option:margins.left': 'marginsChanged', + 'option:axes': 'axesChanged', + 'option:ticks': 'ticksChanged', + 'option:ticks.top': 'ticksChanged', + 'option:ticks.right': 'ticksChanged', + 'option:ticks.bottom': 'ticksChanged', + 'option:ticks.left': 'ticksChanged', + 'option:tickFormats': 'tickFormatsChanged', + 'option:tickFormats.top': 'tickFormatsChanged', + 'option:tickFormats.right': 'tickFormatsChanged', + 'option:tickFormats.bottom': 'tickFormatsChanged', + 'option:tickFormats.left': 'tickFormatsChanged' + }; + + function Plot(options) { + var givenMargins, l, len, pos, ref; + this.options = options; + givenMargins = Epoch.Util.copy(this.options.margins) || {}; + Plot.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + if (this.options.model) { + this.options.model.on('data:push', (function(_this) { + return function() { + return _this.pushFromModel(); + }; + })(this)); + } + this._queue = []; + this.margins = {}; + ref = ['top', 'right', 'bottom', 'left']; + for (l = 0, len = ref.length; l < len; l++) { + pos = ref[l]; + this.margins[pos] = (this.options.margins != null) && (this.options.margins[pos] != null) ? this.options.margins[pos] : this.hasAxis(pos) ? defaultAxisMargins[pos] : 6; + } + this.svg = this.el.insert('svg', ':first-child').attr('width', this.width).attr('height', this.height).style('z-index', '1000'); + if (this.el.style('position') !== 'absolute' && this.el.style('position') !== 'relative') { + this.el.style('position', 'relative'); + } + this.canvas.style({ + position: 'absolute', + 'z-index': '999' + }); + this._sizeCanvas(); + this.animation = { + interval: null, + active: false, + delta: (function(_this) { + return function() { + return -(_this.w() / _this.options.fps); + }; + })(this), + tickDelta: (function(_this) { + return function() { + return -((_this.w() / _this.pixelRatio) / _this.options.fps); + }; + })(this), + frame: 0, + duration: this.options.fps + }; + this._buildAxes(); + this.animationCallback = (function(_this) { + return function() { + return _this._animate(); + }; + })(this); + this.onAll(optionListeners); + } + + Plot.prototype._sizeCanvas = function() { + this.canvas.attr({ + width: this.innerWidth(), + height: this.innerHeight() + }); + return this.canvas.style({ + width: (this.innerWidth() / this.pixelRatio) + "px", + height: (this.innerHeight() / this.pixelRatio) + "px", + top: this.margins.top + "px", + left: this.margins.left + "px" + }); + }; + + Plot.prototype._buildAxes = function() { + this.svg.selectAll('.axis').remove(); + this._prepareTimeAxes(); + return this._prepareRangeAxes(); + }; + + Plot.prototype._annotateLayers = function(prepared) { + var classes, copy, data, i, layer, start; + data = []; + for (i in prepared) { + if (!hasProp.call(prepared, i)) continue; + layer = prepared[i]; + copy = Epoch.Util.copy(layer); + start = Math.max(0, layer.values.length - this.options.historySize); + copy.values = layer.values.slice(start); + classes = ['layer']; + classes.push("category" + ((i | 0) + 1)); + if (layer.label != null) { + classes.push(Epoch.Util.dasherize(layer.label)); + } + copy.className = classes.join(' '); + copy.visible = true; + data.push(copy); + } + return data; + }; + + Plot.prototype._offsetX = function() { + return 0; + }; + + Plot.prototype._prepareTimeAxes = function() { + var axis; + if (this.hasAxis('bottom')) { + axis = this.bottomAxis = this.svg.append('g').attr('class', "x axis bottom canvas").attr('transform', "translate(" + (this.margins.left - 1) + ", " + (this.innerHeight() / this.pixelRatio + this.margins.top) + ")"); + axis.append('path').attr('class', 'domain').attr('d', "M0,0H" + (this.innerWidth() / this.pixelRatio + 1)); + } + if (this.hasAxis('top')) { + axis = this.topAxis = this.svg.append('g').attr('class', "x axis top canvas").attr('transform', "translate(" + (this.margins.left - 1) + ", " + this.margins.top + ")"); + axis.append('path').attr('class', 'domain').attr('d', "M0,0H" + (this.innerWidth() / this.pixelRatio + 1)); + } + return this._resetInitialTimeTicks(); + }; + + Plot.prototype._resetInitialTimeTicks = function() { + var i, k, l, layer, len, ref, ref1, results, tickInterval; + tickInterval = this.options.ticks.time; + this._ticks = []; + this._tickTimer = tickInterval; + if (this.bottomAxis != null) { + this.bottomAxis.selectAll('.tick').remove(); + } + if (this.topAxis != null) { + this.topAxis.selectAll('.tick').remove(); + } + ref = this.data; + results = []; + for (l = 0, len = ref.length; l < len; l++) { + layer = ref[l]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + ref1 = [this.options.windowSize - 1, layer.values.length - 1], i = ref1[0], k = ref1[1]; + while (i >= 0 && k >= 0) { + this._pushTick(i, layer.values[k].time, false, true); + i -= tickInterval; + k -= tickInterval; + } + break; + } + return results; + }; + + Plot.prototype._prepareRangeAxes = function() { + if (this.hasAxis('left')) { + this.svg.append("g").attr("class", "y axis left").attr('transform', "translate(" + (this.margins.left - 1) + ", " + this.margins.top + ")").call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.svg.append('g').attr('class', 'y axis right').attr('transform', "translate(" + (this.width - this.margins.right) + ", " + this.margins.top + ")").call(this.rightAxis()); + } + }; + + Plot.prototype.leftAxis = function() { + var axis, ticks; + ticks = this.options.ticks.left; + axis = d3.svg.axis().scale(this.ySvgLeft()).orient('left').tickFormat(this.options.tickFormats.left); + if (ticks === 2) { + return axis.tickValues(this.extent(function(d) { + return d.y; + })); + } else { + return axis.ticks(ticks); + } + }; + + Plot.prototype.rightAxis = function() { + var axis, extent, ticks; + extent = this.extent(function(d) { + return d.y; + }); + ticks = this.options.ticks.right; + axis = d3.svg.axis().scale(this.ySvgRight()).orient('right').tickFormat(this.options.tickFormats.right); + if (ticks === 2) { + return axis.tickValues(this.extent(function(d) { + return d.y; + })); + } else { + return axis.ticks(ticks); + } + }; + + Plot.prototype.hasAxis = function(name) { + return this.options.axes.indexOf(name) > -1; + }; + + Plot.prototype.innerWidth = function() { + return (this.width - (this.margins.left + this.margins.right)) * this.pixelRatio; + }; + + Plot.prototype.innerHeight = function() { + return (this.height - (this.margins.top + this.margins.bottom)) * this.pixelRatio; + }; + + Plot.prototype._prepareEntry = function(entry) { + return entry; + }; + + Plot.prototype._prepareLayers = function(layers) { + return layers; + }; + + Plot.prototype._startTransition = function() { + if (this.animation.active === true || this._queue.length === 0) { + return; + } + this.trigger('transition:start'); + this._shift(); + this.animation.active = true; + return this.animation.interval = setInterval(this.animationCallback, 1000 / this.options.fps); + }; + + Plot.prototype._stopTransition = function() { + var firstTick, l, lastTick, layer, len, ref, ref1; + if (!this.inTransition()) { + return; + } + ref = this.data; + for (l = 0, len = ref.length; l < len; l++) { + layer = ref[l]; + if (!(layer.values.length > this.options.windowSize + 1)) { + continue; + } + layer.values.shift(); + } + ref1 = [this._ticks[0], this._ticks[this._ticks.length - 1]], firstTick = ref1[0], lastTick = ref1[1]; + if ((lastTick != null) && lastTick.enter) { + lastTick.enter = false; + lastTick.opacity = 1; + } + if ((firstTick != null) && firstTick.exit) { + this._shiftTick(); + } + this.animation.frame = 0; + this.trigger('transition:end'); + if (this._queue.length > 0) { + return this._shift(); + } else { + this.animation.active = false; + return clearInterval(this.animation.interval); + } + }; + + Plot.prototype.inTransition = function() { + return this.animation.active; + }; + + Plot.prototype.push = function(layers) { + layers = this._prepareLayers(layers); + if (this._queue.length > this.options.queueSize) { + this._queue.splice(this.options.queueSize, this._queue.length - this.options.queueSize); + } + if (this._queue.length === this.options.queueSize) { + return false; + } + this._queue.push(layers.map((function(_this) { + return function(entry) { + return _this._prepareEntry(entry); + }; + })(this))); + this.trigger('push'); + if (!this.inTransition()) { + return this._startTransition(); + } + }; + + Plot.prototype.pushFromModel = function() { + return this.push(this.options.model.getNext(this.options.type, this.options.dataFormat)); + }; + + Plot.prototype._shift = function() { + var entry, i, layer, ref; + this.trigger('before:shift'); + entry = this._queue.shift(); + ref = this.data; + for (i in ref) { + if (!hasProp.call(ref, i)) continue; + layer = ref[i]; + layer.values.push(entry[i]); + } + this._updateTicks(entry[0].time); + this._transitionRangeAxes(); + return this.trigger('after:shift'); + }; + + Plot.prototype._transitionRangeAxes = function() { + if (this.hasAxis('left')) { + this.svg.selectAll('.y.axis.left').transition().duration(500).ease('linear').call(this.leftAxis()); + } + if (this.hasAxis('right')) { + return this.svg.selectAll('.y.axis.right').transition().duration(500).ease('linear').call(this.rightAxis()); + } + }; + + Plot.prototype._animate = function() { + if (!this.inTransition()) { + return; + } + if (++this.animation.frame === this.animation.duration) { + this._stopTransition(); + } + this.draw(this.animation.frame * this.animation.delta()); + return this._updateTimeAxes(); + }; + + Plot.prototype.y = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight(), 0]); + }; + + Plot.prototype.ySvg = function(givenDomain) { + return d3.scale.linear().domain(this._getScaleDomain(givenDomain)).range([this.innerHeight() / this.pixelRatio, 0]); + }; + + Plot.prototype.ySvgLeft = function() { + if (this.options.range != null) { + return this.ySvg(this.options.range.left); + } else { + return this.ySvg(); + } + }; + + Plot.prototype.ySvgRight = function() { + if (this.options.range != null) { + return this.ySvg(this.options.range.right); + } else { + return this.ySvg(); + } + }; + + Plot.prototype.w = function() { + return this.innerWidth() / this.options.windowSize; + }; + + Plot.prototype._updateTicks = function(newTime) { + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + if (!((++this._tickTimer) % this.options.ticks.time)) { + this._pushTick(this.options.windowSize, newTime, true); + } + if (!(this._ticks.length > 0)) { + return; + } + if (!(this._ticks[0].x - (this.w() / this.pixelRatio) >= 0)) { + return this._ticks[0].exit = true; + } + }; + + Plot.prototype._pushTick = function(bucket, time, enter, reverse) { + var g, tick; + if (enter == null) { + enter = false; + } + if (reverse == null) { + reverse = false; + } + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + tick = { + time: time, + x: bucket * (this.w() / this.pixelRatio) + this._offsetX(), + opacity: enter ? 0 : 1, + enter: enter ? true : false, + exit: false + }; + if (this.hasAxis('bottom')) { + g = this.bottomAxis.append('g').attr('class', 'tick major').attr('transform', "translate(" + (tick.x + 1) + ",0)").style('opacity', tick.opacity); + g.append('line').attr('y2', 6); + g.append('text').attr('text-anchor', 'middle').attr('dy', 19).text(this.options.tickFormats.bottom(tick.time)); + tick.bottomEl = g; + } + if (this.hasAxis('top')) { + g = this.topAxis.append('g').attr('class', 'tick major').attr('transform', "translate(" + (tick.x + 1) + ",0)").style('opacity', tick.opacity); + g.append('line').attr('y2', -6); + g.append('text').attr('text-anchor', 'middle').attr('dy', -10).text(this.options.tickFormats.top(tick.time)); + tick.topEl = g; + } + if (reverse) { + this._ticks.unshift(tick); + } else { + this._ticks.push(tick); + } + return tick; + }; + + Plot.prototype._shiftTick = function() { + var tick; + if (!(this._ticks.length > 0)) { + return; + } + tick = this._ticks.shift(); + if (tick.topEl != null) { + tick.topEl.remove(); + } + if (tick.bottomEl != null) { + return tick.bottomEl.remove(); + } + }; + + Plot.prototype._updateTimeAxes = function() { + var dop, dx, l, len, ref, ref1, results, tick; + if (!(this.hasAxis('top') || this.hasAxis('bottom'))) { + return; + } + ref = [this.animation.tickDelta(), 1 / this.options.fps], dx = ref[0], dop = ref[1]; + ref1 = this._ticks; + results = []; + for (l = 0, len = ref1.length; l < len; l++) { + tick = ref1[l]; + tick.x += dx; + if (this.hasAxis('bottom')) { + tick.bottomEl.attr('transform', "translate(" + (tick.x + 1) + ",0)"); + } + if (this.hasAxis('top')) { + tick.topEl.attr('transform', "translate(" + (tick.x + 1) + ",0)"); + } + if (tick.enter) { + tick.opacity += dop; + } else if (tick.exit) { + tick.opacity -= dop; + } + if (tick.enter || tick.exit) { + if (this.hasAxis('bottom')) { + tick.bottomEl.style('opacity', tick.opacity); + } + if (this.hasAxis('top')) { + results.push(tick.topEl.style('opacity', tick.opacity)); + } else { + results.push(void 0); + } + } else { + results.push(void 0); + } + } + return results; + }; + + Plot.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + return Plot.__super__.draw.call(this); + }; + + Plot.prototype.dimensionsChanged = function() { + Plot.__super__.dimensionsChanged.call(this); + this.svg.attr('width', this.width).attr('height', this.height); + this._sizeCanvas(); + this._buildAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.axesChanged = function() { + var l, len, pos, ref; + ref = ['top', 'right', 'bottom', 'left']; + for (l = 0, len = ref.length; l < len; l++) { + pos = ref[l]; + if ((this.options.margins != null) && (this.options.margins[pos] != null)) { + continue; + } + if (this.hasAxis(pos)) { + this.margins[pos] = defaultAxisMargins[pos]; + } else { + this.margins[pos] = 6; + } + } + this._sizeCanvas(); + this._buildAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.ticksChanged = function() { + this._resetInitialTimeTicks(); + this._transitionRangeAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.tickFormatsChanged = function() { + this._resetInitialTimeTicks(); + this._transitionRangeAxes(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.marginsChanged = function() { + var pos, ref, size; + if (this.options.margins == null) { + return; + } + ref = this.options.margins; + for (pos in ref) { + if (!hasProp.call(ref, pos)) continue; + size = ref[pos]; + if (size == null) { + this.margins[pos] = 6; + } else { + this.margins[pos] = size; + } + } + this._sizeCanvas(); + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Plot.prototype.layerChanged = function() { + this._transitionRangeAxes(); + return Plot.__super__.layerChanged.call(this); + }; + + return Plot; + +})(Epoch.Chart.Canvas); + +Epoch.Time.Stack = (function(superClass) { + extend(Stack, superClass); + + function Stack() { + return Stack.__super__.constructor.apply(this, arguments); + } + + Stack.prototype._stackLayers = function() { + var i, l, layer, layers, ref, results, y0; + if (!((layers = this.getVisibleLayers()).length > 0)) { + return; + } + results = []; + for (i = l = 0, ref = layers[0].values.length; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) { + y0 = 0; + results.push((function() { + var len, m, results1; + results1 = []; + for (m = 0, len = layers.length; m < len; m++) { + layer = layers[m]; + layer.values[i].y0 = y0; + results1.push(y0 += layer.values[i].y); + } + return results1; + })()); + } + return results; + }; + + Stack.prototype._prepareLayers = function(layers) { + var d, i, y0; + y0 = 0; + for (i in layers) { + if (!hasProp.call(layers, i)) continue; + d = layers[i]; + if (!this.data[i].visible) { + continue; + } + d.y0 = y0; + y0 += d.y; + } + return layers; + }; + + Stack.prototype.setData = function(data) { + Stack.__super__.setData.call(this, data); + return this._stackLayers(); + }; + + Stack.prototype.extent = function() { + var i, j, l, layers, m, max, ref, ref1, ref2, sum; + ref = [0, this.getVisibleLayers()], max = ref[0], layers = ref[1]; + if (!layers.length) { + return [0, 0]; + } + for (i = l = 0, ref1 = layers[0].values.length; 0 <= ref1 ? l < ref1 : l > ref1; i = 0 <= ref1 ? ++l : --l) { + sum = 0; + for (j = m = 0, ref2 = layers.length; 0 <= ref2 ? m < ref2 : m > ref2; j = 0 <= ref2 ? ++m : --m) { + sum += layers[j].values[i].y; + } + if (sum > max) { + max = sum; + } + } + return [0, max]; + }; + + Stack.prototype.layerChanged = function() { + var l, layers, len, ref; + this._stackLayers(); + ref = this._queue; + for (l = 0, len = ref.length; l < len; l++) { + layers = ref[l]; + this._prepareLayers(layers); + } + return Stack.__super__.layerChanged.call(this); + }; + + return Stack; + +})(Epoch.Time.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Area = (function(superClass) { + extend(Area, superClass); + + function Area(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.area'; + } + Area.__super__.constructor.call(this, this.options); + this.draw(); + } + + Area.prototype.setStyles = function(layer) { + var styles; + if ((layer != null) && (layer.className != null)) { + styles = this.getStyles("g." + (layer.className.replace(/\s/g, '.')) + " path.area"); + } else { + styles = this.getStyles("g path.area"); + } + this.ctx.fillStyle = styles.fill; + if (styles.stroke != null) { + this.ctx.strokeStyle = styles.stroke; + } + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Area.prototype._drawAreas = function(delta) { + var args, borderX, entry, firstX, i, j, k, l, layer, layers, ref, ref1, ref2, results, trans, w, y; + if (delta == null) { + delta = 0; + } + ref = [this.y(), this.w(), this.getVisibleLayers()], y = ref[0], w = ref[1], layers = ref[2]; + results = []; + for (i = l = ref1 = layers.length - 1; ref1 <= 0 ? l <= 0 : l >= 0; i = ref1 <= 0 ? ++l : --l) { + if (!(layer = layers[i])) { + continue; + } + this.setStyles(layer); + this.ctx.beginPath(); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], j = ref2[0], k = ref2[1], trans = ref2[2]; + firstX = null; + while ((--j >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(j + 1) * w + delta, y(entry.y + entry.y0)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + if (trans) { + borderX = (j + 3) * w + delta; + } else { + borderX = (j + 2) * w + delta; + } + this.ctx.lineTo(borderX, this.innerHeight()); + this.ctx.lineTo(this.width * this.pixelRatio + w + delta, this.innerHeight()); + this.ctx.closePath(); + results.push(this.ctx.fill()); + } + return results; + }; + + Area.prototype._drawStrokes = function(delta) { + var args, entry, firstX, i, k, l, layer, layers, ref, ref1, ref2, results, trans, w, y; + if (delta == null) { + delta = 0; + } + ref = [this.y(), this.w(), this.getVisibleLayers()], y = ref[0], w = ref[1], layers = ref[2]; + results = []; + for (i = l = ref1 = layers.length - 1; ref1 <= 0 ? l <= 0 : l >= 0; i = ref1 <= 0 ? ++l : --l) { + if (!(layer = layers[i])) { + continue; + } + this.setStyles(layer); + this.ctx.beginPath(); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref2[0], k = ref2[1], trans = ref2[2]; + firstX = null; + while ((--i >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(i + 1) * w + delta, y(entry.y + entry.y0)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + results.push(this.ctx.stroke()); + } + return results; + }; + + Area.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + this.clear(); + this._drawAreas(delta); + this._drawStrokes(delta); + return Area.__super__.draw.call(this); + }; + + return Area; + +})(Epoch.Time.Stack); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Bar = (function(superClass) { + extend(Bar, superClass); + + function Bar(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.bar'; + } + Bar.__super__.constructor.call(this, this.options); + this.draw(); + } + + Bar.prototype._offsetX = function() { + return 0.5 * this.w() / this.pixelRatio; + }; + + Bar.prototype.setStyles = function(className) { + var styles; + styles = this.getStyles("rect.bar." + (className.replace(/\s/g, '.'))); + this.ctx.fillStyle = styles.fill; + if ((styles.stroke == null) || styles.stroke === 'none') { + this.ctx.strokeStyle = 'transparent'; + } else { + this.ctx.strokeStyle = styles.stroke; + } + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Bar.prototype.draw = function(delta) { + var args, entry, ex, ey, ey0, i, iBoundry, j, k, layer, len, ref, ref1, ref2, ref3, trans, w, y; + if (delta == null) { + delta = 0; + } + this.clear(); + ref = [this.y(), this.w()], y = ref[0], w = ref[1]; + ref1 = this.getVisibleLayers(); + for (j = 0, len = ref1.length; j < len; j++) { + layer = ref1[j]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + this.setStyles(layer.className); + ref2 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref2[0], k = ref2[1], trans = ref2[2]; + iBoundry = trans ? -1 : 0; + while ((--i >= iBoundry) && (--k >= 0)) { + entry = layer.values[k]; + ref3 = [i * w + delta, entry.y, entry.y0], ex = ref3[0], ey = ref3[1], ey0 = ref3[2]; + if (trans) { + ex += w; + } + args = [ex + 1, y(ey + ey0), w - 2, this.innerHeight() - y(ey) + 0.5 * this.pixelRatio]; + this.ctx.fillRect.apply(this.ctx, args); + this.ctx.strokeRect.apply(this.ctx, args); + } + } + return Bar.__super__.draw.call(this); + }; + + return Bar; + +})(Epoch.Time.Stack); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Gauge = (function(superClass) { + var defaults, optionListeners; + + extend(Gauge, superClass); + + defaults = { + type: 'time.gauge', + domain: [0, 1], + ticks: 10, + tickSize: 5, + tickOffset: 5, + fps: 34, + format: Epoch.Formats.percent + }; + + optionListeners = { + 'option:domain': 'domainChanged', + 'option:ticks': 'ticksChanged', + 'option:tickSize': 'tickSizeChanged', + 'option:tickOffset': 'tickOffsetChanged', + 'option:format': 'formatChanged' + }; + + function Gauge(options) { + this.options = options != null ? options : {}; + Gauge.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this.value = this.options.value || 0; + if (this.options.model) { + this.options.model.on('data:push', (function(_this) { + return function() { + return _this.pushFromModel(); + }; + })(this)); + } + if (this.el.style('position') !== 'absolute' && this.el.style('position') !== 'relative') { + this.el.style('position', 'relative'); + } + this.svg = this.el.insert('svg', ':first-child').attr('width', this.width).attr('height', this.height).attr('class', 'gauge-labels'); + this.svg.style({ + 'position': 'absolute', + 'z-index': '1' + }); + this.svg.append('g').attr('transform', "translate(" + (this.textX()) + ", " + (this.textY()) + ")").append('text').attr('class', 'value').text(this.options.format(this.value)); + this.animation = { + interval: null, + active: false, + delta: 0, + target: 0 + }; + this._animate = (function(_this) { + return function() { + if (Math.abs(_this.animation.target - _this.value) < Math.abs(_this.animation.delta)) { + _this.value = _this.animation.target; + clearInterval(_this.animation.interval); + _this.animation.active = false; + } else { + _this.value += _this.animation.delta; + } + _this.svg.select('text.value').text(_this.options.format(_this.value)); + return _this.draw(); + }; + })(this); + this.onAll(optionListeners); + this.draw(); + } + + Gauge.prototype.update = function(value) { + this.animation.target = value; + this.animation.delta = (value - this.value) / this.options.fps; + if (!this.animation.active) { + this.animation.interval = setInterval(this._animate, 1000 / this.options.fps); + return this.animation.active = true; + } + }; + + Gauge.prototype.push = function(value) { + return this.update(value); + }; + + Gauge.prototype.pushFromModel = function() { + var next; + next = this.options.model.getNext(this.options.type, this.options.dataFormat); + return this.update(next); + }; + + Gauge.prototype.radius = function() { + return this.getHeight() / 1.58; + }; + + Gauge.prototype.centerX = function() { + return this.getWidth() / 2; + }; + + Gauge.prototype.centerY = function() { + return 0.68 * this.getHeight(); + }; + + Gauge.prototype.textX = function() { + return this.width / 2; + }; + + Gauge.prototype.textY = function() { + return 0.48 * this.height; + }; + + Gauge.prototype.getAngle = function(value) { + var a, b, ref; + ref = this.options.domain, a = ref[0], b = ref[1]; + return ((value - a) / (b - a)) * (Math.PI + 2 * Math.PI / 8) - Math.PI / 2 - Math.PI / 8; + }; + + Gauge.prototype.setStyles = function(selector) { + var styles; + styles = this.getStyles(selector); + this.ctx.fillStyle = styles.fill; + this.ctx.strokeStyle = styles.stroke; + if (styles['stroke-width'] != null) { + return this.ctx.lineWidth = styles['stroke-width'].replace('px', ''); + } + }; + + Gauge.prototype.draw = function() { + var a, c, cx, cy, i, j, r, ref, ref1, ref2, ref3, s, t, tickOffset, tickSize, x1, x2, y1, y2; + ref = [this.centerX(), this.centerY(), this.radius()], cx = ref[0], cy = ref[1], r = ref[2]; + ref1 = [this.options.tickOffset, this.options.tickSize], tickOffset = ref1[0], tickSize = ref1[1]; + this.clear(); + t = d3.scale.linear().domain([0, this.options.ticks]).range([-(9 / 8) * Math.PI, Math.PI / 8]); + this.setStyles('.epoch .gauge .tick'); + this.ctx.beginPath(); + for (i = j = 0, ref2 = this.options.ticks; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { + a = t(i); + ref3 = [Math.cos(a), Math.sin(a)], c = ref3[0], s = ref3[1]; + x1 = c * (r - tickOffset) + cx; + y1 = s * (r - tickOffset) + cy; + x2 = c * (r - tickOffset - tickSize) + cx; + y2 = s * (r - tickOffset - tickSize) + cy; + this.ctx.moveTo(x1, y1); + this.ctx.lineTo(x2, y2); + } + this.ctx.stroke(); + this.setStyles('.epoch .gauge .arc.outer'); + this.ctx.beginPath(); + this.ctx.arc(cx, cy, r, -(9 / 8) * Math.PI, (1 / 8) * Math.PI, false); + this.ctx.stroke(); + this.setStyles('.epoch .gauge .arc.inner'); + this.ctx.beginPath(); + this.ctx.arc(cx, cy, r - 10, -(9 / 8) * Math.PI, (1 / 8) * Math.PI, false); + this.ctx.stroke(); + this.drawNeedle(); + return Gauge.__super__.draw.call(this); + }; + + Gauge.prototype.drawNeedle = function() { + var cx, cy, r, ratio, ref; + ref = [this.centerX(), this.centerY(), this.radius()], cx = ref[0], cy = ref[1], r = ref[2]; + ratio = this.value / this.options.domain[1]; + this.setStyles('.epoch .gauge .needle'); + this.ctx.beginPath(); + this.ctx.save(); + this.ctx.translate(cx, cy); + this.ctx.rotate(this.getAngle(this.value)); + this.ctx.moveTo(4 * this.pixelRatio, 0); + this.ctx.lineTo(-4 * this.pixelRatio, 0); + this.ctx.lineTo(-1 * this.pixelRatio, 19 - r); + this.ctx.lineTo(1, 19 - r); + this.ctx.fill(); + this.setStyles('.epoch .gauge .needle-base'); + this.ctx.beginPath(); + this.ctx.arc(0, 0, this.getWidth() / 25, 0, 2 * Math.PI); + this.ctx.fill(); + return this.ctx.restore(); + }; + + Gauge.prototype.domainChanged = function() { + return this.draw(); + }; + + Gauge.prototype.ticksChanged = function() { + return this.draw(); + }; + + Gauge.prototype.tickSizeChanged = function() { + return this.draw(); + }; + + Gauge.prototype.tickOffsetChanged = function() { + return this.draw(); + }; + + Gauge.prototype.formatChanged = function() { + return this.svg.select('text.value').text(this.options.format(this.value)); + }; + + return Gauge; + +})(Epoch.Chart.Canvas); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Heatmap = (function(superClass) { + var colorFunctions, defaults, optionListeners; + + extend(Heatmap, superClass); + + defaults = { + type: 'time.heatmap', + buckets: 10, + bucketRange: [0, 100], + opacity: 'linear', + bucketPadding: 2, + paintZeroValues: false, + cutOutliers: false + }; + + colorFunctions = { + root: function(value, max) { + return Math.pow(value / max, 0.5); + }, + linear: function(value, max) { + return value / max; + }, + quadratic: function(value, max) { + return Math.pow(value / max, 2); + }, + cubic: function(value, max) { + return Math.pow(value / max, 3); + }, + quartic: function(value, max) { + return Math.pow(value / max, 4); + }, + quintic: function(value, max) { + return Math.pow(value / max, 5); + } + }; + + optionListeners = { + 'option:buckets': 'bucketsChanged', + 'option:bucketRange': 'bucketRangeChanged', + 'option:opacity': 'opacityChanged', + 'option:bucketPadding': 'bucketPaddingChanged', + 'option:paintZeroValues': 'paintZeroValuesChanged', + 'option:cutOutliers': 'cutOutliersChanged' + }; + + function Heatmap(options) { + this.options = options != null ? options : {}; + Heatmap.__super__.constructor.call(this, this.options = Epoch.Util.defaults(this.options, defaults)); + this._setOpacityFunction(); + this._setupPaintCanvas(); + this.onAll(optionListeners); + this.draw(); + } + + Heatmap.prototype._setOpacityFunction = function() { + if (Epoch.isString(this.options.opacity)) { + this._opacityFn = colorFunctions[this.options.opacity]; + if (this._opacityFn == null) { + return Epoch.exception("Unknown coloring function provided '" + this.options.opacity + "'"); + } + } else if (Epoch.isFunction(this.options.opacity)) { + return this._opacityFn = this.options.opacity; + } else { + return Epoch.exception("Unknown type for provided coloring function."); + } + }; + + Heatmap.prototype.setData = function(data) { + var k, layer, len, ref, results; + Heatmap.__super__.setData.call(this, data); + ref = this.data; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + layer = ref[k]; + results.push(layer.values = layer.values.map((function(_this) { + return function(entry) { + return _this._prepareEntry(entry); + }; + })(this))); + } + return results; + }; + + Heatmap.prototype._getBuckets = function(entry) { + var bucketSize, count, i, index, k, prepared, ref, ref1, value; + prepared = { + time: entry.time, + max: 0, + buckets: (function() { + var k, ref, results; + results = []; + for (i = k = 0, ref = this.options.buckets; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) { + results.push(0); + } + return results; + }).call(this) + }; + bucketSize = (this.options.bucketRange[1] - this.options.bucketRange[0]) / this.options.buckets; + ref = entry.histogram; + for (value in ref) { + if (!hasProp.call(ref, value)) continue; + count = ref[value]; + index = parseInt((value - this.options.bucketRange[0]) / bucketSize); + if (this.options.cutOutliers && ((index < 0) || (index >= this.options.buckets))) { + continue; + } + if (index < 0) { + index = 0; + } else if (index >= this.options.buckets) { + index = this.options.buckets - 1; + } + prepared.buckets[index] += parseInt(count); + } + for (i = k = 0, ref1 = prepared.buckets.length; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) { + prepared.max = Math.max(prepared.max, prepared.buckets[i]); + } + return prepared; + }; + + Heatmap.prototype.y = function() { + return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight(), 0]); + }; + + Heatmap.prototype.ySvg = function() { + return d3.scale.linear().domain(this.options.bucketRange).range([this.innerHeight() / this.pixelRatio, 0]); + }; + + Heatmap.prototype.h = function() { + return this.innerHeight() / this.options.buckets; + }; + + Heatmap.prototype._offsetX = function() { + return 0.5 * this.w() / this.pixelRatio; + }; + + Heatmap.prototype._setupPaintCanvas = function() { + this.paintWidth = (this.options.windowSize + 1) * this.w(); + this.paintHeight = this.height * this.pixelRatio; + this.paint = document.createElement('CANVAS'); + this.paint.width = this.paintWidth; + this.paint.height = this.paintHeight; + this.p = Epoch.Util.getContext(this.paint); + this.redraw(); + this.on('after:shift', '_paintEntry'); + this.on('transition:end', '_shiftPaintCanvas'); + return this.on('transition:end', (function(_this) { + return function() { + return _this.draw(_this.animation.frame * _this.animation.delta()); + }; + })(this)); + }; + + Heatmap.prototype.redraw = function() { + var drawColumn, entryIndex; + if (!(Epoch.isNonEmptyArray(this.data) && Epoch.isNonEmptyArray(this.data[0].values))) { + return; + } + entryIndex = this.data[0].values.length; + drawColumn = this.options.windowSize; + if (this.inTransition()) { + drawColumn++; + } + while ((--entryIndex >= 0) && (--drawColumn >= 0)) { + this._paintEntry(entryIndex, drawColumn); + } + return this.draw(this.animation.frame * this.animation.delta()); + }; + + Heatmap.prototype._computeColor = function(value, max, color) { + return Epoch.Util.toRGBA(color, this._opacityFn(value, max)); + }; + + Heatmap.prototype._paintEntry = function(entryIndex, drawColumn) { + var bucket, bucketTotals, color, count, entries, entry, h, i, j, k, layer, len, len1, m, max, maxTotal, ref, ref1, ref2, results, styles, sum, w, xPos; + if (entryIndex == null) { + entryIndex = null; + } + if (drawColumn == null) { + drawColumn = null; + } + ref = [this.w(), this.h()], w = ref[0], h = ref[1]; + if (entryIndex == null) { + entryIndex = this.data[0].values.length - 1; + } + if (drawColumn == null) { + drawColumn = this.options.windowSize; + } + entries = []; + bucketTotals = (function() { + var k, ref1, results; + results = []; + for (i = k = 0, ref1 = this.options.buckets; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) { + results.push(0); + } + return results; + }).call(this); + maxTotal = 0; + ref1 = this.getVisibleLayers(); + for (k = 0, len = ref1.length; k < len; k++) { + layer = ref1[k]; + entry = this._getBuckets(layer.values[entryIndex]); + ref2 = entry.buckets; + for (bucket in ref2) { + if (!hasProp.call(ref2, bucket)) continue; + count = ref2[bucket]; + bucketTotals[bucket] += count; + } + maxTotal += entry.max; + styles = this.getStyles("." + (layer.className.split(' ').join('.')) + " rect.bucket"); + entry.color = styles.fill; + entries.push(entry); + } + xPos = drawColumn * w; + this.p.clearRect(xPos, 0, w, this.paintHeight); + j = this.options.buckets; + results = []; + for (bucket in bucketTotals) { + if (!hasProp.call(bucketTotals, bucket)) continue; + sum = bucketTotals[bucket]; + color = this._avgLab(entries, bucket); + max = 0; + for (m = 0, len1 = entries.length; m < len1; m++) { + entry = entries[m]; + max += (entry.buckets[bucket] / sum) * maxTotal; + } + if (sum > 0 || this.options.paintZeroValues) { + this.p.fillStyle = this._computeColor(sum, max, color); + this.p.fillRect(xPos, (j - 1) * h, w - this.options.bucketPadding, h - this.options.bucketPadding); + } + results.push(j--); + } + return results; + }; + + Heatmap.prototype._shiftPaintCanvas = function() { + var data; + data = this.p.getImageData(this.w(), 0, this.paintWidth - this.w(), this.paintHeight); + return this.p.putImageData(data, 0, 0); + }; + + Heatmap.prototype._avgLab = function(entries, bucket) { + var a, b, color, entry, i, k, l, len, ratio, ref, total, value; + ref = [0, 0, 0, 0], l = ref[0], a = ref[1], b = ref[2], total = ref[3]; + for (k = 0, len = entries.length; k < len; k++) { + entry = entries[k]; + if (entry.buckets[bucket] == null) { + continue; + } + total += entry.buckets[bucket]; + } + for (i in entries) { + if (!hasProp.call(entries, i)) continue; + entry = entries[i]; + if (entry.buckets[bucket] != null) { + value = entry.buckets[bucket] | 0; + } else { + value = 0; + } + ratio = value / total; + color = d3.lab(entry.color); + l += ratio * color.l; + a += ratio * color.a; + b += ratio * color.b; + } + return d3.lab(l, a, b).toString(); + }; + + Heatmap.prototype.draw = function(delta) { + if (delta == null) { + delta = 0; + } + this.clear(); + this.ctx.drawImage(this.paint, delta, 0); + return Heatmap.__super__.draw.call(this); + }; + + Heatmap.prototype.bucketsChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.bucketRangeChanged = function() { + this._transitionRangeAxes(); + return this.redraw(); + }; + + Heatmap.prototype.opacityChanged = function() { + this._setOpacityFunction(); + return this.redraw(); + }; + + Heatmap.prototype.bucketPaddingChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.paintZeroValuesChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.cutOutliersChanged = function() { + return this.redraw(); + }; + + Heatmap.prototype.layerChanged = function() { + return this.redraw(); + }; + + return Heatmap; + +})(Epoch.Time.Plot); + +var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Epoch.Time.Line = (function(superClass) { + extend(Line, superClass); + + function Line(options) { + var base; + this.options = options != null ? options : {}; + if ((base = this.options).type == null) { + base.type = 'time.line'; + } + Line.__super__.constructor.call(this, this.options); + this.draw(); + } + + Line.prototype.setStyles = function(className) { + var styles; + styles = this.getStyles("g." + (className.replace(/\s/g, '.')) + " path.line"); + this.ctx.fillStyle = styles.fill; + this.ctx.strokeStyle = styles.stroke; + return this.ctx.lineWidth = this.pixelRatio * styles['stroke-width'].replace('px', ''); + }; + + Line.prototype.draw = function(delta) { + var args, entry, i, j, k, layer, len, ref, ref1, trans, w, y; + if (delta == null) { + delta = 0; + } + this.clear(); + w = this.w(); + ref = this.getVisibleLayers(); + for (j = 0, len = ref.length; j < len; j++) { + layer = ref[j]; + if (!Epoch.isNonEmptyArray(layer.values)) { + continue; + } + this.setStyles(layer.className); + this.ctx.beginPath(); + y = this.y(layer.range); + ref1 = [this.options.windowSize, layer.values.length, this.inTransition()], i = ref1[0], k = ref1[1], trans = ref1[2]; + while ((--i >= -2) && (--k >= 0)) { + entry = layer.values[k]; + args = [(i + 1) * w + delta, y(entry.y)]; + if (trans) { + args[0] += w; + } + if (i === this.options.windowSize - 1) { + this.ctx.moveTo.apply(this.ctx, args); + } else { + this.ctx.lineTo.apply(this.ctx, args); + } + } + this.ctx.stroke(); + } + return Line.__super__.draw.call(this); + }; + + return Line; + +})(Epoch.Time.Plot); + +Epoch._typeMap = { + 'area': Epoch.Chart.Area, + 'bar': Epoch.Chart.Bar, + 'line': Epoch.Chart.Line, + 'pie': Epoch.Chart.Pie, + 'scatter': Epoch.Chart.Scatter, + 'histogram': Epoch.Chart.Histogram, + 'time.area': Epoch.Time.Area, + 'time.bar': Epoch.Time.Bar, + 'time.line': Epoch.Time.Line, + 'time.gauge': Epoch.Time.Gauge, + 'time.heatmap': Epoch.Time.Heatmap +}; + +var jQueryModule; + +jQueryModule = function($) { + var DATA_NAME; + DATA_NAME = 'epoch-chart'; + return $.fn.epoch = function(options) { + var chart, klass; + options.el = this.get(0); + if ((chart = this.data(DATA_NAME)) == null) { + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + this.data(DATA_NAME, (chart = new klass(options))); + } + return chart; + }; +}; + +if (window.jQuery != null) { + jQueryModule(jQuery); +} + +var MooToolsModule; + +MooToolsModule = function() { + var DATA_NAME; + DATA_NAME = 'epoch-chart'; + return Element.implement('epoch', function(options) { + var chart, klass, self; + self = $$(this); + if ((chart = self.retrieve(DATA_NAME)[0]) == null) { + options.el = this; + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + self.store(DATA_NAME, (chart = new klass(options))); + } + return chart; + }); +}; + +if (window.MooTools != null) { + MooToolsModule(); +} + +var zeptoModule; + +zeptoModule = function($) { + var DATA_NAME, chartId, chartMap, next_cid; + DATA_NAME = 'epoch-chart'; + chartMap = {}; + chartId = 0; + next_cid = function() { + return DATA_NAME + "-" + (++chartId); + }; + return $.extend($.fn, { + epoch: function(options) { + var chart, cid, klass; + if ((cid = this.data(DATA_NAME)) != null) { + return chartMap[cid]; + } + options.el = this.get(0); + klass = Epoch._typeMap[options.type]; + if (klass == null) { + Epoch.exception("Unknown chart type '" + options.type + "'"); + } + this.data(DATA_NAME, (cid = next_cid())); + chart = new klass(options); + chartMap[cid] = chart; + return chart; + } + }); +}; + +if (window.Zepto != null) { + zeptoModule(Zepto); +} diff --git a/JarvisControl/package.json b/SystemControl/build/debug/package.json similarity index 51% rename from JarvisControl/package.json rename to SystemControl/build/debug/package.json index 96cffbf..af4b316 100644 --- a/JarvisControl/package.json +++ b/SystemControl/build/debug/package.json @@ -1,16 +1,19 @@ { - "pkgname": "JarvisControl", - "app":"JarvisControl", + "pkgname": "SystemMonitor", + "app":"SystemMonitor", "name":"Jarvis monitoring", "services": [ - "JarvisService" + "SysmondService" ], - "description":"JarvisControl", + "description":"System monitoring", "info":{ "author": "", "email": "" }, - "version":"0.1.3-a", + "dependencies": [ + "Antunnel@0.1.8-a" + ], + "version":"0.1.4-a", "category":"Other", "iconclass":"fa fa-android", "mimes":["none"], diff --git a/SystemControl/build/debug/scheme.html b/SystemControl/build/debug/scheme.html new file mode 100644 index 0000000..6d6f3b7 --- /dev/null +++ b/SystemControl/build/debug/scheme.html @@ -0,0 +1,33 @@ + + + + +
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+ +
+
+ + +
+
+
+
+ +
+
\ No newline at end of file diff --git a/SystemControl/coffees/SysmondService.coffee b/SystemControl/coffees/SysmondService.coffee new file mode 100644 index 0000000..09da3ca --- /dev/null +++ b/SystemControl/coffees/SysmondService.coffee @@ -0,0 +1,77 @@ +class SysmondService extends OS.application.BaseService + constructor: (args) -> + super "SysmondService", args + @text = __("{0}%", 0.toString()) + @iconclass = "fa fa-android" + @app = undefined + #@nodes = [ + # {text: __("Status"), id: 1}, + # {text: __("Shutdown"), id: 3}, + # {text: __("Reboot"), id: 4}, + # {text: __("Exit service"), id: 2} + #] + @onmenuselect = (e) => @openApp() + + init: () -> + checklib = () => + if not Antunnel.tunnel + @error __("The Antunnel service is not started, please start it first") + @_gui.pushService("Antunnel/AntunnelService") + .catch (e) => + @error e.toString(), e + @quit() + else + @tunnel = Antunnel.tunnel + @sub = new Antunnel.Subscriber("fbf070ddea3ea90d07f456540b405d302554ec82") + @sub.onopen = () => + #@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") + console.log("Subscribed to notification channel") + + @sub.onerror = (e) => + @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e + #@sub = undefined + + @sub.onmessage = (e) => + obj = JSON.parse(new TextDecoder("utf-8").decode(e.data)) if e.data + # update the battery + @text = __("{0}%", Math.round(obj.battery_percent).toString()) + @app.feed obj if @app + @update() + + @sub.onclose = () => + @sub = undefined + @notify __("Unsubscribed to the notification service") + @quit() + Antunnel.tunnel.subscribe @sub + + checklib() + + + openApp: () -> + return if @app + @_gui.launch "SystemControl", [] + + + execute: (cmd) -> + #return unless @tunnel + #sub = new Antunnel.Subscriber("jarvis_control") + #sub.onopen = () => + # console.log("Subscribed to jarvis_control channel. Send the command") + # sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(cmd) + # sub.close() + + #sub.onerror = (e) => + # @error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e + #@sub = undefined + + #sub.onclose = () => + # @notify __("Unsubscribed to the jarvis_control service") + #@tunnel.subscribe sub + + awake: () -> + + cleanup: () -> + @sub.close() if @sub + + +this.OS.register "SysmondService", SysmondService \ No newline at end of file diff --git a/SystemControl/coffees/main.coffee b/SystemControl/coffees/main.coffee new file mode 100644 index 0000000..15f4d18 --- /dev/null +++ b/SystemControl/coffees/main.coffee @@ -0,0 +1,146 @@ + + +class SystemControl extends this.OS.application.BaseApplication + constructor: ( args ) -> + super "SystemControl", args + + main: () -> + @diskchart = $(@find("disk-area")).epoch({ + type: 'time.gauge', + value: 0 + }); + @on "resize", () => + el = @find("cpu-area") + if @cpu + $(el).children().hide() + @cpu.option("width", $(el).width()) + @cpu.option("height", $(el).height()) + $(el).children().show() + el = @find("battery-area") + + el = @find("memory-area") + if @memory + $(el).children().hide() + @memory.option("width", $(el).width()) + @memory.option("height", $(el).height()) + $(el).children().show() + + el = @find("network-area") + if @network + $(el).children().hide() + @network.option("width", $(el).width()) + @network.option("height", $(el).height()) + $(el).children().show() + + el = @find("temp-area") + if @temp + $(el).children().hide() + @temp.option("width", $(el).width()) + @temp.option("height", $(el).height()) + $(el).children().show() + + el = @find("battery-area") + if @battery + $(el).children().hide() + @battery.option("width", $(el).width()) + @battery.option("height", $(el).height()) + $(el).children().show() + + @_gui.pushService("SystemControl/SysmondService", []) + .then (p) => + @service = p + p.app = @ + .catch (e) => + @error __("Unable to start sysmond service"), e + + streamline: (name, data, range, labels) -> + i = 0 + legend = $(@find("#{name}-text")) + if not @[name] + options = { + type: 'time.line', + axes: ['bottom', 'left', "right"] + } + options.range = range if range + dobj = [] + for item in data + dobj.push { label: "label-#{i}", values: [] } + $("
") + .addClass('legend-color') + .addClass('ref') + .addClass('category' + (i+1)) + .appendTo(legend) + $("
") + .addClass('legend-label') + .appendTo(legend) + .text(if labels then labels[i] else "#{name}-#{i}") + $("
") + .addClass('legend-value') + .appendTo(legend) + i = i + 1 + options.data =dobj + @[name] = $(@find("#{name}-area")).epoch(options) + + for item in data + $(legend.children()[i*3 + 2]).text( item.y.toString() ) + i = i + 1 + @[name].push data + + feed: (data) -> + #mem_percent = parseFloat(data.mem.match(/([0-9\.]+)%/)[1]) + #@memchart.push mem_percent / 100.0 + #@find("mem-text").text = data.mem + + disk_used = data.disk_total - data.disk_free + @diskchart.push(disk_used / data.disk_total) + @find("disk-text").text = "Disk: " + (Math.round(disk_used / 1024 / 1024 / 1024)) + "/" + (Math.round(data.disk_total / 1024 / 1024 / 1024)) + " GB" + + now = data.stamp_sec + + data.cpu_usages.shift() + cpu_data = ({ time: now, y: v.toFixed(2) } for v in data.cpu_usages) + @streamline "cpu", cpu_data, [0, 100] + + total_mem = data.mem_total / 1024.0 / 1024.0 + used_mem = data.mem_used / 1024.0 / 1024.0 + total_swap = data.mem_swap_total / 1024.0 / 1024.0 + used_swap = (data.mem_swap_total - data.mem_swap_free) / 1024.0 / 1024.0 + mem_data = [ + { time: now, y: used_mem.toFixed(3)}, + { time: now, y: used_swap.toFixed(3)} + ] + mem_range = [0, if total_mem > total_swap then total_mem else total_swap] + @streamline "memory", mem_data, mem_range, ["RAM (GB)", "SWAP (GB)"] + + net_rx = 0 + net_tx = 0 + + net_rx = net_rx + v.rx_rate for v in data.net + net_tx = net_tx + v.tx_rate for v in data.net + net_data = [ + { time: now, y: (net_rx / 1024.0).toFixed(3)}, + { time: now, y: (net_tx / 1024.0).toFixed(3)} + ] + @streamline "network", net_data, undefined, ["RX (Kb/s)", "TX (Kb/s)"] + + + temp_data = [ + { time: now, y: (data.cpu_temp / 1000.0).toFixed(2)}, + { time: now, y: (data.gpu_temp / 1000.0).toFixed(2)} + ] + @streamline "temp", temp_data, undefined, ["CPU temp (C)", "GPU temp (C)"] + + battery_range = [ + (data.battery_min_voltage / 1000.0).toFixed(2), + (data.battery_max_voltage / 1000.0).toFixed(2)] + @streamline "battery", [ { time: now, y: (data.battery/ 1000.0).toFixed(2)} ], battery_range, ["Baterry (v)"] + cleanup: () -> + return unless @service + @service.app = undefined + @service = undefined + +SystemControl.singleton = true +SystemControl.dependencies = [ + "pkg://Antunnel/main.js" +] +this.OS.register "SystemControl", SystemControl \ No newline at end of file diff --git a/JarvisControl/css/epoch.css b/SystemControl/css/epoch.css similarity index 100% rename from JarvisControl/css/epoch.css rename to SystemControl/css/epoch.css diff --git a/SystemControl/css/main.css b/SystemControl/css/main.css new file mode 100644 index 0000000..897bbed --- /dev/null +++ b/SystemControl/css/main.css @@ -0,0 +1,38 @@ +afx-app-window[data-id="SystemControl"] .legend-color { + display: block; + height: 20px; + width: 20px; + border-radius: 25px; +} +afx-app-window[data-id="SystemControl"] .afx-window-content { + color: black; + background-color: whitesmoke; +} + +afx-app-window[data-id="SystemControl"] afx-label[data-id="disk-text"] i.label-text +{ + font-weight: bold; + padding-left: 10px; +} + + +afx-app-window[data-id="SystemControl"] .legend +{ + padding-left: 20px; +} +afx-app-window[data-id="SystemControl"] .legend div { + float: left; + font-size: 12px; + margin-right: 3px; +} + +afx-app-window[data-id="SystemControl"] .legend div.legend-label { + padding-top: 3px; + font-weight: bold; +} + +afx-app-window[data-id="SystemControl"] .legend div.legend-value { + padding-top: 4px; + margin-right: 5px; + min-width: 30px; +} \ No newline at end of file diff --git a/JarvisControl/javascripts/d3.v3.js b/SystemControl/javascripts/d3.v3.js similarity index 100% rename from JarvisControl/javascripts/d3.v3.js rename to SystemControl/javascripts/d3.v3.js diff --git a/JarvisControl/javascripts/d3.v5.js b/SystemControl/javascripts/d3.v5.js similarity index 100% rename from JarvisControl/javascripts/d3.v5.js rename to SystemControl/javascripts/d3.v5.js diff --git a/JarvisControl/javascripts/epoch.js b/SystemControl/javascripts/epoch.js similarity index 100% rename from JarvisControl/javascripts/epoch.js rename to SystemControl/javascripts/epoch.js diff --git a/JarvisControl/build/debug/package.json b/SystemControl/package.json similarity index 51% rename from JarvisControl/build/debug/package.json rename to SystemControl/package.json index 96cffbf..af4b316 100644 --- a/JarvisControl/build/debug/package.json +++ b/SystemControl/package.json @@ -1,16 +1,19 @@ { - "pkgname": "JarvisControl", - "app":"JarvisControl", + "pkgname": "SystemMonitor", + "app":"SystemMonitor", "name":"Jarvis monitoring", "services": [ - "JarvisService" + "SysmondService" ], - "description":"JarvisControl", + "description":"System monitoring", "info":{ "author": "", "email": "" }, - "version":"0.1.3-a", + "dependencies": [ + "Antunnel@0.1.8-a" + ], + "version":"0.1.4-a", "category":"Other", "iconclass":"fa fa-android", "mimes":["none"], diff --git a/SystemControl/project.json b/SystemControl/project.json new file mode 100644 index 0000000..88f68ad --- /dev/null +++ b/SystemControl/project.json @@ -0,0 +1,7 @@ +{ + "name": "SystemControl", + "css": ["css/epoch.css", "css/main.css"], + "javascripts": ["javascripts/d3.v3.js", "javascripts/epoch.js"], + "coffees": ["coffees/SysmondService.coffee", "coffees/main.coffee"], + "copies": ["assets/scheme.html", "package.json", "README.md"] +} \ No newline at end of file