@d3plus/core 3.0.10 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -57
- package/es/src/charts/Viz.js +46 -40
- package/es/src/charts/drawSteps/drawColorScale.js +7 -2
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +42 -41
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +173 -176
- package/umd/d3plus-core.js +41 -40
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +11 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.12
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
@summary Parses numbers and strings to valid Javascript Date objects.
|
|
49
49
|
@description Returns a javascript Date object for a given a Number (representing either a 4-digit year or milliseconds since epoch), a String representing a Quarter (ie. "Q2 1987", mapping to the last day in that quarter), or a String that is in [valid dateString format](http://dygraphs.com/date-formats.html). Besides the 4-digit year parsing, this function is useful when needing to parse negative (BC) years, which the vanilla Date object cannot parse.
|
|
50
50
|
@param {Number|String} *date*
|
|
51
|
-
*/function
|
|
51
|
+
*/function Nt(t){
|
|
52
52
|
// returns if falsey or already Date object
|
|
53
53
|
var n,e,i,a;return[!1,void 0,NaN].includes(t)||t.constructor===Date?t:t.constructor===Number&&5<"".concat(t).length&&t%1==0?new Date(t):(n="".concat(t),(a=new RegExp(/^\d{1,2}[./-]\d{1,2}[./-](-*\d{1,4})$/g).exec(n))?(0===(a=a[1]).indexOf("-")&&(n=n.replace(a,a.substring(1))),(i=new Date(n)).setFullYear(a),i):(a=new RegExp(/^[A-z]{1,3} [A-z]{1,3} \d{1,2} (-*\d{1,4}) \d{1,2}:\d{1,2}:\d{1,2} [A-z]{1,3}-*\d{1,4} \([A-z]{1,3}\)/g).exec(n))?(0===(i=a[1]).indexOf("-")&&(n=n.replace(i,i.substring(1))),(a=new Date(n)).setFullYear(i),a):(i=new RegExp(/^([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})[\s|-]{0,1}(-*\d{1,4})$/g).exec(n),a=new RegExp(/^(-*\d{1,4})[\s|-]{0,1}([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})$/g).exec(n),i||a?(e=+(i?i[1]:a[2]).toLowerCase().replace("q",""),i=+(i?i[2]:a[1]),(a=new Date(i,3*e-3,1)).setFullYear(i),a):(e=new RegExp(/^([-*\d]{1,2})\-(-*\d{1,4})$/g).exec(n),i=new RegExp(/^(-*\d{1,4})\-([-*\d]{1,2})$/g).exec(n),e||i?(a=+(e?e[1]:i[2]),e=+(e?e[2]:i[1]),(i=new Date(e,a-1,1)).setFullYear(e),i):
|
|
54
54
|
// detects if only passing a year value
|
|
@@ -124,8 +124,8 @@ delete o.__transition}o=t,s=e,l={name:n,index:i,group:a,on:Zt,tween:Jt,time:r.ti
|
|
|
124
124
|
// Note the actual delay is not known until the first callback!
|
|
125
125
|
(u=o.__transition)[s]=l).timer=qt(function(t){l.state=tn,l.timer.restart(g,l.delay,l.time),
|
|
126
126
|
// If the elapsed delay is less than our first sleep, start immediately.
|
|
127
|
-
l.delay<=t&&g(t-l.delay)},0,l.time)}function ln(t,n){t=un(t,n);if(t.state>Qt)throw new Error("too late; already scheduled");return t}function hn(t,n){t=un(t,n);if(t.state>en)throw new Error("too late; already running");return t}function un(t,n){t=t.__transition;if(t=t&&t[n])return t;throw new Error("transition not found")}function cn(t,n){var e,i,a,r=t.__transition,o=!0;if(r){for(a in n=null==n?null:n+"",r)(e=r[a]).name!==n?o=!1:(i=nn<e.state&&e.state<rn,e.state=on,e.timer.stop(),e.on.call(i?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete r[a]);o&&delete t.__transition}}function gn(t,n,e){(t.prototype=n.prototype=e).constructor=t}function dn(t,n){var e,i=Object.create(t.prototype);for(e in n)i[e]=n[e];return i}function fn(){}var pn="\\s*([+-]?\\d+)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yn=/^#([0-9a-f]{3,8})$/,vn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),bn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),xn=new RegExp(`^rgba\\(${pn},${pn},${pn},${_n}\\)$`),wn=new RegExp(`^rgba\\(${mn},${mn},${mn},${_n}\\)$`),Sn=new RegExp(`^hsl\\(${_n},${mn},${mn}\\)$`),kn=new RegExp(`^hsla\\(${_n},${mn},${mn},${_n}\\)$`),Cn={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};function Mn(){return this.rgb().formatHex()}function An(){return this.rgb().formatRgb()}function zn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=yn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Tn(n):3===e?new
|
|
128
|
-
/* From FvD 13.37, CSS Color Module Level 3 */function Un(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}gn(fn,zn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return In(this).formatHsl()},formatRgb:An,toString:An}),gn(Nn,
|
|
127
|
+
l.delay<=t&&g(t-l.delay)},0,l.time)}function ln(t,n){t=un(t,n);if(t.state>Qt)throw new Error("too late; already scheduled");return t}function hn(t,n){t=un(t,n);if(t.state>en)throw new Error("too late; already running");return t}function un(t,n){t=t.__transition;if(t=t&&t[n])return t;throw new Error("transition not found")}function cn(t,n){var e,i,a,r=t.__transition,o=!0;if(r){for(a in n=null==n?null:n+"",r)(e=r[a]).name!==n?o=!1:(i=nn<e.state&&e.state<rn,e.state=on,e.timer.stop(),e.on.call(i?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete r[a]);o&&delete t.__transition}}function gn(t,n,e){(t.prototype=n.prototype=e).constructor=t}function dn(t,n){var e,i=Object.create(t.prototype);for(e in n)i[e]=n[e];return i}function fn(){}var pn="\\s*([+-]?\\d+)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yn=/^#([0-9a-f]{3,8})$/,vn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),bn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),xn=new RegExp(`^rgba\\(${pn},${pn},${pn},${_n}\\)$`),wn=new RegExp(`^rgba\\(${mn},${mn},${mn},${_n}\\)$`),Sn=new RegExp(`^hsl\\(${_n},${mn},${mn}\\)$`),kn=new RegExp(`^hsla\\(${_n},${mn},${mn},${_n}\\)$`),Cn={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};function Mn(){return this.rgb().formatHex()}function An(){return this.rgb().formatRgb()}function zn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=yn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Tn(n):3===e?new Pn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?En(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?En(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=vn.exec(t))?new Pn(n[1],n[2],n[3],1):(n=bn.exec(t))?new Pn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=xn.exec(t))?En(n[1],n[2],n[3],n[4]):(n=wn.exec(t))?En(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Sn.exec(t))?Rn(n[1],n[2]/100,n[3]/100,1):(n=kn.exec(t))?Rn(n[1],n[2]/100,n[3]/100,n[4]):Cn.hasOwnProperty(t)?Tn(Cn[t]):"transparent"===t?new Pn(NaN,NaN,NaN,0):null}function Tn(t){return new Pn(t>>16&255,t>>8&255,255&t,1)}function En(t,n,e,i){return new Pn(t=i<=0?n=e=NaN:t,n,e,i)}function Nn(t,n,e,i){return 1===arguments.length?(a=(a=t)instanceof fn?a:zn(a))?new Pn((a=a.rgb()).r,a.g,a.b,a.opacity):new Pn:new Pn(t,n,e,null==i?1:i);var a}function Pn(t,n,e,i){this.r=+t,this.g=+n,this.b=+e,this.opacity=+i}function Ln(){return"#"+jn(this.r)+jn(this.g)+jn(this.b)}function Bn(){var t=On(this.opacity);return(1===t?"rgb(":"rgba(")+Dn(this.r)+`, ${Dn(this.g)}, `+Dn(this.b)+(1===t?")":`, ${t})`)}function On(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Dn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function jn(t){return((t=Dn(t))<16?"0":"")+t.toString(16)}function Rn(t,n,e,i){return i<=0?t=n=e=NaN:e<=0||1<=e?t=n=NaN:n<=0&&(t=NaN),new Hn(t,n,e,i)}function In(t){var n,e,i,a,r,o,s,l;return t instanceof Hn?new Hn(t.h,t.s,t.l,t.opacity):(t=t instanceof fn?t:zn(t))?t instanceof Hn?t:(n=(t=t.rgb()).r/255,e=t.g/255,i=t.b/255,a=Math.min(n,e,i),o=NaN,l=((r=Math.max(n,e,i))+a)/2,(s=r-a)?(o=n===r?(e-i)/s+6*(e<i):e===r?(i-n)/s+2:(n-e)/s+4,s/=l<.5?r+a:2-r-a,o*=60):s=0<l&&l<1?0:o,new Hn(o,s,l,t.opacity)):new Hn}function Fn(t,n,e,i){return 1===arguments.length?In(t):new Hn(t,n,e,null==i?1:i)}function Hn(t,n,e,i){this.h=+t,this.s=+n,this.l=+e,this.opacity=+i}function Gn(t){return(t=(t||0)%360)<0?t+360:t}function Kn(t){return Math.max(0,Math.min(1,t||0))}
|
|
128
|
+
/* From FvD 13.37, CSS Color Module Level 3 */function Un(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}gn(fn,zn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return In(this).formatHsl()},formatRgb:An,toString:An}),gn(Pn,Nn,dn(fn,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Pn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Pn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Pn(Dn(this.r),Dn(this.g),Dn(this.b),On(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return"#"+jn(this.r)+jn(this.g)+jn(this.b)+jn(255*(isNaN(this.opacity)?1:this.opacity))},formatRgb:Bn,toString:Bn})),gn(Hn,Fn,dn(fn,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*n,e=2*e-n;return new Pn(Un(240<=t?t-240:120+t,e,n),Un(t,e,n),Un(t<120?240+t:t-120,e,n),this.opacity)},clamp(){return new Hn(Gn(this.h),Kn(this.s),Kn(this.l),On(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){var t=On(this.opacity);return(1===t?"hsl(":"hsla(")+Gn(this.h)+`, ${100*Kn(this.s)}%, ${100*Kn(this.l)}%`+(1===t?")":`, ${t})`)}}));var Wn=t=>()=>t;function qn(r){return 1==(r=+r)?$n:function(t,n){return n-t?(e=t,i=n,a=r,e=Math.pow(e,a),i=Math.pow(i,a)-e,a=1/a,function(t){return Math.pow(e+t*i,a)}):Wn(isNaN(t)?n:t);var e,i,a}}function $n(t,n){var e,i,a=n-t;return a?(e=t,i=a,function(t){return e+t*i}):Wn(isNaN(t)?n:t)}var Vn=function t(n){var o=qn(n);function e(n,t){var e=o((n=Nn(n)).r,(t=Nn(t)).r),i=o(n.g,t.g),a=o(n.b,t.b),r=$n(n.opacity,t.opacity);return function(t){return n.r=e(t),n.g=i(t),n.b=a(t),n.opacity=r(t),n+""}}return e.gamma=t,e}(1);function Yn(n,e){e=e||[];var i,a=n?Math.min(e.length,n.length):0,r=e.slice();return function(t){for(i=0;i<a;++i)r[i]=n[i]*(1-t)+e[i]*t;return r}}function Xn(t,n){for(var e=n?n.length:0,i=t?Math.min(e,t.length):0,a=new Array(i),r=new Array(e),o=0;o<i;++o)a[o]=ie(t[o],n[o]);for(;o<e;++o)r[o]=n[o];return function(t){for(o=0;o<i;++o)r[o]=a[o](t);return r}}function Zn(n,e){var i=new Date;return n=+n,e=+e,function(t){return i.setTime(n*(1-t)+e*t),i}}function Jn(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}function Qn(t,n){var e,i={},a={};for(e in null!==t&&"object"==typeof t||(t={}),n=null!==n&&"object"==typeof n?n:{})e in t?i[e]=ie(t[e],n[e]):a[e]=n[e];return function(t){for(e in i)a[e]=i[e](t);return a}}var te=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ne=new RegExp(te.source,"g");function ee(t,i){var n,e,a,r,o,s=te.lastIndex=ne.lastIndex=0,l=-1,h=[],u=[];// number interpolators
|
|
129
129
|
// Coerce inputs to strings.
|
|
130
130
|
// Interpolate pairs of numbers in a & b.
|
|
131
131
|
for(t+="",i+="";(n=te.exec(t))&&(e=ne.exec(i));)(a=e.index)>s&&(a=i.slice(s,a),h[l]?h[l]+=a:h[++l]=a),(n=n[0])===(e=e[0])?h[l]?h[l]+=e:h[++l]=e:(h[++l]=null,u.push({i:l,x:Jn(n,e)})),s=ne.lastIndex;
|
|
@@ -175,7 +175,7 @@ n!==a&&((r=(a=n).copy())._.cancel.push(e),r._.interrupt.push(e),r._.end.push(i))
|
|
|
175
175
|
@param {D3Selection} [params.parent = d3.select("body")] The parent element for this new element to be appended to.
|
|
176
176
|
@param {Number} [params.duration = 0] The duration for the d3 transition.
|
|
177
177
|
@param {Object} [params.update = {}] A collection of key/value pairs that map to attributes to be given on update.
|
|
178
|
-
*/function
|
|
178
|
+
*/function Pt(t,n){
|
|
179
179
|
// overrides default params
|
|
180
180
|
n=Object.assign({},{condition:!0,enter:{},exit:{},duration:0,parent:H("body"),update:{}},n);var e=/\.([^#]+)/g.exec(t),i=/#([^.]+)/g.exec(t),a=ke().duration(n.duration),r=/^([^.^#]+)/g.exec(t)[1],t=n.parent.selectAll(t.includes(":")?t.split(":")[1]:t).data(n.condition?[null]:[]),r=t.enter().append(r).call(f,n.enter),i=(i&&r.attr("id",i[1]),e&&r.attr("class",e[1]),(n.duration?t.exit().transition(a):t.exit()).call(f,n.exit).remove(),r.merge(t));return(n.duration?i.transition(a):i).call(f,n.update),i}
|
|
181
181
|
/**
|
|
@@ -205,20 +205,20 @@ n=Object.assign({},{condition:!0,enter:{},exit:{},duration:0,parent:H("body"),up
|
|
|
205
205
|
@param {String} value
|
|
206
206
|
*/var n,e;return void 0===t?t="undefined":"string"==typeof t||(n=t,null!=(e=String)&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?e[Symbol.hasInstance](n):n instanceof e)||(t=JSON.stringify(t)),t}
|
|
207
207
|
// great unicode list: http://asecuritysite.com/coding/asc2
|
|
208
|
-
var Pe,
|
|
208
|
+
var Ne,Pe,Le,Be,Oe,De,je=[[/[\300-\305]/g,"A"],[/[\340-\345]/g,"a"],[/[\306]/g,"AE"],[/[\346]/g,"ae"],[/[\337]/g,"B"],[/[\307]/g,"C"],[/[\347]/g,"c"],[/[\320\336\376]/g,"D"],[/[\360]/g,"d"],[/[\310-\313]/g,"E"],[/[\350-\353]/g,"e"],[/[\314-\317]/g,"I"],[/[\354-\357]/g,"i"],[/[\321]/g,"N"],[/[\361]/g,"n"],[/[\u014c\322-\326\330]/g,"O"],[/[\u014d\362-\366\370]/g,"o"],[/[\u016a\331-\334]/g,"U"],[/[\u016b\371-\374]/g,"u"],[/[\327]/g,"x"],[/[\335]/g,"Y"],[/[\375\377]/g,"y"]];
|
|
209
209
|
/**
|
|
210
210
|
@function strip
|
|
211
211
|
@desc Removes all non ASCII characters from a string.
|
|
212
212
|
@param {String} value
|
|
213
213
|
@param {String} [spacer = "-"]
|
|
214
|
-
*/function Re(t,n){var i=1<arguments.length&&void 0!==n?n:"-";return"".concat(t).replace(/[^A-Za-z0-9\-_\u0621-\u064A]/g,function(t){if(" "===t)return i;for(var n=!1,e=0;e<je.length;e++)if(new RegExp(je[e][0]).test(t)){n=je[e][1];break}return n||""})}function Ie(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Fe(){if(!
|
|
214
|
+
*/function Re(t,n){var i=1<arguments.length&&void 0!==n?n:"-";return"".concat(t).replace(/[^A-Za-z0-9\-_\u0621-\u064A]/g,function(t){if(" "===t)return i;for(var n=!1,e=0;e<je.length;e++)if(new RegExp(je[e][0]).test(t)){n=je[e][1];break}return n||""})}function Ie(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Fe(){if(!Pe){Pe=1;
|
|
215
215
|
/* build fixed length tree */for(var y=0,v=-3,b=new i,x=new i,s=new Uint8Array(30),l=new Uint16Array(30),h=new Uint8Array(30),u=new Uint16Array(30),w=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),S=new i,k=new Uint8Array(320),o=new Uint16Array(16),
|
|
216
216
|
/* -------------------- *
|
|
217
217
|
* -- initialization -- *
|
|
218
218
|
* -------------------- */ /* build fixed huffman trees */t=b,n=x,e=0;e<7;++e)t.table[e]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,e=0;e<24;++e)t.trans[e]=256+e;for(e=0;e<144;++e)t.trans[24+e]=e;for(e=0;e<8;++e)t.trans[168+e]=280+e;for(e=0;e<112;++e)t.trans[176+e]=144+e;
|
|
219
219
|
/* build fixed distance tree */for(e=0;e<5;++e)n.table[e]=0;for(n.table[5]=32,e=0;e<32;++e)n.trans[e]=e;
|
|
220
220
|
/* build extra bits and base tables */a(s,l,4,3),a(h,u,2,1),
|
|
221
|
-
/* fix a special case */s[28]=0,l[28]=258,
|
|
221
|
+
/* fix a special case */s[28]=0,l[28]=258,Ne=
|
|
222
222
|
/* inflate stream from source to dest */function(t,n){var e,i,a,r=new C(t,n);do{
|
|
223
223
|
/* decompress block */switch(a=void 0,
|
|
224
224
|
/* check if tag is empty */(i=r).bitcount--||(
|
|
@@ -245,7 +245,7 @@ var Pe,Ne,Le,Be,Oe,De,je=[[/[\300-\305]/g,"A"],[/[\340-\345]/g,"a"],[/[\306]/g,"
|
|
|
245
245
|
/* repeat code length 0 for 3-10 times (read 3 bits) */for(m=A(s,3,3);m;--m)k[o++]=0;break;case 18:
|
|
246
246
|
/* repeat code length 0 for 11-138 times (read 7 bits) */for(m=A(s,7,11);m;--m)k[o++]=0;break;default:
|
|
247
247
|
/* values 0-15 represent the actual code lengths */k[o++]=p}}
|
|
248
|
-
/* build dynamic trees */M(l,k,0,u),M(h,k,u,c),e=T(r,r.ltree,r.dtree);break;default:e=v}if(e!==y)throw new Error("Data error")}while(!i);return r.destLen<r.dest.length?"function"==typeof r.dest.slice?r.dest.slice(0,r.destLen):r.dest.subarray(0,r.destLen):r.dest}}return
|
|
248
|
+
/* build dynamic trees */M(l,k,0,u),M(h,k,u,c),e=T(r,r.ltree,r.dtree);break;default:e=v}if(e!==y)throw new Error("Data error")}while(!i);return r.destLen<r.dest.length?"function"==typeof r.dest.slice?r.dest.slice(0,r.destLen):r.dest.subarray(0,r.destLen):r.dest}}return Ne;function i(){this.table=new Uint16Array(16),/* table of code length counts */
|
|
249
249
|
this.trans=new Uint16Array(288)}function C(t,n){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=n,this.destLen=0,this.ltree=new i,/* dynamic length/symbol tree */
|
|
250
250
|
this.dtree=new i}
|
|
251
251
|
/* --------------------------------------------------- *
|
|
@@ -449,7 +449,7 @@ this.LB8a=31===this.nextClass,t)return new ii(this.lastPos)}return this.lastPos<
|
|
|
449
449
|
/**
|
|
450
450
|
@function uuid
|
|
451
451
|
@summary Returns a unique identifier.
|
|
452
|
-
*/function
|
|
452
|
+
*/function Ni(){return""+Ei()+Ei()+`-${Ei()}-${Ei()}-${Ei()}-`+Ei()+Ei()+Ei()}
|
|
453
453
|
/**
|
|
454
454
|
@desc Recursive function that resets nested Object configs.
|
|
455
455
|
@param {Object} obj
|
|
@@ -460,13 +460,13 @@ this.LB8a=31===this.nextClass,t)return new ii(this.lastPos)}return this.lastPos<
|
|
|
460
460
|
* @desc finds all prototype methods of a class and it's parent classes
|
|
461
461
|
* @param {*} obj
|
|
462
462
|
* @private
|
|
463
|
-
*/function
|
|
463
|
+
*/function Pi(t){let n=[];for(;n=n.concat(Object.getOwnPropertyNames(t)),(t=Object.getPrototypeOf(t))&&t!==Object.prototype;);return n.filter(t=>0!==t.indexOf("_")&&!["config","constructor","parent","render"].includes(t))}class Li{
|
|
464
464
|
/**
|
|
465
465
|
@memberof BaseClass
|
|
466
466
|
@desc If *value* is specified, sets the methods that correspond to the key/value pairs and returns this class. If *value* is not specified, returns the current configuration.
|
|
467
467
|
@param {Object} [*value*]
|
|
468
468
|
@chainable
|
|
469
|
-
*/config(t){if(!this._configDefault){let e={};
|
|
469
|
+
*/config(t){if(!this._configDefault){let e={};Pi(this.__proto__).forEach(t=>{var n=this[t]();n!==this&&(e[t]=_(n)?Et({},n):n)}),this._configDefault=e}if(arguments.length){for(var n in t){var e;({}).hasOwnProperty.call(t,n)&&n in this&&((e=t[n])===Ti?"on"===n?this._on=this._configDefault[n]:this[n](this._configDefault[n]):(function t(n,e){if(_(n))for(var i in n){var a;!{}.hasOwnProperty.call(n,i)||i.startsWith("_")||(a=e&&_(e)?e[i]:void 0,n[i]===Ti?a?n[i]=a:delete n[i]:_(n[i])&&t(n[i],a))}}(e,this._configDefault[n]),this[n](e)))}return this}{let n={};return Pi(this.__proto__).forEach(t=>{n[t]=this[t]()}),n}}
|
|
470
470
|
/**
|
|
471
471
|
@memberof BaseClass
|
|
472
472
|
@desc Sets the locale used for all text and number formatting. This method supports the locales defined in [d3plus-format](https://github.com/d3plus/d3plus-format/blob/master/src/locale.js). The locale can be defined as a complex Object (like in d3plus-format), a locale code (like "en-US"), or a 2-digit language code (like "en"). If a 2-digit code is provided, the "findLocale" function is used to identify the most approximate locale from d3plus-format.
|
|
@@ -531,7 +531,7 @@ this.LB8a=31===this.nextClass,t)return new ii(this.lastPos)}return this.lastPos<
|
|
|
531
531
|
@memberof BaseClass
|
|
532
532
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
533
533
|
@private
|
|
534
|
-
*/constructor(){this._locale="en-US",this._on={},this._parent={},this._translate=(t,n=this._locale)=>{n=bi[n];return n&&n[t]?n[t]:t},this._uuid=
|
|
534
|
+
*/constructor(){this._locale="en-US",this._on={},this._parent={},this._translate=(t,n=this._locale)=>{n=bi[n];return n&&n[t]?n[t]:t},this._uuid=Ni()}}
|
|
535
535
|
/**
|
|
536
536
|
@function configPrep
|
|
537
537
|
@desc Preps a config object for d3plus data, and optionally bubbles up a specific nested type. When using this function, you must bind a d3plus class' `this` context.
|
|
@@ -578,11 +578,11 @@ for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)a[o]=Ca(e[o]
|
|
|
578
578
|
// Computes the decimal coefficient and exponent of the specified number x with
|
|
579
579
|
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
|
580
580
|
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
|
581
|
-
function
|
|
582
|
-
return(n=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0?null:[1<(e=t.slice(0,n)).length?e[0]+e.slice(2):e,+t.slice(n+1)]}function
|
|
581
|
+
function Na(t,n){var e;// NaN, ±Infinity
|
|
582
|
+
return(n=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0?null:[1<(e=t.slice(0,n)).length?e[0]+e.slice(2):e,+t.slice(n+1)]}function Pa(t){return(t=Na(Math.abs(t)))?t[1]:NaN}
|
|
583
583
|
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
|
|
584
584
|
var La,Ba=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oa(t){var n;if(n=Ba.exec(t))return new Da({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]});throw new Error("invalid format: "+t)}// instanceof
|
|
585
|
-
function Da(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ja(t,n){var e,n=
|
|
585
|
+
function Da(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ja(t,n){var e,n=Na(t,n);return n?(e=n[0],(n=n[1])<0?"0."+new Array(-n).join("0")+e:e.length>n+1?e.slice(0,n+1)+"."+e.slice(n+1):e+new Array(n-e.length+2).join("0")):t+""}Oa.prototype=Da.prototype,Da.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ra={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return 1e21<=Math.abs(t=Math.round(t))?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>ja(100*t,n),r:ja,s:function(t,n){var e,i,a=Na(t,n);return a?(e=a[0],(a=(a=a[1])-(La=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1)===(i=e.length)?e:i<a?e+new Array(a-i+1).join("0"):0<a?e.slice(0,a)+"."+e.slice(a):"0."+new Array(1-a).join("0")+Na(t,Math.max(0,n+a-1))[0]):t+""},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ia(t){return t}var Fa,Ha,Ga=Array.prototype.map,Ka=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ua(t){var n,s,l,w=void 0===t.grouping||void 0===t.thousands?Ia:(s=Ga.call(t.grouping,Number),l=t.thousands+"",function(t,n){for(var e=t.length,i=[],a=0,r=s[0],o=0;0<e&&0<r&&(n<o+r+1&&(r=Math.max(1,n-o)),i.push(t.substring(e-=r,e+r)),!((o+=r+1)>n));)r=s[a=(a+1)%s.length];return i.reverse().join(l)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",S=void 0===t.decimal?".":t.decimal+"",k=void 0===t.numerals?Ia:(n=Ga.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return n[+t]})}),r=void 0===t.percent?"%":t.percent+"",C=void 0===t.minus?"−":t.minus+"",M=void 0===t.nan?"NaN":t.nan+"";function o(t){var h=(t=Oa(t)).fill,u=t.align,c=t.sign,n=t.symbol,g=t.zero,d=t.width,f=t.comma,p=t.precision,_=t.trim,m=t.type,y=(
|
|
586
586
|
// The "n" type is an alias for ",g".
|
|
587
587
|
"n"===m?(f=!0,m="g"):Ra[m]||(void 0===p&&(p=12),_=!0,m="g"),
|
|
588
588
|
// If zero fill is specified, padding goes after sign and before digits.
|
|
@@ -612,7 +612,7 @@ switch(f&&g&&(t=w(l+t,l.length?d-r.length:1/0),l=""),u){case"<":t=a+t+r+l;break;
|
|
|
612
612
|
// or clamp the specified precision to the supported range.
|
|
613
613
|
// For significant precision, it must be in [1, 21].
|
|
614
614
|
// For fixed precision, it must be in [0, 20].
|
|
615
|
-
return p=void 0===p?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),e.toString=function(){return t+""},e}return{format:o,formatPrefix:function(t,n){var e=o(((t=Oa(t)).type="f",t)),t=3*Math.max(-8,Math.min(8,Math.floor(
|
|
615
|
+
return p=void 0===p?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),e.toString=function(){return t+""},e}return{format:o,formatPrefix:function(t,n){var e=o(((t=Oa(t)).type="f",t)),t=3*Math.max(-8,Math.min(8,Math.floor(Pa(n)/3))),i=Math.pow(10,-t),a=Ka[8+t/3];return function(t){return e(i*t)+a}}}}function Wa(t,n,e,i){var a,r,o=na(t,n,e);switch((i=Oa(null==i?",f":i)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(n));return null!=i.precision||isNaN((r=o,r=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pa(s)/3)))-Pa(Math.abs(r)))))||(i.precision=r),Ha(i,s);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN((s=o,a=Math.max(Math.abs(t),Math.abs(n)),s=Math.abs(s),a=Math.abs(a)-s,r=Math.max(0,Pa(a)-Pa(s))+1))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=Math.max(0,-Pa(Math.abs(o))))||(i.precision=r-2*("%"===i.type))}return Fa(i)}function qa(h){var u=h.domain;return h.ticks=function(t){var n=u();return Qi(n[0],n[n.length-1],null==t?10:t)},h.tickFormat=function(t,n){var e=u();return Wa(e[0],e[e.length-1],null==t?10:t,n)},h.nice=function(t){null==t&&(t=10);var n,e,i=u(),a=0,r=i.length-1,o=i[a],s=i[r],l=10;for(s<o&&(e=o,o=s,s=e,e=a,a=r,r=e);0<l--;){if((e=ta(o,s,t))===n)return i[a]=o,i[r]=s,u(i);if(0<e)o=Math.floor(o/e)*e,s=Math.ceil(s/e)*e;else{if(!(e<0))break;o=Math.ceil(o*e)/e,s=Math.floor(s*e)/e}n=e}return h},h}function $a(){var t=Ea();return t.copy=function(){return za(t,$a())},ma.apply(t,arguments),qa(t)}function Va(t,n){var e,i=0,a=(t=t.slice()).length-1,r=t[i],o=t[a];return o<r&&(e=i,i=a,a=e,e=r,r=o,o=e),t[i]=n.floor(r),t[a]=n.ceil(o),t}function Ya(t){return Math.log(t)}function Xa(t){return Math.exp(t)}function Za(t){return-Math.log(-t)}function Ja(t){return-Math.exp(-t)}function Qa(t){return isFinite(t)?+("1e"+t):t<0?0:t}function tr(e){return(t,n)=>-e(-t,n)}function nr(t){let a=t(Ya,Xa),h=a.domain,u=10,c,g;function n(){var n,e;return c=(e=u)===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e),g=10===(n=u)?Qa:n===Math.E?Math.exp:t=>Math.pow(n,t),h()[0]<0?(c=tr(c),g=tr(g),t(Za,Ja)):t(Ya,Xa),a}return a.base=function(t){return arguments.length?(u=+t,n()):u},a.domain=function(t){return(arguments.length?(h(t),n):h)()},a.ticks=t=>{var n=h();let e=n[0],i=n[n.length-1];n=i<e;n&&([e,i]=[i,e]);let a=c(e),r=c(i),o,s;t=null==t?10:+t;let l=[];if(!(u%1)&&r-a<t){if(a=Math.floor(a),r=Math.ceil(r),0<e){for(;a<=r;++a)for(o=1;o<u;++o)if(!((s=a<0?o/g(-a):o*g(a))<e)){if(s>i)break;l.push(s)}}else for(;a<=r;++a)for(o=u-1;1<=o;--o)if(!((s=0<a?o/g(-a):o*g(a))<e)){if(s>i)break;l.push(s)}2*l.length<t&&(l=Qi(e,i,t))}else l=Qi(a,r,Math.min(r-a,t)).map(g);return n?l.reverse():l},a.tickFormat=(t,e)=>{if(null==t&&(t=10),"function"!=typeof(e=null==e?10===u?"s":",":e)&&(u%1||null!=(e=Oa(e)).precision||(e.trim=!0),e=Fa(e)),t===1/0)return e;let i=Math.max(1,u*t/a.ticks().length);// TODO fast estimate?
|
|
616
616
|
return t=>{let n=t/g(Math.round(c(t)));return n*u<u-.5&&(n*=u),n<=i?e(t):""}},a.nice=()=>h(Va(h(),{floor:t=>g(Math.floor(c(t))),ceil:t=>g(Math.ceil(c(t)))})),a}function er(){let t=nr(Ta()).domain([1,10]);return t.copy=()=>za(t,er()).base(t.base()),ma.apply(t,arguments),t}function ir(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function ar(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function rr(n){var e=1,t=n(ir(e),ar(e));return t.constant=function(t){return arguments.length?n(ir(e=+t),ar(e)):e},qa(t)}function or(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function sr(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function lr(t){return t<0?-t*t:t*t}function hr(n){var t=n(ka,ka),e=1;return t.exponent=function(t){return arguments.length?1===(e=+t)?n(ka,ka):.5===e?n(sr,lr):n(or(e),or(1/e)):e},qa(t)}function ur(){var t=hr(Ta());return t.copy=function(){return za(t,ur()).exponent(t.exponent())},ma.apply(t,arguments),t}function cr(t){return Math.sign(t)*t*t}function gr(){var n,e=[.5],i=[0,1],a=1;function r(t){return null!=t&&t<=t?i[Ii(e,t,0,a)]:n}return r.domain=function(t){return arguments.length?(e=Array.from(t),a=Math.min(e.length,i.length-1),r):e.slice()},r.range=function(t){return arguments.length?(i=Array.from(t),a=Math.min(e.length,i.length-1),r):i.slice()},r.invertExtent=function(t){t=i.indexOf(t);return[e[t-1],e[t]]},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return gr().domain(e).range(i).unknown(n)},ma.apply(r,arguments)}pn=Ua({thousands:",",grouping:[3],currency:["$",""]}),Fa=pn.format,Ha=pn.formatPrefix;let dr=new Date,fr=new Date;function pr(r,o,e,i){function s(t){return r(t=0===arguments.length?new Date:new Date(+t)),t}return s.floor=t=>(r(t=new Date(+t)),t),s.ceil=t=>(r(t=new Date(t-1)),o(t,1),r(t),t),s.round=t=>{var n=s(t),e=s.ceil(t);return t-n<e-t?n:e},s.offset=(t,n)=>(o(t=new Date(+t),null==n?1:Math.floor(n)),t),s.range=(t,n,e)=>{var i,a=[];if(t=s.ceil(t),e=null==e?1:Math.floor(e),t<n&&0<e)for(;a.push(i=new Date(+t)),o(t,e),r(t),i<t&&t<n;);// also handles Invalid Date
|
|
617
617
|
return a},s.filter=e=>pr(t=>{if(t<=t)for(;r(t),!e(t);)t.setTime(t-1)},(t,n)=>{if(t<=t)if(n<0)for(;++n<=0;)for(;o(t,-1),!e(t););// eslint-disable-line no-empty
|
|
618
618
|
else for(;0<=--n;)for(;o(t,1),!e(t););// eslint-disable-line no-empty
|
|
@@ -620,12 +620,12 @@ else for(;0<=--n;)for(;o(t,1),!e(t););// eslint-disable-line no-empty
|
|
|
620
620
|
// noop
|
|
621
621
|
},(t,n)=>{t.setTime(+t+n)},(t,n)=>n-t),mr=(
|
|
622
622
|
// An optimized implementation for this simple case.
|
|
623
|
-
_r.every=e=>(e=Math.floor(e),isFinite(e)&&0<e?1<e?pr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):_r:null),_r,1e3),yr=6e4,vr=36e5,br=864e5,xr=7*br,wr=(br,365*br),Sr=pr(t=>{t.setTime(t-t.getMilliseconds())},(t,n)=>{t.setTime(+t+n*mr)},(t,n)=>(n-t)/mr,t=>t.getUTCSeconds()),kr=(Sr.range,pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mr)},(t,n)=>{t.setTime(+t+n*yr)},(t,n)=>(n-t)/yr,t=>t.getMinutes())),Cr=(kr.range,pr(t=>{t.setUTCSeconds(0,0)},(t,n)=>{t.setTime(+t+n*yr)},(t,n)=>(n-t)/yr,t=>t.getUTCMinutes())),Mr=(Cr.range,pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mr-t.getMinutes()*yr)},(t,n)=>{t.setTime(+t+n*vr)},(t,n)=>(n-t)/vr,t=>t.getHours())),Ar=(Mr.range,pr(t=>{t.setUTCMinutes(0,0,0)},(t,n)=>{t.setTime(+t+n*vr)},(t,n)=>(n-t)/vr,t=>t.getUTCHours())),zr=(Ar.range,pr(t=>t.setHours(0,0,0,0),(t,n)=>t.setDate(t.getDate()+n),(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*yr)/br,t=>t.getDate()-1)),Tr=(zr.range,pr(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/br,t=>t.getUTCDate()-1));Tr.range;mn=pr(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/br,t=>Math.floor(t/br));function Er(n){return pr(t=>{t.setDate(t.getDate()-(t.getDay()+7-n)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+7*n)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*yr)/xr)}mn.range;let
|
|
623
|
+
_r.every=e=>(e=Math.floor(e),isFinite(e)&&0<e?1<e?pr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):_r:null),_r,1e3),yr=6e4,vr=36e5,br=864e5,xr=7*br,wr=(br,365*br),Sr=pr(t=>{t.setTime(t-t.getMilliseconds())},(t,n)=>{t.setTime(+t+n*mr)},(t,n)=>(n-t)/mr,t=>t.getUTCSeconds()),kr=(Sr.range,pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mr)},(t,n)=>{t.setTime(+t+n*yr)},(t,n)=>(n-t)/yr,t=>t.getMinutes())),Cr=(kr.range,pr(t=>{t.setUTCSeconds(0,0)},(t,n)=>{t.setTime(+t+n*yr)},(t,n)=>(n-t)/yr,t=>t.getUTCMinutes())),Mr=(Cr.range,pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mr-t.getMinutes()*yr)},(t,n)=>{t.setTime(+t+n*vr)},(t,n)=>(n-t)/vr,t=>t.getHours())),Ar=(Mr.range,pr(t=>{t.setUTCMinutes(0,0,0)},(t,n)=>{t.setTime(+t+n*vr)},(t,n)=>(n-t)/vr,t=>t.getUTCHours())),zr=(Ar.range,pr(t=>t.setHours(0,0,0,0),(t,n)=>t.setDate(t.getDate()+n),(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*yr)/br,t=>t.getDate()-1)),Tr=(zr.range,pr(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/br,t=>t.getUTCDate()-1));Tr.range;mn=pr(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/br,t=>Math.floor(t/br));function Er(n){return pr(t=>{t.setDate(t.getDate()-(t.getDay()+7-n)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+7*n)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*yr)/xr)}mn.range;let Nr=Er(0),Pr=Er(1);_n=Er(2),n=Er(3);let Lr=Er(4);var pn=Er(5),Br=Er(6);function Or(n){return pr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-n)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)},(t,n)=>(n-t)/xr)}Nr.range,Pr.range,_n.range,n.range,Lr.range,pn.range,Br.range;let Dr=Or(0),jr=Or(1);_n=Or(2),n=Or(3);let Rr=Or(4);pn=Or(5),Br=Or(6);Dr.range,jr.range,_n.range,n.range,Rr.range,pn.range,Br.range;let Ir=pr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,n)=>{t.setMonth(t.getMonth()+n)},(t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear()),t=>t.getMonth()),Fr=(Ir.range,pr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)},(t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth())),Hr=(Fr.range,pr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n)},(t,n)=>n.getFullYear()-t.getFullYear(),t=>t.getFullYear())),Gr=(
|
|
624
624
|
// An optimized implementation for this simple case.
|
|
625
625
|
Hr.every=e=>isFinite(e=Math.floor(e))&&0<e?pr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Hr,pr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)},(t,n)=>n.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear()));function Kr(r,t,n,e,i,a){let o=[[Sr,1,mr],[Sr,5,5e3],[Sr,15,15e3],[Sr,30,3e4],[a,1,yr],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,vr],[i,3,3*vr],[i,6,6*vr],[i,12,432e5],[e,1,br],[e,2,2*br],[n,1,xr],[t,1,2592e6],[t,3,7776e6],[r,1,wr]];function s(t,n,e){var i=Math.abs(n-t)/e,a=Di(([,,t])=>t).right(o,i);return a===o.length?r.every(na(t/wr,n/wr,e)):0===a?_r.every(Math.max(na(t,n,e),1)):([t,n]=o[i/o[a-1][2]<o[a][2]/i?a-1:a],t.every(n))}return[function(t,n,e){var i=n<t;i&&([t,n]=[n,t]);e=(e=e&&"function"==typeof e.range?e:s(t,n,e))?e.range(t,+n+1):[];// inclusive stop
|
|
626
626
|
return i?e.reverse():e},s]}
|
|
627
627
|
// An optimized implementation for this simple case.
|
|
628
|
-
Gr.every=e=>isFinite(e=Math.floor(e))&&0<e?pr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Gr;let[Ur,Wr]=Kr(Gr,Fr,Dr,mn,Ar,Cr),[qr,$r]=Kr(Hr,Ir,
|
|
628
|
+
Gr.every=e=>isFinite(e=Math.floor(e))&&0<e?pr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Gr;let[Ur,Wr]=Kr(Gr,Fr,Dr,mn,Ar,Cr),[qr,$r]=Kr(Hr,Ir,Nr,zr,Mr,kr);function Vr(t){var n;return 0<=t.y&&t.y<100?((n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L)).setFullYear(t.y),n):new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Yr(t){var n;return 0<=t.y&&t.y<100?((n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L))).setUTCFullYear(t.y),n):new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Xr(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function Zr(t){var i=t.dateTime,a=t.date,r=t.time,n=t.periods,e=t.days,o=t.shortDays,s=t.months,l=t.shortMonths,h=so(n),u=lo(n),c=so(e),g=lo(e),d=so(o),f=lo(o),p=so(s),_=lo(s),m=so(l),y=lo(l),v={a:function(t){return o[t.getDay()]},A:function(t){return e[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Eo,e:Eo,f:Oo,g:qo,G:Vo,H:No,I:Po,j:Lo,L:Bo,m:Do,M:jo,p:function(t){return n[+(12<=t.getHours())]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ms,s:ys,S:Ro,u:Io,U:Fo,V:Go,w:Ko,W:Uo,x:null,X:null,y:Wo,Y:$o,Z:Yo,"%":_s},b={a:function(t){return o[t.getUTCDay()]},A:function(t){return e[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Xo,e:Xo,f:ns,g:gs,G:fs,H:Zo,I:Jo,j:Qo,L:ts,m:es,M:is,p:function(t){return n[+(12<=t.getUTCHours())]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ms,s:ys,S:as,u:rs,U:os,V:ls,w:hs,W:us,x:null,X:null,y:cs,Y:ds,Z:ps,"%":_s},x={a:function(t,n,e){n=d.exec(n.slice(e));return n?(t.w=f.get(n[0].toLowerCase()),e+n[0].length):-1},A:function(t,n,e){n=c.exec(n.slice(e));return n?(t.w=g.get(n[0].toLowerCase()),e+n[0].length):-1},b:function(t,n,e){n=m.exec(n.slice(e));return n?(t.m=y.get(n[0].toLowerCase()),e+n[0].length):-1},B:function(t,n,e){n=p.exec(n.slice(e));return n?(t.m=_.get(n[0].toLowerCase()),e+n[0].length):-1},c:function(t,n,e){return k(t,i,n,e)},d:bo,e:bo,f:Mo,g:_o,G:po,H:wo,I:wo,j:xo,L:Co,m:vo,M:So,p:function(t,n,e){n=h.exec(n.slice(e));return n?(t.p=u.get(n[0].toLowerCase()),e+n[0].length):-1},q:yo,Q:zo,s:To,S:ko,u:uo,U:co,V:go,w:ho,W:fo,x:function(t,n,e){return k(t,a,n,e)},X:function(t,n,e){return k(t,r,n,e)},y:_o,Y:po,Z:mo,"%":Ao};function w(l,h){return function(t){var n,e,i,a=[],r=-1,o=0,s=l.length;for(t instanceof Date||(t=new Date(+t));++r<s;)37===l.charCodeAt(r)&&(a.push(l.slice(o,r)),null!=(e=no[n=l.charAt(++r)])?n=l.charAt(++r):e="e"===n?" ":"0",(i=h[n])&&(n=i(t,e)),a.push(n),o=r+1);return a.push(l.slice(o,r)),a.join("")}}function S(a,r){return function(t){var n,e,i=Xr(1900,void 0,1);if(k(i,a,t+="",0)!=t.length)return null;
|
|
629
629
|
// If a UNIX timestamp is specified, return it.
|
|
630
630
|
if("Q"in i)return new Date(i.Q);if("s"in i)return new Date(1e3*i.s+("L"in i?i.L:0));
|
|
631
631
|
// If this is utcParse, never use the local timezone.
|
|
@@ -634,14 +634,14 @@ if(!r||"Z"in i||(i.Z=0),
|
|
|
634
634
|
// The am-pm flag is 0 for AM, and 1 for PM.
|
|
635
635
|
"p"in i&&(i.H=i.H%12+12*i.p),
|
|
636
636
|
// If the month was not specified, inherit from the quarter.
|
|
637
|
-
void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||53<i.V)return null;"w"in i||(i.w=1),"Z"in i?(n=4<(e=(n=Yr(Xr(i.y,0,1))).getUTCDay())||0===e?jr.ceil(n):jr(n),n=Tr.offset(n,7*(i.V-1)),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=4<(e=(n=Vr(Xr(i.y,0,1))).getDay())||0===e?
|
|
637
|
+
void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||53<i.V)return null;"w"in i||(i.w=1),"Z"in i?(n=4<(e=(n=Yr(Xr(i.y,0,1))).getUTCDay())||0===e?jr.ceil(n):jr(n),n=Tr.offset(n,7*(i.V-1)),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=4<(e=(n=Vr(Xr(i.y,0,1))).getDay())||0===e?Pr.ceil(n):Pr(n),n=zr.offset(n,7*(i.V-1)),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),e="Z"in i?Yr(Xr(i.y,0,1)).getUTCDay():Vr(Xr(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(e+5)%7:i.w+7*i.U-(e+6)%7);
|
|
638
638
|
// If a time zone is specified, all fields are interpreted as UTC and then
|
|
639
639
|
// offset according to the specified time zone.
|
|
640
640
|
return("Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,Yr):Vr)(i);
|
|
641
641
|
// Otherwise, all fields are in local time.
|
|
642
642
|
}}function k(t,n,e,i){for(var a,r,o=0,s=n.length,l=e.length;o<s;){if(l<=i)return-1;if(37===(a=n.charCodeAt(o++))){if(a=n.charAt(o++),!(r=x[a in no?n.charAt(o++):a])||(i=r(t,e,i))<0)return-1}else if(a!=e.charCodeAt(i++))return-1}return i}
|
|
643
643
|
// These recursive directive definitions must be deferred.
|
|
644
|
-
return v.x=w(a,v),v.X=w(r,v),v.c=w(i,v),b.x=w(a,b),b.X=w(r,b),b.c=w(i,b),{format:function(t){var n=w(t+="",v);return n.toString=function(){return t},n},parse:function(t){var n=S(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},utcParse:function(t){var n=S(t+="",!0);return n.toString=function(){return t},n}}}var Jr,Qr,to,no={"-":"",_:" ",0:"0"},eo=/^\s*\d+/,io=/^%/,ao=/[\\^$*+?|[\]().{}]/g;function ro(t,n,e){var i=t<0?"-":"",t=(i?-t:t)+"",a=t.length;return i+(a<e?new Array(e-a+1).join(n)+t:t)}function oo(t){return t.replace(ao,"\\$&")}function so(t){return new RegExp("^(?:"+t.map(oo).join("|")+")","i")}function lo(t){return new Map(t.map((t,n)=>[t.toLowerCase(),n]))}function ho(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.w=+n[0],e+n[0].length):-1}function uo(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.u=+n[0],e+n[0].length):-1}function co(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.U=+n[0],e+n[0].length):-1}function go(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.V=+n[0],e+n[0].length):-1}function fo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.W=+n[0],e+n[0].length):-1}function po(t,n,e){n=eo.exec(n.slice(e,e+4));return n?(t.y=+n[0],e+n[0].length):-1}function _o(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.y=+n[0]+(68<+n[0]?1900:2e3),e+n[0].length):-1}function mo(t,n,e){n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),e+n[0].length):-1}function yo(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.q=3*n[0]-3,e+n[0].length):-1}function vo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.m=n[0]-1,e+n[0].length):-1}function bo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.d=+n[0],e+n[0].length):-1}function xo(t,n,e){n=eo.exec(n.slice(e,e+3));return n?(t.m=0,t.d=+n[0],e+n[0].length):-1}function wo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.H=+n[0],e+n[0].length):-1}function So(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.M=+n[0],e+n[0].length):-1}function ko(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.S=+n[0],e+n[0].length):-1}function Co(t,n,e){n=eo.exec(n.slice(e,e+3));return n?(t.L=+n[0],e+n[0].length):-1}function Mo(t,n,e){n=eo.exec(n.slice(e,e+6));return n?(t.L=Math.floor(n[0]/1e3),e+n[0].length):-1}function Ao(t,n,e){n=io.exec(n.slice(e,e+1));return n?e+n[0].length:-1}function zo(t,n,e){n=eo.exec(n.slice(e));return n?(t.Q=+n[0],e+n[0].length):-1}function To(t,n,e){n=eo.exec(n.slice(e));return n?(t.s=+n[0],e+n[0].length):-1}function Eo(t,n){return ro(t.getDate(),n,2)}function Po(t,n){return ro(t.getHours(),n,2)}function No(t,n){return ro(t.getHours()%12||12,n,2)}function Lo(t,n){return ro(1+zr.count(Hr(t),t),n,3)}function Bo(t,n){return ro(t.getMilliseconds(),n,3)}function Oo(t,n){return Bo(t,n)+"000"}function Do(t,n){return ro(t.getMonth()+1,n,2)}function jo(t,n){return ro(t.getMinutes(),n,2)}function Ro(t,n){return ro(t.getSeconds(),n,2)}function Io(t){t=t.getDay();return 0===t?7:t}function Fo(t,n){return ro(Pr.count(Hr(t)-1,t),n,2)}function Ho(t){var n=t.getDay();return 4<=n||0===n?Lr(t):Lr.ceil(t)}function Go(t,n){return t=Ho(t),ro(Lr.count(Hr(t),t)+(4===Hr(t).getDay()),n,2)}function Ko(t){return t.getDay()}function Uo(t,n){return ro(Nr.count(Hr(t)-1,t),n,2)}function Wo(t,n){return ro(t.getFullYear()%100,n,2)}function qo(t,n){return ro((t=Ho(t)).getFullYear()%100,n,2)}function $o(t,n){return ro(t.getFullYear()%1e4,n,4)}function Vo(t,n){var e=t.getDay();return ro((t=4<=e||0===e?Lr(t):Lr.ceil(t)).getFullYear()%1e4,n,4)}function Yo(t){t=t.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+ro(t/60|0,"0",2)+ro(t%60,"0",2)}function Xo(t,n){return ro(t.getUTCDate(),n,2)}function Zo(t,n){return ro(t.getUTCHours(),n,2)}function Jo(t,n){return ro(t.getUTCHours()%12||12,n,2)}function Qo(t,n){return ro(1+Tr.count(Gr(t),t),n,3)}function ts(t,n){return ro(t.getUTCMilliseconds(),n,3)}function ns(t,n){return ts(t,n)+"000"}function es(t,n){return ro(t.getUTCMonth()+1,n,2)}function is(t,n){return ro(t.getUTCMinutes(),n,2)}function as(t,n){return ro(t.getUTCSeconds(),n,2)}function rs(t){t=t.getUTCDay();return 0===t?7:t}function os(t,n){return ro(Dr.count(Gr(t)-1,t),n,2)}function ss(t){var n=t.getUTCDay();return 4<=n||0===n?Rr(t):Rr.ceil(t)}function ls(t,n){return t=ss(t),ro(Rr.count(Gr(t),t)+(4===Gr(t).getUTCDay()),n,2)}function hs(t){return t.getUTCDay()}function us(t,n){return ro(jr.count(Gr(t)-1,t),n,2)}function cs(t,n){return ro(t.getUTCFullYear()%100,n,2)}function gs(t,n){return ro((t=ss(t)).getUTCFullYear()%100,n,2)}function ds(t,n){return ro(t.getUTCFullYear()%1e4,n,4)}function fs(t,n){var e=t.getUTCDay();return ro((t=4<=e||0===e?Rr(t):Rr.ceil(t)).getUTCFullYear()%1e4,n,4)}function ps(){return"+0000"}function _s(){return"%"}function ms(t){return+t}function ys(t){return Math.floor(+t/1e3)}function vs(t){return Jr=Zr(t),Qr=Jr.format,to=Jr.utcFormat,Jr}function bs(t){return new Date(t)}function xs(t){return t instanceof Date?+t:+new Date(+t)}function ws(e,i,n,a,r,o,s,l,h,u){var c=Ea(),g=c.invert,d=c.domain,f=u(".%L"),p=u(":%S"),_=u("%I:%M"),m=u("%I %p"),y=u("%a %d"),v=u("%b %d"),b=u("%B"),x=u("%Y");function w(t){return(h(t)<t?f:l(t)<t?p:s(t)<t?_:o(t)<t?m:a(t)<t?r(t)<t?y:v:n(t)<t?b:x)(t)}return c.invert=function(t){return new Date(g(t))},c.domain=function(t){return arguments.length?d(Array.from(t,xs)):d().map(bs)},c.ticks=function(t){var n=d();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(t,n){return null==n?w:u(n)},c.nice=function(t){var n=d();return(t=t&&"function"==typeof t.range?t:i(n[0],n[n.length-1],null==t?10:t))?d(Va(n,t)):c},c.copy=function(){return za(c,ws(e,i,n,a,r,o,s,l,h,u))},c}function Ss(){return ma.apply(ws(qr,$r,Hr,Ir,Pr,zr,Mr,kr,Sr,Qr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ks(){var n,e,i,a,r,o=0,s=1,l=ka,h=!1;function u(t){return null==t||isNaN(t=+t)?r:l(0===i?.5:(t=(a(t)-n)*i,h?Math.max(0,Math.min(1,t)):t))}function t(e){return function(t){var n;return arguments.length?([t,n]=t,l=e(t,n),u):[l(0),l(1)]}}return u.domain=function(t){return arguments.length?([o,s]=t,n=a(o=+o),e=a(s=+s),i=n===e?0:1/(e-n),u):[o,s]},u.clamp=function(t){return arguments.length?(h=!!t,u):h},u.interpolator=function(t){return arguments.length?(l=t,u):l},u.range=t(ie),u.rangeRound=t(ae),u.unknown=function(t){return arguments.length?(r=t,u):r},function(t){return n=(a=t)(o),e=t(s),i=n===e?0:1/(e-n),u}}function Cs(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Ms(){var t=hr(ks());return t.copy=function(){return Cs(t,Ms()).exponent(t.exponent())},ya.apply(t,arguments)}function As(){var n,e,i,a,r,o,s,l=0,h=.5,u=1,c=1,g=ka,d=!1;function f(t){return isNaN(t=+t)?s:(t=.5+((t=+o(t))-e)*(c*t<c*e?a:r),g(d?Math.max(0,Math.min(1,t)):t))}function t(i){return function(t){var n,e;return arguments.length?([t,n,e]=t,g=((t,n)=>{void 0===n&&(n=t,t=ie);for(var e=0,i=n.length-1,a=n[0],r=new Array(i<0?0:i);e<i;)r[e]=t(a,a=n[++e]);return function(t){var n=Math.max(0,Math.min(i-1,Math.floor(t*=i)));return r[n](t-n)}})(i,[t,n,e]),f):[g(0),g(.5),g(1)]}}return f.domain=function(t){return arguments.length?([l,h,u]=t,n=o(l=+l),e=o(h=+h),i=o(u=+u),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f):[l,h,u]},f.clamp=function(t){return arguments.length?(d=!!t,f):d},f.interpolator=function(t){return arguments.length?(g=t,f):g},f.range=t(ie),f.rangeRound=t(ae),f.unknown=function(t){return arguments.length?(s=t,f):s},function(t){return n=(o=t)(l),e=t(h),i=t(u),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f}}function zs(){var t=hr(As());return t.copy=function(){return Cs(t,zs()).exponent(t.exponent())},ya.apply(t,arguments)}vs({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var Ts=Object.freeze({__proto__:null,scaleBand:xa,scaleDiverging:function t(){var n=qa(As()(ka));return n.copy=function(){return Cs(n,t())},ya.apply(n,arguments)},scaleDivergingLog:function t(){var n=nr(As()).domain([.1,1,10]);return n.copy=function(){return Cs(n,t()).base(n.base())},ya.apply(n,arguments)},scaleDivergingPow:zs,scaleDivergingSqrt:function(){return zs.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var n=rr(As());return n.copy=function(){return Cs(n,t()).constant(n.constant())},ya.apply(n,arguments)},scaleIdentity:function t(n){var e;function i(t){return null==t||isNaN(t=+t)?e:t}return(i.invert=i).domain=i.range=function(t){return arguments.length?(n=Array.from(t,wa),i):n.slice()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,wa):[0,1],qa(i)},scaleImplicit:va,scaleLinear:$a,scaleLog:er,scaleOrdinal:ba,scalePoint:function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return t(e())},n}(xa.apply(null,arguments).paddingInner(1))},scalePow:ur,scaleQuantile:function t(){var n,e=[],i=[],a=[];function r(){var t=0,n=Math.max(1,i.length);for(a=new Array(n-1);++t<n;)a[t-1]=((t,n,e=Ri)=>{var i,a;if((i=t.length)&&!isNaN(n=+n))return n<=0||i<2?+e(t[0],0,t):1<=n?+e(t[i-1],i-1,t):(i=(i-1)*n,(a=+e(t[n=Math.floor(i)],n,t))+(+e(t[n+1],n+1,t)-a)*(i-n))})(e,t/n);return o}function o(t){return null==t||isNaN(t=+t)?n:i[Ii(a,t)]}return o.invertExtent=function(t){return(t=i.indexOf(t))<0?[NaN,NaN]:[0<t?a[t-1]:e[0],t<a.length?a[t]:e[e.length-1]]},o.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Oi),r()},o.range=function(t){return arguments.length?(i=Array.from(t),r()):i.slice()},o.unknown=function(t){return arguments.length?(n=t,o):n},o.quantiles=function(){return a.slice()},o.copy=function(){return t().domain(e).range(i).unknown(n)},ma.apply(o,arguments)},scaleQuantize:function t(){var n,e=0,i=1,a=1,r=[.5],o=[0,1];function s(t){return null!=t&&t<=t?o[Ii(r,t,0,a)]:n}function l(){var t=-1;for(r=new Array(a);++t<a;)r[t]=((t+1)*i-(t-a)*e)/(a+1);return s}return s.domain=function(t){return arguments.length?([e,i]=t,e=+e,i=+i,l()):[e,i]},s.range=function(t){return arguments.length?(a=(o=Array.from(t)).length-1,l()):o.slice()},s.invertExtent=function(t){return(t=o.indexOf(t))<0?[NaN,NaN]:t<1?[e,r[0]]:a<=t?[r[a-1],i]:[r[t-1],r[t]]},s.unknown=function(t){return arguments.length&&(n=t),s},s.thresholds=function(){return r.slice()},s.copy=function(){return t().domain([e,i]).range(o).unknown(n)},ma.apply(qa(s),arguments)},scaleRadial:function t(){var n,e=Ea(),i=[0,1],a=!1;function r(t){return t=e(t),t=Math.sign(t)*Math.sqrt(Math.abs(t)),isNaN(t)?n:a?Math.round(t):t}return r.invert=function(t){return e.invert(cr(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain()},r.range=function(t){return arguments.length?(e.range((i=Array.from(t,wa)).map(cr)),r):i.slice()},r.rangeRound=function(t){return r.range(t).round(!0)},r.round=function(t){return arguments.length?(a=!!t,r):a},r.clamp=function(t){return arguments.length?(e.clamp(t),r):e.clamp()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e.domain(),i).round(a).clamp(e.clamp()).unknown(n)},ma.apply(r,arguments),qa(r)},scaleSequential:function t(){var n=qa(ks()(ka));return n.copy=function(){return Cs(n,t())},ya.apply(n,arguments)},scaleSequentialLog:function t(){var n=nr(ks()).domain([1,10]);return n.copy=function(){return Cs(n,t()).base(n.base())},ya.apply(n,arguments)},scaleSequentialPow:Ms,scaleSequentialQuantile:function t(){var i=[],e=ka;function a(t){if(null!=t&&!isNaN(t=+t))return e((Ii(i,t,1)-1)/(i.length-1))}return a.domain=function(t){if(!arguments.length)return i.slice();i=[];for(var n of t)null==n||isNaN(n=+n)||i.push(n);return i.sort(Oi),a},a.interpolator=function(t){return arguments.length?(e=t,a):e},a.range=function(){return i.map((t,n)=>e(n/(i.length-1)))},a.quantiles=function(e){return Array.from({length:e+1},(t,n)=>aa(i,n/e))},a.copy=function(){return t(e).domain(i)},ya.apply(a,arguments)},scaleSequentialSqrt:function(){return Ms.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var n=rr(ks());return n.copy=function(){return Cs(n,t()).constant(n.constant())},ya.apply(n,arguments)},scaleSqrt:function(){return ur.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var n=rr(Ta());return n.copy=function(){return za(n,t()).constant(n.constant())},ma.apply(n,arguments)},scaleThreshold:gr,scaleTime:Ss,scaleUtc:function(){return ma.apply(ws(Ur,Wr,Gr,Fr,Dr,Tr,Ar,Cr,Sr,to).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:Wa});function v(t){return function(){return t}}let Es=Math.abs,Ps=Math.atan2,Ns=Math.cos,Ls=Math.max,Bs=Math.min,Os=Math.sin,Ds=Math.sqrt,js=1e-12,Rs=Math.PI,Is=Rs/2,Fs=2*Rs;function Hs(t){return 1<=t?Is:t<=-1?-Is:Math.asin(t)}let Gs=Math.PI,Ks=2*Gs,Us=1e-6,Ws=Ks-Us;function qs(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}let $s=class{moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,i){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+i}`}bezierCurveTo(t,n,e,i,a,r){this._append`C${+t},${+n},${+e},${+i},${this._x1=+a},${this._y1=+r}`}arcTo(t,n,e,i,a){
|
|
644
|
+
return v.x=w(a,v),v.X=w(r,v),v.c=w(i,v),b.x=w(a,b),b.X=w(r,b),b.c=w(i,b),{format:function(t){var n=w(t+="",v);return n.toString=function(){return t},n},parse:function(t){var n=S(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},utcParse:function(t){var n=S(t+="",!0);return n.toString=function(){return t},n}}}var Jr,Qr,to,no={"-":"",_:" ",0:"0"},eo=/^\s*\d+/,io=/^%/,ao=/[\\^$*+?|[\]().{}]/g;function ro(t,n,e){var i=t<0?"-":"",t=(i?-t:t)+"",a=t.length;return i+(a<e?new Array(e-a+1).join(n)+t:t)}function oo(t){return t.replace(ao,"\\$&")}function so(t){return new RegExp("^(?:"+t.map(oo).join("|")+")","i")}function lo(t){return new Map(t.map((t,n)=>[t.toLowerCase(),n]))}function ho(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.w=+n[0],e+n[0].length):-1}function uo(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.u=+n[0],e+n[0].length):-1}function co(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.U=+n[0],e+n[0].length):-1}function go(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.V=+n[0],e+n[0].length):-1}function fo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.W=+n[0],e+n[0].length):-1}function po(t,n,e){n=eo.exec(n.slice(e,e+4));return n?(t.y=+n[0],e+n[0].length):-1}function _o(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.y=+n[0]+(68<+n[0]?1900:2e3),e+n[0].length):-1}function mo(t,n,e){n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),e+n[0].length):-1}function yo(t,n,e){n=eo.exec(n.slice(e,e+1));return n?(t.q=3*n[0]-3,e+n[0].length):-1}function vo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.m=n[0]-1,e+n[0].length):-1}function bo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.d=+n[0],e+n[0].length):-1}function xo(t,n,e){n=eo.exec(n.slice(e,e+3));return n?(t.m=0,t.d=+n[0],e+n[0].length):-1}function wo(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.H=+n[0],e+n[0].length):-1}function So(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.M=+n[0],e+n[0].length):-1}function ko(t,n,e){n=eo.exec(n.slice(e,e+2));return n?(t.S=+n[0],e+n[0].length):-1}function Co(t,n,e){n=eo.exec(n.slice(e,e+3));return n?(t.L=+n[0],e+n[0].length):-1}function Mo(t,n,e){n=eo.exec(n.slice(e,e+6));return n?(t.L=Math.floor(n[0]/1e3),e+n[0].length):-1}function Ao(t,n,e){n=io.exec(n.slice(e,e+1));return n?e+n[0].length:-1}function zo(t,n,e){n=eo.exec(n.slice(e));return n?(t.Q=+n[0],e+n[0].length):-1}function To(t,n,e){n=eo.exec(n.slice(e));return n?(t.s=+n[0],e+n[0].length):-1}function Eo(t,n){return ro(t.getDate(),n,2)}function No(t,n){return ro(t.getHours(),n,2)}function Po(t,n){return ro(t.getHours()%12||12,n,2)}function Lo(t,n){return ro(1+zr.count(Hr(t),t),n,3)}function Bo(t,n){return ro(t.getMilliseconds(),n,3)}function Oo(t,n){return Bo(t,n)+"000"}function Do(t,n){return ro(t.getMonth()+1,n,2)}function jo(t,n){return ro(t.getMinutes(),n,2)}function Ro(t,n){return ro(t.getSeconds(),n,2)}function Io(t){t=t.getDay();return 0===t?7:t}function Fo(t,n){return ro(Nr.count(Hr(t)-1,t),n,2)}function Ho(t){var n=t.getDay();return 4<=n||0===n?Lr(t):Lr.ceil(t)}function Go(t,n){return t=Ho(t),ro(Lr.count(Hr(t),t)+(4===Hr(t).getDay()),n,2)}function Ko(t){return t.getDay()}function Uo(t,n){return ro(Pr.count(Hr(t)-1,t),n,2)}function Wo(t,n){return ro(t.getFullYear()%100,n,2)}function qo(t,n){return ro((t=Ho(t)).getFullYear()%100,n,2)}function $o(t,n){return ro(t.getFullYear()%1e4,n,4)}function Vo(t,n){var e=t.getDay();return ro((t=4<=e||0===e?Lr(t):Lr.ceil(t)).getFullYear()%1e4,n,4)}function Yo(t){t=t.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+ro(t/60|0,"0",2)+ro(t%60,"0",2)}function Xo(t,n){return ro(t.getUTCDate(),n,2)}function Zo(t,n){return ro(t.getUTCHours(),n,2)}function Jo(t,n){return ro(t.getUTCHours()%12||12,n,2)}function Qo(t,n){return ro(1+Tr.count(Gr(t),t),n,3)}function ts(t,n){return ro(t.getUTCMilliseconds(),n,3)}function ns(t,n){return ts(t,n)+"000"}function es(t,n){return ro(t.getUTCMonth()+1,n,2)}function is(t,n){return ro(t.getUTCMinutes(),n,2)}function as(t,n){return ro(t.getUTCSeconds(),n,2)}function rs(t){t=t.getUTCDay();return 0===t?7:t}function os(t,n){return ro(Dr.count(Gr(t)-1,t),n,2)}function ss(t){var n=t.getUTCDay();return 4<=n||0===n?Rr(t):Rr.ceil(t)}function ls(t,n){return t=ss(t),ro(Rr.count(Gr(t),t)+(4===Gr(t).getUTCDay()),n,2)}function hs(t){return t.getUTCDay()}function us(t,n){return ro(jr.count(Gr(t)-1,t),n,2)}function cs(t,n){return ro(t.getUTCFullYear()%100,n,2)}function gs(t,n){return ro((t=ss(t)).getUTCFullYear()%100,n,2)}function ds(t,n){return ro(t.getUTCFullYear()%1e4,n,4)}function fs(t,n){var e=t.getUTCDay();return ro((t=4<=e||0===e?Rr(t):Rr.ceil(t)).getUTCFullYear()%1e4,n,4)}function ps(){return"+0000"}function _s(){return"%"}function ms(t){return+t}function ys(t){return Math.floor(+t/1e3)}function vs(t){return Jr=Zr(t),Qr=Jr.format,to=Jr.utcFormat,Jr}function bs(t){return new Date(t)}function xs(t){return t instanceof Date?+t:+new Date(+t)}function ws(e,i,n,a,r,o,s,l,h,u){var c=Ea(),g=c.invert,d=c.domain,f=u(".%L"),p=u(":%S"),_=u("%I:%M"),m=u("%I %p"),y=u("%a %d"),v=u("%b %d"),b=u("%B"),x=u("%Y");function w(t){return(h(t)<t?f:l(t)<t?p:s(t)<t?_:o(t)<t?m:a(t)<t?r(t)<t?y:v:n(t)<t?b:x)(t)}return c.invert=function(t){return new Date(g(t))},c.domain=function(t){return arguments.length?d(Array.from(t,xs)):d().map(bs)},c.ticks=function(t){var n=d();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(t,n){return null==n?w:u(n)},c.nice=function(t){var n=d();return(t=t&&"function"==typeof t.range?t:i(n[0],n[n.length-1],null==t?10:t))?d(Va(n,t)):c},c.copy=function(){return za(c,ws(e,i,n,a,r,o,s,l,h,u))},c}function Ss(){return ma.apply(ws(qr,$r,Hr,Ir,Nr,zr,Mr,kr,Sr,Qr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ks(){var n,e,i,a,r,o=0,s=1,l=ka,h=!1;function u(t){return null==t||isNaN(t=+t)?r:l(0===i?.5:(t=(a(t)-n)*i,h?Math.max(0,Math.min(1,t)):t))}function t(e){return function(t){var n;return arguments.length?([t,n]=t,l=e(t,n),u):[l(0),l(1)]}}return u.domain=function(t){return arguments.length?([o,s]=t,n=a(o=+o),e=a(s=+s),i=n===e?0:1/(e-n),u):[o,s]},u.clamp=function(t){return arguments.length?(h=!!t,u):h},u.interpolator=function(t){return arguments.length?(l=t,u):l},u.range=t(ie),u.rangeRound=t(ae),u.unknown=function(t){return arguments.length?(r=t,u):r},function(t){return n=(a=t)(o),e=t(s),i=n===e?0:1/(e-n),u}}function Cs(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Ms(){var t=hr(ks());return t.copy=function(){return Cs(t,Ms()).exponent(t.exponent())},ya.apply(t,arguments)}function As(){var n,e,i,a,r,o,s,l=0,h=.5,u=1,c=1,g=ka,d=!1;function f(t){return isNaN(t=+t)?s:(t=.5+((t=+o(t))-e)*(c*t<c*e?a:r),g(d?Math.max(0,Math.min(1,t)):t))}function t(i){return function(t){var n,e;return arguments.length?([t,n,e]=t,g=((t,n)=>{void 0===n&&(n=t,t=ie);for(var e=0,i=n.length-1,a=n[0],r=new Array(i<0?0:i);e<i;)r[e]=t(a,a=n[++e]);return function(t){var n=Math.max(0,Math.min(i-1,Math.floor(t*=i)));return r[n](t-n)}})(i,[t,n,e]),f):[g(0),g(.5),g(1)]}}return f.domain=function(t){return arguments.length?([l,h,u]=t,n=o(l=+l),e=o(h=+h),i=o(u=+u),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f):[l,h,u]},f.clamp=function(t){return arguments.length?(d=!!t,f):d},f.interpolator=function(t){return arguments.length?(g=t,f):g},f.range=t(ie),f.rangeRound=t(ae),f.unknown=function(t){return arguments.length?(s=t,f):s},function(t){return n=(o=t)(l),e=t(h),i=t(u),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f}}function zs(){var t=hr(As());return t.copy=function(){return Cs(t,zs()).exponent(t.exponent())},ya.apply(t,arguments)}vs({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var Ts=Object.freeze({__proto__:null,scaleBand:xa,scaleDiverging:function t(){var n=qa(As()(ka));return n.copy=function(){return Cs(n,t())},ya.apply(n,arguments)},scaleDivergingLog:function t(){var n=nr(As()).domain([.1,1,10]);return n.copy=function(){return Cs(n,t()).base(n.base())},ya.apply(n,arguments)},scaleDivergingPow:zs,scaleDivergingSqrt:function(){return zs.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var n=rr(As());return n.copy=function(){return Cs(n,t()).constant(n.constant())},ya.apply(n,arguments)},scaleIdentity:function t(n){var e;function i(t){return null==t||isNaN(t=+t)?e:t}return(i.invert=i).domain=i.range=function(t){return arguments.length?(n=Array.from(t,wa),i):n.slice()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,wa):[0,1],qa(i)},scaleImplicit:va,scaleLinear:$a,scaleLog:er,scaleOrdinal:ba,scalePoint:function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return t(e())},n}(xa.apply(null,arguments).paddingInner(1))},scalePow:ur,scaleQuantile:function t(){var n,e=[],i=[],a=[];function r(){var t=0,n=Math.max(1,i.length);for(a=new Array(n-1);++t<n;)a[t-1]=((t,n,e=Ri)=>{var i,a;if((i=t.length)&&!isNaN(n=+n))return n<=0||i<2?+e(t[0],0,t):1<=n?+e(t[i-1],i-1,t):(i=(i-1)*n,(a=+e(t[n=Math.floor(i)],n,t))+(+e(t[n+1],n+1,t)-a)*(i-n))})(e,t/n);return o}function o(t){return null==t||isNaN(t=+t)?n:i[Ii(a,t)]}return o.invertExtent=function(t){return(t=i.indexOf(t))<0?[NaN,NaN]:[0<t?a[t-1]:e[0],t<a.length?a[t]:e[e.length-1]]},o.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Oi),r()},o.range=function(t){return arguments.length?(i=Array.from(t),r()):i.slice()},o.unknown=function(t){return arguments.length?(n=t,o):n},o.quantiles=function(){return a.slice()},o.copy=function(){return t().domain(e).range(i).unknown(n)},ma.apply(o,arguments)},scaleQuantize:function t(){var n,e=0,i=1,a=1,r=[.5],o=[0,1];function s(t){return null!=t&&t<=t?o[Ii(r,t,0,a)]:n}function l(){var t=-1;for(r=new Array(a);++t<a;)r[t]=((t+1)*i-(t-a)*e)/(a+1);return s}return s.domain=function(t){return arguments.length?([e,i]=t,e=+e,i=+i,l()):[e,i]},s.range=function(t){return arguments.length?(a=(o=Array.from(t)).length-1,l()):o.slice()},s.invertExtent=function(t){return(t=o.indexOf(t))<0?[NaN,NaN]:t<1?[e,r[0]]:a<=t?[r[a-1],i]:[r[t-1],r[t]]},s.unknown=function(t){return arguments.length&&(n=t),s},s.thresholds=function(){return r.slice()},s.copy=function(){return t().domain([e,i]).range(o).unknown(n)},ma.apply(qa(s),arguments)},scaleRadial:function t(){var n,e=Ea(),i=[0,1],a=!1;function r(t){return t=e(t),t=Math.sign(t)*Math.sqrt(Math.abs(t)),isNaN(t)?n:a?Math.round(t):t}return r.invert=function(t){return e.invert(cr(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain()},r.range=function(t){return arguments.length?(e.range((i=Array.from(t,wa)).map(cr)),r):i.slice()},r.rangeRound=function(t){return r.range(t).round(!0)},r.round=function(t){return arguments.length?(a=!!t,r):a},r.clamp=function(t){return arguments.length?(e.clamp(t),r):e.clamp()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e.domain(),i).round(a).clamp(e.clamp()).unknown(n)},ma.apply(r,arguments),qa(r)},scaleSequential:function t(){var n=qa(ks()(ka));return n.copy=function(){return Cs(n,t())},ya.apply(n,arguments)},scaleSequentialLog:function t(){var n=nr(ks()).domain([1,10]);return n.copy=function(){return Cs(n,t()).base(n.base())},ya.apply(n,arguments)},scaleSequentialPow:Ms,scaleSequentialQuantile:function t(){var i=[],e=ka;function a(t){if(null!=t&&!isNaN(t=+t))return e((Ii(i,t,1)-1)/(i.length-1))}return a.domain=function(t){if(!arguments.length)return i.slice();i=[];for(var n of t)null==n||isNaN(n=+n)||i.push(n);return i.sort(Oi),a},a.interpolator=function(t){return arguments.length?(e=t,a):e},a.range=function(){return i.map((t,n)=>e(n/(i.length-1)))},a.quantiles=function(e){return Array.from({length:e+1},(t,n)=>aa(i,n/e))},a.copy=function(){return t(e).domain(i)},ya.apply(a,arguments)},scaleSequentialSqrt:function(){return Ms.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var n=rr(ks());return n.copy=function(){return Cs(n,t()).constant(n.constant())},ya.apply(n,arguments)},scaleSqrt:function(){return ur.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var n=rr(Ta());return n.copy=function(){return za(n,t()).constant(n.constant())},ma.apply(n,arguments)},scaleThreshold:gr,scaleTime:Ss,scaleUtc:function(){return ma.apply(ws(Ur,Wr,Gr,Fr,Dr,Tr,Ar,Cr,Sr,to).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:Wa});function v(t){return function(){return t}}let Es=Math.abs,Ns=Math.atan2,Ps=Math.cos,Ls=Math.max,Bs=Math.min,Os=Math.sin,Ds=Math.sqrt,js=1e-12,Rs=Math.PI,Is=Rs/2,Fs=2*Rs;function Hs(t){return 1<=t?Is:t<=-1?-Is:Math.asin(t)}let Gs=Math.PI,Ks=2*Gs,Us=1e-6,Ws=Ks-Us;function qs(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}let $s=class{moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,i){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+i}`}bezierCurveTo(t,n,e,i,a,r){this._append`C${+t},${+n},${+e},${+i},${this._x1=+a},${this._y1=+r}`}arcTo(t,n,e,i,a){
|
|
645
645
|
// Is the radius negative? Error.
|
|
646
646
|
if(t=+t,n=+n,e=+e,i=+i,(a=+a)<0)throw new Error("negative radius: "+a);var r,o,s=this._x1,l=this._y1,h=e-t,u=i-n,c=s-t,g=l-n,d=c*c+g*g;
|
|
647
647
|
// Is this path empty? Move to (x1,y1).
|
|
@@ -665,30 +665,30 @@ this._="",this._append=null==t?qs:(t=>{var n=Math.floor(t);if(!(0<=n))throw new
|
|
|
665
665
|
function tl(t,n,e,i,a,r,o){var s=t-e,l=n-i,o=(o?r:-r)/Ds(s*s+l*l),l=o*l,o=-o*s,s=t+l,t=n+o,n=e+l,e=i+o,i=(s+n)/2,h=(t+e)/2,u=n-s,c=e-t,g=u*u+c*c,r=a-r,s=s*e-n*t,e=(c<0?-1:1)*Ds(Ls(0,r*r*g-s*s)),n=(s*c-u*e)/g,t=(-s*u-c*e)/g,d=(s*c+u*e)/g,s=(-s*u+c*e)/g,u=n-i,c=t-h,e=d-i,g=s-h;
|
|
666
666
|
// Pick the closer of the two intersection points.
|
|
667
667
|
// TODO Is there a faster way to determine which intersection to use?
|
|
668
|
-
return e*e+g*g<u*u+c*c&&(n=d,t=s),{cx:n,cy:t,x01:-l,y01:-o,x11:n*(a/r-1),y11:t*(a/r-1)}}function nl(){var z=Ys,T=Xs,E=v(0),
|
|
668
|
+
return e*e+g*g<u*u+c*c&&(n=d,t=s),{cx:n,cy:t,x01:-l,y01:-o,x11:n*(a/r-1),y11:t*(a/r-1)}}function nl(){var z=Ys,T=Xs,E=v(0),N=null,P=Zs,L=Js,B=Qs,O=null,D=Vs(n);function n(){var t,n,e,i,a,r,o,s,l,h,u,c,g,d,f,p,_,m,y,v,b,x,w=+z.apply(this,arguments),S=+T.apply(this,arguments),k=P.apply(this,arguments)-Is,C=L.apply(this,arguments)-Is,M=Es(C-k),A=k<C;if(O=O||(t=D()),
|
|
669
669
|
// Ensure that the outer radius is always larger than the inner radius.
|
|
670
670
|
S<w&&(n=S,S=w,w=n),
|
|
671
671
|
// Is it a point?
|
|
672
|
-
S>js?M>Fs-js?(O.moveTo(S*
|
|
672
|
+
S>js?M>Fs-js?(O.moveTo(S*Ps(k),S*Os(k)),O.arc(0,0,S,k,C,!A),w>js&&(O.moveTo(w*Ps(C),w*Os(C)),O.arc(0,0,w,C,k,A))):(i=n=k,a=e=C,o=r=M,g=(u=B.apply(this,arguments)/2)>js&&(N?+N.apply(this,arguments):Ds(w*w+S*S)),x=b=s=Bs(Es(S-w)/2,+E.apply(this,arguments)),
|
|
673
673
|
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
|
674
|
-
g>js&&(c=Hs(g/w*Os(u)),g=Hs(g/S*Os(u)),(r-=2*c)>js?(i+=c*=A?1:-1,a-=c):(r=0,i=a=(k+C)/2),(o-=2*g)>js?(n+=g*=A?1:-1,e-=g):(o=0,n=e=(k+C)/2)),u=S*
|
|
674
|
+
g>js&&(c=Hs(g/w*Os(u)),g=Hs(g/S*Os(u)),(r-=2*c)>js?(i+=c*=A?1:-1,a-=c):(r=0,i=a=(k+C)/2),(o-=2*g)>js?(n+=g*=A?1:-1,e-=g):(o=0,n=e=(k+C)/2)),u=S*Ps(n),c=S*Os(n),g=w*Ps(a),k=w*Os(a),
|
|
675
675
|
// Apply rounded corners?
|
|
676
|
-
s>js&&(d=S*
|
|
676
|
+
s>js&&(d=S*Ps(e),f=S*Os(e),p=w*Ps(i),_=w*Os(i),M<Rs)&&((C=((t,n,e,i,a,r,o,s)=>{var l=(s=s-r)*(e=e-t)-(o=o-a)*(i=i-n);if(!(l*l<js))return[t+(l=(o*(n-r)-s*(t-a))/l)*e,n+l*i]})(u,c,p,_,d,f,g,k))?(M=u-C[0],y=c-C[1],v=d-C[0],m=f-C[1],y=1/Os((1<(M=(M*v+y*m)/(Ds(M*M+y*y)*Ds(v*v+m*m)))?0:M<-1?Rs:Math.acos(M))/2),v=Ds(C[0]*C[0]+C[1]*C[1]),b=Bs(s,(w-v)/(y-1)),x=Bs(s,(S-v)/(1+y))):b=x=0),
|
|
677
677
|
// Is the sector collapsed to a line?
|
|
678
678
|
o>js?x>js?(l=tl(p,_,u,c,S,x,A),h=tl(d,f,g,k,S,x,A),O.moveTo(l.cx+l.x01,l.cy+l.y01),
|
|
679
679
|
// Have the corners merged?
|
|
680
|
-
x<s?O.arc(l.cx,l.cy,x,
|
|
680
|
+
x<s?O.arc(l.cx,l.cy,x,Ns(l.y01,l.x01),Ns(h.y01,h.x01),!A):(O.arc(l.cx,l.cy,x,Ns(l.y01,l.x01),Ns(l.y11,l.x11),!A),O.arc(0,0,S,Ns(l.cy+l.y11,l.cx+l.x11),Ns(h.cy+h.y11,h.cx+h.x11),!A),O.arc(h.cx,h.cy,x,Ns(h.y11,h.x11),Ns(h.y01,h.x01),!A))):(O.moveTo(u,c),O.arc(0,0,S,n,e,!A)):O.moveTo(u,c),
|
|
681
681
|
// Is there no inner ring, and it’s a circular sector?
|
|
682
682
|
// Or perhaps it’s an annular sector collapsed due to padding?
|
|
683
683
|
w>js&&r>js?b>js?(l=tl(g,k,d,f,w,-b,A),h=tl(u,c,p,_,w,-b,A),O.lineTo(l.cx+l.x01,l.cy+l.y01),
|
|
684
684
|
// Have the corners merged?
|
|
685
|
-
b<s?O.arc(l.cx,l.cy,b,
|
|
685
|
+
b<s?O.arc(l.cx,l.cy,b,Ns(l.y01,l.x01),Ns(h.y01,h.x01),!A):(O.arc(l.cx,l.cy,b,Ns(l.y01,l.x01),Ns(l.y11,l.x11),!A),O.arc(0,0,w,Ns(l.cy+l.y11,l.cx+l.x11),Ns(h.cy+h.y11,h.cx+h.x11),A),O.arc(h.cx,h.cy,b,Ns(h.y11,h.x11),Ns(h.y01,h.x01),!A))):O.arc(0,0,w,a,i,A):O.lineTo(g,k)):O.moveTo(0,0),O.closePath(),t)return O=null,t+""||null}return n.centroid=function(){var t=(+z.apply(this,arguments)+ +T.apply(this,arguments))/2,n=(+P.apply(this,arguments)+ +L.apply(this,arguments))/2-Rs/2;return[Ps(n)*t,Os(n)*t]},n.innerRadius=function(t){return arguments.length?(z="function"==typeof t?t:v(+t),n):z},n.outerRadius=function(t){return arguments.length?(T="function"==typeof t?t:v(+t),n):T},n.cornerRadius=function(t){return arguments.length?(E="function"==typeof t?t:v(+t),n):E},n.padRadius=function(t){return arguments.length?(N=null==t?null:"function"==typeof t?t:v(+t),n):N},n.startAngle=function(t){return arguments.length?(P="function"==typeof t?t:v(+t),n):P},n.endAngle=function(t){return arguments.length?(L="function"==typeof t?t:v(+t),n):L},n.padAngle=function(t){return arguments.length?(B="function"==typeof t?t:v(+t),n):B},n.context=function(t){return arguments.length?(O=null==t?null:t,n):O},n}var el=Array.prototype.slice;function il(t){return"object"==typeof t&&"length"in t?t:Array.from(t);// Map, Set, iterable, string, or anything else
|
|
686
686
|
}function al(t){this._context=t}function rl(t){return new al(t)}function ol(t){return t[0]}function sl(t){return t[1]}function ll(o,s){var l=v(!0),h=null,u=rl,c=null,g=Vs(n);function n(t){var n,e,i,a=(t=il(t)).length,r=!1;for(null==h&&(c=u(i=g())),n=0;n<=a;++n)!(n<a&&l(e=t[n],n,t))===r&&((r=!r)?c.lineStart():c.lineEnd()),r&&c.point(+o(e,n,t),+s(e,n,t));if(i)return c=null,i+""||null}return o="function"==typeof o?o:void 0===o?ol:v(o),s="function"==typeof s?s:void 0===s?sl:v(s),n.x=function(t){return arguments.length?(o="function"==typeof t?t:v(+t),n):o},n.y=function(t){return arguments.length?(s="function"==typeof t?t:v(+t),n):s},n.defined=function(t){return arguments.length?(l="function"==typeof t?t:v(!!t),n):l},n.curve=function(t){return arguments.length?(u=t,null!=h&&(c=u(h)),n):u},n.context=function(t){return arguments.length?(null==t?h=c=null:c=u(h=t),n):h},n}function hl(u,c,g){var d=null,f=v(!0),p=null,_=rl,m=null,y=Vs(n);function n(t){var n,e,i,a,r,o=(t=il(t)).length,s=!1,l=new Array(o),h=new Array(o);for(null==p&&(m=_(r=y())),n=0;n<=o;++n){if(!(n<o&&f(a=t[n],n,t))===s)if(s=!s)e=n,m.areaStart(),m.lineStart();else{for(m.lineEnd(),m.lineStart(),i=n-1;e<=i;--i)m.point(l[i],h[i]);m.lineEnd(),m.areaEnd()}s&&(l[n]=+u(a,n,t),h[n]=+c(a,n,t),m.point(d?+d(a,n,t):l[n],g?+g(a,n,t):h[n]))}if(r)return m=null,r+""||null}function t(){return ll().defined(f).curve(_).context(p)}return u="function"==typeof u?u:void 0===u?ol:v(+u),c="function"==typeof c?c:v(void 0===c?0:+c),g="function"==typeof g?g:void 0===g?sl:v(+g),n.x=function(t){return arguments.length?(u="function"==typeof t?t:v(+t),d=null,n):u},n.x0=function(t){return arguments.length?(u="function"==typeof t?t:v(+t),n):u},n.x1=function(t){return arguments.length?(d=null==t?null:"function"==typeof t?t:v(+t),n):d},n.y=function(t){return arguments.length?(c="function"==typeof t?t:v(+t),g=null,n):c},n.y0=function(t){return arguments.length?(c="function"==typeof t?t:v(+t),n):c},n.y1=function(t){return arguments.length?(g=null==t?null:"function"==typeof t?t:v(+t),n):g},n.lineX0=n.lineY0=function(){return t().x(u).y(c)},n.lineY1=function(){return t().x(u).y(g)},n.lineX1=function(){return t().x(d).y(c)},n.defined=function(t){return arguments.length?(f="function"==typeof t?t:v(!!t),n):f},n.curve=function(t){return arguments.length?(_=t,null!=p&&(m=_(p)),n):_},n.context=function(t){return arguments.length?(null==t?p=m=null:m=_(p=t),n):p},n}function ul(t,n){return n<t?-1:t<n?1:t<=n?0:NaN}function cl(t){return t}function gl(){var d=cl,f=ul,p=null,_=v(0),m=v(Fs),y=v(0);function n(e){for(var t,n,i,a=(e=il(e)).length,r=0,o=new Array(a),s=new Array(a),l=+_.apply(this,arguments),h=Math.min(Fs,Math.max(-Fs,m.apply(this,arguments)-l)),u=Math.min(Math.abs(h)/a,y.apply(this,arguments)),c=u*(h<0?-1:1),g=0;g<a;++g)0<(i=s[o[g]=g]=+d(e[g],g,e))&&(r+=i);
|
|
687
687
|
// Optionally sort the arcs by previously-computed values or by data.
|
|
688
688
|
// Compute the arcs! They are stored in the original data's order.
|
|
689
689
|
for(null!=f?o.sort(function(t,n){return f(s[t],s[n])}):null!=p&&o.sort(function(t,n){return p(e[t],e[n])}),g=0,t=r?(h-a*c)/r:0;g<a;++g,l=n)n=o[g],i=s[n],s[n]={data:e[n],index:g,value:i,startAngle:l,endAngle:n=l+(0<i?i*t:0)+c,padAngle:u};return s}return n.value=function(t){return arguments.length?(d="function"==typeof t?t:v(+t),n):d},n.sortValues=function(t){return arguments.length?(f=t,p=null,n):f},n.sort=function(t){return arguments.length?(p=t,f=null,n):p},n.startAngle=function(t){return arguments.length?(_="function"==typeof t?t:v(+t),n):_},n.endAngle=function(t){return arguments.length?(m="function"==typeof t?t:v(+t),n):m},n.padAngle=function(t){return arguments.length?(y="function"==typeof t?t:v(+t),n):y},n}al.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;// falls through
|
|
690
690
|
default:this._context.lineTo(t,n)}}};var dl=pl(rl);function fl(t){this._curve=t}function pl(n){function t(t){return new fl(n(t))}return t._curve=n,t}function _l(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(pl(t)):n()._curve},t}function ml(){return _l(ll().curve(dl))}function yl(){var t=hl().curve(dl),n=t.curve,e=t.lineX0,i=t.lineX1,a=t.lineY0,r=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return _l(e())},delete t.lineX0,t.lineEndAngle=function(){return _l(i())},delete t.lineX1,t.lineInnerRadius=function(){return _l(a())},delete t.lineY0,t.lineOuterRadius=function(){return _l(r())},delete t.lineY1,t.curve=function(t){return arguments.length?n(pl(t)):n()._curve},t}function vl(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}fl.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};class bl{areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;// falls through
|
|
691
|
-
default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n)}this._x0=t,this._y0=n}constructor(t,n){this._context=t,this._x=n}}class xl{lineStart(){this._point=0}lineEnd(){}point(t,n){var e,i,a,r;t=+t,n=+n,0===this._point?this._point=1:(e=vl(this._x0,this._y0),i=vl(this._x0,this._y0=(this._y0+n)/2),a=vl(t,this._y0),r=vl(t,n),this._context.moveTo(...e),this._context.bezierCurveTo(...i,...a,...r)),this._x0=t,this._y0=n}constructor(t){this._context=t}}function wl(t){return new bl(t,!0)}function Sl(t){return new bl(t,!1)}function kl(t){return new xl(t)}function Cl(t){return t.source}function Ml(t){return t.target}function Al(a){let r=Cl,o=Ml,s=ol,l=sl,h=null,u=null,c=Vs(n);function n(){let t;var n=el.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if((u=null==h?a(t=c()):u).lineStart(),n[0]=e,u.point(+s.apply(this,n),+l.apply(this,n)),n[0]=i,u.point(+s.apply(this,n),+l.apply(this,n)),u.lineEnd(),t)return u=null,t+""||null}return n.source=function(t){return arguments.length?(r=t,n):r},n.target=function(t){return arguments.length?(o=t,n):o},n.x=function(t){return arguments.length?(s="function"==typeof t?t:v(+t),n):s},n.y=function(t){return arguments.length?(l="function"==typeof t?t:v(+t),n):l},n.context=function(t){return arguments.length?(null==t?h=u=null:u=a(h=t),n):h},n}let zl=Ds(3),Tl={draw(t,n){var n=.59436*Ds(n+Bs(n/28,.75)),e=n/2,i=e*zl;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-e),t.lineTo(i,e),t.moveTo(-i,e),t.lineTo(i,-e)}};var El={draw(t,n){n=Ds(n/Rs);t.moveTo(n,0),t.arc(0,0,n,0,Fs)}},_n={draw(t,n){n=Ds(n/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};let
|
|
691
|
+
default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n)}this._x0=t,this._y0=n}constructor(t,n){this._context=t,this._x=n}}class xl{lineStart(){this._point=0}lineEnd(){}point(t,n){var e,i,a,r;t=+t,n=+n,0===this._point?this._point=1:(e=vl(this._x0,this._y0),i=vl(this._x0,this._y0=(this._y0+n)/2),a=vl(t,this._y0),r=vl(t,n),this._context.moveTo(...e),this._context.bezierCurveTo(...i,...a,...r)),this._x0=t,this._y0=n}constructor(t){this._context=t}}function wl(t){return new bl(t,!0)}function Sl(t){return new bl(t,!1)}function kl(t){return new xl(t)}function Cl(t){return t.source}function Ml(t){return t.target}function Al(a){let r=Cl,o=Ml,s=ol,l=sl,h=null,u=null,c=Vs(n);function n(){let t;var n=el.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if((u=null==h?a(t=c()):u).lineStart(),n[0]=e,u.point(+s.apply(this,n),+l.apply(this,n)),n[0]=i,u.point(+s.apply(this,n),+l.apply(this,n)),u.lineEnd(),t)return u=null,t+""||null}return n.source=function(t){return arguments.length?(r=t,n):r},n.target=function(t){return arguments.length?(o=t,n):o},n.x=function(t){return arguments.length?(s="function"==typeof t?t:v(+t),n):s},n.y=function(t){return arguments.length?(l="function"==typeof t?t:v(+t),n):l},n.context=function(t){return arguments.length?(null==t?h=u=null:u=a(h=t),n):h},n}let zl=Ds(3),Tl={draw(t,n){var n=.59436*Ds(n+Bs(n/28,.75)),e=n/2,i=e*zl;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-e),t.lineTo(i,e),t.moveTo(-i,e),t.lineTo(i,-e)}};var El={draw(t,n){n=Ds(n/Rs);t.moveTo(n,0),t.arc(0,0,n,0,Fs)}},_n={draw(t,n){n=Ds(n/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};let Nl=Ds(1/3),Pl=2*Nl,Ll={draw(t,n){var n=Ds(n/Pl),e=n*Nl;t.moveTo(0,-n),t.lineTo(e,0),t.lineTo(0,n),t.lineTo(-e,0),t.closePath()}},Bl={draw(t,n){n=.62625*Ds(n);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},Ol={draw(t,n){n=.87559*Ds(n-Bs(n/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},Dl={draw(t,n){var n=Ds(n),e=-n/2;t.rect(e,e,n,n)}},jl={draw(t,n){n=.4431*Ds(n);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};n=Os(Rs/10)/Os(7*Rs/10);let Rl=Os(Fs/10)*n,Il=-Ps(Fs/10)*n,Fl={draw(n,t){var e=Ds(.8908130915292852*t),i=Rl*e,a=Il*e;n.moveTo(0,-e),n.lineTo(i,a);for(let t=1;t<5;++t){var r=Fs*t/5,o=Ps(r),r=Os(r);n.lineTo(r*e,-o*e),n.lineTo(o*i-r*a,r*i+o*a)}n.closePath()}},Hl=Ds(3),Gl={draw(t,n){n=-Ds(n/(3*Hl));t.moveTo(0,2*n),t.lineTo(-Hl*n,-n),t.lineTo(Hl*n,-n),t.closePath()}},Kl=Ds(3),Ul={draw(t,n){var n=.6824*Ds(n),e=n/2,i=n*Kl/2;// cos(Math.PI / 6)
|
|
692
692
|
t.moveTo(0,-n),t.lineTo(i,e),t.lineTo(-i,e),t.closePath()}},Wl=-.5,ql=Ds(3)/2,$l=1/Ds(12),Vl=3*($l/2+1),Yl={draw(t,n){var n=Ds(n/Vl),e=n/2,i=n*$l,a=e,n=n*$l+n,r=-a,o=n;t.moveTo(e,i),t.lineTo(a,n),t.lineTo(r,o),t.lineTo(Wl*e-ql*i,ql*e+Wl*i),t.lineTo(Wl*a-ql*n,ql*a+Wl*n),t.lineTo(Wl*r-ql*o,ql*r+Wl*o),t.lineTo(Wl*e+ql*i,Wl*i-ql*e),t.lineTo(Wl*a+ql*n,Wl*n-ql*a),t.lineTo(Wl*r+ql*o,Wl*o-ql*r),t.closePath()}},Xl={draw(t,n){n=.6189*Ds(n-Bs(n/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};
|
|
693
693
|
// These symbols are designed to be filled.
|
|
694
694
|
pn=[El,_n,Ll,Dl,Fl,Gl,Yl],Br=[El,Ol,Xl,Ul,Tl,jl,Bl];
|
|
@@ -713,9 +713,9 @@ function vh(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}
|
|
|
713
713
|
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
|
714
714
|
function bh(t,n,e){var i=t._x0,a=t._x1,r=t._y1,o=(a-i)/3;t._context.bezierCurveTo(i+o,t._y0+o*n,a-o,r-o*e,a,r)}function xh(t){this._context=t}function wh(t){this._context=new Sh(t)}function Sh(t){this._context=t}function kh(t){this._context=t}
|
|
715
715
|
// See https://www.particleincell.com/2012/bezier-splines/ for derivation.
|
|
716
|
-
function Ch(t){var n,e,i=t.length-1,a=new Array(i),r=new Array(i),o=new Array(i);for(r[a[0]=0]=2,o[0]=t[0]+2*t[1],n=1;n<i-1;++n)a[n]=1,r[n]=4,o[n]=4*t[n]+2*t[n+1];for(a[i-1]=2,r[i-1]=7,o[i-1]=8*t[i-1]+t[i],n=1;n<i;++n)e=a[n]/r[n-1],r[n]-=e,o[n]-=e*o[n-1];for(a[i-1]=o[i-1]/r[i-1],n=i-2;0<=n;--n)a[n]=(o[n]-a[n+1])/r[n];for(r[i-1]=(t[i]+a[i-1])/2,n=0;n<i-1;++n)r[n]=2*t[n+1]-a[n+1];return[a,r]}function Mh(t,n){this._context=t,this._t=n}function Ah(t,n){if(1<(a=t.length))for(var e,i,a,r=1,o=t[n[0]],s=o.length;r<a;++r)for(i=o,o=t[n[r]],e=0;e<s;++e)o[e][1]+=o[e][0]=isNaN(i[e][1])?i[e][0]:i[e][1]}function zh(t){for(var n=t.length,e=new Array(n);0<=--n;)e[n]=n;return e}function Th(t,n){return t[n]}function Eh(t){var n=[];return n.key=t,n}function
|
|
716
|
+
function Ch(t){var n,e,i=t.length-1,a=new Array(i),r=new Array(i),o=new Array(i);for(r[a[0]=0]=2,o[0]=t[0]+2*t[1],n=1;n<i-1;++n)a[n]=1,r[n]=4,o[n]=4*t[n]+2*t[n+1];for(a[i-1]=2,r[i-1]=7,o[i-1]=8*t[i-1]+t[i],n=1;n<i;++n)e=a[n]/r[n-1],r[n]-=e,o[n]-=e*o[n-1];for(a[i-1]=o[i-1]/r[i-1],n=i-2;0<=n;--n)a[n]=(o[n]-a[n+1])/r[n];for(r[i-1]=(t[i]+a[i-1])/2,n=0;n<i-1;++n)r[n]=2*t[n+1]-a[n+1];return[a,r]}function Mh(t,n){this._context=t,this._t=n}function Ah(t,n){if(1<(a=t.length))for(var e,i,a,r=1,o=t[n[0]],s=o.length;r<a;++r)for(i=o,o=t[n[r]],e=0;e<s;++e)o[e][1]+=o[e][0]=isNaN(i[e][1])?i[e][0]:i[e][1]}function zh(t){for(var n=t.length,e=new Array(n);0<=--n;)e[n]=n;return e}function Th(t,n){return t[n]}function Eh(t){var n=[];return n.key=t,n}function Nh(){var s=v([]),l=zh,h=Ah,u=Th;function n(t){var n,e,i,a=Array.from(s.apply(this,arguments),Eh),r=a.length,o=-1;for(i of t)for(n=0,++o;n<r;++n)(a[n][o]=[0,+u(i,a[n].key,o,t)]).data=i;for(n=0,e=il(l(a));n<r;++n)a[e[n]].index=n;return h(a,e),a}return n.keys=function(t){return arguments.length?(s="function"==typeof t?t:v(Array.from(t)),n):s},n.value=function(t){return arguments.length?(u="function"==typeof t?t:v(+t),n):u},n.order=function(t){return arguments.length?(l=null==t?zh:"function"==typeof t?t:v(Array.from(t)),n):l},n.offset=function(t){return arguments.length?(h=null==t?Ah:t,n):h},n}function Ph(t){var e=t.map(Lh);return zh(t).sort(function(t,n){return e[t]-e[n]})}function Lh(t){for(var n,e=-1,i=0,a=t.length,r=-1/0;++e<a;)(n=+t[e][1])>r&&(r=n,i=e);return i}function Bh(t){var e=t.map(Oh);return zh(t).sort(function(t,n){return e[t]-e[n]})}function Oh(t){for(var n,e=0,i=-1,a=t.length;++i<a;)(n=+t[i][1])&&(e+=n);return e}_h.prototype={areaStart:Zl,areaEnd:Zl,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},xh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:bh(this,this._t0,vh(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){// Ignore coincident points.
|
|
717
717
|
switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,bh(this,vh(this,e=yh(this,t,n)),e);break;default:bh(this,this._t0,e=yh(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(wh.prototype=Object.create(xh.prototype)).point=function(t,n){xh.prototype.point.call(this,n,t)},Sh.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,i,a,r){this._context.bezierCurveTo(n,t,i,e,r,a)}},kh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var i=Ch(t),a=Ch(n),r=0,o=1;o<e;++r,++o)this._context.bezierCurveTo(i[0][r],a[0][r],i[1][r],a[1][r],t[o],n[o]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},Mh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),0<=this._line&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;// falls through
|
|
718
|
-
default:var e;this._t<=0?(this._context.lineTo(this._x,n),this._context.lineTo(t,n)):(e=this._x*(1-this._t)+t*this._t,this._context.lineTo(e,this._y),this._context.lineTo(e,n))}this._x=t,this._y=n}};var Dh,jh=Object.freeze({__proto__:null,arc:nl,area:hl,areaRadial:yl,curveBasis:function(t){return new Ql(t)},curveBasisClosed:function(t){return new th(t)},curveBasisOpen:function(t){return new nh(t)},curveBumpX:wl,curveBumpY:Sl,curveBundle:mn,curveCardinal:n,curveCardinalClosed:oh,curveCardinalOpen:lh,curveCatmullRom:ch,curveCatmullRomClosed:dh,curveCatmullRomOpen:ph,curveLinear:rl,curveLinearClosed:function(t){return new _h(t)},curveMonotoneX:function(t){return new xh(t)},curveMonotoneY:function(t){return new wh(t)},curveNatural:function(t){return new kh(t)},curveStep:function(t){return new Mh(t,.5)},curveStepAfter:function(t){return new Mh(t,1)},curveStepBefore:function(t){return new Mh(t,0)},line:ll,lineRadial:ml,link:Al,linkHorizontal:function(){return Al(wl)},linkRadial:function(){var t=Al(kl);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},linkVertical:function(){return Al(Sl)},pie:gl,pointRadial:vl,radialArea:yl,radialLine:ml,stack:
|
|
718
|
+
default:var e;this._t<=0?(this._context.lineTo(this._x,n),this._context.lineTo(t,n)):(e=this._x*(1-this._t)+t*this._t,this._context.lineTo(e,this._y),this._context.lineTo(e,n))}this._x=t,this._y=n}};var Dh,jh=Object.freeze({__proto__:null,arc:nl,area:hl,areaRadial:yl,curveBasis:function(t){return new Ql(t)},curveBasisClosed:function(t){return new th(t)},curveBasisOpen:function(t){return new nh(t)},curveBumpX:wl,curveBumpY:Sl,curveBundle:mn,curveCardinal:n,curveCardinalClosed:oh,curveCardinalOpen:lh,curveCatmullRom:ch,curveCatmullRomClosed:dh,curveCatmullRomOpen:ph,curveLinear:rl,curveLinearClosed:function(t){return new _h(t)},curveMonotoneX:function(t){return new xh(t)},curveMonotoneY:function(t){return new wh(t)},curveNatural:function(t){return new kh(t)},curveStep:function(t){return new Mh(t,.5)},curveStepAfter:function(t){return new Mh(t,1)},curveStepBefore:function(t){return new Mh(t,0)},line:ll,lineRadial:ml,link:Al,linkHorizontal:function(){return Al(wl)},linkRadial:function(){var t=Al(kl);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},linkVertical:function(){return Al(Sl)},pie:gl,pointRadial:vl,radialArea:yl,radialLine:ml,stack:Nh,stackOffsetDiverging:function(t,n){if(0<(s=t.length))for(var e,i,a,r,o,s,l=0,h=t[n[0]].length;l<h;++l)for(e=r=o=0;e<s;++e)0<(a=(i=t[n[e]][l])[1]-i[0])?(i[0]=r,i[1]=r+=a):a<0?(i[1]=o,i[0]=o+=a):(i[0]=0,i[1]=a)},stackOffsetExpand:function(t,n){if(0<(i=t.length)){for(var e,i,a,r=0,o=t[0].length;r<o;++r){for(a=e=0;e<i;++e)a+=t[e][r][1]||0;if(a)for(e=0;e<i;++e)t[e][r][1]/=a}Ah(t,n)}},stackOffsetNone:Ah,stackOffsetSilhouette:function(t,n){if(0<(e=t.length)){for(var e,i=0,a=t[n[0]],r=a.length;i<r;++i){for(var o=0,s=0;o<e;++o)s+=t[o][i][1]||0;a[i][1]+=a[i][0]=-s/2}Ah(t,n)}},stackOffsetWiggle:function(t,n){if(0<(a=t.length)&&0<(i=(e=t[n[0]]).length)){for(var e,i,a,r=0,o=1;o<i;++o){for(var s=0,l=0,h=0;s<a;++s){for(var u=t[n[s]],c=u[o][1]||0,g=(c-(u[o-1][1]||0))/2,d=0;d<s;++d){var f=t[n[d]];g+=(f[o][1]||0)-(f[o-1][1]||0)}l+=c,h+=g*c}e[o-1][1]+=e[o-1][0]=r,l&&(r-=h/l)}e[o-1][1]+=e[o-1][0]=r,Ah(t,n)}},stackOrderAppearance:Ph,stackOrderAscending:Bh,stackOrderDescending:function(t){return Bh(t).reverse()},stackOrderInsideOut:function(t){for(var n,e=t.length,i=t.map(Oh),a=Ph(t),r=0,o=0,s=[],l=[],h=0;h<e;++h)n=a[h],(r<o?(r+=i[n],s):(o+=i[n],l)).push(n);return l.reverse().concat(s)},stackOrderNone:zh,stackOrderReverse:function(t){return zh(t).reverse()},symbol:function(n,e){let i=null,a=Vs(r);function r(){let t;if(i=i||(t=a()),n.apply(this,arguments).draw(i,+e.apply(this,arguments)),t)return i=null,t+""||null}return n="function"==typeof n?n:v(n||El),e="function"==typeof e?e:v(void 0===e?64:+e),r.type=function(t){return arguments.length?(n="function"==typeof t?t:v(t),r):n},r.size=function(t){return arguments.length?(e="function"==typeof t?t:v(+t),r):e},r.context=function(t){return arguments.length?(i=null==t?null:t,r):i},r},symbolAsterisk:Tl,symbolCircle:El,symbolCross:_n,symbolDiamond:Ll,symbolDiamond2:Bl,symbolPlus:Ol,symbolSquare:Dl,symbolSquare2:jl,symbolStar:Fl,symbolTimes:Xl,symbolTriangle:Gl,symbolTriangle2:Ul,symbolWye:Yl,symbolX:Xl,symbols:pn,symbolsFill:pn,symbolsStroke:Br});
|
|
719
719
|
/*
|
|
720
720
|
*
|
|
721
721
|
* 𝗖 𝗢 𝗟 𝗢 𝗥
|
|
@@ -750,7 +750,7 @@ zn(t)?t.toString():Ih("scale",n)(t)}function Hh(t,n
|
|
|
750
750
|
@desc Darkens a color so that it will appear legible on a white background.
|
|
751
751
|
@param {String} c A valid CSS color string.
|
|
752
752
|
@returns {String}
|
|
753
|
-
*/){n=1<arguments.length&&void 0!==n?n:{};return Ih(128<=(299*(t=
|
|
753
|
+
*/){n=1<arguments.length&&void 0!==n?n:{};return Ih(128<=(299*(t=Nn(t)).r+587*t.g+114*t.b)/1e3?"dark":"light",n)}function Gh(t){return.45<(t=Fn(t)).l&&(.8<t.s&&(t.s=.8),t.l=.45),t.toString()}
|
|
754
754
|
/**
|
|
755
755
|
@function colorLighter
|
|
756
756
|
@desc Similar to d3.color.brighter, except that this also reduces saturation so that colors don't appear neon.
|
|
@@ -1037,7 +1037,7 @@ return Math.abs(l)<1e-9?null:[((t=t[0]*n[1]-t[1]*n[0])*r-(n=e[0]*i[1]-e[1]*i[0])
|
|
|
1037
1037
|
@param {Array} p1 The first point, which should always be an `[x, y]` formatted Array.
|
|
1038
1038
|
@param {Array} p2 The second point, which should always be an `[x, y]` formatted Array.
|
|
1039
1039
|
@returns {Number}
|
|
1040
|
-
*/function
|
|
1040
|
+
*/function Nu(t,n){var e=n[0]-t[0],n=n[1]-t[1];return e*e+n*n}function Pu(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=new Array(n);e<n;e++)i[e]=t[e];return i}function Lu(t,n){return(t=>{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,a,r=[],o=!0,s=!1;try{for(e=e.call(t);!(o=(i=e.next()).done)&&(r.push(i.value),!n||r.length!==n);o=!0);}catch(t){s=!0,a=t}finally{try{o||null==e.return||e.return()}finally{if(s)throw a}}return r}})(t,n)||((t,n)=>{var e;if(t)return"string"==typeof t?Pu(t,n):"Map"===(e="Object"===(e=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Pu(t,n):void 0}
|
|
1041
1041
|
/**
|
|
1042
1042
|
@function polygonRayCast
|
|
1043
1043
|
@desc Gives the two closest intersection points between a ray cast from a point inside a polygon. The two points should lie on opposite sides of the origin.
|
|
@@ -1053,7 +1053,7 @@ return Math.abs(l)<1e-9?null:[((t=t[0]*n[1]-t[1]*n[0])*r-(n=e[0]*i[1]-e[1]*i[0])
|
|
|
1053
1053
|
@param {Number} alpha The angle in radians to rotate.
|
|
1054
1054
|
@param {Array} [origin = [0, 0]] The origin point of the rotation, which should always be an `[x, y]` formatted Array.
|
|
1055
1055
|
@returns {Boolean}
|
|
1056
|
-
*/){for(var e=2<arguments.length&&void 0!==e?e:0,i=Lu(n=[n[0]+1e-9*Math.cos(e),n[1]+1e-9*Math.sin(e)],2),a=i[0],i=i[1],r=[a+Math.cos(e),i+Math.sin(e)],o=0,s=(Math.abs(r[0]-a)<1e-9&&(o=1),-1),l=t.length,h=t[l-1],u=Number.MAX_VALUE,c=Number.MAX_VALUE,g=null,d=null;++s<l;){var f=h,p=Mu(n,r,f,h=t[s]);p&&Tu(f,h,p)&&(f=
|
|
1056
|
+
*/){for(var e=2<arguments.length&&void 0!==e?e:0,i=Lu(n=[n[0]+1e-9*Math.cos(e),n[1]+1e-9*Math.sin(e)],2),a=i[0],i=i[1],r=[a+Math.cos(e),i+Math.sin(e)],o=0,s=(Math.abs(r[0]-a)<1e-9&&(o=1),-1),l=t.length,h=t[l-1],u=Number.MAX_VALUE,c=Number.MAX_VALUE,g=null,d=null;++s<l;){var f=h,p=Mu(n,r,f,h=t[s]);p&&Tu(f,h,p)&&(f=Nu(n,p),p[o]<n[o]?f<u&&(u=f,g=p):p[o]>n[o]&&f<c&&(c=f,d=p))}return[g,d]}function Ou(t,n,e
|
|
1057
1057
|
/**
|
|
1058
1058
|
@function polygonRotate
|
|
1059
1059
|
@desc Rotates a point around a given origin.
|
|
@@ -1091,7 +1091,7 @@ return function t(n,e,i,a,r){for(var o,s,l,h,u,c,g,d=a,f=e+1;f<i;f++){s=n[f],p=n
|
|
|
1091
1091
|
@param {Array} polygon
|
|
1092
1092
|
@param {Number} sqTolerance
|
|
1093
1093
|
@private
|
|
1094
|
-
*/(t,n)=>{for(var e,i=t[0],a=[i],r=1,o=t.length;r<o;r++)
|
|
1094
|
+
*/(t,n)=>{for(var e,i=t[0],a=[i],r=1,o=t.length;r<o;r++)Nu(e=t[r],i)>n&&(a.push(e),i=e);return i!==e&&a.push(e),a})(t,n),n)),t}function Ru(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=new Array(n);e<n;e++)i[e]=t[e];return i}function Iu(t,n){return null!=n&&"undefined"!=typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](t):t instanceof n}function Fu(t,n){return(t=>{if(Array.isArray(t))return t})(t)||((t,n)=>{var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var i,a,r=[],o=!0,s=!1;try{for(e=e.call(t);!(o=(i=e.next()).done)&&(r.push(i.value),!n||r.length!==n);o=!0);}catch(t){s=!0,a=t}finally{try{o||null==e.return||e.return()}finally{if(s)throw a}}return r}})(t,n)||((t,n)=>{var e;if(t)return"string"==typeof t?Ru(t,n):"Map"===(e="Object"===(e=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ru(t,n):void 0}
|
|
1095
1095
|
// Algorithm constants
|
|
1096
1096
|
)(t,n)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}var Hu={};// step size for the aspect ratio
|
|
1097
1097
|
/**
|
|
@@ -1153,9 +1153,9 @@ for(var H=e.nTries;H;){var G=[Math.random()*R+s,Math.random()*I+h];Cu(t,G)&&o.pu
|
|
|
1153
1153
|
// generate improved origins
|
|
1154
1154
|
y&&m&&b.push([(y[0]+m[0])/2,(y[1]+m[1])/2]),// average along with width axis
|
|
1155
1155
|
v&&_&&b.push([(v[0]+_[0])/2,(v[1]+_[1])/2]),// average along with height axis
|
|
1156
|
-
e.events&&a.push({type:"modifOrigin",idx:p,p1W:y,p2W:m,p1H:v,p2H:_,modifOrigins:b});for(var x=0;x<b.length;x++){var w=b[x],S=(e.events&&a.push({type:"origin",cx:w[0],cy:w[1]}),Fu(Bu(t,w,f),2)),k=S[0],S=S[1];if(null!==k&&null!==S){var k=Math.min(
|
|
1156
|
+
e.events&&a.push({type:"modifOrigin",idx:p,p1W:y,p2W:m,p1H:v,p2H:_,modifOrigins:b});for(var x=0;x<b.length;x++){var w=b[x],S=(e.events&&a.push({type:"origin",cx:w[0],cy:w[1]}),Fu(Bu(t,w,f),2)),k=S[0],S=S[1];if(null!==k&&null!==S){var k=Math.min(Nu(w,k),Nu(w,S)),C=2*Math.sqrt(k),S=Fu(Bu(t,w,f+Math.PI/2),2),k=S[0],S=S[1];if(null!==k&&null!==S){var k=Math.min(Nu(w,k),Nu(w,S)),M=2*Math.sqrt(k);if(!(C*M<u)){var A=D;A.length||(A=jt(Math.max(e.minAspectRatio,e.minWidth/M,u/(M*M)),Math.min(e.maxAspectRatio,C/e.minHeight,C*C/u)+.5,.5));for(var K=0;K<A.length;K++){var z=A[K],T=Math.max(e.minWidth,Math.sqrt(u*z)),E=Math.min(C,M*z);
|
|
1157
1157
|
// do a binary search to find the max width that works
|
|
1158
|
-
if(!(E*M<u))for(e.events&&F<=E-T&&a.push({type:"aRatio",aRatio:z});F<=E-T;){var
|
|
1158
|
+
if(!(E*M<u))for(e.events&&F<=E-T&&a.push({type:"aRatio",aRatio:z});F<=E-T;){var N=(T+E)/2,P=N/z,L=Fu(w,2),B=L[0],L=L[1],O=[[B-N/2,L-P/2],[B+N/2,L-P/2],[B+N/2,L+P/2],[B-N/2,L+P/2]],U=Eu(O=function(t,n,e
|
|
1159
1159
|
/**
|
|
1160
1160
|
@desc square distance from a point to a segment
|
|
1161
1161
|
@param {Array} point
|
|
@@ -1164,14 +1164,14 @@ if(!(E*M<u))for(e.events&&F<=E-T&&a.push({type:"aRatio",aRatio:z});F<=E-T;){var
|
|
|
1164
1164
|
@private
|
|
1165
1165
|
*/){var i=2<arguments.length&&void 0!==e?e:[0,0];return t.map(function(t){return Ou(t,n,i)})}(O,f,w),t);U?(
|
|
1166
1166
|
// we know that the area is already greater than the maxArea found so far
|
|
1167
|
-
u=P
|
|
1167
|
+
u=N*P,O.push(O[0]),c={area:u,cx:B,cy:L,width:N,height:P,angle:-d,points:O},T=N):E=N,e.events&&a.push({type:"rectangle",areaFraction:N*P/j,cx:B,cy:L,width:N,height:P,angle:d,insidePoly:U})}}}}}}}}return e.cache&&(Hu[i]=c),e.events?Object.assign(c||{},{events:a}):c}
|
|
1168
1168
|
/**
|
|
1169
1169
|
@function pointDistance
|
|
1170
1170
|
@desc Calculates the pixel distance between two points.
|
|
1171
1171
|
@param {Array} p1 The first point, which should always be an `[x, y]` formatted Array.
|
|
1172
1172
|
@param {Array} p2 The second point, which should always be an `[x, y]` formatted Array.
|
|
1173
1173
|
@returns {Number}
|
|
1174
|
-
*/function Ku(t,n){return Math.sqrt(
|
|
1174
|
+
*/function Ku(t,n){return Math.sqrt(Nu(t,n))}var Uu=function(t,n){return parseFloat(Math.round(t*Math.pow(10,n))/Math.pow(10,n)).toFixed(n)};
|
|
1175
1175
|
/**
|
|
1176
1176
|
* @private
|
|
1177
1177
|
*/
|
|
@@ -1394,12 +1394,12 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
1394
1394
|
@memberof Shape
|
|
1395
1395
|
@desc Adds background image to each shape group.
|
|
1396
1396
|
@private
|
|
1397
|
-
*/_renderImage(){let l=[];this._update.merge(this._enter).data().forEach((i,a)=>{var r=this._aes(i,a);if(r.r||r.width&&r.height){let e=i;i.nested&&i.key&&i.values&&(e=i.values[0],a=this._data.indexOf(e));var i=r.r?2*r.r:r.height,o=this._backgroundImage(e,a),s=r.r?2*r.r:r.width;if(o){let t=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,a),n=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,a);r.x&&(t+=r.x),r.y&&(n+=r.y),e.__d3plusShape__&&(a=(e=e.data).i),l.push({__d3plus__:!0,data:e,height:i,i:a,id:this._id(e,a),url:o,width:s,x:t+-s/2,y:n+-i/2})}}}),this._backgroundImageClass.data(l).duration(this._duration).opacity(this._nestWrapper(this._opacity)).pointerEvents("none").select(
|
|
1397
|
+
*/_renderImage(){let l=[];this._update.merge(this._enter).data().forEach((i,a)=>{var r=this._aes(i,a);if(r.r||r.width&&r.height){let e=i;i.nested&&i.key&&i.values&&(e=i.values[0],a=this._data.indexOf(e));var i=r.r?2*r.r:r.height,o=this._backgroundImage(e,a),s=r.r?2*r.r:r.width;if(o){let t=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,a),n=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,a);r.x&&(t+=r.x),r.y&&(n+=r.y),e.__d3plusShape__&&(a=(e=e.data).i),l.push({__d3plus__:!0,data:e,height:i,i:a,id:this._id(e,a),url:o,width:s,x:t+-s/2,y:n+-i/2})}}}),this._backgroundImageClass.data(l).duration(this._duration).opacity(this._nestWrapper(this._opacity)).pointerEvents("none").select(Pt(`g.d3plus-${this._name}-image`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).render()}
|
|
1398
1398
|
/**
|
|
1399
1399
|
@memberof Shape
|
|
1400
1400
|
@desc Adds labels to each shape group.
|
|
1401
1401
|
@private
|
|
1402
|
-
*/_renderLabels(){let u=[];this._update.merge(this._enter).data().forEach((t,n)=>{let e=t,i=(t.nested&&t.key&&t.values&&(e=t.values[0],n=this._data.indexOf(e)),this._label(e,n));if(this._labelBounds&&!1!==i&&null!=i){var a=this._labelBounds.bind(this)(e,n,this._aes(t,n));if(a){i.constructor!==Array&&(i=[i]);var r=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,n),o=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,n);e.__d3plusShape__&&(n=(e=e.data).i);for(let t=0;t<i.length;t++){var s=a.constructor===Array?a[t]:Object.assign({},a),l=this._rotate(e,n),h=e.labelConfig&&e.labelConfig.rotate?e.labelConfig.rotate:void 0!==a.angle?a.angle:0,l=(h+=l,0!==l?[-1*s.x||0,-1*s.y||0]:[s.width/2,s.height/2]);u.push({__d3plus__:!0,data:e,height:s.height,l:t,id:this._id(e,n)+"_"+t,r:h,rotateAnchor:l,text:i[t],width:s.width,x:r+s.x,y:o+s.y})}}}}),this._labelClass.data(u).duration(this._duration).fontOpacity(this._nestWrapper(this._opacity)).pointerEvents("none").rotate(t=>(t.__d3plus__?t:t.data).r).rotateAnchor(t=>(t.__d3plus__?t:t.data).rotateAnchor).select(
|
|
1402
|
+
*/_renderLabels(){let u=[];this._update.merge(this._enter).data().forEach((t,n)=>{let e=t,i=(t.nested&&t.key&&t.values&&(e=t.values[0],n=this._data.indexOf(e)),this._label(e,n));if(this._labelBounds&&!1!==i&&null!=i){var a=this._labelBounds.bind(this)(e,n,this._aes(t,n));if(a){i.constructor!==Array&&(i=[i]);var r=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,n),o=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,n);e.__d3plusShape__&&(n=(e=e.data).i);for(let t=0;t<i.length;t++){var s=a.constructor===Array?a[t]:Object.assign({},a),l=this._rotate(e,n),h=e.labelConfig&&e.labelConfig.rotate?e.labelConfig.rotate:void 0!==a.angle?a.angle:0,l=(h+=l,0!==l?[-1*s.x||0,-1*s.y||0]:[s.width/2,s.height/2]);u.push({__d3plus__:!0,data:e,height:s.height,l:t,id:this._id(e,n)+"_"+t,r:h,rotateAnchor:l,text:i[t],width:s.width,x:r+s.x,y:o+s.y})}}}}),this._labelClass.data(u).duration(this._duration).fontOpacity(this._nestWrapper(this._opacity)).pointerEvents("none").rotate(t=>(t.__d3plus__?t:t.data).r).rotateAnchor(t=>(t.__d3plus__?t:t.data).rotateAnchor).select(Pt(`g.d3plus-${this._name}-text`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).config(Lt.bind(this)(this._labelConfig)).render()}
|
|
1403
1403
|
/**
|
|
1404
1404
|
@memberof Shape
|
|
1405
1405
|
@desc Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
@@ -1407,11 +1407,11 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
1407
1407
|
@chainable
|
|
1408
1408
|
*/render(t){void 0===this._select&&this.select(H("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node()),this._transition=ke(this._uuid).duration(this._duration);let n=this._data,e=this._id,i=(this._dataFilter&&(n=this._dataFilter(n)).key&&(e=n.key),pu((n=this._sort?n.sort((t,n)=>{for(;t.__d3plusShape__||t.__d3plus__;)t=t.data;for(;n.__d3plusShape__||n.__d3plus__;)n=n.data;return this._sort(t,n)}):n).map(this._getTextureKey.bind(this))).filter(Boolean)),a=Object.keys(this._textureDefs);a.forEach(t=>{i.includes(t)||(H(this._select.select("pattern#"+this._textureDefs[t].id()).node().parentNode).remove(),delete this._textureDefs[t])}),i.forEach(t=>{if(!a.includes(t)){let n=JSON.parse(t);var e=n.texture,i=(delete n.texture,Qu[e]());for(let t in n)({}).hasOwnProperty.call(i,t)&&t in i&&("d"===t&&"function"==typeof t?i[t](()=>n[t]):n[t]instanceof Array?i[t].apply(null,n[t]):i[t](n[t]));this._select.call(i),this._textureDefs[t]=i}}),("string"==typeof(r=`g.d3plus-${this._name}-hover > *, g.d3plus-${this._name}-active > *`)?new _t([document.querySelectorAll(r)],[document.documentElement]):new _t([c(r)],pt)).each(function(t){t&&t.parentNode?t.parentNode.appendChild(this):this.parentNode.removeChild(this)}),
|
|
1409
1409
|
// Makes the update state of the group selection accessible.
|
|
1410
|
-
this._group=
|
|
1410
|
+
this._group=Pt(`g.d3plus-${this._name}-group`,{parent:this._select});var r=this._update=Pt(`g.d3plus-${this._name}-shape`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).selectAll(".d3plus-"+this._name).data(n,e);
|
|
1411
1411
|
// Orders and transforms the updating Shapes.
|
|
1412
1412
|
r.order(),(this._duration?r.transition(this._transition):r).call(this._applyTransform.bind(this));var o=(this._enter=r.enter().append(this._tagName).attr("class",(t,n)=>`d3plus-Shape d3plus-${this._name} d3plus-id-`+Re(this._nestWrapper(this._id)(t,n))).call(this._applyTransform.bind(this)).attr("aria-label",this._ariaLabel).attr("role",this._role).attr("opacity",this._nestWrapper(this._opacity))).merge(r);let s=o.attr("shape-rendering",this._nestWrapper(this._shapeRendering));(s=this._duration?s.attr("pointer-events","none").transition(this._transition).transition().delay(100).attr("pointer-events",this._pointerEvents):s).attr("opacity",this._nestWrapper(this._opacity));
|
|
1413
1413
|
// Makes the exit state of the group selection accessible.
|
|
1414
|
-
var r=this._exit=r.exit(),r=((this._duration?r.transition().delay(this._duration):r).remove(),this._renderImage(),this._renderLabels(),this._hoverGroup=
|
|
1414
|
+
var r=this._exit=r.exit(),r=((this._duration?r.transition().delay(this._duration):r).remove(),this._renderImage(),this._renderLabels(),this._hoverGroup=Pt(`g.d3plus-${this._name}-hover`,{parent:this._group}),this._activeGroup=Pt(`g.d3plus-${this._name}-active`,{parent:this._group}),this._group.selectAll(".d3plus-HitArea").data(this._hitArea&&Object.keys(this._on).length?n:[],e)),l=(r.order().call(this._applyTransform.bind(this)),"Line"===this._name),h=(l&&(h=this._curve.bind(this)(this.config()),l)&&this._path.curve(jh["curve"+h.charAt(0).toUpperCase()+h.slice(1)]).defined(this._defined).x(this._x).y(this._y),r.enter().append(l?"path":"rect").attr("class",(t,n)=>"d3plus-HitArea d3plus-id-"+Re(this._nestWrapper(this._id)(t,n))).attr("fill","black").attr("stroke","black").attr("pointer-events","painted").attr("opacity",0).call(this._applyTransform.bind(this)));let u=this;l=r.merge(h).each(function(t){var n=u._data.indexOf(t),e=u._hitArea(t,n,u._aes(t,n));return!e||"Line"===u._name&&10<parseFloat(u._strokeWidth(t,n))?H(this).remove():H(this).call(f,e)});return r.exit().remove(),this._applyEvents(this._hitArea?l:o),setTimeout(()=>{this._active?this._renderActive():this._hover&&this._renderHover(),t&&t()},this._duration+100),this}
|
|
1415
1415
|
/**
|
|
1416
1416
|
@memberof Shape
|
|
1417
1417
|
@desc If *value* is specified, sets the highlight accessor to the specified function and returns the current class instance.
|
|
@@ -2191,9 +2191,9 @@ Object.keys(dc).forEach(function(t){dc[t.toLowerCase()]=dc[t]});class vc extends
|
|
|
2191
2191
|
@chainable
|
|
2192
2192
|
*/render(t){void 0===this._select&&this.select(H("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node());let s=[];this._data.forEach((t,n)=>{var e=this._orient(t,n),i=this._x(t,n),a=this._y(t,n);let r=i,o=("left"===e?r-=this._length(t,n):"right"===e&&(r+=this._length(t,n)),a);"top"===e?o-=this._length(t,n):"bottom"===e&&(o+=this._length(t,n)),s.push({__d3plus__:!0,data:t,i:n,id:n,x:i,y:a}),s.push({__d3plus__:!0,data:t,i:n,id:n,x:r,y:o})}),
|
|
2193
2193
|
// Draw whisker line.
|
|
2194
|
-
this._line=(new Sc).data(s).select(
|
|
2194
|
+
this._line=(new Sc).data(s).select(Pt("g.d3plus-Whisker",{parent:this._select}).node()).config(Lt.bind(this)(this._lineConfig,"shape")).render(t);t=this._data.map((t,n)=>{var e={__d3plus__:!0};e.data=t,e.i=n,e.endpoint=this._endpoint(t,n),e.length=this._length(t,n),e.orient=this._orient(t,n);let i=this._x(t,n),a=("left"===e.orient?i-=e.length:"right"===e.orient&&(i+=e.length),this._y(t,n));return"top"===e.orient?a-=e.length:"bottom"===e.orient&&(a+=e.length),e.x=i,e.y=a,e});
|
|
2195
2195
|
// Draw whisker endpoint.
|
|
2196
|
-
return this._whiskerEndpoint=[],ca().key(t=>t.endpoint).entries(t).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new kc[n]).data(t.values).select(
|
|
2196
|
+
return this._whiskerEndpoint=[],ca().key(t=>t.endpoint).entries(t).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new kc[n]).data(t.values).select(Pt("g.d3plus-Whisker-Endpoint-"+n,{parent:this._select}).node()).config({height:t=>"top"===t.orient||"bottom"===t.orient?5:20,width:t=>"top"===t.orient||"bottom"===t.orient?20:5}).config(Lt.bind(this)(this._endpointConfig,"shape",n)).render())}),this}
|
|
2197
2197
|
/**
|
|
2198
2198
|
@memberof Whisker
|
|
2199
2199
|
@desc Sets the highlight accessor to the Shape class's active function.
|
|
@@ -2286,16 +2286,16 @@ a.height=this._rectWidth(a.data,a.i),a.width=t,a.x=a.first+t/2,a.y=this._y(a.dat
|
|
|
2286
2286
|
// Compute data for outliers.
|
|
2287
2287
|
a.values.forEach((t,n)=>{var e,i="vertical"===a.orient?this._y(t,n):this._x(t,n);(i<a.lowerLimit||i>a.upperLimit)&&((e={__d3plus__:!0}).data=t,e.i=n,e.outlier=this._outlier(t,n),"vertical"===a.orient?(e.x=a.x,e.y=i,r.push(e)):"horizontal"===a.orient&&(e.y=a.y,e.x=i,r.push(e)))}),a.__d3plus__=!0,a});
|
|
2288
2288
|
// Draw box.
|
|
2289
|
-
this._box=(new wc).data(t).x(t=>t.x).y(t=>t.y).select(
|
|
2289
|
+
this._box=(new wc).data(t).x(t=>t.x).y(t=>t.y).select(Pt("g.d3plus-Box",{parent:this._select}).node()).config(Lt.bind(this)(this._rectConfig,"shape")).render(),
|
|
2290
2290
|
// Draw median.
|
|
2291
|
-
this._median=(new wc).data(t).x(t=>"vertical"===t.orient?t.x:t.median).y(t=>"vertical"===t.orient?t.median:t.y).height(t=>"vertical"===t.orient?1:t.height).width(t=>"vertical"===t.orient?t.width:1).select(
|
|
2291
|
+
this._median=(new wc).data(t).x(t=>"vertical"===t.orient?t.x:t.median).y(t=>"vertical"===t.orient?t.median:t.y).height(t=>"vertical"===t.orient?1:t.height).width(t=>"vertical"===t.orient?t.width:1).select(Pt("g.d3plus-Box-Median",{parent:this._select}).node()).config(Lt.bind(this)(this._medianConfig,"shape")).render();
|
|
2292
2292
|
// Draw 2 lines using Whisker class.
|
|
2293
2293
|
// Construct coordinates for whisker startpoints and push it to the whiskerData.
|
|
2294
2294
|
let l=[];return t.forEach((t,n)=>{var e,i,a=t.x,r=t.y,o=t.first-t.lowerLimit,s=t.upperLimit-t.third;"vertical"===t.orient?(e=r-t.height/2,i=r+t.height/2,l.push({__d3plus__:!0,data:t,i:n,x:a,y:e,length:o,orient:"top"},{__d3plus__:!0,data:t,i:n,x:a,y:i,length:s,orient:"bottom"})):"horizontal"===t.orient&&(e=a+t.width/2,i=a-t.width/2,l.push({__d3plus__:!0,data:t,i:n,x:e,y:r,length:s,orient:"right"},{__d3plus__:!0,data:t,i:n,x:i,y:r,length:o,orient:"left"}))}),
|
|
2295
2295
|
// Draw whiskers.
|
|
2296
|
-
this._whisker=(new Cc).data(l).select(
|
|
2296
|
+
this._whisker=(new Cc).data(l).select(Pt("g.d3plus-Box-Whisker",{parent:this._select}).node()).config(Lt.bind(this)(this._whiskerConfig,"shape")).render(),
|
|
2297
2297
|
// Draw outliers.
|
|
2298
|
-
this._whiskerEndpoint=[],ca().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new Mc[n]).data(t.values).select(
|
|
2298
|
+
this._whiskerEndpoint=[],ca().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new Mc[n]).data(t.values).select(Pt("g.d3plus-Box-Outlier-"+n,{parent:this._select}).node()).config(Lt.bind(this)(this._outlierConfig,"shape",n)).render())}),this}
|
|
2299
2299
|
/**
|
|
2300
2300
|
@memberof Box
|
|
2301
2301
|
@desc Sets the highlight accessor to the Shape class's active function.
|
|
@@ -2424,7 +2424,7 @@ this._whiskerEndpoint=[],ca().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2424
2424
|
@memberof Path
|
|
2425
2425
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
2426
2426
|
@private
|
|
2427
|
-
*/constructor(){super("path"),this._d=p("path"),this._labelBounds=(t,n,e)=>{e=Gu(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,n):0});return!!e&&{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2,y:e.cy-e.height/2}},this._name="Path",this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}};var Tc=Object.freeze({__proto__:null,Area:vc,Bar:bc,Box:Ac,Circle:xc,Image:tc,Line:Sc,Path:zc,Rect:wc,Shape:ec,Whisker:Cc});let Ec=mn.theme,
|
|
2427
|
+
*/constructor(){super("path"),this._d=p("path"),this._labelBounds=(t,n,e)=>{e=Gu(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,n):0});return!!e&&{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2,y:e.cy-e.height/2}},this._name="Path",this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}};var Tc=Object.freeze({__proto__:null,Area:vc,Bar:bc,Box:Ac,Circle:xc,Image:tc,Line:Sc,Path:zc,Rect:wc,Shape:ec,Whisker:Cc});let Ec=mn.theme,Nc=t=>t<0||Object.is(t,-0),Pc=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,Nc(t)),Lc=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,Nc(t)),Bc=t=>{var n,e=""+t;return e.includes("e-")||"0"===e?0:(n=e.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/))?+(""+n[1]+(+n[2]+1)):(n=e.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/))?+(""+n[1]+ +n[2]):t};
|
|
2428
2428
|
/* catches for -0 and less */
|
|
2429
2429
|
/**
|
|
2430
2430
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
@@ -2435,10 +2435,10 @@ this._whiskerEndpoint=[],ca().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2435
2435
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
2436
2436
|
* @param {scale} scale A d3-scale object
|
|
2437
2437
|
* @private
|
|
2438
|
-
*/function(t,n=!1){var e=$a().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let i=Math.floor(e(t));return"time"===this._scale&&(i=this._data&&this._data.length?(e=Hi(this._data),t=this._data.reduce((t,n,e,i)=>t=e&&(n=Math.abs(n-i[e-1]))<t?n:t,1/0),e=Math.round((e[1]-e[0])/t),Dt([i*(n?2:.5),e])):n?2*i:i/2),Math.floor(i)}.bind(this)(t,e),r=t.domain();let o=r[1]<r[0];if(e||"log"!==this._scale){if(i=t.ticks(a),!e&&!["log","time"].includes(this._scale)&&1<i.length){let e=Math.abs(2*Bc(i[1]-i[0]));i=i.filter(t=>{var t=Math.abs(t)%e,n=Bc(t);return n!==t?!n||n===e:0==t})}}else{var e=r.map(t=>Math.log10(t)%1==0?t:(o?Lc:
|
|
2438
|
+
*/function(t,n=!1){var e=$a().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let i=Math.floor(e(t));return"time"===this._scale&&(i=this._data&&this._data.length?(e=Hi(this._data),t=this._data.reduce((t,n,e,i)=>t=e&&(n=Math.abs(n-i[e-1]))<t?n:t,1/0),e=Math.round((e[1]-e[0])/t),Dt([i*(n?2:.5),e])):n?2*i:i/2),Math.floor(i)}.bind(this)(t,e),r=t.domain();let o=r[1]<r[0];if(e||"log"!==this._scale){if(i=t.ticks(a),!e&&!["log","time"].includes(this._scale)&&1<i.length){let e=Math.abs(2*Bc(i[1]-i[0]));i=i.filter(t=>{var t=Math.abs(t)%e,n=Bc(t);return n!==t?!n||n===e:0==t})}}else{var e=r.map(t=>Math.log10(t)%1==0?t:(o?Lc:Pc)(t)),s=e[1]<e[0],e=e.map(t=>(Nc(t)?-1:1)*([-1,1].includes(t)||Math.abs(t)<1?1:Math.log10(Math.abs(t))));let n=Math.ceil((Math.abs(e[1]-e[0])+1)/(.65*a));i=n<=1&&e[0]===e[1]||s!=o?t.ticks(a).filter(t=>+(""+t).replace("0.","")%2==0):jt(e[0],e[1],e[1]<e[0]?-1:1).concat([e[1]]).filter(t=>Math.abs(t)%n==0).map(t=>+(""+(Nc(t)?-1:1)*(t?Math.pow(10,Math.abs(t)):0<Math.sign(1/t)?1:-1)).replace(/9+/g,"1"))}
|
|
2439
2439
|
// forces min/max into ticks, if not present
|
|
2440
2440
|
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
2441
|
-
if(this._d3ScaleNegative&&
|
|
2441
|
+
if(this._d3ScaleNegative&&Nc(r[o?1:0])!==i.some(t=>Nc(t))||i.map(Number).includes(+r[0])||i.unshift(r[0]),this._d3ScaleNegative&&Nc(r[o?0:1])!==i.some(t=>Nc(t))||i.map(Number).includes(+r[1])||i.push(r[1]),"time"===this._scale&&this._data.length){let n=this._data.map(Number);i=i.filter(t=>n.includes(+t))}return i}class Dc extends Li{
|
|
2442
2442
|
/**
|
|
2443
2443
|
@memberof Axis
|
|
2444
2444
|
@desc Sets positioning for the axis bar.
|
|
@@ -2455,7 +2455,7 @@ if(this._d3ScaleNegative&&Pc(r[o?1:0])!==i.some(t=>Pc(t))||i.map(Number).include
|
|
|
2455
2455
|
@desc Returns a value's scale position, taking into account negative and positive log scales.
|
|
2456
2456
|
@param {Number|String} *d*
|
|
2457
2457
|
@private
|
|
2458
|
-
*/_getPosition(t){return"log"===this._scale?0===t?(this._d3Scale||this._d3ScaleNegative).range()[this._d3Scale?0:1]:(
|
|
2458
|
+
*/_getPosition(t){return"log"===this._scale?0===t?(this._d3Scale||this._d3ScaleNegative).range()[this._d3Scale?0:1]:(Nc(t)?this._d3ScaleNegative||(()=>0):this._d3Scale)(t):this._d3Scale(t)}
|
|
2459
2459
|
/**
|
|
2460
2460
|
@memberof Axis
|
|
2461
2461
|
@desc Returns the scale's range, taking into account negative and positive log scales.
|
|
@@ -2465,7 +2465,7 @@ if(this._d3ScaleNegative&&Pc(r[o?1:0])!==i.some(t=>Pc(t))||i.map(Number).include
|
|
|
2465
2465
|
@memberof Axis
|
|
2466
2466
|
@desc Returns the scale's labels, taking into account negative and positive log scales.
|
|
2467
2467
|
@private
|
|
2468
|
-
*/_getLabels(){let t=[];if((this._d3ScaleNegative&&(t=t.concat(Oc.bind(this)(this._d3ScaleNegative,!1))),this._d3Scale&&(t=t.concat(Oc.bind(this)(this._d3Scale,!1))),"log"===this._scale)&&(t.some(t=>
|
|
2468
|
+
*/_getLabels(){let t=[];if((this._d3ScaleNegative&&(t=t.concat(Oc.bind(this)(this._d3ScaleNegative,!1))),this._d3Scale&&(t=t.concat(Oc.bind(this)(this._d3Scale,!1))),"log"===this._scale)&&(t.some(t=>Nc(t))&&t.some(t=>0<t))){let n=Dt([...this._d3ScaleNegative.domain().map(Math.abs),...this._d3Scale.domain()]);
|
|
2469
2469
|
// add minValue if it does not exist, and should
|
|
2470
2470
|
t.includes(n)||t.splice(t.findIndex(t=>t>n),0,n),
|
|
2471
2471
|
// remove -minValue if minValue also exists
|
|
@@ -2474,7 +2474,7 @@ t.includes(-n)&&t.includes(n)&&t.splice(t.indexOf(-n),1)}return t}
|
|
|
2474
2474
|
@memberof Axis
|
|
2475
2475
|
@desc Returns the scale's ticks, taking into account negative and positive log scales.
|
|
2476
2476
|
@private
|
|
2477
|
-
*/_getTicks(){if(["band","ordinal","point","time"].includes(this._scale)&&this._data.length&&this._data.length<this._width/4)return"time"===this._scale?this._data.map(
|
|
2477
|
+
*/_getTicks(){if(["band","ordinal","point","time"].includes(this._scale)&&this._data.length&&this._data.length<this._width/4)return"time"===this._scale?this._data.map(Nt):this._data;let t=[];return this._d3ScaleNegative&&(t=t.concat(Oc.bind(this)(this._d3ScaleNegative,!0))),this._d3Scale&&(t=t.concat(Oc.bind(this)(this._d3Scale,!0))),"log"===this._scale&&t.includes(-1)&&t.includes(1)&&t.splice(t.indexOf(-1),1),t}
|
|
2478
2478
|
/**
|
|
2479
2479
|
@memberof Axis
|
|
2480
2480
|
@desc Sets positioning for the grid lines.
|
|
@@ -2490,7 +2490,7 @@ t.includes(-n)&&t.includes(n)&&t.splice(t.indexOf(-n),1)}return t}
|
|
|
2490
2490
|
/**
|
|
2491
2491
|
* Creates an SVG element to contain the axis if none
|
|
2492
2492
|
* has been specified using the "select" method.
|
|
2493
|
-
*/void 0===this._select&&this.select(H("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());let r=this._timeLocale||wi[this._locale]||wi["en-US"],{width:n,height:u,x:c,y:g,horizontal:d,opposite:f}=(vs(r).format(),this._position),e="d3plus-Axis-clip-"+this._uuid,p=["top","left"].includes(this._orient),_=this._padding,i=this._select,m=[_,this["_"+n]-_],a=ke().duration(this._duration),o="Circle"===this._shape?this._shapeConfig.r:"Rect"===this._shape?this._shapeConfig[n]:this._shapeConfig.strokeWidth,y="function"!=typeof o?()=>o:o,v=this._margin={top:0,right:0,bottom:0,left:0},b,x,w,S=this._tickFormat||(t=>{var n,e,i,a;return isNaN(t)||["band","ordinal","point"].includes(this._scale)?t:"time"===this._scale?Yu(t,(this._data.length?this._data:this._domain).map(
|
|
2493
|
+
*/void 0===this._select&&this.select(H("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());let r=this._timeLocale||wi[this._locale]||wi["en-US"],{width:n,height:u,x:c,y:g,horizontal:d,opposite:f}=(vs(r).format(),this._position),e="d3plus-Axis-clip-"+this._uuid,p=["top","left"].includes(this._orient),_=this._padding,i=this._select,m=[_,this["_"+n]-_],a=ke().duration(this._duration),o="Circle"===this._shape?this._shapeConfig.r:"Rect"===this._shape?this._shapeConfig[n]:this._shapeConfig.strokeWidth,y="function"!=typeof o?()=>o:o,v=this._margin={top:0,right:0,bottom:0,left:0},b,x,w,S=this._tickFormat||(t=>{var n,e,i,a;return isNaN(t)||["band","ordinal","point"].includes(this._scale)?t:"time"===this._scale?Yu(t,(this._data.length?this._data:this._domain).map(Nt).sort((t,n)=>+t-+n),Qr).replace(/^Q/g,r.quarter):"linear"===this._scale&&"smallest"===this._tickSuffix?({separator:e,suffixes:i}=a="object"==typeof this._locale?this._locale:xi[this._locale],i=1e3<=t?i[this._tickUnit+8]:"",""+qu(n=t/Math.pow(10,3*this._tickUnit),a,`,.${n.toString().length}r`)+e+i):(n=(a=w[1]<w[0])?w.length-1:0,e=a?0:w.length-1,i="inside"===this._rounding?w.indexOf(t)===n?this._roundingInsideMinPrefix:w.indexOf(t)===e?this._roundingInsideMaxPrefix:"":"",a="inside"===this._rounding?w.indexOf(t)===n?this._roundingInsideMinSuffix:w.indexOf(t)===e?this._roundingInsideMaxSuffix:"":"",""+i+qu(t,this._locale)+a)});
|
|
2494
2494
|
/**
|
|
2495
2495
|
* (Re)calculates the internal d3 scale
|
|
2496
2496
|
* @param {} newRange
|
|
@@ -2515,20 +2515,20 @@ t.includes(-n)&&t.includes(n)&&t.splice(t.indexOf(-n),1)}return t}
|
|
|
2515
2515
|
/**
|
|
2516
2516
|
* Sets up the initial d3 scale, using this._domain and the
|
|
2517
2517
|
* previously defined range variable.
|
|
2518
|
-
*/var i="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let a=this._domain.slice();if(this._d3Scale=Ts[i]().domain("time"===this._scale?a.map(
|
|
2518
|
+
*/var i="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let a=this._domain.slice();if(this._d3Scale=Ts[i]().domain("time"===this._scale?a.map(Nt):a).range(x),"none"!==this._rounding&&(i=()=>{var t=t=>{if(e){if(!t)return 0;var n=(""+t).match(/0\.(0*)/);if(n)return+`0.${Array(n[1].length+1).fill(0).join("")}1`}return(""+Math.round(Math.abs(t))).length};let e=a.every(t=>Math.abs(t)<1);var t=[t(a[0]),t(a[1])].filter(Boolean).sort(),n=a.some(t=>Nc(t))&&a.some(t=>0<t),n=1===t.length?t[0]:1<t[0]&&t[0]===t[1]?t[0]-1:"outside"!==this._rounding&&n?Ot(t):t[0]+(t[1]-t[0])/2;let i=n<1?Bc(n):+("1"+Array(Math.floor(Bc(n))-1).fill(0).join(""));i>=Math.abs(a[1]-a[0])&&(i/=2);t=a[1]<a[0],n=[Math["outside"===this._rounding?t?"ceil":"floor":t?"floor":"ceil"](a[0]/i)*i,Math["outside"===this._rounding?t?"floor":"ceil":t?"ceil":"floor"](a[1]/i)*i];"log"===this._scale&&(0===n[0]&&(n[0]=a[0]),0===n[1])&&(n[1]=a[1]),this._d3Scale.domain(n.map(Bc))},"linear"===this._scale?i.bind(this)():"log"===this._scale&&(s=[],o=a[1]<a[0],s[0]=("outside"===this._rounding?Nc(a[0])?o?Pc:Lc:o?Lc:Pc:Nc(a[0])?o?Lc:Pc:o?Pc:Lc)(a[0]),s[1]=("inside"===this._rounding?Nc(a[1])?o?Pc:Lc:o?Lc:Pc:Nc(a[1])?o?Lc:Pc:o?Pc:Lc)(a[1]),r=s[1]<s[0],s[0]!==s[1]&&s.some(t=>10<Math.abs(t))&&r==o?this._d3Scale.domain(s):i.bind(this)())),this._d3Scale.padding&&this._d3Scale.padding(this._scalePadding),this._d3Scale.paddingInner&&this._d3Scale.paddingInner(this._paddingInner),this._d3Scale.paddingOuter&&this._d3Scale.paddingOuter(this._paddingOuter)
|
|
2519
2519
|
/**
|
|
2520
2520
|
* Constructs a separate "negative only" scale for logarithmic
|
|
2521
2521
|
* domains, as they cannot pass zero.
|
|
2522
|
-
*/,this._d3ScaleNegative=null,"log"===this._scale){var r=this._d3Scale.domain();0===r[0]?(o=Dt([Dt(this._data),Math.abs(r[1])]),r[0]=0===o||1===o?1e-6:o<=1?
|
|
2522
|
+
*/,this._d3ScaleNegative=null,"log"===this._scale){var r=this._d3Scale.domain();0===r[0]?(o=Dt([Dt(this._data),Math.abs(r[1])]),r[0]=0===o||1===o?1e-6:o<=1?Pc(o):1,Nc(r[1])&&(r[0]*=-1)):0===r[r.length-1]&&(s=Dt([Dt(this._data),Math.abs(r[0])]),r[r.length-1]=0===s||1===s?1e-6:s<=1?Pc(s):1,Nc(r[0]))&&(r[r.length-1]*=-1);let e=this._d3Scale.range();
|
|
2523
2523
|
// all negatives
|
|
2524
|
-
if(
|
|
2524
|
+
if(Nc(r[0])&&Nc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(r).range(e),this._d3Scale=null;else if(0<r[0]&&0<r[r.length-1])this._d3Scale.domain(r).range(e);else{var i=r.map(t=>Math.log10(Math.abs(t))).map(t=>t||-1e-6),o=i[0]/sa(i)*(e[1]-e[0]);let t=Dt([Dt(this._data.filter(t=>0<=t)),Math.abs(r[1])]),n=(1===t&&(t=1e-6),Dt([Dt(this._data.filter(Nc)),Math.abs(r[0])]));1===n&&(n=1e-6);var s=0===t?1e-6:t<=1?Pc(t):1,i=0===n?-1e-6:n<=1?Pc(n):1,s=Dt([Math.abs(s),Math.abs(i)]);this._d3ScaleNegative=this._d3Scale.copy(),(Nc(r[0])?this._d3Scale:this._d3ScaleNegative).domain([Nc(r[0])?s:-s,r[1]]).range([e[0]+o,e[1]]),(Nc(r[0])?this._d3ScaleNegative:this._d3Scale).domain([r[0],Nc(r[0])?-s:s]).range([e[0],e[0]+o])}}
|
|
2525
2525
|
/**
|
|
2526
2526
|
* Determines the of values array to use
|
|
2527
2527
|
* for the "ticks" and the "labels"
|
|
2528
2528
|
*/
|
|
2529
2529
|
/**
|
|
2530
2530
|
* Get the smallest suffix.
|
|
2531
|
-
*/if(w=(this._ticks?"time"===this._scale?this._ticks.map(
|
|
2531
|
+
*/if(w=(this._ticks?"time"===this._scale?this._ticks.map(Nt):this._ticks:(this._d3Scale||this._d3ScaleNegative).ticks?this._getTicks():this._domain).slice(),b=(this._labels?"time"===this._scale?this._labels.map(Nt):this._labels:(this._d3Scale||this._d3ScaleNegative).ticks?this._getLabels():w).slice(),"time"===this._scale&&(w=w.map(Number),b=b.map(Number)),w=w.sort((t,n)=>this._getPosition(t)-this._getPosition(n)),b=b.sort((t,n)=>this._getPosition(t)-this._getPosition(n)),"linear"===this._scale&&"smallest"===this._tickSuffix){i=b.filter(t=>1e3<=t);if(0<i.length){var l=Math.min(...i);let t=1;for(;t&&t<7;){if(!(1<=l/Math.pow(10,3*t)))break;this._tickUnit=t,t+=1}}}
|
|
2532
2532
|
/**
|
|
2533
2533
|
* Removes ticks when they overlap other ticks.
|
|
2534
2534
|
*/let h=[];(this._availableTicks=w).forEach((t,n)=>{let e=y({id:t,tick:!0},n);"Circle"===this._shape&&(e*=2);n=this._getPosition(t);!h.length||Math.abs(wu(n,h)-n)>2*e?h.push(n):h.push(!1)}),w=w.filter((t,n)=>!1!==h[n]),this._visibleTicks=w}
|
|
@@ -2548,7 +2548,7 @@ if(Pc(r[0])&&Pc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain
|
|
|
2548
2548
|
/**
|
|
2549
2549
|
* "spillover" will contain the pixel spillover of the first and last label,
|
|
2550
2550
|
* and then adjust the scale range accordingly.
|
|
2551
|
-
*/,[0,1].map(t=>{var n,e,i,a=M[t?M.length-1:0];return!a||({height:a,position:n,rotate:i,width:e}=a,t=t?m[1]:m[0],i=(i||!d?a:e)/2,Math.abs(n-t)>=i)?0:Math.abs(i-(n-t))})),[z,T]=x,l=[z+l[0],T-l[1]];this._range&&(void 0!==this._range[0]&&(l[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(l[1]=this._range[this._range.length-1]),l[0]===z&&l[1]===T||(s.bind(this)(l),A.bind(this)(h?2:1));let E=Ot(M,t=>t.height)||0,
|
|
2551
|
+
*/,[0,1].map(t=>{var n,e,i,a=M[t?M.length-1:0];return!a||({height:a,position:n,rotate:i,width:e}=a,t=t?m[1]:m[0],i=(i||!d?a:e)/2,Math.abs(n-t)>=i)?0:Math.abs(i-(n-t))})),[z,T]=x,l=[z+l[0],T-l[1]];this._range&&(void 0!==this._range[0]&&(l[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(l[1]=this._range[this._range.length-1]),l[0]===z&&l[1]===T||(s.bind(this)(l),A.bind(this)(h?2:1));let E=Ot(M,t=>t.height)||0,N=(this._labelRotation=d&&void 0===this._labelRotation?M.some(t=>{var{i:t,height:n,position:e,truncated:i}=t,a=M[t-1];return i||t&&a.position+a.height/2>e-n/2}):this._labelRotation,this._labelOffset?Ot(M,t=>t.offset||0):0);M.forEach(t=>t.offset=t.offset?N:0);z="Line"===this._shape?0:k;let P=this._outerBounds={[u]:(Ot(M,t=>Math.ceil(t[t.rotate||!d?"width":"height"]+t.offset))||0)+(M.length?_:0),[n]:m[m.length-1]-m[0],[c]:m[0]};P[u]=Ot([this._minSize,P[u]]),v[this._orient]+=k,v[f]=void 0!==this._gridSize?Ot([this._gridSize,z]):this["_"+u]-v[this._orient]-P[u]-_,P[u]+=v[f]+v[this._orient],P[g]="start"===this._align?this._padding:"end"===this._align?this["_"+u]-P[u]-this._padding:this["_"+u]/2-P[u]/2;T=Pt("g#d3plus-Axis-"+this._uuid,{parent:i}),l=Pt("g.grid",{parent:this._group=T}).selectAll("line").data((0!==this._gridSize?this._grid||"log"===this._scale&&!this._gridLog?b:w:[]).map(t=>({id:t})),t=>t.id),l.exit().transition(a).attr("opacity",0).call(this._gridPosition.bind(this)).remove(),l.enter().append("line").attr("opacity",0).attr("clip-path",`url(#${e})`).call(this._gridPosition.bind(this),!0).merge(l).transition(a).attr("opacity",1).call(this._gridPosition.bind(this)),h=b.filter((t,n)=>M[n].lines.length&&!w.includes(t));let L=M.some(t=>t.rotate),B=w.concat(h).map(n=>{var t=M.find(t=>t.d===n),e=this._getPosition(n),i=t?t.space:0,a=t?t.lines.length:1,r=t?t.lineHeight:1,o=t?t.fP:0,s=t&&this._labelOffset?t.offset:0,l=d?i:P.width-v[this._position.opposite]-k-v[this._orient]+_,h=v[f],s=(k+s)*(p?-1:1),h=p?P[g]+P[u]-h:P[g]+h;return{id:n,labelBounds:L&&t?{x:-t.width/2+t.fS/4,y:"bottom"===this._orient?s+(t.width-r*a)/2+o:2*s-(t.width+r*a)/2+o,width:t.width,height:t.height}:{x:d?-i/2:"left"===this._orient?-l-_+s:s+_,y:d?"bottom"===this._orient?s+o:s-E-o:-i/2,width:d?i:l,height:d?E:i},rotate:!!t&&t.rotate,size:b.includes(n)||"log"===this._scale&&Math.log10(Math.abs(n))%1==0?s:w.includes(n)?Math.ceil(s/2):this._data.find(t=>+t===n)?Math.ceil(s/4):0,text:!((t||{}).truncated||!b.includes(n))&&S(n),tick:w.includes(n),[c]:e+("band"===this._scale?this._d3Scale.bandwidth()/2:0),[g]:h}});"Line"===this._shape&&(B=B.concat(B.map(t=>{var n=Object.assign({},t);return n[g]+=t.size,n}))),(new Tc[this._shape]).data(B).duration(this._duration).labelConfig({ellipsis:t=>t&&t.length?t+"...":"",rotate:t=>t.rotate?-90:0}).select(Pt("g.ticks",{parent:T}).node()).config(Lt.bind(this)(this._shapeConfig)).labelConfig({padding:0}).render();z=T.selectAll("line.bar").data([null]);return z.enter().append("line").attr("class","bar").attr("opacity",0).call(this._barPosition.bind(this)).merge(z).transition(a).attr("opacity",1).call(this._barPosition.bind(this)),this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).height(v[this._orient]).rotate("left"===this._orient?-90:"right"===this._orient?90:0).select(Pt("g.d3plus-Axis-title",{parent:T}).node()).text(t=>t.text).verticalAlign("middle").width(x[x.length-1]-x[0]).x(d?x[0]:"left"===this._orient?P.x+v.left/2-(x[x.length-1]-x[0])/2:P.x+P.width-v.right/2-(x[x.length-1]-x[0])/2).y(d?"bottom"===this._orient?P.y+P.height-v.bottom:P.y:x[0]+(x[x.length-1]-x[0])/2-v[this._orient]/2).config(Lt.bind(this)(this._titleConfig)).render(),this._lastScale=this._getPosition.bind(this),t&&setTimeout(t,this._duration+100),this}
|
|
2552
2552
|
/**
|
|
2553
2553
|
@memberof Axis
|
|
2554
2554
|
@desc If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance.
|
|
@@ -2815,7 +2815,7 @@ if(Pc(r[0])&&Pc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain
|
|
|
2815
2815
|
@chainable
|
|
2816
2816
|
*/render(t){void 0===this._select&&this.select(H("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node()),
|
|
2817
2817
|
// Legend Container <g> Groups
|
|
2818
|
-
this._group=
|
|
2818
|
+
this._group=Pt("g.d3plus-Legend",{parent:this._select}),this._titleGroup=Pt("g.d3plus-Legend-title",{parent:this._group}),this._shapeGroup=Pt("g.d3plus-Legend-shape",{parent:this._group});let h=this._height;if(this._titleHeight=0,this._titleWidth=0,this._title){var n=this._titleConfig.fontFamily||this._titleClass.fontFamily()(),e=this._titleConfig.fontSize||this._titleClass.fontSize()();let t=this._titleConfig.lineHeight||this._titleClass.lineHeight();t=t?t():1.4*e;n=si().fontFamily(n).fontSize(e).lineHeight(t).width(this._width).height(this._height)(this._title);this._titleHeight=t+n.lines.length+this._padding,this._titleWidth=Ot(n.widths),h-=this._titleHeight}
|
|
2819
2819
|
// Calculate Text Sizes
|
|
2820
2820
|
this._lineData=this._data.map((i,a)=>{var r=this._label(i,a),o=this._shape(i,a),s=this._fetchConfig("r",i,a);let l={data:i,i:a,id:this._id(i,a),shape:o,shapeR:s,shapeWidth:"Circle"===o?2*s:this._fetchConfig("width",i,a),shapeHeight:"Circle"===o?2*s:this._fetchConfig("height",i,a),y:0};if(r){let n=this._fetchConfig("fontFamily",i,a),t=this._fetchConfig("lineHeight",i,a),e=this._fetchConfig("fontSize",i,a);o=h-(this._data.length+1)*this._padding,s=this._width,i=si().fontFamily(n).fontSize(e).lineHeight(t).width(s).height(o)(r);(l=Object.assign(l,i)).width=Math.ceil(Ot(l.lines.map(t=>Ae(t,{"font-family":n,"font-size":e}))))+10,l.height=Math.ceil(l.lines.length*(t+1)),l.og={height:l.height,width:l.width},l.f=n,l.s=e,l.lh=t}else l.sentence=!1,l.words=[],l.height=0,l.width=0;return l});let i,l=this._width-2*this._padding;if(i=this._rowWidth(this._lineData),"column"===this._direction||i>l){let o=1,s=[],t=Ot(this._lineData.map(t=>t.words.length));if(this._wrapLines=function(){if(!(++o>t)){var i=1===o?this._lineData.slice():this._lineData.filter(t=>t.width+t.shapeWidth+this._padding*(t.width?2:1)>l&&t.words.length>=o).sort((t,n)=>n.sentence.length-t.sentence.length);if(i.length&&h>i[0].height*o){let e=!1;for(let t=0;t<i.length;t++){let n=i[t];var a=n.og.height*o,r=n.og.width*(1/o*1.5),r=si().fontFamily(n.f).fontSize(n.s).lineHeight(n.lh).width(r).height(a)(n.sentence);if(r.truncated){e=!0;break}n.width=Math.ceil(Ot(r.lines.map(t=>Ae(t,{"font-family":n.f,"font-size":n.s}))))+n.s,n.height=r.lines.length*(n.lh+1)}e||this._wrapRows()}else s=[]}},this._wrapRows=function(){s=[];let n=1,e=0;for(let t=0;t<this._lineData.length;t++){var i=this._lineData[t],a=i.width+this._padding*(i.width?2:1)+i.shapeWidth;if(sa(s.map(t=>Ot(t,t=>Ot([t.height,t.shapeHeight]))))>h){s=[];break}if(a>l){s=[],this._wrapLines();break}e+a<l?e+=a:"column"!==this._direction&&(e=a,n++),s[n-1]||(s[n-1]=[]),s[n-1].push(i),"column"===this._direction&&(e=0,n++)}},this._wrapRows(),!s.length||sa(s,this._rowHeight.bind(this))+this._padding>h){i=sa(this._lineData.map(t=>t.shapeWidth+this._padding))-this._padding;for(let t=0;t<this._lineData.length;t++)this._lineData[t].width=0,this._lineData[t].height=0;this._wrapRows()}s.length&&sa(s,this._rowHeight.bind(this))+this._padding<h&&(s.forEach((t,n)=>{t.forEach(t=>{n&&(t.y=sa(s.slice(0,n),this._rowHeight.bind(this)))})}),i=Ot(s,this._rowWidth.bind(this)))}e=Ot(this._lineData,(t,n)=>Ot([t.height,this._fetchConfig("height",t.data,n)])+t.y)+this._titleHeight,n=Ot([i,this._titleWidth]);this._outerBounds.width=n,this._outerBounds.height=e;let a=this._padding,r=this._padding,o=("center"===this._align?a=(this._width-n)/2:"right"===this._align&&(a=this._width-this._padding-n),"middle"===this._verticalAlign?r=(this._height-e)/2:"bottom"===this._verticalAlign&&(r=this._height-this._padding-e),this._outerBounds.x=a,this._outerBounds.y=r,this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).select(this._titleGroup.node()).textAnchor({left:"start",center:"middle",right:"end"}[this._align]).width(this._width-2*this._padding).x(this._padding).y(this._outerBounds.y).config(this._titleConfig).render(),this._shapes=[],Lt.bind(this)(this._shapeConfig,"legend")),s={id:t=>t.id,label:t=>t.label,lineHeight:t=>t.lH},u=this._data.map((t,n)=>({__d3plus__:!0,data:t,i:n,id:this._id(t,n),label:!!this._lineData[n].width&&this._label(t,n),lH:this._fetchConfig("lineHeight",t,n),shape:this._shape(t,n)}));
|
|
2821
2821
|
// Legend Shapes
|
|
@@ -2944,7 +2944,7 @@ return this._shapes=[],["Circle","Rect"].forEach(n=>{this._shapes.push((new Tc[n
|
|
|
2944
2944
|
@chainable
|
|
2945
2945
|
*/render(t){void 0===this._select&&this.select(H("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());var s=["bottom","top"].includes(this._orient),l=s?"height":"width",h=s?"width":"height",u=s?"x":"y",c=s?"y":"x";
|
|
2946
2946
|
// Shape <g> Group
|
|
2947
|
-
this._group=
|
|
2947
|
+
this._group=Pt("g.d3plus-ColorScale",{parent:this._select});let i=this._data.map(this._value).filter(t=>null!==t&&"number"==typeof t).sort((t,n)=>t-n);var g=this._domain||Hi(i);let n=g[0]<this._midpoint;var d=g[1]>this._midpoint,f=n&&d;let r=Dt([this._buckets instanceof Array?this._buckets.length:this._buckets,f&&"jenks"!==this._scale?2*Math.floor(pu(i).length/2)-1:pu(i).length]),p=f&&(!this._color||this._color instanceof Array&&!this._color.includes(this._colorMid))?void 0:this._color,_,m;if(!p||p instanceof Array||(p=jt(0,r,1).map(t=>Kh(p,(t+1)/r)).reverse()),"jenks"===this._scale){var y=Dt([p?p.length:r,r,i.length]);let t=[];m=this._buckets instanceof Array?this._buckets:(t=f&&this._centered?(b=Math.floor(y/2),o=y%2,x=(k=Fi(v=i.filter(t=>t<this._midpoint)))<(S=Fi(w=i.concat(this._midpoint).filter(t=>t>=this._midpoint)))?1:0,S=xu(v,Dt([b+o*(S<k?1:0),v.length])),k=xu(w,Dt([b+o*x,w.length])),S.concat(k)):xu(i,y)).map(t=>t[0]);var v=new Set(m);if(m.length!==v.size&&(_=Array.from(v)),!p)if(f){p=[this._colorMin,this._colorMid,this._colorMax];let e=m.slice(0,y).filter((t,n)=>t<this._midpoint&&m[n+1]<=this._midpoint);var b=m.slice(0,y).filter((t,n)=>t<=this._midpoint&&m[n+1]>this._midpoint);let i=m.slice(0,y).filter(t=>t>this._midpoint);var o=e.map((t,n)=>n?Kh(p[0],n/e.length):p[0]),x=b.map(()=>p[1]),w=i.map((t,n)=>n===i.length-1?p[2]:Kh(p[2],1-(n+1)/i.length));p=o.concat(x).concat(w)}else p=jt(0,r,1).map(t=>Kh(this._colorMax,t/r)).reverse();p=[(p=m.length<=y?p.slice(-m.length):p)[0]].concat(p),this._colorScale=gr().domain(m).range(p)}else{let a=this._buckets instanceof Array?this._buckets:void 0;if(f&&!p){let n=Math.floor(r/2),e=Vn.gamma(2.2)(this._colorMin,this._colorMid);var S=jt(0,n,1).map(t=>e(t/n)),k=(r%2?[0]:[]).map(()=>this._colorMid);let i=Vn.gamma(2.2)(this._colorMax,this._colorMid);var v=jt(0,n,1).map(t=>i(t/n)).reverse();p=S.concat(k).concat(v),a||(b=(p.length-1)/2,a=[g[0],this._midpoint,g[1]],a=jt(g[0],this._midpoint,-(g[0]-this._midpoint)/b).concat(jt(this._midpoint,g[1],(g[1]-this._midpoint)/b)).concat([g[1]]))}else p||("buckets"===this._scale||"quantile"===this._scale?(p=jt(0,r,1).map(t=>Kh(n?this._colorMin:this._colorMax,t/r)),d&&(p=p.reverse())):p=n?[this._colorMin,Kh(this._colorMin,.8)]:[Kh(this._colorMax,.8),this._colorMax]),a=a||("quantile"===this._scale?jt(0,1+(o=1/(p.length-1))/2,o).map(t=>aa(i,t)):f&&this._color&&this._centered?(x=p.indexOf(this._colorMid),w=(this._midpoint-g[0])/x,y=(g[1]-this._midpoint)/(p.length-x),S=jt(g[0],this._midpoint,w),k=jt(this._midpoint,g[1]+y/2,y),S.concat(k)):(v=(g[1]-g[0])/(p.length-1),jt(g[0],g[1]+v/2,v)));if("buckets"===this._scale||"quantile"===this._scale)m=a,p=[p[0]].concat(p);else if("log"===this._scale){b=a.filter(t=>t<0);if(b.length){let n=b[0],e=b.map(t=>-Math.pow(Math.abs(n),t/n));b.forEach((t,n)=>{a[a.indexOf(t)]=e[n]})}d=a.filter(t=>0<t);if(d.length){let n=d[d.length-1],e=d.map(t=>Math.pow(n,t/n));d.forEach((t,n)=>{a[a.indexOf(t)]=e[n]})}a.includes(0)&&(a[a.indexOf(0)]=1)}this._colorScale=("buckets"===this._scale||"quantile"===this._scale?gr:$a)().domain(a).range(p)}this._colorScale.clamp&&this._colorScale.clamp(!0);o=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale),f=ke().duration(this._duration),x={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:f,update:{opacity:1}},w=Pt("g.d3plus-ColorScale-labels",Object.assign({condition:o},x)),y=Pt("g.d3plus-ColorScale-Rect",Object.assign({condition:o},x)),S=Pt("g.d3plus-ColorScale-legend",Object.assign({condition:!o},x));if(o){k={x:0,y:0};let e=g.slice();this._bucketAxis&&(v=e[e.length-1],b=e[e.length-2],f=1<=(d=v?v/10:b/10)||d<=-1?Math.round(d).toString().length-1:-1*d.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,g=Math.pow(10,f),e[e.length-1]=v+g);b=Et({domain:s?e:e.slice().reverse(),duration:this._duration,height:this._height,labels:_||m,orient:this._orient,padding:this._padding,scale:"log"===this._scale?"log":"linear",ticks:m,width:this._width},this._axisConfig),d=Et({height:this["_"+l]/2,width:this["_"+h]/2},this._labelConfig),f=(this._labelClass.config(d),[]),v=(s&&this._labelMin&&((v={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)})["font-family"]instanceof Array&&(v["font-family"]=v["font-family"][0]),g=Ae(this._labelMin,v))&&g<this["_"+h]/2&&(f.push(this._labelMin),g+=this._padding,s&&(k.x+=g),b[h]-=g),s&&this._labelMax&&((v={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)})["font-family"]instanceof Array&&(v["font-family"]=v["font-family"][0]),g=Ae(this._labelMax,v))&&g<this["_"+h]/2&&(f.push(this._labelMax),g+=this._padding,s||(k.y+=g),b[h]-=g),this._axisTest.select(Pt("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(b).duration(0).render(),this._axisTest.outerBounds()),g=(this._outerBounds[h]=this["_"+h]-2*this._padding,this._outerBounds[l]=v[l]+this._size,this._outerBounds[u]=this._padding,this._outerBounds[c]=this._padding,"middle"===this._align?this._outerBounds[c]=(this["_"+l]-this._outerBounds[l])/2:"end"===this._align&&(this._outerBounds[c]=this["_"+l]-this._padding-this._outerBounds[l]),this._outerBounds[c]+(["bottom","right"].includes(this._orient)?this._size:0)-(b.padding||this._axisClass.padding())),g=`translate(${k.x+(s?0:g)}, ${k.y+(s?g:0)})`;this._axisClass.select(Pt("g.d3plus-ColorScale-axis",Et(x,{condition:!0,enter:{transform:g},update:{transform:g}})).node()).config(b).align("start").render();let i=this._axisTest._getPosition.bind(this._axisTest);g=this._axisTest._getRange();let t=this._group.selectAll("defs").data([0]);b=t.enter().append("defs"),b=(b.append("linearGradient").attr("id","gradient-"+this._uuid),(t=b.merge(t)).select("linearGradient").attr(u+"1",s?"0%":"100%").attr(u+"2",s?"100%":"0%").attr(c+"1","0%").attr(c+"2","0%"),t.select("linearGradient").selectAll("stop").data(p));let a=this._colorScale.domain(),r=$a().domain(g).range(s?[0,100]:[100,0]),o=(b.enter().append("stop").merge(b).attr("offset",(t,n)=>`${n<=a.length-1?r(i(a[n])):100}%`).attr("stop-color",String),(t,n)=>{n=m[n+1]||e[e.length-1];return Math.abs(i(n)-i(t))}),n=Et({duration:this._duration,fill:m?t=>this._colorScale(t):`url(#gradient-${this._uuid})`,[u]:m?(t,n)=>i(t)+o(t,n)/2-(["left","right"].includes(this._orient)?o(t,n):0):g[0]+(g[1]-g[0])/2+k[u],[c]:this._outerBounds[c]+(["top","left"].includes(this._orient)?v[l]:0)+this._size/2+k[c],[h]:m?o:g[1]-g[0],[l]:this._size},this._rectConfig);this._rectClass.data(m||[0]).id((t,n)=>n).select(y.node()).config(n).render(),d.height=this._outerBounds[l],d.width=this._outerBounds[h],this._labelClass.config(d).data(f).select(w.node()).x(t=>t===this._labelMax?n.x+n.width/2+this._padding:this._outerBounds.x).y(t=>n.y-this._labelClass.fontSize()(t)/2).text(t=>t).rotate(s?0:"right"===this._orient?90:-90).render()}else{Pt("g.d3plus-ColorScale-axis",Object.assign({condition:o},x));let t=m.reduce((t,n,e)=>{n=this._bucketFormat.bind(this)(n,e,m,i);return t.push({color:p[e+1],id:n}),t},[]);s||(t=t.reverse());b=Et({align:s?"center":{start:"left",middle:"center",end:"right"}[this._align],direction:s?"row":"column",duration:this._duration,height:this._height,padding:this._padding,shapeConfig:Et({duration:this._duration},this._axisConfig.shapeConfig||{}),title:this._axisConfig.title,titleConfig:this._axisConfig.titleConfig||{},width:this._width,verticalAlign:s?{start:"top",middle:"middle",end:"bottom"}[this._align]:"middle"},this._legendConfig);this._legendClass.data(t).select(S.node()).config(b).render(),this._outerBounds=this._legendClass.outerBounds()}return t&&setTimeout(t,this._duration+100),this}
|
|
2948
2948
|
/**
|
|
2949
2949
|
@memberof ColorScale
|
|
2950
2950
|
@desc The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).
|
|
@@ -3416,9 +3416,9 @@ let qc={capture:!0,passive:!1};function $c(t){t.preventDefault(),t.stopImmediate
|
|
|
3416
3416
|
// Ignore right-click, since that should open the context menu.
|
|
3417
3417
|
function mg(t){return!t.ctrlKey&&!t.button}function yg(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function vg(){return navigator.maxTouchPoints||"ontouchstart"in this}
|
|
3418
3418
|
// Like d3.local, but with the name “__brush” rather than auto-generated.
|
|
3419
|
-
function bg(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function xg(O){var D,n=yg,j=mg,e=vg,R=!0,a=xt("start","brush","end"),i=6;function r(t){var n=t.property("__brush",u).selectAll(".overlay").data([_g("overlay")]),n=(n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",cg.overlay).merge(n).each(function(){var t=bg(this).extent;H(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([_g("selection")]).enter().append("rect").attr("class","selection").attr("cursor",cg.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges"),t.selectAll(".handle").data(O.handles,function(t){return t.type}));n.exit().remove(),n.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return cg[t.type]}),t.each(I).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",s).filter(e).on("touchstart.brush",s).on("touchmove.brush",l).on("touchend.brush touchcancel.brush",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function I(){var t=H(this),n=bg(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-i/2:n[0][0]-i/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-i/2:n[0][1]-i/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+i:i}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+i:i})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function F(t,n,e){var i=t.__brush.emitter;return!i||e&&i.clean?new o(t,n,e):i}function o(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function s(t){var r,a,o,s,l,h,u,c,g,d,f,p,_,m,y,v,b,x,w,S,k,C,M,A,z,T,E,n,e,
|
|
3420
|
-
A&&(d=u[0][0],v=u[1][0]),z&&(_=u[0][1],w=u[1][1]),u[0][0]===d&&u[0][1]===_&&u[1][0]===v&&u[1][1]===w||(h.selection=[[d,_],[v,w]],I.call(r),E.brush(t,o.name))}function B(t){if(t.stopImmediatePropagation(),t.touches){if(t.touches.length)return;D&&clearTimeout(D),D=setTimeout(function(){D=null},500)}else Yc(t.view,C),i.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);var n;e.attr("pointer-events","all"),
|
|
3421
|
-
(n=u)[0][0]!==n[1][0]&&n[0][1]!==n[1][1]||(h.selection=null,I.call(r)),E.end(t,o.name)}D&&!t.touches||j.apply(this,arguments)&&(r=this,a=t.target.__data__.type,o="selection"===(R&&t.metaKey?a="overlay":a)?Qc:R&&t.altKey?eg:ng,s=O===hg?null:fg[a],l=O===lg?null:pg[a],n=(h=bg(r)).extent,u=h.selection,c=n[0][0],f=n[0][1],m=n[1][0],b=n[1][1],k=S=0,M=s&&l&&R&&t.shiftKey,T=Array.from(t.touches||[t],t=>{var n=t.identifier;return(t=vt(t,r)).point0=t.slice(),t.identifier=n,t}),cn(r),E=F(r,arguments,!0).beforestart(),"overlay"===a?(u&&(C=!0),n=[T[0],T[1]||T[0]],h.selection=u=[[g=O===hg?c:rg(n[0][0],n[1][0]),p=O===lg?f:rg(n[0][1],n[1][1])],[y=O===hg?m:ag(n[0][0],n[1][0]),x=O===lg?b:ag(n[0][1],n[1][1])]],1<T.length&&L(t)):(g=u[0][0],p=u[0][1],y=u[1][0],x=u[1][1]),d=g,_=p,v=y,w=x,e=H(r).attr("pointer-events","none"),
|
|
3419
|
+
function bg(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function xg(O){var D,n=yg,j=mg,e=vg,R=!0,a=xt("start","brush","end"),i=6;function r(t){var n=t.property("__brush",u).selectAll(".overlay").data([_g("overlay")]),n=(n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",cg.overlay).merge(n).each(function(){var t=bg(this).extent;H(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([_g("selection")]).enter().append("rect").attr("class","selection").attr("cursor",cg.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges"),t.selectAll(".handle").data(O.handles,function(t){return t.type}));n.exit().remove(),n.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return cg[t.type]}),t.each(I).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",s).filter(e).on("touchstart.brush",s).on("touchmove.brush",l).on("touchend.brush touchcancel.brush",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function I(){var t=H(this),n=bg(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-i/2:n[0][0]-i/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-i/2:n[0][1]-i/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+i:i}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+i:i})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function F(t,n,e){var i=t.__brush.emitter;return!i||e&&i.clean?new o(t,n,e):i}function o(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function s(t){var r,a,o,s,l,h,u,c,g,d,f,p,_,m,y,v,b,x,w,S,k,C,M,A,z,T,E,n,e,N,i;function P(t){for(var n of t.changedTouches||[t])for(var e of T)e.identifier===n.identifier&&(e.cur=vt(n,r));var i,a;!M||A||z||1!==T.length||(i=T[0],ig(i.cur[0]-i[0])>ig(i.cur[1]-i[1])?z=!0:A=!0);for(a of T)a.cur&&(a[0]=a.cur[0],a[1]=a.cur[1]);C=!0,Jc(t),L(t)}function L(t){var n,e=T[0],i=e.point0;switch(S=e[0]-i[0],k=e[1]-i[1],o){case tg:case Qc:s&&(S=ag(c-g,rg(m-y,S)),d=g+S,v=y+S),l&&(k=ag(f-p,rg(b-x,k)),_=p+k,w=x+k);break;case ng:T[1]?(s&&(d=ag(c,rg(m,T[0][0])),v=ag(c,rg(m,T[1][0])),s=1),l&&(_=ag(f,rg(b,T[0][1])),w=ag(f,rg(b,T[1][1])),l=1)):(s<0?(S=ag(c-g,rg(m-g,S)),d=g+S,v=y):0<s&&(S=ag(c-y,rg(m-y,S)),d=g,v=y+S),l<0?(k=ag(f-p,rg(b-p,k)),_=p+k,w=x):0<l&&(k=ag(f-x,rg(b-x,k)),_=p,w=x+k));break;case eg:s&&(d=ag(c,rg(m,g-S*s)),v=ag(c,rg(m,y+S*s))),l&&(_=ag(f,rg(b,p-k*l)),w=ag(f,rg(b,x+k*l)))}v<d&&(s*=-1,n=g,g=y,y=n,n=d,d=v,v=n,a in gg)&&N.attr("cursor",cg[a=gg[a]]),w<_&&(l*=-1,n=p,p=x,x=n,n=_,_=w,w=n,a in dg)&&N.attr("cursor",cg[a=dg[a]]),h.selection&&(u=h.selection),// May be set by brush.move!
|
|
3420
|
+
A&&(d=u[0][0],v=u[1][0]),z&&(_=u[0][1],w=u[1][1]),u[0][0]===d&&u[0][1]===_&&u[1][0]===v&&u[1][1]===w||(h.selection=[[d,_],[v,w]],I.call(r),E.brush(t,o.name))}function B(t){if(t.stopImmediatePropagation(),t.touches){if(t.touches.length)return;D&&clearTimeout(D),D=setTimeout(function(){D=null},500)}else Yc(t.view,C),i.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);var n;e.attr("pointer-events","all"),N.attr("cursor",cg.overlay),h.selection&&(u=h.selection),// May be set by brush.move (on start)!
|
|
3421
|
+
(n=u)[0][0]!==n[1][0]&&n[0][1]!==n[1][1]||(h.selection=null,I.call(r)),E.end(t,o.name)}D&&!t.touches||j.apply(this,arguments)&&(r=this,a=t.target.__data__.type,o="selection"===(R&&t.metaKey?a="overlay":a)?Qc:R&&t.altKey?eg:ng,s=O===hg?null:fg[a],l=O===lg?null:pg[a],n=(h=bg(r)).extent,u=h.selection,c=n[0][0],f=n[0][1],m=n[1][0],b=n[1][1],k=S=0,M=s&&l&&R&&t.shiftKey,T=Array.from(t.touches||[t],t=>{var n=t.identifier;return(t=vt(t,r)).point0=t.slice(),t.identifier=n,t}),cn(r),E=F(r,arguments,!0).beforestart(),"overlay"===a?(u&&(C=!0),n=[T[0],T[1]||T[0]],h.selection=u=[[g=O===hg?c:rg(n[0][0],n[1][0]),p=O===lg?f:rg(n[0][1],n[1][1])],[y=O===hg?m:ag(n[0][0],n[1][0]),x=O===lg?b:ag(n[0][1],n[1][1])]],1<T.length&&L(t)):(g=u[0][0],p=u[0][1],y=u[1][0],x=u[1][1]),d=g,_=p,v=y,w=x,e=H(r).attr("pointer-events","none"),N=e.selectAll(".overlay").attr("cursor",cg[a]),t.touches?(E.moved=P,E.ended=B):(i=H(t.view).on("mousemove.brush",P,!0).on("mouseup.brush",B,!0),R&&i.on("keydown.brush",function(t){switch(t.keyCode){case 16:M=s&&l;break;case 18:o===ng&&(s&&(y=v-S*s,g=d+S*s),l&&(x=w-k*l,p=_+k*l),o=eg,L(t));break;case 32:o!==ng&&o!==eg||(s<0?y=v-S:0<s&&(g=d-S),l<0?x=w-k:0<l&&(p=_-k),o=tg,N.attr("cursor",cg.selection),L(t));break;default:return}Jc(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:M&&(A=z=M=!1,L(t));break;case 18:o===eg&&(s<0?y=v:0<s&&(g=d),l<0?x=w:0<l&&(p=_),o=ng,L(t));break;case 32:o===tg&&(o=t.altKey?(s&&(y=v-S*s,g=d+S*s),l&&(x=w-k*l,p=_+k*l),eg):(s<0?y=v:0<s&&(g=d),l<0?x=w:0<l&&(p=_),ng),N.attr("cursor",cg[a]),L(t));break;default:return}Jc(t)},!0),Vc(t.view)),I.call(r),E.start(t,o.name))}function l(t){F(this,arguments).moved(t)}function h(t){F(this,arguments).ended(t)}function u(){var t=this.__brush||{selection:null};return t.extent=sg(n.apply(this,arguments)),t.dim=O,t}return r.move=function(t,s,i){t.tween?t.on("start.brush",function(t){F(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){F(this,arguments).end(t)}).tween("brush",function(){var n=this,e=n.__brush,i=F(n,arguments),t=e.selection,a=O.input("function"==typeof s?s.apply(this,arguments):s,e.extent),r=ie(t,a);function o(t){e.selection=1===t&&null===a?null:r(t),I.call(n),i.brush()}return null!==t&&null!==a?o:o(1)}):t.each(function(){var t=arguments,n=this.__brush,e=O.input("function"==typeof s?s.apply(this,t):s,n.extent),t=F(this,t).beforestart();cn(this),n.selection=null===e?null:e,I.call(this),t.start(i).brush(i).end(i)})},r.clear=function(t,n){r.move(t,null,n)},o.prototype={beforestart:function(){return 1==++this.active&&((this.state.emitter=this).starting=!0),this},start:function(t,n){return this.starting?(this.starting=!1,this.emit("start",t,n)):this.emit("brush",t),this},brush:function(t,n){return this.emit("brush",t,n),this},end:function(t,n){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,n)),this},emit:function(t,n,e){var i=H(this.that).datum();a.call(t,this.that,new Zc(t,{sourceEvent:n,target:r,selection:O.output(this.state.selection),mode:e,dispatch:a}),i)}},r.extent=function(t){return arguments.length?(n="function"==typeof t?t:Xc(sg(t)),r):n},r.filter=function(t){return arguments.length?(j="function"==typeof t?t:Xc(!!t),r):j},r.touchable=function(t){return arguments.length?(e="function"==typeof t?t:Xc(!!t),r):e},r.handleSize=function(t){return arguments.length?(i=+t,r):i},r.keyModifiers=function(t){return arguments.length?(R=!!t,r):R},r.on=function(){var t=a.on.apply(a,arguments);return t===a?r:t},r}let wg="#bbb";class Sg extends Dc{
|
|
3422
3422
|
/**
|
|
3423
3423
|
@memberof Timeline
|
|
3424
3424
|
@desc Triggered on brush "brush".
|
|
@@ -3447,7 +3447,7 @@ A&&(d=u[0][0],v=u[1][0]),z&&(_=u[0][1],w=u[1][1]),u[0][0]===d&&u[0][1]===_&&u[1]
|
|
|
3447
3447
|
*/_updateDomain(n){i=n,e=this._select.node(),i.target&&(i=yt(i),void 0===e&&(e=i.currentTarget),i=i.touches||[i]);var e,i=Array.from(i,t=>vt(t,e));let a=n.selection&&this._brushing||!i.length?n.selection:[i[0][0],i[0][0]];a=(a="ticks"===this._buttonBehaviorCurrent?a.map(this._d3Scale.invert):a).map(Number),"brush"===n.type&&this._brushing&&"buttons"===this._buttonBehaviorCurrent&&(i=n.selection.map(t=>Math.abs(t-n.sourceEvent.offsetX)),a=i[1]<=i[0]?[n.selection[0],n.sourceEvent.offsetX].sort((t,n)=>t-n):[n.sourceEvent.offsetX,n.selection[1]].sort((t,n)=>t-n));i="ticks"===this._buttonBehaviorCurrent?this._availableTicks.map(Number):this._d3Scale.range();if("ticks"===this._buttonBehaviorCurrent){
|
|
3448
3448
|
// find closest min and max ticks from data
|
|
3449
3449
|
// and their indices in the ticks Array
|
|
3450
|
-
let t=
|
|
3450
|
+
let t=Nt(wu(a[0],i));var r=i.indexOf(+t);let n=Nt(wu(a[1],i));var o=i.indexOf(+n),s=Math.abs(o-r),l=this._brushMin()-1;
|
|
3451
3451
|
// using the indices, determine if the 2 ends of the brush
|
|
3452
3452
|
// are too close to each other. "ticksApart" always needs to
|
|
3453
3453
|
// be less than the current current brushMin minus 1. For
|
|
@@ -3459,20 +3459,20 @@ s<l&&(
|
|
|
3459
3459
|
// push the maxDomain out as far as possible to account for brushMin
|
|
3460
3460
|
o=Dt([i.length-1,o+(l-s)]),n=i[o],(s=Math.abs(o-r))<l)&&(r=Ot([0,r-(l-s)]),t=i[r]),a[0]=t,a[1]=n}else a[0]=wu(a[0],i),a[1]=wu(a[1],i);
|
|
3461
3461
|
// if the brush event has finished, update the current "selection" value
|
|
3462
|
-
o=+a[0]==+a[1];return"brush"!==n.type&&"end"!==n.type||(this._selection="ticks"===this._buttonBehaviorCurrent?o?a[0]:a:o?
|
|
3462
|
+
o=+a[0]==+a[1];return"brush"!==n.type&&"end"!==n.type||(this._selection="ticks"===this._buttonBehaviorCurrent?o?a[0]:a:o?Nt(this._availableTicks[i.indexOf(a[0])]):[Nt(this._availableTicks[i.indexOf(a[0])]),Nt(this._availableTicks[i.indexOf(a[1])])]),a}
|
|
3463
3463
|
/**
|
|
3464
3464
|
@memberof Timeline
|
|
3465
3465
|
@desc Updates limits of the brush.
|
|
3466
3466
|
@private
|
|
3467
|
-
*/_updateBrushLimit(t){var n,t="ticks"===this._buttonBehaviorCurrent?t.map(
|
|
3467
|
+
*/_updateBrushLimit(t){var n,t="ticks"===this._buttonBehaviorCurrent?t.map(Nt).map(this._d3Scale):t;return t[0]===t[1]&&(t[0]-=.1,t[1]+=.1),"buttons"===this._buttonBehaviorCurrent&&(n=this._hiddenHandles?0:this._handleSize,n=.5*(this._ticksWidth/this._availableTicks.length-n),t[0]-=n,t[1]+=n),t}
|
|
3468
3468
|
/**
|
|
3469
3469
|
@memberof Timeline
|
|
3470
3470
|
@desc Draws the timeline.
|
|
3471
3471
|
@param {Function} [*callback* = undefined]
|
|
3472
3472
|
@chainable
|
|
3473
|
-
*/render(t){var{height:n,y:e}=this._position;this._ticks&&(this._ticks=this._ticks.map(
|
|
3473
|
+
*/render(t){var{height:n,y:e}=this._position;this._ticks&&(this._ticks=this._ticks.map(Nt)),this._data&&(this._data=this._data.map(Nt));let i=this._ticks||this._domain.map(Nt),a=(this._ticks||(r=Ss().domain(i).range([0,this._width]),i=r.ticks()),this._timeLocale||wi[this._locale]||wi["en-US"]),l=(void 0===this._userFormat&&(this._userFormat=this._tickFormat||!1),this._tickFormat=this._userFormat||(t=>Yu(t,i).replace(/^Q/g,a.quarter)));if(
|
|
3474
3474
|
// Measures size of ticks
|
|
3475
|
-
this._ticksWidth=this._width,["auto","buttons"].includes(this._buttonBehavior)){let s=0;i.forEach((t,n)=>{var{fontFamily:e,fontSize:i}=this._shapeConfig.labelConfig;let a="function"==typeof e?e(t,n):e,r="function"==typeof i?i(t,n):i;e=si().fontFamily(a).fontSize(r).lineHeight(this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,n):void 0)(l(t));let o=e.lines.length?Math.ceil(Ot(e.lines.map(t=>Ae(t,{"font-family":a,"font-size":r}))))+r/4:0;o%2&&o++,s<o&&(s=o+2*this._buttonPadding)}),this._ticksWidth=s*i.length}var r=this._playButton?this._playButtonConfig.width||this._buttonHeight:0,o=this._width-r,o=(this._buttonBehaviorCurrent="auto"===this._buttonBehavior?this._ticksWidth<o?"buttons":"ticks":this._buttonBehavior,this._hiddenHandles="buttons"===this._buttonBehaviorCurrent&&!this._brushing);if("buttons"===this._buttonBehaviorCurrent){this._scale="ordinal";let e=Ss().domain(this._domain.map(
|
|
3475
|
+
this._ticksWidth=this._width,["auto","buttons"].includes(this._buttonBehavior)){let s=0;i.forEach((t,n)=>{var{fontFamily:e,fontSize:i}=this._shapeConfig.labelConfig;let a="function"==typeof e?e(t,n):e,r="function"==typeof i?i(t,n):i;e=si().fontFamily(a).fontSize(r).lineHeight(this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,n):void 0)(l(t));let o=e.lines.length?Math.ceil(Ot(e.lines.map(t=>Ae(t,{"font-family":a,"font-size":r}))))+r/4:0;o%2&&o++,s<o&&(s=o+2*this._buttonPadding)}),this._ticksWidth=s*i.length}var r=this._playButton?this._playButtonConfig.width||this._buttonHeight:0,o=this._width-r,o=(this._buttonBehaviorCurrent="auto"===this._buttonBehavior?this._ticksWidth<o?"buttons":"ticks":this._buttonBehavior,this._hiddenHandles="buttons"===this._buttonBehaviorCurrent&&!this._brushing);if("buttons"===this._buttonBehaviorCurrent){this._scale="ordinal";let e=Ss().domain(this._domain.map(Nt)).ticks().map(Number);this._domain=this._ticks||Array.from(Array(e[e.length-1]-e[0]+1),(t,n)=>e[0]+n).map(Nt),this._ticks=this._domain;var s=.5*this._ticksWidth/this._ticks.length,h=this._width-this._ticksWidth-r;this._paddingLeft="middle"===this._buttonAlign?h/2+r:"end"===this._buttonAlign?h+r:r,this._range=[this._paddingLeft+s,this._paddingLeft+this._ticksWidth-s]}else this._scale="time",this._domain=Hi(i),this._range=[r?1.5*r:void 0,void 0],this._paddingLeft=r;super.render(t);let u=this._outerBounds[e],c=this._d3Scale.range();h=this._brush=xg(lg).extent([[c[0],u],[c[c.length-1],u+this._outerBounds[n]]]).filter(this._brushFilter).handleSize(o?0:this._handleSize).on("start",this._brushStart.bind(this)).on("brush",this._brushBrush.bind(this)).on("end",this._brushEnd.bind(this)),s="ticks"===this._buttonBehaviorCurrent?this._availableTicks:c,t=[this._brushMin()>s.length?s[0]:s[s.length-this._brushMin()],s[s.length-1]],e=void 0===this._selection?t:this._selection instanceof Array?"buttons"===this._buttonBehaviorCurrent?this._selection.map(Nt).map(t=>c[this._ticks.map(Number).indexOf(+t)]):this._selection.map(Nt):"buttons"===this._buttonBehaviorCurrent?[c[this._ticks.map(Number).indexOf(+this._selection)]]:[this._selection],1===e.length&&e.push(e[0]),this._updateBrushLimit(e),this._brushGroup=Pt("g.brushGroup",{parent:this._group}),this._brushGroup.call(h).transition(this._transition).call(h.move,"ticks"===this._buttonBehaviorCurrent?this._updateBrushLimit(e):e),this._outerBounds.y-=this._handleSize/2,this._outerBounds.height+=this._handleSize/2,n=Pt("g.d3plus-Timeline-play",{parent:this._group});
|
|
3476
3476
|
// data Array to be used when detecting the default value
|
|
3477
3477
|
return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-r,y:"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2-this._buttonHeight/2:"start"===this._align?this._margin.top:this._height-this._buttonHeight-this._margin.bottom:this._outerBounds.y,width:r,height:this._buttonHeight}]:[]).select(n.node()).config(Lt.bind(this)(this._playButtonConfig)).render(),this}
|
|
3478
3478
|
/**
|
|
@@ -3582,7 +3582,7 @@ return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-r,y:"bu
|
|
|
3582
3582
|
@private
|
|
3583
3583
|
*/constructor(){super(),this._barConfig=Et({},this._barConfig,{stroke:()=>"buttons"===this._buttonBehaviorCurrent?"transparent":wg,"stroke-width":()=>"buttons"===this._buttonBehaviorCurrent?0:1}),this._brushing=!0,this._brushFilter=t=>!t.button&&t.detail<2,this._brushMin=Bt(1),this._buttonAlign="middle",this._buttonBehavior="auto",this._buttonPadding=10,this._buttonHeight=24,this._domain=[2001,2010],this._gridSize=0,this._handleConfig={fill:Rh.light,stroke:"#228be6","stroke-width":2,rx:2,ry:2},this._handleSize=6,this._height=100,this._labelOffset=!1,this._on={},this.orient("bottom"),this._playButton=!0,this._playButtonClass=(new Wc).on("click",()=>{
|
|
3584
3584
|
// if playing, pause
|
|
3585
|
-
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let a=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(
|
|
3585
|
+
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let a=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(Nt).map(Number)).length&&t.push(t[0]);var n=this._ticks.map(Number),e=n.indexOf(t[0]),i=n.indexOf(t[t.length-1]);(i===n.length-1?a?this.selection([this._ticks[0],this._ticks[i-e]]):(clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass):(i+1===n.length-1&&(clearInterval(this._playTimer),this._playTimer=!1),this.selection([this._ticks[e+1],this._ticks[i+1]]))).render(),a=!1};this._playTimer=setInterval(t,this._playButtonInterval),t()}}).on("mousemove",()=>this._playButtonClass.select().style("cursor","pointer")),this._playButtonConfig={fontColor:Rh.dark,fontSize:15,text:()=>this._playTimer?"⏸":"⏵",textAnchor:"middle",verticalAlign:"middle"},this._playButtonInterval=1e3,this._selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===this._buttonBehaviorCurrent?.3:1,"stroke-width":0},this._shape="Rect",this._shapeConfig=Et({},this._shapeConfig,{labelBounds:t=>"buttons"===this._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-this._buttonHeight/2+1,width:t.labelBounds.width,height:this._buttonHeight}:t.labelBounds,labelConfig:{fontColor:Rh.dark,fontSize:()=>12,verticalAlign:()=>"buttons"===this._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===this._buttonBehaviorCurrent?"#fff":wg,stroke:()=>"buttons"===this._buttonBehaviorCurrent?wg:"transparent",height:t=>"buttons"===this._buttonBehaviorCurrent?this._buttonHeight:t.tick?this._handleSize:0,width:t=>"buttons"===this._buttonBehaviorCurrent?this._ticksWidth/this._availableTicks.length:t.tick?this._domain.map(Number).includes(t.id)?2:1:0,y:t=>"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2:"start"===this._align?this._margin.top+this._buttonHeight/2:this._height-this._buttonHeight/2-this._margin.bottom:t.y,rx:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0,ry:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0}),this._snapping=!0}}var kg="top",Cg="bottom",Mg="right",Ag="left",zg="auto",Tg=[kg,Cg,Mg,Ag],Eg="start",Ng="end",Pg="clippingParents",Lg="viewport",Bg="popper",Og="reference",Dg=Tg.reduce(function(t,n){return t.concat([n+"-"+Eg,n+"-"+Ng])},[]),jg=[].concat(Tg,[zg]).reduce(function(t,n){return t.concat([n,n+"-"+Eg,n+"-"+Ng])},[]),Rg=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Ig(t){return t?(t.nodeName||"").toLowerCase():null}function Fg(t){var n;return null==t?window:"[object Window]"!==t.toString()?(n=t.ownerDocument)&&n.defaultView||window:t}function Hg(t){return t instanceof Fg(t).Element||t instanceof Element}function Gg(t){return t instanceof Fg(t).HTMLElement||t instanceof HTMLElement}function Kg(t){
|
|
3586
3586
|
// IE 11 has no ShadowRoot
|
|
3587
3587
|
return"undefined"!=typeof ShadowRoot&&(t instanceof Fg(t).ShadowRoot||t instanceof ShadowRoot)}
|
|
3588
3588
|
// and applies them to the HTMLElements such as popper and arrow
|
|
@@ -3611,7 +3611,7 @@ function id(t){for(var n,e=Fg(t),i=ed(t);i&&(n=i,0<=["table","td","th"].indexOf(
|
|
|
3611
3611
|
if("none"!==a.transform||"none"!==a.perspective||"paint"===a.contain||-1!==["transform","perspective"].indexOf(a.willChange)||n&&"filter"===a.willChange||n&&a.filter&&"none"!==a.filter)return i;i=i.parentNode}}return null})(t))||e}function ad(t){return 0<=["top","bottom"].indexOf(t)?"x":"y"}function rd(t,n,e){return Wg(t,qg(n,e))}function od(){return{top:0,right:0,bottom:0,left:0}}function sd(t){return Object.assign({},od(),t)}function ld(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function hd(t){return t.split("-")[1]}var ud={top:"auto",right:"auto",bottom:"auto",left:"auto"};// Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
3612
3612
|
// Zooming can change the DPR, but it seems to report a value that will
|
|
3613
3613
|
// cleanly divide the values into the appropriate subpixels.
|
|
3614
|
-
function cd(t){var n,e=t.popper,i=t.popperRect,a=t.placement,r=t.variation,o=t.offsets,s=t.position,l=t.gpuAcceleration,h=t.adaptive,u=t.roundOffsets,t=t.isFixed,c=o.x,c=void 0===c?0:c,g=o.y,g=void 0===g?0:g,d="function"==typeof u?u({x:c,y:g}):{x:c,y:g},d=(c=d.x,g=d.y,o.hasOwnProperty("x")),o=o.hasOwnProperty("y"),f=Ag,p=kg,_=window,m=(h&&(m="clientHeight",n="clientWidth",(y=id(e))===Fg(e)&&"static"!==Qg(y=td(e)).position&&"absolute"===s&&(m="scrollHeight",n="scrollWidth"),a!==kg&&(a!==Ag&&a!==Mg||r!==
|
|
3614
|
+
function cd(t){var n,e=t.popper,i=t.popperRect,a=t.placement,r=t.variation,o=t.offsets,s=t.position,l=t.gpuAcceleration,h=t.adaptive,u=t.roundOffsets,t=t.isFixed,c=o.x,c=void 0===c?0:c,g=o.y,g=void 0===g?0:g,d="function"==typeof u?u({x:c,y:g}):{x:c,y:g},d=(c=d.x,g=d.y,o.hasOwnProperty("x")),o=o.hasOwnProperty("y"),f=Ag,p=kg,_=window,m=(h&&(m="clientHeight",n="clientWidth",(y=id(e))===Fg(e)&&"static"!==Qg(y=td(e)).position&&"absolute"===s&&(m="scrollHeight",n="scrollWidth"),a!==kg&&(a!==Ag&&a!==Mg||r!==Ng)||(p=Cg,g=(g-((t&&y===_&&_.visualViewport?_.visualViewport.height:y[m])-i.height))*(l?1:-1)),a!==Ag&&(a!==kg&&a!==Cg||r!==Ng)||(f=Mg,c=(c-((t&&y===_&&_.visualViewport?_.visualViewport.width:y[n])-i.width))*(l?1:-1))),Object.assign({position:s},h&&ud)),y=!0===u?(a={x:c,y:g},r=Fg(e),t=a.x,a=a.y,r=r.devicePixelRatio||1,{x:$g(t*r)/r||0,y:$g(a*r)/r||0}):{x:c,y:g};return c=y.x,g=y.y,l?Object.assign({},m,((n={})[p]=o?"0":"",n[f]=d?"0":"",n.transform=(_.devicePixelRatio||1)<=1?"translate("+c+"px, "+g+"px)":"translate3d("+c+"px, "+g+"px, 0)",n)):Object.assign({},m,((i={})[p]=o?g+"px":"",i[f]=d?c+"px":"",i.transform="",i))}// eslint-disable-next-line import/no-unused-modules
|
|
3615
3615
|
var gd={passive:!0};// eslint-disable-next-line import/no-unused-modules
|
|
3616
3616
|
var dd={left:"right",right:"left",bottom:"top",top:"bottom"};function fd(t){return t.replace(/left|right|bottom|top/g,function(t){return dd[t]})}var pd={start:"end",end:"start"};function _d(t){return t.replace(/start|end/g,function(t){return pd[t]})}function md(t){t=Fg(t);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function yd(t){
|
|
3617
3617
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
@@ -3636,14 +3636,14 @@ var i,a,r,o,s,l,h,u}// A "clipping parent" is an overflowable container with the
|
|
|
3636
3636
|
// `initial`
|
|
3637
3637
|
// Gets the maximum area that the element is visible in due to any number of
|
|
3638
3638
|
// clipping parents
|
|
3639
|
-
function Sd(e,t,n,i){var a,r="clippingParents"===t?(o=bd(nd(r=e)),Hg(a=0<=["absolute","fixed"].indexOf(Qg(r).position)&&Gg(r)?id(r):r)?o.filter(function(t){return Hg(t)&&Jg(t,a)&&"body"!==Ig(t)}):[]):[].concat(t),o=[].concat(r,[n]),t=o[0],n=o.reduce(function(t,n){n=wd(e,n,i);return t.top=Wg(n.top,t.top),t.right=qg(n.right,t.right),t.bottom=qg(n.bottom,t.bottom),t.left=Wg(n.left,t.left),t},wd(e,t,i));return n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}function kd(t){var n,e=t.reference,i=t.element,t=t.placement,a=t?Ug(t):null,t=t?hd(t):null,r=e.x+e.width/2-i.width/2,o=e.y+e.height/2-i.height/2;switch(a){case kg:n={x:r,y:e.y-i.height};break;case Cg:n={x:r,y:e.y+e.height};break;case Mg:n={x:e.x+e.width,y:o};break;case Ag:n={x:e.x-i.width,y:o};break;default:n={x:e.x,y:e.y}}var s=a?ad(a):null;if(null!=s){var l="y"===s?"height":"width";switch(t){case Eg:n[s]=n[s]-(e[l]/2-i[l]/2);break;case
|
|
3639
|
+
function Sd(e,t,n,i){var a,r="clippingParents"===t?(o=bd(nd(r=e)),Hg(a=0<=["absolute","fixed"].indexOf(Qg(r).position)&&Gg(r)?id(r):r)?o.filter(function(t){return Hg(t)&&Jg(t,a)&&"body"!==Ig(t)}):[]):[].concat(t),o=[].concat(r,[n]),t=o[0],n=o.reduce(function(t,n){n=wd(e,n,i);return t.top=Wg(n.top,t.top),t.right=qg(n.right,t.right),t.bottom=qg(n.bottom,t.bottom),t.left=Wg(n.left,t.left),t},wd(e,t,i));return n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}function kd(t){var n,e=t.reference,i=t.element,t=t.placement,a=t?Ug(t):null,t=t?hd(t):null,r=e.x+e.width/2-i.width/2,o=e.y+e.height/2-i.height/2;switch(a){case kg:n={x:r,y:e.y-i.height};break;case Cg:n={x:r,y:e.y+e.height};break;case Mg:n={x:e.x+e.width,y:o};break;case Ag:n={x:e.x-i.width,y:o};break;default:n={x:e.x,y:e.y}}var s=a?ad(a):null;if(null!=s){var l="y"===s?"height":"width";switch(t){case Eg:n[s]=n[s]-(e[l]/2-i[l]/2);break;case Ng:n[s]=n[s]+(e[l]/2-i[l]/2)}}return n}function Cd(t,n){var i,n=n=void 0===n?{}:n,e=n.placement,e=void 0===e?t.placement:e,a=n.strategy,a=void 0===a?t.strategy:a,r=n.boundary,r=void 0===r?Pg:r,o=n.rootBoundary,o=void 0===o?Lg:o,s=n.elementContext,s=void 0===s?Bg:s,l=n.altBoundary,l=void 0!==l&&l,n=n.padding,n=void 0===n?0:n,n=sd("number"!=typeof n?n:ld(n,Tg)),h=t.rects.popper,l=t.elements[l?s===Bg?Og:Bg:s],l=Sd(Hg(l)?l:l.contextElement||td(t.elements.popper),r,o,a),r=Xg(t.elements.reference),o=kd({reference:r,element:h,placement:e}),a=xd(Object.assign({},h,o)),h=s===Bg?a:r,u={top:l.top-h.top+n.top,bottom:h.bottom-l.bottom+n.bottom,left:l.left-h.left+n.left,right:h.right-l.right+n.right},o=t.modifiersData.offset;// Offsets can be applied only to the popper element
|
|
3640
3640
|
return s===Bg&&o&&(i=o[e],Object.keys(u).forEach(function(t){var n=0<=[Mg,Cg].indexOf(t)?1:-1,e=0<=[kg,Cg].indexOf(t)?"y":"x";u[t]+=i[e]*n})),u}function Md(t,n,e){return{top:t.top-n.height-(e=void 0===e?{x:0,y:0}:e).y,right:t.right-n.width+e.x,bottom:t.bottom-n.height+e.y,left:t.left-n.width-e.x}}function Ad(n){return[kg,Mg,Cg,Ag].some(function(t){return 0<=n[t]})}// Returns the composite rect of an element relative to its offsetParent.
|
|
3641
3641
|
// Composite means it takes into account transforms as well as layout.
|
|
3642
3642
|
function zd(t,n,e){void 0===e&&(e=!1);var i=Gg(n),a=Gg(n)&&(o=(a=n).getBoundingClientRect(),r=$g(o.width)/a.offsetWidth||1,o=$g(o.height)/a.offsetHeight||1,1!==r||1!==o),r=td(n),o=Xg(t,a,e),t={scrollLeft:0,scrollTop:0},s={x:0,y:0};return!i&&e||("body"===Ig(n)&&// https://github.com/popperjs/popper-core/issues/1078
|
|
3643
3643
|
!vd(r)||(t=(i=n)!==Fg(i)&&Gg(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:md(i)),Gg(n)?((s=Xg(n,!0)).x+=n.clientLeft,s.y+=n.clientTop):r&&(s.x=yd(r))),{x:o.left+t.scrollLeft-s.x,y:o.top+t.scrollTop-s.y,width:o.width,height:o.height}}function Td(t){var e=new Map,i=new Set,a=[];return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){i.has(t.name)||
|
|
3644
3644
|
// check for visited object
|
|
3645
3645
|
!// On visiting object, check for its dependencies and visit them recursively
|
|
3646
|
-
function n(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){i.has(t)||(t=e.get(t))&&n(t)}),a.push(t)}(t)}),a}var Ed={placement:"bottom",modifiers:[],strategy:"absolute"};function
|
|
3646
|
+
function n(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){i.has(t)||(t=e.get(t))&&n(t)}),a.push(t)}(t)}),a}var Ed={placement:"bottom",modifiers:[],strategy:"absolute"};function Nd(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return!n.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function Pd(t){var t=t=void 0===t?{}:t,n=t.defaultModifiers,c=void 0===n?[]:n,n=t.defaultOptions,g=void 0===n?Ed:n;return function(i,a,n){void 0===n&&(n=g);var e,r,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ed,g),modifiersData:{},elements:{reference:i,popper:a},attributes:{},styles:{}},s=[],l=!1,h={state:o,setOptions:function(t){var e,n,t="function"==typeof t?t(o.options):t,t=(u(),o.options=Object.assign({},g,o.options,t),o.scrollParents={reference:Hg(i)?bd(i):i.contextElement?bd(i.contextElement):[],popper:bd(a)},t=[].concat(c,o.options.modifiers),n=t.reduce(function(t,n){var e=t[n.name];return t[n.name]=e?Object.assign({},e,n,{options:Object.assign({},e.options,n.options),data:Object.assign({},e.data,n.data)}):n,t},{}),t=Object.keys(n).map(function(t){return n[t]}),e=Td(t),Rg.reduce(function(t,n){return t.concat(e.filter(function(t){return t.phase===n}))},[]));// Strip out disabled modifiers
|
|
3647
3647
|
return o.orderedModifiers=t.filter(function(t){return t.enabled}),o.orderedModifiers.forEach(function(t){var n=t.name,e=t.options,t=t.effect;"function"==typeof t&&(t=t({state:o,name:n,instance:h,options:void 0===e?{}:e}),s.push(t||function(){}))}),h.update()},
|
|
3648
3648
|
// Sync update – it will always be executed, even if not necessary. This
|
|
3649
3649
|
// is useful for low frequency updates where sync behavior simplifies the
|
|
@@ -3652,7 +3652,7 @@ return o.orderedModifiers=t.filter(function(t){return t.enabled}),o.orderedModif
|
|
|
3652
3652
|
// prefer the async Popper#update method
|
|
3653
3653
|
forceUpdate:function(){if(!l){var t=o.elements,n=t.reference,t=t.popper;// Don't proceed if `reference` or `popper` are not valid elements
|
|
3654
3654
|
// anymore
|
|
3655
|
-
if(
|
|
3655
|
+
if(Nd(n,t)){// Store the reference and popper rects to be read by modifiers
|
|
3656
3656
|
o.rects={reference:zd(n,id(t),"fixed"===o.options.strategy),popper:Zg(t)},// Modifiers have the ability to reset the current update cycle. The
|
|
3657
3657
|
// most common use case for this is the `flip` modifier changing the
|
|
3658
3658
|
// placement, which then needs to re-run all the modifiers, because the
|
|
@@ -3665,7 +3665,7 @@ o.reset=!1,o.placement=o.options.placement,// On each update cycle, the `modifie
|
|
|
3665
3665
|
o.orderedModifiers.forEach(function(t){return o.modifiersData[t.name]=Object.assign({},t.data)});for(var e,i,a,r=0;r<o.orderedModifiers.length;r++)!0===o.reset?(o.reset=!1,r=-1):(i=(e=o.orderedModifiers[r]).fn,a=e.options,"function"==typeof i&&(o=i({state:o,options:void 0===a?{}:a,name:e.name,instance:h})||o))}}},
|
|
3666
3666
|
// Async and optimistically optimized update – it will not be executed if
|
|
3667
3667
|
// not necessary (debounced to run at most once-per-tick)
|
|
3668
|
-
update:(e=function(){return new Promise(function(t){h.forceUpdate(),t(o)})},function(){return r=r||new Promise(function(t){Promise.resolve().then(function(){r=void 0,t(e())})})}),destroy:function(){u(),l=!0}};return
|
|
3668
|
+
update:(e=function(){return new Promise(function(t){h.forceUpdate(),t(o)})},function(){return r=r||new Promise(function(t){Promise.resolve().then(function(){r=void 0,t(e())})})}),destroy:function(){u(),l=!0}};return Nd(i,a)&&h.setOptions(n).then(function(t){!l&&n.onFirstUpdate&&n.onFirstUpdate(t)}),h;function u(){s.forEach(function(t){return t()}),s=[]}}}var Ld=Pd({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,e=t.instance,i=(t=t.options).scroll,a=void 0===i||i,r=void 0===(i=t.resize)||i,o=Fg(n.elements.popper),s=[].concat(n.scrollParents.reference,n.scrollParents.popper);return a&&s.forEach(function(t){t.addEventListener("scroll",e.update,gd)}),r&&o.addEventListener("resize",e.update,gd),function(){a&&s.forEach(function(t){t.removeEventListener("scroll",e.update,gd)}),r&&o.removeEventListener("resize",e.update,gd)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state;
|
|
3669
3669
|
// Offsets are the actual position the popper needs to have to be
|
|
3670
3670
|
// properly positioned near its reference element
|
|
3671
3671
|
// This is the most basic placement, and will be adjusted by
|
|
@@ -3694,7 +3694,7 @@ var M=p?3:1;0<M;M--)if("break"===(n=>{var t=s.find(function(t){t=u.get(t);if(t)r
|
|
|
3694
3694
|
/**
|
|
3695
3695
|
The inner return object and draw function that gets assigned the public methods.
|
|
3696
3696
|
@private
|
|
3697
|
-
*/render(t){let l=this;var n=
|
|
3697
|
+
*/render(t){let l=this;var n=Pt("div#d3plus-portal").selectAll("."+this._className).data(this._data,this._id);let i=n.enter().append("div").attr("class",this._className),a=n.merge(i);
|
|
3698
3698
|
/**
|
|
3699
3699
|
Creates DIV elements with a unique class and styles.
|
|
3700
3700
|
@private
|
|
@@ -3960,7 +3960,7 @@ function uf(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}af||(af=1,ch.exports=((dh=rf.pro
|
|
|
3960
3960
|
@function _drawColorScale
|
|
3961
3961
|
@desc Renders the color scale if this._colorScale is not falsey.
|
|
3962
3962
|
@private
|
|
3963
|
-
*/function gf(){var t=this._data;let n=this._colorScalePosition.bind(this)(this.config());[!1,"top","bottom","left","right"].includes(n)||(n="bottom");var e=["top","bottom"].includes(n),i=this._colorScale&&n,a=this._colorScalePadding()?this._padding:{top:0,right:0,bottom:0,left:0},r=this._width-(this._margin.left+this._margin.right+a.left+a.right),o=e?Dt([this._colorScaleMaxSize,r]):this._width-(this._margin.left+this._margin.right),s=this._height-(this._margin.bottom+this._margin.top+a.bottom+a.top),l=e?this._height-(this._margin.bottom+this._margin.top):Dt([this._colorScaleMaxSize,s]),r={opacity:n?1:0,transform:`translate(${e?this._margin.left+a.left+(r-o)/2:this._margin.left}, ${e?this._margin.top:this._margin.top+a.top+(s-l)/2})`},a=
|
|
3963
|
+
*/function gf(){var t=Array.from(qi(this._data,t=>_u(t,this._aggs),(t,n)=>`${this._time?this._time(t,n):"all"}-`+this._ids(t,n).join("_")).values());let n=this._colorScalePosition.bind(this)(this.config());[!1,"top","bottom","left","right"].includes(n)||(n="bottom");var e=["top","bottom"].includes(n),i=this._colorScale&&n,a=this._colorScalePadding()?this._padding:{top:0,right:0,bottom:0,left:0},r=this._width-(this._margin.left+this._margin.right+a.left+a.right),o=e?Dt([this._colorScaleMaxSize,r]):this._width-(this._margin.left+this._margin.right),s=this._height-(this._margin.bottom+this._margin.top+a.bottom+a.top),l=e?this._height-(this._margin.bottom+this._margin.top):Dt([this._colorScaleMaxSize,s]),r={opacity:n?1:0,transform:`translate(${e?this._margin.left+a.left+(r-o)/2:this._margin.left}, ${e?this._margin.top:this._margin.top+a.top+(s-l)/2})`},a=Pt("g.d3plus-viz-colorScale",{condition:i&&!this._colorScaleConfig.select,enter:r,parent:this._select,duration:this._duration,update:r}).node();this._colorScale&&(s=t.filter((t,n)=>{t=this._colorScale(t,n);return null!=t}),this._colorScaleClass.align({bottom:"end",left:"start",right:"end",top:"start"}[n]||"bottom").duration(this._duration).data(s).height(l).locale(this._locale).orient(n).select(a).value(this._colorScale).width(o).config(this._colorScaleConfig).render(),i)&&(r=this._colorScaleClass.outerBounds(),!this._colorScaleConfig.select)&&r.height&&(this._margin[n]+=e?r.height+2*this._legendClass.padding():r.width+2*this._legendClass.padding())}let df=["fill","opacity","texture"];
|
|
3964
3964
|
/**
|
|
3965
3965
|
@function legendLabel
|
|
3966
3966
|
@desc Default label function for the legend.
|
|
@@ -3971,7 +3971,7 @@ function uf(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}af||(af=1,ch.exports=((dh=rf.pro
|
|
|
3971
3971
|
@desc Renders the legend if this._legend is not falsy.
|
|
3972
3972
|
@param {Array} data The filtered data array to be displayed.
|
|
3973
3973
|
@private
|
|
3974
|
-
*/function pf(t=[]){let e=[],i=(t,n,e)=>{var i=this._shape(t,n),i=("fill"===e&&"Line"===i&&(e="stroke"),(this._shapeConfig[i]&&this._shapeConfig[i][e]?this._shapeConfig[i]:this._shapeConfig)[e]);return"function"==typeof i?i.bind(this)(t,n):i};var n=(n,e)=>df.map(t=>i(n,e,t)).join("_"),a=(qi(this._colorScale?t.filter((t,n)=>void 0===this._colorScale(t,n)):t,t=>e.push(_u(t,this._aggs)),n),e.sort(this._legendSort),e.map((t,n)=>this._ids(t,n).slice(0,this._drawDepth+1)));for(let n=this._legendDepth=0;n<=this._drawDepth;n++){var r=a.map(t=>t[n]);if(!r.some(t=>t instanceof Array)&&Array.from(new Set(r)).length===e.length){this._legendDepth=n;break}}let o=(t,n)=>{let e=this._id(t,n);return e instanceof Array&&(e=e[0]),this._hidden.includes(e)||this._solo.length&&!this._solo.includes(e)};var t=this._legendClass.outerBounds(),s=this.config();let l=this._legendPosition.bind(this)(s);[!1,"top","bottom","left","right"].includes(l)||(l="bottom");var h=["top","bottom"].includes(l),u=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},c={transform:`translate(${h?this._margin.left+u.left:this._margin.left}, ${h?this._margin.top:this._margin.top+u.top})`},s=this._legend.bind(this)(s,e),c=
|
|
3974
|
+
*/function pf(t=[]){let e=[],i=(t,n,e)=>{var i=this._shape(t,n),i=("fill"===e&&"Line"===i&&(e="stroke"),(this._shapeConfig[i]&&this._shapeConfig[i][e]?this._shapeConfig[i]:this._shapeConfig)[e]);return"function"==typeof i?i.bind(this)(t,n):i};var n=(n,e)=>df.map(t=>i(n,e,t)).join("_"),a=(qi(this._colorScale?t.filter((t,n)=>void 0===this._colorScale(t,n)):t,t=>e.push(_u(t,this._aggs)),n),e.sort(this._legendSort),e.map((t,n)=>this._ids(t,n).slice(0,this._drawDepth+1)));for(let n=this._legendDepth=0;n<=this._drawDepth;n++){var r=a.map(t=>t[n]);if(!r.some(t=>t instanceof Array)&&Array.from(new Set(r)).length===e.length){this._legendDepth=n;break}}let o=(t,n)=>{let e=this._id(t,n);return e instanceof Array&&(e=e[0]),this._hidden.includes(e)||this._solo.length&&!this._solo.includes(e)};var t=this._legendClass.outerBounds(),s=this.config();let l=this._legendPosition.bind(this)(s);[!1,"top","bottom","left","right"].includes(l)||(l="bottom");var h=["top","bottom"].includes(l),u=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},c={transform:`translate(${h?this._margin.left+u.left:this._margin.left}, ${h?this._margin.top:this._margin.top+u.top})`},s=this._legend.bind(this)(s,e),c=Pt("g.d3plus-viz-legend",{condition:s&&!this._legendConfig.select,enter:c,parent:this._select,duration:this._duration,update:c}).node();this._legendClass.id(n).align(h?"center":l).direction(h?"row":"column").duration(this._duration).data(s?e:[]).height(h?this._height-(this._margin.bottom+this._margin.top):this._height-(this._margin.bottom+this._margin.top+u.bottom+u.top)).locale(this._locale).parent(this).select(c).shape((t,n)=>"Circle"===this._shape(t,n)?"Circle":"Rect").verticalAlign(h?l:"middle").width(h?this._width-(this._margin.left+this._margin.right+u.left+u.right):this._width-(this._margin.left+this._margin.right)).shapeConfig(Lt.bind(this)(this._shapeConfig,"legend")).shapeConfig({fill:(t,n)=>o(t,n)?this._hiddenColor(t,n):i(t,n,"fill"),labelConfig:{fontOpacity:(t,n)=>o(t,n)?this._hiddenOpacity(t,n):1}}).config(this._legendConfig).render(),!this._legendConfig.select&&t.height&&(this._margin[l]+=h?t.height+2*this._legendClass.padding():t.width+2*this._legendClass.padding())}
|
|
3975
3975
|
/**
|
|
3976
3976
|
@function _drawSubtitle
|
|
3977
3977
|
@desc Draws a subtitle if this._subtitle is defined.
|
|
@@ -3983,7 +3983,7 @@ function uf(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}af||(af=1,ch.exports=((dh=rf.pro
|
|
|
3983
3983
|
@desc Determines whether or not to update the timeFilter method of the Viz.
|
|
3984
3984
|
@param {Array|Date} The timeline selection given from the d3 brush.
|
|
3985
3985
|
@private
|
|
3986
|
-
*/function _f(n){n instanceof Array||(n=[n,n]),JSON.stringify(n)!==JSON.stringify(this._timelineSelection)&&(n=(this._timelineSelection=n).map(Number),this.timeFilter(t=>{t=
|
|
3986
|
+
*/function _f(n){n instanceof Array||(n=[n,n]),JSON.stringify(n)!==JSON.stringify(this._timelineSelection)&&(n=(this._timelineSelection=n).map(Number),this.timeFilter(t=>{t=Nt(this._time(t)).getTime();return t>=n[0]&&t<=n[1]}).render())}
|
|
3987
3987
|
/**
|
|
3988
3988
|
@function _drawTimeline
|
|
3989
3989
|
@desc Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
|
|
@@ -4090,7 +4090,7 @@ if(this._drawDepth=void 0!==this._depth?Dt([0<=this._depth?this._depth:0,this._g
|
|
|
4090
4090
|
// Returns the current unique ID for a data point, coerced to a String.
|
|
4091
4091
|
this._id=(t,n)=>{t=Af(this._groupBy[this._drawDepth],t,n);return"number"==typeof t?""+t:t},
|
|
4092
4092
|
// Returns an array of the current unique groupBy ID for a data point, coerced to Strings.
|
|
4093
|
-
this._ids=(n,e)=>this._groupBy.map(t=>""+Af(t,n,e)).filter(Boolean),this._drawLabel=(t,n,e=this._drawDepth)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)n=(t=t.data).i;var i;return t._isAggregation?`${this._thresholdName(t,n)} < ${qu(100*t._threshold,this._locale)}%`:this._label&&e===this._drawDepth?""+this._label(t,n):(e=a._ids(t,n).slice(0,e+1),(e=e.reverse().find(t=>!(t instanceof Array))||e[e.length-1])instanceof Array?(i=e).reduce((t,n,e)=>(e?e===i.length-1&&1===e?t+=" and "+n:e===i.length-1?t+=", and "+n:t+=", "+n:t+=n,t),""):""+e)},this._time&&!this._timeFilter&&this._data.length){var t=this._data.map(this._time).map(
|
|
4093
|
+
this._ids=(n,e)=>this._groupBy.map(t=>""+Af(t,n,e)).filter(Boolean),this._drawLabel=(t,n,e=this._drawDepth)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)n=(t=t.data).i;var i;return t._isAggregation?`${this._thresholdName(t,n)} < ${qu(100*t._threshold,this._locale)}%`:this._label&&e===this._drawDepth?""+this._label(t,n):(e=a._ids(t,n).slice(0,e+1),(e=e.reverse().find(t=>!(t instanceof Array))||e[e.length-1])instanceof Array?(i=e).reduce((t,n,e)=>(e?e===i.length-1&&1===e?t+=" and "+n:e===i.length-1?t+=", and "+n:t+=", "+n:t+=n,t),""):""+e)},this._time&&!this._timeFilter&&this._data.length){var t=this._data.map(this._time).map(Nt),n=this._data[0];if(this._discrete&&"_"+this._discrete in this&&this["_"+this._discrete](n,0)===this._time(n,0))this._timeFilter=()=>!0;else{let e=+Ot(t);this._timeFilter=(t,n)=>+Nt(this._time(t,n))==e}}this._filteredData=[],this._legendData=[];let e=[];if(this._data.length){e=this._timeFilter?this._data.filter(this._timeFilter):this._data,this._filter&&(e=e.filter(this._filter));var i=[];for(let t=0;t<=this._drawDepth;t++)i.push(this._groupBy[t]);this._discrete&&"_"+this._discrete in this&&i.push(this["_"+this._discrete]),this._discrete&&`_${this._discrete}2`in this&&i.push(this[`_${this._discrete}2`]);n=qi(e,t=>{var n=this._data.indexOf(t[0]),e=this._shape(t[0],n),n=this._id(t[0],n),i=_u(t,this._aggs);this._hidden.includes(n)||this._solo.length&&!this._solo.includes(n)||(this._discrete||"Line"!==e?this._filteredData.push(i):this._filteredData=this._filteredData.concat(t)),this._legendData.push(i)},...i);this._filteredData=this._thresholdFunction(this._filteredData,n)}
|
|
4094
4094
|
// overrides the hoverOpacity of shapes if data is larger than cutoff
|
|
4095
4095
|
t=this._filteredData,n=[this._id],$i(t,Wi,Wi,n).size>this._dataCutoff?(void 0===this._userHover&&(this._userHover=this._shapeConfig.hoverOpacity||.5),void 0===this._userDuration&&(this._userDuration=this._shapeConfig.duration||600),this._shapeConfig.hoverOpacity=1,this._shapeConfig.duration=0):void 0!==this._userHover&&(this._shapeConfig.hoverOpacity=this._userHover,this._shapeConfig.duration=this._userDuration),this._noDataMessage&&!this._filteredData.length&&(this._messageClass.render({container:this._select.node().parentNode,html:this._noDataHTML(this),mask:!1,style:this._messageStyle}),this._select.transition().duration(this._duration).attr("opacity",0))}
|
|
4096
4096
|
/**
|
|
@@ -4103,19 +4103,19 @@ let t=this._legendPosition.bind(this)(this.config()),n=([!1,"top","bottom","left
|
|
|
4103
4103
|
// Draws legend and colorScale if they are positioned "left" or "right"
|
|
4104
4104
|
"left"!==t&&"right"!==t||pf.bind(this)(this._legendData),"left"!==n&&"right"!==n&&!1!==n||gf.bind(this)(this._filteredData),
|
|
4105
4105
|
// Draws all of the top/bottom UI elements
|
|
4106
|
-
function(){var t=this._history.length,n=
|
|
4106
|
+
function(){var t=this._history.length,n=Pt("g.d3plus-viz-back",{parent:this._select,duration:this._duration,update:{transform:`translate(${this._margin.left}, ${this._margin.top})`}}).node();this._backClass.data(t?[{text:"← "+this._translate("Back"),x:0,y:0}]:[]).select(n).config(this._backConfig).render(),this._margin.top+=t?this._backClass.fontSize()()+2*this._backClass.padding()():0}.bind(this)(),
|
|
4107
4107
|
/**
|
|
4108
4108
|
@function _drawTitle
|
|
4109
4109
|
@desc Draws a title if this._title is defined.
|
|
4110
4110
|
@param {Array} [*data*] The currently filtered dataset.
|
|
4111
4111
|
@private
|
|
4112
|
-
*/function(t=[]){var t=!!this._title&&this._title(t),n=this._titlePadding()?this._padding:{right:0,left:0},e=
|
|
4112
|
+
*/function(t=[]){var t=!!this._title&&this._title(t),n=this._titlePadding()?this._padding:{right:0,left:0},e=Pt("g.d3plus-viz-title",{enter:e={transform:`translate(${this._margin.left+n.left}, ${this._margin.top})`},parent:this._select,duration:0,update:e}).node();this._titleClass.data(t?[{text:t}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+n.left+n.right)).config(this._titleConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._titleConfig.padding:0}
|
|
4113
4113
|
/**
|
|
4114
4114
|
@function _drawTotal
|
|
4115
4115
|
@desc Draws a total title if this._total is defined.
|
|
4116
4116
|
@param {Array} [*data*] The currently filtered dataset.
|
|
4117
4117
|
@private
|
|
4118
|
-
*/.bind(this)(this._filteredData),function(t=[]){var t=!!this._subtitle&&this._subtitle(t),n=this._subtitlePadding()?this._padding:{right:0,left:0},e=
|
|
4118
|
+
*/.bind(this)(this._filteredData),function(t=[]){var t=!!this._subtitle&&this._subtitle(t),n=this._subtitlePadding()?this._padding:{right:0,left:0},e=Pt("g.d3plus-viz-subtitle",{enter:e={transform:`translate(${this._margin.left+n.left}, ${this._margin.top})`},parent:this._select,duration:0,update:e}).node();this._subtitleClass.data(t?[{text:t}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+n.left+n.right)).config(this._subtitleConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._subtitleConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var t="function"==typeof this._total?sa(t.map(this._total)):!(!0!==this._total||!this._size)&&sa(t.map(this._size)),n=this._totalPadding()?this._padding:{right:0,left:0},e=Pt("g.d3plus-viz-total",{enter:e={transform:`translate(${this._margin.left+n.left}, ${this._margin.top})`},parent:this._select,duration:0,update:e}).node();this._totalClass.data(t?[{text:this._totalFormat(t)}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+n.left+n.right)).config(this._totalConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._totalConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var e=(i=this._time&&this._timeline)?pu(this._data.map(this._time)).map(Nt):[],i=i&&1<e.length,a=this._timelinePadding()?this._padding:{right:0,left:0},r={transform:`translate(${this._margin.left+a.left}, 0)`},r=Pt("g.d3plus-viz-timeline",{condition:i,enter:r,parent:this._select,duration:this._duration,update:r}).node();if(i){i=this._timelineClass.domain(Hi(e)).duration(this._duration).height(this._height-this._margin.bottom).locale(this._locale).select(r).ticks(e.sort((t,n)=>+t-+n)).width(this._width-(this._margin.left+this._margin.right+a.left+a.right)),r=Hi(t.map(this._time).map(Nt));this._timelineSelection?(this._timelineSelection[0]<r[0]&&(this._timelineSelection[0]=r[0]),this._timelineSelection[1]>r[1]&&(this._timelineSelection[1]=r[1])):this._timelineSelection=this._timelineDefault||r,i.selection(this._timelineSelection);let n=this._timelineConfig;i.config(n).on("brush",t=>{_f.bind(this)(t),n.on&&n.on.brush&&n.on.brush(t)}).on("end",t=>{_f.bind(this)(t),n.on&&n.on.end&&n.on.end(t)}).render(),this._margin.bottom+=i.outerBounds().height+2*i.padding()}}.bind(this)(this._filteredData),
|
|
4119
4119
|
// Draws legend and colorScale if they are positioned "top" or "bottom"
|
|
4120
4120
|
"top"!==t&&"bottom"!==t||pf.bind(this)(this._legendData),"top"!==n&&"bottom"!==n||gf.bind(this)(this._filteredData),this._shapes=[]}
|
|
4121
4121
|
/**
|
|
@@ -4123,6 +4123,10 @@ function(){var t=this._history.length,n=Nt("g.d3plus-viz-back",{parent:this._sel
|
|
|
4123
4123
|
* @param {Array} data The data to process.
|
|
4124
4124
|
* @private
|
|
4125
4125
|
*/_thresholdFunction(t){return t}
|
|
4126
|
+
/**
|
|
4127
|
+
* Detects width and height and sets SVG properties
|
|
4128
|
+
* @private
|
|
4129
|
+
*/_setSVGSize(){var t=this._select.style("display"),[n,e]=(this._select.style("display","none"),[pi(n=this._select.node().parentNode,"width"),pi(n,"height")]),n=(n-=parseFloat(this._select.style("border-left-width"),10))-parseFloat(this._select.style("border-right-width"),10),e=(e-=parseFloat(this._select.style("border-top-width"),10))-parseFloat(this._select.style("border-bottom-width"),10);this._select.style("display",t),this._autoWidth&&(this.width(n),this._select.style("width",this._width+"px").attr("width",this._width+"px")),this._autoHeight&&(this.height(e),this._select.style("height",this._height+"px").attr("height",this._height+"px"))}
|
|
4126
4130
|
/**
|
|
4127
4131
|
@memberof Viz
|
|
4128
4132
|
@desc Draws the visualization given the specified configuration.
|
|
@@ -4130,21 +4134,20 @@ function(){var t=this._history.length,n=Nt("g.d3plus-viz-back",{parent:this._sel
|
|
|
4130
4134
|
@chainable
|
|
4131
4135
|
*/render(i){
|
|
4132
4136
|
// Appends a fullscreen SVG to the BODY if a container has not been provided through .select().
|
|
4133
|
-
if(
|
|
4137
|
+
if(this._callback=i,
|
|
4134
4138
|
// Resets margins and padding
|
|
4135
4139
|
this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,right:0,top:0},void 0===this._select||"svg"!==this._select.node().tagName.toLowerCase()){let t=void 0===this._select?H("body").append("div"):this._select;var n=t.select(".d3plus-viz").size()?t.select(".d3plus-viz"):t.append("svg");this.select(n.node())}
|
|
4136
|
-
/** detects width and height and sets SVG properties */function a(){var t=this._select.style("display"),[n,e]=(this._select.style("display","none"),[pi(n=this._select.node().parentNode,"width"),pi(n,"height")]),n=(n-=parseFloat(this._select.style("border-left-width"),10))-parseFloat(this._select.style("border-right-width"),10),e=(e-=parseFloat(this._select.style("border-top-width"),10))-parseFloat(this._select.style("border-bottom-width"),10);this._select.style("display",t),this._autoWidth&&(this.width(n),this._select.style("width",this._width+"px").attr("width",this._width+"px")),this._autoHeight&&(this.height(e),this._select.style("height",this._height+"px").attr("height",this._height+"px"))}
|
|
4137
4140
|
// Calculates the width and/or height of the Viz based on the this._select, if either has not been defined.
|
|
4138
|
-
this._width&&this._height||this._detectVisible&&!_i(this._select.node())||(this._autoWidth=void 0===this._width,this._autoHeight=void 0===this._height,
|
|
4141
|
+
this._width&&this._height||this._detectVisible&&!_i(this._select.node())||(this._autoWidth=void 0===this._width,this._autoHeight=void 0===this._height,this._setSVGSize()),this._select.attr("class","d3plus-viz").attr("aria-hidden",this._ariaHidden).attr("aria-labelledby",`${this._uuid}-title ${this._uuid}-desc`).attr("role","img").attr("xmlns","http://www.w3.org/2000/svg").attr("xmlns:xlink","http://www.w3.org/1999/xlink").transition().duration(this._duration).style("width",void 0!==this._width?this._width+"px":void 0).style("height",void 0!==this._height?this._height+"px":void 0).attr("width",void 0!==this._width?this._width+"px":void 0).attr("height",void 0!==this._height?this._height+"px":void 0);
|
|
4139
4142
|
// sets "position: relative" on the SVG parent if currently undefined
|
|
4140
4143
|
let t=H(this._select.node().parentNode);"static"===t.style("position")&&t.style("position","relative"),t.style("font-family",ze(this._fontFamily)),
|
|
4141
4144
|
// sets initial opacity to 1, if it has not already been set
|
|
4142
|
-
null===this._select.attr("opacity")&&this._select.attr("opacity",1);var n=this._select.selectAll("title").data([0]),e=n.enter().append("title").attr("id",this._uuid+"-title"),n=(n.merge(e).text(this._svgTitle),this._select.selectAll("desc").data([0])),e=n.enter().append("desc").attr("id",this._uuid+"-desc");if(n.merge(e).text(this._svgDesc),this._visiblePoll=clearInterval(this._visiblePoll),this._resizePoll=clearTimeout(this._resizePoll),this._scrollPoll=clearTimeout(this._scrollPoll),H(this._scrollContainer).on("scroll."+this._uuid,null),
|
|
4145
|
+
null===this._select.attr("opacity")&&this._select.attr("opacity",1);var n=this._select.selectAll("title").data([0]),e=n.enter().append("title").attr("id",this._uuid+"-title"),n=(n.merge(e).text(this._svgTitle),this._select.selectAll("desc").data([0])),e=n.enter().append("desc").attr("id",this._uuid+"-desc");if(n.merge(e).text(this._svgDesc),this._visiblePoll=clearInterval(this._visiblePoll),this._resizePoll=clearTimeout(this._resizePoll),this._scrollPoll=clearTimeout(this._scrollPoll),H(this._scrollContainer).on("scroll."+this._uuid,null),this._detectVisible&&"hidden"===this._select.style("visibility"))this._visiblePoll=setInterval(()=>{"hidden"!==this._select.style("visibility")&&(this._visiblePoll=clearInterval(this._visiblePoll),this.render(i))},this._detectVisibleInterval);else if(this._detectVisible&&"none"===this._select.style("display"))this._visiblePoll=setInterval(()=>{"none"!==this._select.style("display")&&(this._visiblePoll=clearInterval(this._visiblePoll),this.render(i))},this._detectVisibleInterval);else if(this._detectVisible&&!_i(this._select.node()))H(this._scrollContainer).on("scroll."+this._uuid,()=>{this._scrollPoll||(this._scrollPoll=setTimeout(()=>{_i(this._select.node())&&(H(this._scrollContainer).on("scroll."+this._uuid,null),this.render(i)),this._scrollPoll=clearTimeout(this._scrollPoll)},this._detectVisibleInterval))});else{let e=Gd();this._queue.forEach(t=>{var n=this._cache?this._lrucache.get(t[3]+"_"+t[1]):void 0;n?this["_"+t[3]]=t[2]?t[2](n):n:e.defer(...t)}),this._queue=[],this._loadingMessage&&e._tasks.length&&this._messageClass.render({container:this._select.node().parentNode,html:this._loadingHTML(this),mask:!!this._filteredData&&this._messageMask,style:this._messageStyle}),e.awaitAll(()=>{
|
|
4143
4146
|
// creates a data table as DOM elements inside of the SVG for accessibility
|
|
4144
4147
|
// only if this._ariaHidden is set to true
|
|
4145
4148
|
let e=this._data instanceof Array&&0<this._data.length?Object.keys(this._data[0]):[];var t=this._select.selectAll("g.data-table").data(!this._ariaHidden&&this._data instanceof Array&&this._data.length?[0]:[]),n=t.enter().append("g").attr("class","data-table").attr("role","table"),t=(t.exit().remove(),t.merge(n).selectAll("text").data(this._data instanceof Array?jt(0,this._data.length+1):[])),n=(t.exit().remove(),t.merge(t.enter().append("text").attr("role","row")).selectAll("tspan").data((t,n)=>e.map(t=>({role:n?"cell":"columnheader",text:n?this._data[n-1][t]:t}))));n.exit().remove(),n.merge(n.enter().append("tspan")).attr("role",t=>t.role).attr("dy","-1000px").html(t=>t.text),
|
|
4146
4149
|
// finishes the draw cycle
|
|
4147
|
-
this._preDraw(),this._draw(i),yf.bind(this)(),function(){let t=H(this._select.node().parentNode).selectAll("div.d3plus-attribution").data(this._attribution?[0]:[]);var n=t.enter().append("div").attr("class","d3plus-attribution");t.exit().remove(),t=t.merge(n).style("position","absolute").html(this._attribution).style("right",this._margin.right+"px").style("bottom",this._margin.bottom+"px").call(vi,this._attributionStyle)}.bind(this)(),!this._messageClass._isVisible||this._noDataMessage&&!this._filteredData.length||(this._messageClass.hide(),"0"===this._select.attr("opacity")&&this._select.transition().duration(this._duration).attr("opacity",1)),this._detectResize&&(this._autoWidth||this._autoHeight)
|
|
4150
|
+
this._preDraw(),this._draw(i),yf.bind(this)(),function(){let t=H(this._select.node().parentNode).selectAll("div.d3plus-attribution").data(this._attribution?[0]:[]);var n=t.enter().append("div").attr("class","d3plus-attribution");t.exit().remove(),t=t.merge(n).style("position","absolute").html(this._attribution).style("right",this._margin.right+"px").style("bottom",this._margin.bottom+"px").call(vi,this._attributionStyle)}.bind(this)(),!this._messageClass._isVisible||this._noDataMessage&&!this._filteredData.length||(this._messageClass.hide(),"0"===this._select.attr("opacity")&&this._select.transition().duration(this._duration).attr("opacity",1)),this._detectResize&&(this._autoWidth||this._autoHeight)?this._resizeObserver.observe(this._select.node().parentNode):this._resizeObserver.unobserve(this._select.node().parentNode),i&&setTimeout(i,this._duration+100)})}
|
|
4148
4151
|
// Attaches touchstart event listener to the BODY to hide the tooltip when the user touches any element without data
|
|
4149
4152
|
return H("body").on("touchstart."+this._uuid,
|
|
4150
4153
|
/**
|
|
@@ -4437,12 +4440,6 @@ return H("body").on("touchstart."+this._uuid,
|
|
|
4437
4440
|
@param {Boolean} [*value* = true]
|
|
4438
4441
|
@chainable
|
|
4439
4442
|
*/noDataMessage(t){return arguments.length?(this._noDataMessage=t,this):this._noDataMessage}
|
|
4440
|
-
/**
|
|
4441
|
-
@memberof Viz
|
|
4442
|
-
@desc If using resize detection, this method allow a custom override of the element to which the resize detection function gets attached.
|
|
4443
|
-
@param {String|HTMLElement} *selector*
|
|
4444
|
-
@chainable
|
|
4445
|
-
*/resizeContainer(t){return arguments.length?(this._resizeContainer=t,this):this._resizeContainer}
|
|
4446
4443
|
/**
|
|
4447
4444
|
@memberof Viz
|
|
4448
4445
|
@desc If using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.
|
|
@@ -4544,7 +4541,7 @@ return H("body").on("touchstart."+this._uuid,
|
|
|
4544
4541
|
@desc Sets the starting time or range for the timeline. The value provided can either be a single Date/String, or an Array of 2 values representing the min and max.
|
|
4545
4542
|
@param {Date|String|Array} [*value*]
|
|
4546
4543
|
@chainable
|
|
4547
|
-
*/timelineDefault(t){return arguments.length?(t instanceof Array||(t=[t,t]),this._timelineDefault=t.map(
|
|
4544
|
+
*/timelineDefault(t){return arguments.length?(t instanceof Array||(t=[t,t]),this._timelineDefault=t.map(Nt),this):this._timelineDefault}
|
|
4548
4545
|
/**
|
|
4549
4546
|
@memberof Viz
|
|
4550
4547
|
@desc Tells the timeline whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the timeline appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
@@ -4737,7 +4734,7 @@ this._on[t].toString()!==n),l=this._on["click.legend"]&&this._on["click.legend"]
|
|
|
4737
4734
|
this._select.style("cursor",s||l&&h?"pointer":"auto"),this._legendFilterInvert.bind(this)()),h=this._solo.includes(t),u=this._hidden.includes(t);
|
|
4738
4735
|
// does the legend still have our default "click.legend" event?
|
|
4739
4736
|
// (if the user only sets "click", both functions will fire)
|
|
4740
|
-
this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!h||u?i("Click to Highlight"):1===this._solo.length&&h||this._hidden.length===o-1?i("Click to Show All"):i("Click to Highlight")+"<br />"+i("Shift+Click to Hide"):this._solo.length&&!h||u?i("Click to Show")+"<br />"+i("Shift+Click to Highlight"):1===this._solo.length&&h||this._hidden.length===o-1?i("Click to Show All"):i("Click to Hide")+"<br />"+i("Shift+Click to Highlight"))).title(this._legendConfig.label?this._legendClass.label():ff.bind(this)).position(r).config(Lt.bind(this)(this._tooltipConfig)).config(Lt.bind(this)(this._legendTooltip)).render()}}.bind(this)},this._queue=[],this.
|
|
4737
|
+
this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!h||u?i("Click to Highlight"):1===this._solo.length&&h||this._hidden.length===o-1?i("Click to Show All"):i("Click to Highlight")+"<br />"+i("Shift+Click to Hide"):this._solo.length&&!h||u?i("Click to Show")+"<br />"+i("Shift+Click to Highlight"):1===this._solo.length&&h||this._hidden.length===o-1?i("Click to Show All"):i("Click to Hide")+"<br />"+i("Shift+Click to Highlight"))).title(this._legendConfig.label?this._legendClass.label():ff.bind(this)).position(r).config(Lt.bind(this)(this._tooltipConfig)).config(Lt.bind(this)(this._legendTooltip)).render()}}.bind(this)},this._queue=[],this._resizeObserver=new ResizeObserver(((e,i)=>{let a;return function(...t){let n=this;clearTimeout(a),a=setTimeout(()=>e.apply(n,t),i)}})(()=>{this._setSVGSize(),this.render(this._callback)},this._detectResizeDelay)),this._scrollContainer="undefined"==typeof window?"":window,this._shape=Bt("Rect"),this._shapes=[],this._shapeConfig={ariaLabel:(t,n)=>this._drawLabel(t,n),fill:(n,e)=>{for(;n.__d3plus__&&n.data;)e=(n=n.data).i;if(this._colorScale){let t=this._colorScale(n,e);var i,a;if(null!=t)return i=this._colorScaleClass._colorScale,a=this._colorScaleClass.color(),i?i.domain().length?i(t):i.range()[i.range().length-1]:a instanceof Array?a[a.length-1]:a}let t=this._color(n,e);return zn(t)?t:Fh("string"==typeof t?t:JSON.stringify(t),this._colorDefaults)},labelConfig:{fontColor:(t,n)=>Hh("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill)},opacity:Bt(1),stroke:(t,n)=>zn("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill).darker(.25),role:"presentation",strokeWidth:Bt(0)},this._solo=[],this._subtitleClass=new Wc,this._subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},this._subtitlePadding=Mf,this._svgDesc="",this._svgTitle="",this._timeline=!0,this._timelineClass=(new Sg).align("end"),this._timelineConfig={padding:5},this._timelinePadding=Mf,this._threshold=Bt(1e-4),this._thresholdKey=void 0,this._thresholdName=()=>this._translate("Values"),this._titleClass=new Wc,this._titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},this._titlePadding=Mf,this._tooltip=Bt(!0),this._tooltipClass=new Od,this._tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},this._totalClass=new Wc,this._totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},this._totalFormat=t=>this._translate("Total")+": "+qu(t,this._locale),this._totalPadding=Mf,this._zoom=!1,this._zoomBehavior=ef(),this._zoomBrush=xg(ug),this._zoomBrushHandleSize=1,this._zoomBrushHandleStyle={fill:"#444"},this._zoomBrushSelectionStyle={fill:"#777","stroke-width":0},this._zoomControlStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.75)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"900 15px/21px "+ze(Te),height:"20px",margin:"5px",opacity:.75,padding:0,"text-align":"center",width:"20px"},this._zoomControlStyleActive={background:"rgba(0, 0, 0, 0.75)",color:"rgba(255, 255, 255, 0.75)",opacity:1},this._zoomControlStyleHover={cursor:"pointer",opacity:1},this._zoomFactor=2,this._zoomMax=16,this._zoomPadding=20,this._zoomPan=!0,this._zoomScroll=!0}}
|
|
4741
4738
|
/**
|
|
4742
4739
|
@module discreteBuffer
|
|
4743
4740
|
@desc Adds left/right padding to a point or time scale.
|
|
@@ -4752,11 +4749,11 @@ this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!h||u?i("Click
|
|
|
4752
4749
|
@param {Object} [config]
|
|
4753
4750
|
@param {Number} [buffer = 10]
|
|
4754
4751
|
@private
|
|
4755
|
-
*/let Ef=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,t<0),
|
|
4752
|
+
*/let Ef=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,t<0),Nf=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,t<0);
|
|
4756
4753
|
/**
|
|
4757
4754
|
@module numericBuffer
|
|
4758
4755
|
@private
|
|
4759
|
-
*/function
|
|
4756
|
+
*/function Pf(r,o,s,l,t,n,h,u){if(void 0===s||isNaN(n[0])||isNaN(n[1]))return n;if(u&&(n=n.slice().reverse(),t=t.slice().reverse()),n[0]===n[1])n=n.slice(),"log"===o?(n=[Ef(n[0]),Nf(n[0])])[1]<n[0]&&n.reverse():(t=Math.abs(parseFloat(n[0].toPrecision(1).replace(/[0-9]{1}$/,"1"))),n[0]-=t,n[1]+=t),r.domain(u?n.slice().reverse():n);else{var e=n[0]===n[1]?10:Math.abs(Math.log(n[1]-n[0])/100),i=()=>{let e=r.copy(),i=!1;if("log"===o){let t=r.domain().slice(),n=r.range().slice();u&&(t=t.reverse(),n=n.reverse()),(i=t[0]*t[1]<0)&&(a=(a=er().domain([1e-6,Math.abs(t[h])]).range([0,1])(Math.abs(t[h?0:1])))/(a+1)*(n[1]-n[0]),t=(0===h?[t[0],1e-6]:[1e-6,t[1]]).map(Math.abs),n=0===h?[n[0],n[0]+a]:[n[0]+a,n[1]]),e=er().domain(t).range(n)}let t=!1;var a=e.range();let n;return n="log"===o&&i?e(Math.abs(s)):e(s),u?0===h?t=n+l>a[h]:1===h&&(t=n-l<a[h]):0===h?t=n-l<a[h]:1===h&&(t=n+l>a[h]),t};if(r.invert&&i())if("log"===o){let t=0;for(;t<10&&i();){var a=(0===h?-1:1)*(n[h]<0?-1:1);n[h]+=n[h]*e*a,r.domain(u?n.slice().reverse():n),t++}}else 0===h?(t=r.invert(r(s)+(l+10)*(u?1:-1)))<n[h]&&(n[h]=t,r.domain(u?n.slice().reverse():n)):1===h&&(t=r.invert(r(s)+(l+10)*(u?-1:1)))>n[h]&&(n[h]=t,r.domain(u?n.slice().reverse():n))}return u?n.reverse():n}
|
|
4760
4757
|
/**
|
|
4761
4758
|
@module circleBuffer
|
|
4762
4759
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -4776,7 +4773,7 @@ this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!h||u?i("Click
|
|
|
4776
4773
|
@param {Object} [config]
|
|
4777
4774
|
@param {Number} [buffer = 10]
|
|
4778
4775
|
@private
|
|
4779
|
-
*/,Box:function({data:t,x:n,y:e,x2:i,y2:a,buffer:r=10}){let o=i?"x2":"x",s=a?"y2":"y",l=(i="x"===this._discrete?e:n,a=i.domain().slice(),"x"===this._discrete);l&&a.reverse();let h,u;h=this._stacked?(c=ca().key(t=>t[this._discrete]).entries(t).map(t=>t.values.map(t=>t[l?s:o])),u=c.map(t=>sa(t.filter(t=>0<t))),c.map(t=>sa(t.filter(t=>t<0)))):u=t.map(t=>t[l?s:o]);var c=i(Ot(u)),t=(c+=l?-r:r,c=i.invert(c),i(Dt(h)));return t+=l?r:-r,t=i.invert(t),c>a[1]&&(a[1]=c),t<a[0]&&(a[0]=t),l&&a.reverse(),i.domain(a),[n,e]},Circle:function({data:t,x:e,y:i,x2:n,y2:a,yScale:r,xScale:o,config:s,buffer:l}){e=e.copy(),i=i.copy();let h=n?"x2":"x",u=a?"y2":"y",c=e.domain().slice(),g=i.domain().slice(),d=e.range(),f=i.range();return!e.invert&&e.padding&&Tf(e,t,this._discrete),!i.invert&&i.padding&&Tf(i,t,this._discrete),(e.invert||i.invert)&&t.forEach(t=>{var n=l||2*s.r(t.data,t.i);e.invert&&(c=
|
|
4776
|
+
*/,Box:function({data:t,x:n,y:e,x2:i,y2:a,buffer:r=10}){let o=i?"x2":"x",s=a?"y2":"y",l=(i="x"===this._discrete?e:n,a=i.domain().slice(),"x"===this._discrete);l&&a.reverse();let h,u;h=this._stacked?(c=ca().key(t=>t[this._discrete]).entries(t).map(t=>t.values.map(t=>t[l?s:o])),u=c.map(t=>sa(t.filter(t=>0<t))),c.map(t=>sa(t.filter(t=>t<0)))):u=t.map(t=>t[l?s:o]);var c=i(Ot(u)),t=(c+=l?-r:r,c=i.invert(c),i(Dt(h)));return t+=l?r:-r,t=i.invert(t),c>a[1]&&(a[1]=c),t<a[0]&&(a[0]=t),l&&a.reverse(),i.domain(a),[n,e]},Circle:function({data:t,x:e,y:i,x2:n,y2:a,yScale:r,xScale:o,config:s,buffer:l}){e=e.copy(),i=i.copy();let h=n?"x2":"x",u=a?"y2":"y",c=e.domain().slice(),g=i.domain().slice(),d=e.range(),f=i.range();return!e.invert&&e.padding&&Tf(e,t,this._discrete),!i.invert&&i.padding&&Tf(i,t,this._discrete),(e.invert||i.invert)&&t.forEach(t=>{var n=l||2*s.r(t.data,t.i);e.invert&&(c=Pf(e,o,t[h],n,d,c,0,!1),c=Pf(e,o,t[h],n,d,c,1,!1)),i.invert&&(g=Pf(i,r,t[u],n,f,g,0,!0),g=Pf(i,r,t[u],n,f,g,1,!0))}),[e,i]}
|
|
4780
4777
|
/**
|
|
4781
4778
|
@module lineBuffer
|
|
4782
4779
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -4796,7 +4793,7 @@ this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!h||u?i("Click
|
|
|
4796
4793
|
@param {Object} [config]
|
|
4797
4794
|
@param {Number} [buffer] Defaults to the width/height of the largest Rect.
|
|
4798
4795
|
@private
|
|
4799
|
-
*/,Rect:function({data:t,x:e,y:i,x2:n,y2:a,yScale:r,xScale:o,config:s}){e=e.copy(),i=i.copy();let l=n?"x2":"x",h=a?"y2":"y",u=e.domain().slice(),c=i.domain().slice(),g=e.range(),d=i.range();return!e.invert&&e.padding&&Tf(e,t,this._discrete),!i.invert&&i.padding&&Tf(i,t,this._discrete),(e.invert||i.invert)&&t.forEach(t=>{var n;e.invert&&(n=s.width(t.data,t.i),u=
|
|
4796
|
+
*/,Rect:function({data:t,x:e,y:i,x2:n,y2:a,yScale:r,xScale:o,config:s}){e=e.copy(),i=i.copy();let l=n?"x2":"x",h=a?"y2":"y",u=e.domain().slice(),c=i.domain().slice(),g=e.range(),d=i.range();return!e.invert&&e.padding&&Tf(e,t,this._discrete),!i.invert&&i.padding&&Tf(i,t,this._discrete),(e.invert||i.invert)&&t.forEach(t=>{var n;e.invert&&(n=s.width(t.data,t.i),u=Pf(e,o,t[l],n,g,u,0,!1),u=Pf(e,o,t[l],n,g,u,1,!1)),i.invert&&(n=s.height(t.data,t.i),c=Pf(i,r,t[h],n,d,c,0,!0),c=Pf(i,r,t[h],n,d,c,1,!0))}),[e,i]}};
|
|
4800
4797
|
/**
|
|
4801
4798
|
@desc Logic for determining default sizes of shapes using the sizeScaleD3 internal function.
|
|
4802
4799
|
@private
|
|
@@ -4841,19 +4838,19 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
4841
4838
|
Extends the draw behavior of the abstract Viz class.
|
|
4842
4839
|
@private
|
|
4843
4840
|
*/_draw(ot){if(this._filteredData.length||this._annotations.length){
|
|
4844
|
-
/* Determines whether or not any of the x or y axes are a "time" axis. */var st=!!this._time&&this._time(this._filteredData[0],0);let i=this._x2Time=st&&this._x2(this._filteredData[0],0)===st,a=this._xTime=st&&this._x(this._filteredData[0],0)===st,D=this._y2Time=st&&this._y2(this._filteredData[0],0)===st,j=this._yTime=st&&this._y(this._filteredData[0],0)===st,R=a||i||j||D,I=(t,n)=>`${!R&&this._time?this._time(t,n):"time"}_`+(this._stacked?""+(1<this._groupBy.length?this._ids(t,n).slice(0,-1).join("_"):"group"):""+this._ids(t,n).join("_"));var st=(t,n)=>{t={__d3plus__:!0,data:t,group:I(t,n),i:n,hci:this._confidence&&this._confidence[1]&&this._confidence[1](t,n),id:this._ids(t,n).slice(0,this._drawDepth+1).join("_"),lci:this._confidence&&this._confidence[0]&&this._confidence[0](t,n),shape:this._shape(t,n),x:a?
|
|
4841
|
+
/* Determines whether or not any of the x or y axes are a "time" axis. */var st=!!this._time&&this._time(this._filteredData[0],0);let i=this._x2Time=st&&this._x2(this._filteredData[0],0)===st,a=this._xTime=st&&this._x(this._filteredData[0],0)===st,D=this._y2Time=st&&this._y2(this._filteredData[0],0)===st,j=this._yTime=st&&this._y(this._filteredData[0],0)===st,R=a||i||j||D,I=(t,n)=>`${!R&&this._time?this._time(t,n):"time"}_`+(this._stacked?""+(1<this._groupBy.length?this._ids(t,n).slice(0,-1).join("_"):"group"):""+this._ids(t,n).join("_"));var st=(t,n)=>{t={__d3plus__:!0,data:t,group:I(t,n),i:n,hci:this._confidence&&this._confidence[1]&&this._confidence[1](t,n),id:this._ids(t,n).slice(0,this._drawDepth+1).join("_"),lci:this._confidence&&this._confidence[0]&&this._confidence[0](t,n),shape:this._shape(t,n),x:a?Nt(this._x(t,n)):this._x(t,n),x2:i?Nt(this._x2(t,n)):this._x2(t,n),y:j?Nt(this._y(t,n)):this._y(t,n),y2:D?Nt(this._y2(t,n)):this._y2(t,n)};return t.discrete="Bar"===t.shape?t[this._discrete]+"_"+t.group:""+t[this._discrete],t.id="Bar"===t.shape?t.id+"_"+t[this._discrete]:t.id,t};let o=this._formattedData=this._filteredData.map(st),s=this._axisPersist?this._data.map(st):o;this._size?(st=Hi(s,t=>this._size(t.data)),this._sizeScaleD3=Ts["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(st).range([st[0]===st[1]?this._sizeMax:Dt([this._sizeMax/2,this._sizeMin]),this._sizeMax])):this._sizeScaleD3=()=>this._sizeMin;var st=s.some(t=>void 0!==t.x2),lt=s.some(t=>void 0!==t.y2);let t=this._height-this._margin.top-this._margin.bottom,d=this._discrete?"x"===this._discrete?"y":"x":void 0,F=this._discrete?"x"===this._discrete?"y2":"x2":void 0,H=[d,F].filter(t=>t),n=this._select,e=this._transition,v=this._width-this._margin.left-this._margin.right;
|
|
4845
4842
|
/**
|
|
4846
4843
|
* @desc Returns all unique values for a given axis.
|
|
4847
4844
|
* @param {String} axis
|
|
4848
4845
|
* @returns {Array}
|
|
4849
4846
|
* @private
|
|
4850
|
-
*/var ht=zt.bind(this)("x"),ut=zt.bind(this)("x2"),ct=zt.bind(this)("y"),gt=zt.bind(this)("y2");let G,f,p,_;if(this._stacked){var dt=s.filter(t=>["Area","Bar"].includes(t.shape));let a=ca().key(t=>t.group).entries(dt).reduce((t,n)=>(t[n.key]||(t[n.key]=0),t[n.key]+=sa(n.values,t=>t[d]),t),{}),e=(s.sort((t,n)=>{var e,i;return this[`_${this._discrete}Sort`]?this[`_${this._discrete}Sort`](t.data,n.data):(e=t[this._discrete])-(i=n[this._discrete])!=0?e-i:t.group!==n.group?a[n.group]-a[t.group]:n[d]-t[d]}),G=Array.from(new Set(s.map(t=>t.discrete))),_=Array.from(new Set(s.map(t=>t.id))),(p=ca().key(t=>t.discrete).entries(s).map(t=>t.values)).forEach(i=>{let a=Array.from(new Set(i.map(t=>t.id)));a.length<_.length&&_.forEach(n=>{var t,e;a.includes(n)||"Area"===(t=s.filter(t=>t.id===n)[0]).shape&&(e=I(t.data,t.i),e={__d3plus__:!0,data:t.data,discrete:"Bar"===t.shape?i[0][this._discrete]+"_"+e:""+i[0][this._discrete],group:e,id:t.id,ids:n,shape:t.shape,[this._discrete]:i[0][this._discrete],[d]:0},o.push(e))})}),this[`_${this._discrete}Sort`]?o.sort((t,n)=>this[`_${this._discrete}Sort`](t.data,n.data)):o.sort((t,n)=>t[this._discrete]-n[this._discrete]),this._stackOrder);e instanceof Array?_.sort((t,n)=>e.indexOf(t)-e.indexOf(n)):e===zh&&_.sort((t,n)=>t.localeCompare(n)),p=
|
|
4847
|
+
*/var ht=zt.bind(this)("x"),ut=zt.bind(this)("x2"),ct=zt.bind(this)("y"),gt=zt.bind(this)("y2");let G,f,p,_;if(this._stacked){var dt=s.filter(t=>["Area","Bar"].includes(t.shape));let a=ca().key(t=>t.group).entries(dt).reduce((t,n)=>(t[n.key]||(t[n.key]=0),t[n.key]+=sa(n.values,t=>t[d]),t),{}),e=(s.sort((t,n)=>{var e,i;return this[`_${this._discrete}Sort`]?this[`_${this._discrete}Sort`](t.data,n.data):(e=t[this._discrete])-(i=n[this._discrete])!=0?e-i:t.group!==n.group?a[n.group]-a[t.group]:n[d]-t[d]}),G=Array.from(new Set(s.map(t=>t.discrete))),_=Array.from(new Set(s.map(t=>t.id))),(p=ca().key(t=>t.discrete).entries(s).map(t=>t.values)).forEach(i=>{let a=Array.from(new Set(i.map(t=>t.id)));a.length<_.length&&_.forEach(n=>{var t,e;a.includes(n)||"Area"===(t=s.filter(t=>t.id===n)[0]).shape&&(e=I(t.data,t.i),e={__d3plus__:!0,data:t.data,discrete:"Bar"===t.shape?i[0][this._discrete]+"_"+e:""+i[0][this._discrete],group:e,id:t.id,ids:n,shape:t.shape,[this._discrete]:i[0][this._discrete],[d]:0},o.push(e))})}),this[`_${this._discrete}Sort`]?o.sort((t,n)=>this[`_${this._discrete}Sort`](t.data,n.data)):o.sort((t,n)=>t[this._discrete]-n[this._discrete]),this._stackOrder);e instanceof Array?_.sort((t,n)=>e.indexOf(t)-e.indexOf(n)):e===zh&&_.sort((t,n)=>t.localeCompare(n)),p=Nh().keys(_).offset(this._stackOffset).order(e instanceof Array?zh:e).value((t,n)=>{t=t.filter(t=>t.id===n);return t.length?t[0][d]:0})(p);dt="x"===this._discrete?ht:ct;f={[this._discrete]:this[`_${this._discrete}Time`]?Hi(dt):dt,[d]:[Dt(p.map(t=>Dt(t.map(t=>t[0])))),Ot(p.map(t=>Ot(t.map(t=>t[1]))))]}}else{let e=this._discrete||"x";this[`_${this._discrete}Sort`]?s.sort((t,n)=>this[`_${this._discrete}Sort`](t.data,n.data)):s.sort((t,n)=>t[e]-n[e]),f={x:!a&&"x"===this._discrete||this._xSort?ht:Hi(ht),x2:!i&&"x"===this._discrete||this._x2Sort?ut:Hi(ut),y:!j&&"y"===this._discrete||this._ySort?ct:Hi(ct),y2:!D&&"y"===this._discrete||this._y2Sort?gt:Hi(gt)}}
|
|
4851
4848
|
/**
|
|
4852
4849
|
* Determins default scale type and domain for a given axis.
|
|
4853
4850
|
* @param {String} axis
|
|
4854
4851
|
* @private
|
|
4855
|
-
*/let[K,m,U,W]=Tt.bind(this)("x"),[q,y,$,V]=Tt.bind(this)("y");dt=(n,t)=>{var e,i=this[`_${n}Config`].scale;return"auto"===i?this._discrete===n?t:3<Fi(e=s.map(t=>t[n]))/ra(e)?"log":"linear":i||t};let r=this._yConfigScale=dt("y",y).toLowerCase(),l=this._y2ConfigScale=dt("y2",V).toLowerCase(),h=this._xConfigScale=dt("x",m).toLowerCase(),u=this._x2ConfigScale=dt("x2",W).toLowerCase(),b=(f={x:K,x2:U||K,y:q,y2:$||q},Object.keys(f).forEach(n=>{"log"===this[`_${n}ConfigScale`]&&f[n].includes(0)&&(Dt(f[n])<0?f[n][1]=Ot(o.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))):f[n][0]=Dt(s.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))))}),H.forEach(t=>{var n;this[`_${t}Config`].domain?(n=this[`_${t}Config`].domain,"x"===this._discrete&&n.reverse(),f[t]=n):t&&void 0!==this._baseline&&(n=this._baseline,f[t]&&f[t][0]>n?f[t][0]=n:f[t]&&f[t][1]<n&&(f[t][1]=n))}),Ts["scale"+m]().domain(f.x).range(jt(0,1+v,v/(f.x.length-1)))),Y=Ts["scale"+W]().domain(f.x2).range(jt(0,1+v,v/(f.x2.length-1))),x=Ts["scale"+y]().domain(f.y.reverse()).range(jt(0,1+t,t/(f.y.length-1))),X=Ts["scale"+V]().domain(f.y2.reverse()).range(jt(0,1+t,t/(f.y2.length-1)));dt=ca().key(t=>t.shape).entries(o).sort((t,n)=>this._shapeSort(t.key,n.key));"Point"!==("x"===this._discrete?y:m)&&ca().key(t=>t.shape).entries(s).forEach(t=>{var n;["Bar","Box"].includes(t.key)&&Tf("x"===this._discrete?b:x,o,this._discrete),this._buffer[t.key]&&(n=this._buffer[t.key].bind(this)({data:t.values,x:b,y:x,yScale:r,xScale:h,config:this._shapeConfig[t.key]}),b=n[0],x=n[1],n=this._buffer[t.key].bind(this)({data:t.values,x:Y,y:X,yScale:l,xScale:u,x2:!0,y2:!0,config:this._shapeConfig[t.key]}),Y=n[0],X=n[1])});let w=b.domain(),Z=Y.domain(),S=x.domain(),c=X.domain();var ft={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},ut=st?{data:ut}:ft,gt=lt?{data:gt}:ft,ft=("x"!==this._discrete||this._width>this._discreteCutoff)&&this._width>this._xCutoff,pt=("y"!==this._discrete||this._height>this._discreteCutoff)&&this._height>this._yCutoff,ct={data:ct,locale:this._locale,rounding:this._yDomain?"none":"outside",scalePadding:x.padding?x.padding():0},_t=(!ft&&pt&&(ct.barConfig={stroke:"transparent"},ct.tickSize=0,ct.shapeConfig={labelBounds:(t,n)=>{var{width:t,y:e}=t.labelBounds,i=this._height/2;return{x:n?-i:0,y:e,width:t,height:i}},labelConfig:{padding:0,rotate:0},labelRotation:!1}),
|
|
4856
|
-
/** */function t(e,i,a){if(e.defaultY||(e.defaultY=this._yAxis._getPosition(e.value)),i){var r=a[i-1],{fontSize:o,padding:s}=e,l=e.newY||e.defaultY;let n=r.newY||r.defaultY;l-o/2-s<n&&(l=h.find(t=>t<n),e.defaultY-l<u)&&(r.newY=l,i)&&t(r,i-1,a)}}.bind(this))}),et=z.reduce((t,n)=>(n.newY&&(t[n.id]=n.newY),t),{})),this._yFunc=x=(t,n)=>"y2"===n?("log"===l&&0===t&&(t=c[1]<0?this._y2Axis._d3ScaleNegative.domain()[0]:this._y2Axis._d3Scale.domain()[1]),this._y2Axis._getPosition.bind(this._y2Axis)(t)-T):("log"===r&&0===t&&(t=S[1]<0?this._yAxis._d3ScaleNegative.domain()[0]:this._yAxis._d3Scale.domain()[1]),this._yAxis._getPosition.bind(this._yAxis)(t)-T),this._xAxis.barConfig()["stroke-width"]);
|
|
4852
|
+
*/let[K,m,U,W]=Tt.bind(this)("x"),[q,y,$,V]=Tt.bind(this)("y");dt=(n,t)=>{var e,i=this[`_${n}Config`].scale;return"auto"===i?this._discrete===n?t:3<Fi(e=s.map(t=>t[n]))/ra(e)?"log":"linear":i||t};let r=this._yConfigScale=dt("y",y).toLowerCase(),l=this._y2ConfigScale=dt("y2",V).toLowerCase(),h=this._xConfigScale=dt("x",m).toLowerCase(),u=this._x2ConfigScale=dt("x2",W).toLowerCase(),b=(f={x:K,x2:U||K,y:q,y2:$||q},Object.keys(f).forEach(n=>{"log"===this[`_${n}ConfigScale`]&&f[n].includes(0)&&(Dt(f[n])<0?f[n][1]=Ot(o.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))):f[n][0]=Dt(s.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))))}),H.forEach(t=>{var n;this[`_${t}Config`].domain?(n=this[`_${t}Config`].domain,"x"===this._discrete&&n.reverse(),f[t]=n):t&&void 0!==this._baseline&&(n=this._baseline,f[t]&&f[t][0]>n?f[t][0]=n:f[t]&&f[t][1]<n&&(f[t][1]=n))}),Ts["scale"+m]().domain(f.x).range(jt(0,1+v,v/(f.x.length-1)))),Y=Ts["scale"+W]().domain(f.x2).range(jt(0,1+v,v/(f.x2.length-1))),x=Ts["scale"+y]().domain(f.y.reverse()).range(jt(0,1+t,t/(f.y.length-1))),X=Ts["scale"+V]().domain(f.y2.reverse()).range(jt(0,1+t,t/(f.y2.length-1)));dt=ca().key(t=>t.shape).entries(o).sort((t,n)=>this._shapeSort(t.key,n.key));"Point"!==("x"===this._discrete?y:m)&&ca().key(t=>t.shape).entries(s).forEach(t=>{var n;["Bar","Box"].includes(t.key)&&Tf("x"===this._discrete?b:x,o,this._discrete),this._buffer[t.key]&&(n=this._buffer[t.key].bind(this)({data:t.values,x:b,y:x,yScale:r,xScale:h,config:this._shapeConfig[t.key]}),b=n[0],x=n[1],n=this._buffer[t.key].bind(this)({data:t.values,x:Y,y:X,yScale:l,xScale:u,x2:!0,y2:!0,config:this._shapeConfig[t.key]}),Y=n[0],X=n[1])});let w=b.domain(),Z=Y.domain(),S=x.domain(),c=X.domain();var ft={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},ut=st?{data:ut}:ft,gt=lt?{data:gt}:ft,ft=("x"!==this._discrete||this._width>this._discreteCutoff)&&this._width>this._xCutoff,pt=("y"!==this._discrete||this._height>this._discreteCutoff)&&this._height>this._yCutoff,ct={data:ct,locale:this._locale,rounding:this._yDomain?"none":"outside",scalePadding:x.padding?x.padding():0},_t=(!ft&&pt&&(ct.barConfig={stroke:"transparent"},ct.tickSize=0,ct.shapeConfig={labelBounds:(t,n)=>{var{width:t,y:e}=t.labelBounds,i=this._height/2;return{x:n?-i:0,y:e,width:t,height:i}},labelConfig:{padding:0,rotate:0},labelRotation:!1}),Pt("g.d3plus-plot-test",{enter:{opacity:0},parent:this._select})),mt=Lt.bind(this)(this._shapeConfig,"shape","Bar");let J=void 0!==mt.label?"function"==typeof mt.label?mt.label:Bt(mt.label):this._drawLabel,g=s.map(t=>J(t.data,t.i)).filter(t=>"number"==typeof t||t).map(String),k=pu(s.map(t=>t.x2)),C=(k="Point"===W&&k.every(t=>g.includes(""+t))?[]:null,pu(s.map(t=>t.x))),Q=(C="Point"===m&&C.every(t=>g.includes(""+t))?[]:null,pu(s.map(t=>t.y2))),M=(Q="Point"===V&&Q.every(t=>g.includes(""+t))?[]:null,pu(s.map(t=>t.y)));M="Point"===y&&M.every(t=>g.includes(""+t))?[]:null,pt&&this._yTest.domain(S).height(t).maxSize(v/2).range([void 0,void 0]).select(_t.node()).ticks(M).width(v).config(ct).config(this._yConfig).scale(r).render();var mt=this._yTest.outerBounds(),yt=mt.width?mt.width+this._yTest.padding():void 0,vt=(lt&&this._y2Test.domain(c).height(t).range([void 0,void 0]).select(_t.node()).ticks(Q).width(v).config(ct).config(gt).config(this._y2Config).scale(l).render(),this._y2Test.outerBounds()),bt=vt.width?vt.width+this._y2Test.padding():void 0,ht={data:ht,locale:this._locale,rounding:this._xDomain?"none":"outside",scalePadding:b.padding?b.padding():0};!pt&&ft&&(ht.barConfig={stroke:"transparent"},ht.tickSize=0,ht.shapeConfig={labelBounds:(t,n)=>{var{height:t,y:e}=t.labelBounds,i=this._width/2;return{x:n?-i:0,y:e,width:i,height:t}},labelConfig:{padding:0,rotate:0,textAnchor:t=>C&&t.id===C[0]?"start":"end"},labelRotation:!1});let A=void 0;ft&&this._xTest.domain(w).height(t).maxSize(t/2).range([void 0,A]).select(_t.node()).ticks(C).width(v).config(ht).config(this._xConfig).scale(h).render();let tt,z=[],nt=this._lineLabels&&!lt;if(nt){var xt=o.filter(t=>"Line"===t.shape&&("function"!=typeof this._lineLabels||this._lineLabels(t.data,t.i))),xt=ca().key(t=>t.id).entries(xt);if(xt.length){var wt=Lt.bind(this)(this._shapeConfig,"shape","Line"),St=(Bf.config(wt),Bf.labelConfig());let c=void 0!==St.fontColor?St.fontColor:Of.fontColor(),g=void 0!==St.fontSize?St.fontSize:Of.fontSize(),d=void 0!==St.fontWeight?St.fontWeight:Of.fontWeight(),f=void 0!==St.fontFamily?St.fontFamily:Of.fontFamily(),p=void 0!==St.padding?St.padding:Of.padding(),_=wt.label||this._drawLabel,m=t=>("log"===h&&0===t&&(t=w[0]<0?this._xTest._d3Scale.domain()[1]:this._xTest._d3Scale.domain()[0]),this._xTest._getPosition.bind(this._xTest)(t)),y=t=>("log"===r&&0===t&&(t=S[0]<0?this._yTest._d3Scale.domain()[1]:this._yTest._d3Scale.domain()[0]),this._yTest._getPosition.bind(this._yTest)(t)),n=(z=xt.map(t=>{let n=t.values[t.values.length-1],e;for(;n.__d3plus__&&n.data;)n=n.data,e=n.i;var i="function"==typeof _?_(n,e):_,a="function"==typeof c?c(n,e):c,r="function"==typeof g?g(n,e):g,o="function"==typeof d?d(n,e):d;let s="function"==typeof f?f(n,e):f;s instanceof Array&&(s=s.map(t=>`'${t}'`).join(", "));var l="function"==typeof p?p(n,e):p,i=Ae(i,{"font-size":r,"font-family":s,"font-weight":o}),o=t.values.map(t=>[m(t.x),y(t.y)]);let h=Ot(t.values.map(t=>m(t.x)));var u=t.values.find(t=>m(t.x)===h).y;return{id:t.key,labelWidth:i+2*l,spaceNeeded:i+4*l,value:u,yEstimate:y(u),padding:l,fontSize:r,fontColor:a,maxX:h,xValue:Ot(t.values,t=>t.x),coords:o}}).sort((t,n)=>S[1]>S[0]?t.value-n.value:n.value-t.value).filter((t,n,e)=>{let{fontSize:i,id:a,labelWidth:r,maxX:o,yEstimate:s}=t;return 0===e.filter(n=>n.id!==a&&n.coords.some(t=>(t[0]>o||t[0]===o&&n.maxX!==o)&&t[0]<=o+r&&t[1]<=s+.75*i&&t[1]>=s-.75*i)).length}),Ot(z,t=>t.maxX));tt=Ot(z.map(t=>t.labelWidth));St=n===this._xTest._getRange.bind(this._xTest)()[1]?Ot(z.filter(t=>t.maxX===n),t=>t.spaceNeeded):0;St&&(wt=Dt([St,v/4]),A=v-wt-this._margin.right)}}ft&&A&&this._xTest.domain(w).height(t).maxSize(t/2).range([void 0,A]).select(_t.node()).ticks(C).width(v).config(ht).config(this._xConfig).scale(h).render(),st&&this._x2Test.domain(Z).height(t).range([void 0,A]).select(_t.node()).ticks(k).width(v).config(ht).tickSize(0).config(ut).config(this._x2Config).scale(u).render();xt=this._xTest._getRange(),St=this._x2Test._getRange(),wt=this._x2Test.outerBounds();let T=st?wt.height+this._x2Test.padding():0;var wt=Ot([yt,xt[0],St[0]]),kt=(ft&&this._xTest.range([wt,void 0]).render(),pt?this._yTest.shapeConfig().labelConfig.fontSize()/2:0),Ct=Ot([bt,v-xt[1],v-St[1]]),Mt=this._xTest.outerBounds().height+(pt?this._xTest.padding():0),ot=(this._padding.left+=wt,this._padding.right+=Ct,this._padding.bottom+=Mt,this._padding.top+=T+kt,super._draw(ot),this._margin.left+this._margin.right),At=this._margin.top+this._margin.bottom;let E=[T,t-(Mt+kt+At)],N=(pt&&this._yTest.domain(S).height(t).maxSize(v/2).range(E).select(_t.node()).ticks(M).width(v).config(ct).config(this._yConfig).scale(r).render(),wt=Ot([yt=(mt=this._yTest.outerBounds()).width?mt.width+this._yTest.padding():void 0,xt[0],St[0]]),lt&&this._y2Test.config(ct).domain(c).gridSize(0).height(t).range(E).select(_t.node()).width(v-Ot([0,Ct-bt])).title(!1).config(this._y2Config).config(gt).scale(l).render(),Ct=Ot([0,bt=(vt=this._y2Test.outerBounds()).width?vt.width+this._y2Test.padding():void 0,v-xt[1],v-St[1]]),[wt,v-(Ct+ot)]);mt=Pt("g.d3plus-plot-background",{parent:n,transition:e}),_t=`translate(${this._margin.left}, ${this._margin.top+T+kt})`,vt=`translate(${this._margin.left}, ${this._margin.top+kt})`,xt=Pt("g.d3plus-plot-x-axis",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t,opacity:ft?1:0}}),St=st&&Pt("g.d3plus-plot-x2-axis",{parent:n,transition:e,enter:{transform:vt},update:{transform:vt}}),ot=`translate(${this._margin.left+(yt<wt?wt-yt:0)}, ${this._margin.top+kt})`,ft=Pt("g.d3plus-plot-y-axis",{parent:n,transition:e,enter:{transform:ot},update:{transform:ot,opacity:pt?1:0}}),vt=`translate(-${this._margin.right}, ${this._margin.top+kt})`,wt=lt&&Pt("g.d3plus-plot-y2-axis",{parent:n,transition:e,enter:{transform:vt},update:{transform:vt}});this._xAxis.domain(w).height(t-(T+kt+At)).maxSize(t/2).range(N).select(xt.node()).ticks(C).width(v).config(ht).config(this._xConfig).scale(h).render(),st&&this._x2Axis.domain(Z).height(t-(Mt+kt+At)).range(N).select(St.node()).ticks(k).width(v).config(ht).config(ut).config(this._x2Config).scale(u).render(),this._xFunc=b=(t,n)=>("x2"===n?("log"===u&&0===t&&(t=Z[0]<0?this._x2Axis._d3Scale.domain()[1]:this._x2Axis._d3Scale.domain()[0]),this._x2Axis._getPosition.bind(this._x2Axis)):("log"===h&&0===t&&(t=w[0]<0?this._xAxis._d3Scale.domain()[1]:this._xAxis._d3Scale.domain()[0]),this._xAxis._getPosition.bind(this._xAxis)))(t),E=[this._xAxis.outerBounds().y+T,t-(Mt+kt+At)],this._yAxis.domain(S).height(t).maxSize(v/2).range(E).select(ft.node()).ticks(M).width(N[N.length-1]).config(ct).config(this._yConfig).scale(r).render(),lt&&this._y2Axis.config(ct).domain(lt?c:S).gridSize(0).height(t).range(E).select(wt.node()).width(v-Ot([0,Ct-bt])).title(!1).config(this._y2Config).config(gt).scale(l).render();let et={},P=(z&&(ca().key(t=>t.xValue).entries(z).forEach(({values:t})=>{var n=Ot(t.map(t=>t.fontSize));let h=jt(E[0],E[1],n).reverse(),u=(E[1]-E[0])/8;t.forEach(
|
|
4853
|
+
/** */function t(e,i,a){if(e.defaultY||(e.defaultY=this._yAxis._getPosition(e.value)),i){var r=a[i-1],{fontSize:o,padding:s}=e,l=e.newY||e.defaultY;let n=r.newY||r.defaultY;l-o/2-s<n&&(l=h.find(t=>t<n),e.defaultY-l<u)&&(r.newY=l,i)&&t(r,i-1,a)}}.bind(this))}),et=z.reduce((t,n)=>(n.newY&&(t[n.id]=n.newY),t),{})),this._yFunc=x=(t,n)=>"y2"===n?("log"===l&&0===t&&(t=c[1]<0?this._y2Axis._d3ScaleNegative.domain()[0]:this._y2Axis._d3Scale.domain()[1]),this._y2Axis._getPosition.bind(this._y2Axis)(t)-T):("log"===r&&0===t&&(t=S[1]<0?this._yAxis._d3ScaleNegative.domain()[0]:this._yAxis._d3Scale.domain()[1]),this._yAxis._getPosition.bind(this._yAxis)(t)-T),this._xAxis.barConfig()["stroke-width"]);P&&(P/=2),(new wc).data([{}]).select(mt.node()).x(N[0]+(N[1]-N[0])/2).width(N[1]-N[0]).y(this._margin.top+kt+E[0]+(E[1]-E[0])/2).height(E[1]-E[0]).config(this._backgroundConfig).render();yt=z.filter(t=>void 0!==t.newY);if(yt.length){ot=Pt("g.d3plus-plot-connectors",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let t=yt.map(t=>Et({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue),y:t.defaultY},t)).concat(yt.map(t=>Et({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t)));(new Sc).config({data:t,stroke:t=>t.fontColor,x:t=>t.x,y:t=>t.y}).config(this._labelConnectorConfig).select(ot).render()}let it=Pt("g.d3plus-plot-annotations",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();pt=Pt("g.d3plus-plot-shapes",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let at=Pt("g.d3plus-plot-annotations-front",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node(),L=(Object.keys(this._previousAnnotations).forEach(n=>{let e="front"===n?at:it;var t=this._annotations.filter(t=>"back"===n&&!t.layer||t.layer===n);let i=t.map(t=>t.shape);t.forEach(t=>{(new Tc[t.shape]).duration(this._duration).config(t).config({x:t=>t.x2?b(t.x2,"x2"):b(t.x),x0:"x"===this._discrete?t=>t.x2?b(t.x2,"x2"):b(t.x):b(f.x[0]),x1:"x"===this._discrete?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>t.y2?x(t.y2,"y2"):x(t.y),y0:"y"===this._discrete?t=>t.y2?x(t.y2,"y2"):x(t.y):x(f.y[1])-P,y1:"y"===this._discrete?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-P}).select(e).render()}),this._previousAnnotations[n].filter(t=>!i.includes(t)).forEach(t=>{(new Tc[t]).data([]).select(e).render()}),this._previousAnnotations[n]=i}),this._discrete||"x"),B={discrete:this._discrete,duration:this._duration,label:t=>this._drawLabel(t.data,t.i),select:pt,x:t=>void 0!==t.x2?b(t.x2,"x2"):b(t.x),x0:"x"===L?t=>t.x2?b(t.x2,"x2"):b(t.x):b("number"==typeof this._baseline?this._baseline:f.x[0]),x1:"x"===L?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>void 0!==t.y2?x(t.y2,"y2"):x(t.y),y0:"y"===L?t=>t.y2?x(t.y2,"y2"):x(t.y):x("number"==typeof this._baseline?this._baseline:f.y[1])-P,y1:"y"===L?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-P},rt=Object.keys(this._on),O=(dt.forEach(r=>{var o=Object.assign({},B);if(this._stacked&&["Area","Bar"].includes(r.key)){let i="x"===d?b:x;o[""+d]=o[d+"0"]=t=>{var n=_.indexOf(t.id),e=G.indexOf(t.discrete),t=t[d]<0?1:0;return 0<=n?i(p[n][e][t]):i(f[d]["x"===d?0:1])},o[d+"1"]=t=>{var n=_.indexOf(t.id),e=G.indexOf(t.discrete),t=t[d]<0?0:1;return 0<=n?i(p[n][e][t]):i(f[d]["x"===d?0:1])}}var s=(new Tc[r.key]).config(o).data(r.values);if("Bar"===r.key){let t,n="x"===this._discrete?b:x;var o="x"===this._discrete?m:y,l="x"===this._discrete?w:S,h="x"===this._discrete?N:E;t="Point"!==o&&2===l.length?((o=Array.from(new Set(r.values.map(t=>n(t[this._discrete]))))).unshift(h[0]-o[0]-h[0]),o.push(h[1]+h[1]-o[o.length-1]),o.reduce((t,n,e,i)=>t=e&&(n=Math.abs(n-i[e-1]))<t?n:t,1/0)):1<l.length?n(l[1])-n(l[0]):h[h.length-1]-h[0],this._groupPadding<t&&(t-=this._groupPadding);let i=t||1;o=ca().key(t=>t[this._discrete]).key(t=>t.group).entries(r.values),l=oa(o.map(t=>t.values.map(t=>t.key)));let a=Array.from(new Set(l));if(1===Ot(o.map(t=>t.values.length)))s[this._discrete]((t,n)=>B[this._discrete](t,n));else{i=(i-this._barPadding*a.length-1)/a.length;h=t/2-i/2;let e=$a().domain([0,a.length-1]).range([-h,h]);s[this._discrete]((t,n)=>B[this._discrete](t,n)+e(a.indexOf(t.group)))}s.width(i),s.height(i)}else if("Line"===r.key){if(s.duration(1.5*v),this._confidence){l=Object.assign({},B),o=this._discrete||"x";let n="x"===o?"y":"x",e="x"===o?x:b;l[n+"0"]=t=>e(this._confidence[0]?t.lci:t[n]),l[n+"1"]=t=>e(this._confidence[1]?t.hci:t[n]);h=(new vc).config(l).data(r.values),o=Object.assign(this._shapeConfig,this._confidenceConfig);h.config(Et(Lt.bind(this)(o,"shape","Line"),Lt.bind(this)(o,"shape","Area"))).render(),this._shapes.push(h)}s.config({discrete:B.discrete||"x",label:!!nt&&((e,t)=>{if("function"!=typeof this._lineLabels||this._lineLabels(e.data,e.i)){var i=z.find(t=>t.id===e.id);if(i){let n=i.newY||i.defaultY;i=z.filter(t=>t.newY===n);return 1<i.length?i[0].id===e.id&&`+${qu(i.length,this._locale)} `+this._translate("more"):this._drawLabel(e,t)}}return!1}),labelBounds:!!nt&&((t,n,e)=>{var[i,a]=e.points[0],[e,r]=e.points[e.points.length-1],o=this._height/4;return{x:e-i,y:r-a-o/2-(et[t.id]?r-et[t.id]:0),width:tt,height:o}})})}let u=rt.filter(t=>t.includes("."+r.key)),c=rt.filter(t=>!t.includes(".")),g=rt.filter(t=>t.includes(".shape"));for(let a=0;a<c.length;a++)s.on(c[a],(t,n,e,i)=>this._on[c[a]](t.data,t.i,e,i));for(let a=0;a<g.length;a++)s.on(g[a],(t,n,e,i)=>this._on[g[a]](t.data,t.i,e,i));for(let a=0;a<u.length;a++)s.on(u[a],(t,n,e,i)=>this._on[u[a]](t.data,t.i,e,i));l=Lt.bind(this)(this._shapeConfig,"shape",r.key);if(void 0===this._shapeConfig.duration&&delete l.duration,s.config(l).render(),this._shapes.push(s),"Line"===r.key){var t=(new xc).data(this._lineMarkers?r.values:[]).config(B).config(this._lineMarkerConfig).id(t=>t.id+"_"+t.discrete);for(let a=0;a<c.length;a++)t.on(c[a],(t,n,e,i)=>this._on[c[a]](t.data,t.i,e,i));for(let a=0;a<g.length;a++)t.on(g[a],(t,n,e,i)=>this._on[g[a]](t.data,t.i,e,i));for(let a=0;a<u.length;a++)t.on(u[a],(t,n,e,i)=>this._on[u[a]](t.data,t.i,e,i));t.render(),this._shapes.push(t)}}),dt.map(t=>t.key));function zt(e){let i=this[`_${e}Time`];var t=i?o:s,n=t.filter(t=>![NaN,void 0,!1].includes(t[e]));if(!n.length)return[];let a="number"==typeof n[0][e],r=this._discrete===e?ca().key(t=>t[e]).rollup(t=>1===t.length?t[0].data:_u(t.map(t=>t.data),this._aggs)).entries(n).sort((t,n)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.value,n.value):(i||a?parseFloat(t.key,10):t.key)-(i||a?parseFloat(n.key,10):n.key)).map(t=>i?Nt(t.key):a?parseFloat(t.key,10):t.key):pu(n.sort((t,n)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.data,n.data):t[e]-n[e]).map(t=>t[e]),t=>""+t);return r=this._discrete!==e.charAt(0)&&this._confidence&&(this._confidence[0]&&(r=r.concat(t.map(t=>t.lci))),this._confidence[1])?r.concat(t.map(t=>t.hci)):r}function Tt(t){var n=this[`_${t}Time`]?"Time":this._discrete===t||this[`_${t}Sort`]?"Point":"Linear",e=this[`_${t}Domain`]?this[`_${t}Domain`].slice():f[t],i=this[`_${t}2Domain`]?this[`_${t}2Domain`].slice():f[t+"2"];return"Point"!=n&&(e&&void 0===e[0]&&(e[0]=f[t][0]),e&&void 0===e[1]&&(e[1]=f[t][1]),i&&void 0===i[0]&&(i[0]=f[t+"2"][0]),i)&&void 0===i[1]&&(i[1]=f[t+"2"][1]),[e,n,i,n]}O.includes("Line")&&(this._confidence&&O.push("Area"),this._lineMarkers)&&O.push("Circle"),this._previousShapes.filter(t=>!O.includes(t)).forEach(t=>{(new Tc[t]).config(B).data([]).render()}),this._previousShapes=O}return this}
|
|
4857
4854
|
/**
|
|
4858
4855
|
@memberof Plot
|
|
4859
4856
|
@desc Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
|
|
@@ -5140,7 +5137,7 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5140
5137
|
/**
|
|
5141
5138
|
Extends the draw behavior of the abstract Viz class.
|
|
5142
5139
|
@private
|
|
5143
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=Dt([n,t])/2,i=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/e).sort(this._sort).value(this._value)(this._filteredData),e=(i.forEach((t,n)=>{t.__d3plus__=!0,t.i=n}),nl().innerRadius(this._innerRadius).outerRadius(e)),n=`translate(${n/2+this._margin.left}, ${t/2+this._margin.top})`;return this._shapes.push((new zc).data(i).d(e).select(
|
|
5140
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=Dt([n,t])/2,i=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/e).sort(this._sort).value(this._value)(this._filteredData),e=(i.forEach((t,n)=>{t.__d3plus__=!0,t.i=n}),nl().innerRadius(this._innerRadius).outerRadius(e)),n=`translate(${n/2+this._margin.left}, ${t/2+this._margin.top})`;return this._shapes.push((new zc).data(i).d(e).select(Pt("g.d3plus-Pie",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config({id:t=>this._ids(t).join("-"),x:0,y:0}).label(this._drawLabel).config(Lt.bind(this)(this._shapeConfig,"shape","Path")).render()),this}
|
|
5144
5141
|
/**
|
|
5145
5142
|
@memberof Pie
|
|
5146
5143
|
@desc The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).
|
|
@@ -5181,19 +5178,19 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5181
5178
|
@memberof Donut
|
|
5182
5179
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
5183
5180
|
@private
|
|
5184
|
-
*/constructor(){super(),this._innerRadius=()=>Dt([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var E=1e-6,Xf=1e-12,A=Math.PI,Zf=A/2,Jf=A/4,Qf=2*A,t0=180/A,
|
|
5181
|
+
*/constructor(){super(),this._innerRadius=()=>Dt([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var E=1e-6,Xf=1e-12,A=Math.PI,Zf=A/2,Jf=A/4,Qf=2*A,t0=180/A,N=A/180,P=Math.abs,n0=Math.atan,e0=Math.atan2,z=Math.cos,i0=Math.ceil,a0=Math.exp,r0=Math.hypot,o0=Math.log,s0=Math.pow,T=Math.sin,l0=Math.sign||function(t){return 0<t?1:t<0?-1:0},h0=Math.sqrt,u0=Math.tan;function c0(t){return 1<t?0:t<-1?A:Math.acos(t)}function g0(t){return 1<t?Zf:t<-1?-Zf:Math.asin(t)}function d0(t){return(t=T(t/2))*t}function f0(){}function p0(t,n){t&&m0.hasOwnProperty(t.type)&&m0[t.type](t,n)}var _0={Feature:function(t,n){p0(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)p0(e[i].geometry,n)}},m0={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)t=e[i],n.point(t[0],t[1],t[2])},LineString:function(t,n){y0(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)y0(e[i],n,0)},Polygon:function(t,n){v0(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)v0(e[i],n)},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)p0(e[i],n)}};function y0(t,n,e){var i,a=-1,r=t.length-e;for(n.lineStart();++a<r;)i=t[a],n.point(i[0],i[1],i[2]);n.lineEnd()}function v0(t,n){var e=-1,i=t.length;for(n.polygonStart();++e<i;)y0(t[e],n,1);n.polygonEnd()}function b0(t,n){t&&_0.hasOwnProperty(t.type)?_0[t.type](t,n):p0(t,n)}var x0,w0,S0,k0,C0,M0,A0,z0,T0,E0,N0,P0,L0,B0,O0,D0,j0=new Gi,R0=new Gi,I0={point:f0,lineStart:f0,lineEnd:f0,polygonStart:function(){j0=new Gi,I0.lineStart=F0,I0.lineEnd=H0},polygonEnd:function(){var t=+j0;R0.add(t<0?Qf+t:t),this.lineStart=this.lineEnd=this.point=f0},sphere:function(){R0.add(Qf)}};
|
|
5185
5182
|
// hello?
|
|
5186
|
-
function F0(){I0.point=G0}function H0(){K0(x0,w0)}function G0(t,n){I0.point=K0,x0=t,w0=n,S0=t*=
|
|
5183
|
+
function F0(){I0.point=G0}function H0(){K0(x0,w0)}function G0(t,n){I0.point=K0,x0=t,w0=n,S0=t*=N,k0=z(n=(n*=N)/2+Jf),C0=T(n)}function K0(t,n){// half the angular distance from south pole
|
|
5187
5184
|
// Spherical excess E for a spherical triangle with vertices: south pole,
|
|
5188
5185
|
// previous point, current point. Uses a formula derived from Cagnoli’s
|
|
5189
5186
|
// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
|
|
5190
|
-
var e=(t*=
|
|
5187
|
+
var e=(t*=N)-S0,i=0<=e?1:-1,e=i*e,a=z(n=(n*=N)/2+Jf),n=T(n),r=C0*n,o=k0*a+r*z(e),r=r*i*T(e);j0.add(e0(r,o)),
|
|
5191
5188
|
// Advance the previous points.
|
|
5192
5189
|
S0=t,k0=a,C0=n}function U0(t){return[e0(t[1],t[0]),g0(t[2])]}function W0(t){var n=t[0],t=t[1],e=z(t);return[e*z(n),e*T(n),T(t)]}function q0(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function $0(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]]}
|
|
5193
5190
|
// TODO return a
|
|
5194
5191
|
function V0(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Y0(t,n){return[t[0]*n,t[1]*n,t[2]*n]}
|
|
5195
5192
|
// TODO return d
|
|
5196
|
-
function X0(t){var n=h0(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Z0,J0,Q0,t1,n1,e1,i1,a1,r1,o1,s1,l1,h1,u1,c1,g1,d1={point:f1,lineStart:_1,lineEnd:m1,polygonStart:function(){d1.point=y1,d1.lineStart=v1,d1.lineEnd=b1,B0=new Gi,I0.polygonStart()},polygonEnd:function(){I0.polygonEnd(),d1.point=f1,d1.lineStart=_1,d1.lineEnd=m1,j0<0?(M0=-(z0=180),A0=-(T0=90)):E<B0?T0=90:B0<-1e-6&&(A0=-90),D0[0]=M0,D0[1]=z0},sphere:function(){M0=-(z0=180),A0=-(T0=90)}};function f1(t,n){O0.push(D0=[M0=t,z0=t]),n<A0&&(A0=n),T0<n&&(T0=n)}function p1(t,n){var e,i,a,r,o,s=W0([t*
|
|
5193
|
+
function X0(t){var n=h0(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Z0,J0,Q0,t1,n1,e1,i1,a1,r1,o1,s1,l1,h1,u1,c1,g1,d1={point:f1,lineStart:_1,lineEnd:m1,polygonStart:function(){d1.point=y1,d1.lineStart=v1,d1.lineEnd=b1,B0=new Gi,I0.polygonStart()},polygonEnd:function(){I0.polygonEnd(),d1.point=f1,d1.lineStart=_1,d1.lineEnd=m1,j0<0?(M0=-(z0=180),A0=-(T0=90)):E<B0?T0=90:B0<-1e-6&&(A0=-90),D0[0]=M0,D0[1]=z0},sphere:function(){M0=-(z0=180),A0=-(T0=90)}};function f1(t,n){O0.push(D0=[M0=t,z0=t]),n<A0&&(A0=n),T0<n&&(T0=n)}function p1(t,n){var e,i,a,r,o,s=W0([t*N,n*N]);L0?(e=$0(L0,s),X0(e=$0([e[1],-e[0],0],e)),e=U0(e),o=t-E0,a=e[0]*t0*(i=0<o?1:-1),(o=180<P(o))^(i*E0<a&&a<i*t)?(r=e[1]*t0,T0<r&&(T0=r)):o^(i*E0<(a=(360+a)%360-180)&&a<i*t)?(r=-e[1]*t0)<A0&&(A0=r):(n<A0&&(A0=n),T0<n&&(T0=n)),o?t<E0?x1(M0,t)>x1(M0,z0)&&(z0=t):x1(t,z0)>x1(M0,z0)&&(M0=t):M0<=z0?(t<M0&&(M0=t),z0<t&&(z0=t)):E0<t?x1(M0,t)>x1(M0,z0)&&(z0=t):x1(t,z0)>x1(M0,z0)&&(M0=t)):O0.push(D0=[M0=t,z0=t]),n<A0&&(A0=n),T0<n&&(T0=n),L0=s,E0=t}function _1(){d1.point=p1}function m1(){D0[0]=M0,D0[1]=z0,d1.point=f1,L0=null}function y1(t,n){var e;L0?(e=t-E0,B0.add(180<P(e)?e+(0<e?360:-360):e)):(N0=t,P0=n),I0.point(t,n),p1(t,n)}function v1(){I0.lineStart()}function b1(){y1(N0,P0),I0.lineEnd(),P(B0)>E&&(M0=-(z0=180)),D0[0]=M0,D0[1]=z0,L0=null}
|
|
5197
5194
|
// Finds the left-right distance between two longitudes.
|
|
5198
5195
|
// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want
|
|
5199
5196
|
// the distance between ±180° to be 360°.
|
|
@@ -5205,21 +5202,21 @@ for(O0.sort(w1),n=1,r=[i=O0[0]];n<e;++n)S1(i,(a=O0[n])[0])||S1(i,a[1])?(x1(i[0],
|
|
|
5205
5202
|
// Finally, find the largest gap between the merged ranges.
|
|
5206
5203
|
// The final bounding box will be the inverse of this gap.
|
|
5207
5204
|
for(o=-1/0,n=0,i=r[e=r.length-1];n<=e;i=a,++n)(s=x1(i[1],(a=r[n])[0]))>o&&(o=s,M0=a[0],z0=i[1])}return O0=D0=null,M0===1/0||A0===1/0?[[NaN,NaN],[NaN,NaN]]:[[M0,A0],[z0,T0]]}// previous point
|
|
5208
|
-
var C1={sphere:f0,point:M1,lineStart:z1,lineEnd:
|
|
5205
|
+
var C1={sphere:f0,point:M1,lineStart:z1,lineEnd:N1,polygonStart:function(){C1.lineStart=P1,C1.lineEnd=L1},polygonEnd:function(){C1.lineStart=z1,C1.lineEnd=N1}};
|
|
5209
5206
|
// Arithmetic mean of Cartesian vectors.
|
|
5210
|
-
function M1(t,n){t*=
|
|
5207
|
+
function M1(t,n){t*=N;var e=z(n*=N);A1(e*z(t),e*T(t),T(n))}function A1(t,n,e){Q0+=(t-Q0)/++Z0,t1+=(n-t1)/Z0,n1+=(e-n1)/Z0}function z1(){C1.point=T1}function T1(t,n){t*=N;var e=z(n*=N);u1=e*z(t),c1=e*T(t),g1=T(n),C1.point=E1,A1(u1,c1,g1)}function E1(t,n){t*=N;var e=z(n*=N),i=e*z(t),e=e*T(t),t=T(n),n=e0(h0((n=c1*t-g1*e)*n+(n=g1*i-u1*t)*n+(n=u1*e-c1*i)*n),u1*i+c1*e+g1*t);J0+=n,e1+=n*(u1+(u1=i)),i1+=n*(c1+(c1=e)),a1+=n*(g1+(g1=t)),A1(u1,c1,g1)}function N1(){C1.point=M1}
|
|
5211
5208
|
// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
|
|
5212
5209
|
// J. Applied Mechanics 42, 239 (1975).
|
|
5213
|
-
function
|
|
5210
|
+
function P1(){C1.point=B1}function L1(){O1(l1,h1),C1.point=M1}function B1(t,n){l1=t,h1=n,t*=N,n*=N,C1.point=O1;var e=z(n);u1=e*z(t),c1=e*T(t),g1=T(n),A1(u1,c1,g1)}function O1(t,n){t*=N;var e=z(n*=N),i=e*z(t),e=e*T(t),t=T(n),n=c1*t-g1*e,a=g1*i-u1*t,r=u1*e-c1*i,o=r0(n,a,r),s=g0(o),o=o&&-s/o;// area weight multiplier
|
|
5214
5211
|
r1.add(o*n),o1.add(o*a),s1.add(o*r),J0+=s,e1+=s*(u1+(u1=i)),i1+=s*(c1+(c1=e)),a1+=s*(g1+(g1=t)),A1(u1,c1,g1)}function D1(t){Z0=J0=Q0=t1=n1=e1=i1=a1=0,r1=new Gi,o1=new Gi,s1=new Gi,b0(t,C1);var t=+r1,n=+o1,e=+s1,i=r0(t,n,e);
|
|
5215
5212
|
// If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.
|
|
5216
5213
|
return i<Xf&&(t=e1,n=i1,e=a1,
|
|
5217
5214
|
// If the feature has zero length, fall back to arithmetic mean of point vectors.
|
|
5218
|
-
J0<E&&(t=Q0,n=t1,e=n1),(i=r0(t,n,e))<Xf)?[NaN,NaN]:[e0(n,t)*t0,g0(e/i)*t0]}function j1(t){return function(){return t}}function R1(e,i){function t(t,n){return t=e(t,n),i(t[0],t[1])}return e.invert&&i.invert&&(t.invert=function(t,n){return(t=i.invert(t,n))&&e.invert(t[0],t[1])}),t}function I1(t,n){return
|
|
5215
|
+
J0<E&&(t=Q0,n=t1,e=n1),(i=r0(t,n,e))<Xf)?[NaN,NaN]:[e0(n,t)*t0,g0(e/i)*t0]}function j1(t){return function(){return t}}function R1(e,i){function t(t,n){return t=e(t,n),i(t[0],t[1])}return e.invert&&i.invert&&(t.invert=function(t,n){return(t=i.invert(t,n))&&e.invert(t[0],t[1])}),t}function I1(t,n){return P(t)>A&&(t-=Math.round(t/Qf)*Qf),[t,n]}function F1(t,n,e){return(t%=Qf)?n||e?R1(G1(t),K1(n,e)):G1(t):n||e?K1(n,e):I1}function H1(e){return function(t,n){return P(t+=e)>A&&(t-=Math.round(t/Qf)*Qf),[t,n]}}function G1(t){var n=H1(t);return n.invert=H1(-t),n}function K1(t,n){var a=z(t),r=T(t),o=z(n),s=T(n);function e(t,n){var e=z(n),i=z(t)*e,t=T(t)*e,e=T(n),n=e*a+i*r;return[e0(t*o-n*s,i*a-e*r),g0(n*o+t*s)]}return e.invert=function(t,n){var e=z(n),i=z(t)*e,t=T(t)*e,e=T(n),n=e*o-t*s;return[e0(t*o+e*s,i*a+n*r),g0(n*a-i*r)]},e}function U1(n){function t(t){return(t=n(t[0]*N,t[1]*N))[0]*=t0,t[1]*=t0,t}return n=F1(n[0]*N,n[1]*N,2<n.length?n[2]*N:0),t.invert=function(t){return(t=n.invert(t[0]*N,t[1]*N))[0]*=t0,t[1]*=t0,t},t}
|
|
5219
5216
|
// Generates a circle centered at [0°, 0°], with a given radius and precision.
|
|
5220
5217
|
function W1(t,n,e,i,a,r){if(e){var o=z(n),s=T(n),l=i*e;null==a?(a=n+i*Qf,r=n-l/2):(a=q1(o,a),r=q1(o,r),(0<i?a<r:r<a)&&(a+=i*Qf));for(var h,u=a;0<i?r<u:u<r;u-=l)h=U0([o,-s*z(u),-s*T(u)]),t.point(h[0],h[1])}}
|
|
5221
5218
|
// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].
|
|
5222
|
-
function q1(t,n){(n=W0(n))[0]-=t,X0(n);t=c0(-n[1]);return((-n[2]<0?-t:t)+Qf-E)%Qf}function $1(){var i,a,r=j1([0,0]),o=j1(90),s=j1(2),l={point:function(t,n){i.push(t=a(t,n)),t[0]*=t0,t[1]*=t0}};function n(){var t=r.apply(this,arguments),n=o.apply(this,arguments)*
|
|
5219
|
+
function q1(t,n){(n=W0(n))[0]-=t,X0(n);t=c0(-n[1]);return((-n[2]<0?-t:t)+Qf-E)%Qf}function $1(){var i,a,r=j1([0,0]),o=j1(90),s=j1(2),l={point:function(t,n){i.push(t=a(t,n)),t[0]*=t0,t[1]*=t0}};function n(){var t=r.apply(this,arguments),n=o.apply(this,arguments)*N,e=s.apply(this,arguments)*N;return i=[],a=F1(-t[0]*N,-t[1]*N,0).invert,W1(l,n,e,1),t={type:"Polygon",coordinates:[i]},i=a=null,t}return n.center=function(t){return arguments.length?(r="function"==typeof t?t:j1([+t[0],+t[1]]),n):r},n.radius=function(t){return arguments.length?(o="function"==typeof t?t:j1(+t),n):o},n.precision=function(t){return arguments.length?(s="function"==typeof t?t:j1(+t),n):s},n}function V1(){var i,n=[];return{point:function(t,n,e){i.push([t,n,e])},lineStart:function(){n.push(i=[])},lineEnd:f0,rejoin:function(){1<n.length&&n.push(n.pop().concat(n.shift()))},result:function(){var t=n;return n=[],i=null,t}}}function Y1(t,n){return P(t[0]-n[0])<E&&P(t[1]-n[1])<E}function X1(t,n,e,i){this.x=t,this.z=n,this.o=e,// another intersection
|
|
5223
5220
|
this.e=i,// is an entry?
|
|
5224
5221
|
this.v=!1,// visited
|
|
5225
5222
|
this.n=this.p=null}
|
|
@@ -5230,7 +5227,7 @@ function Z1(t,n,e,i,r){var o,a,s=[],l=[];if(t.forEach(function(t){if(!((n=t.leng
|
|
|
5230
5227
|
// handle degenerate cases by moving the point
|
|
5231
5228
|
a[0]+=2*E}s.push(e=new X1(i,t,null,!0)),l.push(e.o=new X1(i,null,e,!1)),s.push(e=new X1(a,t,null,!1)),l.push(e.o=new X1(a,null,e,!0))}}),s.length){for(l.sort(n),J1(s),J1(l),o=0,a=l.length;o<a;++o)l[o].e=e=!e;for(var h,u,c=s[0];;){for(
|
|
5232
5229
|
// Find first unvisited intersection.
|
|
5233
|
-
var g=c,d=!0;g.v;)if((g=g.n)===c)return;h=g.z,r.lineStart();do{if(g.v=g.o.v=!0,g.e){if(d)for(o=0,a=h.length;o<a;++o)r.point((u=h[o])[0],u[1]);else i(g.x,g.n.x,1,r);g=g.n}else{if(d)for(h=g.p.z,o=h.length-1;0<=o;--o)r.point((u=h[o])[0],u[1]);else i(g.x,g.p.x,-1,r);g=g.p}}while(h=(g=g.o).z,d=!d,!g.v);r.lineEnd()}}}function J1(t){if(n=t.length){for(var n,e,i=0,a=t[0];++i<n;)a.n=e=t[i],e.p=a,a=e;a.n=e=t[0],e.p=a}}function Q1(t){return
|
|
5230
|
+
var g=c,d=!0;g.v;)if((g=g.n)===c)return;h=g.z,r.lineStart();do{if(g.v=g.o.v=!0,g.e){if(d)for(o=0,a=h.length;o<a;++o)r.point((u=h[o])[0],u[1]);else i(g.x,g.n.x,1,r);g=g.n}else{if(d)for(h=g.p.z,o=h.length-1;0<=o;--o)r.point((u=h[o])[0],u[1]);else i(g.x,g.p.x,-1,r);g=g.p}}while(h=(g=g.o).z,d=!d,!g.v);r.lineEnd()}}}function J1(t){if(n=t.length){for(var n,e,i=0,a=t[0];++i<n;)a.n=e=t[i],e.p=a,a=e;a.n=e=t[0],e.p=a}}function Q1(t){return P(t[0])<=A?t[0]:l0(t[0])*((P(t[0])+A)%Qf-A)}function tp(t,n){var e=Q1(n),i=n[1],n=T(i),a=[T(e),-z(e),0],r=0,o=0,s=new Gi;1===n?i=Zf+E:-1===n&&(i=-Zf-E);for(var l=0,h=t.length;l<h;++l)if(c=(u=t[l]).length)for(var u,c,g=u[c-1],d=Q1(g),f=g[1]/2+Jf,p=T(f),_=z(f),m=0;m<c;++m,d=v,p=x,_=b,g=y){var y=u[m],v=Q1(y),b=y[1]/2+Jf,x=T(b),b=z(b),w=v-d,S=0<=w?1:-1,k=S*w,C=A<k,M=p*x;s.add(e0(M*S*T(k),_*b+M*z(k))),r+=C?w+S*Qf:w,
|
|
5234
5231
|
// Are the longitudes either side of the point’s meridian (lambda),
|
|
5235
5232
|
// and are the latitudes smaller than the parallel (phi)?
|
|
5236
5233
|
C^e<=d^e<=v&&(X0(M=$0(W0(g),W0(y))),X0(k=$0(a,M)),(S=(C^0<=w?-1:1)*g0(k[2]))<i||i===S&&(M[0]||M[1]))&&(o+=C^0<=w?1:-1)}
|
|
@@ -5257,9 +5254,9 @@ function ip(t,n){return((t=t.x)[0]<0?t[1]-Zf-E:Zf-t[1])-((n=n.x)[0]<0?n[1]-Zf-E:
|
|
|
5257
5254
|
// intersections or the line was empty; 1 - no intersections; 2 - there were
|
|
5258
5255
|
// intersections, and the first and last segments should be rejoined.
|
|
5259
5256
|
function(h){var u,c=NaN,g=NaN,d=NaN;// no intersections
|
|
5260
|
-
return{lineStart:function(){h.lineStart(),u=1},point:function(t,n){var e,i,a,r,o,s=0<t?A:-A,l=
|
|
5261
|
-
|
|
5262
|
-
}}},function(t,n,e,i){var a;null==t?(a=e*Zf,i.point(-A,a),i.point(0,a),i.point(A,a),i.point(A,0),i.point(A,-a),i.point(0,-a),i.point(-A,-a),i.point(-A,0),i.point(-A,a)):
|
|
5257
|
+
return{lineStart:function(){h.lineStart(),u=1},point:function(t,n){var e,i,a,r,o,s=0<t?A:-A,l=P(t-c);P(l-A)<E?(h.point(c,g=0<(g+n)/2?Zf:-Zf),h.point(d,g),h.lineEnd(),h.lineStart(),h.point(s,g),h.point(t,g),u=0):d!==s&&A<=l&&(P(c-d)<E&&(c-=d*E),// handle degeneracies
|
|
5258
|
+
P(t-s)<E&&(t-=s*E),l=g,a=n,o=T((e=c)-(i=t)),g=P(o)>E?n0((T(l)*(r=z(a))*T(i)-T(a)*(i=z(l))*T(e))/(i*r*o)):(l+a)/2,h.point(d,g),h.lineEnd(),h.lineStart(),h.point(s,g),u=0),h.point(c=t,g=n),d=s},lineEnd:function(){h.lineEnd(),c=g=NaN},clean:function(){return 2-u;// if intersections, rejoin first and last segments
|
|
5259
|
+
}}},function(t,n,e,i){var a;null==t?(a=e*Zf,i.point(-A,a),i.point(0,a),i.point(A,a),i.point(A,0),i.point(A,-a),i.point(0,-a),i.point(-A,-a),i.point(-A,0),i.point(-A,a)):P(t[0]-n[0])>E?(t=t[0]<n[0]?A:-A,a=e*t/2,i.point(-t,a),i.point(0,a),i.point(t,a)):i.point(n[0],n[1])},[-A,-Zf]);function rp(a){var p=z(a),r=2*N,c=0<p,g=P(p)>E;// TODO optimise for this common case
|
|
5263
5260
|
function d(t,n){return z(t)*z(n)>p}
|
|
5264
5261
|
// Takes a line and cuts into visible segments. Return values used for polygon
|
|
5265
5262
|
// clipping: 0 - there were intersections or the line was empty; 1 - no
|
|
@@ -5272,7 +5269,7 @@ function f(t,n,e){var i,a,r,o,s,l,h,u=[1,0,0],c=$0(W0(t),W0(n)),g=q0(c,c),d=c[0]
|
|
|
5272
5269
|
// Two polar points.
|
|
5273
5270
|
return f?(i=$0(u,c),V0(u=Y0(u,p*g/f),Y0(c,-p*d/f)),(f=(c=q0(u,g=i))*c-(d=q0(g,g))*(q0(u,u)-1))<0?void 0:(V0(f=Y0(g,(-c-(i=h0(f)))/d),u),f=U0(f),e?(
|
|
5274
5271
|
// Check that the first point is between a and b.
|
|
5275
|
-
a=t[0],r=n[0],o=t[1],n=n[1],r<a&&(h=a,a=r,r=h),!(l=
|
|
5272
|
+
a=t[0],r=n[0],o=t[1],n=n[1],r<a&&(h=a,a=r,r=h),!(l=P((s=r-a)-A)<E)&&n<o&&(h=o,o=n,n=h),(l||s<E?l?0<o+n^f[1]<(P(f[0]-a)<E?o:n):o<=f[1]&&f[1]<=n:A<s^(a<=f[0]&&f[0]<=r))?(V0(h=Y0(g,(-c+i)/d),u),[f,U0(h)]):void 0):f)):!e&&t}
|
|
5276
5273
|
// Generates a 4-bit vector representing the location of a point relative to
|
|
5277
5274
|
// the small circle's bounding box.
|
|
5278
5275
|
function _(t,n){var e=c?a:A-a,i=0;// above
|
|
@@ -5291,36 +5288,36 @@ t&s||!(n=f(i,o,!0))||(u=0,c?(r.lineStart(),r.point(n[0][0],n[0][1]),r.point(n[1]
|
|
|
5291
5288
|
clean:function(){return u|(h&&l)<<1}}},function(t,n,e,i){W1(i,a,r,e,t,n)},c?[0,-a]:[-A,a-A])}var op,sp,lp,hp,up=1e9,cp=-1e9;
|
|
5292
5289
|
// TODO Use d3-polygon’s polygonContains here for the ring check?
|
|
5293
5290
|
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
|
|
5294
|
-
function gp(m,y,v,b){function x(t,n){return m<=t&&t<=v&&y<=n&&n<=b}function w(t,n,e,i){var a=0,r=0;if(null==t||(a=o(t,e))!==(r=o(n,e))||s(t,n)<0^0<e)for(;i.point(0===a||3===a?m:v,1<a?b:y),(a=(a+e+4)%4)!==r;);else i.point(n[0],n[1])}function o(t,n){return
|
|
5291
|
+
function gp(m,y,v,b){function x(t,n){return m<=t&&t<=v&&y<=n&&n<=b}function w(t,n,e,i){var a=0,r=0;if(null==t||(a=o(t,e))!==(r=o(n,e))||s(t,n)<0^0<e)for(;i.point(0===a||3===a?m:v,1<a?b:y),(a=(a+e+4)%4)!==r;);else i.point(n[0],n[1])}function o(t,n){return P(t[0]-m)<E?0<n?0:3:P(t[0]-v)<E?0<n?2:1:P(t[1]-y)<E?0<n?1:0:0<n?3:2;// abs(p[1] - y1) < epsilon
|
|
5295
5292
|
}function S(t,n){return s(t.x,n.x)}function s(t,n){var e=o(t,1),i=o(n,1);return e!==i?e-i:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(i){var a,c,r,o,s,l,h,u,g,d,f,p=i,t=V1(),n={point:e,lineStart:function(){n.point=_,c&&c.push(r=[]);d=!0,g=!1,h=u=NaN}
|
|
5296
5293
|
// TODO rather than special-case polygons, simply handle them separately.
|
|
5297
5294
|
// Ideally, coincident intersection points should be jittered to avoid
|
|
5298
5295
|
// clipping issues.
|
|
5299
5296
|
,lineEnd:function(){a&&(_(o,s),l&&g&&t.rejoin(),a.push(t.result()));n.point=e,g&&p.lineEnd()},polygonStart:
|
|
5300
5297
|
// Buffer geometry within a polygon and then clip it en masse.
|
|
5301
|
-
function(){p=t,a=[],c=[],f=!0},polygonEnd:function(){var t=(()=>{for(var t=0,n=0,e=c.length;n<e;++n)for(var i,a,r=c[n],o=1,s=r.length,l=r[0],h=l[0],u=l[1];o<s;++o)i=h,a=u,l=r[o],h=l[0],u=l[1],a<=b?b<u&&(u-a)*(m-i)<(h-i)*(b-a)&&++t:u<=b&&(h-i)*(b-a)<(u-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=oa(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&Z1(a,S,t,w,i),i.polygonEnd());p=i,a=c=r=null}};function e(t,n){x(t,n)&&p.point(t,n)}function _(t,n){var e,i,a=x(t,n);c&&r.push([t,n]),d?(o=t,s=n,d=!1,(l=a)&&(p.lineStart(),p.point(t,n))):a&&g?p.point(t,n):((t,n,e,i,a,r)=>{var o=t[0],s=t[1],l=0,h=1,u=n[0]-o,c=n[1]-s,e=e-o;if(u||!(0<e)){if(e/=u,u<0){if(e<l)return;e<h&&(h=e)}else if(0<u){if(h<e)return;l<e&&(l=e)}if(e=a-o,u||!(e<0)){if(e/=u,u<0){if(h<e)return;l<e&&(l=e)}else if(0<u){if(e<l)return;e<h&&(h=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<h&&(h=e)}else if(0<c){if(h<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(h<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<h&&(h=e)}return 0<l&&(t[0]=o+l*u,t[1]=s+l*c),h<1&&(n[0]=o+h*u,n[1]=s+h*c),1}}}}})(e=[h=Math.max(cp,Math.min(up,h)),u=Math.max(cp,Math.min(up,u))],i=[t=Math.max(cp,Math.min(up,t)),n=Math.max(cp,Math.min(up,n))],m,y,v,b)?(g||(p.lineStart(),p.point(e[0],e[1])),p.point(i[0],i[1]),a||p.lineEnd(),f=!1):a&&(p.lineStart(),p.point(t,n),f=!1),h=t,u=n,g=a}return n}}var dp={sphere:f0,point:f0,lineStart:function(){dp.point=pp,dp.lineEnd=fp},lineEnd:f0,polygonStart:f0,polygonEnd:f0};function fp(){dp.point=dp.lineEnd=f0}function pp(t,n){sp=t*=
|
|
5298
|
+
function(){p=t,a=[],c=[],f=!0},polygonEnd:function(){var t=(()=>{for(var t=0,n=0,e=c.length;n<e;++n)for(var i,a,r=c[n],o=1,s=r.length,l=r[0],h=l[0],u=l[1];o<s;++o)i=h,a=u,l=r[o],h=l[0],u=l[1],a<=b?b<u&&(u-a)*(m-i)<(h-i)*(b-a)&&++t:u<=b&&(h-i)*(b-a)<(u-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=oa(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&Z1(a,S,t,w,i),i.polygonEnd());p=i,a=c=r=null}};function e(t,n){x(t,n)&&p.point(t,n)}function _(t,n){var e,i,a=x(t,n);c&&r.push([t,n]),d?(o=t,s=n,d=!1,(l=a)&&(p.lineStart(),p.point(t,n))):a&&g?p.point(t,n):((t,n,e,i,a,r)=>{var o=t[0],s=t[1],l=0,h=1,u=n[0]-o,c=n[1]-s,e=e-o;if(u||!(0<e)){if(e/=u,u<0){if(e<l)return;e<h&&(h=e)}else if(0<u){if(h<e)return;l<e&&(l=e)}if(e=a-o,u||!(e<0)){if(e/=u,u<0){if(h<e)return;l<e&&(l=e)}else if(0<u){if(e<l)return;e<h&&(h=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<h&&(h=e)}else if(0<c){if(h<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(h<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<h&&(h=e)}return 0<l&&(t[0]=o+l*u,t[1]=s+l*c),h<1&&(n[0]=o+h*u,n[1]=s+h*c),1}}}}})(e=[h=Math.max(cp,Math.min(up,h)),u=Math.max(cp,Math.min(up,u))],i=[t=Math.max(cp,Math.min(up,t)),n=Math.max(cp,Math.min(up,n))],m,y,v,b)?(g||(p.lineStart(),p.point(e[0],e[1])),p.point(i[0],i[1]),a||p.lineEnd(),f=!1):a&&(p.lineStart(),p.point(t,n),f=!1),h=t,u=n,g=a}return n}}var dp={sphere:f0,point:f0,lineStart:function(){dp.point=pp,dp.lineEnd=fp},lineEnd:f0,polygonStart:f0,polygonEnd:f0};function fp(){dp.point=dp.lineEnd=f0}function pp(t,n){sp=t*=N,lp=T(n*=N),hp=z(n),dp.point=_p}function _p(t,n){t*=N;var e=T(n*=N),n=z(n),i=P(t-sp),a=z(i),i=n*T(i),r=hp*e-lp*n*a,a=lp*e+hp*n*a;op.add(e0(h0(i*i+r*r),a)),sp=t,lp=e,hp=n}function mp(t){return op=new Gi,b0(t,dp),+op}var yp=[null,null],vp={type:"LineString",coordinates:yp};function bp(t,n){return yp[0]=t,yp[1]=n,mp(vp)}var xp={Feature:function(t,n){return Sp(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)if(Sp(e[i].geometry,n))return!0;return!1}},wp={Sphere:function(){return!0},Point:function(t,n){return kp(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(kp(e[i],n))return!0;return!1},LineString:function(t,n){return Cp(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(Cp(e[i],n))return!0;return!1},Polygon:function(t,n){return Mp(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(Mp(e[i],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)if(Sp(e[i],n))return!0;return!1}};function Sp(t,n){return!(!t||!wp.hasOwnProperty(t.type))&&wp[t.type](t,n)}function kp(t,n){return 0===bp(t,n)}function Cp(t,n){for(var e,i,a,r=0,o=t.length;r<o;r++){if(0===(i=bp(t[r],n)))return!0;if(0<r&&0<(a=bp(t[r],t[r-1]))&&e<=a&&i<=a&&(e+i-a)*(1-Math.pow((e-i)/a,2))<Xf*a)return!0;e=i}return!1}function Mp(t,n){return!!tp(t.map(Ap),zp(n))}function Ap(t){return(t=t.map(zp)).pop(),t}function zp(t){return[t[0]*N,t[1]*N]}function Tp(t,n,e){var i=jt(t,n-E,e).concat(n);return function(n){return i.map(function(t){return[n,t]})}}function Ep(t,n,e){var i=jt(t,n-E,e).concat(n);return function(n){return i.map(function(t){return[t,n]})}}function Np(){var n,e,i,a,r,o,s,l,h,u,c,g,d=10,f=d,p=90,_=360,m=2.5;function y(){return{type:"MultiLineString",coordinates:t()}}function t(){return jt(i0(a/p)*p,i,p).map(c).concat(jt(i0(l/_)*_,s,_).map(g)).concat(jt(i0(e/d)*d,n,d).filter(function(t){return P(t%p)>E}).map(h)).concat(jt(i0(o/f)*f,r,f).filter(function(t){return P(t%_)>E}).map(u))}return y.lines=function(){return t().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[c(a).concat(g(s).slice(1),c(i).reverse().slice(1),g(l).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(a=+t[0][0],i=+t[1][0],l=+t[0][1],s=+t[1][1],i<a&&(t=a,a=i,i=t),s<l&&(t=l,l=s,s=t),y.precision(m)):[[a,l],[i,s]]},y.extentMinor=function(t){return arguments.length?(e=+t[0][0],n=+t[1][0],o=+t[0][1],r=+t[1][1],n<e&&(t=e,e=n,n=t),r<o&&(t=o,o=r,r=t),y.precision(m)):[[e,o],[n,r]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],_=+t[1],y):[p,_]},y.stepMinor=function(t){return arguments.length?(d=+t[0],f=+t[1],y):[d,f]},y.precision=function(t){return arguments.length?(m=+t,h=Tp(o,r,90),u=Ep(e,n,m),c=Tp(l,s,90),g=Ep(a,i,m),y):m},y.extentMajor([[-180,-90+E],[180,90-E]]).extentMinor([[-180,-80-E],[180,80+E]])}function Pp(t,n){var e=t[0]*N,i=t[1]*N,t=n[0]*N,n=n[1]*N,a=z(i),r=T(i),o=z(n),s=T(n),l=a*z(e),h=a*T(e),u=o*z(t),c=o*T(t),g=2*g0(h0(d0(n-i)+a*o*d0(t-e))),d=T(g),n=g?function(t){var n=T(t*=g)/d,t=T(g-t)/d,e=t*l+n*u,i=t*h+n*c,t=t*r+n*s;return[e0(i,e)*t0,e0(t,h0(e*e+i*i))*t0]}:function(){return[e*t0,i*t0]};return n.distance=g,n}var Lp,Bp,Op,Dp,jp=t=>t,Rp=new Gi,Ip=new Gi,Fp={point:f0,lineStart:f0,lineEnd:f0,polygonStart:function(){Fp.lineStart=Hp,Fp.lineEnd=Up},polygonEnd:function(){Fp.lineStart=Fp.lineEnd=Fp.point=f0,Rp.add(P(Ip)),Ip=new Gi},result:function(){var t=Rp/2;return Rp=new Gi,t}};function Hp(){Fp.point=Gp}function Gp(t,n){Fp.point=Kp,Lp=Op=t,Bp=Dp=n}function Kp(t,n){Ip.add(Dp*t-Op*n),Op=t,Dp=n}function Up(){Kp(Lp,Bp)}var Wp=1/0,qp=Wp,$p=-Wp,Vp=$p,Yp={point:function(t,n){t<Wp&&(Wp=t);$p<t&&($p=t);n<qp&&(qp=n);Vp<n&&(Vp=n)}
|
|
5302
5299
|
// TODO Enforce positive area for exterior, negative area for interior?
|
|
5303
5300
|
,lineStart:f0,lineEnd:f0,polygonStart:f0,polygonEnd:f0,result:function(){var t=[[Wp,qp],[$p,Vp]];return $p=Vp=-(qp=Wp=1/0),t}};var Xp,Zp,Jp,Qp,t_=0,n_=0,e_=0,i_=0,a_=0,r_=0,o_=0,s_=0,l_=0,h_={point:u_,lineStart:c_,lineEnd:f_,polygonStart:function(){h_.lineStart=p_,h_.lineEnd=__},polygonEnd:function(){h_.point=u_,h_.lineStart=c_,h_.lineEnd=f_},result:function(){var t=l_?[o_/l_,s_/l_]:r_?[i_/r_,a_/r_]:e_?[t_/e_,n_/e_]:[NaN,NaN];return t_=n_=e_=i_=a_=r_=o_=s_=l_=0,t}};function u_(t,n){t_+=t,n_+=n,++e_}function c_(){h_.point=g_}function g_(t,n){h_.point=d_,u_(Jp=t,Qp=n)}function d_(t,n){var e=t-Jp,i=n-Qp,e=h0(e*e+i*i);i_+=e*(Jp+t)/2,a_+=e*(Qp+n)/2,r_+=e,u_(Jp=t,Qp=n)}function f_(){h_.point=u_}function p_(){h_.point=m_}function __(){y_(Xp,Zp)}function m_(t,n){h_.point=y_,u_(Xp=Jp=t,Zp=Qp=n)}function y_(t,n){var e=t-Jp,i=n-Qp,e=h0(e*e+i*i);i_+=e*(Jp+t)/2,a_+=e*(Qp+n)/2,r_+=e,o_+=(e=Qp*t-Jp*n)*(Jp+t),s_+=e*(Qp+n),l_+=3*e,u_(Jp=t,Qp=n)}function v_(t){this._context=t}v_.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Qf)}},result:f0};var b_,x_,w_,S_,k_,C_=new Gi,M_={point:f0,lineStart:function(){M_.point=A_},lineEnd:function(){b_&&z_(x_,w_),M_.point=f0},polygonStart:function(){b_=!0},polygonEnd:function(){b_=null},result:function(){var t=+C_;return C_=new Gi,t}};function A_(t,n){M_.point=z_,x_=S_=t,w_=k_=n}function z_(t,n){S_-=t,k_-=n,C_.add(h0(S_*S_+k_*k_)),S_=t,k_=n}
|
|
5304
5301
|
// Simple caching for constant-radius points.
|
|
5305
|
-
let T_,E_,P_
|
|
5306
|
-
this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,
|
|
5302
|
+
let T_,E_,N_,P_;class L_{pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:var e,i;this._append`M${t},${n}`,this._radius===N_&&this._append===E_||(e=this._radius,i=this._,this._="",// stash the old string so we can cache the circle path fragment
|
|
5303
|
+
this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,N_=e,E_=this._append,P_=this._,this._=i),this._+=P_}}result(){var t=this._;return this._="",t.length?t:null}constructor(t){this._append=null==t?B_:(t=>{var n=Math.floor(t);if(!(0<=n))throw new RangeError("invalid digits: "+t);if(15<n)return B_;if(n!==T_){let i=10**n;T_=n,E_=function(t){let n=1;this._+=t[0];for(var e=t.length;n<e;++n)this._+=Math.round(arguments[n]*i)/i+t[n]}}return E_})(t),this._radius=4.5,this._=""}}function B_(t){let n=1;this._+=t[0];for(var e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function O_(i){return function(t){var n,e=new D_;for(n in i)e[n]=i[n];return e.stream=t,e}}function D_(){}function j_(t,n,e){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),b0(e,t.stream(Yp)),n(Yp.result()),null!=i&&t.clipExtent(i),t}function R_(a,r,t){return j_(a,function(t){var n=r[1][0]-r[0][0],e=r[1][1]-r[0][1],i=Math.min(n/(t[1][0]-t[0][0]),e/(t[1][1]-t[0][1])),n=+r[0][0]+(n-i*(t[1][0]+t[0][0]))/2,e=+r[0][1]+(e-i*(t[1][1]+t[0][1]))/2;a.scale(150*i).translate([n,e])},t)}function I_(t,n,e){return R_(t,[[0,0],n],e)}function F_(i,a,t){return j_(i,function(t){var n=+a,e=n/(t[1][0]-t[0][0]),n=(n-e*(t[1][0]+t[0][0]))/2,t=-e*t[0][1];i.scale(150*e).translate([n,t])},t)}function H_(a,r,t){return j_(a,function(t){var n=+r,e=n/(t[1][1]-t[0][1]),i=-e*t[0][0],n=(n-e*(t[1][1]+t[0][1]))/2;a.scale(150*e).translate([i,n])},t)}D_.prototype={constructor:D_,point:function(t,n){this.stream.point(t,n)},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()}};var G_=16,K_=z(30*N);// cos(minimum angular distance)
|
|
5307
5304
|
function U_(t,n){return+n?(A=t,z=n,function(i){var e,a,r,o,s,l,h,u,c,g,d,f,p={point:t,lineStart:n,lineEnd:m,polygonStart:function(){i.polygonStart(),p.lineStart=y},polygonEnd:function(){i.polygonEnd(),p.lineStart=n}};// previous point
|
|
5308
|
-
function t(t,n){t=A(t,n),i.point(t[0],t[1])}function n(){u=NaN,p.point=_,i.lineStart()}function _(t,n){var e=W0([t,n]),n=A(t,n);T(u,c,h,g,d,f,u=n[0],c=n[1],h=t,g=e[0],d=e[1],f=e[2],G_,i),i.point(u,c)}function m(){p.point=t,i.lineEnd()}function y(){n(),p.point=v,p.lineEnd=b}function v(t,n){_(e=t,n),a=u,r=c,o=g,s=d,l=f,p.point=_}function b(){T(u,c,h,g,d,f,a,r,e,o,s,l,G_,i),p.lineEnd=m,m()}return p}):(e=t,O_({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}}));var e,A,z;function T(t,n,e,i,a,r,o,s,l,h,u,c,g,d){var f,p,_,m,y,v,b,x,w,S,k=o-t,C=s-n,M=k*k+C*C;4*z<M&&g--&&(_=r+c,b=g0(_/=m=h0((f=i+h)*f+(p=a+u)*p+_*_)),y=
|
|
5305
|
+
function t(t,n){t=A(t,n),i.point(t[0],t[1])}function n(){u=NaN,p.point=_,i.lineStart()}function _(t,n){var e=W0([t,n]),n=A(t,n);T(u,c,h,g,d,f,u=n[0],c=n[1],h=t,g=e[0],d=e[1],f=e[2],G_,i),i.point(u,c)}function m(){p.point=t,i.lineEnd()}function y(){n(),p.point=v,p.lineEnd=b}function v(t,n){_(e=t,n),a=u,r=c,o=g,s=d,l=f,p.point=_}function b(){T(u,c,h,g,d,f,a,r,e,o,s,l,G_,i),p.lineEnd=m,m()}return p}):(e=t,O_({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}}));var e,A,z;function T(t,n,e,i,a,r,o,s,l,h,u,c,g,d){var f,p,_,m,y,v,b,x,w,S,k=o-t,C=s-n,M=k*k+C*C;4*z<M&&g--&&(_=r+c,b=g0(_/=m=h0((f=i+h)*f+(p=a+u)*p+_*_)),y=P(P(_)-1)<E||P(e-l)<E?(e+l)/2:e0(p,f),v=(b=A(y,b))[0],z<(S=C*(x=v-t)-k*(w=(b=b[1])-n))*S/M||.3<P((k*x+C*w)/M-.5)||i*h+a*u+r*c<K_)&&(T(t,n,e,i,a,r,v,b,y,f/=m,p/=m,_,g,d),d.point(v,b),T(v,b,y,f,p,_,o,s,l,h,u,c,g,d))}}var W_=O_({point:function(t,n){this.stream.point(t*N,n*N)}});function q_(t,e,i,a,r,n){var o,s,l,h,u,c,g,d,f,p,_,m;return n?(c=z(n),n=T(n),g=c*t,d=n*t,f=c/t,p=n/t,_=(n*i-c*e)/t,m=(n*e+c*i)/t,v.invert=function(t,n){return[a*(f*t-p*n+_),r*(m-p*t-f*n)]},v):(o=t,s=e,l=i,h=a,u=r,y.invert=function(t,n){return[(t-s)/o*h,(l-n)/o*u]},y);function y(t,n){return[s+o*(t*=h),l-o*(n*=u)]}function v(t,n){return[g*(t*=a)-d*(n*=r)+e,i-d*t-g*n]}}function d(t){return $_(function(){return t})()}function $_(t){var n,i,e,a,r,o,s,l,h,u,c=150,g=480,d=250,f=0,p=0,_=0,m=0,y=0,v=0,b=1,x=1,w=null,S=ap,k=null,C=jp,M=.5;function A(t){return l(t[0]*N,t[1]*N)}function z(t){return(t=l.invert(t[0],t[1]))&&[t[0]*t0,t[1]*t0]}function T(){var t=q_(c,0,0,b,x,v).apply(null,n(f,p)),t=q_(c,g-t[0],d-t[1],b,x,v);return i=F1(_,m,y),s=R1(n,t),l=R1(i,s),o=U_(s,M),E()}function E(){return h=u=null,A}return A.stream=function(t){return h&&u===t?h:h=W_((e=i,O_({point:function(t,n){t=e(t,n);return this.stream.point(t[0],t[1])}})(S(o(C(u=t))))));var e},A.preclip=function(t){return arguments.length?(S=t,w=void 0,E()):S},A.postclip=function(t){return arguments.length?(C=t,k=e=a=r=null,E()):C},A.clipAngle=function(t){return arguments.length?(S=+t?rp(w=t*N):(w=null,ap),E()):w*t0},A.clipExtent=function(t){return arguments.length?(C=null==t?(k=e=a=r=null,jp):gp(k=+t[0][0],e=+t[0][1],a=+t[1][0],r=+t[1][1]),E()):null==k?null:[[k,e],[a,r]]},A.scale=function(t){return arguments.length?(c=+t,T()):c},A.translate=function(t){return arguments.length?(g=+t[0],d=+t[1],T()):[g,d]},A.center=function(t){return arguments.length?(f=t[0]%360*N,p=t[1]%360*N,T()):[f*t0,p*t0]},A.rotate=function(t){return arguments.length?(_=t[0]%360*N,m=t[1]%360*N,y=2<t.length?t[2]%360*N:0,T()):[_*t0,m*t0,y*t0]},A.angle=function(t){return arguments.length?(v=t%360*N,T()):v*t0},A.reflectX=function(t){return arguments.length?(b=t?-1:1,T()):b<0},A.reflectY=function(t){return arguments.length?(x=t?-1:1,T()):x<0},A.precision=function(t){return arguments.length?(o=U_(s,M=t*t),E()):h0(M)},A.fitExtent=function(t,n){return R_(A,t,n)},A.fitSize=function(t,n){return I_(A,t,n)},A.fitWidth=function(t,n){return F_(A,t,n)},A.fitHeight=function(t,n){return H_(A,t,n)},function(){return n=t.apply(this,arguments),A.invert=n.invert&&z,T()}}function V_(t){var n=0,e=A/3,i=$_(t),t=i(n,e);return t.parallels=function(t){return arguments.length?i(n=t[0]*N,e=t[1]*N):[n*t0,e*t0]},t}function Y_(t,n){var e,i,a,r=T(t),o=(r+T(n))/2;
|
|
5309
5306
|
// Are the parallels symmetrical around the Equator?
|
|
5310
|
-
return
|
|
5307
|
+
return P(o)<E?(e=z(t),s.invert=function(t,n){return[t/e,g0(n*e)]},s):(a=h0(i=1+r*(2*o-r))/o,l.invert=function(t,n){var n=a-n,e=e0(t,P(n))*l0(n);return n*o<0&&(e-=A*l0(t)*l0(n)),[e/o,g0((i-(t*t+n*n)*o*o)/(2*o))]},l);function s(t,n){return[t*e,T(n)/e]}function l(t,n){n=h0(i-2*o*T(n))/o;return[n*T(t*=o),a-n*z(t)]}}function X_(){return V_(Y_).scale(155.424).center([0,33.6442])}function Z_(){return X_().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}
|
|
5311
5308
|
// The projections must have mutually exclusive clip regions on the sphere,
|
|
5312
5309
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5313
5310
|
function J_(a){return function(t,n){var e=z(t),i=z(n),e=a(e*i);return e===1/0?[2,0]:[e*i*T(t),e*T(n)]}}function Q_(r){return function(t,n){var e=h0(t*t+n*n),i=r(e),a=T(i),i=z(i);return[e0(t*a,e*i),g0(e&&n*a/e)]}}var tm=J_(function(t){return h0(2/(1+t))});tm.invert=Q_(function(t){return 2*g0(t/2)});var nm=J_(function(t){return(t=c0(t))&&t/T(t)});function em(t,n){return[t,o0(u0((Zf+n)/2))]}function im(e){var i,a,r,o=d(e),n=o.center,s=o.scale,l=o.translate,h=o.clipExtent,u=null;// clip extent
|
|
5314
|
-
function c(){var t=A*s(),n=o(U1(o.rotate()).invert([0,0]));return h(null==u?[[n[0]-t,n[1]-t],[n[0]+t,n[1]+t]]:e===em?[[Math.max(n[0]-t,u),i],[Math.min(n[0]+t,a),r]]:[[u,Math.max(n[1]-t,i)],[a,Math.min(n[1]+t,r)]])}return o.scale=function(t){return(arguments.length?(s(t),c):s)()},o.translate=function(t){return(arguments.length?(l(t),c):l)()},o.center=function(t){return(arguments.length?(n(t),c):n)()},o.clipExtent=function(t){return arguments.length?(null==t?u=i=a=r=null:(u=+t[0][0],i=+t[0][1],a=+t[1][0],r=+t[1][1]),c()):null==u?null:[[u,i],[a,r]]},c()}function am(t){return u0((Zf+t)/2)}function rm(t,n){var e=z(t),a=t===n?T(t):o0(e/z(n))/o0(am(n)/am(t)),r=e*s0(am(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=l0(a)*h0(t*t+n*n),i=e0(t,
|
|
5311
|
+
function c(){var t=A*s(),n=o(U1(o.rotate()).invert([0,0]));return h(null==u?[[n[0]-t,n[1]-t],[n[0]+t,n[1]+t]]:e===em?[[Math.max(n[0]-t,u),i],[Math.min(n[0]+t,a),r]]:[[u,Math.max(n[1]-t,i)],[a,Math.min(n[1]+t,r)]])}return o.scale=function(t){return(arguments.length?(s(t),c):s)()},o.translate=function(t){return(arguments.length?(l(t),c):l)()},o.center=function(t){return(arguments.length?(n(t),c):n)()},o.clipExtent=function(t){return arguments.length?(null==t?u=i=a=r=null:(u=+t[0][0],i=+t[0][1],a=+t[1][0],r=+t[1][1]),c()):null==u?null:[[u,i],[a,r]]},c()}function am(t){return u0((Zf+t)/2)}function rm(t,n){var e=z(t),a=t===n?T(t):o0(e/z(n))/o0(am(n)/am(t)),r=e*s0(am(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=l0(a)*h0(t*t+n*n),i=e0(t,P(n))*l0(n);return n*a<0&&(i-=A*l0(t)*l0(n)),[i/a,2*n0(s0(r/e,1/a))-Zf]},i):em;function i(t,n){0<r?n<-Zf+E&&(n=-Zf+E):Zf-E<n&&(n=Zf-E);n=r/s0(am(n),a);return[n*T(a*t),r-n*z(a*t)]}}function om(t,n){return[t,n]}function sm(){return d(om).scale(152.63)}function lm(t,n){var e=z(t),i=t===n?T(t):(e-z(n))/(n-t),a=e/i+t;return P(i)<E?om:(r.invert=function(t,n){var n=a-n,e=e0(t,P(n))*l0(n);return n*i<0&&(e-=A*l0(t)*l0(n)),[e/i,a-l0(i)*h0(t*t+n*n)]},r);function r(t,n){n=a-n,t*=i;return[n*T(t),a-n*z(t)]}}nm.invert=Q_(function(t){return t}),em.invert=function(t,n){return[t,2*n0(a0(n))-Zf]},om.invert=om;var hm=1.340264,um=-.081106,cm=893e-6,gm=.003796,dm=h0(3)/2;function fm(t,n){var n=g0(dm*T(n)),e=n*n,i=e*e*e;return[t*z(n)/(dm*(hm+3*um*e+i*(7*cm+9*gm*e))),n*(hm+um*e+i*(cm+gm*e))]}function pm(t,n){var e=z(n),i=z(t)*e;return[e*T(t)/i,T(n)/i]}function _m(){return d(pm).scale(144.049).clipAngle(60)}function mm(t,n){var e=n*n,i=e*e;return[t*(.8707-.131979*e+i*(i*(.003971*e-.001529*i)-.013791)),n*(1.007226+e*(.015085+i*(.028874*e-.044475-.005916*i)))]}function ym(t,n){return[z(n)*T(t),T(n)]}function vm(){return d(ym).scale(249.5).clipAngle(90+E)}function bm(t,n){var e=z(n),i=1+z(t)*e;return[e*T(t)/i,T(n)/i]}function xm(t,n){return[o0(u0((Zf+n)/2)),-t]}fm.invert=function(t,n){for(var e,i=n,a=i*i,r=a*a*a,o=0;o<12&&(r=(a=(i-=e=(i*(hm+um*a+r*(cm+gm*a))-n)/(hm+3*um*a+r*(7*cm+9*gm*a)))*i)*a*a,!(P(e)<Xf));++o);return[dm*t*(hm+3*um*a+r*(7*cm+9*gm*a))/z(i),g0(T(i)/dm)]},pm.invert=Q_(n0),mm.invert=function(t,n){var e=n,i=25;do{var a=e*e,r=a*a}while(e-=r=(e*(1.007226+a*(.015085+r*(.028874*a-.044475-.005916*r)))-n)/(1.007226+a*(.045255+r*(.259866*a-.311325-.005916*11*r))),P(r)>E&&0<--i);return[t/(.8707+(a=e*e)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),e]},ym.invert=Q_(g0),bm.invert=Q_(function(t){return 2*n0(t)}),xm.invert=function(t,n){return[-n,2*n0(a0(t))-Zf]};var ph=Object.freeze({__proto__:null,geoAlbers:Z_,geoAlbersUsa:
|
|
5315
5312
|
// A composite projection for the United States, configured by default for
|
|
5316
5313
|
// 960×500. The projection also works quite well at 960×600 if you change the
|
|
5317
5314
|
// scale to 1285 and adjust the translate accordingly. The set of standard
|
|
5318
5315
|
// parallels for each region comes from USGS, which is published here:
|
|
5319
5316
|
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
|
|
5320
|
-
function(){var n,e,a,r,o,i,s=Z_(),l=X_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),h=X_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(t,n){i=[t,n]}};function c(t){var n=t[0],t=t[1];return i=null,a.point(n,t),i||(r.point(n,t),i)||(o.point(n,t),i)}function g(){return n=e=null,c}return c.invert=function(t){var n=s.scale(),e=s.translate(),i=(t[0]-e[0])/n,e=(t[1]-e[1])/n;return(.12<=e&&e<.234&&-.425<=i&&i<-.214?l:.166<=e&&e<.234&&-.214<=i&&i<-.115?h:s).invert(t)},c.stream=function(t){return n&&e===t?n:(i=[s.stream(e=t),l.stream(t),h.stream(t)],a=i.length,n={point:function(t,n){for(var e=-1;++e<a;)i[e].point(t,n)},sphere:function(){for(var t=-1;++t<a;)i[t].sphere()},lineStart:function(){for(var t=-1;++t<a;)i[t].lineStart()},lineEnd:function(){for(var t=-1;++t<a;)i[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<a;)i[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<a;)i[t].polygonEnd()}});var i,a},c.precision=function(t){return arguments.length?(s.precision(t),l.precision(t),h.precision(t),g()):s.precision()},c.scale=function(t){return arguments.length?(s.scale(t),l.scale(.35*t),h.scale(t),c.translate(s.translate())):s.scale()},c.translate=function(t){var n,e,i;return arguments.length?(n=s.scale(),e=+t[0],i=+t[1],a=s.translate(t).clipExtent([[e-.455*n,i-.238*n],[e+.455*n,i+.238*n]]).stream(u),r=l.translate([e-.307*n,i+.201*n]).clipExtent([[e-.425*n+E,i+.12*n+E],[e-.214*n-E,i+.234*n-E]]).stream(u),o=h.translate([e-.205*n,i+.212*n]).clipExtent([[e-.214*n+E,i+.166*n+E],[e-.115*n-E,i+.234*n-E]]).stream(u),g()):s.translate()},c.fitExtent=function(t,n){return R_(c,t,n)},c.fitSize=function(t,n){return I_(c,t,n)},c.fitWidth=function(t,n){return F_(c,t,n)},c.fitHeight=function(t,n){return H_(c,t,n)},c.scale(1070)},geoArea:function(t){return R0=new Gi,b0(t,I0),2*R0},geoAzimuthalEqualArea:function(){return d(tm).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:tm,geoAzimuthalEquidistant:function(){return d(nm).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:nm,geoBounds:k1,geoCentroid:D1,geoCircle:$1,geoClipAntimeridian:ap,geoClipCircle:rp,geoClipExtent:function(){var n,e,i,a=0,r=0,o=960,s=500;return i={stream:function(t){return n&&e===t?n:n=gp(a,r,o,s)(e=t)},extent:function(t){return arguments.length?(a=+t[0][0],r=+t[0][1],o=+t[1][0],s=+t[1][1],n=e=null,i):[[a,r],[o,s]]}}},geoClipRectangle:gp,geoConicConformal:function(){return V_(rm).scale(109.5).parallels([30,30])},geoConicConformalRaw:rm,geoConicEqualArea:X_,geoConicEqualAreaRaw:Y_,geoConicEquidistant:function(){return V_(lm).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:lm,geoContains:function(t,n){return(t&&xp.hasOwnProperty(t.type)?xp[t.type]:Sp)(t,n)},geoDistance:bp,geoEqualEarth:function(){return d(fm).scale(177.158)},geoEqualEarthRaw:fm,geoEquirectangular:sm,geoEquirectangularRaw:om,geoGnomonic:_m,geoGnomonicRaw:pm,geoGraticule:
|
|
5317
|
+
function(){var n,e,a,r,o,i,s=Z_(),l=X_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),h=X_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(t,n){i=[t,n]}};function c(t){var n=t[0],t=t[1];return i=null,a.point(n,t),i||(r.point(n,t),i)||(o.point(n,t),i)}function g(){return n=e=null,c}return c.invert=function(t){var n=s.scale(),e=s.translate(),i=(t[0]-e[0])/n,e=(t[1]-e[1])/n;return(.12<=e&&e<.234&&-.425<=i&&i<-.214?l:.166<=e&&e<.234&&-.214<=i&&i<-.115?h:s).invert(t)},c.stream=function(t){return n&&e===t?n:(i=[s.stream(e=t),l.stream(t),h.stream(t)],a=i.length,n={point:function(t,n){for(var e=-1;++e<a;)i[e].point(t,n)},sphere:function(){for(var t=-1;++t<a;)i[t].sphere()},lineStart:function(){for(var t=-1;++t<a;)i[t].lineStart()},lineEnd:function(){for(var t=-1;++t<a;)i[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<a;)i[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<a;)i[t].polygonEnd()}});var i,a},c.precision=function(t){return arguments.length?(s.precision(t),l.precision(t),h.precision(t),g()):s.precision()},c.scale=function(t){return arguments.length?(s.scale(t),l.scale(.35*t),h.scale(t),c.translate(s.translate())):s.scale()},c.translate=function(t){var n,e,i;return arguments.length?(n=s.scale(),e=+t[0],i=+t[1],a=s.translate(t).clipExtent([[e-.455*n,i-.238*n],[e+.455*n,i+.238*n]]).stream(u),r=l.translate([e-.307*n,i+.201*n]).clipExtent([[e-.425*n+E,i+.12*n+E],[e-.214*n-E,i+.234*n-E]]).stream(u),o=h.translate([e-.205*n,i+.212*n]).clipExtent([[e-.214*n+E,i+.166*n+E],[e-.115*n-E,i+.234*n-E]]).stream(u),g()):s.translate()},c.fitExtent=function(t,n){return R_(c,t,n)},c.fitSize=function(t,n){return I_(c,t,n)},c.fitWidth=function(t,n){return F_(c,t,n)},c.fitHeight=function(t,n){return H_(c,t,n)},c.scale(1070)},geoArea:function(t){return R0=new Gi,b0(t,I0),2*R0},geoAzimuthalEqualArea:function(){return d(tm).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:tm,geoAzimuthalEquidistant:function(){return d(nm).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:nm,geoBounds:k1,geoCentroid:D1,geoCircle:$1,geoClipAntimeridian:ap,geoClipCircle:rp,geoClipExtent:function(){var n,e,i,a=0,r=0,o=960,s=500;return i={stream:function(t){return n&&e===t?n:n=gp(a,r,o,s)(e=t)},extent:function(t){return arguments.length?(a=+t[0][0],r=+t[0][1],o=+t[1][0],s=+t[1][1],n=e=null,i):[[a,r],[o,s]]}}},geoClipRectangle:gp,geoConicConformal:function(){return V_(rm).scale(109.5).parallels([30,30])},geoConicConformalRaw:rm,geoConicEqualArea:X_,geoConicEqualAreaRaw:Y_,geoConicEquidistant:function(){return V_(lm).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:lm,geoContains:function(t,n){return(t&&xp.hasOwnProperty(t.type)?xp[t.type]:Sp)(t,n)},geoDistance:bp,geoEqualEarth:function(){return d(fm).scale(177.158)},geoEqualEarthRaw:fm,geoEquirectangular:sm,geoEquirectangularRaw:om,geoGnomonic:_m,geoGnomonicRaw:pm,geoGraticule:Np,geoGraticule10:function(){return Np()()},geoIdentity:function(){var i,a,n,e,r,o,s,l=1,h=0,u=0,c=1,g=1,d=0,f=null,p=1,_=1,m=O_({point:function(t,n){t=b([t,n]);this.stream.point(t[0],t[1])}}),y=jp;function v(){return p=l*c,_=l*g,o=s=null,b}function b(t){var n,e=t[0]*p,t=t[1]*_;return d&&(n=t*i-e*a,e=e*i+t*a,t=n),[e+h,t+u]}return b.invert=function(t){var n,e=t[0]-h,t=t[1]-u;return d&&(n=t*i+e*a,e=e*i-t*a,t=n),[e/p,t/_]},b.stream=function(t){return o&&s===t?o:o=m(y(s=t))},b.postclip=function(t){return arguments.length?(y=t,f=n=e=r=null,v()):y},b.clipExtent=function(t){return arguments.length?(y=null==t?(f=n=e=r=null,jp):gp(f=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),v()):null==f?null:[[f,n],[e,r]]},b.scale=function(t){return arguments.length?(l=+t,v()):l},b.translate=function(t){return arguments.length?(h=+t[0],u=+t[1],v()):[h,u]},b.angle=function(t){return arguments.length?(a=T(d=t%360*N),i=z(d),v()):d*t0},b.reflectX=function(t){return arguments.length?(c=t?-1:1,v()):c<0},b.reflectY=function(t){return arguments.length?(g=t?-1:1,v()):g<0},b.fitExtent=function(t,n){return R_(b,t,n)},b.fitSize=function(t,n){return I_(b,t,n)},b.fitWidth=function(t,n){return F_(b,t,n)},b.fitHeight=function(t,n){return H_(b,t,n)},b},geoInterpolate:Pp,geoLength:mp,geoMercator:function(){return im(em).scale(961/Qf)},geoMercatorRaw:em,geoNaturalEarth1:function(){return d(mm).scale(175.295)},geoNaturalEarth1Raw:mm,geoOrthographic:vm,geoOrthographicRaw:ym,geoPath:function(n,e){let i=3,a=4.5,r,o;function s(t){return t&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),b0(t,r(o))),o.result()}return s.area=function(t){return b0(t,r(Fp)),Fp.result()},s.measure=function(t){return b0(t,r(M_)),M_.result()},s.bounds=function(t){return b0(t,r(Yp)),Yp.result()},s.centroid=function(t){return b0(t,r(h_)),h_.result()},s.projection=function(t){return arguments.length?(r=null==t?(n=null,jp):(n=t).stream,s):n},s.context=function(t){return arguments.length?(o=null==t?(e=null,new L_(i)):new v_(e=t),"function"!=typeof a&&o.pointRadius(a),s):e},s.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(o.pointRadius(+t),+t),s):a},s.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{var n=Math.floor(t);if(!(0<=n))throw new RangeError("invalid digits: "+t);i=n}return null===e&&(o=new L_(i)),s},s.projection(n).digits(i).context(e)},geoProjection:d,geoProjectionMutator:$_,geoRotation:U1,geoStereographic:function(){return d(bm).scale(250).clipAngle(142)},geoStereographicRaw:bm,geoStream:b0,geoTransform:function(t){return{stream:O_(t)}},geoTransverseMercator:function(){var t=im(xm),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],2<t.length?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},geoTransverseMercatorRaw:xm}),L=Math.abs,wm=Math.atan,b=Math.atan2,B=Math.cos,Sm=Math.exp,km=Math.floor,Cm=Math.log,Mm=Math.max,Am=Math.min,zm=Math.pow,Tm=Math.round,y=Math.sign||function(t){return 0<t?1:t<0?-1:0},O=Math.sin,g=Math.tan,D=1e-6,Em=1e-12,j=Math.PI,R=j/2,Nm=j/4,Pm=Math.SQRT1_2,Lm=F(2),Bm=F(j),Om=2*j,m=180/j,x=j/180;function I(t){return 1<t?R:t<-1?-R:Math.asin(t)}function Dm(t){return 1<t?0:t<-1?j:Math.acos(t)}function F(t){return 0<t?Math.sqrt(t):0}function jm(t){return(Sm(t)-Sm(-t))/2}function Rm(t){return(Sm(t)+Sm(-t))/2}function Im(u){var t=g(u/2),c=2*Cm(B(u/2))/(t*t);function n(t,n){var e=B(t),i=B(n),n=O(n),e=i*e,e=-((1-e?Cm((1+e)/2)/(1-e):-.5)+c/(1+e));return[e*i*O(t),e*n]}return n.invert=function(t,n){var e=F(t*t+n*n),i=-u/2,a=50;if(!e)return[0,0];do{var r=i/2,o=B(r),r=O(r),s=r/o,l=-Cm(L(o))}while(i-=s=(2/s*l-c*s-e)/(-l/(r*r)+1-c/(2*o*o))*(o<0?.7:1),L(s)>D&&0<--a);var h=O(i);return[b(t*h,e*B(i)),I(n*h/e)]},n}function Fm(t,n){var e=B(n),i=(i=Dm(e*B(t/=2)))?i/Math.sin(i):1;return[2*e*O(t)*i,O(n)*i]}
|
|
5321
5318
|
// Abort if [x, y] is not within an ellipse centered at [0, 0] with
|
|
5322
5319
|
// semi-major axis pi and semi-minor axis pi/2.
|
|
5323
|
-
function Hm(t){var f=O(t),p=B(t),_=0<=t?1:-1,m=g(_*t),y=(1+f-p)/2;function n(t,n){var e=B(n),i=B(t/=2);return[(1+e)*O(t),(_*n>-b(i,m)-.001?0:10*-_)+y+O(n)*p-(1+e)*f*i]}return n.invert=function(t,n){var e=0,i=0,a=50;do{var r=B(e),o=O(e),s=B(i),l=O(i),h=1+s,u=h*o-t,c=y+l*p-h*f*r-n,g=h*r/2,d=-o*l,h=f*h*o/2,o=p*s+f*r*l,s=d*h-o*g,r=(c*d-u*o)/s/2,l=(u*h-c*g)/s}while(2<L(l)&&(l/=2),e-=r,i-=l,(L(r)>D||L(l)>D)&&0<--a);return _*i>-b(B(e),m)-.001?[2*e,i]:null},n}function Gm(t,n){var n=g(n/2),e=F(1-n*n),i=1+e*B(t/=2),t=O(t)*e/i,e=n/i,n=t*t,i=e*e;return[4/3*t*(3+n-3*i),4/3*e*(3+3*n-i)]}Fm.invert=function(t,n){if(!(j*j+D<t*t+4*n*n)){var e=t,i=n,a=25;do{var r,o=O(e),s=O(e/2),l=B(e/2),h=O(i),u=B(i),c=O(2*i),g=h*h,d=u*u,f=s*s,p=1-d*l*l,p=p?Dm(u*l)*F(r=1/p):r=0,_=2*p*u*s-t,m=p*h-n,y=r*(d*f+p*u*l*g),v=r*(.5*o*c-2*p*h*s),c=.25*r*(c*s-p*h*d*o),s=r*(g*l+p*f*u),h=v*c-s*y;if(!h)break;d=(m*v-_*s)/h,o=(_*c-m*y)/h}while(e-=d,i-=o,(L(d)>D||L(o)>D)&&0<--a);return[e,i]}},Gm.invert=function(t,n){var e,i,a,r,o;return n*=3/8,!(t*=3/8)&&1<L(n)?null:(e=I(o=F(((o=1+t*t+n*n)-F(o*o-4*n*n))/2))/3,o=o?(o=L(n/o),Cm(o+F(o*o-1))/3):(o=L(t),Cm(o+F(o*o+1))/3),i=B(e),r=(a=Rm(o))*a-i*i,[2*y(t)*b(jm(o)*i,.25-r),2*y(n)*b(a*O(e),.25+r)])};var Km=F(8),Um=Cm(1+Lm);function Wm(t,n){var e=L(n);return e<
|
|
5320
|
+
function Hm(t){var f=O(t),p=B(t),_=0<=t?1:-1,m=g(_*t),y=(1+f-p)/2;function n(t,n){var e=B(n),i=B(t/=2);return[(1+e)*O(t),(_*n>-b(i,m)-.001?0:10*-_)+y+O(n)*p-(1+e)*f*i]}return n.invert=function(t,n){var e=0,i=0,a=50;do{var r=B(e),o=O(e),s=B(i),l=O(i),h=1+s,u=h*o-t,c=y+l*p-h*f*r-n,g=h*r/2,d=-o*l,h=f*h*o/2,o=p*s+f*r*l,s=d*h-o*g,r=(c*d-u*o)/s/2,l=(u*h-c*g)/s}while(2<L(l)&&(l/=2),e-=r,i-=l,(L(r)>D||L(l)>D)&&0<--a);return _*i>-b(B(e),m)-.001?[2*e,i]:null},n}function Gm(t,n){var n=g(n/2),e=F(1-n*n),i=1+e*B(t/=2),t=O(t)*e/i,e=n/i,n=t*t,i=e*e;return[4/3*t*(3+n-3*i),4/3*e*(3+3*n-i)]}Fm.invert=function(t,n){if(!(j*j+D<t*t+4*n*n)){var e=t,i=n,a=25;do{var r,o=O(e),s=O(e/2),l=B(e/2),h=O(i),u=B(i),c=O(2*i),g=h*h,d=u*u,f=s*s,p=1-d*l*l,p=p?Dm(u*l)*F(r=1/p):r=0,_=2*p*u*s-t,m=p*h-n,y=r*(d*f+p*u*l*g),v=r*(.5*o*c-2*p*h*s),c=.25*r*(c*s-p*h*d*o),s=r*(g*l+p*f*u),h=v*c-s*y;if(!h)break;d=(m*v-_*s)/h,o=(_*c-m*y)/h}while(e-=d,i-=o,(L(d)>D||L(o)>D)&&0<--a);return[e,i]}},Gm.invert=function(t,n){var e,i,a,r,o;return n*=3/8,!(t*=3/8)&&1<L(n)?null:(e=I(o=F(((o=1+t*t+n*n)-F(o*o-4*n*n))/2))/3,o=o?(o=L(n/o),Cm(o+F(o*o-1))/3):(o=L(t),Cm(o+F(o*o+1))/3),i=B(e),r=(a=Rm(o))*a-i*i,[2*y(t)*b(jm(o)*i,.25-r),2*y(n)*b(a*O(e),.25+r)])};var Km=F(8),Um=Cm(1+Lm);function Wm(t,n){var e=L(n);return e<Nm?[t,Cm(g(Nm+n/2))]:[t*B(e)*(2*Lm-1/O(e)),y(n)*(2*Lm*(e-Nm)-Cm(g(e/2)))]}function qm(t){var s=2*j/t;function n(t,n){var e,i,a,n=nm(t,n);return L(t)>R&&(t=b(n[1],n[0]),e=F(n[0]*n[0]+n[1]*n[1]),i=s*Tm((t-R)/s)+R,a=b(O(t-=i),2-B(t)),// angle relative to lobe end
|
|
5324
5321
|
t=i+I(j/e*O(a))-a,n[0]=e*B(t),n[1]=e*O(t)),n}return n.invert=function(t,n){var e,i,a,r,o=F(t*t+n*n);return R<o&&(r=b(n,t),i=(e=s*Tm((r-R)/s)+R)<r?-1:1,a=o*B(e-r),a=1/g(i*Dm((a-j)/F(j*(j-2*a)+o*o))),r=e+2*wm((a+i*F(a*a-3))/3),t=o*B(r),n=o*O(r)),nm.invert(t,n)},n}function $m(e,i){return 1===(i=arguments.length<2?e:i)?tm:i===1/0?Vm:(t.invert=function(t,n){t=tm.invert(t/e,n);return t[0]*=i,t},t);function t(t,n){t=tm(t/i,n);return t[0]*=e,t}}function Vm(t,n){return[t*B(n)/B(n/=2),2*O(n)]}
|
|
5325
5322
|
// Approximate Newton-Raphson
|
|
5326
5323
|
// Solve f(x) = y, start from x
|
|
@@ -5338,7 +5335,7 @@ g=(L(r)<.5?.5:1)/r;if(e+=h=(s*l-o*f)*g,i+=u=(o*d-s*p)*g,L(h)<y&&L(u)<y)break;//
|
|
|
5338
5335
|
}}return[e,i]}}
|
|
5339
5336
|
// Bertin 1953 as a modified Briesemeister
|
|
5340
5337
|
// https://bl.ocks.org/Fil/5b9ee9636dfb6ffa53443c9006beb642
|
|
5341
|
-
function Zm(){var i=$m(1.68,2);function t(t,n){t+n<-1.4&&(t+=e=(t-n+1.6)*(t+n+1.4)/8,n-=.8*e*O(n+j/2));var e=i(t,n),t=(1-B(t*n))/12;return e[1]<0&&(e[0]*=1+t),0<e[1]&&(e[1]*=1+t/1.5*e[0]*e[0]),e}return t.invert=Xm(t),t}function Jm(t,n){for(var e,i=t*O(n),a=30;n-=e=(n+O(n)-i)/(1+B(n)),L(e)>D&&0<--a;);return n/2}function Qm(e,i,a){function t(t,n){return[e*t*B(n=Jm(a,n)),i*O(n)]}return t.invert=function(t,n){return n=I(n/i),[t/(e*B(n)),I((2*n+O(2*n))/a)]},t}Wm.invert=function(t,n){if((e=L(n))<Um)return[t,2*wm(Sm(n))-R];var e,i=
|
|
5338
|
+
function Zm(){var i=$m(1.68,2);function t(t,n){t+n<-1.4&&(t+=e=(t-n+1.6)*(t+n+1.4)/8,n-=.8*e*O(n+j/2));var e=i(t,n),t=(1-B(t*n))/12;return e[1]<0&&(e[0]*=1+t),0<e[1]&&(e[1]*=1+t/1.5*e[0]*e[0]),e}return t.invert=Xm(t),t}function Jm(t,n){for(var e,i=t*O(n),a=30;n-=e=(n+O(n)-i)/(1+B(n)),L(e)>D&&0<--a;);return n/2}function Qm(e,i,a){function t(t,n){return[e*t*B(n=Jm(a,n)),i*O(n)]}return t.invert=function(t,n){return n=I(n/i),[t/(e*B(n)),I((2*n+O(2*n))/a)]},t}Wm.invert=function(t,n){if((e=L(n))<Um)return[t,2*wm(Sm(n))-R];var e,i=Nm,a=25;do{var r=B(i/2),o=g(i/2)}while(i-=r=(Km*(i-Nm)-Cm(o)-e)/(Km-r*r/(2*o)),L(r)>Em&&0<--a);return[t/(B(i)*(Km-1/O(i))),y(n)*i]},Vm.invert=function(t,n){n=2*I(n/2);return[t*B(n/2)/B(n),n]};var ty=Qm(Lm/R,Lm,j);var ny=2.00276;function ey(t,n){var e=Jm(j,n);return[ny*t/(1/B(n)+1.11072/B(e)),(n+Lm*O(e))/ny]}function iy(t){var n=0,e=$_(t),t=e(n);return t.parallel=function(t){return arguments.length?e(n=t*x):n*m},t}function ay(t,n){return[t*B(n),n]}function ry(a){var r;return a?(r=1/g(a),t.invert=function(t,n){var e=F(t*t+(n=r-n)*n),i=r+a-e;return[e/B(i)*b(t,n),i]},t):ay;function t(t,n){var e=r+a-n,t=e&&t*B(n)/e;return[e*O(t),r-e*B(t)]}}function oy(i){function t(t,n){n=R-n,t=n&&t*i*O(n)/n;return[n*O(t)/i,R-n*B(t)]}return t.invert=function(t,n){var t=t*i,n=R-n,e=F(t*t+n*n),t=b(t,n);return[(e?e/O(e):1)*t/i,R-e]},t}ey.invert=function(t,n){for(var e,i,a=ny*n,r=n<0?-Nm:Nm,o=25;i=a-Lm*O(r),r-=e=(O(2*r)+2*r-j*O(i))/(2*B(2*r)+2+j*B(i)*Lm*B(r)),L(e)>D&&0<--o;);return i=a-Lm*O(r),[t*(1/B(i)+1.11072/B(r))/ny,i]},ay.invert=function(t,n){return[t/B(n),n]};var sy=Qm(1,4/j,j);
|
|
5342
5339
|
// Azimuthal distance.
|
|
5343
5340
|
function ly(t,n,e,i,a,r){var o=B(r);return t=1<L(t)||1<L(r)?Dm(e*a+n*i*o):2*I(F((t=O(t/2))*t+n*i*(t=O(r/2))*t)),L(t)>D?[t,b(i*O(r),n*a-e*i*o)]:[0,0]}
|
|
5344
5341
|
// Angle opposite a, and contained between sides of lengths b and c.
|
|
@@ -5348,7 +5345,7 @@ function uy(t,n,e){for(var i,h=[[t[0],t[1],O(t[1]),B(t[1])],[n[0],n[1],O(n[1]),B
|
|
|
5348
5345
|
// Compute distance and azimuth from control points.
|
|
5349
5346
|
for(var e=O(n),i=B(n),a=new Array(3),r=0;r<3;++r){var o=h[r];if(a[r]=ly(n-o[1],o[3],o[2],i,e,t-o[0]),!a[r][0])return o.point;a[r][1]=(o=a[r][1]-o.v[1])-2*j*km((o+j)/(2*j))}
|
|
5350
5347
|
// Arithmetic mean of interception points.
|
|
5351
|
-
var s=g.slice();for(r=0;r<3;++r){var l=2==r?0:r+1,l=hy(h[r].v[0],a[r][0],a[l][0]);a[r][1]<0&&(l=-l),r?1==r?(s[0]-=a[r][0]*B(l=u-l),s[1]-=a[r][0]*O(l)):(s[0]+=a[r][0]*B(l=c-l),s[1]+=a[r][0]*O(l)):(s[0]+=a[r][0]*B(l),s[1]-=a[r][0]*O(l))}return s[0]/=3,s[1]/=3,s}}function cy(t){return t[0]*=x,t[1]*=x,t}function gy(t,n,e){var i=D1({type:"MultiPoint",coordinates:[t,n,e]}),i=[-i[0],-i[1]],a=U1(i),t=uy(cy(a(t)),cy(a(n)),cy(a(e))),n=(t.invert=Xm(t),d(t).rotate(i)),r=n.center;return delete n.rotate,n.center=function(t){return arguments.length?r(a(t)):a.invert(r())},n.clipAngle(90)}function dy(t,n){n=F(1-O(n));return[2/Bm*t*n,Bm*(1-n)]}function fy(t){var i=g(t);function n(t,n){return[t,(t?t/O(t):1)*(O(n)*B(t)-i*B(n))]}return n.invert=i?function(t,n){t&&(n*=O(t)/t);var e=B(t);return[t,2*b(F(e*e+i*i-n*n)-e,i-n)]}:function(t,n){return[t,I(t?n*g(t)/t:n)]},n}dy.invert=function(t,n){n=(n=n/Bm-1)*n;return[0<n?t*F(j/n)/2:0,I(1-n)]};var py=F(3);function _y(t,n){return[py*t*(2*B(2*n/3)-1)/Bm,py*Bm*O(n/3)]}function my(t){var e=B(t);function n(t,n){return[t*e,O(n)/e]}return n.invert=function(t,n){return[t/e,I(n*e)]},n}function yy(t){var e=B(t);function n(t,n){return[t*e,(1+e)*g(n/2)]}return n.invert=function(t,n){return[t/e,2*wm(n/(1+e))]},n}function vy(t,n){var e=F(8/(3*j));return[e*t*(1-L(n)/j),e*n]}function by(t,n){var e=F(4-3*O(L(n)));return[2/F(6*j)*t*e,y(n)*F(2*j/3)*(2-e)]}function xy(t,n){var e=F(j*(4+j));return[2/e*t*(1+F(1-4*n*n/(j*j))),4/e*n]}function wy(t,n){var e=(2+R)*O(n);n/=2;for(var i=0,a=1/0;i<10&&L(a)>D;i++){var r=B(n);n-=a=(n+O(n)*(r+2)-e)/(2*r*(1+r))}return[2/F(j*(4+j))*t*(1+B(n)),2*F(j/(4+j))*O(n)]}function Sy(t,n){return[t*(1+B(n))/F(2+j),2*n/F(2+j)]}function ky(t,n){for(var e=(1+R)*O(n),i=0,a=1/0;i<10&&L(a)>D;i++)n-=a=(n+O(n)-e)/(1+B(n));return e=F(2+j),[t*(1+B(n))/e,2*n/e]}_y.invert=function(t,n){n=3*I(n/(py*Bm));return[Bm*t/(py*(2*B(2*n/3)-1)),n]},vy.invert=function(t,n){var e=F(8/(3*j)),n=n/e;return[t/(e*(1-L(n)/j)),n]},by.invert=function(t,n){var e=2-L(n)/F(2*j/3);return[t*F(6*j)/(2*e),y(n)*I((4-e*e)/3)]},xy.invert=function(t,n){var e=F(j*(4+j))/2;return[t*e/(1+F(1-n*n*(4+j)/(4*j))),n*e/2]},wy.invert=function(t,n){var n=n*F((4+j)/j)/2,e=I(n),i=B(e);return[t/(2/F(j*(4+j))*(1+i)),I((e+n*(i+2))/(2+R))]},Sy.invert=function(t,n){var e=F(2+j),n=n*e/2;return[e*t/(1+B(n)),n]},ky.invert=function(t,n){var e=1+R,i=F(e/2);return[2*t*i/(1+B(n*=i)),I((n+O(n))/e)]};var Cy=3+2*Lm;function My(t,n){var e=O(t/=2),t=B(t),i=F(B(n)),a=B(n/=2),n=O(n)/(a+Lm*t*i),r=F(2/(1+n*n)),a=F((Lm*a+(t+e)*i)/(Lm*a+(t-e)*i));return[Cy*(r*(a-1/a)-2*Cm(a)),Cy*(r*n*(a+1/a)-2*wm(n))]}My.invert=function(t,n){if(!(e=Gm.invert(t/1.2,1.065*n)))return null;var e,i=e[0],a=e[1],r=20;t/=Cy,n/=Cy;do{var o=i/2,s=a/2,l=O(o),o=B(o),h=O(s),s=B(s),u=B(a),c=F(u),g=h/(s+Lm*o*c),d=g*g,f=F(2/(1+d)),p=(Lm*s+(o+l)*c)/(Lm*s+(o-l)*c),_=F(p),m=_-1/_,y=_+1/_,v=f*m-2*Cm(_)-t,b=f*g*y-2*wm(g)-n,x=h&&
|
|
5348
|
+
var s=g.slice();for(r=0;r<3;++r){var l=2==r?0:r+1,l=hy(h[r].v[0],a[r][0],a[l][0]);a[r][1]<0&&(l=-l),r?1==r?(s[0]-=a[r][0]*B(l=u-l),s[1]-=a[r][0]*O(l)):(s[0]+=a[r][0]*B(l=c-l),s[1]+=a[r][0]*O(l)):(s[0]+=a[r][0]*B(l),s[1]-=a[r][0]*O(l))}return s[0]/=3,s[1]/=3,s}}function cy(t){return t[0]*=x,t[1]*=x,t}function gy(t,n,e){var i=D1({type:"MultiPoint",coordinates:[t,n,e]}),i=[-i[0],-i[1]],a=U1(i),t=uy(cy(a(t)),cy(a(n)),cy(a(e))),n=(t.invert=Xm(t),d(t).rotate(i)),r=n.center;return delete n.rotate,n.center=function(t){return arguments.length?r(a(t)):a.invert(r())},n.clipAngle(90)}function dy(t,n){n=F(1-O(n));return[2/Bm*t*n,Bm*(1-n)]}function fy(t){var i=g(t);function n(t,n){return[t,(t?t/O(t):1)*(O(n)*B(t)-i*B(n))]}return n.invert=i?function(t,n){t&&(n*=O(t)/t);var e=B(t);return[t,2*b(F(e*e+i*i-n*n)-e,i-n)]}:function(t,n){return[t,I(t?n*g(t)/t:n)]},n}dy.invert=function(t,n){n=(n=n/Bm-1)*n;return[0<n?t*F(j/n)/2:0,I(1-n)]};var py=F(3);function _y(t,n){return[py*t*(2*B(2*n/3)-1)/Bm,py*Bm*O(n/3)]}function my(t){var e=B(t);function n(t,n){return[t*e,O(n)/e]}return n.invert=function(t,n){return[t/e,I(n*e)]},n}function yy(t){var e=B(t);function n(t,n){return[t*e,(1+e)*g(n/2)]}return n.invert=function(t,n){return[t/e,2*wm(n/(1+e))]},n}function vy(t,n){var e=F(8/(3*j));return[e*t*(1-L(n)/j),e*n]}function by(t,n){var e=F(4-3*O(L(n)));return[2/F(6*j)*t*e,y(n)*F(2*j/3)*(2-e)]}function xy(t,n){var e=F(j*(4+j));return[2/e*t*(1+F(1-4*n*n/(j*j))),4/e*n]}function wy(t,n){var e=(2+R)*O(n);n/=2;for(var i=0,a=1/0;i<10&&L(a)>D;i++){var r=B(n);n-=a=(n+O(n)*(r+2)-e)/(2*r*(1+r))}return[2/F(j*(4+j))*t*(1+B(n)),2*F(j/(4+j))*O(n)]}function Sy(t,n){return[t*(1+B(n))/F(2+j),2*n/F(2+j)]}function ky(t,n){for(var e=(1+R)*O(n),i=0,a=1/0;i<10&&L(a)>D;i++)n-=a=(n+O(n)-e)/(1+B(n));return e=F(2+j),[t*(1+B(n))/e,2*n/e]}_y.invert=function(t,n){n=3*I(n/(py*Bm));return[Bm*t/(py*(2*B(2*n/3)-1)),n]},vy.invert=function(t,n){var e=F(8/(3*j)),n=n/e;return[t/(e*(1-L(n)/j)),n]},by.invert=function(t,n){var e=2-L(n)/F(2*j/3);return[t*F(6*j)/(2*e),y(n)*I((4-e*e)/3)]},xy.invert=function(t,n){var e=F(j*(4+j))/2;return[t*e/(1+F(1-n*n*(4+j)/(4*j))),n*e/2]},wy.invert=function(t,n){var n=n*F((4+j)/j)/2,e=I(n),i=B(e);return[t/(2/F(j*(4+j))*(1+i)),I((e+n*(i+2))/(2+R))]},Sy.invert=function(t,n){var e=F(2+j),n=n*e/2;return[e*t/(1+B(n)),n]},ky.invert=function(t,n){var e=1+R,i=F(e/2);return[2*t*i/(1+B(n*=i)),I((n+O(n))/e)]};var Cy=3+2*Lm;function My(t,n){var e=O(t/=2),t=B(t),i=F(B(n)),a=B(n/=2),n=O(n)/(a+Lm*t*i),r=F(2/(1+n*n)),a=F((Lm*a+(t+e)*i)/(Lm*a+(t-e)*i));return[Cy*(r*(a-1/a)-2*Cm(a)),Cy*(r*n*(a+1/a)-2*wm(n))]}My.invert=function(t,n){if(!(e=Gm.invert(t/1.2,1.065*n)))return null;var e,i=e[0],a=e[1],r=20;t/=Cy,n/=Cy;do{var o=i/2,s=a/2,l=O(o),o=B(o),h=O(s),s=B(s),u=B(a),c=F(u),g=h/(s+Lm*o*c),d=g*g,f=F(2/(1+d)),p=(Lm*s+(o+l)*c)/(Lm*s+(o-l)*c),_=F(p),m=_-1/_,y=_+1/_,v=f*m-2*Cm(_)-t,b=f*g*y-2*wm(g)-n,x=h&&Pm*c*l*d/h,w=(Lm*o*s+c)/(2*(s+Lm*o*c)*(s+Lm*o*c)*c),S=-.5*g*f*f*f,k=S*x,S=S*w,C=(C=2*s+Lm*c*(o-l))*C*_,o=(Lm*o*s*c+u)/C,s=-Lm*l*h/(c*C),u=m*k-2*o/_+f*(o+o/p),l=m*S-2*s/_+f*(s+s/p),h=g*y*k-2*x/(1+d)+f*y*x+f*g*(o-o/p),c=g*y*S-2*w/(1+d)+f*y*w+f*g*(s-s/p),C=l*h-c*u;if(!C)break;m=(b*l-v*c)/C,_=(v*h-b*u)/C}while(i-=m,a=Mm(-R,Am(R,a-_)),(L(m)>D||L(_)>D)&&0<--r);return L(L(a)-R)<D?[0,a]:r&&[i,a]};var Ay=B(35*x);function zy(t,n){n=g(n/2);return[t*Ay*F(1-n*n),(1+Ay)*n]}function Ty(t,n){var e=n/2,i=B(e);return[2*t/Bm*B(n)*i*i,Bm*g(e)]}function Ey(a){var r=1-a,t=i(j,0)[0]-i(-j,0)[0],e=F(2*(i(0,R)[1]-i(0,-R)[1])/t);function i(t,n){var e=B(n),i=O(n);return[e/(r+a*e)*t,r*n+a*i]}function n(t,n){t=i(t,n);return[t[0]*e,t[1]/e]}function o(t){return n(0,t)[1]}return n.invert=function(t,n){n=Ym(o,n);return[t/e*(a+r/B(n)),n]},n}function Ny(t){return[t[0]/2,I(g(t[1]/2*x))*m]}function Py(t){return[2*t[0],2*wm(O(t[1]*x))*m]}function Ly(m,t){var y=2*j/t,v=m*m;function n(t,n){var t=nm(t,n),e=t[0],n=t[1],i=e*e+n*n;if(v<i){for(var a,r=F(i),i=b(n,e),o=y*Tm(i/y),i=i-o,s=m*B(i),l=(m*O(i)-i*O(s))/(R-s),h=By(i,l),u=(j-m)/Oy(h,s,j),e=r,c=50;e-=a=(m+Oy(h,s,e)*u-r)/(h(e)*u),L(a)>D&&0<--c;);n=i*O(e),e<R&&(n-=l*(e-R));i=O(o),l=B(o);t[0]=e*l-n*i,t[1]=e*i+n*l}return t}return n.invert=function(t,n){var e=t*t+n*n;if(v<e){for(var e=F(e),i=b(n,t),a=y*Tm(i/y),r=i-a,o=(t=e*B(r),n=e*O(r),t-R),s=O(t),l=n/s,h=t<R?1/0:0,u=10;;){var c=m*O(l),g=m*B(l),d=O(g),f=R-g,p=(c-l*d)/f,_=By(l,p);if(L(h)<Em||!--u)break;l-=h=(l*s-p*o-n)/(s-2*o*(f*(g+l*c*B(g)-d)-c*(c-l*d))/(f*f))}t=(e=m+Oy(_,g,t)*(j-m)/Oy(_,g,j))*B(i=a+l),n=e*O(i)}return nm.invert(t,n)},n}function By(e,i){return function(t){var n=e*B(t);return t<R&&(n-=i),F(1+n*n)}}
|
|
5352
5349
|
// Numerical integration: trapezoidal rule.
|
|
5353
5350
|
function Oy(t,n,e){for(var i=(e-n)/50,a=t(n)+t(e),r=1,o=n;r<50;++r)a+=2*t(o+=i);return.5*a*i}function Dy(m,y,v,b,x,w,S,k){function t(t,n){var e,i,a;return n?(a=t*I((i=m+(e=n*n)*(y+e*(v+e*b)))/(i=(i*i+(i=n*(x-1+e*(w-k+e*S)))*i)/(2*i)))/j,[i*O(a),n*(1+e*k)+i*(1-B(a))]):[m*t/j,0]}return arguments.length<8&&(k=0),t.invert=function(t,n){var e=j*t/m,i=n,a=50;do{var r=i*i,o=m+r*(y+r*(v+r*b)),s=i*(x-1+r*(w-k+r*S)),l=o*o+s*s,h=2*s,u=l/h,c=u*u,g=I(o/u)/j,d=e*g,f=o*o,p=(2*y+r*(4*v+6*r*b))*i,_=x+r*(3*w+5*r*S),s=(2*(o*p+s*(_-1))*h-l*(2*(_-1)))/(h*h),l=B(d),_=O(d),h=u*l,d=u*_,f=e/j*(1/F(1-f/c))*(p*u-o*s)/c,p=d-t,o=i*(1+r*k)+u-h-n,c=s*_+h*f,r=h*g,u=1+s-(s*l-d*f),_=d*g,h=c*_-u*r}while(h&&(e-=s=(o*c-p*u)/h,i-=l=(p*_-o*r)/h,(L(s)>D||L(l)>D)&&0<--a));return[e,i]},t}zy.invert=function(t,n){n/=1+Ay;return[t&&t/(Ay*F(1-n*n)),2*wm(n)]},Ty.invert=function(t,n){var n=wm(n/Bm),e=B(n),n=2*n;return[t*Bm/2/(B(n)*e*e),n]};var jy=Dy(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555);var Ry=Dy(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742);var Iy=Dy(5/6*j,-.62636,-.0344,0,1.3493,-.05524,0,.045);function Fy(t,n){var e=t*t,i=n*n;return[t*(1-.162388*i)*(.87-952426e-9*e*e),n*(1+i/12)]}Fy.invert=function(t,n){var e,i=t,a=n,r=50;do{var o=a*a}while(a-=e=(a*(1+o/12)-n)/(1+o/4),L(e)>D&&0<--r);r=50,t/=1-.162388*o;do{var s=(s=i*i)*s}while(i-=e=(i*(.87-952426e-9*s)-t)/(.87-.00476213*s),L(e)>D&&0<--r);return[i,a]};var Hy=Dy(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);function Gy(i){var a=i(R,0)[0]-i(-R,0)[0];function t(t,n){var e=0<t?-.5:.5,t=i(t+e*j,n);return t[0]-=e*a,t}return i.invert&&(t.invert=function(t,n){var e=0<t?-.5:.5,t=i.invert(t+e*a,n),n=t[0]-e*j;return n<-j?n+=2*j:j<n&&(n-=2*j),t[0]=n,t}),t}function Ky(t,n){var e=y(t),i=y(n),a=B(n),r=B(t)*a,a=O(t)*a,o=O(i*n),a=(t=L(b(a,o)),n=I(r),L(t-R)>D&&(t%=R),((t,n)=>{if(n===R)return[0,0];var e,i,a=O(n),r=a*a,o=r*r,s=1+o,l=1+3*o,h=1-o,u=I(1/F(s)),c=h+r*s*u,g=(1-a)/c,d=F(g),f=g*s,p=F(f),_=d*h;if(0===t)return[0,-(_+r*p)];var m=B(n),y=1/m,v=2*a*m,b=-y*v,x=-y*(r*s*(m=(-c*m-(-3*r+u*l)*v*(1-a))/(c*c))+g*l*v),w=-2*y*(.5*m/d*h-2*r*d*v),S=4*t/j;
|
|
5354
5351
|
// Slower but accurate bisection method.
|
|
@@ -5359,7 +5356,7 @@ function Uy(t,n){var e,i,a,r;if(n<D)return[(a=O(t))-(e=n*(t-a*(h=B(t)))/4)*h,h+e
|
|
|
5359
5356
|
// See Abramowitz and Stegun, 17.4.11.
|
|
5360
5357
|
// Calculate F(phi|m) where m = k² = sin²α.
|
|
5361
5358
|
// See Abramowitz and Stegun, 17.6.7.
|
|
5362
|
-
function Wy(t,n){if(!n)return t;if(1===n)return Cm(g(t/2+
|
|
5359
|
+
function Wy(t,n){if(!n)return t;if(1===n)return Cm(g(t/2+Nm));for(var e,i=1,a=F(1-n),r=F(n),o=0;L(r)>D;o++)t%j?((e=wm(a*g(t)/i))<0&&(e+=j),t+=e+~~(t/j)*j):t+=t,r=(i+a)/2,a=F(i*a),r=((i=r)-a)/2;return t/(zm(2,o)*i)}function qy(t,n){var e,i=(Lm-1)/(Lm+1),a=F(1-i*i),r=Wy(R,a*a),o=Cm(g(j/4+L(n)/2)),o=Sm(-1*o)/F(i),i=(i=o*B(-1*t),o=o*O(-1*t),t=o+1,[.5*((0<=i?R:-R)-b(o=1-(s=i*i)-o*o,2*i)),-.25*Cm(o*o+4*s)+.5*Cm(t*t+s)]),s=(o=i[1],t=a*a,a=L(s=i[0]),i=jm(L(o)),a?(e=1/O(a),e=(-(e=-((a=1/(g(a)*g(a)))+t*(i*i*e*e)-1+t))+F(e*e-4*((t-1)*a)))/2,[Wy(wm(1/F(e)),t)*y(s),Wy(wm(F((e/a-1)/t)),1-t)*y(o)]):[0,Wy(wm(i),1-t)*y(o)]);return[-s[1],(0<=n?1:-1)*(.5*r-s[0])]}function $y(t){var h=O(t),o=B(t),u=Vy(t);function n(t,n){var e=u(t,n),e=(t=e[0],O(n=e[1])),n=B(n),i=B(t),a=Dm(h*e+o*n*i),r=O(a),a=L(r)>D?a/r:1;return[a*o*O(t),(L(t)>R?a:-a)*(h*n-o*e*i)]}return u.invert=Vy(-t),n.invert=function(t,n){var e=F(t*t+n*n),i=-O(e),a=B(e),r=e*a,o=-n*i,s=e*h,l=F(r*r+o*o-s*s),o=b(r*s+o*l,o*s-r*l),s=(R<e?-1:1)*b(t*i,e*B(o)*a+n*O(o)*i);return u.invert(s,o)},n}
|
|
5363
5360
|
// Latitudinal rotation by phi0.
|
|
5364
5361
|
// Temporary hack until D3 supports arbitrary small-circle clipping origins.
|
|
5365
5362
|
function Vy(t){var a=O(t),r=B(t);return function(t,n){var e=B(n),i=B(t)*e,t=O(t)*e,e=O(n);return[b(t,i*r-e*a),I(e*r+i*a)]}}Ky.invert=function(t,n){1<L(t)&&(t=2*y(t)-t),1<L(n)&&(n=2*y(n)-n);var e=y(t),i=y(n),t=-e*t,n=-i*n,a=n/t<1,t=((t,n)=>{for(var e,i,a,r,o=0,s=1,l=.5,h=50;;){var u=l*l,c=F(l),g=I(1/F(1+u)),d=1-u+l*(1+u)*g,f=(1-c)/d,p=F(f),_=f*(1+u),m=p*(1-u),y=F(_-t*t),m=n+m+l*y;if(L(s-o)<Em||0==--h||0===m)break;0<m?o=l:s=l,l=.5*(o+s)}return h?(e=I(c),a=B(e),[j/4*(t*(-2*(i=1/a)*((1-u)*(.5*(r=(-d*a-(1-c)*((-3*l+g*(1+3*u))*(a=2*c*a)))/(d*d))/p)-2*l*p*a)+-i*a*y)+-i*(l*(1+u)*r+f*(1+3*u)*a)*I(t/F(_))),e]):null})(a?n:t,a?t:n),n=t[0],t=t[1],r=B(t);return[e*(b(O(n=a?-R-n:n)*r,-O(t))+j),i*I(B(n)*r)]},qy.invert=function(t,n){var e=(Lm-1)/(Lm+1),i=F(1-e*e),a=Wy(R,i*i),n=(t=-t,i=i*i,(a=.5*a-n)?(a=Uy(a,i),t?(n=(r=Uy(t,1-i))[1]*r[1]+i*a[0]*a[0]*r[0]*r[0],[[a[0]*r[2]/n,a[1]*a[2]*r[0]*r[1]/n],[a[1]*r[1]/n,-a[0]*a[2]*r[0]*r[2]/n],[a[2]*r[1]*r[2]/n,-i*a[0]*a[1]*r[0]/n]]):[[a[0],0],[a[1],0],[a[2],0]]):[[0,(r=Uy(t,1-i))[0]/r[1]],[1/r[1],0],[r[2]/r[1],0]]),r=(a=n[0],i=(t=n[1])[0]*t[0]+t[1]*t[1],[(a[0]*t[0]+a[1]*t[1])/i,(a[1]*t[0]-a[0]*t[1])/i]);return[b(r[1],r[0])/-1,2*wm(Sm(-.5*Cm(e*r[0]*r[0]+e*r[1]*r[1])))-R]};var Yy=I(1-1/3)*m,Xy=my(0);function Zy(r){var o=Yy*x,s=dy(j,o)[0]-dy(-j,o)[0],l=Xy(0,o)[1],h=dy(0,o)[1],u=Bm-h,c=Om/r,g=4/Om,d=l+u*u*4/Om;function t(t,n){var e,i,a=L(n);return o<a?(i=Am(r-1,Mm(0,km((t+j)/c))),(e=dy(t+=j*(r-1)/r-i*c,a))[0]=e[0]*Om/s-Om*(r-1)/(2*r)+i*Om/r,e[1]=l+4*(e[1]-h)*u/Om,n<0&&(e[1]=-e[1])):e=Xy(t,n),e[0]*=g,e[1]/=d,e}return t.invert=function(t,n){t/=g;var e,i=L(n*=d);return l<i?(e=Am(r-1,Mm(0,km((t+j)/c))),t=(t+j*(r-1)/r-e*c)*s/Om,(i=dy.invert(t,.25*(i-l)*Om/u+h))[0]-=j*(r-1)/r-e*c,n<0&&(i[1]=-i[1]),i):Xy.invert(t,n)},t}function Jy(t,n){return[t,1&n?90-D:Yy]}function Qy(t,n){return[t,1&n?-90+D:-Yy]}function tv(t){return[t[0]*(1-D),t[1]]}function nv(c){var g,d=1+c,f=I(O(1/d)),p=2*F(j/(g=j+4*f*d)),_=.5*p*(d+F(c*(2+c))),m=c*c,y=d*d;function t(t,n){var e,i,a=1-O(n);if(a&&a<2){var r=R-n,o=25;do{var s=O(r),l=B(r),h=f+b(s,d-l),u=1+y-2*d*l}while(r-=l=(r-m*f-d*s+u*h-.5*a*g)/(2*d*s*h),L(l)>Em&&0<--o);e=p*F(u),i=t*h/j}else e=p*(c+a),i=t*f/j;return[e*O(i),_-e*B(i)]}return t.invert=function(t,n){var n=t*t+(n-=_)*n,e=(1+y-n/(p*p))/(2*d),i=Dm(e),a=O(i),r=f+b(a,d-e);return[I(t/F(n))*j/r,I(1-2*(i-m*f-d*a+(1+y-2*d*e)*r)/g)]},t}var ev=.7109889596207567,iv=.0528035274542;function av(t,n){return-.7109889596207567<n?((t=ty(t,n))[1]+=iv,t):ay(t,n)}function rv(t,n){return L(n)>ev?((t=ty(t,n))[1]-=0<n?iv:-.0528035274542,t):ay(t,n)}function ov(n,e,i,t){var a=F(4*j/(2*i+(1+n-e/2)*O(2*i)+(n+e)/2*O(4*i)+e/2*O(6*i))),r=F(t*O(i)*F((1+n*B(2*i)+e*B(4*i))/(1+n+e))),o=i*l(1);function s(t){return F(1+n*B(2*t)+e*B(4*t))}function l(t){t*=i;return(2*t+(1+n-e/2)*O(2*t)+(n+e)/2*O(4*t)+e/2*O(6*t))/i}function h(t){return s(t)*O(t)}var u=function(t,n){var e=i*Ym(l,o*O(n)/i,n/j),n=(isNaN(e)&&(e=i*y(n)),a*s(e));return[n*r*t/j*B(e),n/r*O(e)]};return u.invert=function(t,n){n=Ym(h,n*r/a);return[t*j/(B(n)*a*r*s(n)),I(i*l(n/i)/o)]},0===i&&(a=F(t/j),(u=function(t,n){return[t*a,O(n)/a]}).invert=function(t,n){return[t/a,I(n*a)]}),u}function sv(t,n,e,i,a){void 0===a&&(a=20);var r=t(n),o=t(.5*(n+e)),s=t(e);
|
|
@@ -5384,7 +5381,7 @@ c.nanEncountered=!0}(t,n,e,r,o,s,(r+4*o+s)*(e-n)/6,i,a,1,{maxDepthCount:0,nanEnc
|
|
|
5384
5381
|
for(var n,e,i,a,r,o,s=[],l=t[0].length,h=0;h<l;++h)e=(n=t[0][h])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(hv([[e+D,i+D],[e+D,a-D],[r-D,a-D],[r-D,o+D]],30));
|
|
5385
5382
|
// Southern Hemisphere
|
|
5386
5383
|
for(h=t[1].length-1;0<=h;--h)e=(n=t[1][h])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(hv([[r-D,o-D],[r-D,a+D],[e+D,a+D],[e+D,i-D]],30));return{type:"Polygon",coordinates:[oa(s)]}})(t),u=t.map(function(t){return t.map(function(t){return[[t[0][0]*x,t[0][1]*x],[t[1][0]*x,t[1][1]*x],[t[2][0]*x,t[2][1]*x]]})}),c=u.map(function(t){return t.map(function(t){var n,e=h(t[0][0],t[0][1])[0],i=h(t[2][0],t[2][1])[0],a=h(t[1][0],t[0][1])[1],t=h(t[1][0],t[1][1])[1];return t<a&&(n=a,a=t,t=n),[[e,a],[i,t]]})}),r):u.map(function(t){return t.map(function(t){return[[t[0][0]*m,t[0][1]*m],[t[1][0]*m,t[1][1]*m],[t[2][0]*m,t[2][1]*m]]})})},null!=u&&r.lobes(u),r}av.invert=function(t,n){return-.7109889596207567<n?ty.invert(t,n-iv):ay.invert(t,n)},rv.invert=function(t,n){return L(n)>ev?ty.invert(t,n+(0<n?iv:-.0528035274542)):ay.invert(t,n)};var cv=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var gv=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var dv=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];var fv=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];var pv=[[[[-180,35],[-30,90],[0,35]],[[0,35],[30,90],[180,35]]],[[[-180,-10],[-102,-90],[-65,-10]],[[-65,-10],[5,-90],[77,-10]],[[77,-10],[103,-90],[180,-10]]]];var _v=[[[[-180,0],[-110,90],[-40,0]],[[-40,0],[0,90],[40,0]],[[40,0],[110,90],[180,0]]],[[[-180,0],[-110,-90],[-40,0]],[[-40,0],[0,-90],[40,0]],[[40,0],[110,-90],[180,0]]]];function mv(t,n){return[3/Om*t*F(j*j/3-n*n),n]}function yv(a){function t(t,n){var e;return L(L(n)-R)<D?[0,n<0?-2:2]:(n=O(n),e=.5*((n=zm((1+n)/(1-n),a/2))+1/n)+B(t*=a),[2*O(t)/e,(n-1/n)/e])}return t.invert=function(t,n){var e,i=L(n);return L(i-2)<D?t?null:[0,y(n)*R]:2<i?null:(i=(t/=2)*t,e=(n/=2)*n,// tanh(nPhi)
|
|
5387
|
-
n=zm((1+(n=2*n/(1+i+e)))/(1-n),1/a),[b(2*t,1-i-e)/a,I((n-1)/(n+1))])},t}mv.invert=function(t,n){return[Om/3*t/F(j*j/3-n*n),n]};var vv=j/Lm;function bv(t,n){return[t*(1+F(B(n)))/2,n/(B(n/2)*B(t/6))]}function xv(t,n){var e=t*t,i=n*n;return[t*(.975534+i*(-.0143059*e-.119161+-.0547009*i)),n*(1.00384+e*(.0802894+-.02855*i+199025e-9*e)+i*(.0998909+-.0491032*i))]}function wv(t,n){return[O(t)/B(n),g(n)*B(t)]}function Sv(a){var r=B(a),o=g(
|
|
5384
|
+
n=zm((1+(n=2*n/(1+i+e)))/(1-n),1/a),[b(2*t,1-i-e)/a,I((n-1)/(n+1))])},t}mv.invert=function(t,n){return[Om/3*t/F(j*j/3-n*n),n]};var vv=j/Lm;function bv(t,n){return[t*(1+F(B(n)))/2,n/(B(n/2)*B(t/6))]}function xv(t,n){var e=t*t,i=n*n;return[t*(.975534+i*(-.0143059*e-.119161+-.0547009*i)),n*(1.00384+e*(.0802894+-.02855*i+199025e-9*e)+i*(.0998909+-.0491032*i))]}function wv(t,n){return[O(t)/B(n),g(n)*B(t)]}function Sv(a){var r=B(a),o=g(Nm+a/2);function t(t,n){var e=n-a,i=L(e)<D?t*r:L(i=Nm+n/2)<D||L(L(i)-R)<D?0:t*e/Cm(g(i)/o);return[i,e]}return t.invert=function(t,n){var e,i=n+a;return[L(n)<D?t/r:L(e=Nm+i/2)<D||L(L(e)-R)<D?0:t*Cm(g(e)/o)/n,i]},t}function kv(t,n){return[t,1.25*Cm(g(Nm+.4*n))]}function Cv(m){var y=m.length-1;function t(t,n){for(var e,i=B(n),a=2/(1+i*B(t)),r=a*i*O(t),o=a*O(n),s=y,l=m[s],h=l[0],u=l[1];0<=--s;)h=(l=m[s])[0]+r*(e=h)-o*u,u=l[1]+r*u+o*e;return[h=r*(e=h)-o*u,u=r*u+o*e]}return t.invert=function(t,n){var e,i,a,r=20,o=t,s=n;do{for(var l,h=y,u=m[h],c=u[0],g=u[1],d=0,f=0;0<=--h;)d=c+o*(l=d)-s*f,f=g+o*f+s*l,c=(u=m[h])[0]+o*(l=c)-s*g,g=u[1]+o*g+s*l;var p,_=(d=c+o*(l=d)-s*f)*d+(f=g+o*f+s*l)*f}while(o-=p=((c=o*(l=c)-s*g-t)*d+(g=o*g+s*l-n)*f)/_,s-=_=(g*d-c*f)/_,L(p)+L(_)>D*D&&0<--r);if(r)return e=F(o*o+s*s),i=2*wm(.5*e),a=O(i),[b(o*a,e*B(i)),e?I(s*a/e):0]},t}bv.invert=function(t,n){var e=L(t),i=L(n),a=D,r=R;i<vv?r*=i/vv:a+=6*Dm(vv/i);for(var o=0;o<25;o++){var s=O(r),l=F(B(r)),h=O(r/2),u=B(r/2),c=O(a/6),g=B(a/6),d=.5*a*(1+l)-e,f=r/(u*g)-i,s=l?-.25*a*s/l:0,l=.5*(1+l),h=(1+.5*r*h/u)/(u*g),u=r/u*(c/6)/(g*g),c=s*u-h*l,g=(d*u-f*l)/c,u=(f*s-d*h)/c;if(r-=g,a-=u,L(g)<D&&L(u)<D)break}return[t<0?-a:a,n<0?-r:r]},xv.invert=function(t,n){var e=y(t)*j,i=n/2,a=50;do{var r=e*e,o=i*i,s=e*i,l=e*(.975534+o*(-.0143059*r-.119161+-.0547009*o))-t,h=i*(1.00384+r*(.0802894+-.02855*o+199025e-9*r)+o*(.0998909+-.0491032*o))-n,u=.975534-o*(.119161+3*r*.0143059+.0547009*o),c=-s*(.238322+.2188036*o+.0286118*r),s=s*(.1605788+7961e-7*r+-.0571*o),r=1.00384+r*(.0802894+199025e-9*r)+o*(3*(.0998909-.02855*r)-.245516*o),o=c*s-r*u,c=(h*c-l*r)/o,r=(l*s-h*u)/o}while(e-=c,i-=r,(L(c)>D||L(r)>D)&&0<--a);return a&&[e,i]},wv.invert=function(t,n){var e=t*t,i=1+n*n,a=e+i,a=t?Pm*F((a-F(a*a-4*e))/e):1/F(i);return[I(t*a),y(n)*Dm(a)]},kv.invert=function(t,n){return[t,2.5*wm(Sm(.8*n))-.625*j]};var Mv=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],Av=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],zv=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],Tv=[[.9245,0],[0,0],[.01943,0]],Ev=[[.721316,0],[0,0],[-.00881625,-.00617325]];function Nv(t,n){var t=d(Cv(t)).rotate(n).clipAngle(90),e=U1(n),i=t.center;return delete t.rotate,t.center=function(t){return arguments.length?i(e(t)):e.invert(i())},t}var Pv=F(6),Lv=F(7);function Bv(t,n){n=I(7*O(n)/(3*Pv));return[Pv*t*(2*B(2*n/3)-1)/Lv,9*O(n/3)/Lv]}function Ov(t,n){for(var e,i=(1+Pm)*O(n),a=n,r=0;r<25&&(a-=e=(O(a/2)+O(a)-i)/(.5*B(a/2)+B(a)),!(L(e)<D));r++);return[t*(1+2*B(a)/B(a/2))/(3*Lm),2*F(3)*O(a/2)/F(2+Lm)]}function Dv(t,n){for(var e,i=F(6/(4+j)),a=(1+j/4)*O(n),r=n/2,o=0;o<25&&(r-=e=(r/2+O(r)-a)/(.5+B(r)),!(L(e)<D));o++);return[i*(.5+B(r))*t/1.5,i*r]}function jv(t,n){var e=n*n,i=e*e,a=e*i;return[t*(.84719-.13063*e+a*a*(.05494*e-.04515-.02326*i+.00331*a)),n*(1.01183+i*i*(.01926*e-.02625-.00396*i))]}function Rv(t,n){return[t*(1+B(n))/2,2*(n-g(n/2))]}Bv.invert=function(t,n){n=3*I(n*Lv/9);return[t*Lv/(Pv*(2*B(2*n/3)-1)),I(3*O(n)*Pv/7)]},Ov.invert=function(t,n){var n=n*F(2+Lm)/(2*F(3)),e=2*I(n);return[3*Lm*t/(1+2*B(e)/B(e/2)),I((n+O(e))/(1+Pm))]},Dv.invert=function(t,n){var e=F(6/(4+j)),n=n/e;return L(L(n)-R)<D&&(n=n<0?-R:R),[1.5*t/(e*(.5+B(n))),I((n/2+O(n))/(1+j/4))]},jv.invert=function(t,n){for(var e,i,a,r=n,o=25;r-=e=(r*(1.01183+(a=(i=r*r)*i)*a*(.01926*i-.02625-.00396*a))-n)/(1.01183+a*a*(.21186*i-.23625+-.05148*a)),L(e)>Em&&0<--o;);return[t/(.84719-.13063*(i=r*r)+(t=i*(a=i*i))*t*(.05494*i-.04515-.02326*a+.00331*t)),r]},Rv.invert=function(t,n){for(var e=n/2,i=0,a=1/0;i<10&&L(a)>D;++i){var r=B(n/2);n-=a=(n-g(n/2)-e)/(1-.5/(r*r))}return[2*t/(1+B(n)),n]};var Iv=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];
|
|
5388
5385
|
// Based on Torben Jansen's implementation
|
|
5389
5386
|
// https://beta.observablehq.com/@toja/nicolosi-globular-projection
|
|
5390
5387
|
// https://beta.observablehq.com/@toja/nicolosi-globular-inverse
|
|
@@ -5421,7 +5418,7 @@ if(t.face){for(var i=e.shared=n2(e.face,t.face),a=Vv(i.map(t.project),i.map(e.pr
|
|
|
5421
5418
|
// TODO
|
|
5422
5419
|
var d=180==g||360==g?[(h[0][0]+h[1][0])/2,(h[0][1]+h[1][1])/2]:D1(l);
|
|
5423
5420
|
// First find the shared edge…
|
|
5424
|
-
if(i)for(;++c<s&&o[c]!==i;);++c;for(var f=0;f<s;++f)r=o[(f+c)%s],Array.isArray(r)?(u||(n.point((a=
|
|
5421
|
+
if(i)for(;++c<s&&o[c]!==i;);++c;for(var f=0;f<s;++f)r=o[(f+c)%s],Array.isArray(r)?(u||(n.point((a=Pp(r[0],d)(D))[0],a[1]),u=!0),n.point((a=Pp(r[1],d)(D))[0],a[1])):(u=!1,r!==i&&t(n,r,e))}
|
|
5425
5422
|
// Tests equality of two spherical points.
|
|
5426
5423
|
(i,a),i.lineEnd(),i.polygonEnd()},e},r.angle(-30)}function t2(t,n){return t&&n&&t[0]===n[0]&&t[1]===n[1]}
|
|
5427
5424
|
// Finds a shared edge given two clockwise polygons.
|
|
@@ -5435,18 +5432,18 @@ function h2(t){return[b(t[1],t[0])*m,I(Mm(-1,Am(1,t[2])))*m]}
|
|
|
5435
5432
|
// Converts spherical coordinates (degrees) to 3D Cartesian.
|
|
5436
5433
|
function u2(t){var n=t[0]*x,t=t[1]*x,e=B(t);return[e*B(n),e*O(n),O(t)]}s2.invert=function(t,n){return dy.invert(t/o2,n)};_n=()=>{};function c2(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return g2(t,n)})}}function g2(t,n){return{type:"Feature",id:t.id,properties:t.properties,geometry:d2(t.geometry,n)}}function d2(t,n){if(!t)return null;if("GeometryCollection"===t.type)return e=n,{type:"GeometryCollection",geometries:t.geometries.map(function(t){return d2(t,e)})};var e,i;switch(t.type){case"Point":case"MultiPoint":i=_2;break;case"LineString":case"MultiLineString":i=m2;break;case"Polygon":case"MultiPolygon":case"Sphere":i=y2;break;default:return null}return b0(t,n(i)),i.result()}var f2=[],p2=[],_2={point:function(t,n){f2.push([t,n])},result:function(){var t=f2.length?f2.length<2?{type:"Point",coordinates:f2[0]}:{type:"MultiPoint",coordinates:f2}:null;return f2=[],t}},m2={lineStart:_n,point:function(t,n){f2.push([t,n])},lineEnd:function(){f2.length&&(p2.push(f2),f2=[])},result:function(){var t=p2.length?p2.length<2?{type:"LineString",coordinates:p2[0]}:{type:"MultiLineString",coordinates:p2}:null;return p2=[],t}},y2={polygonStart:_n,lineStart:_n,point:function(t,n){f2.push([t,n])},lineEnd:function(){var t=f2.length;if(t){for(;f2.push(f2[0].slice()),++t<4;);p2.push(f2),f2=[]}},polygonEnd:_n,result:function(){var i,n;return p2.length&&(i=[],n=[],
|
|
5437
5434
|
// https://github.com/d3/d3/issues/1558
|
|
5438
|
-
p2.forEach(function(t){(t=>{if(!((n=t.length)<4)){for(var n,e=0,i=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)i+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return i<=0}})(t)?i.push([t]):n.push(t)}),n.forEach(function(n){var e=n[0];i.some(function(t){if(((t,n)=>{for(var e=n[0],i=n[1],a=!1,r=0,o=t.length,s=o-1;r<o;s=r++){var l=t[r],h=l[0],l=l[1],u=t[s],c=u[0],u=u[1];i<l^i<u&&e<(c-h)*(i-l)/(u-l)+h&&(a=!a)}return a})(t[0],e))return t.push(n),!0})||i.push([n])}),p2=[],i.length)?1<i.length?{type:"MultiPolygon",coordinates:i}:{type:"Polygon",coordinates:i[0]}:null}};function v2(s){var l=s(R,0)[0]-s(-R,0)[0];function t(t,n){var e,i=L(t)<R,t=s(i?t:0<t?t-j:t+j,n),n=(t[0]-t[1])*
|
|
5435
|
+
p2.forEach(function(t){(t=>{if(!((n=t.length)<4)){for(var n,e=0,i=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)i+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return i<=0}})(t)?i.push([t]):n.push(t)}),n.forEach(function(n){var e=n[0];i.some(function(t){if(((t,n)=>{for(var e=n[0],i=n[1],a=!1,r=0,o=t.length,s=o-1;r<o;s=r++){var l=t[r],h=l[0],l=l[1],u=t[s],c=u[0],u=u[1];i<l^i<u&&e<(c-h)*(i-l)/(u-l)+h&&(a=!a)}return a})(t[0],e))return t.push(n),!0})||i.push([n])}),p2=[],i.length)?1<i.length?{type:"MultiPolygon",coordinates:i}:{type:"Polygon",coordinates:i[0]}:null}};function v2(s){var l=s(R,0)[0]-s(-R,0)[0];function t(t,n){var e,i=L(t)<R,t=s(i?t:0<t?t-j:t+j,n),n=(t[0]-t[1])*Pm,t=(t[0]+t[1])*Pm;return i?[n,t]:(i=l*Pm,[(e=0<n^0<t?-1:1)*n-y(t)*i,e*t-y(n)*i])}return s.invert&&(t.invert=function(t,n){var e,i,a=(t+n)*Pm,r=(n-t)*Pm,o=L(a)<.5*l&&L(r)<.5*l,n=(o||(a=(-(e=-(i=0<a^0<r?-1:1)*t+(0<r?1:-1)*(t=l*Pm))-(i=-i*n+(0<a?1:-1)*t))*Pm,r=(e-i)*Pm),s.invert(a,r));return o||(n[0]+=0<a?j:-j),n}),d(t).rotate([-90,-90,45]).clipAngle(179.999)}function b2(l){var h=O(l);function t(t,n){var e,i,t=h?g(t*h/2)/h:t/2;return n?(e=2*wm(t*O(n)),i=1/g(n),[O(e)*i,n+(1-B(e))*i-l]):[2*t,-l]}
|
|
5439
5436
|
// TODO return null for points outside outline.
|
|
5440
|
-
return t.invert=function(t,n){if(L(n+=l)<D)return[h?2*wm(h*t/2)/h:t,0];var e=t*t+n*n,i=0,a=10;do{var r=g(i),o=1/B(i),s=e-2*n*i+i*i}while(i-=s=(r*s+2*(i-n))/(2+s*o*o+2*(i-n)*r),L(s)>D&&0<--a);t*=r=g(i),t=g(L(n)<L(i+1/r)?.5*I(t):.5*Dm(t)+j/4)/O(i);return[h?2*wm(h*t)/h:2*t,i]},t}var x2=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function w2(t,n){var e=Am(18,36*L(n)/j),i=km(e),e=e-i,a=(l=x2[i])[0],r=l[1],o=(l=x2[++i])[0],s=l[1],i=(l=x2[Am(19,++i)])[0],l=l[1];return[t*(o+e*(i-a)/2+e*e*(i-2*o+a)/2),y(n)*(s+e*(l-r)/2+e*e*(l-2*s+r)/2)]}function S2(i,t){a=i,n.invert=function(t,n){var e=t*t+n*n,i=F(e),e=(a-F(1-e*(a+1)/(a-1)))/((a-1)/i+i/(a-1));return[b(t*e,i*F(1-e*e)),i?I(n*e/i):0]};var a,r,o,s=n;function n(t,n){var e=B(n),i=(a-1)/(a-e*B(t));return[i*e*O(t),i*O(n)]}return t?(r=B(t),o=O(t),e.invert=function(t,n){var e=(i-1)/(i-1-n*o);return s.invert(e*t,e*n*r)},e):s;function e(t,n){var t=s(t,n),n=t[1],e=n*o/(i-1)+r;return[t[0]*r/e,n/e]}}x2.forEach(function(t){t[1]*=1.593415793900743}),w2.invert=function(t,n){var e=Am(18,L((g=90*n)/5)),i=Mm(0,km(e));do{var a=x2[i][1],r=x2[i+1][1],o=x2[Am(19,i+2)][1],s=o-a,l=o-2*r+a,h=2*(L(n)-r)/s,l=l/s,u=h*(1-l*h*(1-2*l*h));if(0<=u||1===i){for(var c,g=(0<=n?5:-5)*(u+e),d=50;u=(e=Am(18,L(g)/5))-(i=km(e)),a=x2[i][1],r=x2[i+1][1],o=x2[Am(19,i+2)][1],g-=(c=y(n)*(r+u*(o-a)/2+u*u*(o-2*r+a)/2)-n)*m,L(c)>Em&&0<--d;);break}}while(0<=--i);var f=x2[i][0],p=x2[i+1][0],_=x2[Am(19,i+2)][0];return[t/(p+u*(_-f)/2+u*u*(_-2*p+f)/2),g*x]};var k2=1e4,C2=-180,M2=C2+1e-4,A2=180,z2=A2-1e-4,T2=-90,E2=T2+1e-4,
|
|
5441
|
-
}function O2(t){var n=t[0],e=t[1],i=!1;return n<=M2?(n=C2,i=!0):z2<=n&&(n=A2,i=!0),e<=E2?(e=T2,i=!0):
|
|
5437
|
+
return t.invert=function(t,n){if(L(n+=l)<D)return[h?2*wm(h*t/2)/h:t,0];var e=t*t+n*n,i=0,a=10;do{var r=g(i),o=1/B(i),s=e-2*n*i+i*i}while(i-=s=(r*s+2*(i-n))/(2+s*o*o+2*(i-n)*r),L(s)>D&&0<--a);t*=r=g(i),t=g(L(n)<L(i+1/r)?.5*I(t):.5*Dm(t)+j/4)/O(i);return[h?2*wm(h*t)/h:2*t,i]},t}var x2=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function w2(t,n){var e=Am(18,36*L(n)/j),i=km(e),e=e-i,a=(l=x2[i])[0],r=l[1],o=(l=x2[++i])[0],s=l[1],i=(l=x2[Am(19,++i)])[0],l=l[1];return[t*(o+e*(i-a)/2+e*e*(i-2*o+a)/2),y(n)*(s+e*(l-r)/2+e*e*(l-2*s+r)/2)]}function S2(i,t){a=i,n.invert=function(t,n){var e=t*t+n*n,i=F(e),e=(a-F(1-e*(a+1)/(a-1)))/((a-1)/i+i/(a-1));return[b(t*e,i*F(1-e*e)),i?I(n*e/i):0]};var a,r,o,s=n;function n(t,n){var e=B(n),i=(a-1)/(a-e*B(t));return[i*e*O(t),i*O(n)]}return t?(r=B(t),o=O(t),e.invert=function(t,n){var e=(i-1)/(i-1-n*o);return s.invert(e*t,e*n*r)},e):s;function e(t,n){var t=s(t,n),n=t[1],e=n*o/(i-1)+r;return[t[0]*r/e,n/e]}}x2.forEach(function(t){t[1]*=1.593415793900743}),w2.invert=function(t,n){var e=Am(18,L((g=90*n)/5)),i=Mm(0,km(e));do{var a=x2[i][1],r=x2[i+1][1],o=x2[Am(19,i+2)][1],s=o-a,l=o-2*r+a,h=2*(L(n)-r)/s,l=l/s,u=h*(1-l*h*(1-2*l*h));if(0<=u||1===i){for(var c,g=(0<=n?5:-5)*(u+e),d=50;u=(e=Am(18,L(g)/5))-(i=km(e)),a=x2[i][1],r=x2[i+1][1],o=x2[Am(19,i+2)][1],g-=(c=y(n)*(r+u*(o-a)/2+u*u*(o-2*r+a)/2)-n)*m,L(c)>Em&&0<--d;);break}}while(0<=--i);var f=x2[i][0],p=x2[i+1][0],_=x2[Am(19,i+2)][0];return[t/(p+u*(_-f)/2+u*u*(_-2*p+f)/2),g*x]};var k2=1e4,C2=-180,M2=C2+1e-4,A2=180,z2=A2-1e-4,T2=-90,E2=T2+1e-4,N2=90,P2=N2-1e-4;function L2(t){return 0<t.length}function B2(t){return t===T2||t===N2?[0,t]:[C2,Math.floor(t*k2)/k2];// pole or antimeridian?
|
|
5438
|
+
}function O2(t){var n=t[0],e=t[1],i=!1;return n<=M2?(n=C2,i=!0):z2<=n&&(n=A2,i=!0),e<=E2?(e=T2,i=!0):P2<=e&&(e=N2,i=!0),i?[n,e]:t}function D2(t){return t.map(O2)}
|
|
5442
5439
|
// For each ring, detect where it crosses the antimeridian or pole.
|
|
5443
5440
|
function j2(t,n,e){for(var i=0,a=t.length;i<a;++i){var r=t[i].slice();
|
|
5444
5441
|
// By default, assume that this ring doesn’t need any stitching.
|
|
5445
5442
|
e.push({index:-1,polygon:n,ring:r});for(var o=0,s=r.length;o<s;++o){var l=r[o],h=l[0],u=l[1];
|
|
5446
5443
|
// If this is an antimeridian or polar point…
|
|
5447
|
-
if(h<=M2||z2<=h||u<=E2||
|
|
5444
|
+
if(h<=M2||z2<=h||u<=E2||P2<=u){r[o]=O2(l);
|
|
5448
5445
|
// Advance through any antimeridian or polar points…
|
|
5449
|
-
for(var c=o+1;c<s;++c){var g=r[c],d=g[0],g=g[1];if(M2<d&&d<z2&&E2<g&&g<
|
|
5446
|
+
for(var c=o+1;c<s;++c){var g=r[c],d=g[0],g=g[1];if(M2<d&&d<z2&&E2<g&&g<P2)break}
|
|
5450
5447
|
// If this was just a single antimeridian or polar point,
|
|
5451
5448
|
// we don’t need to cut this ring into a fragment;
|
|
5452
5449
|
// we can just leave it as-is.
|
|
@@ -5476,11 +5473,11 @@ t[i.index]=null,n={index:-1,polygon:i.polygon,ring:i.ring.concat(n.ring)},i===r?
|
|
|
5476
5473
|
// Connect both ends to this single fragment to create a ring.
|
|
5477
5474
|
n.polygon.push(n.ring):(n.index=o++,t.push(s[n.ring[0]]=l[n.ring[n.ring.length-1]]=n))):r?(delete s[a],delete l[r.ring[r.ring.length-1]],n.ring.pop(),// drop the shared coordinate
|
|
5478
5475
|
n={index:o++,polygon:r.polygon,ring:n.ring.concat(r.ring)},t[r.index]=null,t.push(s[n.ring[0]]=l[n.ring[n.ring.length-1]]=n)):(n.ring.push(n.ring[0]),// close ring
|
|
5479
|
-
n.polygon.push(n.ring)))}function I2(t){var n={type:"Feature",geometry:F2(t.geometry)};return null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),null!=t.properties&&(n.properties=t.properties),n}function F2(t){if(null==t)return t;var n;switch(t.type){case"GeometryCollection":n={type:"GeometryCollection",geometries:t.geometries.map(F2)};break;case"Point":n={type:"Point",coordinates:O2(t.coordinates)};break;case"MultiPoint":case"LineString":n={type:t.type,coordinates:D2(t.coordinates)};break;case"MultiLineString":n={type:"MultiLineString",coordinates:t.coordinates.map(D2)};break;case"Polygon":var e=[];j2(t.coordinates,e,i=[]),R2(i),n={type:"Polygon",coordinates:e};break;case"MultiPolygon":for(var i=[],a=-1,r=t.coordinates.length,o=new Array(r);++a<r;)j2(t.coordinates[a],o[a]=[],i);R2(i),n={type:"MultiPolygon",coordinates:o.filter(L2)};break;default:return t}return null!=t.bbox&&(n.bbox=t.bbox),n}function H2(t,n){var n=g(n/2),e=O(
|
|
5476
|
+
n.polygon.push(n.ring)))}function I2(t){var n={type:"Feature",geometry:F2(t.geometry)};return null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),null!=t.properties&&(n.properties=t.properties),n}function F2(t){if(null==t)return t;var n;switch(t.type){case"GeometryCollection":n={type:"GeometryCollection",geometries:t.geometries.map(F2)};break;case"Point":n={type:"Point",coordinates:O2(t.coordinates)};break;case"MultiPoint":case"LineString":n={type:t.type,coordinates:D2(t.coordinates)};break;case"MultiLineString":n={type:"MultiLineString",coordinates:t.coordinates.map(D2)};break;case"Polygon":var e=[];j2(t.coordinates,e,i=[]),R2(i),n={type:"Polygon",coordinates:e};break;case"MultiPolygon":for(var i=[],a=-1,r=t.coordinates.length,o=new Array(r);++a<r;)j2(t.coordinates[a],o[a]=[],i);R2(i),n={type:"MultiPolygon",coordinates:o.filter(L2)};break;default:return t}return null!=t.bbox&&(n.bbox=t.bbox),n}function H2(t,n){var n=g(n/2),e=O(Nm*n);return[t*(.74482-.34588*e*e),1.70711*n]}
|
|
5480
5477
|
// Compute the origin as the midpoint of the two reference points.
|
|
5481
5478
|
// Rotate one of the reference points by the origin.
|
|
5482
5479
|
// Apply the spherical law of sines to compute gamma rotation.
|
|
5483
|
-
function G2(t,n,e){var e=
|
|
5480
|
+
function G2(t,n,e){var e=Pp(n,e),i=e(.5),n=U1([-i[0],-i[1]])(n),e=e.distance/2,a=-I(O(n[1]*x)/O(e)),i=[-i[0],-i[1],-(0<n[0]?j-a:a)*m],n=d(t(e)).rotate(i),r=U1(i),o=n.center;return delete n.rotate,n.center=function(t){return arguments.length?o(r(t)):r.invert(o())},n.clipAngle(90)}function K2(t){var e=B(t);function n(t,n){t=pm(t,n);return t[0]*=e,t}return n.invert=function(t,n){return pm.invert(t/e,n)},n}function U2(t,n){return G2(K2,t,n)}function W2(i){var r,o,a,s,l;return(i*=2)?(a=i*i,s=g(o=-(r=-i/2)),l=.5/O(o),t.invert=function(t,n){var e,i=n*n,a=B(F(i+(e=t+r)*e)),i=B(F(i+(e=t+o)*e));return[b(t=a-i,e=(a+i)*s),(n<0?-1:1)*Dm(F(e*e+t*t)*l)]},t):nm;function t(t,n){var e=Dm(B(n)*B(t-r)),t=Dm(B(n)*B(t-o));return[((e*=e)-(t*=t))/(2*i),(n<0?-1:1)*F(4*a*t-(a-e+t)*(a-e+t))/(2*i)]}}function q2(t,n){return G2(W2,t,n)}function $2(t,n){var e,i,a,r,o,s,l,h;return L(n)<D?[t,0]:(a=I(r=L(n/R)),L(t)<D||L(L(n)-R)<D?[0,y(n)*j*g(a/2)]:(s=(o=(r=(a=(a=B(a))/(r+a-1))*(2/r-1))*r)+(i=(e=L(j/t-t/j)/2)*e),l=a-o,h=i+a,[y(t)*j*(e*l+F(i*l*l-s*(a*a-o)))/s,y(n)*j*(r*h-e*F((1+i)*s-h*h))/s]))}function V2(t,n){var e,i,a,r;return L(n)<D?[t,0]:(r=I(e=L(n/R)),L(t)<D||L(L(n)-R)<D?[0,y(n)*j*g(r/2)]:(r=(r=B(r))*(F(1+(a=(i=L(j/t-t/j)/2)*i))-i*r)/(1+a*e*e),[y(t)*j*r,y(n)*j*F(1-r*(2*i+r))]))}function Y2(t,n){var e,i;return L(n)<D?[t,0]:(e=I(i=n/R),L(t)<D||L(L(n)-R)<D?[0,j*g(e/2)]:(n=(j/t-t/j)/2,i=i/(1+B(e)),[j*(y(t)*F(n*n+1-i*i)-n),j*i]))}function X2(t,n){var e,i,a,r,o,s,l;return n?(r=L(n),t&&r!==R?(a=(l=(r=r/R)*r)+(e=(o=(8*r-l*(2+l)-5)/(2*l*(r-1)))*o)+2*(i=r*o),r=r+3*o,o=(o=t/R)+1/o,l=((o=y(L(t)-R)*F(o*o-4))*(a+e-1)+2*F(a*(l+e*(s=o*o)-1)+(1-l)*(l*(r*r+4*e)+12*i*e+4*e*e)))/(4*a+s),[y(t)*R*l,y(n)*R*F(1+o*L(l)-l*l)]):[0,n]):[t,0]}function Z2(t,n,e,i){
|
|
5484
5481
|
// 60 is always used as reference parallel
|
|
5485
5482
|
var a,r,o,s,l,h=j/3,e=(
|
|
5486
5483
|
// sanitizing the input values
|
|
@@ -5495,25 +5492,25 @@ e=Mm(e,0),(e=Am(e,100-D))/100+1),i=(
|
|
|
5495
5492
|
// recognized as world map, are e.g. 20 <= ratio <= 1000.
|
|
5496
5493
|
i=Mm(i,D))/100,e=Dm(e*B(h))/h,h=O(t)/O(e*R),u=n/j,i=F(i*O(t/2)/O(n/2)),t=i/F(u*h*e),n=1/(i*F(u*h*e));return a=t,r=n,o=h,s=e,l=u,c.invert=function(t,n){var e=t/a,i=n/r,e=F(e*e+i*i),i=2*I(e/2);return[b(t*g(i),a*e)/l,e&&I(n*O(i)/(r*o*e))/s]},c;function c(t,n){var n=o*O(s*n),e=F(1-n*n),i=F(2/(1+e*B(t*=l)));return[a*e*i*O(t),r*n*i]}}function J2(){
|
|
5497
5494
|
// default values generate wagner8
|
|
5498
|
-
var n=65*x,e=60*x,i=20,a=200,r=$_(Z2),t=r(n,e,i,a);return t.poleline=function(t){return arguments.length?r(n=+t*x,e,i,a):n*m},t.parallels=function(t){return arguments.length?r(n,e=+t*x,i,a):e*m},t.inflation=function(t){return arguments.length?r(n,e,i=+t,a):i},t.ratio=function(t){return arguments.length?r(n,e,i,a=+t):a},t.scale(163.775)}H2.invert=function(t,n){var n=n/1.70711,e=O(
|
|
5495
|
+
var n=65*x,e=60*x,i=20,a=200,r=$_(Z2),t=r(n,e,i,a);return t.poleline=function(t){return arguments.length?r(n=+t*x,e,i,a):n*m},t.parallels=function(t){return arguments.length?r(n,e=+t*x,i,a):e*m},t.inflation=function(t){return arguments.length?r(n,e,i=+t,a):i},t.ratio=function(t){return arguments.length?r(n,e,i,a=+t):a},t.scale(163.775)}H2.invert=function(t,n){var n=n/1.70711,e=O(Nm*n);return[t/(.74482-.34588*e*e),2*wm(n)]},$2.invert=function(t,n){var e,i,a,r,o,s,l,h;return L(n)<D?[t,0]:L(t)<D?[0,R*O(2*wm(n/j))]:(r=(a=(e=(t/=j)*t)+(i=(n/=j)*n))*a,h=Dm(3*(i/(s=-2*(l=-L(n)*(1+a))+1+2*i+r)+(2*(o=l-2*i+e)*o*o/(s*s*s)-9*l*o/(s*s))/27)/((l=(l-o*o/(3*s))/s)*(l=2*F(-l/3))))/3,[j*(a-1+F(1+2*(e-i)+r))/(2*t),y(n)*j*(-l*B(h+j/3)-o/(3*s))])},V2.invert=function(t,n){var e,i,a;return t?(a=F(1+(i=(1-(e=L(t/j))*e-(n/=j)*n)/(2*e))*i),[y(t)*j*(a-i),y(n)*R*O(2*b(F((1-2*i*e)*(i+a)-e),F(a+i+e)))]):[0,R*O(2*wm(n/j))]},Y2.invert=function(t,n){var e;return n?(e=(j*j*(1-(n=n/j)*n)-t*t)/(2*j*t),[t?j*(y(t)*F(e*e+1)-e):0,R*O(2*wm(n))]):[t,0]},X2.invert=function(t,n){if(!t||!n)return[t,n];var e=y(n),i=(n=L(n)/j,y(t)*t/R),a=(i*i-1+4*n*n)/L(i),r=a*a,o=n*(2-(.5<n?Am(n,L(t)):0)),s=t*t+n*n,l=50;do{var h=o*o,u=(8*o-h*(2+h)-5)/(2*h*(o-1)),c=(3*o-h*o-10)/(2*h*o),g=u*u,d=o*u,f=o+u,p=f*f,_=o+3*u,m=-2*f*(4*d*g+(1-4*h+3*h*h)*(1+c)+g*(14*h-6-r+(8*h-8-2*r)*c)+d*(12*h-8+(10*h-10-r)*c)),h=F(p*(h+g*r-1)+(1-h)*(h*(_*_+4*g)+g*(12*d+4*g)))}while(o-=_=(a*(p+g-1)+2*h-i*(4*p+r))/(a*(2*u*c+2*f*(1+c))+m/h-8*f*(a*(g-1+p)+2*h)*(1+c)/(r+4*p)),D<_*s*s&&0<--l);return[y(t)*(F(a*a+4)+a)*j/4,e*R*o]};var pn=4*j+3*F(3),Br=2*F(2*j*F(3)/pn),Q2=Qm(Br*F(3)/j,Br,pn/6);function t3(t,n){return[t*F(1-3*n*n/(j*j)),n]}function n3(t,n){var e=B(n),i=B(t)*e,a=1-i,n=B(t=b(O(t)*e,-O(n))),t=O(t);return[t*(e=F(1-i*i))-n*a,-n*e-t*a]}function e3(t,n){var e=Fm(t,n);return[(e[0]+t/R)/2,(e[1]+n)/2]}t3.invert=function(t,n){return[t/F(1-3*n*n/(j*j)),n]},n3.invert=function(t,n){var e=(t*t+n*n)/-2,i=F(-e*(2+e)),a=n*e+t*i,t=t*e-n*i,n=F(t*t+a*a);return[b(i*a,n*(1+e)),n?-I(i*t/n):0]},e3.invert=function(t,n){var e=t,i=n,a=25;do{var r,o=B(i),s=O(i),l=O(2*i),h=s*s,u=o*o,c=O(e),g=B(e/2),d=O(e/2),f=d*d,p=1-u*g*g,p=p?Dm(o*g)*F(r=1/p):r=0,_=.5*(2*p*o*d+e/R)-t,m=.5*(p*s+i)-n,y=.5*r*(u*f+p*o*g*h)+.5/R,v=r*(c*l/4-p*s*d),l=.125*r*(l*d-p*s*u*c),d=.5*r*(h*g+p*f*o)+.5,s=v*l-d*y,u=(m*v-_*d)/s,c=(_*l-m*y)/s}while(e-=u,i-=c,(L(u)>D||L(c)>D)&&0<--a);return[e,i]};var i3=Object.freeze({__proto__:null,geoAiry:function(){var n=R,e=$_(Im),t=e(n);return t.radius=function(t){return arguments.length?e(n=t*x):n*m},t.scale(179.976).clipAngle(147)},geoAiryRaw:Im,geoAitoff:function(){return d(Fm).scale(152.63)},geoAitoffRaw:Fm,geoArmadillo:function(){var r=20*x,o=0<=r?1:-1,s=g(o*r),n=$_(Hm),l=n(r),h=l.stream;return l.parallel=function(t){return arguments.length?(s=g((o=0<=(r=t*x)?1:-1)*r),n(r)):r*m},l.stream=function(t){var n=l.rotate(),e=h(t),i=(l.rotate([0,0]),h(t)),a=l.precision();return l.rotate(n),e.sphere=function(){i.polygonStart(),i.lineStart();for(var t=-180*o;o*t<180;t+=90*o)i.point(t,90*o);if(r)for(;-180<=o*(t-=3*o*a);)i.point(t,o*-b(B(t*x/2),s)*m);i.lineEnd(),i.polygonEnd()},e},l.scale(218.695).center([0,28.0974])},geoArmadilloRaw:Hm,geoAugust:function(){return d(Gm).scale(66.1603)},geoAugustRaw:Gm,geoBaker:function(){return d(Wm).scale(112.314)},geoBakerRaw:Wm,geoBerghaus:function(){var o=5,n=$_(qm),i=n(o),a=i.stream,s=-B(.01*x),l=O(.01*x);return i.lobes=function(t){return arguments.length?n(o=+t):o},i.stream=function(t){var n=i.rotate(),e=a(t),r=(i.rotate([0,0]),a(t));return i.rotate(n),e.sphere=function(){r.polygonStart(),r.lineStart();for(var t=0,n=360/o,e=2*j/o,i=90-180/o,a=R;t<o;++t,i-=n,a-=e)r.point(b(l*B(a),s)*m,I(l*O(a))*m),i<-90?(r.point(-90,-180-i-.01),r.point(-90,-180-i+.01)):(r.point(90,i+.01),r.point(90,i-.01));r.lineEnd(),r.polygonEnd()},e},i.scale(87.8076).center([0,17.1875]).clipAngle(179.999)},geoBerghausRaw:qm,geoBertin1953:function(){
|
|
5499
5496
|
// this projection should not be rotated
|
|
5500
5497
|
return d(Zm()).rotate([-16.5,-42]).scale(176.57).center([7.93,.09])},geoBertin1953Raw:Zm,geoBoggs:function(){return d(ey).scale(160.857)},geoBoggsRaw:ey,geoBonne:function(){return iy(ry).scale(123.082).center([0,26.1441]).parallel(45)},geoBonneRaw:ry,geoBottomley:function(){var n=.5,e=$_(oy),t=e(n);return t.fraction=function(t){return arguments.length?e(n=+t):n},t.scale(158.837)},geoBottomleyRaw:oy,geoBromley:function(){return d(sy).scale(152.63)},geoBromleyRaw:sy,geoChamberlin:gy,geoChamberlinAfrica:function(){return gy([0,22],[45,22],[22.5,-22]).scale(380).center([22.5,2])},geoChamberlinRaw:uy,geoCollignon:function(){return d(dy).scale(95.6464).center([0,30])},geoCollignonRaw:dy,geoCraig:function(){return iy(fy).scale(249.828).clipAngle(90)},geoCraigRaw:fy,geoCraster:function(){return d(_y).scale(156.19)},geoCrasterRaw:_y,geoCylindricalEqualArea:function(){return iy(my).parallel(38.58).scale(195.044);// width / (sqrt(width / height / pi) * 2 * pi)
|
|
5501
5498
|
},geoCylindricalEqualAreaRaw:my,geoCylindricalStereographic:function(){return iy(yy).scale(124.75)},geoCylindricalStereographicRaw:yy,geoEckert1:function(){return d(vy).scale(165.664)},geoEckert1Raw:vy,geoEckert2:function(){return d(by).scale(165.664)},geoEckert2Raw:by,geoEckert3:function(){return d(xy).scale(180.739)},geoEckert3Raw:xy,geoEckert4:function(){return d(wy).scale(180.739)},geoEckert4Raw:wy,geoEckert5:function(){return d(Sy).scale(173.044)},geoEckert5Raw:Sy,geoEckert6:function(){return d(ky).scale(173.044)},geoEckert6Raw:ky,geoEisenlohr:function(){return d(My).scale(62.5271)},geoEisenlohrRaw:My,geoFahey:function(){return d(zy).scale(137.152)},geoFaheyRaw:zy,geoFoucaut:function(){return d(Ty).scale(135.264)},geoFoucautRaw:Ty,geoFoucautSinusoidal:function(){var n=.5,e=$_(Ey),t=e(n);return t.alpha=function(t){return arguments.length?e(n=+t):n},t.scale(168.725)},geoFoucautSinusoidalRaw:Ey,geoGilbert:function(t){var n=(t=null==t?vm:t)(),i=sm().scale(m).precision(0).clipAngle(null).translate([0,0]);// antimeridian cutting
|
|
5502
|
-
function e(t){return n(
|
|
5499
|
+
function e(t){return n(Ny(t))}function a(t){e[t]=function(){return arguments.length?(n[t].apply(n,arguments),e):n[t]()}}return n.invert&&(e.invert=function(t){return Py(n.invert(t))}),e.stream=function(t){var e=n.stream(t),t=i.stream({point:function(t,n){e.point(t/2,I(g(-n/2*x))*m)},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}});return t.sphere=e.sphere,t},e.rotate=function(t){return arguments.length?(i.rotate(t),e):i.rotate()},e.center=function(t){return arguments.length?(n.center(Ny(t)),e):Py(n.center())},a("angle"),a("clipAngle"),a("clipExtent"),a("fitExtent"),a("fitHeight"),a("fitSize"),a("fitWidth"),a("scale"),a("translate"),a("precision"),e.scale(249.5)},geoGingery:function(){var a=6,n=30*x,r=B(n),o=O(n),e=$_(Ly),s=e(n,a),l=s.stream,h=-B(.01*x),u=O(.01*x);return s.radius=function(t){return arguments.length?(r=B(n=t*x),o=O(n),e(n,a)):n*m},s.lobes=function(t){return arguments.length?e(n,a=+t):a},s.stream=function(t){var n=s.rotate(),e=l(t),i=(s.rotate([0,0]),l(t));return s.rotate(n),e.sphere=function(){i.polygonStart(),i.lineStart();for(var t=0,n=2*j/a,e=0;t<a;++t,e-=n)i.point(b(u*B(e),h)*m,I(u*O(e))*m),i.point(b(o*B(e-n/2),r)*m,I(o*O(e-n/2))*m);i.lineEnd(),i.polygonEnd()},e},s.rotate([90,-40]).scale(91.7095).clipAngle(179.999)},geoGingeryRaw:Ly,geoGinzburg4:function(){return d(jy).scale(149.995)},geoGinzburg4Raw:jy,geoGinzburg5:function(){return d(Ry).scale(153.93)},geoGinzburg5Raw:Ry,geoGinzburg6:function(){return d(Iy).scale(130.945)},geoGinzburg6Raw:Iy,geoGinzburg8:function(){return d(Fy).scale(131.747)},geoGinzburg8Raw:Fy,geoGinzburg9:function(){return d(Hy).scale(131.087)},geoGinzburg9Raw:Hy,geoGringorten:function(){return d(Gy(Ky)).scale(239.75)}
|
|
5503
5500
|
// Returns [sn, cn, dn](u + iv|m).
|
|
5504
5501
|
,geoGringortenQuincuncial:function(){return v2(Ky).scale(176.423)},geoGringortenRaw:Ky,geoGuyou:function(){return d(Gy(qy)).scale(151.496)},geoGuyouRaw:qy,geoHammer:function(){var n=2,e=$_($m),t=e(n);return t.coefficient=function(t){return arguments.length?e(n=+t):n},t.scale(169.529)},geoHammerRaw:$m,geoHammerRetroazimuthal:function(){var e=0,i=$_($y),a=i(e),n=a.rotate,t=a.stream,r=$1();return a.parallel=function(t){var n;return arguments.length?(n=a.rotate(),i(e=t*x).rotate(n)):e*m},
|
|
5505
5502
|
// Temporary hack; see hammerRetroazimuthalRotation.
|
|
5506
|
-
a.rotate=function(t){return arguments.length?(n.call(a,[t[0],t[1]-e*m]),r.center([-t[0],-t[1]]),a):((t=n.call(a))[1]+=e*m,t)},a.stream=function(a){return(a=t(a)).sphere=function(){a.polygonStart();var t,n=r.radius(89.99)().coordinates[0],e=n.length-1,i=-1;for(a.lineStart();++i<e;)a.point((t=n[i])[0],t[1]);for(a.lineEnd(),e=(n=r.radius(90.01)().coordinates[0]).length-1,a.lineStart();0<=--i;)a.point((t=n[i])[0],t[1]);a.lineEnd(),a.polygonEnd()},a},a.scale(79.4187).parallel(45).clipAngle(179.999)},geoHammerRetroazimuthalRaw:$y,geoHealpix:function(){var a=4,n=$_(Zy),r=n(a),o=r.stream;return r.lobes=function(t){return arguments.length?n(a=+t):a},r.stream=function(t){var n=r.rotate(),e=o(t),i=(r.rotate([0,0]),o(t));return r.rotate(n),e.sphere=function(){var t,n;b0((t=180/a,n=[].concat(jt(-180,180+t/2,t).map(Jy),jt(180,-180-t/2,-t).map(Qy)),{type:"Polygon",coordinates:[180===t?n.map(tv):n]}),i)},e},r.scale(239.75)},geoHealpixRaw:Zy,geoHill:function(){var n=1,e=$_(nv),t=e(n);return t.ratio=function(t){return arguments.length?e(n=+t):n},t.scale(167.774).center([0,18.67])},geoHillRaw:nv,geoHomolosine:function(){return d(rv).scale(152.63)},geoHomolosineRaw:rv,geoHufnagel:function(){var n=1,e=0,i=45*x,a=2,r=$_(ov),t=r(n,e,i,a);return t.a=function(t){return arguments.length?r(n=+t,e,i,a):n},t.b=function(t){return arguments.length?r(n,e=+t,i,a):e},t.psiMax=function(t){return arguments.length?r(n,e,i=+t*x,a):i*m},t.ratio=function(t){return arguments.length?r(n,e,i,a=+t):a},t.scale(180.739)},geoHufnagelRaw:ov,geoHyperelliptical:function(){var n=0,e=2.5,i=1.183136,a=$_(lv),t=a(n,e,i);return t.alpha=function(t){return arguments.length?a(n=+t,e,i):n},t.k=function(t){return arguments.length?a(n,e=+t,i):e},t.gamma=function(t){return arguments.length?a(n,e,i=+t):i},t.scale(152.63)},geoHyperellipticalRaw:lv,geoInterrupt:uv,geoInterruptedBoggs:function(){return uv(ey,cv).scale(160.857)},geoInterruptedHomolosine:function(){return uv(rv,gv).scale(152.63)},geoInterruptedMollweide:function(){return uv(ty,dv).scale(169.529)},geoInterruptedMollweideHemispheres:function(){return uv(ty,fv).scale(169.529).rotate([20,0])},geoInterruptedQuarticAuthalic:function(){return uv($m(1/0),Iv).rotate([20,0]).scale(152.63)},geoInterruptedSinuMollweide:function(){return uv(av,pv,Xm).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoInterruptedSinusoidal:function(){return uv(ay,_v).scale(152.63).rotate([-20,0])},geoKavrayskiy7:function(){return d(mv).scale(158.837)},geoKavrayskiy7Raw:mv,geoLagrange:function(){var n=.5,e=$_(yv),t=e(n);return t.spacing=function(t){return arguments.length?e(n=+t):n},t.scale(124.75)},geoLagrangeRaw:yv,geoLarrivee:function(){return d(bv).scale(97.2672)},geoLarriveeRaw:bv,geoLaskowski:function(){return d(xv).scale(139.98)},geoLaskowskiRaw:xv,geoLittrow:function(){return d(wv).scale(144.049).clipAngle(89.999)},geoLittrowRaw:wv,geoLoximuthal:function(){return iy(Sv).parallel(40).scale(158.837)},geoLoximuthalRaw:Sv,geoMiller:function(){return d(kv).scale(108.318)},geoMillerRaw:kv,geoModifiedStereographic:
|
|
5503
|
+
a.rotate=function(t){return arguments.length?(n.call(a,[t[0],t[1]-e*m]),r.center([-t[0],-t[1]]),a):((t=n.call(a))[1]+=e*m,t)},a.stream=function(a){return(a=t(a)).sphere=function(){a.polygonStart();var t,n=r.radius(89.99)().coordinates[0],e=n.length-1,i=-1;for(a.lineStart();++i<e;)a.point((t=n[i])[0],t[1]);for(a.lineEnd(),e=(n=r.radius(90.01)().coordinates[0]).length-1,a.lineStart();0<=--i;)a.point((t=n[i])[0],t[1]);a.lineEnd(),a.polygonEnd()},a},a.scale(79.4187).parallel(45).clipAngle(179.999)},geoHammerRetroazimuthalRaw:$y,geoHealpix:function(){var a=4,n=$_(Zy),r=n(a),o=r.stream;return r.lobes=function(t){return arguments.length?n(a=+t):a},r.stream=function(t){var n=r.rotate(),e=o(t),i=(r.rotate([0,0]),o(t));return r.rotate(n),e.sphere=function(){var t,n;b0((t=180/a,n=[].concat(jt(-180,180+t/2,t).map(Jy),jt(180,-180-t/2,-t).map(Qy)),{type:"Polygon",coordinates:[180===t?n.map(tv):n]}),i)},e},r.scale(239.75)},geoHealpixRaw:Zy,geoHill:function(){var n=1,e=$_(nv),t=e(n);return t.ratio=function(t){return arguments.length?e(n=+t):n},t.scale(167.774).center([0,18.67])},geoHillRaw:nv,geoHomolosine:function(){return d(rv).scale(152.63)},geoHomolosineRaw:rv,geoHufnagel:function(){var n=1,e=0,i=45*x,a=2,r=$_(ov),t=r(n,e,i,a);return t.a=function(t){return arguments.length?r(n=+t,e,i,a):n},t.b=function(t){return arguments.length?r(n,e=+t,i,a):e},t.psiMax=function(t){return arguments.length?r(n,e,i=+t*x,a):i*m},t.ratio=function(t){return arguments.length?r(n,e,i,a=+t):a},t.scale(180.739)},geoHufnagelRaw:ov,geoHyperelliptical:function(){var n=0,e=2.5,i=1.183136,a=$_(lv),t=a(n,e,i);return t.alpha=function(t){return arguments.length?a(n=+t,e,i):n},t.k=function(t){return arguments.length?a(n,e=+t,i):e},t.gamma=function(t){return arguments.length?a(n,e,i=+t):i},t.scale(152.63)},geoHyperellipticalRaw:lv,geoInterrupt:uv,geoInterruptedBoggs:function(){return uv(ey,cv).scale(160.857)},geoInterruptedHomolosine:function(){return uv(rv,gv).scale(152.63)},geoInterruptedMollweide:function(){return uv(ty,dv).scale(169.529)},geoInterruptedMollweideHemispheres:function(){return uv(ty,fv).scale(169.529).rotate([20,0])},geoInterruptedQuarticAuthalic:function(){return uv($m(1/0),Iv).rotate([20,0]).scale(152.63)},geoInterruptedSinuMollweide:function(){return uv(av,pv,Xm).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoInterruptedSinusoidal:function(){return uv(ay,_v).scale(152.63).rotate([-20,0])},geoKavrayskiy7:function(){return d(mv).scale(158.837)},geoKavrayskiy7Raw:mv,geoLagrange:function(){var n=.5,e=$_(yv),t=e(n);return t.spacing=function(t){return arguments.length?e(n=+t):n},t.scale(124.75)},geoLagrangeRaw:yv,geoLarrivee:function(){return d(bv).scale(97.2672)},geoLarriveeRaw:bv,geoLaskowski:function(){return d(xv).scale(139.98)},geoLaskowskiRaw:xv,geoLittrow:function(){return d(wv).scale(144.049).clipAngle(89.999)},geoLittrowRaw:wv,geoLoximuthal:function(){return iy(Sv).parallel(40).scale(158.837)},geoLoximuthalRaw:Sv,geoMiller:function(){return d(kv).scale(108.318)},geoMillerRaw:kv,geoModifiedStereographic:Nv,geoModifiedStereographicAlaska:function(){return Nv(Mv,[152,-64]).scale(1400).center([-160.908,62.4864]).clipAngle(30).angle(7.8)},geoModifiedStereographicGs48:function(){return Nv(Av,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])},geoModifiedStereographicGs50:function(){return Nv(zv,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])},geoModifiedStereographicLee:function(){return Nv(Ev,[165,10]).scale(250).clipAngle(130).center([-165,-10])},geoModifiedStereographicMiller:function(){return Nv(Tv,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)},geoModifiedStereographicRaw:Cv,geoMollweide:function(){return d(ty).scale(169.529)},geoMollweideRaw:ty,geoMtFlatPolarParabolic:function(){return d(Bv).scale(164.859)},geoMtFlatPolarParabolicRaw:Bv,geoMtFlatPolarQuartic:function(){return d(Ov).scale(188.209)},geoMtFlatPolarQuarticRaw:Ov,geoMtFlatPolarSinusoidal:function(){return d(Dv).scale(166.518)},geoMtFlatPolarSinusoidalRaw:Dv,geoNaturalEarth2:function(){return d(jv).scale(175.295)},geoNaturalEarth2Raw:jv,geoNellHammer:function(){return d(Rv).scale(152.63)},geoNellHammerRaw:Rv,geoNicolosi:function(){return d(Fv).scale(127.267)},geoNicolosiRaw:Fv,geoPatterson:function(){return d(qv).scale(139.319)},geoPattersonRaw:qv,geoPeirceQuincuncial:function(){return v2(qy).scale(111.48)},geoPolyconic:function(){return d($v).scale(103.74)},geoPolyconicRaw:$v,geoPolyhedral:Qv,geoPolyhedralButterfly:function(n){n=n||function(t){t=D1({type:"MultiPoint",coordinates:t});return _m().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var e=r2.map(function(t){return{face:t,project:n(t)}});return[-1,0,0,1,0,1,4,5].forEach(function(t,n){t=e[t];t&&(t.children||(t.children=[])).push(e[n])}),Qv(e[0],function(t,n){return e[t<-j/2?n<0?6:4:t<0?n<0?2:0:t<j/2?n<0?3:1:n<0?7:5]}).angle(-30).scale(101.858).center([0,45])},geoPolyhedralCollignon:function(n){n=n||function(t){t=D1({type:"MultiPoint",coordinates:t});return d(s2).translate([0,0]).scale(1).rotate(0<t[1]?[-t[0],0]:[180-t[0],180])};var e=r2.map(function(t){return{face:t,project:n(t)}});return[-1,0,0,1,0,1,4,5].forEach(function(t,n){t=e[t];t&&(t.children||(t.children=[])).push(e[n])}),Qv(e[0],function(t,n){return e[t<-j/2?n<0?6:4:t<0?n<0?2:0:t<j/2?n<0?3:1:n<0?7:5]}).angle(-30).scale(121.906).center([0,48.5904])},geoPolyhedralWaterman:function(n){n=n||function(t){t=6===t.length?D1({type:"MultiPoint",coordinates:t}):t[0];return _m().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var l=r2.map(function(t){for(var n,e=t.map(u2),i=e.length,a=e[i-1],r=[],o=0;o<i;++o)n=e[o],r.push(h2([.9486832980505138*a[0]+.31622776601683794*n[0],.9486832980505138*a[1]+.31622776601683794*n[1],.9486832980505138*a[2]+.31622776601683794*n[2]]),h2([.9486832980505138*n[0]+.31622776601683794*a[0],.9486832980505138*n[1]+.31622776601683794*a[1],.9486832980505138*n[2]+.31622776601683794*a[2]])),a=n;return r}),h=[],u=[-1,0,0,1,0,1,4,5],i=(l.forEach(function(t,n){for(var e,i,a=r2[n],r=a.length,o=h[n]=[],s=0;s<r;++s)l.push([a[s],t[(2*s+2)%(2*r)],t[(2*s+1)%(2*r)]]),u.push(n),o.push((e=u2(t[(2*s+2)%(2*r)]),i=u2(t[(2*s+1)%(2*r)]),[e[1]*i[2]-e[2]*i[1],e[2]*i[0]-e[0]*i[2],e[0]*i[1]-e[1]*i[0]]))}),l.map(function(t){return{project:n(t),face:t}}));return u.forEach(function(t,n){t=i[t];t&&(t.children||(t.children=[])).push(i[n])}),Qv(i[0],function(t,n){var e=[(e=B(n))*B(t),e*O(t),O(n)];return i[l2((n=h[t=t<-j/2?n<0?6:4:t<0?n<0?2:0:t<j/2?n<0?3:1:n<0?7:5])[0],e)<0?8+3*t:l2(n[1],e)<0?8+3*t+1:l2(n[2],e)<0?8+3*t+2:t]}).angle(-30).scale(110.625).center([0,45])},geoProject:function(t,n){var e;if(!(n=n.stream))throw new Error("invalid projection");switch(t&&t.type){case"Feature":e=g2;break;case"FeatureCollection":e=c2;break;default:e=d2}return e(t,n)},geoQuantize:function(t,a){if(!(0<=(a=+a)&&a<=20))throw new Error("invalid digits");function r(t){var n=t.length,e=2,i=new Array(n);for(i[0]=+t[0].toFixed(a),i[1]=+t[1].toFixed(a);e<n;)i[e]=t[e],++e;return i}function e(t){for(var n=r(t[0]),e=[n],i=1;i<t.length;i++){var a=r(t[i]);(2<a.length||a[0]!=n[0]||a[1]!=n[1])&&(e.push(a),n=a)}return 1===e.length&&1<t.length&&e.push(r(t[t.length-1])),e}function i(t){return t.map(e)}function o(t){if(null==t)return t;var n;switch(t.type){case"GeometryCollection":n={type:"GeometryCollection",geometries:t.geometries.map(o)};break;case"Point":n={type:"Point",coordinates:r(t.coordinates)};break;case"MultiPoint":n={type:t.type,coordinates:t.coordinates.map(r)};break;case"LineString":n={type:t.type,coordinates:e(t.coordinates)};break;case"MultiLineString":case"Polygon":n={type:t.type,coordinates:i(t.coordinates)};break;case"MultiPolygon":n={type:"MultiPolygon",coordinates:t.coordinates.map(i)};break;default:return t}return null!=t.bbox&&(n.bbox=t.bbox),n}function n(t){var n={type:"Feature",properties:t.properties,geometry:o(t.geometry)};return null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),n}if(null!=t)switch(t.type){case"Feature":return n(t);case"FeatureCollection":var s={type:"FeatureCollection",features:t.features.map(n)};return null!=t.bbox&&(s.bbox=t.bbox),s;default:return o(t)}return t},geoQuincuncial:v2,geoRectangularPolyconic:function(){return iy(b2).scale(131.215)},geoRectangularPolyconicRaw:b2,geoRobinson:function(){return d(w2).scale(152.63)},geoRobinsonRaw:w2,geoSatellite:function(){var n=2,e=0,i=$_(S2),t=i(n,e);
|
|
5507
5504
|
// As a multiple of radius.
|
|
5508
5505
|
return t.distance=function(t){return arguments.length?i(n=+t,e):n},t.tilt=function(t){return arguments.length?i(n,e=t*x):e*m},t.scale(432.147).clipAngle(Dm(1/n)*m-1e-6)},geoSatelliteRaw:S2,geoSinuMollweide:function(){return d(av).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoSinuMollweideRaw:av,geoSinusoidal:function(){return d(ay).scale(152.63)},geoSinusoidalRaw:ay,geoStitch:function(t){if(null==t)return t;switch(t.type){case"Feature":return I2(t);case"FeatureCollection":var n={type:"FeatureCollection",features:t.features.map(I2)};return null!=t.bbox&&(n.bbox=t.bbox),n;default:return F2(t)}},geoTimes:function(){return d(H2).scale(146.153)},geoTimesRaw:H2,geoTwoPointAzimuthal:U2,geoTwoPointAzimuthalRaw:K2,geoTwoPointAzimuthalUsa:function(){return U2([-158,21.5],[-77,39]).clipAngle(60).scale(400)},geoTwoPointEquidistant:q2,geoTwoPointEquidistantRaw:W2,geoTwoPointEquidistantUsa:function(){return q2([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)},geoVanDerGrinten:function(){return d($2).scale(79.4183)},geoVanDerGrinten2:function(){return d(V2).scale(79.4183)},geoVanDerGrinten2Raw:V2,geoVanDerGrinten3:function(){return d(Y2).scale(79.4183)},geoVanDerGrinten3Raw:Y2,geoVanDerGrinten4:function(){return d(X2).scale(127.16)},geoVanDerGrinten4Raw:X2,geoVanDerGrintenRaw:$2,geoWagner:J2,geoWagner4:function(){return d(Q2).scale(176.84)},geoWagner4Raw:Q2,geoWagner6:function(){return d(t3).scale(152.63)},geoWagner6Raw:t3,geoWagner7:function(){return J2().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)},geoWagnerRaw:Z2,geoWiechel:function(){return d(n3).rotate([0,-90,45]).scale(124.75).clipAngle(179.999)},geoWiechelRaw:n3,geoWinkel3:function(){return d(e3).scale(158.837)},geoWinkel3Raw:e3}),G=1e-6;
|
|
5509
5506
|
// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
|
|
5510
|
-
class a3{add(n){var e=this._partials;let i=0;for(let t=0;t<this._n&&t<32;t++){var a=e[t],r=n+a,a=Math.abs(n)<Math.abs(a)?n-(r-a):a-(r-n);a&&(e[i++]=a),n=r}return e[i]=n,this._n=i+1,this}valueOf(){var t=this._partials;let n=this._n,e,i,a,r=0;if(0<n){for(r=t[--n];0<n&&(e=r,i=t[--n],r=e+i,!(a=i-(r-e))););0<n&&(a<0&&t[n-1]<0||0<a&&0<t[n-1])&&(i=2*a,e=r+i,i==e-r)&&(r=e)}return r}constructor(){this._partials=new Float64Array(32),this._n=0}}function r3(t){return Array.from(function*(t){for(var n of t)yield*n}(t))}var o3=1e-6,K=Math.PI,s3=K/2,l3=K/4,h3=2*K,u3=180/K,c3=K/180,g3=Math.abs,d3=Math.atan,f3=Math.atan2,p3=Math.cos,_3=Math.exp,m3=Math.log,y3=Math.pow,U=Math.sin,v3=Math.sign||function(t){return 0<t?1:t<0?-1:0},b3=Math.sqrt,x3=Math.tan;function w3(t){return 1<t?s3:t<-1?-s3:Math.asin(t)}function S3(){}function k3(t,n){t&&M3.hasOwnProperty(t.type)&&M3[t.type](t,n)}var C3={Feature:function(t,n){k3(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)k3(e[i].geometry,n)}},M3={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)t=e[i],n.point(t[0],t[1],t[2])},LineString:function(t,n){A3(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)A3(e[i],n,0)},Polygon:function(t,n){z3(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)z3(e[i],n)},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)k3(e[i],n)}};function A3(t,n,e){var i,a=-1,r=t.length-e;for(n.lineStart();++a<r;)i=t[a],n.point(i[0],i[1],i[2]);n.lineEnd()}function z3(t,n){var e=-1,i=t.length;for(n.polygonStart();++e<i;)A3(t[e],n,1);n.polygonEnd()}function T3(t,n){t&&C3.hasOwnProperty(t.type)?C3[t.type](t,n):k3(t,n)}function E3(t){return[f3(t[1],t[0]),w3(t[2])]}function
|
|
5507
|
+
class a3{add(n){var e=this._partials;let i=0;for(let t=0;t<this._n&&t<32;t++){var a=e[t],r=n+a,a=Math.abs(n)<Math.abs(a)?n-(r-a):a-(r-n);a&&(e[i++]=a),n=r}return e[i]=n,this._n=i+1,this}valueOf(){var t=this._partials;let n=this._n,e,i,a,r=0;if(0<n){for(r=t[--n];0<n&&(e=r,i=t[--n],r=e+i,!(a=i-(r-e))););0<n&&(a<0&&t[n-1]<0||0<a&&0<t[n-1])&&(i=2*a,e=r+i,i==e-r)&&(r=e)}return r}constructor(){this._partials=new Float64Array(32),this._n=0}}function r3(t){return Array.from(function*(t){for(var n of t)yield*n}(t))}var o3=1e-6,K=Math.PI,s3=K/2,l3=K/4,h3=2*K,u3=180/K,c3=K/180,g3=Math.abs,d3=Math.atan,f3=Math.atan2,p3=Math.cos,_3=Math.exp,m3=Math.log,y3=Math.pow,U=Math.sin,v3=Math.sign||function(t){return 0<t?1:t<0?-1:0},b3=Math.sqrt,x3=Math.tan;function w3(t){return 1<t?s3:t<-1?-s3:Math.asin(t)}function S3(){}function k3(t,n){t&&M3.hasOwnProperty(t.type)&&M3[t.type](t,n)}var C3={Feature:function(t,n){k3(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)k3(e[i].geometry,n)}},M3={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)t=e[i],n.point(t[0],t[1],t[2])},LineString:function(t,n){A3(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)A3(e[i],n,0)},Polygon:function(t,n){z3(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)z3(e[i],n)},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)k3(e[i],n)}};function A3(t,n,e){var i,a=-1,r=t.length-e;for(n.lineStart();++a<r;)i=t[a],n.point(i[0],i[1],i[2]);n.lineEnd()}function z3(t,n){var e=-1,i=t.length;for(n.polygonStart();++e<i;)A3(t[e],n,1);n.polygonEnd()}function T3(t,n){t&&C3.hasOwnProperty(t.type)?C3[t.type](t,n):k3(t,n)}function E3(t){return[f3(t[1],t[0]),w3(t[2])]}function N3(t){var n=t[0],t=t[1],e=p3(t);return[e*p3(n),e*U(n),U(t)]}function P3(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function L3(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]]}
|
|
5511
5508
|
// TODO return a
|
|
5512
5509
|
function B3(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function O3(t,n){return[t[0]*n,t[1]*n,t[2]*n]}
|
|
5513
5510
|
// TODO return d
|
|
5514
5511
|
function D3(t){var n=b3(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function j3(e,i){function t(t,n){return t=e(t,n),i(t[0],t[1])}return e.invert&&i.invert&&(t.invert=function(t,n){return(t=i.invert(t,n))&&e.invert(t[0],t[1])}),t}function R3(t,n){return[g3(t)>K?t+Math.round(-t/h3)*h3:t,n]}function I3(t,n,e){return(t%=h3)?n||e?j3(H3(t),G3(n,e)):H3(t):n||e?G3(n,e):R3}function F3(e){return function(t,n){return[K<(t+=e)?t-h3:t<-K?t+h3:t,n]}}function H3(t){var n=F3(t);return n.invert=F3(-t),n}function G3(t,n){var a=p3(t),r=U(t),o=p3(n),s=U(n);function e(t,n){var e=p3(n),i=p3(t)*e,t=U(t)*e,e=U(n),n=e*a+i*r;return[f3(t*o-n*s,i*a-e*r),w3(n*o+t*s)]}return e.invert=function(t,n){var e=p3(n),i=p3(t)*e,t=U(t)*e,e=U(n),n=e*o-t*s;return[f3(t*o+e*s,i*a+n*r),w3(n*a-i*r)]},e}
|
|
5515
5512
|
// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].
|
|
5516
|
-
function K3(t,n){(n=
|
|
5513
|
+
function K3(t,n){(n=N3(n))[0]-=t,D3(n);t=1<(t=-n[1])?0:t<-1?K:Math.acos(t);return((-n[2]<0?-t:t)+h3-o3)%h3}function U3(){var i,n=[];return{point:function(t,n,e){i.push([t,n,e])},lineStart:function(){n.push(i=[])},lineEnd:S3,rejoin:function(){1<n.length&&n.push(n.pop().concat(n.shift()))},result:function(){var t=n;return n=[],i=null,t}}}function W3(t,n){return g3(t[0]-n[0])<o3&&g3(t[1]-n[1])<o3}function q3(t,n,e,i){this.x=t,this.z=n,this.o=e,// another intersection
|
|
5517
5514
|
this.e=i,// is an entry?
|
|
5518
5515
|
this.v=!1,// visited
|
|
5519
5516
|
this.n=this.p=null}
|
|
@@ -5527,7 +5524,7 @@ a[0]+=2*o3}s.push(e=new q3(i,t,null,!0)),l.push(e.o=new q3(i,null,e,!1)),s.push(
|
|
|
5527
5524
|
var g=c,d=!0;g.v;)if((g=g.n)===c)return;h=g.z,r.lineStart();do{if(g.v=g.o.v=!0,g.e){if(d)for(o=0,a=h.length;o<a;++o)r.point((u=h[o])[0],u[1]);else i(g.x,g.n.x,1,r);g=g.n}else{if(d)for(h=g.p.z,o=h.length-1;0<=o;--o)r.point((u=h[o])[0],u[1]);else i(g.x,g.p.x,-1,r);g=g.p}}while(h=(g=g.o).z,d=!d,!g.v);r.lineEnd()}}}function V3(t){if(n=t.length){for(var n,e,i=0,a=t[0];++i<n;)a.n=e=t[i],e.p=a,a=e;a.n=e=t[0],e.p=a}}function Y3(t){return g3(t[0])<=K?t[0]:v3(t[0])*((g3(t[0])+K)%h3-K)}function X3(_,m,y,v){return function(s){var l,h,u,e=m(s),c=U3(),g=m(c),d=!1,n={point:i,lineStart:a,lineEnd:r,polygonStart:function(){n.point=f,n.lineStart=o,n.lineEnd=p,h=[],l=[]},polygonEnd:function(){n.point=i,n.lineStart=a,n.lineEnd=r,h=r3(h);var t=((t,n)=>{var e=Y3(n),i=n[1],n=U(i),a=[U(e),-p3(e),0],r=0,o=0,s=new a3;1===n?i=s3+o3:-1===n&&(i=-s3-o3);for(var l=0,h=t.length;l<h;++l)if(c=(u=t[l]).length)for(var u,c,g=u[c-1],d=Y3(g),f=g[1]/2+l3,p=U(f),_=p3(f),m=0;m<c;++m,d=v,p=x,_=b,g=y){var y=u[m],v=Y3(y),b=y[1]/2+l3,x=U(b),b=p3(b),w=v-d,S=0<=w?1:-1,k=S*w,C=K<k,M=p*x;s.add(f3(M*S*U(k),_*b+M*p3(k))),r+=C?w+S*h3:w,
|
|
5528
5525
|
// Are the longitudes either side of the point’s meridian (lambda),
|
|
5529
5526
|
// and are the latitudes smaller than the parallel (phi)?
|
|
5530
|
-
C^e<=d^e<=v&&(D3(M=L3(
|
|
5527
|
+
C^e<=d^e<=v&&(D3(M=L3(N3(g),N3(y))),D3(k=L3(a,M)),(S=(C^0<=w?-1:1)*w3(k[2]))<i||i===S&&(M[0]||M[1]))&&(o+=C^0<=w?1:-1)}
|
|
5531
5528
|
// First, determine whether the South pole is inside or outside:
|
|
5532
5529
|
//
|
|
5533
5530
|
// It is inside if:
|
|
@@ -5560,11 +5557,11 @@ function _(t,n){return p3(t)*p3(n)>p}
|
|
|
5560
5557
|
// intersections 2 - there were intersections, and the first and last segments
|
|
5561
5558
|
// should be rejoined.
|
|
5562
5559
|
// Intersects the great circle between a and b with the clip circle.
|
|
5563
|
-
function m(t,n,e){var i,a,r,o,s,l,h,u=[1,0,0],c=L3(
|
|
5560
|
+
function m(t,n,e){var i,a,r,o,s,l,h,u=[1,0,0],c=L3(N3(t),N3(n)),g=P3(c,c),d=c[0],f=g-d*d;
|
|
5564
5561
|
// We have two planes, n1.p = d1 and n2.p = d2.
|
|
5565
5562
|
// Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
|
|
5566
5563
|
// Two polar points.
|
|
5567
|
-
return f?(i=L3(u,c),B3(u=O3(u,p*g/f),O3(c,-p*d/f)),(f=(c=
|
|
5564
|
+
return f?(i=L3(u,c),B3(u=O3(u,p*g/f),O3(c,-p*d/f)),(f=(c=P3(u,g=i))*c-(d=P3(g,g))*(P3(u,u)-1))<0?void 0:(B3(f=O3(g,(-c-(i=b3(f)))/d),u),f=E3(f),e?(
|
|
5568
5565
|
// Check that the first point is between a and b.
|
|
5569
5566
|
a=t[0],r=n[0],o=t[1],n=n[1],r<a&&(h=a,a=r,r=h),!(l=g3((s=r-a)-K)<o3)&&n<o&&(h=o,o=n,n=h),(l||s<o3?l?0<o+n^f[1]<(g3(f[0]-a)<o3?o:n):o<=f[1]&&f[1]<=n:K<s^(a<=f[0]&&f[0]<=r))?(B3(h=O3(g,(-c+i)/d),u),[f,E3(h)]):void 0):f)):!e&&t}
|
|
5570
5567
|
// Generates a 4-bit vector representing the location of a point relative to
|
|
@@ -5594,10 +5591,10 @@ function ib(m,y,v,b){function x(t,n){return m<=t&&t<=v&&y<=n&&n<=b}function w(t,
|
|
|
5594
5591
|
// Buffer geometry within a polygon and then clip it en masse.
|
|
5595
5592
|
function(){p=t,a=[],c=[],f=!0},polygonEnd:function(){var t=(()=>{for(var t=0,n=0,e=c.length;n<e;++n)for(var i,a,r=c[n],o=1,s=r.length,l=r[0],h=l[0],u=l[1];o<s;++o)i=h,a=u,l=r[o],h=l[0],u=l[1],a<=b?b<u&&(u-a)*(m-i)<(h-i)*(b-a)&&++t:u<=b&&(h-i)*(b-a)<(u-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=r3(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&$3(a,S,t,w,i),i.polygonEnd());p=i,a=c=r=null}};function e(t,n){x(t,n)&&p.point(t,n)}function _(t,n){var e,i,a=x(t,n);c&&r.push([t,n]),d?(o=t,s=n,d=!1,(l=a)&&(p.lineStart(),p.point(t,n))):a&&g?p.point(t,n):((t,n,e,i,a,r)=>{var o=t[0],s=t[1],l=0,h=1,u=n[0]-o,c=n[1]-s,e=e-o;if(u||!(0<e)){if(e/=u,u<0){if(e<l)return;e<h&&(h=e)}else if(0<u){if(h<e)return;l<e&&(l=e)}if(e=a-o,u||!(e<0)){if(e/=u,u<0){if(h<e)return;l<e&&(l=e)}else if(0<u){if(e<l)return;e<h&&(h=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<h&&(h=e)}else if(0<c){if(h<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(h<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<h&&(h=e)}return 0<l&&(t[0]=o+l*u,t[1]=s+l*c),h<1&&(n[0]=o+h*u,n[1]=s+h*c),1}}}}})(e=[h=Math.max(eb,Math.min(nb,h)),u=Math.max(eb,Math.min(nb,u))],i=[t=Math.max(eb,Math.min(nb,t)),n=Math.max(eb,Math.min(nb,n))],m,y,v,b)?(g||(p.lineStart(),p.point(e[0],e[1])),p.point(i[0],i[1]),a||p.lineEnd(),f=!1):a&&(p.lineStart(),p.point(t,n),f=!1),h=t,u=n,g=a}return n}}var ab=t=>t,rb=1/0,ob=rb,sb=-rb,lb=sb,hb={point:function(t,n){t<rb&&(rb=t);sb<t&&(sb=t);n<ob&&(ob=n);lb<n&&(lb=n)},lineStart:S3,lineEnd:S3,polygonStart:S3,polygonEnd:S3,result:function(){var t=[[rb,ob],[sb,lb]];return sb=lb=-(ob=rb=1/0),t}};function ub(i){return function(t){var n,e=new cb;for(n in i)e[n]=i[n];return e.stream=t,e}}function cb(){}function gb(t,n,e){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),T3(e,t.stream(hb)),n(hb.result()),null!=i&&t.clipExtent(i),t}function db(a,r,t){return gb(a,function(t){var n=r[1][0]-r[0][0],e=r[1][1]-r[0][1],i=Math.min(n/(t[1][0]-t[0][0]),e/(t[1][1]-t[0][1])),n=+r[0][0]+(n-i*(t[1][0]+t[0][0]))/2,e=+r[0][1]+(e-i*(t[1][1]+t[0][1]))/2;a.scale(150*i).translate([n,e])},t)}cb.prototype={constructor:cb,point:function(t,n){this.stream.point(t,n)},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()}};var fb=16,pb=p3(30*c3);// cos(minimum angular distance)
|
|
5596
5593
|
function _b(t,n){return+n?(A=t,z=n,function(i){var e,a,r,o,s,l,h,u,c,g,d,f,p={point:t,lineStart:n,lineEnd:m,polygonStart:function(){i.polygonStart(),p.lineStart=y},polygonEnd:function(){i.polygonEnd(),p.lineStart=n}};// previous point
|
|
5597
|
-
function t(t,n){t=A(t,n),i.point(t[0],t[1])}function n(){u=NaN,p.point=_,i.lineStart()}function _(t,n){var e=
|
|
5594
|
+
function t(t,n){t=A(t,n),i.point(t[0],t[1])}function n(){u=NaN,p.point=_,i.lineStart()}function _(t,n){var e=N3([t,n]),n=A(t,n);T(u,c,h,g,d,f,u=n[0],c=n[1],h=t,g=e[0],d=e[1],f=e[2],fb,i),i.point(u,c)}function m(){p.point=t,i.lineEnd()}function y(){n(),p.point=v,p.lineEnd=b}function v(t,n){_(e=t,n),a=u,r=c,o=g,s=d,l=f,p.point=_}function b(){T(u,c,h,g,d,f,a,r,e,o,s,l,fb,i),p.lineEnd=m,m()}return p}):(e=t,ub({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}}));var e,A,z;function T(t,n,e,i,a,r,o,s,l,h,u,c,g,d){var f,p,_,m,y,v,b,x,w,S,k=o-t,C=s-n,M=k*k+C*C;4*z<M&&g--&&(_=r+c,b=w3(_/=m=b3((f=i+h)*f+(p=a+u)*p+_*_)),y=g3(g3(_)-1)<o3||g3(e-l)<o3?(e+l)/2:f3(p,f),v=(b=A(y,b))[0],z<(S=C*(x=v-t)-k*(w=(b=b[1])-n))*S/M||.3<g3((k*x+C*w)/M-.5)||i*h+a*u+r*c<pb)&&(T(t,n,e,i,a,r,v,b,y,f/=m,p/=m,_,g,d),d.point(v,b),T(v,b,y,f,p,_,o,s,l,h,u,c,g,d))}}var mb,yb=ub({point:function(t,n){this.stream.point(t*c3,n*c3)}});function vb(t,e,i,a,r,n){var o,s,l,h,u,c,g,d,f,p,_,m;return n?(c=p3(n),n=U(n),g=c*t,d=n*t,f=c/t,p=n/t,_=(n*i-c*e)/t,m=(n*e+c*i)/t,v.invert=function(t,n){return[a*(f*t-p*n+_),r*(m-p*t-f*n)]},v):(o=t,s=e,l=i,h=a,u=r,y.invert=function(t,n){return[(t-s)/o*h,(l-n)/o*u]},y);function y(t,n){return[s+o*(t*=h),l-o*(n*=u)]}function v(t,n){return[g*(t*=a)-d*(n*=r)+e,i-d*t-g*n]}}function bb(t){return xb(function(){return t})()}function xb(t){var n,i,e,a,r,o,s,l,h,u,c=150,g=480,d=250,f=0,p=0,_=0,m=0,y=0,v=0,b=1,x=1,w=null,S=Q3,k=null,C=ab,M=.5;function A(t){return l(t[0]*c3,t[1]*c3)}function z(t){return(t=l.invert(t[0],t[1]))&&[t[0]*u3,t[1]*u3]}function T(){var t=vb(c,0,0,b,x,v).apply(null,n(f,p)),t=vb(c,g-t[0],d-t[1],b,x,v);return i=I3(_,m,y),s=j3(n,t),l=j3(i,s),o=_b(s,M),E()}function E(){return h=u=null,A}return A.stream=function(t){return h&&u===t?h:h=yb((e=i,ub({point:function(t,n){t=e(t,n);return this.stream.point(t[0],t[1])}})(S(o(C(u=t))))));var e},A.preclip=function(t){return arguments.length?(S=t,w=void 0,E()):S},A.postclip=function(t){return arguments.length?(C=t,k=e=a=r=null,E()):C},A.clipAngle=function(t){return arguments.length?(S=+t?tb(w=t*c3):(w=null,Q3),E()):w*u3},A.clipExtent=function(t){return arguments.length?(C=null==t?(k=e=a=r=null,ab):ib(k=+t[0][0],e=+t[0][1],a=+t[1][0],r=+t[1][1]),E()):null==k?null:[[k,e],[a,r]]},A.scale=function(t){return arguments.length?(c=+t,T()):c},A.translate=function(t){return arguments.length?(g=+t[0],d=+t[1],T()):[g,d]},A.center=function(t){return arguments.length?(f=t[0]%360*c3,p=t[1]%360*c3,T()):[f*u3,p*u3]},A.rotate=function(t){return arguments.length?(_=t[0]%360*c3,m=t[1]%360*c3,y=2<t.length?t[2]%360*c3:0,T()):[_*u3,m*u3,y*u3]},A.angle=function(t){return arguments.length?(v=t%360*c3,T()):v*u3},A.reflectX=function(t){return arguments.length?(b=t?-1:1,T()):b<0},A.reflectY=function(t){return arguments.length?(x=t?-1:1,T()):x<0},A.precision=function(t){return arguments.length?(o=_b(s,M=t*t),E()):b3(M)},A.fitExtent=function(t,n){return db(A,t,n)},A.fitSize=function(t,n){return db(A,[[0,0],t],n)},A.fitWidth=function(t,n){return a=t,gb(i=A,function(t){var n=+a,e=n/(t[1][0]-t[0][0]),n=(n-e*(t[1][0]+t[0][0]))/2,t=-e*t[0][1];i.scale(150*e).translate([n,t])},n);var i,a},A.fitHeight=function(t,n){return r=t,gb(a=A,function(t){var n=+r,e=n/(t[1][1]-t[0][1]),i=-e*t[0][0],n=(n-e*(t[1][1]+t[0][1]))/2;a.scale(150*e).translate([i,n])},n);var a,r},function(){return n=t.apply(this,arguments),A.invert=n.invert&&z,T()}}function wb(t){var n=0,e=K/3,i=xb(t),t=i(n,e);return t.parallels=function(t){return arguments.length?i(n=t[0]*c3,e=t[1]*c3):[n*u3,e*u3]},t}function Sb(t,n){var e,i,a,r=U(t),o=(r+U(n))/2;
|
|
5598
5595
|
// Are the parallels symmetrical around the Equator?
|
|
5599
5596
|
return g3(o)<o3?(e=p3(t),s.invert=function(t,n){return[t/e,w3(n*e)]},s):(a=b3(i=1+r*(2*o-r))/o,l.invert=function(t,n){var n=a-n,e=f3(t,g3(n))*v3(n);return n*o<0&&(e-=K*v3(t)*v3(n)),[e/o,w3((i-(t*t+n*n)*o*o)/(2*o))]},l);function s(t,n){return[t*e,U(n)/e]}function l(t,n){n=b3(i-2*o*U(n))/o;return[n*U(t*=o),a-n*p3(t)]}}function kb(){return wb(Sb).scale(155.424).center([0,33.6442])}function Cb(){return kb().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Mb(t,n){return[t,m3(x3((s3+n)/2))]}function Ab(){return zb(Mb).scale(961/h3)}function zb(i){var a,r,o,s=bb(i),n=s.center,l=s.scale,e=s.translate,h=s.clipExtent,u=null;// clip extent
|
|
5600
|
-
function c(){var n,t=K*l(),e=s((n=I3((n=s.rotate())[0]*c3,n[1]*c3,2<n.length?n[2]*c3:0),function(t){return(t=n.invert(t[0]*c3,t[1]*c3))[0]*=u3,t[1]*=u3,t}([0,0])));return h(null==u?[[e[0]-t,e[1]-t],[e[0]+t,e[1]+t]]:i===Mb?[[Math.max(e[0]-t,u),a],[Math.min(e[0]+t,r),o]]:[[u,Math.max(e[1]-t,a)],[r,Math.min(e[1]+t,o)]])}return s.scale=function(t){return(arguments.length?(l(t),c):l)()},s.translate=function(t){return(arguments.length?(e(t),c):e)()},s.center=function(t){return(arguments.length?(n(t),c):n)()},s.clipExtent=function(t){return arguments.length?(null==t?u=a=r=o=null:(u=+t[0][0],a=+t[0][1],r=+t[1][0],o=+t[1][1]),c()):null==u?null:[[u,a],[r,o]]},c()}function Tb(t){return x3((s3+t)/2)}function Eb(t,n){var e=p3(t),a=t===n?U(t):m3(e/p3(n))/m3(Tb(n)/Tb(t)),r=e*y3(Tb(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=v3(a)*b3(t*t+n*n),i=f3(t,g3(n))*v3(n);return n*a<0&&(i-=K*v3(t)*v3(n)),[i/a,2*d3(y3(r/e,1/a))-s3]},i):Mb;function i(t,n){0<r?n<-s3+o3&&(n=-s3+o3):s3-o3<n&&(n=s3-o3);n=r/y3(Tb(n),a);return[n*U(a*t),r-n*p3(a*t)]}}function
|
|
5597
|
+
function c(){var n,t=K*l(),e=s((n=I3((n=s.rotate())[0]*c3,n[1]*c3,2<n.length?n[2]*c3:0),function(t){return(t=n.invert(t[0]*c3,t[1]*c3))[0]*=u3,t[1]*=u3,t}([0,0])));return h(null==u?[[e[0]-t,e[1]-t],[e[0]+t,e[1]+t]]:i===Mb?[[Math.max(e[0]-t,u),a],[Math.min(e[0]+t,r),o]]:[[u,Math.max(e[1]-t,a)],[r,Math.min(e[1]+t,o)]])}return s.scale=function(t){return(arguments.length?(l(t),c):l)()},s.translate=function(t){return(arguments.length?(e(t),c):e)()},s.center=function(t){return(arguments.length?(n(t),c):n)()},s.clipExtent=function(t){return arguments.length?(null==t?u=a=r=o=null:(u=+t[0][0],a=+t[0][1],r=+t[1][0],o=+t[1][1]),c()):null==u?null:[[u,a],[r,o]]},c()}function Tb(t){return x3((s3+t)/2)}function Eb(t,n){var e=p3(t),a=t===n?U(t):m3(e/p3(n))/m3(Tb(n)/Tb(t)),r=e*y3(Tb(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=v3(a)*b3(t*t+n*n),i=f3(t,g3(n))*v3(n);return n*a<0&&(i-=K*v3(t)*v3(n)),[i/a,2*d3(y3(r/e,1/a))-s3]},i):Mb;function i(t,n){0<r?n<-s3+o3&&(n=-s3+o3):s3-o3<n&&(n=s3-o3);n=r/y3(Tb(n),a);return[n*U(a*t),r-n*p3(a*t)]}}function Nb(){return wb(Eb).scale(109.5).parallels([30,30])}function Pb(t,n){return[t,n]}function Lb(){return bb(Pb).scale(152.63)}function Bb(t,n){var e=p3(t),i=t===n?U(t):(e-p3(n))/(n-t),a=e/i+t;return g3(i)<o3?Pb:(r.invert=function(t,n){var n=a-n,e=f3(t,g3(n))*v3(n);return n*i<0&&(e-=K*v3(t)*v3(n)),[e/i,a-v3(i)*b3(t*t+n*n)]},r);function r(t,n){n=a-n,t*=i;return[n*U(t),a-n*p3(t)]}}function Ob(){return wb(Bb).scale(131.154).center([0,13.9389])}function Db(t,n){var e=p3(n),i=1+p3(t)*e;return[e*U(t)/i,U(n)/i]}function jb(t,n){return[m3(x3((s3+n)/2)),-t]}function Rb(){}Mb.invert=function(t,n){return[t,2*d3(_3(n))-s3]},Pb.invert=Pb,Db.invert=(mb=function(t){return 2*d3(t)},function(t,n){var e=b3(t*t+n*n),i=mb(e),a=U(i),i=p3(i);return[f3(t*a,e*i),w3(e&&n*a/e)]}),jb.invert=function(t,n){return[-n,2*d3(_3(t))-s3]};var Ib=1/0,Fb=Ib,Hb=-Ib,Gb=Hb,Kb={point:function(t,n){t<Ib&&(Ib=t);Hb<t&&(Hb=t);n<Fb&&(Fb=n);Gb<n&&(Gb=n)},lineStart:Rb,lineEnd:Rb,polygonStart:Rb,polygonEnd:Rb,result:function(){var t=[[Ib,Fb],[Hb,Gb]];return Hb=Gb=-(Fb=Ib=1/0),t}};function Ub(t,n,e){var i=n[1][0]-n[0][0],a=n[1][1]-n[0][1],r=t.clipExtent&&t.clipExtent(),e=(t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),T3(e,t.stream(Kb)),Kb.result()),o=Math.min(i/(e[1][0]-e[0][0]),a/(e[1][1]-e[0][1])),i=+n[0][0]+(i-o*(e[1][0]+e[0][0]))/2,n=+n[0][1]+(a-o*(e[1][1]+e[0][1]))/2;return null!=r&&t.clipExtent(r),t.scale(150*o).translate([i,n])}function Wb(t,n,e){return Ub(t,[[0,0],n],e)}let qb=Math.PI,$b=2*qb,Vb=1e-6,Yb=$b-Vb;function Xb(){this._x0=this._y0=this._x1=this._y1=null,// end of current subpath
|
|
5601
5598
|
this._=""}function Zb(){return new Xb}Xb.prototype=Zb.prototype={constructor:Xb,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,i){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+i)},bezierCurveTo:function(t,n,e,i,a,r){this._+="C"+ +t+","+ +n+","+ +e+","+ +i+","+(this._x1=+a)+","+(this._y1=+r)},arcTo:function(t,n,e,i,a){var r,o,s=this._x1,l=this._y1,h=(e=+e)-(t=+t),u=(i=+i)-(n=+n),c=s-t,g=l-n,d=c*c+g*g;
|
|
5602
5599
|
// Is the radius negative? Error.
|
|
5603
5600
|
if((a=+a)<0)throw new Error("negative radius: "+a);
|
|
@@ -5797,7 +5794,7 @@ function(){var n,e,a,r,o,s,l,h,i,x=Cb(),u=kb().rotate([154,0]).center([-2,58.5])
|
|
|
5797
5794
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5798
5795
|
,geoConicConformalEurope:
|
|
5799
5796
|
// A composite projection for Portugal, configured by default for 960×500.
|
|
5800
|
-
function(){var n,e,i,a,r,o,s,l,h,u,c,g,d,f,p,_=
|
|
5797
|
+
function(){var n,e,i,a,r,o,s,l,h,u,c,g,d,f,p,_=Nb().rotate([-10,-53]).parallels([0,60]),m=Ab().center([-61.46,16.14]),y=Ab().center([-53.2,3.9]),v=Nb().rotate([27.8,-38.9]).parallels([0,60]),b=Nb().rotate([25.43,-37.398]).parallels([0,60]),x=Nb().rotate([31.17,-39.539]).parallels([0,60]),w=Nb().rotate([17,-32.7]).parallels([0,60]),S=Nb().rotate([16,-28.5]).parallels([0,60]),k=Ab().center([-61.03,14.67]),C=Ab().center([45.16,-12.8]),M=Ab().center([55.52,-21.13]),A=Nb().rotate([-14.4,-35.95]).parallels([0,60]),z={point:function(t,n){p=[t,n]}};
|
|
5801
5798
|
/*
|
|
5802
5799
|
var europeBbox = [[-6.5, 51], [10, 41]];
|
|
5803
5800
|
var guyaneBbox = [[-54.5, 6.29], [-50.9, 1.48]];
|
|
@@ -5830,7 +5827,7 @@ var i,a},T.precision=function(t){return arguments.length?(_.precision(t),y.preci
|
|
|
5830
5827
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5831
5828
|
,geoConicConformalFrance:
|
|
5832
5829
|
// A composite projection for France, configured by default for 960×500.
|
|
5833
|
-
function(){var n,e,a,r,o,s,l,h,u,c,g,d,f,p,i,_=
|
|
5830
|
+
function(){var n,e,a,r,o,s,l,h,u,c,g,d,f,p,i,_=Nb().rotate([-3,-46.2]).parallels([0,60]),m=Ab().center([-53.2,3.9]),y=Ab().center([-61.03,14.67]),v=Ab().center([-61.46,16.14]),b=Ab().center([-62.85,17.92]),x=Ab().center([-56.23,46.93]),w=Ab().center([45.16,-12.8]),S=Ab().center([55.52,-21.13]),k=Ab().center([165.8,-21.07]),C=Ab().center([-178.1,-14.3]),M=Ab().center([-150.55,-17.11]),A=Ab().center([-150.55,-17.11]),z={point:function(t,n){i=[t,n]}};
|
|
5834
5831
|
/*
|
|
5835
5832
|
var europeBbox = [[-6.5, 51], [10, 41]];
|
|
5836
5833
|
var guyaneBbox = [[-54.5, 6.29], [-50.9, 1.48]];
|
|
@@ -5860,7 +5857,7 @@ var i,a},T.precision=function(t){return arguments.length?(_.precision(t),m.preci
|
|
|
5860
5857
|
|
|
5861
5858
|
}*/var n=_([-7.938886725111036,43.7219460918835]),e=_([-4.832080896458295,44.12930268549372]),i=_([-4.205299743793263,40.98096346967365]),a=_([-7.071796453126152,40.610037319181444]);t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([-8.42751373617692,45.32889452553031]),e=_([-5.18599305777107,45.7566442062976]),i=_([-4.832080905154431,44.129302726751426]),a=_([-7.938886737126192,43.72194613263854]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([-9.012656899657046,47.127733821030176]),e=_([-5.6105244772793155,47.579777861410626]),i=_([-5.185993067168585,45.756644248170346]),a=_([-8.427513749141811,45.32889456686326]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([-9.405747558985553,48.26506375557457]),e=_([-5.896175018439575,48.733352850851624]),i=_([-5.610524487556043,47.57977790393761]),a=_([-9.012656913808351,47.127733862971255]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([-9.908436061346974,49.642448789505856]),e=_([-6.262026716233124,50.131426841787174]),i=_([-5.896175029331232,48.73335289377258]),a=_([-9.40574757396393,48.26506379787767]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([11.996907706504462,50.16039028163579]),e=_([15.649907879773343,49.68279246765253]),i=_([15.156712840526632,48.30371557625831]),a=_([11.64122661754411,48.761078240546816]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([11.641226606955788,48.7610781975889]),e=_([15.156712825832164,48.30371553390465]),i=_([14.549932166241172,46.4866532486199]),a=_([11.204443787952183,46.91899233914248]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([11.204443778297161,46.918992296823646]),e=_([14.549932152815039,46.486653206856396]),i=_([13.994409796764009,44.695833444323256]),a=_([10.805306599253848,45.105133870684924]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([10.805306590412085,45.10513382903308]),e=_([13.99440978444733,44.695833403183606]),i=_([13.654633799024392,43.53552468558152]),a=_([10.561516803980956,43.930671459798624]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([10.561516795617383,43.93067141859757]),e=_([13.654633787361952,43.5355246448671]),i=_([12.867691604239901,40.640701985019405]),a=_([9.997809515987688,41.00288343254471]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),n=_([10.8,42.4]),e=_([12.8,42.13]),t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1])},T.getCompositionBorders=function(){var t=Zb();return this.drawCompositionBorders(t),t.toString()},T.scale(2700)},geoConicConformalNetherlands:
|
|
5862
5859
|
// A composite projection for the Netherlands, configured by default for 960×500.
|
|
5863
|
-
function(){var n,e,a,r,o,i,h=
|
|
5860
|
+
function(){var n,e,a,r,o,i,h=Nb().rotate([-5.5,-52.2]).parallels([0,60]),s=Ab().center([-68.25,12.2]),l=Ab().center([-63.1,17.5]),u={point:function(t,n){i=[t,n]}};function c(t){var[t,n]=t;return i=null,a.point(t,n),i||(r.point(t,n),i)||(o.point(t,n),i)}function g(){return n=e=null,c}return c.invert=function(t){var n=h.scale(),e=h.translate(),i=(t[0]-e[0])/n,e=(t[1]-e[1])/n;return(-.0067<=e&&e<.0015&&-.0232<=i&&i<-.0154?s:-.022<=e&&e<-.014&&-.023<=i&&i<-.014?l:h).invert(t)},c.stream=function(t){return n&&e===t?n:(i=[h.stream(e=t),s.stream(t),l.stream(t)],a=i.length,n={point:function(t,n){for(var e=-1;++e<a;)i[e].point(t,n)},sphere:function(){for(var t=-1;++t<a;)i[t].sphere()},lineStart:function(){for(var t=-1;++t<a;)i[t].lineStart()},lineEnd:function(){for(var t=-1;++t<a;)i[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<a;)i[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<a;)i[t].polygonEnd()}});var i,a},c.precision=function(t){return arguments.length?(h.precision(t),s.precision(t),l.precision(t),g()):h.precision()},c.scale=function(t){return arguments.length?(h.scale(t),s.scale(t),l.scale(t),c.translate(h.translate())):h.scale()},c.translate=function(t){var n,e,i;return arguments.length?(n=h.scale(),e=+t[0],i=+t[1],a=h.translate(t).clipExtent([[e-.0245*n,i-.026*n],[e+.023*n,i+.026*n]]).stream(u),r=s.translate([e-.0186*n,i-.00325*n]).clipExtent([[e-.0232*n+G,i-.0067*n+G],[e-.0154*n-G,i+.0015*n-G]]).stream(u),o=l.translate([e-.0185*n,i-.017*n]).clipExtent([[e-.023*n+G,i-.022*n+G],[e-.014*n-G,i-.014*n-G]]).stream(u),g()):h.translate()},c.fitExtent=function(t,n){return Ub(c,t,n)},c.fitSize=function(t,n){return Wb(c,t,n)},c.drawCompositionBorders=function(t){
|
|
5864
5861
|
/*
|
|
5865
5862
|
console.table({
|
|
5866
5863
|
"Clip extent": ["Bonaire", bonaire.clipExtent()],
|
|
@@ -5882,7 +5879,7 @@ function(){var n,e,a,r,o,i,h=Pb().rotate([-5.5,-52.2]).parallels([0,60]),s=Ab().
|
|
|
5882
5879
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5883
5880
|
,geoConicConformalPortugal:
|
|
5884
5881
|
// A composite projection for Portugal, configured by default for 960×500.
|
|
5885
|
-
function(){var n,e,a,r,o,i,h=
|
|
5882
|
+
function(){var n,e,a,r,o,i,h=Nb().rotate([10,-39.3]).parallels([0,60]),s=Nb().rotate([17,-32.7]).parallels([0,60]),l=Nb().rotate([27.8,-38.6]).parallels([0,60]),u={point:function(t,n){i=[t,n]}};
|
|
5886
5883
|
/*
|
|
5887
5884
|
var iberianPeninsuleBbox = [[-11, 46], [4, 34]];
|
|
5888
5885
|
var madeiraBbox = [[-17.85, 33.6], [-16, 32.02]];
|
|
@@ -5993,7 +5990,7 @@ var i,a},c.precision=function(t){return arguments.length?(h.precision(t),s.preci
|
|
|
5993
5990
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5994
5991
|
,geoConicConformalSpain:
|
|
5995
5992
|
// A composite projection for Spain, configured by default for 960×500.
|
|
5996
|
-
function(){var n,e,a,r,i,o=
|
|
5993
|
+
function(){var n,e,a,r,i,o=Nb().rotate([5,-38.6]).parallels([0,60]),s=Nb().rotate([5,-38.6]).parallels([0,60]),l={point:function(t,n){i=[t,n]}};
|
|
5997
5994
|
/*
|
|
5998
5995
|
var iberianPeninsuleBbox = [[-11, 46], [4, 35]];
|
|
5999
5996
|
var canaryIslandsBbox = [[-19.0, 28.85], [-12.7, 28.1]];
|
|
@@ -6527,7 +6524,7 @@ return n}function l(t){return t.map(s)}return null==e&&null==i?{type:"Feature",p
|
|
|
6527
6524
|
@memberof Matrix
|
|
6528
6525
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
6529
6526
|
@private
|
|
6530
|
-
*/_draw(l){var{rowValues:h,columnValues:u,shapeData:c}=h6.bind(this)(this._filteredData);if(h.length&&u.length){let t=this._height-this._margin.top-this._margin.bottom,e=this._select,i=this._transition,n=this._width-this._margin.left-this._margin.right;var g={opacity:0},d={opacity:1},f=n/u.length<120,p=(t,n)=>
|
|
6527
|
+
*/_draw(l){var{rowValues:h,columnValues:u,shapeData:c}=h6.bind(this)(this._filteredData);if(h.length&&u.length){let t=this._height-this._margin.top-this._margin.bottom,e=this._select,i=this._transition,n=this._width-this._margin.left-this._margin.right;var g={opacity:0},d={opacity:1},f=n/u.length<120,p=(t,n)=>Pt("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:i},n)).node(),_=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(h).height(t-this._margin.top-this._margin.bottom-this._padding.bottom-this._padding.top).maxSize(n/4).width(n).config(this._rowConfig).render(),this._rowAxis.outerBounds().width),m=(this._padding.left+=_,`translate(0, ${this._margin.top})`),g=Object.assign({transform:m},g),g=(this._columnAxis.select(p("column",{enter:g,update:g})).domain(u).range([this._margin.left+this._padding.left,n-this._margin.right+this._padding.right]).height(t).maxSize(t/4).width(n).labelRotation(f).config(this._columnConfig).render(),this._columnAxis.outerBounds().height),f=(this._padding.top+=g,super._draw(l),`translate(${this._margin.left}, ${this._margin.top})`),m=`translate(0, ${this._margin.top})`,l=Object.assign({transform:m},d);this._rowAxis.select(p("row",{update:Object.assign({transform:f},d)})).height(t-this._margin.top-this._margin.bottom-this._padding.bottom).maxSize(_).range([g+this._columnAxis.padding(),void 0]).render(),this._columnAxis.select(p("column",{update:l})).range([this._margin.left+this._padding.left+this._rowAxis.padding(),n-this._margin.right+this._padding.right]).maxSize(g).render();let a=this._rowAxis._getPosition.bind(this._rowAxis),r=this._columnAxis._getPosition.bind(this._columnAxis),o=1<h.length?a(h[1])-a(h[0]):this._rowAxis.height(),s=1<u.length?r(u[1])-r(u[0]):this._columnAxis.width();m=`translate(0, ${this._margin.top})`,f=Lt.bind(this)(this._shapeConfig,"shape","Rect");this._shapes.push((new wc).data(c).select(Pt("g.d3plus-Matrix-cells",{parent:this._select,enter:{transform:m},update:{transform:m}}).node()).config({height:o-this._cellPadding,width:s-this._cellPadding,x:t=>r(t.column)+s/2,y:t=>a(t.row)+o/2}).config(f).render())}return this}
|
|
6531
6528
|
/**
|
|
6532
6529
|
@memberof Matrix
|
|
6533
6530
|
@desc The pixel padding in between each cell.
|
|
@@ -6646,11 +6643,11 @@ a?n[u]=a:delete n[u],
|
|
|
6646
6643
|
/**
|
|
6647
6644
|
* Fetches the unique ID for a data point, whether it's defined by data or nodes.
|
|
6648
6645
|
* @private
|
|
6649
|
-
*/function
|
|
6646
|
+
*/function N6(t,n){return""+(this._id(t,n)||this._nodeGroupBy[Dt([this._drawDepth,this._nodeGroupBy.length-1])](t,n))}class P6 extends zf{
|
|
6650
6647
|
/**
|
|
6651
6648
|
Extends the draw behavior of the abstract Viz class.
|
|
6652
6649
|
@private
|
|
6653
|
-
*/_draw(t){super._draw(t);var t=this._duration,n=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,i=this._width-this._margin.left-this._margin.right;let a=this._filteredData.reduce((t,n,e)=>(t[this._id(n,e)]=n,t),{}),r=this._nodes.reduce((t,n,e)=>(t[
|
|
6650
|
+
*/_draw(t){super._draw(t);var t=this._duration,n=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,i=this._width-this._margin.left-this._margin.right;let a=this._filteredData.reduce((t,n,e)=>(t[this._id(n,e)]=n,t),{}),r=this._nodes.reduce((t,n,e)=>(t[N6.bind(this)(n,e)]=n,t),{}),o=(r=Array.from(new Set(Object.keys(a).concat(Object.keys(r)))).map((t,n)=>{var e=a[t],i=r[t];return void 0!==i&&{__d3plus__:!0,data:e||i,i:n,id:t,fx:void 0===e||isNaN(this._x(e))?this._x(i):this._x(e),fy:void 0===e||isNaN(this._y(e))?this._y(i):this._y(e),node:i,r:this._size?void 0!==e&&void 0!==this._size(e)?this._size(e):this._size(i):this._sizeMin,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(i)}}).filter(t=>t),this._nodeLookup=r.reduce((t,n)=>(t[n.id]=n,t),{})),s=r.map(t=>t.node);var l,h,u,c,g,d,f,p,_,m=this._links.map(t=>{var n=typeof t.source;return{size:this._linkSize(t),source:"number"==n?r[s.indexOf(this._nodes[t.source])]:"string"==n?o[t.source]:o[t.source.id],target:"number"==n?r[s.indexOf(this._nodes[t.target])]:"string"==n?o[t.target]:o[t.target.id]}}),y=(this._linkLookup=m.reduce((t,n)=>(t[n.source.id]||(t[n.source.id]=[]),t[n.source.id].push(n.target),t[n.target.id]||(t[n.target.id]=[]),t[n.target.id].push(n.source),t),{}),r.some(t=>void 0===t.fx||void 0===t.fy));if(y){let n=$a().domain(Hi(m,t=>t.size)).range([.1,.5]);var y=E6().force("link",S6(m).id(t=>t.id).distance(1).strength(t=>n(t.size)).iterations(4)).force("charge",(d=v6(-30),p=(f=1)/0,_=.81,b.initialize=function(t,n){l=t,u=n,x()},b.strength=function(t){return arguments.length?(d="function"==typeof t?t:v6(+t),x(),b):d},b.distanceMin=function(t){return arguments.length?(f=t*t,b):Math.sqrt(f)},b.distanceMax=function(t){return arguments.length?(p=t*t,b):Math.sqrt(p)},b.theta=function(t){return arguments.length?(_=t*t,b):Math.sqrt(_)},b.strength(-1))).stop(),v=1-Math.pow(.001,.01),v=(y.velocityDecay(0),y.alphaMin(.001),y.alphaDecay(v),y.alphaDecay(0),y.nodes(r),y.tick(100).stop(),r.map(t=>[t.vx,t.vy]));let e=0,i=0,a=0;2===v.length?e=100:2<v.length&&(y=Gu((t=>{if((n=t.length)<3)return null;for(var n,e=new Array(n),i=new Array(n),a=0;a<n;++a)e[a]=[+t[a][0],+t[a][1],a];for(e.sort(Su),a=0;a<n;++a)i[a]=[e[a][0],-e[a][1]];var r=ku(e),o=ku(i),s=o[0]===r[0],l=o[o.length-1]===r[r.length-1],h=[];
|
|
6654
6651
|
// Construct the hull polygon, removing possible duplicate endpoints.
|
|
6655
6652
|
// Add upper hull in right-to-l order.
|
|
6656
6653
|
// Then add lower hull in left-to-right order.
|
|
@@ -6661,7 +6658,7 @@ if(t.length){for(i=a=r=0;r<4;++r)(n=t[r])&&(e=Math.abs(n.value))&&(o+=n.value,s+
|
|
|
6661
6658
|
// Limit forces for very close nodes; randomize direction if coincident.
|
|
6662
6659
|
if(o*o/_<s)return s<p&&(0===a&&(s+=(a=b6(u))*a),0===r&&(s+=(r=b6(u))*r),s<f&&(s=Math.sqrt(f*s)),h.vx+=a*t.value*c/s,h.vy+=r*t.value*c/s),!0;
|
|
6663
6660
|
// Limit forces for very close nodes; randomize direction if coincident.
|
|
6664
|
-
if(!(t.length||p<=s))for((t.data!==h||t.next)&&(0===a&&(s+=(a=b6(u))*a),0===r&&(s+=(r=b6(u))*r),s<f)&&(s=Math.sqrt(f*s));t.data!==h&&(o=g[t.data.index]*c/s,h.vx+=a*o,h.vy+=r*o),t=t.next;);}v=Hi(r.map(t=>t.fx)),y=Hi(r.map(t=>t.fy));let k=$a().domain(v).range([0,i]),C=$a().domain(y).range([0,n]);var v=(v[1]-v[0])/(y[1]-y[0])||1,y=i/n,M=(y<v?(M=n*y/v,C.range([(n-M)/2,n-(n-M)/2])):(M=i*v/y,k.range([(i-M)/2,i-(i-M)/2])),r.forEach(t=>{t.x=k(t.fx),t.y=C(t.fy)}),Hi(r.map(t=>t.r))),A=this._sizeMax||Ot([1,Dt(oa(r.map(n=>r.map(t=>n===t?null:Ku([n.x,n.y],[t.x,t.y])))))/2]);let z=Ts["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(M).range([M[0]===M[1]?A:Dt([A/2,this._sizeMin]),A]),T=k.domain(),E=C.domain();var
|
|
6661
|
+
if(!(t.length||p<=s))for((t.data!==h||t.next)&&(0===a&&(s+=(a=b6(u))*a),0===r&&(s+=(r=b6(u))*r),s<f)&&(s=Math.sqrt(f*s));t.data!==h&&(o=g[t.data.index]*c/s,h.vx+=a*o,h.vy+=r*o),t=t.next;);}v=Hi(r.map(t=>t.fx)),y=Hi(r.map(t=>t.fy));let k=$a().domain(v).range([0,i]),C=$a().domain(y).range([0,n]);var v=(v[1]-v[0])/(y[1]-y[0])||1,y=i/n,M=(y<v?(M=n*y/v,C.range([(n-M)/2,n-(n-M)/2])):(M=i*v/y,k.range([(i-M)/2,i-(i-M)/2])),r.forEach(t=>{t.x=k(t.fx),t.y=C(t.fy)}),Hi(r.map(t=>t.r))),A=this._sizeMax||Ot([1,Dt(oa(r.map(n=>r.map(t=>n===t?null:Ku([n.x,n.y],[t.x,t.y])))))/2]);let z=Ts["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(M).range([M[0]===M[1]?A:Dt([A/2,this._sizeMin]),A]),T=k.domain(),E=C.domain();var N=T[1]-T[0],P=E[1]-E[0],L=(r.forEach(t=>{var n=z(t.r);T[0]>k.invert(t.x-n)&&(T[0]=k.invert(t.x-n)),T[1]<k.invert(t.x+n)&&(T[1]=k.invert(t.x+n)),E[0]>C.invert(t.y-n)&&(E[0]=C.invert(t.y-n)),E[1]<C.invert(t.y+n)&&(E[1]=C.invert(t.y+n))}),T[1]-T[0]);A*=Dt([N/L,P/(E[1]-E[0])]),z.range([M[0]===M[1]?A:Dt([A/2,this._sizeMin]),A]),k.domain(T),C.domain(E);let B=(y<v?i:n)/2;r.forEach(t=>{t.x=k(t.fx),t.fx=t.x,t.y=C(t.fy),t.fy=t.y,t.r=z(t.r)||B,t.width=2*t.r,t.height=2*t.r}),this._container=this._select.selectAll("svg.d3plus-network").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-network").attr("opacity",0).attr("width",i).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color","transparent").merge(this._container),this._container.transition().duration(t).attr("opacity",1).attr("width",i).attr("height",n).attr("x",this._margin.left).attr("y",this._margin.top);N=this._container.selectAll("rect.d3plus-network-hitArea").data([0]),N.enter().append("rect").attr("class","d3plus-network-hitArea").merge(N).attr("width",i).attr("height",n).attr("fill","transparent").on("click",()=>{this._focus&&(this.active(!1),this._focus=void 0,this._zoomToBounds(null))}),this._zoomGroup=this._container.selectAll("g.d3plus-network-zoomGroup").data([0]),L=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup),P=Hi(m,t=>t.size);if(P[0]!==P[1]){let n=Ts["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(P).range([this._linkSizeMin,z.range()[0]]);m.forEach(t=>{t.size=n(t.size)})}M=Lt.bind(this)(this._shapeConfig,"edge","Path");delete M.on,this._shapes.push((new zc).config(M).strokeWidth(t=>t.size).activeStyle({"stroke-width":t=>t.size}).d(t=>`M${t.source.x},${t.source.y} ${t.target.x},`+t.target.y).data(m).select(Pt("g.d3plus-network-links",{parent:L,duration:t,enter:{transform:e},update:{transform:e}}).node()).render());let O={label:t=>!!(r.length<=this._dataCutoff||this._hover&&this._hover(t)||this._active&&this._active(t))&&this._drawLabel(t.data||t.node,t.i),select:Pt("g.d3plus-network-nodes",{parent:L,duration:t,enter:{transform:e},update:{transform:e}}).node()};return ca().key(t=>t.shape).entries(r).forEach(t=>{this._shapes.push((new Tc[t.key]).config(Lt.bind(this)(this._shapeConfig,"shape",t.key)).config(O).config(O[t.key]||{}).data(t.values).render())}),this}
|
|
6665
6662
|
/**
|
|
6666
6663
|
@memberof Network
|
|
6667
6664
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -6753,7 +6750,7 @@ if(!(t.length||p<=s))for((t.data!==h||t.next)&&(0===a&&(s+=(a=b6(u))*a),0===r&&(
|
|
|
6753
6750
|
@memberof Network
|
|
6754
6751
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
6755
6752
|
@private
|
|
6756
|
-
*/constructor(){super(),this._links=[],this._linkSize=Bt(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[p("id")],this._nodes=[],this._on["click.shape"]=(t,o,n,e)=>{if(this._tooltipClass.data([]).render(),this._hover&&this._drawDepth>=this._groupBy.length-1){let r=
|
|
6753
|
+
*/constructor(){super(),this._links=[],this._linkSize=Bt(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[p("id")],this._nodes=[],this._on["click.shape"]=(t,o,n,e)=>{if(this._tooltipClass.data([]).render(),this._hover&&this._drawDepth>=this._groupBy.length-1){let r=N6.bind(this)(t,o);if(this._focus&&this._focus===r)this.active(!1),this._on.mouseenter.bind(this)(t,o,n,e),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);t=this._linkLookup[r],o=this._nodeLookup[r];let e=[r],n=[o.x-o.r,o.x+o.r],i=[o.y-o.r,o.y+o.r],a=(t.forEach(t=>{e.push(t.id),t.x-t.r<n[0]&&(n[0]=t.x-t.r),t.x+t.r>n[1]&&(n[1]=t.x+t.r),t.y-t.r<i[0]&&(i[0]=t.y-t.r),t.y+t.r>i[1]&&(i[1]=t.y+t.r)}),this.active((t,n)=>t.source&&t.target?t.source.id===r||t.target.id===r:e.includes(N6.bind(this)(t,n))),this._focus=r,$d(this._container.node()));n=n.map(t=>t*a.k+a.x),i=i.map(t=>t*a.k+a.y),this._zoomToBounds([[n[0],i[0]],[n[1],i[1]]])}}},this._on["click.legend"]=(t,n,e,i)=>{var r=this._id(t),o=(o=this._ids(t))[o.length-1];if(this._hover&&this._drawDepth>=this._groupBy.length-1){if(this._focus&&this._focus===r)this.active(!1),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);var s=r.map(t=>this._nodeLookup[t]);let e=[""+o],n=[s[0].x-s[0].r,s[0].x+s[0].r],i=[s[0].y-s[0].r,s[0].y+s[0].r],a=(s.forEach(t=>{e.push(t.id),t.x-t.r<n[0]&&(n[0]=t.x-t.r),t.x+t.r>n[1]&&(n[1]=t.x+t.r),t.y-t.r<i[0]&&(i[0]=t.y-t.r),t.y+t.r>i[1]&&(i[1]=t.y+t.r)}),this.active((t,n)=>t.source&&t.target?e.includes(t.source.id)&&e.includes(t.target.id):(t=this._ids(t,n),e.includes(""+t[t.length-1]))),this._focus=r,$d(this._container.node()));n=n.map(t=>t*a.k+a.x),i=i.map(t=>t*a.k+a.y),this._zoomToBounds([[n[0],i[0]],[n[1],i[1]]])}this._on.mouseenter.bind(this)(t,n,e,i),this._on["mousemove.legend"].bind(this)(t,n,e,i)}},this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let u=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,n,e,i)=>{u(t,n,e,i);let a=N6.bind(this)(t,n),r=this._linkLookup[a]||[],o=this._nodeLookup[a],s=[a],l=[o.x-o.r,o.x+o.r],h=[o.y-o.r,o.y+o.r];r.forEach(t=>{s.push(t.id),t.x-t.r<l[0]&&(l[0]=t.x-t.r),t.x+t.r>l[1]&&(l[1]=t.x+t.r),t.y-t.r<h[0]&&(h[0]=t.y-t.r),t.y+t.r>h[1]&&(h[1]=t.y+t.r)}),this.hover((t,n)=>t.source&&t.target?t.source.id===a||t.target.id===a:s.includes(""+this._ids(t,n)[this._drawDepth]))},this._sizeMin=5,this._sizeScale="sqrt",this._shape=Bt("Circle"),this._shapeConfig=Et(this._shapeConfig,{ariaLabel:(t,n)=>{var e=this._size?", "+this._size(t,n):"";return this._drawLabel(t,n)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee"}}),this._x=p("x"),this._y=p("y"),this._zoom=!0}}function L6(t){var n=0,e=t.children,i=e&&e.length;if(i)for(;0<=--i;)n+=e[i].value;else n=1;t.value=n}function B6(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=D6)):void 0===n&&(n=O6);for(var e,i,a,r,o,t=new I6(t),s=[t];e=s.pop();)if((a=n(e.data))&&(o=(a=Array.from(a)).length))for(e.children=a,r=o-1;0<=r;--r)s.push(i=a[r]=new I6(a[r])),i.parent=e,i.depth=e.depth+1;return t.eachBefore(R6)}function O6(t){return t.children}function D6(t){return Array.isArray(t)?t[1]:null}function j6(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function R6(t){for(var n=0;t.height=n,(t=t.parent)&&t.height<++n;);}function I6(t){this.data=t,this.depth=this.height=0,this.parent=null}function F6(t){if("function"!=typeof t)throw new Error;return t}function H6(){return 0}function G6(t){return function(){return t}}
|
|
6757
6754
|
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
|
|
6758
6755
|
I6.prototype=B6.prototype={constructor:I6,count:function(){return this.eachAfter(L6)},each:function(t,n){let e=-1;for(var i of this)t.call(n,i,++e,this);return this},eachAfter:function(t,n){for(var e,i,a,r=this,o=[r],s=[],l=-1;r=o.pop();)if(s.push(r),e=r.children)for(i=0,a=e.length;i<a;++i)o.push(e[i]);for(;r=s.pop();)t.call(n,r,++l,this);return this},eachBefore:function(t,n){for(var e,i,a,r=[this],o=-1;e=r.pop();)if(t.call(n,e,++o,this),i=e.children)for(a=i.length-1;0<=a;--a)r.push(i[a]);return this},find:function(t,n){let e=-1;for(var i of this)if(t.call(n,i,++e,this))return i},sum:function(a){return this.eachAfter(function(t){for(var n=+a(t.data)||0,e=t.children,i=e&&e.length;0<=--i;)n+=e[i].value;t.value=n})},sort:function(n){return this.eachBefore(function(t){t.children&&t.children.sort(n)})},path:function(t){for(var n=this,e=((t,n)=>{if(t===n)return t;var e=t.ancestors(),i=n.ancestors(),a=null;for(t=e.pop(),n=i.pop();t===n;)a=t,t=e.pop(),n=i.pop();return a})(n,t),i=[n];n!==e;)n=n.parent,i.push(n);for(var a=i.length;t!==e;)i.splice(a,0,t),t=t.parent;return i},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var n=[];return this.eachBefore(function(t){t.children||n.push(t)}),n},links:function(){var n=this,e=[];return n.each(function(t){t!==n&&e.push({source:t.parent,target:t})}),e},copy:function(){return B6(this).eachBefore(j6)},[Symbol.iterator]:function*(){var t,n,e,i,a,r=[this];do{for(n=r.reverse(),r=[];t=n.pop();)if(yield t,e=t.children)for(i=0,a=e.length;i<a;++i)r.push(e[i])}while(r.length)}};let K6=1664525,U6=1013904223,W6=4294967296;function q6(t,n){for(var e,i,a=0,r=(t=((t,n)=>{let e=t.length,i,a;for(;e;)a=n()*e--|0,i=t[e],t[e]=t[a],t[a]=i;return t})(Array.from(t),n)).length,o=[];a<r;)e=t[a],i&&V6(i,e)?++a:(i=(t=>{switch(t.length){case 1:return(t=>({x:t.x,y:t.y,r:t.r}))(t[0]);case 2:return X6(t[0],t[1]);case 3:return Z6(t[0],t[1],t[2])}})(o=((t,n)=>{var e,i;if(Y6(n,t))return[n];
|
|
6759
6756
|
// If we get here then B must have at least one element.
|
|
@@ -6846,7 +6843,7 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
6846
6843
|
/**
|
|
6847
6844
|
Extends the draw behavior of the abstract Viz class.
|
|
6848
6845
|
@private
|
|
6849
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=Math.min(t,n),n=`translate(${(n-e)/2}, ${(t-e)/2})`;let i=ca();for(let t=0;t<=this._drawDepth;t++)i.key(this._groupBy[t]);i=i.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(B6({key:i.key,values:i},t=>t.values).sum(this._sum).sort(this._sort)).descendants().filter((t,n)=>(t.__d3plus__=!0,t.i=n,t.id=t.parent?t.parent.data.key:"root",t.data.__d3plusOpacity__=t.height?this._packOpacity(t.data,n):1,t.data.__d3plusTooltip__=!t.height,!t.children||1<t.children.length));return this._shapes.push((new xc).data(t).select(
|
|
6846
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=Math.min(t,n),n=`translate(${(n-e)/2}, ${(t-e)/2})`;let i=ca();for(let t=0;t<=this._drawDepth;t++)i.key(this._groupBy[t]);i=i.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(B6({key:i.key,values:i},t=>t.values).sum(this._sum).sort(this._sort)).descendants().filter((t,n)=>(t.__d3plus__=!0,t.i=n,t.id=t.parent?t.parent.data.key:"root",t.data.__d3plusOpacity__=t.height?this._packOpacity(t.data,n):1,t.data.__d3plusTooltip__=!t.height,!t.children||1<t.children.length));return this._shapes.push((new xc).data(t).select(Pt("g.d3plus-Pack",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(Lt.bind(this)(this._shapeConfig,"shape","Circle")).render()),this}
|
|
6850
6847
|
/**
|
|
6851
6848
|
@memberof Pack
|
|
6852
6849
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -6890,7 +6887,7 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
6890
6887
|
@memberof Priestley
|
|
6891
6888
|
@desc Extends the render behavior of the abstract Viz class.
|
|
6892
6889
|
@private
|
|
6893
|
-
*/_draw(r){if(super._draw(r),this._filteredData){r=this._filteredData.map((t,n)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?
|
|
6890
|
+
*/_draw(r){if(super._draw(r),this._filteredData){r=this._filteredData.map((t,n)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?Nt(this._end(t,n)):this._end(t,n),i:n,id:this._id(t,n),start:"time"===this._axisConfig.scale?Nt(this._start(t,n)):this._start(t,n)})).filter(t=>0<t.end-t.start).sort((t,n)=>t.start-n.start);let t;if(1<this._groupBy.length&&0<this._drawDepth){var o=ca();for(let n=0;n<this._drawDepth;n++)o.key(t=>this._groupBy[n](t.data,t.i));t=o.entries(r)}else t=[{values:r}];let i=0;t.forEach(t=>{let e=[];t.values.forEach(n=>{var t=(e=e.map(t=>!(t<=n.start)&&t)).indexOf(!1);t<0?(n.lane=i+e.length,e.push(n.end)):(e[t]=n.end,n.lane=i+t)}),i+=e.length});var s={domain:[Dt(r,t=>t.start)||0,Ot(r,t=>t.end)||0],height:this._height-this._margin.top-this._margin.bottom,width:this._width-this._margin.left-this._margin.right},l=`translate(${this._margin.left}, ${this._margin.top})`,s=(this._axisTest.config(s).config(this._axisConfig).select(Pt("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render(),this._axis.config(s).config(this._axisConfig).select(Pt("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).render(),this._axisTest._padding);let n=this._axis._d3Scale,e=xa().domain(jt(0,i,1)).paddingInner(this._paddingInner).paddingOuter(this._paddingOuter).rangeRound([this._height-this._margin.bottom-this._axisTest.outerBounds().height-s,this._margin.top+s]),a=e.bandwidth();this._shapes.push((new wc).data(r).duration(this._duration).height(a).label((t,n)=>this._drawLabel(t.data,n)).select(Pt("g.d3plus-priestley-shapes",{parent:this._select}).node()).width(t=>{t=Math.abs(n(t.end)-n(t.start));return 2<t?t-2:t}).x(t=>n(t.start)+(n(t.end)-n(t.start))/2).y(t=>e(t.lane)+a/2).config(Lt.bind(this)(this._shapeConfig,"shape","Rect")).render())}return this}
|
|
6894
6891
|
/**
|
|
6895
6892
|
@memberof Priestley
|
|
6896
6893
|
@desc If *value* is specified, sets the config method for the axis and returns the current class instance. If *value* is not specified, returns the current axis configuration.
|
|
@@ -6929,7 +6926,7 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
6929
6926
|
/**
|
|
6930
6927
|
Extends the draw behavior of the abstract Viz class.
|
|
6931
6928
|
@private
|
|
6932
|
-
*/_draw(t){super._draw(t);let h=this._height-this._margin.top-this._margin.bottom,u=this._width-this._margin.left-this._margin.right,c=Dt([h,u])/2-this._outerPadding,n=`translate(${u/2}, ${h/2})`;var t=ca().key(this._metric).entries(this._filteredData),e=ca().key(this._id).key(this._metric).entries(this._filteredData);let i=Ot(e.map(t=>t.values.map(t=>sa(t.values,(t,n)=>this._value(t,n)))).flat());var a=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:c*((t+1)/this._levels)})),r=Lt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete r.label,(new xc).data(a).select(
|
|
6929
|
+
*/_draw(t){super._draw(t);let h=this._height-this._margin.top-this._margin.bottom,u=this._width-this._margin.left-this._margin.right,c=Dt([h,u])/2-this._outerPadding,n=`translate(${u/2}, ${h/2})`;var t=ca().key(this._metric).entries(this._filteredData),e=ca().key(this._id).key(this._metric).entries(this._filteredData);let i=Ot(e.map(t=>t.values.map(t=>sa(t.values,(t,n)=>this._value(t,n)))).flat());var a=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:c*((t+1)/this._levels)})),r=Lt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete r.label,(new xc).data(a).select(Pt("g.d3plus-Radar-radial-circles",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(r).render();let g=t.length;var a=t.map((t,n)=>{var e=this._outerPadding,i=2*(1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(t,n)||11)),a=parseInt(360-360/g*n/90,10)%4+1,r=w9/g*n;let o=360/g*n,s="start",l=10;2!=a&&3!=a||(l=-e-10,s="end",o+=180);a={x:l,y:-i/2,width:e,height:i};return{__d3plus__:!0,data:_u(t.values,this._aggs),i:n,id:t.key,angle:o,textAnchor:s,labelBounds:a,rotateAnchor:[-l,i/2],x:c*Math.cos(r),y:c*Math.sin(r)}}).sort((t,n)=>t.key-n.key),r=((new wc).data(a).rotate(t=>t.angle||0).width(0).height(0).x(t=>t.x).y(t=>t.y).label(t=>t.id).labelBounds(t=>t.labelBounds).labelConfig(this._axisConfig.shapeConfig.labelConfig).select(Pt("g.d3plus-Radar-text",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).render(),(new zc).data(a).d(t=>`M0,0 ${-t.x},`+-t.y).select(Pt("g.d3plus-Radar-axis",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(Lt.bind(this)(this._axisConfig.shapeConfig,"shape","Path")).render(),e.map(t=>{var n=t.values.map((t,n)=>{t=sa(t.values,(t,n)=>this._value(t,n))/i*c,n=w9/g*n;return{x:t*Math.cos(n),y:t*Math.sin(n)}}),e=`M ${n[0].x} ${n[0].y} ${n.map(t=>`L ${t.x} `+t.y).join(" ")} L ${n[0].x} `+n[0].y;return{arr:t.values.map(t=>_u(t.values,this._aggs)),id:t.key,points:n,d:e,__d3plus__:!0,data:_u(t.values.map(t=>_u(t.values,this._aggs)),this._aggs)}})),o=Lt.bind(this)(this._shapeConfig,"shape","Path"),s=Object.keys(o.on);o.on={};for(let t=0;t<s.length;t++){let l=s[t];o.on[l]=(t,n,e,i)=>{var a=t.points.map(t=>t.x+u/2),r=t.points.map(t=>t.y+h/2);let o=vt(i,this._select.node());a=a.map(t=>Math.abs(t-o[0]));let s=r.map(t=>Math.abs(t-o[1]));r=a.map((t,n)=>t+s[n]);this._on[l].bind(this)(t.arr[r.indexOf(Dt(r))],n,e,i)}}return this._shapes.push((new zc).data(r).d(t=>t.d).select(Pt("g.d3plus-Radar-items",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(o).render()),this}
|
|
6933
6930
|
/**
|
|
6934
6931
|
@memberof Radar
|
|
6935
6932
|
@desc Sets the config method used for the radial spokes, circles, and labels.
|
|
@@ -6970,7 +6967,7 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
6970
6967
|
/**
|
|
6971
6968
|
* Extracts the axis config "labels" Array, if it exists, it filters
|
|
6972
6969
|
* the column labels by the values included in the Array.
|
|
6973
|
-
*/l=this._columnConfig.labels instanceof Array?n.filter(t=>this._columnConfig.labels.includes(t.key)):n;this._columnLabels.data(l).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(
|
|
6970
|
+
*/l=this._columnConfig.labels instanceof Array?n.filter(t=>this._columnConfig.labels.includes(t.key)):n;this._columnLabels.data(l).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(Pt("g.d3plus-RadialMatrix-columns",{parent:g,transition:d,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(o),i=(o-e)/h.length,a=1<n.length?n[1].radians-n[0].radians:k9,r=h.slice().reverse();f=nl().padAngle(this._cellPadding/o).innerRadius(t=>e+r.indexOf(t.row)*i+this._cellPadding/2).outerRadius(t=>e+(r.indexOf(t.row)+1)*i-this._cellPadding/2).startAngle(t=>n[u.indexOf(t.column)].radians-a/2).endAngle(t=>n[u.indexOf(t.column)].radians+a/2);this._shapes.push((new zc).data(c).d(f).select(Pt("g.d3plus-RadialMatrix-arcs",{parent:g,transition:d,enter:{transform:t},update:{transform:t}}).node()).config({id:t=>this._ids(t).join("-"),x:0,y:0}).config(Lt.bind(this)(this._shapeConfig,"shape","Path")).render())}return this}
|
|
6974
6971
|
/**
|
|
6975
6972
|
@memberof RadialMatrix
|
|
6976
6973
|
@desc The pixel padding in between each cell.
|
|
@@ -7045,7 +7042,7 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
7045
7042
|
/**
|
|
7046
7043
|
Extends the draw behavior of the abstract Viz class.
|
|
7047
7044
|
@private
|
|
7048
|
-
*/_draw(e){super._draw(e);let a=this._filteredData.reduce((t,n,e)=>(t[this._id(n,e)]=n,t),{}),l=this._nodes;!this._nodes.length&&this._links.length&&(e=Array.from(new Set(this._links.reduce((t,n)=>t.concat([n.source,n.target]),[]))),l=e.map(t=>"object"==typeof t?t:{id:t})),l=l.reduce((t,n,e)=>(t[this._nodeGroupBy?this._nodeGroupBy[this._drawDepth](n,e):this._id(n,e)]=n,t),{}),l=Array.from(new Set(Object.keys(a).concat(Object.keys(l)))).map((t,n)=>{var e=a[t],i=l[t];return void 0!==i&&{__d3plus__:!0,data:e||i,i:n,id:t,node:i,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(i)}}).filter(t=>t);let i=this._nodeLookup=l.reduce((t,n)=>(t[n.id]=n,t),{});e=this._links.map(e=>{var t=["source","target"].reduce((t,n)=>(t[n]="number"==typeof e[n]?l[e[n]]:i[e[n].id||e[n]],t),{});return t.size=this._linkSize(e),t});let r=e.reduce((t,n)=>(t[n.source.id]||(t[n.source.id]=[]),t[n.source.id].push(n),t[n.target.id]||(t[n.target.id]=[]),t[n.target.id].push(n),t),{}),t=this._duration,h=this._height-this._margin.top-this._margin.bottom,n=`translate(${this._margin.left}, ${this._margin.top})`,u=this._width-this._margin.left-this._margin.right,c=[],o=Dt([h,u])/2,g=o/3,d=g,f=2*g,p=i[this._center],s=(p.x=u/2,p.y=h/2,p.r=this._sizeMin?Ot([this._sizeMin,.65*d]):this._sizeMax?Dt([this._sizeMax,.65*d]):.65*d,[p]),_=[],m=(r[this._center].forEach(t=>{var n=t.source.id===this._center?t.target:t.source;n.edges=r[n.id].filter(t=>t.source.id!==this._center||t.target.id!==this._center),n.edge=t,s.push(n),_.push(n)}),_.sort((t,n)=>t.edges.length-n.edges.length),[]),y=0,v=(_.forEach(t=>{let e=t.id;t.edges=t.edges.filter(t=>!s.includes(t.source)&&t.target.id===e||!s.includes(t.target)&&t.source.id===e),y+=t.edges.length||1,t.edges.forEach(t=>{var{source:t,target:n}=t,t=n.id===e?t:n;s.push(t)})}),2*Math.PI),b=0;_.forEach((i,t)=>{let a=i.edges.length||1;var n=v/y*a;0===t&&(b-=n/2);let r=b+n/2-v/4;i.radians=r,i.x=u/2+d*Math.cos(r),i.y=h/2+d*Math.sin(r),b+=n,i.edges.forEach((t,n)=>{var t=t.source.id===i.id?t.target:t.source,e=v/y,e=r-e*a/2+e/2+e*n;t.radians=e,t.x=u/2+f*Math.cos(e),t.y=h/2+f*Math.sin(e),m.push(t)})});var x=g/2,w=g/4;let S=x/2-4,k=(x/2-4<8&&(S=Dt([x/2,8])),w/2-4);(k=(k=w/2-4<4?Dt([w/2,4]):k)>g/10?g/10:k)>S&&10<k&&(k=.75*S),S>1.5*k&&(S=1.5*k),S=Math.floor(S),k=Math.floor(k);let C;this._size?((x=Hi(a,t=>t.size))[0]===x[1]&&(x[0]=0),C=$a().domain(x).rangeRound([3,Dt([S,k])]),w=p.size,p.r=C(w)):C=$a().domain([1,2]).rangeRound([S,k]),m.forEach(t=>{t.ring=2;var n=this._size?t.size:2;t.r=this._sizeMin?Ot([this._sizeMin,C(n)]):this._sizeMax?Dt([this._sizeMax,C(n)]):C(n)}),_.forEach(t=>{t.ring=1;var n=this._size?t.size:1;t.r=this._sizeMin?Ot([this._sizeMin,C(n)]):this._sizeMax?Dt([this._sizeMax,C(n)]):C(n)}),l=[p].concat(_).concat(m),_.forEach(s=>{let e=s.edge;["source","target"].forEach(n=>{e[n]=l.find(t=>t.id===e[n].id)}),c.push(e),r[s.id].forEach(o=>{let n=o.source.id===s.id?o.target:o.source;if(n.id!==p.id){let r=m.find(t=>t.id===n.id);if(r=r||_.find(t=>t.id===n.id)){o.spline=!0;let e=u/2,i=h/2,a=d+.5*(f-d);["source","target"].forEach((n,t)=>{o[n+"X"]=o[n].x+Math.cos(2===o[n].ring?o[n].radians+Math.PI:o[n].radians)*o[n].r,o[n+"Y"]=o[n].y+Math.sin(2===o[n].ring?o[n].radians+Math.PI:o[n].radians)*o[n].r,o[n+"BisectX"]=e+a*Math.cos(o[n].radians),o[n+"BisectY"]=i+a*Math.sin(o[n].radians),o[n]=l.find(t=>t.id===o[n].id),void 0===o[n].edges&&(o[n].edges={});t=(0===t?o.target:o.source).id;o[n].id===s.id?o[n].edges[t]={angle:s.radians+Math.PI,radius:g/2}:o[n].edges[t]={angle:r.radians,radius:g/2}}),c.push(o)}}})}),l.forEach(i=>{if(i.id!==this._center){var a=1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(i)||11),r=2*a,o=g-i.r;let t=i.radians*(180/Math.PI),n=i.r+5,e="start";(t<-90||90<t)&&(n=-i.r-o-5,e="end",t+=180),i.labelBounds={x:n,y:-a/2,width:o,height:r},i.rotate=t,i.textAnchor=e}else i.labelBounds={x:-d/2,y:-d/2,width:d,height:d}}),this._linkLookup=e.reduce((t,n)=>(t[n.source.id]||(t[n.source.id]=[]),t[n.source.id].push(n.target),t[n.target.id]||(t[n.target.id]=[]),t[n.target.id].push(n.source),t),{});x=Hi(e,t=>t.size);if(x[0]!==x[1]){let t=Dt(l,t=>t.r),n=Ts["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(x).range([this._linkSizeMin,t]);e.forEach(t=>{t.size=n(t.size)})}w=Lt.bind(this)(this._shapeConfig,"edge","Path");delete w.on,this._shapes.push((new zc).config(w).strokeWidth(t=>t.size).id(t=>t.source.id+"_"+t.target.id).d(t=>t.spline?`M${t.sourceX},${t.sourceY}C${t.sourceBisectX},${t.sourceBisectY} ${t.targetBisectX},${t.targetBisectY} ${t.targetX},`+t.targetY:`M${t.source.x},${t.source.y} ${t.target.x},`+t.target.y).data(c).select(
|
|
7045
|
+
*/_draw(e){super._draw(e);let a=this._filteredData.reduce((t,n,e)=>(t[this._id(n,e)]=n,t),{}),l=this._nodes;!this._nodes.length&&this._links.length&&(e=Array.from(new Set(this._links.reduce((t,n)=>t.concat([n.source,n.target]),[]))),l=e.map(t=>"object"==typeof t?t:{id:t})),l=l.reduce((t,n,e)=>(t[this._nodeGroupBy?this._nodeGroupBy[this._drawDepth](n,e):this._id(n,e)]=n,t),{}),l=Array.from(new Set(Object.keys(a).concat(Object.keys(l)))).map((t,n)=>{var e=a[t],i=l[t];return void 0!==i&&{__d3plus__:!0,data:e||i,i:n,id:t,node:i,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(i)}}).filter(t=>t);let i=this._nodeLookup=l.reduce((t,n)=>(t[n.id]=n,t),{});e=this._links.map(e=>{var t=["source","target"].reduce((t,n)=>(t[n]="number"==typeof e[n]?l[e[n]]:i[e[n].id||e[n]],t),{});return t.size=this._linkSize(e),t});let r=e.reduce((t,n)=>(t[n.source.id]||(t[n.source.id]=[]),t[n.source.id].push(n),t[n.target.id]||(t[n.target.id]=[]),t[n.target.id].push(n),t),{}),t=this._duration,h=this._height-this._margin.top-this._margin.bottom,n=`translate(${this._margin.left}, ${this._margin.top})`,u=this._width-this._margin.left-this._margin.right,c=[],o=Dt([h,u])/2,g=o/3,d=g,f=2*g,p=i[this._center],s=(p.x=u/2,p.y=h/2,p.r=this._sizeMin?Ot([this._sizeMin,.65*d]):this._sizeMax?Dt([this._sizeMax,.65*d]):.65*d,[p]),_=[],m=(r[this._center].forEach(t=>{var n=t.source.id===this._center?t.target:t.source;n.edges=r[n.id].filter(t=>t.source.id!==this._center||t.target.id!==this._center),n.edge=t,s.push(n),_.push(n)}),_.sort((t,n)=>t.edges.length-n.edges.length),[]),y=0,v=(_.forEach(t=>{let e=t.id;t.edges=t.edges.filter(t=>!s.includes(t.source)&&t.target.id===e||!s.includes(t.target)&&t.source.id===e),y+=t.edges.length||1,t.edges.forEach(t=>{var{source:t,target:n}=t,t=n.id===e?t:n;s.push(t)})}),2*Math.PI),b=0;_.forEach((i,t)=>{let a=i.edges.length||1;var n=v/y*a;0===t&&(b-=n/2);let r=b+n/2-v/4;i.radians=r,i.x=u/2+d*Math.cos(r),i.y=h/2+d*Math.sin(r),b+=n,i.edges.forEach((t,n)=>{var t=t.source.id===i.id?t.target:t.source,e=v/y,e=r-e*a/2+e/2+e*n;t.radians=e,t.x=u/2+f*Math.cos(e),t.y=h/2+f*Math.sin(e),m.push(t)})});var x=g/2,w=g/4;let S=x/2-4,k=(x/2-4<8&&(S=Dt([x/2,8])),w/2-4);(k=(k=w/2-4<4?Dt([w/2,4]):k)>g/10?g/10:k)>S&&10<k&&(k=.75*S),S>1.5*k&&(S=1.5*k),S=Math.floor(S),k=Math.floor(k);let C;this._size?((x=Hi(a,t=>t.size))[0]===x[1]&&(x[0]=0),C=$a().domain(x).rangeRound([3,Dt([S,k])]),w=p.size,p.r=C(w)):C=$a().domain([1,2]).rangeRound([S,k]),m.forEach(t=>{t.ring=2;var n=this._size?t.size:2;t.r=this._sizeMin?Ot([this._sizeMin,C(n)]):this._sizeMax?Dt([this._sizeMax,C(n)]):C(n)}),_.forEach(t=>{t.ring=1;var n=this._size?t.size:1;t.r=this._sizeMin?Ot([this._sizeMin,C(n)]):this._sizeMax?Dt([this._sizeMax,C(n)]):C(n)}),l=[p].concat(_).concat(m),_.forEach(s=>{let e=s.edge;["source","target"].forEach(n=>{e[n]=l.find(t=>t.id===e[n].id)}),c.push(e),r[s.id].forEach(o=>{let n=o.source.id===s.id?o.target:o.source;if(n.id!==p.id){let r=m.find(t=>t.id===n.id);if(r=r||_.find(t=>t.id===n.id)){o.spline=!0;let e=u/2,i=h/2,a=d+.5*(f-d);["source","target"].forEach((n,t)=>{o[n+"X"]=o[n].x+Math.cos(2===o[n].ring?o[n].radians+Math.PI:o[n].radians)*o[n].r,o[n+"Y"]=o[n].y+Math.sin(2===o[n].ring?o[n].radians+Math.PI:o[n].radians)*o[n].r,o[n+"BisectX"]=e+a*Math.cos(o[n].radians),o[n+"BisectY"]=i+a*Math.sin(o[n].radians),o[n]=l.find(t=>t.id===o[n].id),void 0===o[n].edges&&(o[n].edges={});t=(0===t?o.target:o.source).id;o[n].id===s.id?o[n].edges[t]={angle:s.radians+Math.PI,radius:g/2}:o[n].edges[t]={angle:r.radians,radius:g/2}}),c.push(o)}}})}),l.forEach(i=>{if(i.id!==this._center){var a=1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(i)||11),r=2*a,o=g-i.r;let t=i.radians*(180/Math.PI),n=i.r+5,e="start";(t<-90||90<t)&&(n=-i.r-o-5,e="end",t+=180),i.labelBounds={x:n,y:-a/2,width:o,height:r},i.rotate=t,i.textAnchor=e}else i.labelBounds={x:-d/2,y:-d/2,width:d,height:d}}),this._linkLookup=e.reduce((t,n)=>(t[n.source.id]||(t[n.source.id]=[]),t[n.source.id].push(n.target),t[n.target.id]||(t[n.target.id]=[]),t[n.target.id].push(n.source),t),{});x=Hi(e,t=>t.size);if(x[0]!==x[1]){let t=Dt(l,t=>t.r),n=Ts["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(x).range([this._linkSizeMin,t]);e.forEach(t=>{t.size=n(t.size)})}w=Lt.bind(this)(this._shapeConfig,"edge","Path");delete w.on,this._shapes.push((new zc).config(w).strokeWidth(t=>t.size).id(t=>t.source.id+"_"+t.target.id).d(t=>t.spline?`M${t.sourceX},${t.sourceY}C${t.sourceBisectX},${t.sourceBisectY} ${t.targetBisectX},${t.targetBisectY} ${t.targetX},`+t.targetY:`M${t.source.x},${t.source.y} ${t.target.x},`+t.target.y).data(c).select(Pt("g.d3plus-rings-links",{parent:this._select,duration:t,enter:{transform:n},update:{transform:n}}).node()).render());let M=this,A={label:t=>!!(l.length<=this._dataCutoff||this._hover&&this._hover(t)||this._active&&this._active(t))&&this._drawLabel(t.data||t.node,t.i),labelBounds:t=>t.labelBounds,labelConfig:{fontColor:t=>t.id===this._center?Lt.bind(M)(M._shapeConfig,"shape",t.key).labelConfig.fontColor(t):Gh(Lt.bind(M)(M._shapeConfig,"shape",t.key).fill(t)),fontResize:t=>t.id===this._center,padding:0,textAnchor:t=>i[t.id].textAnchor||Lt.bind(M)(M._shapeConfig,"shape",t.key).labelConfig.textAnchor,verticalAlign:t=>t.id===this._center?"middle":"top"},rotate:t=>i[t.id].rotate||0,select:Pt("g.d3plus-rings-nodes",{parent:this._select,duration:t,enter:{transform:n},update:{transform:n}}).node()};return ca().key(t=>t.shape).entries(l).forEach(t=>{this._shapes.push((new Tc[t.key]).config(Lt.bind(this)(this._shapeConfig,"shape",t.key)).config(A).data(t.values).render())}),this}
|
|
7049
7046
|
/**
|
|
7050
7047
|
@memberof Rings
|
|
7051
7048
|
@desc Sets the center node to be the node with the given id.
|
|
@@ -7135,20 +7132,20 @@ m.push(o={value:u,dice:l<h,children:y.slice(v,b)}),o.dice?h9(o,e,i,a,w?i+=h*u/w:
|
|
|
7135
7132
|
// Need to resets margins and padding because we are
|
|
7136
7133
|
// skipping over the default render method and using
|
|
7137
7134
|
// _draw directly.
|
|
7138
|
-
this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,right:0,top:0},this._draw()},this._sizeMin=5,this._sizeScale="sqrt",this._shape=Bt("Circle"),this._shapeConfig=Et(this._shapeConfig,{ariaLabel:(t,n)=>{var e=this._size?", "+this._size(t,n):"";return this._drawLabel(t,n)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}}function A9(n,e){let i;if(void 0===e)for(var t of n)null!=t&&(i<t||void 0===i&&t>=t)&&(i=t);else{let t=-1;for(var a of n)null!=(a=e(a,++t,n))&&(i<a||void 0===i&&a>=a)&&(i=a)}return i}function z9(n,e){let i;if(void 0===e)for(var t of n)null!=t&&(i>t||void 0===i&&t>=t)&&(i=t);else{let t=-1;for(var a of n)null!=(a=e(a,++t,n))&&(i>a||void 0===i&&a>=a)&&(i=a)}return i}function T9(n,e){let i=0;if(void 0===e)for(var t of n)(t=+t)&&(i+=t);else{let t=-1;for(var a of n)(a=+e(a,++t,n))&&(i+=a)}return i}function E9(t){return t.target.depth}function
|
|
7139
|
-
function n(){var t,n,a={nodes:B.apply(null,arguments),links:O.apply(null,arguments)},{nodes:e,links:r}=[a][0];for([t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];var i,o,s=new Map(e.map((t,n)=>[E(t,n,e),t]));for([i,o]of r.entries()){o.index=i;let{source:t,target:n}=o;"object"!=typeof t&&(t=o.source=F9(s,t)),"object"!=typeof n&&(n=o.target=F9(s,n)),t.sourceLinks.push(o),n.targetLinks.push(o)}if(null!=L)for(var{sourceLinks:l,targetLinks:h}of e)l.sort(L),h.sort(L);var u,r=a.nodes;for(u of r)u.value=void 0===u.fixedValue?Math.max(T9(u.sourceLinks,D9),T9(u.targetLinks,D9)):u.fixedValue;{let t=(r=a.nodes).length,n=new Set(r),e=new Set,i=0;for(;n.size;){for(var c of n){c.depth=i;for(var{target:g}of c.sourceLinks)e.add(g)}if(++i>t)throw new Error("circular link");n=e,e=new Set}}{let t=(r=a.nodes).length,n=new Set(r),e=new Set,i=0;for(;n.size;){for(var d of n){d.height=i;for(var{source:f}of d.targetLinks)e.add(f)}if(++i>t)throw new Error("circular link");n=e,e=new Set}}var p,r=a,_=(({nodes:t})=>{var n,e=A9(t,t=>t.depth)+1,i=(C-S-A)/(e-1),a=new Array(e);for(n of t){var r=Math.max(0,Math.min(e-1,Math.floor(
|
|
7135
|
+
this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,right:0,top:0},this._draw()},this._sizeMin=5,this._sizeScale="sqrt",this._shape=Bt("Circle"),this._shapeConfig=Et(this._shapeConfig,{ariaLabel:(t,n)=>{var e=this._size?", "+this._size(t,n):"";return this._drawLabel(t,n)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}}function A9(n,e){let i;if(void 0===e)for(var t of n)null!=t&&(i<t||void 0===i&&t>=t)&&(i=t);else{let t=-1;for(var a of n)null!=(a=e(a,++t,n))&&(i<a||void 0===i&&a>=a)&&(i=a)}return i}function z9(n,e){let i;if(void 0===e)for(var t of n)null!=t&&(i>t||void 0===i&&t>=t)&&(i=t);else{let t=-1;for(var a of n)null!=(a=e(a,++t,n))&&(i>a||void 0===i&&a>=a)&&(i=a)}return i}function T9(n,e){let i=0;if(void 0===e)for(var t of n)(t=+t)&&(i+=t);else{let t=-1;for(var a of n)(a=+e(a,++t,n))&&(i+=a)}return i}function E9(t){return t.target.depth}function N9(t,n){return t.sourceLinks.length?t.depth:n-1}function P9(t){return function(){return t}}function L9(t,n){return O9(t.source,n.source)||t.index-n.index}function B9(t,n){return O9(t.target,n.target)||t.index-n.index}function O9(t,n){return t.y0-n.y0}function D9(t){return t.value}function j9(t){return t.index}function R9(t){return t.nodes}function I9(t){return t.links}function F9(t,n){t=t.get(n);if(t)return t;throw new Error("missing: "+n)}function H9({nodes:t}){for(var e of t){let t=e.y0,n=t;for(var i of e.sourceLinks)i.y0=t+i.width/2,t+=i.width;for(var a of e.targetLinks)a.y1=n+a.width/2,n+=a.width}}function G9(){let S=0,k=0,C=1,M=1,A=24,z=8,T,E=j9,N=N9,P,L,B=R9,O=I9,D=6;// extent
|
|
7136
|
+
function n(){var t,n,a={nodes:B.apply(null,arguments),links:O.apply(null,arguments)},{nodes:e,links:r}=[a][0];for([t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];var i,o,s=new Map(e.map((t,n)=>[E(t,n,e),t]));for([i,o]of r.entries()){o.index=i;let{source:t,target:n}=o;"object"!=typeof t&&(t=o.source=F9(s,t)),"object"!=typeof n&&(n=o.target=F9(s,n)),t.sourceLinks.push(o),n.targetLinks.push(o)}if(null!=L)for(var{sourceLinks:l,targetLinks:h}of e)l.sort(L),h.sort(L);var u,r=a.nodes;for(u of r)u.value=void 0===u.fixedValue?Math.max(T9(u.sourceLinks,D9),T9(u.targetLinks,D9)):u.fixedValue;{let t=(r=a.nodes).length,n=new Set(r),e=new Set,i=0;for(;n.size;){for(var c of n){c.depth=i;for(var{target:g}of c.sourceLinks)e.add(g)}if(++i>t)throw new Error("circular link");n=e,e=new Set}}{let t=(r=a.nodes).length,n=new Set(r),e=new Set,i=0;for(;n.size;){for(var d of n){d.height=i;for(var{source:f}of d.targetLinks)e.add(f)}if(++i>t)throw new Error("circular link");n=e,e=new Set}}var p,r=a,_=(({nodes:t})=>{var n,e=A9(t,t=>t.depth)+1,i=(C-S-A)/(e-1),a=new Array(e);for(n of t){var r=Math.max(0,Math.min(e-1,Math.floor(N.call(null,n,e))));n.layer=r,n.x0=S+r*i,n.x1=n.x0+A,a[r]?a[r].push(n):a[r]=[n]}if(P)for(var o of a)o.sort(P);return a})(r),r=(T=Math.min(z,(M-k)/(A9(_,t=>t.length)-1)),_),m=z9(r,t=>(M-k-(t.length-1)*T)/T9(t,D9));for(p of r){let n=k;for(var y of p){y.y0=n,y.y1=n+y.value*m,n=y.y1+T;for(var v of y.sourceLinks)v.width=v.value*m}n=(M-n+T)/(p.length+1);for(let t=0;t<p.length;++t){var b=p[t];b.y0+=n*(t+1),b.y1+=n*(t+1)}(t=>{if(void 0===L)for(var{sourceLinks:n,targetLinks:e}of t)n.sort(B9),e.sort(L9)}
|
|
7140
7137
|
// Returns the target.y0 that would produce an ideal link from source to target.
|
|
7141
7138
|
)(p)}for(let t=0;t<D;++t){var x=Math.pow(.99,t),w=Math.max(1-x,(t+1)/D);(
|
|
7142
7139
|
// Reposition each node based on its outgoing (source) links.
|
|
7143
7140
|
(e,i,a)=>{for(let t=e.length,n=t-2;0<=n;--n){var r,o,s=e[n];for(r of s){let t=0,n=0;for(var{target:l,value:h}of r.sourceLinks){h=h*(l.layer-r.layer);t+=(
|
|
7144
7141
|
// Returns the source.y0 that would produce an ideal link from source to target.
|
|
7145
|
-
(t,n)=>{let e=n.y0-(n.targetLinks.length-1)*T/2;for(var{source:i,width:a}of n.targetLinks){if(i===t)break;e+=a+T}for(var{target:r,width:o}of t.sourceLinks){if(r===n)break;e-=o}return e})(r,l)*h,n+=h}0<n&&(o=(t/n-r.y0)*i,r.y0+=o,r.y1+=o,R(r))}void 0===
|
|
7142
|
+
(t,n)=>{let e=n.y0-(n.targetLinks.length-1)*T/2;for(var{source:i,width:a}of n.targetLinks){if(i===t)break;e+=a+T}for(var{target:r,width:o}of t.sourceLinks){if(r===n)break;e-=o}return e})(r,l)*h,n+=h}0<n&&(o=(t/n-r.y0)*i,r.y0+=o,r.y1+=o,R(r))}void 0===P&&s.sort(O9),j(s,a)}})(_,x,w),(
|
|
7146
7143
|
// Reposition each node based on its incoming (target) links.
|
|
7147
|
-
(e,i,a)=>{for(let t=1,n=e.length;t<n;++t){var r,o,s=e[t];for(r of s){let t=0,n=0;for(var{source:l,value:h}of r.targetLinks){h=h*(r.layer-l.layer);t+=((t,n)=>{let e=t.y0-(t.sourceLinks.length-1)*T/2;for(var{target:i,width:a}of t.sourceLinks){if(i===n)break;e+=a+T}for(var{source:r,width:o}of n.targetLinks){if(r===t)break;e-=o}return e})(l,r)*h,n+=h}0<n&&(o=(t/n-r.y0)*i,r.y0+=o,r.y1+=o,R(r))}void 0===
|
|
7144
|
+
(e,i,a)=>{for(let t=1,n=e.length;t<n;++t){var r,o,s=e[t];for(r of s){let t=0,n=0;for(var{source:l,value:h}of r.targetLinks){h=h*(r.layer-l.layer);t+=((t,n)=>{let e=t.y0-(t.sourceLinks.length-1)*T/2;for(var{target:i,width:a}of t.sourceLinks){if(i===n)break;e+=a+T}for(var{source:r,width:o}of n.targetLinks){if(r===t)break;e-=o}return e})(l,r)*h,n+=h}0<n&&(o=(t/n-r.y0)*i,r.y0+=o,r.y1+=o,R(r))}void 0===P&&s.sort(O9),j(s,a)}})(_,x,w)}return H9(a),a}function j(t,n){var e=t.length>>1,i=t[e];r(t,i.y0-T,e-1,n),a(t,i.y1+T,1+e,n),r(t,M,t.length-1,n),a(t,k,0,n)}
|
|
7148
7145
|
// Push any overlapping nodes down.
|
|
7149
7146
|
function a(t,n,e,i){for(;e<t.length;++e){var a=t[e],r=(n-a.y0)*i;1e-6<r&&(a.y0+=r,a.y1+=r),n=a.y1+T}}
|
|
7150
7147
|
// Push any overlapping nodes up.
|
|
7151
|
-
function r(t,n,e,i){for(;0<=e;--e){var a=t[e],r=(a.y1-n)*i;1e-6<r&&(a.y0-=r,a.y1-=r),n=a.y0-T}}function R({sourceLinks:n,targetLinks:e}){if(void 0===L){for(let{source:{sourceLinks:t}}of e)t.sort(B9);for(let{target:{targetLinks:t}}of n)t.sort(L9)}}return n.update=function(t){return H9(t),t},n.nodeId=function(t){return arguments.length?(E="function"==typeof t?t:
|
|
7148
|
+
function r(t,n,e,i){for(;0<=e;--e){var a=t[e],r=(a.y1-n)*i;1e-6<r&&(a.y0-=r,a.y1-=r),n=a.y0-T}}function R({sourceLinks:n,targetLinks:e}){if(void 0===L){for(let{source:{sourceLinks:t}}of e)t.sort(B9);for(let{target:{targetLinks:t}}of n)t.sort(L9)}}return n.update=function(t){return H9(t),t},n.nodeId=function(t){return arguments.length?(E="function"==typeof t?t:P9(t),n):E},n.nodeAlign=function(t){return arguments.length?(N="function"==typeof t?t:P9(t),n):N},n.nodeSort=function(t){return arguments.length?(P=t,n):P},n.nodeWidth=function(t){return arguments.length?(A=+t,n):A},n.nodePadding=function(t){return arguments.length?(z=T=+t,n):z},n.nodes=function(t){return arguments.length?(B="function"==typeof t?t:P9(t),n):B},n.links=function(t){return arguments.length?(O="function"==typeof t?t:P9(t),n):O},n.linkSort=function(t){return arguments.length?(L=t,n):L},n.size=function(t){return arguments.length?(S=k=0,C=+t[0],M=+t[1],n):[C-S,M-k]},n.extent=function(t){return arguments.length?(S=+t[0][0],C=+t[1][0],k=+t[0][1],M=+t[1][1],n):[[S,k],[C,M]]},n.iterations=function(t){return arguments.length?(D=+t,n):D},n}var K9=Math.PI,U9=2*K9,W9=1e-6,q9=U9-W9;function $9(){this._x0=this._y0=this._x1=this._y1=null,// end of current subpath
|
|
7152
7149
|
this._=""}function V9(){return new $9}function Y9(t){return function(){return t}}function X9(t){return t[0]}function Z9(t){return t[1]}$9.prototype=V9.prototype={constructor:$9,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,i){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+i)},bezierCurveTo:function(t,n,e,i,a,r){this._+="C"+ +t+","+ +n+","+ +e+","+ +i+","+(this._x1=+a)+","+(this._y1=+r)},arcTo:function(t,n,e,i,a){var r,o,s=this._x1,l=this._y1,h=(e=+e)-(t=+t),u=(i=+i)-(n=+n),c=s-t,g=l-n,d=c*c+g*g;
|
|
7153
7150
|
// Is the radius negative? Error.
|
|
7154
7151
|
if((a=+a)<0)throw new Error("negative radius: "+a);
|
|
@@ -7165,11 +7162,11 @@ e&&(
|
|
|
7165
7162
|
// Is this a complete circle? Draw two arcs to complete the circle.
|
|
7166
7163
|
q9<(
|
|
7167
7164
|
// Does the angle go the wrong way? Flip the direction.
|
|
7168
|
-
r=r<0?r%U9+U9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+",0,1,"+u+","+(this._x1=l)+","+(this._y1=h):W9<r&&(this._+="A"+e+","+e+",0,"+ +(K9<=r)+","+u+","+(this._x1=t+e*Math.cos(a))+","+(this._y1=n+e*Math.sin(a))))},rect:function(t,n,e,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +i+"h"+-e+"Z"},toString:function(){return this._}};var J9=Array.prototype.slice;function Q9(t){return t.source}function tx(t){return t.target}function nx(t,n,e,i,a){t.moveTo(n,e),t.bezierCurveTo(n=(n+i)/2,e,n,a,i,a)}function ex(){return a=nx,r=Q9,o=tx,s=X9,l=Z9,h=null,n.source=function(t){return arguments.length?(r=t,n):r},n.target=function(t){return arguments.length?(o=t,n):o},n.x=function(t){return arguments.length?(s="function"==typeof t?t:Y9(+t),n):s},n.y=function(t){return arguments.length?(l="function"==typeof t?t:Y9(+t),n):l},n.context=function(t){return arguments.length?(h=null==t?null:t,n):h},n;function n(){var t,n=J9.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if(h=h||(t=V9()),a(h,+s.apply(this,(n[0]=e,n)),+l.apply(this,n),+s.apply(this,(n[0]=i,n)),+l.apply(this,n)),t)return h=null,t+""||null}var a,r,o,s,l,h}function ix(t){return[t.source.x1,t.y0]}function ax(t){return[t.target.x0,t.y1]}let rx={center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?z9(t.sourceLinks,E9)-1:0},justify:
|
|
7165
|
+
r=r<0?r%U9+U9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+",0,1,"+u+","+(this._x1=l)+","+(this._y1=h):W9<r&&(this._+="A"+e+","+e+",0,"+ +(K9<=r)+","+u+","+(this._x1=t+e*Math.cos(a))+","+(this._y1=n+e*Math.sin(a))))},rect:function(t,n,e,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +i+"h"+-e+"Z"},toString:function(){return this._}};var J9=Array.prototype.slice;function Q9(t){return t.source}function tx(t){return t.target}function nx(t,n,e,i,a){t.moveTo(n,e),t.bezierCurveTo(n=(n+i)/2,e,n,a,i,a)}function ex(){return a=nx,r=Q9,o=tx,s=X9,l=Z9,h=null,n.source=function(t){return arguments.length?(r=t,n):r},n.target=function(t){return arguments.length?(o=t,n):o},n.x=function(t){return arguments.length?(s="function"==typeof t?t:Y9(+t),n):s},n.y=function(t){return arguments.length?(l="function"==typeof t?t:Y9(+t),n):l},n.context=function(t){return arguments.length?(h=null==t?null:t,n):h},n;function n(){var t,n=J9.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if(h=h||(t=V9()),a(h,+s.apply(this,(n[0]=e,n)),+l.apply(this,n),+s.apply(this,(n[0]=i,n)),+l.apply(this,n)),t)return h=null,t+""||null}var a,r,o,s,l,h}function ix(t){return[t.source.x1,t.y0]}function ax(t){return[t.target.x0,t.y1]}let rx={center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?z9(t.sourceLinks,E9)-1:0},justify:N9,left:function(t){return t.depth},right:function(t,n){return n-1-t.height}};class ox extends zf{
|
|
7169
7166
|
/**
|
|
7170
7167
|
Extends the draw behavior of the abstract Viz class.
|
|
7171
7168
|
@private
|
|
7172
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=(Array.isArray(this._nodes)?this._nodes:this._links.reduce((t,n)=>(t.includes(n[this._linksSource])||t.push(n[this._linksSource]),t.includes(n[this._linksTarget])||t.push(n[this._linksTarget]),t),[]).map(t=>({id:t}))).map((t,n)=>({__d3plus__:!0,data:t,i:n,id:this._nodeId(t,n),node:t,shape:"Rect"}));let i=this._nodeLookup=e.reduce((t,n,e)=>(t[n.id]=e,t),{});var a=this._links.map((e,t)=>{var n=[this._linksSource,this._linksTarget].reduce((t,n)=>(t[n]=i[e[n]],t),{});return{source:n[this._linksSource],target:n[this._linksTarget],value:this._value(e,t)}});this._linkLookup=a.reduce((t,n)=>(t[n.source]||(t[n.source]=[]),t[n.source].push(n.target),t[n.target]||(t[n.target]=[]),t[n.target].push(n.source),t),{});let r=`translate(${this._margin.left}, ${this._margin.top})`;return this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(e).links(a).size([n,t])(),this._shapes.push((new zc).config(this._shapeConfig.Path).data(a).d(this._path).select(
|
|
7169
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=(Array.isArray(this._nodes)?this._nodes:this._links.reduce((t,n)=>(t.includes(n[this._linksSource])||t.push(n[this._linksSource]),t.includes(n[this._linksTarget])||t.push(n[this._linksTarget]),t),[]).map(t=>({id:t}))).map((t,n)=>({__d3plus__:!0,data:t,i:n,id:this._nodeId(t,n),node:t,shape:"Rect"}));let i=this._nodeLookup=e.reduce((t,n,e)=>(t[n.id]=e,t),{});var a=this._links.map((e,t)=>{var n=[this._linksSource,this._linksTarget].reduce((t,n)=>(t[n]=i[e[n]],t),{});return{source:n[this._linksSource],target:n[this._linksTarget],value:this._value(e,t)}});this._linkLookup=a.reduce((t,n)=>(t[n.source]||(t[n.source]=[]),t[n.source].push(n.target),t[n.target]||(t[n.target]=[]),t[n.target].push(n.source),t),{});let r=`translate(${this._margin.left}, ${this._margin.top})`;return this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(e).links(a).size([n,t])(),this._shapes.push((new zc).config(this._shapeConfig.Path).data(a).d(this._path).select(Pt("g.d3plus-Links",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).render()),ca().key(t=>t.shape).entries(e).forEach(t=>{this._shapes.push((new Tc[t.key]).data(t.values).height(t=>t.y1-t.y0).width(t=>t.x1-t.x0).x(t=>(t.x1+t.x0)/2).y(t=>(t.y1+t.y0)/2).select(Pt("g.d3plus-sankey-nodes",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).config(Lt.bind(this)(this._shapeConfig,"shape",t.key)).render())}),this}
|
|
7173
7170
|
/**
|
|
7174
7171
|
@memberof Sankey
|
|
7175
7172
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -7255,7 +7252,7 @@ r=r<0?r%U9+U9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7255
7252
|
/**
|
|
7256
7253
|
Merges the values of a given nest branch.
|
|
7257
7254
|
@private
|
|
7258
|
-
*/t.forEach((t,n)=>{t.data.key&&t.data.values&&(t.data=function n(t){return _u(t.values.map(t=>t.key&&t.values?n(t):t),e._aggs)}(t.data)),t.__d3plus__=!0,t.i=n});let a=this._shapeConfig.r;"function"!=typeof a&&(a=Bt(a));var h=Ot(t,t=>1===t.depth?a(t.data,t.i):0),u=Ot(t,t=>t.children?0:a(t.data,t.i)),c=Hi(t,t=>t.y);this._labelHeight=Dt([o?50:100,(c[1]-h-u)/(this._groupBy.length+1)]),this._labelWidths=mu(t,t=>t.depth).map(a=>a.values.reduce((t,n,e)=>{var i=e<a.values.length-1?a.values[e+1].x:l+this._margin[s],e=e?a.values[e-1].x:this._margin[s];return Dt([t,i-n.x,n.x-e])},l));let g=$a().domain(c).range([h+this._labelHeight,n-u-this._labelHeight]),d=(t.forEach(t=>{var n=g(t.y);r?(t.y=t.x,t.x=n):t.y=n}),{parent:this._select,enter:{transform:i},update:{transform:i}}),f=(this._shapes.push((new zc).data(t.filter(t=>1<t.depth).map(t=>Et({},t))).select(
|
|
7255
|
+
*/t.forEach((t,n)=>{t.data.key&&t.data.values&&(t.data=function n(t){return _u(t.values.map(t=>t.key&&t.values?n(t):t),e._aggs)}(t.data)),t.__d3plus__=!0,t.i=n});let a=this._shapeConfig.r;"function"!=typeof a&&(a=Bt(a));var h=Ot(t,t=>1===t.depth?a(t.data,t.i):0),u=Ot(t,t=>t.children?0:a(t.data,t.i)),c=Hi(t,t=>t.y);this._labelHeight=Dt([o?50:100,(c[1]-h-u)/(this._groupBy.length+1)]),this._labelWidths=mu(t,t=>t.depth).map(a=>a.values.reduce((t,n,e)=>{var i=e<a.values.length-1?a.values[e+1].x:l+this._margin[s],e=e?a.values[e-1].x:this._margin[s];return Dt([t,i-n.x,n.x-e])},l));let g=$a().domain(c).range([h+this._labelHeight,n-u-this._labelHeight]),d=(t.forEach(t=>{var n=g(t.y);r?(t.y=t.x,t.x=n):t.y=n}),{parent:this._select,enter:{transform:i},update:{transform:i}}),f=(this._shapes.push((new zc).data(t.filter(t=>1<t.depth).map(t=>Et({},t))).select(Pt("g.d3plus-Tree-Links",d).node()).config(Lt.bind(this)(this._shapeConfig,"shape","Path")).config({d:t=>{let n=this._shapeConfig.r;"function"==typeof n&&(n=n(t.data,t.i));var e=t.parent.x-t.x+(o?0:n),t=t.parent.y-t.y+(o?n:0),i=o?0:-n,a=o?-n:0;return o?`M${i},${a}C${i},${(a+t)/2} ${e},${(a+t)/2} ${e},`+t:`M${i},${a}C${(i+e)/2},${a} ${(i+e)/2},${t} ${e},`+t},id:(t,n)=>this._ids(t,n)[t.depth-1]}).render()),{id:(t,n)=>this._ids(t,n)[t.depth-1],label:(t,n)=>this._label?this._label(t.data,n):(n=this._ids(t,n).slice(0,t.depth))[n.length-1],labelConfig:{textAnchor:(t,n,e)=>o?"middle":e.children&&e.depth!==this._drawDepth+1?"end":"start",verticalAlign:(t,n,e)=>o?1===e.depth?"bottom":"top":"middle"},hitArea:(t,n,e)=>{var i=this._labelHeight,e=e.r||(o?e.height/2:e.width/2),a=this._labelWidths[t.depth-1];return{width:o?a:2*e+a,height:r?i:2*e+i,x:o?-a/2:t.children&&t.depth!==this._groupBy.length?-(e+a):-e,y:r?-i/2:t.children&&t.depth!==this._groupBy.length?-(e+this._labelHeight):-e}},labelBounds:(t,n,e)=>{var i=this._labelHeight,a=o?"height":"width",e=e.r||(o?e.height/2:e.width/2),r=this._labelWidths[t.depth-1];return{[o?"width":"height"]:r,[a]:i,[o?"x":"y"]:-r/2,[o?"y":"x"]:t.children&&t.depth!==this._groupBy.length?-(e+i):e}}});c=mu(t,t=>this._shape(t.data));let p=c.map(t=>t.key);h=this._previousShapes.filter(t=>!p.includes(t));return c.concat(h.map(t=>({key:t,values:[]}))).forEach(({key:t,values:n})=>{this._shapes.push((new Tc[t]).data(n).select(Pt("g.d3plus-Tree-"+t,d).node()).config(Lt.bind(this)(this._shapeConfig,"shape",t)).config(f).render())}),this._previousShapes=p,this}
|
|
7259
7256
|
/**
|
|
7260
7257
|
@memberof Tree
|
|
7261
7258
|
@desc Changes the orientation of the entire Tree, either "vertical" (top to bottom) or "horizontal" (left to right).
|
|
@@ -7287,7 +7284,7 @@ r=r<0?r%U9+U9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7287
7284
|
@memberof Treemap
|
|
7288
7285
|
@desc Flattens and merges treemap data.
|
|
7289
7286
|
@private
|
|
7290
|
-
*/t.children&&!function n(e){for(let t=0;t<e.length;t++){var i,a=e[t];a.depth<=o._drawDepth?n(a.children):(i=1===a.data.values.length?o._filteredData.indexOf(a.data.values[0]):void 0,a.__d3plus__=!0,a.id=a.data.key,a.i=-1<i?i:void 0,a.data=_u(a.data.values,o._aggs),a.x=a.x0+(a.x1-a.x0)/2,a.y=a.y0+(a.y1-a.y0)/2,r.push(a))}}(t.children),this._rankData=r.sort(this._sort).map(t=>t.data);let e=t.value;r.forEach(t=>{t.share=this._sum(t.data,t.i)/e});var t=`translate(${this._margin.left}, ${this._margin.top})`,i=Lt.bind(this)(this._shapeConfig,"shape","Rect");let s=i.labelConfig.fontMax,l=i.labelConfig.fontMin,h=i.labelConfig.padding;return this._shapes.push((new wc).data(r).label(t=>[this._drawLabel(t.data,t.i),qu(100*t.share,this._locale)+"%"]).select(
|
|
7287
|
+
*/t.children&&!function n(e){for(let t=0;t<e.length;t++){var i,a=e[t];a.depth<=o._drawDepth?n(a.children):(i=1===a.data.values.length?o._filteredData.indexOf(a.data.values[0]):void 0,a.__d3plus__=!0,a.id=a.data.key,a.i=-1<i?i:void 0,a.data=_u(a.data.values,o._aggs),a.x=a.x0+(a.x1-a.x0)/2,a.y=a.y0+(a.y1-a.y0)/2,r.push(a))}}(t.children),this._rankData=r.sort(this._sort).map(t=>t.data);let e=t.value;r.forEach(t=>{t.share=this._sum(t.data,t.i)/e});var t=`translate(${this._margin.left}, ${this._margin.top})`,i=Lt.bind(this)(this._shapeConfig,"shape","Rect");let s=i.labelConfig.fontMax,l=i.labelConfig.fontMin,h=i.labelConfig.padding;return this._shapes.push((new wc).data(r).label(t=>[this._drawLabel(t.data,t.i),qu(100*t.share,this._locale)+"%"]).select(Pt("g.d3plus-Treemap",{parent:this._select,enter:{transform:t},update:{transform:t}}).node()).config({height:t=>t.y1-t.y0,labelBounds:(t,n,e)=>{var i=e.height;let a=Math.min(s,.5*(i-2*h));return a<l&&(a=0),[{width:e.width,height:i-a,x:-e.width/2,y:-i/2},{width:e.width,height:a+2*h,x:-e.width/2,y:i/2-a-2*h}]},labelConfig:{textAnchor:(t,n,e)=>{let i,a=e;for(;void 0===i&&a;)void 0!==a.l&&(i=a.l),a=a.__d3plusParent__;return i?"middle":"start"},verticalAlign:(t,n,e)=>{let i,a=e;for(;void 0===i&&a;)void 0!==a.l&&(i=a.l),a=a.__d3plusParent__;return i?"bottom":"top"}},width:t=>t.x1-t.x0}).config(i).render()),this}
|
|
7291
7288
|
/**
|
|
7292
7289
|
* Applies the threshold algorithm for Treemaps.
|
|
7293
7290
|
* @param {Array} data The data to process.
|
|
@@ -7334,5 +7331,5 @@ r=r<0?r%U9+U9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7334
7331
|
@memberof Treemap
|
|
7335
7332
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
7336
7333
|
@private
|
|
7337
|
-
*/constructor(){super(),this._layoutPadding=1;let e=this._legend;function n(t){return t.x0=t.y0=0,t.x1=r,t.y1=s,t.eachBefore(i),l=[0],a&&t.eachBefore(l9),t}function i(t){var n=l[t.depth],e=t.x0+n,i=t.y0+n,a=t.x1-n,r=t.y1-n;a<e&&(e=a=(e+a)/2),r<i&&(i=r=(i+r)/2),t.x0=e,t.y0=i,t.x1=a,t.y1=r,t.children&&(n=l[t.depth+1]=h(t)/2,e+=d(t)-n,i+=u(t)-n,(a-=c(t)-n)<e&&(e=a=(e+a)/2),(r-=g(t)-n)<i&&(i=r=(i+r)/2),o(t,e,i,a,r))}var o,a,r,s,l,h,u,c,g,d;this._legend=(t,n)=>n.length!==this._filteredData.length&&e.bind(this)(t,n),this._legendSort=(t,n)=>this._sum(n)-this._sum(t),this._legendTooltip=Et({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Et({},this._shapeConfig,{ariaLabel:(t,n)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,n)+`, ${this._sum(t,n)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,n)=>{var e=f(t),i=f(n);return e&&!i?1:!e&&i?-1:n.value-t.value},this._sum=p("value"),this._thresholdKey=this._sum,this._tile=m9,this._tooltipConfig=Et({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,n,e)=>qu(100*e.share,this._locale)+"%"]]}),this._treemap=(o=m9,a=!1,s=r=1,l=[0],d=g=c=u=h=H6,n.round=function(t){return arguments.length?(a=!!t,n):a},n.size=function(t){return arguments.length?(r=+t[0],s=+t[1],n):[r,s]},n.tile=function(t){return arguments.length?(o=F6(t),n):o},n.padding=function(t){return arguments.length?n.paddingInner(t).paddingOuter(t):n.paddingInner()},n.paddingInner=function(t){return arguments.length?(h="function"==typeof t?t:G6(+t),n):h},n.paddingOuter=function(t){return arguments.length?n.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):n.paddingTop()},n.paddingTop=function(t){return arguments.length?(u="function"==typeof t?t:G6(+t),n):u},n.paddingRight=function(t){return arguments.length?(c="function"==typeof t?t:G6(+t),n):c},n.paddingBottom=function(t){return arguments.length?(g="function"==typeof t?t:G6(+t),n):g},n.paddingLeft=function(t){return arguments.length?(d="function"==typeof t?t:G6(+t),n):d},n.round(!0));let f=t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation}}t.Area=vc,t.AreaPlot=Uf,t.Axis=Dc,t.AxisBottom=jc,t.AxisLeft=Rc,t.AxisRight=Ic,t.AxisTop=Fc,t.Bar=bc,t.BarChart=Wf,t.BaseClass=Li,t.Box=Ac,t.BoxWhisker=qf,t.BumpChart=$f,t.Circle=xc,t.ColorScale=Gc,t.Donut=Yf,t.Geomap=s6,t.Image=tc,t.Legend=Hc,t.Line=Sc,t.LinePlot=l6,t.Matrix=c6,t.Message=Kc,t.Network=
|
|
7334
|
+
*/constructor(){super(),this._layoutPadding=1;let e=this._legend;function n(t){return t.x0=t.y0=0,t.x1=r,t.y1=s,t.eachBefore(i),l=[0],a&&t.eachBefore(l9),t}function i(t){var n=l[t.depth],e=t.x0+n,i=t.y0+n,a=t.x1-n,r=t.y1-n;a<e&&(e=a=(e+a)/2),r<i&&(i=r=(i+r)/2),t.x0=e,t.y0=i,t.x1=a,t.y1=r,t.children&&(n=l[t.depth+1]=h(t)/2,e+=d(t)-n,i+=u(t)-n,(a-=c(t)-n)<e&&(e=a=(e+a)/2),(r-=g(t)-n)<i&&(i=r=(i+r)/2),o(t,e,i,a,r))}var o,a,r,s,l,h,u,c,g,d;this._legend=(t,n)=>n.length!==this._filteredData.length&&e.bind(this)(t,n),this._legendSort=(t,n)=>this._sum(n)-this._sum(t),this._legendTooltip=Et({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Et({},this._shapeConfig,{ariaLabel:(t,n)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,n)+`, ${this._sum(t,n)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,n)=>{var e=f(t),i=f(n);return e&&!i?1:!e&&i?-1:n.value-t.value},this._sum=p("value"),this._thresholdKey=this._sum,this._tile=m9,this._tooltipConfig=Et({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,n,e)=>qu(100*e.share,this._locale)+"%"]]}),this._treemap=(o=m9,a=!1,s=r=1,l=[0],d=g=c=u=h=H6,n.round=function(t){return arguments.length?(a=!!t,n):a},n.size=function(t){return arguments.length?(r=+t[0],s=+t[1],n):[r,s]},n.tile=function(t){return arguments.length?(o=F6(t),n):o},n.padding=function(t){return arguments.length?n.paddingInner(t).paddingOuter(t):n.paddingInner()},n.paddingInner=function(t){return arguments.length?(h="function"==typeof t?t:G6(+t),n):h},n.paddingOuter=function(t){return arguments.length?n.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):n.paddingTop()},n.paddingTop=function(t){return arguments.length?(u="function"==typeof t?t:G6(+t),n):u},n.paddingRight=function(t){return arguments.length?(c="function"==typeof t?t:G6(+t),n):c},n.paddingBottom=function(t){return arguments.length?(g="function"==typeof t?t:G6(+t),n):g},n.paddingLeft=function(t){return arguments.length?(d="function"==typeof t?t:G6(+t),n):d},n.round(!0));let f=t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation}}t.Area=vc,t.AreaPlot=Uf,t.Axis=Dc,t.AxisBottom=jc,t.AxisLeft=Rc,t.AxisRight=Ic,t.AxisTop=Fc,t.Bar=bc,t.BarChart=Wf,t.BaseClass=Li,t.Box=Ac,t.BoxWhisker=qf,t.BumpChart=$f,t.Circle=xc,t.ColorScale=Gc,t.Donut=Yf,t.Geomap=s6,t.Image=tc,t.Legend=Hc,t.Line=Sc,t.LinePlot=l6,t.Matrix=c6,t.Message=Kc,t.Network=P6,t.Pack=b9,t.Path=zc,t.Pie=Vf,t.Plot=Kf,t.Priestley=x9,t.RESET=Ti,t.Radar=S9,t.RadialMatrix=C9,t.Rect=wc,t.Rings=M9,t.Sankey=ox,t.Shape=ec,t.StackedArea=sx,t.TextBox=Wc,t.Timeline=Sg,t.Tooltip=Od,t.Tree=lx,t.Treemap=ux,t.Viz=zf,t.Whisker=Cc,t.accessor=p,t.configPrep=Lt,t.constant=Bt,t.uuid=Ni});
|
|
7338
7335
|
//# sourceMappingURL=d3plus-core.full.js.map
|