@d3plus/core 3.0.0 → 3.0.2
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 +1 -1
- package/es/src/charts/Geomap.js +1 -1
- package/es/src/charts/Network.js +1 -1
- package/es/src/charts/Rings.js +1 -1
- package/es/src/charts/Sankey.js +1 -1
- package/es/src/charts/index.js +21 -21
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +17 -7
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +165 -165
- package/umd/d3plus-core.js +1 -1
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.2
|
|
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
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
@param {Number|String} *date*
|
|
51
51
|
*/function Bt(t){
|
|
52
52
|
// returns if falsey or already Date object
|
|
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),(
|
|
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
|
|
55
|
-
n.includes("/")||n.includes(" ")||n.includes("-")&&n.indexOf("-")?new Date(n):((a=new Date(+n,0,1)).setFullYear(t),a)))}var i="http://www.w3.org/1999/xhtml",a={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var n=t+="",e=n.indexOf(":");return 0<=e&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),a.hasOwnProperty(n)?{space:a[n],local:t}:t;// eslint-disable-line no-prototype-builtins
|
|
55
|
+
n.includes("/")||n.includes(" ")||n.includes("-")&&n.indexOf("-")?new Date(n.replace(/-/g,"/")):((a=new Date(+n,0,1)).setFullYear(t),a))))}var i="http://www.w3.org/1999/xhtml",a={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var n=t+="",e=n.indexOf(":");return 0<=e&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),a.hasOwnProperty(n)?{space:a[n],local:t}:t;// eslint-disable-line no-prototype-builtins
|
|
56
56
|
}function o(t){t=r(t);return(t.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===i&&t.documentElement.namespaceURI===i?t.createElement(e):t.createElementNS(n,e)}})(t)}function e(){}function w(t){return null==t?e:function(){return this.querySelector(t)}}
|
|
57
57
|
// Given something array like (or null), returns something that is strictly an
|
|
58
58
|
// array. This is used to ensure that array-like objects passed to d3.selectAll
|
|
@@ -124,8 +124,8 @@ delete o.__transition}o=t,s=e,l={name:n,index:i,group:a,on:Xt,tween:Jt,time:r.ti
|
|
|
124
124
|
// Note the actual delay is not known until the first callback!
|
|
125
125
|
(h=o.__transition)[s]=l).timer=Ut(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=hn(t,n);if(t.state>Qt)throw new Error("too late; already scheduled");return t}function un(t,n){t=hn(t,n);if(t.state>en)throw new Error("too late; already running");return t}function hn(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*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mn=/^#([0-9a-f]{3,8})$/,yn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),vn=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),bn=new RegExp(`^rgba\\(${pn},${pn},${pn},${n}\\)$`),xn=new RegExp(`^rgba\\(${_n},${_n},${_n},${n}\\)$`),wn=new RegExp(`^hsl\\(${n},${_n},${_n}\\)$`),Sn=new RegExp(`^hsla\\(${n},${_n},${_n},${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 kn(){return this.rgb().formatHex()}function An(){return this.rgb().formatRgb()}function Mn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?En(n):3===e?new Bn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?zn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?zn(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=yn.exec(t))?new Bn(n[1],n[2],n[3],1):(n=vn.exec(t))?new Bn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=bn.exec(t))?zn(n[1],n[2],n[3],n[4]):(n=xn.exec(t))?zn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=wn.exec(t))?On(n[1],n[2]/100,n[3]/100,1):(n=Sn.exec(t))?On(n[1],n[2]/100,n[3]/100,n[4]):Cn.hasOwnProperty(t)?En(Cn[t]):"transparent"===t?new Bn(NaN,NaN,NaN,0):null}function En(t){return new Bn(t>>16&255,t>>8&255,255&t,1)}function zn(t,n,e,i){return new Bn(t=i<=0?n=e=NaN:t,n,e,i)}function Tn(t,n,e,i){return 1===arguments.length?(a=(a=t)instanceof fn?a:Mn(a))?new Bn((a=a.rgb()).r,a.g,a.b,a.opacity):new Bn:new Bn(t,n,e,null==i?1:i);var a}function Bn(t,n,e,i){this.r=+t,this.g=+n,this.b=+e,this.opacity=+i}function Dn(){return"#"+
|
|
128
|
-
/* From FvD 13.37, CSS Color Module Level 3 */function Kn(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,Mn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:kn,formatHex:kn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Rn(this).formatHsl()},formatRgb:An,toString:An}),gn(Bn,Tn,dn(fn,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Bn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Bn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Bn(
|
|
127
|
+
l.delay<=t&&g(t-l.delay)},0,l.time)}function ln(t,n){t=hn(t,n);if(t.state>Qt)throw new Error("too late; already scheduled");return t}function un(t,n){t=hn(t,n);if(t.state>en)throw new Error("too late; already running");return t}function hn(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*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mn=/^#([0-9a-f]{3,8})$/,yn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),vn=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),bn=new RegExp(`^rgba\\(${pn},${pn},${pn},${n}\\)$`),xn=new RegExp(`^rgba\\(${_n},${_n},${_n},${n}\\)$`),wn=new RegExp(`^hsl\\(${n},${_n},${_n}\\)$`),Sn=new RegExp(`^hsla\\(${n},${_n},${_n},${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 kn(){return this.rgb().formatHex()}function An(){return this.rgb().formatRgb()}function Mn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?En(n):3===e?new Bn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?zn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?zn(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=yn.exec(t))?new Bn(n[1],n[2],n[3],1):(n=vn.exec(t))?new Bn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=bn.exec(t))?zn(n[1],n[2],n[3],n[4]):(n=xn.exec(t))?zn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=wn.exec(t))?On(n[1],n[2]/100,n[3]/100,1):(n=Sn.exec(t))?On(n[1],n[2]/100,n[3]/100,n[4]):Cn.hasOwnProperty(t)?En(Cn[t]):"transparent"===t?new Bn(NaN,NaN,NaN,0):null}function En(t){return new Bn(t>>16&255,t>>8&255,255&t,1)}function zn(t,n,e,i){return new Bn(t=i<=0?n=e=NaN:t,n,e,i)}function Tn(t,n,e,i){return 1===arguments.length?(a=(a=t)instanceof fn?a:Mn(a))?new Bn((a=a.rgb()).r,a.g,a.b,a.opacity):new Bn:new Bn(t,n,e,null==i?1:i);var a}function Bn(t,n,e,i){this.r=+t,this.g=+n,this.b=+e,this.opacity=+i}function Dn(){return"#"+Ln(this.r)+Ln(this.g)+Ln(this.b)}function Nn(){var t=Pn(this.opacity);return(1===t?"rgb(":"rgba(")+Fn(this.r)+`, ${Fn(this.g)}, `+Fn(this.b)+(1===t?")":`, ${t})`)}function Pn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ln(t){return((t=Fn(t))<16?"0":"")+t.toString(16)}function On(t,n,e,i){return i<=0?t=n=e=NaN:e<=0||1<=e?t=n=NaN:n<=0&&(t=NaN),new In(t,n,e,i)}function Rn(t){var n,e,i,a,r,o,s,l;return t instanceof In?new In(t.h,t.s,t.l,t.opacity):(t=t instanceof fn?t:Mn(t))?t instanceof In?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 In(o,s,l,t.opacity)):new In}function jn(t,n,e,i){return 1===arguments.length?Rn(t):new In(t,n,e,null==i?1:i)}function In(t,n,e,i){this.h=+t,this.s=+n,this.l=+e,this.opacity=+i}function Hn(t){return(t=(t||0)%360)<0?t+360:t}function Gn(t){return Math.max(0,Math.min(1,t||0))}
|
|
128
|
+
/* From FvD 13.37, CSS Color Module Level 3 */function Kn(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,Mn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:kn,formatHex:kn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Rn(this).formatHsl()},formatRgb:An,toString:An}),gn(Bn,Tn,dn(fn,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Bn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Bn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Bn(Fn(this.r),Fn(this.g),Fn(this.b),Pn(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:Dn,formatHex:Dn,formatHex8:function(){return"#"+Ln(this.r)+Ln(this.g)+Ln(this.b)+Ln(255*(isNaN(this.opacity)?1:this.opacity))},formatRgb:Nn,toString:Nn})),gn(In,jn,dn(fn,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new In(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new In(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 Bn(Kn(240<=t?t-240:120+t,e,n),Kn(t,e,n),Kn(t<120?240+t:t-120,e,n),this.opacity)},clamp(){return new In(Hn(this.h),Gn(this.s),Gn(this.l),Pn(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=Pn(this.opacity);return(1===t?"hsl(":"hsla(")+Hn(this.h)+`, ${100*Gn(this.s)}%, ${100*Gn(this.l)}%`+(1===t?")":`, ${t})`)}}));var $n=t=>()=>t;function qn(r){return 1==(r=+r)?Un: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)}):$n(isNaN(t)?n:t);var e,i,a}}function Un(t,n){var e,i,a=n-t;return a?(e=t,i=a,function(t){return e+t*i}):$n(isNaN(t)?n:t)}var Wn=function t(n){var o=qn(n);function e(n,t){var e=o((n=Tn(n)).r,(t=Tn(t)).r),i=o(n.g,t.g),a=o(n.b,t.b),r=Un(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 Vn(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]=ee(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 Xn(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}function Jn(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]=ee(t[e],n[e]):a[e]=n[e];return function(t){for(e in i)a[e]=i[e](t);return a}}var Qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,te=new RegExp(Qn.source,"g");function ne(t,i){var n,e,a,r,o,s=Qn.lastIndex=te.lastIndex=0,l=-1,u=[],h=[];// number interpolators
|
|
129
129
|
// Coerce inputs to strings.
|
|
130
130
|
// Interpolate pairs of numbers in a & b.
|
|
131
131
|
for(t+="",i+="";(n=Qn.exec(t))&&(e=te.exec(i));)(a=e.index)>s&&(a=i.slice(s,a),u[l]?u[l]+=a:u[++l]=a),(n=n[0])===(e=e[0])?u[l]?u[l]+=e:u[++l]=e:(u[++l]=null,h.push({i:l,x:Xn(n,e)})),s=te.lastIndex;
|
|
@@ -222,12 +222,12 @@ _n=["u0903","u093B","u093E","u093F","u0940","u0949","u094A","u094B","u094C","u09
|
|
|
222
222
|
// for a comparator (except for specific, known comparators) because we can’t
|
|
223
223
|
// tell if the comparator is symmetric, and an asymmetric comparator can’t be
|
|
224
224
|
// used to test whether a single value is comparable.
|
|
225
|
-
function s(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{var a=e+i>>>1;o(t[a],n)<0?e=1+a:i=a}while(e<i)}return e}return a=2!==e.length?(r=De,o=(t,n)=>De(e(t),n),(t,n)=>e(t)-n):(r=e===De||e===function(t,n){return null==t||null==n?NaN:n<t?-1:t<n?1:t<=n?0:NaN}?e:Pe,o=e),{left:s,center:function(t,n,e=0,i=t.length){return i=s(t,n,e,i-1),e<i&&a(t[i-1],n)>-a(t[i],n)?i-1:i},right:function(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{var a=e+i>>>1;o(t[a],n)<=0?e=1+a:i=a}while(e<i)}return e}}}function Pe(){return 0}function
|
|
225
|
+
function s(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{var a=e+i>>>1;o(t[a],n)<0?e=1+a:i=a}while(e<i)}return e}return a=2!==e.length?(r=De,o=(t,n)=>De(e(t),n),(t,n)=>e(t)-n):(r=e===De||e===function(t,n){return null==t||null==n?NaN:n<t?-1:t<n?1:t<=n?0:NaN}?e:Pe,o=e),{left:s,center:function(t,n,e=0,i=t.length){return i=s(t,n,e,i-1),e<i&&a(t[i-1],n)>-a(t[i],n)?i-1:i},right:function(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{var a=e+i>>>1;o(t[a],n)<=0?e=1+a:i=a}while(e<i)}return e}}}function Pe(){return 0}function Fe(t){return null===t?NaN:+t}let Le=Ne(De).right;function Oe(t){t=(t=>{let n=0;var e,i;let a=0,r=0;for(i of t)null!=i&&(i=+i)>=i&&(e=i-a,a+=e/++n,r+=e*(i-a));if(1<n)return r/(n-1)})(t);return t&&Math.sqrt(t)}function Re(n,e){let i,a;if(void 0===e)for(var t of n)null!=t&&(void 0===i?t>=t&&(i=a=t):(i>t&&(i=t),a<t&&(a=t)));else{let t=-1;for(var r of n)null!=(r=e(r,++t,n))&&(void 0===i?r>=r&&(i=a=r):(i>r&&(i=r),a<r&&(a=r)))}return[i,a]}
|
|
226
226
|
// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
|
|
227
|
-
Ne(
|
|
227
|
+
Ne(Fe).center;let je=class{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}};class Ie extends Map{get(t){return super.get(He(this,t))}has(t){return super.has(He(this,t))}set(t,n){return super.set((({_intern:t,_key:n},e)=>(n=n(e),t.has(n)?t.get(n):(t.set(n,e),e)))(this,t),n)}delete(t){return super.delete((({_intern:t,_key:n},e)=>(n=n(e),t.has(n)&&(e=t.get(n),t.delete(n)),e))(this,t))}constructor(e,t=function(t){return null!==t&&"object"==typeof t?t.valueOf():t}){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(let[t,n]of e)this.set(t,n)}}function He({_intern:t,_key:n},e){n=n(e);return t.has(n)?t.get(n):e}function Ge(t){return t}function Ke(t,n,...e){return $e(t,Ge,n,e)}function $e(t,u,h,c){return function e(t,i){if(i>=c.length)return h(t);var n,a=new Ie,r=c[i++];let o=-1;for(n of t){var s=r(n,++o,t),l=a.get(s);l?l.push(n):a.set(s,[n])}for(let[t,n]of a)a.set(t,e(n,i));return u(a)}(t,0)}function qe(t,n){return(null==t||!(t<=t))-(null==n||!(n<=n))||(t<n?-1:n<t?1:0)}let Ue=Math.sqrt(50),We=Math.sqrt(10),Ye=Math.sqrt(2);function Ve(t,n,e){var i=(n-t)/Math.max(0,e),a=Math.floor(Math.log10(i)),i=i/Math.pow(10,a),i=i>=Ue?10:i>=We?5:i>=Ye?2:1;let r,o,s;return a<0?(s=Math.pow(10,-a)/i,r=Math.round(t*s),o=Math.round(n*s),r/s<t&&++r,o/s>n&&--o,s=-s):(s=Math.pow(10,a)*i,r=Math.round(t/s),o=Math.round(n/s),r*s<t&&++r,o*s>n&&--o),o<r&&.5<=e&&e<2?Ve(t,n,2*e):[r,o,s]}function Ze(t,n,e){if(!(0<(e=+e)))return[];if((t=+t)===(n=+n))return[t];var i=n<t,[a,r,o]=i?Ve(n,t,e):Ve(t,n,e);if(!(a<=r))return[];var s=r-a+1,l=new Array(s);if(i)if(o<0)for(let t=0;t<s;++t)l[t]=(r-t)/-o;else for(let t=0;t<s;++t)l[t]=(r-t)*o;else if(o<0)for(let t=0;t<s;++t)l[t]=(a+t)/-o;else for(let t=0;t<s;++t)l[t]=(a+t)*o;return l}function Xe(t,n,e){return Ve(t=+t,n=+n,e=+e)[2]}function Je(t,n,e){e=+e;var i=(n=+n)<(t=+t),t=i?Xe(n,t,e):Xe(t,n,e);return(i?-1:1)*(t<0?1/-t:t)}function Nt(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 Pt(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}
|
|
228
228
|
// Based on https://github.com/mourner/quickselect
|
|
229
229
|
// ISC license, Copyright 2018 Vladimir Agafonkin.
|
|
230
|
-
function Qe(e,i,a=0,r=1/0,o){if(i=Math.floor(i),a=Math.floor(Math.max(0,a)),r=Math.floor(Math.min(e.length-1,r)),a<=i&&i<=r)for(o=void 0===o?qe:((i=De)=>{if(i===De)return qe;if("function"!=typeof i)throw new TypeError("compare is not a function");return(t,n)=>{var e=i(t,n);return e||0===e?e:(0===i(n,n))-(0===i(t,t))}})(o);a<r;){600<r-a&&(s=r-a+1,l=i-a+1,h=Math.log(s),u=.5*Math.exp(2*h/3),h=.5*Math.sqrt(h*u*(s-u)/s)*(l-s/2<0?-1:1),Qe(e,i,Math.max(a,Math.floor(i-l*u/s+h)),Math.min(r,Math.floor(i+(s-l)*u/s+h)),o));var s,l,u,h,c=e[i];let t=a,n=r;for(ti(e,a,i),0<o(e[r],c)&&ti(e,a,r);t<n;){for(ti(e,t,n),++t,--n;o(e[t],c)<0;)++t;for(;0<o(e[n],c);)--n}0===o(e[a],c)?ti(e,a,n):ti(e,++n,r),n<=i&&(a=n+1),i<=n&&(r=n-1)}return e}function ti(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function ni(t,n){var e,i;if((e=(t=Float64Array.from(function*(t){for(var n of t)null!=n&&(n=+n)>=n&&(yield n)}(t))).length)&&!isNaN(n=+n))return n<=0||e<2?Pt(t):1<=n?Nt(t):(e=(e-1)*n,(i=Nt(Qe(t,n=Math.floor(e)).subarray(0,n+1)))+(Pt(t.subarray(n+1))-i)*(e-n))}function ei(n,e){let i=0,a=0;if(void 0===e)for(var t of n)null!=t&&(t=+t)>=t&&(++i,a+=t);else{let t=-1;for(var r of n)null!=(r=e(r,++t,n))&&(r=+r)>=r&&(++i,a+=r)}if(i)return a/i}function ii(t){return Array.from(function*(t){for(var n of t)yield*n}(t))}function
|
|
230
|
+
function Qe(e,i,a=0,r=1/0,o){if(i=Math.floor(i),a=Math.floor(Math.max(0,a)),r=Math.floor(Math.min(e.length-1,r)),a<=i&&i<=r)for(o=void 0===o?qe:((i=De)=>{if(i===De)return qe;if("function"!=typeof i)throw new TypeError("compare is not a function");return(t,n)=>{var e=i(t,n);return e||0===e?e:(0===i(n,n))-(0===i(t,t))}})(o);a<r;){600<r-a&&(s=r-a+1,l=i-a+1,h=Math.log(s),u=.5*Math.exp(2*h/3),h=.5*Math.sqrt(h*u*(s-u)/s)*(l-s/2<0?-1:1),Qe(e,i,Math.max(a,Math.floor(i-l*u/s+h)),Math.min(r,Math.floor(i+(s-l)*u/s+h)),o));var s,l,u,h,c=e[i];let t=a,n=r;for(ti(e,a,i),0<o(e[r],c)&&ti(e,a,r);t<n;){for(ti(e,t,n),++t,--n;o(e[t],c)<0;)++t;for(;0<o(e[n],c);)--n}0===o(e[a],c)?ti(e,a,n):ti(e,++n,r),n<=i&&(a=n+1),i<=n&&(r=n-1)}return e}function ti(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function ni(t,n){var e,i;if((e=(t=Float64Array.from(function*(t){for(var n of t)null!=n&&(n=+n)>=n&&(yield n)}(t))).length)&&!isNaN(n=+n))return n<=0||e<2?Pt(t):1<=n?Nt(t):(e=(e-1)*n,(i=Nt(Qe(t,n=Math.floor(e)).subarray(0,n+1)))+(Pt(t.subarray(n+1))-i)*(e-n))}function ei(n,e){let i=0,a=0;if(void 0===e)for(var t of n)null!=t&&(t=+t)>=t&&(++i,a+=t);else{let t=-1;for(var r of n)null!=(r=e(r,++t,n))&&(r=+r)>=r&&(++i,a+=r)}if(i)return a/i}function ii(t){return Array.from(function*(t){for(var n of t)yield*n}(t))}function Ft(t,n,e){t=+t,n=+n,e=(a=arguments.length)<2?(n=t,t=0,1):a<3?1:+e;for(var i=-1,a=0|Math.max(0,Math.ceil((n-t)/e)),r=new Array(a);++i<a;)r[i]=t+i*e;return r}function ai(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}var n=["-",";",":","&","|","u0E2F","u0EAF","u0EC6","u0ECC","u104A","u104B","u104C","u104D","u104E","u104F","u2013","u2014","u2027","u3000","u3001","u3002","uFF0C","uFF5E"],pn=["'",">",")","}","]",".","!","?","/","u00BB","u300B","u3009"].concat(n),ri="က-ဪဿ-၉ၐ-ၕ㐀-龿-ゟ゠-ヿ-+--}⦅-゚㐀-䶿ກ-ຮະ-ໄ່-໋ໍ-ໝ",oi=new RegExp("(\\".concat(n.join("|\\"),")*[^\\s|\\").concat(n.join("|\\"),"]*(\\").concat(n.join("|\\"),")*"),"g"),si=new RegExp("[".concat(ri,"]")),li=new RegExp("(\\".concat(["'","<","(","{","[","u00AB","u300A","u3008"].join("|\\"),")*[").concat(ri,"](\\").concat(pn.join("|\\"),"|\\").concat(_n.join("|\\"),")*|[a-z0-9]+"),"gi");
|
|
231
231
|
/**
|
|
232
232
|
@function textSplit
|
|
233
233
|
@desc Splits a given sentence into an array of words.
|
|
@@ -344,11 +344,11 @@ function Qe(e,i,a=0,r=1/0,o){if(i=Math.floor(i),a=Math.floor(Math.max(0,a)),r=Ma
|
|
|
344
344
|
@function s
|
|
345
345
|
@desc Returns 4 random characters, used for constructing unique identifiers.
|
|
346
346
|
@private
|
|
347
|
-
*/function
|
|
347
|
+
*/function Fi(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}
|
|
348
348
|
/**
|
|
349
349
|
@function uuid
|
|
350
350
|
@summary Returns a unique identifier.
|
|
351
|
-
*/function
|
|
351
|
+
*/function Li(){return""+Fi()+Fi()+`-${Fi()}-${Fi()}-${Fi()}-`+Fi()+Fi()+Fi()}
|
|
352
352
|
/**
|
|
353
353
|
@desc Recursive function that resets nested Object configs.
|
|
354
354
|
@param {Object} obj
|
|
@@ -430,14 +430,14 @@ function Qe(e,i,a=0,r=1/0,o){if(i=Math.floor(i),a=Math.floor(Math.max(0,a)),r=Ma
|
|
|
430
430
|
@memberof BaseClass
|
|
431
431
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
432
432
|
@private
|
|
433
|
-
*/constructor(){this._locale="en-US",this._on={},this._parent={},this._translate=(t,n=this._locale)=>{n=ki[n];return n&&n[t]?n[t]:t},this._uuid=
|
|
433
|
+
*/constructor(){this._locale="en-US",this._on={},this._parent={},this._translate=(t,n=this._locale)=>{n=ki[n];return n&&n[t]?n[t]:t},this._uuid=Li()}}
|
|
434
434
|
/**
|
|
435
435
|
@function configPrep
|
|
436
436
|
@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.
|
|
437
437
|
@param {Object} [config = this._shapeConfig] The configuration object to parse.
|
|
438
438
|
@param {String} [type = "shape"] The event classifier to user for "on" events. For example, the default event type of "shape" will apply all events in the "on" config object with that key, like "click.shape" and "mouseleave.shape", in addition to any gloval events like "click" and "mouseleave".
|
|
439
439
|
@param {String} [nest] An optional nested key to bubble up to the parent config level.
|
|
440
|
-
*/function
|
|
440
|
+
*/function Lt(t=this._shapeConfig,i="shape",n=!1){var e={duration:this._duration,on:{}};let a=r=>(t,n,e,i)=>{if(!r)return r;let a;for(;t.__d3plus__;)a&&(t.__d3plusParent__=a),n=(a=t).i,t=t.data||t.feature;return r.bind(this)(t,n,e||a,i)},r=(t,n)=>{for(var e in n)({}.hasOwnProperty.call(n,e)&&!e.includes(".")||e.includes("."+i))&&(t.on[e]=a(n[e]))},o=t=>t.map(t=>t instanceof Array?o(t):"object"==typeof t?s({},t):"function"==typeof t?a(t):t),s=(t,n)=>{for(var e in n)!{}.hasOwnProperty.call(n,e)||("on"===e?r(t,n[e]):"function"==typeof n[e]?t[e]=a(n[e]):n[e]instanceof Array?t[e]=o(n[e]):"object"==typeof n[e]?(t[e]||(t[e]={}),t[e].on={},s(t[e],n[e])):t[e]=n[e])};return s(e,t),this._on&&r(e,this._on),n&&t[n]&&(s(e,t[n]),t[n].on)&&r(e,t[n].on),e}
|
|
441
441
|
/**
|
|
442
442
|
@function constant
|
|
443
443
|
@desc Wraps non-function variables in a simple return function.
|
|
@@ -457,12 +457,12 @@ function Qe(e,i,a=0,r=1/0,o){if(i=Math.floor(i),a=Math.floor(Math.max(0,a)),r=Ma
|
|
|
457
457
|
@private
|
|
458
458
|
*/function ji(t,n,e){return n[t]||this["_"+t](n,e)}var Ii="$";function Hi(){}function Gi(t,n){var e=new Hi;
|
|
459
459
|
// Copy constructor.
|
|
460
|
-
if(t instanceof Hi)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var i,a=-1,r=t.length;if(null==n)for(;++a<r;)e.set(a,t[a]);else for(;++a<r;)e.set(n(i=t[a],a,t),i)}else if(t)for(var o in t)e.set(o,t[o]);return e}function Ki(){var g,d,n,f=[],o=[];function p(t,e,i,a){if(e>=f.length)return null!=g&&t.sort(g),null!=d?d(t):t;for(var n,r,o,s=-1,l=t.length,u=f[e++],h=Gi(),c=i();++s<l;)(o=h.get(n=u(r=t[s])+""))?o.push(r):h.set(n,[r]);return h.each(function(t,n){a(c,n,p(t,e,i,a))}),c}return n={object:function(t){return p(t,0,$i,qi)},map:function(t){return p(t,0,Ui,Wi)},entries:function(t){return function e(t,i){var a,r;return++i>f.length?t:(r=o[i-1],null!=d&&i>=f.length?a=t.entries():(a=[],t.each(function(t,n){a.push({key:n,values:e(t,i)})})),null!=r?a.sort(function(t,n){return r(t.key,n.key)}):a)}(p(t,0,Ui,Wi),0)},key:function(t){return f.push(t),n},sortKeys:function(t){return o[f.length-1]=t,n},sortValues:function(t){return g=t,n},rollup:function(t){return d=t,n}}}function $i(){return{}}function qi(t,n,e){t[n]=e}function Ui(){return Gi()}function Wi(t,n,e){t.set(n,e)}function Yi(){}Hi.prototype=Gi.prototype={constructor:Hi,has:function(t){return Ii+t in this},get:function(t){return this[Ii+t]},set:function(t,n){return this[Ii+t]=n,this},remove:function(t){t=Ii+t;return t in this&&delete this[t]},clear:function(){for(var t in this)t[0]===Ii&&delete this[t]},keys:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push(t.slice(1));return n},values:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push(this[t]);return n},entries:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push({key:t.slice(1),value:this[t]});return n},size:function(){var t,n=0;for(t in this)t[0]===Ii&&++n;return n},empty:function(){for(var t in this)if(t[0]===Ii)return!1;return!0},each:function(t){for(var n in this)n[0]===Ii&&t(this[n],n.slice(1),this)}};n=Gi.prototype;function Vi(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Zi(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}Yi.prototype={constructor:Yi,has:n.has,add:function(t){return this[Ii+(t+="")]=t,this},remove:n.remove,clear:n.clear,values:n.keys,size:n.size,empty:n.empty,each:n.each};let Xi=Symbol("implicit");function Ji(){var e=new Ie,i=[],a=[],r=Xi;function o(t){let n=e.get(t);if(void 0===n){if(r!==Xi)return r;e.set(t,n=i.push(t)-1)}return a[n%a.length]}return o.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new Ie;for(var n of t)e.has(n)||e.set(n,i.push(n)-1);return o},o.range=function(t){return arguments.length?(a=Array.from(t),o):a.slice()},o.unknown=function(t){return arguments.length?(r=t,o):r},o.copy=function(){return Ji(i,a).unknown(r)},Vi.apply(o,arguments),o}function Qi(){var a,r,t=Ji().unknown(void 0),o=t.domain,s=t.range,l=0,u=1,h=!1,c=0,g=0,d=.5;function n(){var t=o().length,n=u<l,e=n?u:l,i=n?l:u,i=(a=(i-e)/Math.max(1,t-c+2*g),h&&(a=Math.floor(a)),e+=(i-e-a*(t-c))*d,r=a*(1-c),h&&(e=Math.round(e),r=Math.round(r)),
|
|
460
|
+
if(t instanceof Hi)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var i,a=-1,r=t.length;if(null==n)for(;++a<r;)e.set(a,t[a]);else for(;++a<r;)e.set(n(i=t[a],a,t),i)}else if(t)for(var o in t)e.set(o,t[o]);return e}function Ki(){var g,d,n,f=[],o=[];function p(t,e,i,a){if(e>=f.length)return null!=g&&t.sort(g),null!=d?d(t):t;for(var n,r,o,s=-1,l=t.length,u=f[e++],h=Gi(),c=i();++s<l;)(o=h.get(n=u(r=t[s])+""))?o.push(r):h.set(n,[r]);return h.each(function(t,n){a(c,n,p(t,e,i,a))}),c}return n={object:function(t){return p(t,0,$i,qi)},map:function(t){return p(t,0,Ui,Wi)},entries:function(t){return function e(t,i){var a,r;return++i>f.length?t:(r=o[i-1],null!=d&&i>=f.length?a=t.entries():(a=[],t.each(function(t,n){a.push({key:n,values:e(t,i)})})),null!=r?a.sort(function(t,n){return r(t.key,n.key)}):a)}(p(t,0,Ui,Wi),0)},key:function(t){return f.push(t),n},sortKeys:function(t){return o[f.length-1]=t,n},sortValues:function(t){return g=t,n},rollup:function(t){return d=t,n}}}function $i(){return{}}function qi(t,n,e){t[n]=e}function Ui(){return Gi()}function Wi(t,n,e){t.set(n,e)}function Yi(){}Hi.prototype=Gi.prototype={constructor:Hi,has:function(t){return Ii+t in this},get:function(t){return this[Ii+t]},set:function(t,n){return this[Ii+t]=n,this},remove:function(t){t=Ii+t;return t in this&&delete this[t]},clear:function(){for(var t in this)t[0]===Ii&&delete this[t]},keys:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push(t.slice(1));return n},values:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push(this[t]);return n},entries:function(){var t,n=[];for(t in this)t[0]===Ii&&n.push({key:t.slice(1),value:this[t]});return n},size:function(){var t,n=0;for(t in this)t[0]===Ii&&++n;return n},empty:function(){for(var t in this)if(t[0]===Ii)return!1;return!0},each:function(t){for(var n in this)n[0]===Ii&&t(this[n],n.slice(1),this)}};n=Gi.prototype;function Vi(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Zi(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}Yi.prototype={constructor:Yi,has:n.has,add:function(t){return this[Ii+(t+="")]=t,this},remove:n.remove,clear:n.clear,values:n.keys,size:n.size,empty:n.empty,each:n.each};let Xi=Symbol("implicit");function Ji(){var e=new Ie,i=[],a=[],r=Xi;function o(t){let n=e.get(t);if(void 0===n){if(r!==Xi)return r;e.set(t,n=i.push(t)-1)}return a[n%a.length]}return o.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new Ie;for(var n of t)e.has(n)||e.set(n,i.push(n)-1);return o},o.range=function(t){return arguments.length?(a=Array.from(t),o):a.slice()},o.unknown=function(t){return arguments.length?(r=t,o):r},o.copy=function(){return Ji(i,a).unknown(r)},Vi.apply(o,arguments),o}function Qi(){var a,r,t=Ji().unknown(void 0),o=t.domain,s=t.range,l=0,u=1,h=!1,c=0,g=0,d=.5;function n(){var t=o().length,n=u<l,e=n?u:l,i=n?l:u,i=(a=(i-e)/Math.max(1,t-c+2*g),h&&(a=Math.floor(a)),e+=(i-e-a*(t-c))*d,r=a*(1-c),h&&(e=Math.round(e),r=Math.round(r)),Ft(t).map(function(t){return e+a*t}));return s(n?i.reverse():i)}return delete t.unknown,t.domain=function(t){return(arguments.length?(o(t),n):o)()},t.range=function(t){return arguments.length?([l,u]=t,l=+l,u=+u,n()):[l,u]},t.rangeRound=function(t){return[l,u]=t,l=+l,u=+u,h=!0,n()},t.bandwidth=function(){return r},t.step=function(){return a},t.round=function(t){return arguments.length?(h=!!t,n()):h},t.padding=function(t){return arguments.length?(c=Math.min(1,g=+t),n()):c},t.paddingInner=function(t){return arguments.length?(c=Math.min(1,t),n()):c},t.paddingOuter=function(t){return arguments.length?(g=+t,n()):g},t.align=function(t){return arguments.length?(d=Math.max(0,Math.min(1,t)),n()):d},t.copy=function(){return Qi(o(),[l,u]).round(h).paddingInner(c).paddingOuter(g).align(d)},Vi.apply(n(),arguments)}function ta(t){return+t}var na=[0,1];function ea(t){return t}function ia(n,e){return(e-=n=+n)?function(t){return(t-n)/e}:(t=isNaN(e)?NaN:.5,function(){return t});var t}
|
|
461
461
|
// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
|
462
462
|
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
|
|
463
463
|
function aa(t,n,e){var i=t[0],t=t[1],a=n[0],n=n[1],a=t<i?(i=ia(t,i),e(n,a)):(i=ia(i,t),e(a,n));return function(t){return a(i(t))}}function ra(e,t,n){var i=Math.min(e.length,t.length)-1,a=new Array(i),r=new Array(i),o=-1;
|
|
464
464
|
// Reverse descending domains.
|
|
465
|
-
for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)a[o]=ia(e[o],e[o+1]),r[o]=n(t[o],t[o+1]);return function(t){var n=
|
|
465
|
+
for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<i;)a[o]=ia(e[o],e[o+1]),r[o]=n(t[o],t[o+1]);return function(t){var n=Le(e,t,1,i)-1;return r[n](a[n](t))}}function oa(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function sa(){var e,i,n,a,r,o,s=na,l=na,u=ee,h=ea;function c(){var n,e,t,i=Math.min(s.length,l.length);return h!==ea&&(n=s[0],(e=s[i-1])<n&&(t=n,n=e,e=t),h=function(t){return Math.max(n,Math.min(e,t))}),a=2<i?ra:aa,r=o=null,g}function g(t){return null==t||isNaN(t=+t)?n:(r=r||a(s.map(e),l,u))(e(h(t)))}return g.invert=function(t){return h(i((o=o||a(l,s.map(e),Xn))(t)))},g.domain=function(t){return arguments.length?(s=Array.from(t,ta),c()):s.slice()},g.range=function(t){return arguments.length?(l=Array.from(t),c()):l.slice()},g.rangeRound=function(t){return l=Array.from(t),u=ie,c()},g.clamp=function(t){return arguments.length?(h=!!t||ea,c()):h!==ea},g.interpolate=function(t){return arguments.length?(u=t,c()):u},g.unknown=function(t){return arguments.length?(n=t,g):n},function(t,n){return e=t,i=n,c()}}function la(){return sa()(ea,ea)}
|
|
466
466
|
// Computes the decimal coefficient and exponent of the specified number x with
|
|
467
467
|
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
|
468
468
|
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
|
@@ -501,7 +501,7 @@ switch(f&&g&&(t=w(l+t,l.length?d-r.length:1/0),l=""),h){case"<":t=a+t+r+l;break;
|
|
|
501
501
|
// For significant precision, it must be in [1, 21].
|
|
502
502
|
// For fixed precision, it must be in [0, 20].
|
|
503
503
|
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=da(t)).type="f",t)),t=3*Math.max(-8,Math.min(8,Math.floor(ha(n)/3))),i=Math.pow(10,-t),a=xa[8+t/3];return function(t){return e(i*t)+a}}}}function Sa(t,n,e,i){var a,r,o=Je(t,n,e);switch((i=da(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(ha(s)/3)))-ha(Math.abs(r)))))||(i.precision=r),va(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,ha(a)-ha(s))+1))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=Math.max(0,-ha(Math.abs(o))))||(i.precision=r-2*("%"===i.type))}return ya(i)}function Ca(u){var h=u.domain;return u.ticks=function(t){var n=h();return Ze(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(t,n){var e=h();return Sa(e[0],e[e.length-1],null==t?10:t,n)},u.nice=function(t){null==t&&(t=10);var n,e,i=h(),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=Xe(o,s,t))===n)return i[a]=o,i[r]=s,h(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 u},u}function ka(){var t=la();return t.copy=function(){return oa(t,ka())},Vi.apply(t,arguments),Ca(t)}function Aa(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 Ma(t){return Math.log(t)}function Ea(t){return Math.exp(t)}function za(t){return-Math.log(-t)}function Ta(t){return-Math.exp(-t)}function Ba(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Da(e){return(t,n)=>-e(-t,n)}function Na(t){let a=t(Ma,Ea),u=a.domain,h=10,c,g;function n(){var n,e;return c=(e=h)===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e),g=10===(n=h)?Ba:n===Math.E?Math.exp:t=>Math.pow(n,t),u()[0]<0?(c=Da(c),g=Da(g),t(za,Ta)):t(Ma,Ea),a}return a.base=function(t){return arguments.length?(h=+t,n()):h},a.domain=function(t){return(arguments.length?(u(t),n):u)()},a.ticks=t=>{var n=u();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(!(h%1)&&r-a<t){if(a=Math.floor(a),r=Math.ceil(r),0<e){for(;a<=r;++a)for(o=1;o<h;++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=h-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=Ze(e,i,t))}else l=Ze(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===h?"s":",":e)&&(h%1||null!=(e=da(e)).precision||(e.trim=!0),e=ya(e)),t===1/0)return e;let i=Math.max(1,h*t/a.ticks().length);// TODO fast estimate?
|
|
504
|
-
return t=>{let n=t/g(Math.round(c(t)));return n*h<h-.5&&(n*=h),n<=i?e(t):""}},a.nice=()=>u(Aa(u(),{floor:t=>g(Math.floor(c(t))),ceil:t=>g(Math.ceil(c(t)))})),a}function Pa(){let t=Na(sa()).domain([1,10]);return t.copy=()=>oa(t,Pa()).base(t.base()),Vi.apply(t,arguments),t}function
|
|
504
|
+
return t=>{let n=t/g(Math.round(c(t)));return n*h<h-.5&&(n*=h),n<=i?e(t):""}},a.nice=()=>u(Aa(u(),{floor:t=>g(Math.floor(c(t))),ceil:t=>g(Math.ceil(c(t)))})),a}function Pa(){let t=Na(sa()).domain([1,10]);return t.copy=()=>oa(t,Pa()).base(t.base()),Vi.apply(t,arguments),t}function Fa(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function La(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function Oa(n){var e=1,t=n(Fa(e),La(e));return t.constant=function(t){return arguments.length?n(Fa(e=+t),La(e)):e},Ca(t)}function Ra(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function ja(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Ia(t){return t<0?-t*t:t*t}function Ha(n){var t=n(ea,ea),e=1;return t.exponent=function(t){return arguments.length?1===(e=+t)?n(ea,ea):.5===e?n(ja,Ia):n(Ra(e),Ra(1/e)):e},Ca(t)}function Ga(){var t=Ha(sa());return t.copy=function(){return oa(t,Ga()).exponent(t.exponent())},Vi.apply(t,arguments),t}function Ka(t){return Math.sign(t)*t*t}function $a(){var n,e=[.5],i=[0,1],a=1;function r(t){return null!=t&&t<=t?i[Le(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 $a().domain(e).range(i).unknown(n)},Vi.apply(r,arguments)}ri=wa({thousands:",",grouping:[3],currency:["$",""]}),ya=ri.format,va=ri.formatPrefix;let qa=new Date,Ua=new Date;function Wa(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
|
|
505
505
|
return a},s.filter=e=>Wa(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
|
|
506
506
|
else for(;0<=--n;)for(;o(t,1),!e(t););// eslint-disable-line no-empty
|
|
507
507
|
}),e&&(s.count=(t,n)=>(qa.setTime(+t),Ua.setTime(+n),r(qa),r(Ua),Math.floor(e(qa,Ua))),s.every=n=>(n=Math.floor(n),isFinite(n)&&0<n?1<n?s.filter(i?t=>i(t)%n==0:t=>s.count(0,t)%n==0):s:null)),s}let Ya=Wa(()=>{
|
|
@@ -513,7 +513,7 @@ Ya.every=e=>(e=Math.floor(e),isFinite(e)&&0<e?1<e?Wa(t=>{t.setTime(Math.floor(t/
|
|
|
513
513
|
vr.every=e=>isFinite(e=Math.floor(e))&&0<e?Wa(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,vr,Wa(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 xr(r,t,n,e,i,a){let o=[[nr,1,Va],[nr,5,5e3],[nr,15,15e3],[nr,30,3e4],[a,1,Za],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,Xa],[i,3,3*Xa],[i,6,6*Xa],[i,12,432e5],[e,1,Ja],[e,2,2*Ja],[n,1,Qa],[t,1,2592e6],[t,3,7776e6],[r,1,tr]];function s(t,n,e){var i=Math.abs(n-t)/e,a=Ne(([,,t])=>t).right(o,i);return a===o.length?r.every(Je(t/tr,n/tr,e)):0===a?Ya.every(Math.max(Je(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
|
|
514
514
|
return i?e.reverse():e},s]}
|
|
515
515
|
// An optimized implementation for this simple case.
|
|
516
|
-
br.every=e=>isFinite(e=Math.floor(e))&&0<e?Wa(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,br;let[wr,Sr]=xr(br,yr,fr,pn,rr,ir),[Cr,kr]=xr(vr,mr,ur,or,ar,er);function Ar(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 Mr(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 Er(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,u=jr(n),h=Ir(n),c=jr(e),g=Ir(e),d=jr(o),f=Ir(o),p=jr(s),_=Ir(s),m=jr(l),y=Ir(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:so,e:so,f:go,g:Co,G:Ao,H:lo,I:uo,j:ho,L:co,m:fo,M:po,p:function(t){return n[+(12<=t.getHours())]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Vo,s:Zo,S:_o,u:mo,U:yo,V:bo,w:xo,W:wo,x:null,X:null,y:So,Y:ko,Z:Mo,"%":Yo},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:Eo,e:Eo,f:No,g:$o,G:Uo,H:zo,I:To,j:Bo,L:Do,m:Po,M:
|
|
516
|
+
br.every=e=>isFinite(e=Math.floor(e))&&0<e?Wa(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,br;let[wr,Sr]=xr(br,yr,fr,pn,rr,ir),[Cr,kr]=xr(vr,mr,ur,or,ar,er);function Ar(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 Mr(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 Er(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,u=jr(n),h=Ir(n),c=jr(e),g=Ir(e),d=jr(o),f=Ir(o),p=jr(s),_=Ir(s),m=jr(l),y=Ir(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:so,e:so,f:go,g:Co,G:Ao,H:lo,I:uo,j:ho,L:co,m:fo,M:po,p:function(t){return n[+(12<=t.getHours())]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Vo,s:Zo,S:_o,u:mo,U:yo,V:bo,w:xo,W:wo,x:null,X:null,y:So,Y:ko,Z:Mo,"%":Yo},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:Eo,e:Eo,f:No,g:$o,G:Uo,H:zo,I:To,j:Bo,L:Do,m:Po,M:Fo,p:function(t){return n[+(12<=t.getUTCHours())]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Vo,s:Zo,S:Lo,u:Oo,U:Ro,V:Io,w:Ho,W:Go,x:null,X:null,y:Ko,Y:qo,Z:Wo,"%":Yo},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 C(t,i,n,e)},d:Xr,e:Xr,f:io,g:Wr,G:Ur,H:Qr,I:Qr,j:Jr,L:eo,m:Zr,M:to,p:function(t,n,e){n=u.exec(n.slice(e));return n?(t.p=h.get(n[0].toLowerCase()),e+n[0].length):-1},q:Vr,Q:ro,s:oo,S:no,u:Gr,U:Kr,V:$r,w:Hr,W:qr,x:function(t,n,e){return C(t,a,n,e)},X:function(t,n,e){return C(t,r,n,e)},y:Wr,Y:Ur,Z:Yr,"%":ao};function w(l,u){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=Nr[n=l.charAt(++r)])?n=l.charAt(++r):e="e"===n?" ":"0",(i=u[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=Er(1900,void 0,1);if(C(i,a,t+="",0)!=t.length)return null;
|
|
517
517
|
// If a UNIX timestamp is specified, return it.
|
|
518
518
|
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));
|
|
519
519
|
// If this is utcParse, never use the local timezone.
|
|
@@ -529,7 +529,7 @@ return("Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,Mr):Ar)(i);
|
|
|
529
529
|
// Otherwise, all fields are in local time.
|
|
530
530
|
}}function C(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 Nr?n.charAt(o++):a])||(i=r(t,e,i))<0)return-1}else if(a!=e.charCodeAt(i++))return-1}return i}
|
|
531
531
|
// These recursive directive definitions must be deferred.
|
|
532
|
-
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 Tr,Br,Dr,Nr={"-":"",_:" ",0:"0"},Pr=/^\s*\d+/,Lr=/^%/,Fr=/[\\^$*+?|[\]().{}]/g;function Or(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 Rr(t){return t.replace(Fr,"\\$&")}function jr(t){return new RegExp("^(?:"+t.map(Rr).join("|")+")","i")}function Ir(t){return new Map(t.map((t,n)=>[t.toLowerCase(),n]))}function Hr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.w=+n[0],e+n[0].length):-1}function Gr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.u=+n[0],e+n[0].length):-1}function Kr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.U=+n[0],e+n[0].length):-1}function $r(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.V=+n[0],e+n[0].length):-1}function qr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.W=+n[0],e+n[0].length):-1}function Ur(t,n,e){n=Pr.exec(n.slice(e,e+4));return n?(t.y=+n[0],e+n[0].length):-1}function Wr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.y=+n[0]+(68<+n[0]?1900:2e3),e+n[0].length):-1}function Yr(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 Vr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.q=3*n[0]-3,e+n[0].length):-1}function Zr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.m=n[0]-1,e+n[0].length):-1}function Xr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.d=+n[0],e+n[0].length):-1}function Jr(t,n,e){n=Pr.exec(n.slice(e,e+3));return n?(t.m=0,t.d=+n[0],e+n[0].length):-1}function Qr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.H=+n[0],e+n[0].length):-1}function to(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.M=+n[0],e+n[0].length):-1}function no(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.S=+n[0],e+n[0].length):-1}function eo(t,n,e){n=Pr.exec(n.slice(e,e+3));return n?(t.L=+n[0],e+n[0].length):-1}function io(t,n,e){n=Pr.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=Lr.exec(n.slice(e,e+1));return n?e+n[0].length:-1}function ro(t,n,e){n=Pr.exec(n.slice(e));return n?(t.Q=+n[0],e+n[0].length):-1}function oo(t,n,e){n=Pr.exec(n.slice(e));return n?(t.s=+n[0],e+n[0].length):-1}function so(t,n){return Or(t.getDate(),n,2)}function lo(t,n){return Or(t.getHours(),n,2)}function uo(t,n){return Or(t.getHours()%12||12,n,2)}function ho(t,n){return Or(1+or.count(vr(t),t),n,3)}function co(t,n){return Or(t.getMilliseconds(),n,3)}function go(t,n){return co(t,n)+"000"}function fo(t,n){return Or(t.getMonth()+1,n,2)}function po(t,n){return Or(t.getMinutes(),n,2)}function _o(t,n){return Or(t.getSeconds(),n,2)}function mo(t){t=t.getDay();return 0===t?7:t}function yo(t,n){return Or(ur.count(vr(t)-1,t),n,2)}function vo(t){var n=t.getDay();return 4<=n||0===n?cr(t):cr.ceil(t)}function bo(t,n){return t=vo(t),Or(cr.count(vr(t),t)+(4===vr(t).getDay()),n,2)}function xo(t){return t.getDay()}function wo(t,n){return Or(hr.count(vr(t)-1,t),n,2)}function So(t,n){return Or(t.getFullYear()%100,n,2)}function Co(t,n){return Or((t=vo(t)).getFullYear()%100,n,2)}function ko(t,n){return Or(t.getFullYear()%1e4,n,4)}function Ao(t,n){var e=t.getDay();return Or((t=4<=e||0===e?cr(t):cr.ceil(t)).getFullYear()%1e4,n,4)}function Mo(t){t=t.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+Or(t/60|0,"0",2)+Or(t%60,"0",2)}function Eo(t,n){return Or(t.getUTCDate(),n,2)}function zo(t,n){return Or(t.getUTCHours(),n,2)}function To(t,n){return Or(t.getUTCHours()%12||12,n,2)}function Bo(t,n){return Or(1+sr.count(br(t),t),n,3)}function Do(t,n){return Or(t.getUTCMilliseconds(),n,3)}function No(t,n){return Do(t,n)+"000"}function Po(t,n){return Or(t.getUTCMonth()+1,n,2)}function Lo(t,n){return Or(t.getUTCMinutes(),n,2)}function Fo(t,n){return Or(t.getUTCSeconds(),n,2)}function Oo(t){t=t.getUTCDay();return 0===t?7:t}function Ro(t,n){return Or(fr.count(br(t)-1,t),n,2)}function jo(t){var n=t.getUTCDay();return 4<=n||0===n?_r(t):_r.ceil(t)}function Io(t,n){return t=jo(t),Or(_r.count(br(t),t)+(4===br(t).getUTCDay()),n,2)}function Ho(t){return t.getUTCDay()}function Go(t,n){return Or(pr.count(br(t)-1,t),n,2)}function Ko(t,n){return Or(t.getUTCFullYear()%100,n,2)}function $o(t,n){return Or((t=jo(t)).getUTCFullYear()%100,n,2)}function qo(t,n){return Or(t.getUTCFullYear()%1e4,n,4)}function Uo(t,n){var e=t.getUTCDay();return Or((t=4<=e||0===e?_r(t):_r.ceil(t)).getUTCFullYear()%1e4,n,4)}function Wo(){return"+0000"}function Yo(){return"%"}function Vo(t){return+t}function Zo(t){return Math.floor(+t/1e3)}function Xo(t){return Tr=zr(t),Br=Tr.format,Dr=Tr.utcFormat,Tr}function Jo(t){return new Date(t)}function Qo(t){return t instanceof Date?+t:+new Date(+t)}function ts(e,i,n,a,r,o,s,l,u,h){var c=la(),g=c.invert,d=c.domain,f=h(".%L"),p=h(":%S"),_=h("%I:%M"),m=h("%I %p"),y=h("%a %d"),v=h("%b %d"),b=h("%B"),x=h("%Y");function w(t){return(u(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,Qo)):d().map(Jo)},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:h(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(Aa(n,t)):c},c.copy=function(){return oa(c,ts(e,i,n,a,r,o,s,l,u,h))},c}function ns(){return Vi.apply(ts(Cr,kr,vr,mr,ur,or,ar,er,nr,Br).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function es(){var n,e,i,a,r,o=0,s=1,l=ea,u=!1;function h(t){return null==t||isNaN(t=+t)?r:l(0===i?.5:(t=(a(t)-n)*i,u?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),h):[l(0),l(1)]}}return h.domain=function(t){return arguments.length?([o,s]=t,n=a(o=+o),e=a(s=+s),i=n===e?0:1/(e-n),h):[o,s]},h.clamp=function(t){return arguments.length?(u=!!t,h):u},h.interpolator=function(t){return arguments.length?(l=t,h):l},h.range=t(ee),h.rangeRound=t(ie),h.unknown=function(t){return arguments.length?(r=t,h):r},function(t){return n=(a=t)(o),e=t(s),i=n===e?0:1/(e-n),h}}function is(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function as(){var t=Ha(es());return t.copy=function(){return is(t,as()).exponent(t.exponent())},Zi.apply(t,arguments)}function rs(){var n,e,i,a,r,o,s,l=0,u=.5,h=1,c=1,g=ea,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=ee);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,u,h]=t,n=o(l=+l),e=o(u=+u),i=o(h=+h),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f):[l,u,h]},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(ee),f.rangeRound=t(ie),f.unknown=function(t){return arguments.length?(s=t,f):s},function(t){return n=(o=t)(l),e=t(u),i=t(h),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f}}function os(){var t=Ha(rs());return t.copy=function(){return is(t,os()).exponent(t.exponent())},Zi.apply(t,arguments)}Xo({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 ss=Object.freeze({__proto__:null,scaleBand:Qi,scaleDiverging:function t(){var n=Ca(rs()(ea));return n.copy=function(){return is(n,t())},Zi.apply(n,arguments)},scaleDivergingLog:function t(){var n=Na(rs()).domain([.1,1,10]);return n.copy=function(){return is(n,t()).base(n.base())},Zi.apply(n,arguments)},scaleDivergingPow:os,scaleDivergingSqrt:function(){return os.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var n=Oa(rs());return n.copy=function(){return is(n,t()).constant(n.constant())},Zi.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,ta),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,ta):[0,1],Ca(i)},scaleImplicit:Xi,scaleLinear:ka,scaleLog:Pa,scaleOrdinal:Ji,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}(Qi.apply(null,arguments).paddingInner(1))},scalePow:Ga,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=Le)=>{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[Fe(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(De),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)},Vi.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[Fe(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)},Vi.apply(Ca(s),arguments)},scaleRadial:function t(){var n,e=la(),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(Ka(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,ta)).map(Ka)),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)},Vi.apply(r,arguments),Ca(r)},scaleSequential:function t(){var n=Ca(es()(ea));return n.copy=function(){return is(n,t())},Zi.apply(n,arguments)},scaleSequentialLog:function t(){var n=Na(es()).domain([1,10]);return n.copy=function(){return is(n,t()).base(n.base())},Zi.apply(n,arguments)},scaleSequentialPow:as,scaleSequentialQuantile:function t(){var i=[],e=ea;function a(t){if(null!=t&&!isNaN(t=+t))return e((Fe(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(De),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)=>ni(i,n/e))},a.copy=function(){return t(e).domain(i)},Zi.apply(a,arguments)},scaleSequentialSqrt:function(){return as.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var n=Oa(es());return n.copy=function(){return is(n,t()).constant(n.constant())},Zi.apply(n,arguments)},scaleSqrt:function(){return Ga.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var n=Oa(sa());return n.copy=function(){return oa(n,t()).constant(n.constant())},Vi.apply(n,arguments)},scaleThreshold:$a,scaleTime:ns,scaleUtc:function(){return Vi.apply(ts(wr,Sr,br,yr,fr,sr,rr,ir,nr,Dr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:Sa});function v(t){return function(){return t}}let ls=Math.abs,us=Math.atan2,hs=Math.cos,cs=Math.max,gs=Math.min,ds=Math.sin,fs=Math.sqrt,ps=1e-12,_s=Math.PI,ms=_s/2,ys=2*_s;function vs(t){return 1<=t?ms:t<=-1?-ms:Math.asin(t)}let bs=Math.PI,xs=2*bs,ws=1e-6,Ss=xs-ws;function Cs(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}let ks=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){
|
|
532
|
+
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 Tr,Br,Dr,Nr={"-":"",_:" ",0:"0"},Pr=/^\s*\d+/,Fr=/^%/,Lr=/[\\^$*+?|[\]().{}]/g;function Or(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 Rr(t){return t.replace(Lr,"\\$&")}function jr(t){return new RegExp("^(?:"+t.map(Rr).join("|")+")","i")}function Ir(t){return new Map(t.map((t,n)=>[t.toLowerCase(),n]))}function Hr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.w=+n[0],e+n[0].length):-1}function Gr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.u=+n[0],e+n[0].length):-1}function Kr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.U=+n[0],e+n[0].length):-1}function $r(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.V=+n[0],e+n[0].length):-1}function qr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.W=+n[0],e+n[0].length):-1}function Ur(t,n,e){n=Pr.exec(n.slice(e,e+4));return n?(t.y=+n[0],e+n[0].length):-1}function Wr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.y=+n[0]+(68<+n[0]?1900:2e3),e+n[0].length):-1}function Yr(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 Vr(t,n,e){n=Pr.exec(n.slice(e,e+1));return n?(t.q=3*n[0]-3,e+n[0].length):-1}function Zr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.m=n[0]-1,e+n[0].length):-1}function Xr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.d=+n[0],e+n[0].length):-1}function Jr(t,n,e){n=Pr.exec(n.slice(e,e+3));return n?(t.m=0,t.d=+n[0],e+n[0].length):-1}function Qr(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.H=+n[0],e+n[0].length):-1}function to(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.M=+n[0],e+n[0].length):-1}function no(t,n,e){n=Pr.exec(n.slice(e,e+2));return n?(t.S=+n[0],e+n[0].length):-1}function eo(t,n,e){n=Pr.exec(n.slice(e,e+3));return n?(t.L=+n[0],e+n[0].length):-1}function io(t,n,e){n=Pr.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=Fr.exec(n.slice(e,e+1));return n?e+n[0].length:-1}function ro(t,n,e){n=Pr.exec(n.slice(e));return n?(t.Q=+n[0],e+n[0].length):-1}function oo(t,n,e){n=Pr.exec(n.slice(e));return n?(t.s=+n[0],e+n[0].length):-1}function so(t,n){return Or(t.getDate(),n,2)}function lo(t,n){return Or(t.getHours(),n,2)}function uo(t,n){return Or(t.getHours()%12||12,n,2)}function ho(t,n){return Or(1+or.count(vr(t),t),n,3)}function co(t,n){return Or(t.getMilliseconds(),n,3)}function go(t,n){return co(t,n)+"000"}function fo(t,n){return Or(t.getMonth()+1,n,2)}function po(t,n){return Or(t.getMinutes(),n,2)}function _o(t,n){return Or(t.getSeconds(),n,2)}function mo(t){t=t.getDay();return 0===t?7:t}function yo(t,n){return Or(ur.count(vr(t)-1,t),n,2)}function vo(t){var n=t.getDay();return 4<=n||0===n?cr(t):cr.ceil(t)}function bo(t,n){return t=vo(t),Or(cr.count(vr(t),t)+(4===vr(t).getDay()),n,2)}function xo(t){return t.getDay()}function wo(t,n){return Or(hr.count(vr(t)-1,t),n,2)}function So(t,n){return Or(t.getFullYear()%100,n,2)}function Co(t,n){return Or((t=vo(t)).getFullYear()%100,n,2)}function ko(t,n){return Or(t.getFullYear()%1e4,n,4)}function Ao(t,n){var e=t.getDay();return Or((t=4<=e||0===e?cr(t):cr.ceil(t)).getFullYear()%1e4,n,4)}function Mo(t){t=t.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+Or(t/60|0,"0",2)+Or(t%60,"0",2)}function Eo(t,n){return Or(t.getUTCDate(),n,2)}function zo(t,n){return Or(t.getUTCHours(),n,2)}function To(t,n){return Or(t.getUTCHours()%12||12,n,2)}function Bo(t,n){return Or(1+sr.count(br(t),t),n,3)}function Do(t,n){return Or(t.getUTCMilliseconds(),n,3)}function No(t,n){return Do(t,n)+"000"}function Po(t,n){return Or(t.getUTCMonth()+1,n,2)}function Fo(t,n){return Or(t.getUTCMinutes(),n,2)}function Lo(t,n){return Or(t.getUTCSeconds(),n,2)}function Oo(t){t=t.getUTCDay();return 0===t?7:t}function Ro(t,n){return Or(fr.count(br(t)-1,t),n,2)}function jo(t){var n=t.getUTCDay();return 4<=n||0===n?_r(t):_r.ceil(t)}function Io(t,n){return t=jo(t),Or(_r.count(br(t),t)+(4===br(t).getUTCDay()),n,2)}function Ho(t){return t.getUTCDay()}function Go(t,n){return Or(pr.count(br(t)-1,t),n,2)}function Ko(t,n){return Or(t.getUTCFullYear()%100,n,2)}function $o(t,n){return Or((t=jo(t)).getUTCFullYear()%100,n,2)}function qo(t,n){return Or(t.getUTCFullYear()%1e4,n,4)}function Uo(t,n){var e=t.getUTCDay();return Or((t=4<=e||0===e?_r(t):_r.ceil(t)).getUTCFullYear()%1e4,n,4)}function Wo(){return"+0000"}function Yo(){return"%"}function Vo(t){return+t}function Zo(t){return Math.floor(+t/1e3)}function Xo(t){return Tr=zr(t),Br=Tr.format,Dr=Tr.utcFormat,Tr}function Jo(t){return new Date(t)}function Qo(t){return t instanceof Date?+t:+new Date(+t)}function ts(e,i,n,a,r,o,s,l,u,h){var c=la(),g=c.invert,d=c.domain,f=h(".%L"),p=h(":%S"),_=h("%I:%M"),m=h("%I %p"),y=h("%a %d"),v=h("%b %d"),b=h("%B"),x=h("%Y");function w(t){return(u(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,Qo)):d().map(Jo)},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:h(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(Aa(n,t)):c},c.copy=function(){return oa(c,ts(e,i,n,a,r,o,s,l,u,h))},c}function ns(){return Vi.apply(ts(Cr,kr,vr,mr,ur,or,ar,er,nr,Br).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function es(){var n,e,i,a,r,o=0,s=1,l=ea,u=!1;function h(t){return null==t||isNaN(t=+t)?r:l(0===i?.5:(t=(a(t)-n)*i,u?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),h):[l(0),l(1)]}}return h.domain=function(t){return arguments.length?([o,s]=t,n=a(o=+o),e=a(s=+s),i=n===e?0:1/(e-n),h):[o,s]},h.clamp=function(t){return arguments.length?(u=!!t,h):u},h.interpolator=function(t){return arguments.length?(l=t,h):l},h.range=t(ee),h.rangeRound=t(ie),h.unknown=function(t){return arguments.length?(r=t,h):r},function(t){return n=(a=t)(o),e=t(s),i=n===e?0:1/(e-n),h}}function is(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function as(){var t=Ha(es());return t.copy=function(){return is(t,as()).exponent(t.exponent())},Zi.apply(t,arguments)}function rs(){var n,e,i,a,r,o,s,l=0,u=.5,h=1,c=1,g=ea,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=ee);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,u,h]=t,n=o(l=+l),e=o(u=+u),i=o(h=+h),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f):[l,u,h]},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(ee),f.rangeRound=t(ie),f.unknown=function(t){return arguments.length?(s=t,f):s},function(t){return n=(o=t)(l),e=t(u),i=t(h),a=n===e?0:.5/(e-n),r=e===i?0:.5/(i-e),c=e<n?-1:1,f}}function os(){var t=Ha(rs());return t.copy=function(){return is(t,os()).exponent(t.exponent())},Zi.apply(t,arguments)}Xo({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 ss=Object.freeze({__proto__:null,scaleBand:Qi,scaleDiverging:function t(){var n=Ca(rs()(ea));return n.copy=function(){return is(n,t())},Zi.apply(n,arguments)},scaleDivergingLog:function t(){var n=Na(rs()).domain([.1,1,10]);return n.copy=function(){return is(n,t()).base(n.base())},Zi.apply(n,arguments)},scaleDivergingPow:os,scaleDivergingSqrt:function(){return os.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var n=Oa(rs());return n.copy=function(){return is(n,t()).constant(n.constant())},Zi.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,ta),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,ta):[0,1],Ca(i)},scaleImplicit:Xi,scaleLinear:ka,scaleLog:Pa,scaleOrdinal:Ji,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}(Qi.apply(null,arguments).paddingInner(1))},scalePow:Ga,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=Fe)=>{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[Le(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(De),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)},Vi.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[Le(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)},Vi.apply(Ca(s),arguments)},scaleRadial:function t(){var n,e=la(),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(Ka(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,ta)).map(Ka)),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)},Vi.apply(r,arguments),Ca(r)},scaleSequential:function t(){var n=Ca(es()(ea));return n.copy=function(){return is(n,t())},Zi.apply(n,arguments)},scaleSequentialLog:function t(){var n=Na(es()).domain([1,10]);return n.copy=function(){return is(n,t()).base(n.base())},Zi.apply(n,arguments)},scaleSequentialPow:as,scaleSequentialQuantile:function t(){var i=[],e=ea;function a(t){if(null!=t&&!isNaN(t=+t))return e((Le(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(De),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)=>ni(i,n/e))},a.copy=function(){return t(e).domain(i)},Zi.apply(a,arguments)},scaleSequentialSqrt:function(){return as.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var n=Oa(es());return n.copy=function(){return is(n,t()).constant(n.constant())},Zi.apply(n,arguments)},scaleSqrt:function(){return Ga.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var n=Oa(sa());return n.copy=function(){return oa(n,t()).constant(n.constant())},Vi.apply(n,arguments)},scaleThreshold:$a,scaleTime:ns,scaleUtc:function(){return Vi.apply(ts(wr,Sr,br,yr,fr,sr,rr,ir,nr,Dr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:Sa});function v(t){return function(){return t}}let ls=Math.abs,us=Math.atan2,hs=Math.cos,cs=Math.max,gs=Math.min,ds=Math.sin,fs=Math.sqrt,ps=1e-12,_s=Math.PI,ms=_s/2,ys=2*_s;function vs(t){return 1<=t?ms:t<=-1?-ms:Math.asin(t)}let bs=Math.PI,xs=2*bs,ws=1e-6,Ss=xs-ws;function Cs(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}let ks=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){
|
|
533
533
|
// Is the radius negative? Error.
|
|
534
534
|
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,u=e-t,h=i-n,c=s-t,g=l-n,d=c*c+g*g;
|
|
535
535
|
// Is this path empty? Move to (x1,y1).
|
|
@@ -553,28 +553,28 @@ this._="",this._append=null==t?Cs:(t=>{var n=Math.floor(t);if(!(0<=n))throw new
|
|
|
553
553
|
function Ds(t,n,e,i,a,r,o){var s=t-e,l=n-i,o=(o?r:-r)/fs(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,u=(t+e)/2,h=n-s,c=e-t,g=h*h+c*c,r=a-r,s=s*e-n*t,e=(c<0?-1:1)*fs(cs(0,r*r*g-s*s)),n=(s*c-h*e)/g,t=(-s*h-c*e)/g,d=(s*c+h*e)/g,s=(-s*h+c*e)/g,h=n-i,c=t-u,e=d-i,g=s-u;
|
|
554
554
|
// Pick the closer of the two intersection points.
|
|
555
555
|
// TODO Is there a faster way to determine which intersection to use?
|
|
556
|
-
return e*e+g*g<h*h+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 Ns(){var E=Ms,z=Es,T=v(0),B=null,D=zs,N=Ts,P=Bs,
|
|
556
|
+
return e*e+g*g<h*h+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 Ns(){var E=Ms,z=Es,T=v(0),B=null,D=zs,N=Ts,P=Bs,F=null,L=As(n);function n(){var t,n,e,i,a,r,o,s,l,u,h,c,g,d,f,p,_,m,y,v,b,x,w=+E.apply(this,arguments),S=+z.apply(this,arguments),C=D.apply(this,arguments)-ms,k=N.apply(this,arguments)-ms,A=ls(k-C),M=C<k;if(F=F||(t=L()),
|
|
557
557
|
// Ensure that the outer radius is always larger than the inner radius.
|
|
558
558
|
S<w&&(n=S,S=w,w=n),
|
|
559
559
|
// Is it a point?
|
|
560
|
-
S>ps?A>ys-ps?(
|
|
560
|
+
S>ps?A>ys-ps?(F.moveTo(S*hs(C),S*ds(C)),F.arc(0,0,S,C,k,!M),w>ps&&(F.moveTo(w*hs(k),w*ds(k)),F.arc(0,0,w,k,C,M))):(i=n=C,a=e=k,o=r=A,g=(h=P.apply(this,arguments)/2)>ps&&(B?+B.apply(this,arguments):fs(w*w+S*S)),x=b=s=gs(ls(S-w)/2,+T.apply(this,arguments)),
|
|
561
561
|
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
|
562
562
|
g>ps&&(c=vs(g/w*ds(h)),g=vs(g/S*ds(h)),(r-=2*c)>ps?(i+=c*=M?1:-1,a-=c):(r=0,i=a=(C+k)/2),(o-=2*g)>ps?(n+=g*=M?1:-1,e-=g):(o=0,n=e=(C+k)/2)),h=S*hs(n),c=S*ds(n),g=w*hs(a),C=w*ds(a),
|
|
563
563
|
// Apply rounded corners?
|
|
564
564
|
s>ps&&(d=S*hs(e),f=S*ds(e),p=w*hs(i),_=w*ds(i),A<_s)&&((k=((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<ps))return[t+(l=(o*(n-r)-s*(t-a))/l)*e,n+l*i]})(h,c,p,_,d,f,g,C))?(A=h-k[0],y=c-k[1],v=d-k[0],m=f-k[1],y=1/ds((1<(A=(A*v+y*m)/(fs(A*A+y*y)*fs(v*v+m*m)))?0:A<-1?_s:Math.acos(A))/2),v=fs(k[0]*k[0]+k[1]*k[1]),b=gs(s,(w-v)/(y-1)),x=gs(s,(S-v)/(1+y))):b=x=0),
|
|
565
565
|
// Is the sector collapsed to a line?
|
|
566
|
-
o>ps?x>ps?(l=Ds(p,_,h,c,S,x,M),u=Ds(d,f,g,C,S,x,M),
|
|
566
|
+
o>ps?x>ps?(l=Ds(p,_,h,c,S,x,M),u=Ds(d,f,g,C,S,x,M),F.moveTo(l.cx+l.x01,l.cy+l.y01),
|
|
567
567
|
// Have the corners merged?
|
|
568
|
-
x<s?
|
|
568
|
+
x<s?F.arc(l.cx,l.cy,x,us(l.y01,l.x01),us(u.y01,u.x01),!M):(F.arc(l.cx,l.cy,x,us(l.y01,l.x01),us(l.y11,l.x11),!M),F.arc(0,0,S,us(l.cy+l.y11,l.cx+l.x11),us(u.cy+u.y11,u.cx+u.x11),!M),F.arc(u.cx,u.cy,x,us(u.y11,u.x11),us(u.y01,u.x01),!M))):(F.moveTo(h,c),F.arc(0,0,S,n,e,!M)):F.moveTo(h,c),
|
|
569
569
|
// Is there no inner ring, and it’s a circular sector?
|
|
570
570
|
// Or perhaps it’s an annular sector collapsed due to padding?
|
|
571
|
-
w>ps&&r>ps?b>ps?(l=Ds(g,C,d,f,w,-b,M),u=Ds(h,c,p,_,w,-b,M),
|
|
571
|
+
w>ps&&r>ps?b>ps?(l=Ds(g,C,d,f,w,-b,M),u=Ds(h,c,p,_,w,-b,M),F.lineTo(l.cx+l.x01,l.cy+l.y01),
|
|
572
572
|
// Have the corners merged?
|
|
573
|
-
b<s?
|
|
574
|
-
}function
|
|
573
|
+
b<s?F.arc(l.cx,l.cy,b,us(l.y01,l.x01),us(u.y01,u.x01),!M):(F.arc(l.cx,l.cy,b,us(l.y01,l.x01),us(l.y11,l.x11),!M),F.arc(0,0,w,us(l.cy+l.y11,l.cx+l.x11),us(u.cy+u.y11,u.cx+u.x11),M),F.arc(u.cx,u.cy,b,us(u.y11,u.x11),us(u.y01,u.x01),!M))):F.arc(0,0,w,a,i,M):F.lineTo(g,C)):F.moveTo(0,0),F.closePath(),t)return F=null,t+""||null}return n.centroid=function(){var t=(+E.apply(this,arguments)+ +z.apply(this,arguments))/2,n=(+D.apply(this,arguments)+ +N.apply(this,arguments))/2-_s/2;return[hs(n)*t,ds(n)*t]},n.innerRadius=function(t){return arguments.length?(E="function"==typeof t?t:v(+t),n):E},n.outerRadius=function(t){return arguments.length?(z="function"==typeof t?t:v(+t),n):z},n.cornerRadius=function(t){return arguments.length?(T="function"==typeof t?t:v(+t),n):T},n.padRadius=function(t){return arguments.length?(B=null==t?null:"function"==typeof t?t:v(+t),n):B},n.startAngle=function(t){return arguments.length?(D="function"==typeof t?t:v(+t),n):D},n.endAngle=function(t){return arguments.length?(N="function"==typeof t?t:v(+t),n):N},n.padAngle=function(t){return arguments.length?(P="function"==typeof t?t:v(+t),n):P},n.context=function(t){return arguments.length?(F=null==t?null:t,n):F},n}var Ps=Array.prototype.slice;function Fs(t){return"object"==typeof t&&"length"in t?t:Array.from(t);// Map, Set, iterable, string, or anything else
|
|
574
|
+
}function Ls(t){this._context=t}function Os(t){return new Ls(t)}function Rs(t){return t[0]}function js(t){return t[1]}function Is(o,s){var l=v(!0),u=null,h=Os,c=null,g=As(n);function n(t){var n,e,i,a=(t=Fs(t)).length,r=!1;for(null==u&&(c=h(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?Rs:v(o),s="function"==typeof s?s:void 0===s?js: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?(h=t,null!=u&&(c=h(u)),n):h},n.context=function(t){return arguments.length?(null==t?u=c=null:c=h(u=t),n):u},n}function Hs(h,c,g){var d=null,f=v(!0),p=null,_=Os,m=null,y=As(n);function n(t){var n,e,i,a,r,o=(t=Fs(t)).length,s=!1,l=new Array(o),u=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],u[i]);m.lineEnd(),m.areaEnd()}s&&(l[n]=+h(a,n,t),u[n]=+c(a,n,t),m.point(d?+d(a,n,t):l[n],g?+g(a,n,t):u[n]))}if(r)return m=null,r+""||null}function t(){return Is().defined(f).curve(_).context(p)}return h="function"==typeof h?h:void 0===h?Rs:v(+h),c="function"==typeof c?c:v(void 0===c?0:+c),g="function"==typeof g?g:void 0===g?js:v(+g),n.x=function(t){return arguments.length?(h="function"==typeof t?t:v(+t),d=null,n):h},n.x0=function(t){return arguments.length?(h="function"==typeof t?t:v(+t),n):h},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(h).y(c)},n.lineY1=function(){return t().x(h).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 Gs(t,n){return n<t?-1:t<n?1:t<=n?0:NaN}function Ks(t){return t}function $s(){var d=Ks,f=Gs,p=null,_=v(0),m=v(ys),y=v(0);function n(e){for(var t,n,i,a=(e=Fs(e)).length,r=0,o=new Array(a),s=new Array(a),l=+_.apply(this,arguments),u=Math.min(ys,Math.max(-ys,m.apply(this,arguments)-l)),h=Math.min(Math.abs(u)/a,y.apply(this,arguments)),c=h*(u<0?-1:1),g=0;g<a;++g)0<(i=s[o[g]=g]=+d(e[g],g,e))&&(r+=i);
|
|
575
575
|
// Optionally sort the arcs by previously-computed values or by data.
|
|
576
576
|
// Compute the arcs! They are stored in the original data's order.
|
|
577
|
-
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?(u-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:h};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}
|
|
577
|
+
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?(u-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:h};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}Ls.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
|
|
578
578
|
default:this._context.lineTo(t,n)}}};var qs=Ws(Os);function Us(t){this._curve=t}function Ws(n){function t(t){return new Us(n(t))}return t._curve=n,t}function Ys(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(Ws(t)):n()._curve},t}function Vs(){return Ys(Is().curve(qs))}function Zs(){var t=Hs().curve(qs),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 Ys(e())},delete t.lineX0,t.lineEndAngle=function(){return Ys(i())},delete t.lineX1,t.lineInnerRadius=function(){return Ys(a())},delete t.lineY0,t.lineOuterRadius=function(){return Ys(r())},delete t.lineY1,t.curve=function(t){return arguments.length?n(Ws(t)):n()._curve},t}function Xs(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Us.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 Js{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
|
|
579
579
|
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 Qs{lineStart(){this._point=0}lineEnd(){}point(t,n){var e,i,a,r;t=+t,n=+n,0===this._point?this._point=1:(e=Xs(this._x0,this._y0),i=Xs(this._x0,this._y0=(this._y0+n)/2),a=Xs(t,this._y0),r=Xs(t,n),this._context.moveTo(...e),this._context.bezierCurveTo(...i,...a,...r)),this._x0=t,this._y0=n}constructor(t){this._context=t}}function tl(t){return new Js(t,!0)}function nl(t){return new Js(t,!1)}function el(t){return new Qs(t)}function il(t){return t.source}function al(t){return t.target}function rl(a){let r=il,o=al,s=Rs,l=js,u=null,h=null,c=As(n);function n(){let t;var n=Ps.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if((h=null==u?a(t=c()):h).lineStart(),n[0]=e,h.point(+s.apply(this,n),+l.apply(this,n)),n[0]=i,h.point(+s.apply(this,n),+l.apply(this,n)),h.lineEnd(),t)return h=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?u=h=null:h=a(u=t),n):u},n}let ol=fs(3),sl={draw(t,n){var n=.59436*fs(n+gs(n/28,.75)),e=n/2,i=e*ol;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 ll={draw(t,n){n=fs(n/_s);t.moveTo(n,0),t.arc(0,0,n,0,ys)}},_n={draw(t,n){n=fs(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 ul=fs(1/3),hl=2*ul,cl={draw(t,n){var n=fs(n/hl),e=n*ul;t.moveTo(0,-n),t.lineTo(e,0),t.lineTo(0,n),t.lineTo(-e,0),t.closePath()}},gl={draw(t,n){n=.62625*fs(n);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},dl={draw(t,n){n=.87559*fs(n-gs(n/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},fl={draw(t,n){var n=fs(n),e=-n/2;t.rect(e,e,n,n)}},pl={draw(t,n){n=.4431*fs(n);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};n=ds(_s/10)/ds(7*_s/10);let _l=ds(ys/10)*n,ml=-hs(ys/10)*n,yl={draw(n,t){var e=fs(.8908130915292852*t),i=_l*e,a=ml*e;n.moveTo(0,-e),n.lineTo(i,a);for(let t=1;t<5;++t){var r=ys*t/5,o=hs(r),r=ds(r);n.lineTo(r*e,-o*e),n.lineTo(o*i-r*a,r*i+o*a)}n.closePath()}},vl=fs(3),bl={draw(t,n){n=-fs(n/(3*vl));t.moveTo(0,2*n),t.lineTo(-vl*n,-n),t.lineTo(vl*n,-n),t.closePath()}},xl=fs(3),wl={draw(t,n){var n=.6824*fs(n),e=n/2,i=n*xl/2;// cos(Math.PI / 6)
|
|
580
580
|
t.moveTo(0,-n),t.lineTo(i,e),t.lineTo(-i,e),t.closePath()}},Sl=-.5,Cl=fs(3)/2,kl=1/fs(12),Al=3*(kl/2+1),Ml={draw(t,n){var n=fs(n/Al),e=n/2,i=n*kl,a=e,n=n*kl+n,r=-a,o=n;t.moveTo(e,i),t.lineTo(a,n),t.lineTo(r,o),t.lineTo(Sl*e-Cl*i,Cl*e+Sl*i),t.lineTo(Sl*a-Cl*n,Cl*a+Sl*n),t.lineTo(Sl*r-Cl*o,Cl*r+Sl*o),t.lineTo(Sl*e+Cl*i,Sl*i-Cl*e),t.lineTo(Sl*a+Cl*n,Sl*n-Cl*a),t.lineTo(Sl*r+Cl*o,Sl*o-Cl*r),t.closePath()}},El={draw(t,n){n=.6189*fs(n-gs(n/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};
|
|
@@ -584,10 +584,10 @@ ri=[ll,_n,cl,fl,yl,bl,Ml],gr=[ll,dl,El,wl,sl,pl,gl];
|
|
|
584
584
|
function zl(){}function Tl(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Bl(t){this._context=t}function Dl(t){this._context=t}function Nl(t){this._context=t}function Pl(t,n){this._basis=new Bl(t),this._beta=n}Bl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Tl(this,this._x1,this._y1);// falls through
|
|
585
585
|
case 2:this._context.lineTo(this._x1,this._y1)}(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;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);// falls through
|
|
586
586
|
default:Tl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Dl.prototype={areaStart:zl,areaEnd:zl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Tl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Nl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===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;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,i):this._context.moveTo(e,i);break;case 3:this._point=4;// falls through
|
|
587
|
-
default:Tl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Pl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(0<e)for(var i,a=t[0],r=n[0],o=t[e]-a,s=n[e]-r,l=-1;++l<=e;)this._basis.point(this._beta*t[l]+(1-this._beta)*(a+(i=l/e)*o),this._beta*n[l]+(1-this._beta)*(r+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};pn=function n(e){function t(t){return 1===e?new Bl(t):new Pl(t,e)}return t.beta=function(t){return n(+t)},t}(.85);function
|
|
588
|
-
default:
|
|
589
|
-
default:
|
|
590
|
-
default:Hl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kl=function n(e){function t(t){return e?new Gl(t,e):new
|
|
587
|
+
default:Tl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Pl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(0<e)for(var i,a=t[0],r=n[0],o=t[e]-a,s=n[e]-r,l=-1;++l<=e;)this._basis.point(this._beta*t[l]+(1-this._beta)*(a+(i=l/e)*o),this._beta*n[l]+(1-this._beta)*(r+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};pn=function n(e){function t(t){return 1===e?new Bl(t):new Pl(t,e)}return t.beta=function(t){return n(+t)},t}(.85);function Fl(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Ll(t,n){this._context=t,this._k=(1-n)/6}Ll.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Fl(this,this._x1,this._y1)}(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,this._x1=t,this._y1=n;break;case 2:this._point=3;// falls through
|
|
588
|
+
default:Fl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};n=function n(e){function t(t){return new Ll(t,e)}return t.tension=function(t){return n(+t)},t}(0);function Ol(t,n){this._context=t,this._k=(1-n)/6}Ol.prototype={areaStart:zl,areaEnd:zl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Fl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Rl=function n(e){function t(t){return new Ol(t,e)}return t.tension=function(t){return n(+t)},t}(0);function jl(t,n){this._context=t,this._k=(1-n)/6}jl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===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;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;// falls through
|
|
589
|
+
default:Fl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Il=function n(e){function t(t){return new jl(t,e)}return t.tension=function(t){return n(+t)},t}(0);function Hl(t,n,e){var i,a,r=t._x1,o=t._y1,s=t._x2,l=t._y2;t._l01_a>ps&&(r=(r*(i=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a)-t._x0*t._l12_2a+t._x2*t._l01_2a)/(a=3*t._l01_a*(t._l01_a+t._l12_a)),o=(o*i-t._y0*t._l12_2a+t._y2*t._l01_2a)/a),t._l23_a>ps&&(s=(s*(i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a)+t._x1*t._l23_2a-n*t._l12_2a)/(a=3*t._l23_a*(t._l23_a+t._l12_a)),l=(l*i+t._y1*t._l23_2a-e*t._l12_2a)/a),t._context.bezierCurveTo(r,o,s,l,t._x2,t._y2)}function Gl(t,n){this._context=t,this._alpha=n}Gl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e,i;switch(t=+t,n=+n,this._point&&(e=this._x2-t,i=this._y2-n,this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))),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;// falls through
|
|
590
|
+
default:Hl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kl=function n(e){function t(t){return e?new Gl(t,e):new Ll(t,0)}return t.alpha=function(t){return n(+t)},t}(.5);function $l(t,n){this._context=t,this._alpha=n}$l.prototype={areaStart:zl,areaEnd:zl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){var e,i;switch(t=+t,n=+n,this._point&&(e=this._x2-t,i=this._y2-n,this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))),this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Hl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var ql=function n(e){function t(t){return e?new $l(t,e):new Ol(t,0)}return t.alpha=function(t){return n(+t)},t}(.5);function Ul(t,n){this._context=t,this._alpha=n}Ul.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e,i;switch(t=+t,n=+n,this._point&&(e=this._x2-t,i=this._y2-n,this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))),this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;// falls through
|
|
591
591
|
default:Hl(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Wl=function n(e){function t(t){return e?new Ul(t,e):new jl(t,0)}return t.alpha=function(t){return n(+t)},t}(.5);function Yl(t){this._context=t}function Vl(t){return t<0?-1:1}
|
|
592
592
|
// Calculate the slopes of the tangents (Hermite-type interpolation) based on
|
|
593
593
|
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
|
|
@@ -601,7 +601,7 @@ function Xl(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}
|
|
|
601
601
|
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
|
602
602
|
function Jl(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 Ql(t){this._context=t}function tu(t){this._context=new nu(t)}function nu(t){this._context=t}function eu(t){this._context=t}
|
|
603
603
|
// See https://www.particleincell.com/2012/bezier-splines/ for derivation.
|
|
604
|
-
function iu(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 au(t,n){this._context=t,this._t=n}function ru(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 ou(t){for(var n=t.length,e=new Array(n);0<=--n;)e[n]=n;return e}function su(t,n){return t[n]}function lu(t){var n=[];return n.key=t,n}function uu(){var s=v([]),l=ou,u=ru,h=su;function n(t){var n,e,i,a=Array.from(s.apply(this,arguments),lu),r=a.length,o=-1;for(i of t)for(n=0,++o;n<r;++n)(a[n][o]=[0,+h(i,a[n].key,o,t)]).data=i;for(n=0,e=
|
|
604
|
+
function iu(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 au(t,n){this._context=t,this._t=n}function ru(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 ou(t){for(var n=t.length,e=new Array(n);0<=--n;)e[n]=n;return e}function su(t,n){return t[n]}function lu(t){var n=[];return n.key=t,n}function uu(){var s=v([]),l=ou,u=ru,h=su;function n(t){var n,e,i,a=Array.from(s.apply(this,arguments),lu),r=a.length,o=-1;for(i of t)for(n=0,++o;n<r;++n)(a[n][o]=[0,+h(i,a[n].key,o,t)]).data=i;for(n=0,e=Fs(l(a));n<r;++n)a[e[n]].index=n;return u(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?(h="function"==typeof t?t:v(+t),n):h},n.order=function(t){return arguments.length?(l=null==t?ou:"function"==typeof t?t:v(Array.from(t)),n):l},n.offset=function(t){return arguments.length?(u=null==t?ru:t,n):u},n}function hu(t){var e=t.map(cu);return ou(t).sort(function(t,n){return e[t]-e[n]})}function cu(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 gu(t){var e=t.map(du);return ou(t).sort(function(t,n){return e[t]-e[n]})}function du(t){for(var n,e=0,i=-1,a=t.length;++i<a;)(n=+t[i][1])&&(e+=n);return e}Yl.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))}},Ql.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:Jl(this,this._t0,Xl(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.
|
|
605
605
|
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,Jl(this,Xl(this,e=Zl(this,t,n)),e);break;default:Jl(this,this._t0,e=Zl(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(tu.prototype=Object.create(Ql.prototype)).point=function(t,n){Ql.prototype.point.call(this,n,t)},nu.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)}},eu.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=iu(t),a=iu(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)}},au.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
|
|
606
606
|
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 fu,pu=Object.freeze({__proto__:null,arc:Ns,area:Hs,areaRadial:Zs,curveBasis:function(t){return new Bl(t)},curveBasisClosed:function(t){return new Dl(t)},curveBasisOpen:function(t){return new Nl(t)},curveBumpX:tl,curveBumpY:nl,curveBundle:pn,curveCardinal:n,curveCardinalClosed:Rl,curveCardinalOpen:Il,curveCatmullRom:Kl,curveCatmullRomClosed:ql,curveCatmullRomOpen:Wl,curveLinear:Os,curveLinearClosed:function(t){return new Yl(t)},curveMonotoneX:function(t){return new Ql(t)},curveMonotoneY:function(t){return new tu(t)},curveNatural:function(t){return new eu(t)},curveStep:function(t){return new au(t,.5)},curveStepAfter:function(t){return new au(t,1)},curveStepBefore:function(t){return new au(t,0)},line:Is,lineRadial:Vs,link:rl,linkHorizontal:function(){return rl(tl)},linkRadial:function(){var t=rl(el);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},linkVertical:function(){return rl(nl)},pie:$s,pointRadial:Xs,radialArea:Zs,radialLine:Vs,stack:uu,stackOffsetDiverging:function(t,n){if(0<(s=t.length))for(var e,i,a,r,o,s,l=0,u=t[n[0]].length;l<u;++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}ru(t,n)}},stackOffsetNone:ru,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}ru(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,u=0;s<a;++s){for(var h=t[n[s]],c=h[o][1]||0,g=(c-(h[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,u+=g*c}e[o-1][1]+=e[o-1][0]=r,l&&(r-=u/l)}e[o-1][1]+=e[o-1][0]=r,ru(t,n)}},stackOrderAppearance:hu,stackOrderAscending:gu,stackOrderDescending:function(t){return gu(t).reverse()},stackOrderInsideOut:function(t){for(var n,e=t.length,i=t.map(du),a=hu(t),r=0,o=0,s=[],l=[],u=0;u<e;++u)n=a[u],(r<o?(r+=i[n],s):(o+=i[n],l)).push(n);return l.reverse().concat(s)},stackOrderNone:ou,stackOrderReverse:function(t){return ou(t).reverse()},symbol:function(n,e){let i=null,a=As(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||ll),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:sl,symbolCircle:ll,symbolCross:_n,symbolDiamond:cl,symbolDiamond2:gl,symbolPlus:dl,symbolSquare:fl,symbolSquare2:pl,symbolStar:yl,symbolTimes:El,symbolTriangle:bl,symbolTriangle2:wl,symbolWye:Ml,symbolX:El,symbols:ri,symbolsFill:ri,symbolsStroke:gr});function _u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
|
|
607
607
|
/*
|
|
@@ -609,7 +609,7 @@ default:var e;this._t<=0?(this._context.lineTo(this._x,n),this._context.lineTo(t
|
|
|
609
609
|
* 𝗖 𝗢 𝗟 𝗢 𝗥
|
|
610
610
|
* v 1.9.1
|
|
611
611
|
*
|
|
612
|
-
* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
612
|
+
* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */L2||(L2=1,fu={theme:{colors:{white:"#ffffff",black:"#000000",gray:{50:"#f8f9fa",100:"#f1f3f5",200:"#e9ecef",300:"#dee2e6",400:"#ced4da",500:"#adb5bd",600:"#868e96",700:"#495057",800:"#343a40",900:"#212529"},red:{50:"#fff5f5",100:"#ffe3e3",200:"#ffc9c9",300:"#ffa8a8",400:"#ff8787",500:"#ff6b6b",600:"#fa5252",700:"#f03e3e",800:"#e03131",900:"#c92a2a"},pink:{50:"#fff0f6",100:"#ffdeeb",200:"#fcc2d7",300:"#faa2c1",400:"#f783ac",500:"#f06595",600:"#e64980",700:"#d6336c",800:"#c2255c",900:"#a61e4d"},grape:{50:"#f8f0fc",100:"#f3d9fa",200:"#eebefa",300:"#e599f7",400:"#da77f2",500:"#cc5de8",600:"#be4bdb",700:"#ae3ec9",800:"#9c36b5",900:"#862e9c"},violet:{50:"#f3f0ff",100:"#e5dbff",200:"#d0bfff",300:"#b197fc",400:"#9775fa",500:"#845ef7",600:"#7950f2",700:"#7048e8",800:"#6741d9",900:"#5f3dc4"},indigo:{50:"#edf2ff",100:"#dbe4ff",200:"#bac8ff",300:"#91a7ff",400:"#748ffc",500:"#5c7cfa",600:"#4c6ef5",700:"#4263eb",800:"#3b5bdb",900:"#364fc7"},blue:{50:"#e7f5ff",100:"#d0ebff",200:"#a5d8ff",300:"#74c0fc",400:"#4dabf7",500:"#339af0",600:"#228be6",700:"#1c7ed6",800:"#1971c2",900:"#1864ab"},cyan:{50:"#e3fafc",100:"#c5f6fa",200:"#99e9f2",300:"#66d9e8",400:"#3bc9db",500:"#22b8cf",600:"#15aabf",700:"#1098ad",800:"#0c8599",900:"#0b7285"},teal:{50:"#e6fcf5",100:"#c3fae8",200:"#96f2d7",300:"#63e6be",400:"#38d9a9",500:"#20c997",600:"#12b886",700:"#0ca678",800:"#099268",900:"#087f5b"},green:{50:"#ebfbee",100:"#d3f9d8",200:"#b2f2bb",300:"#8ce99a",400:"#69db7c",500:"#51cf66",600:"#40c057",700:"#37b24d",800:"#2f9e44",900:"#2b8a3e"},lime:{50:"#f4fce3",100:"#e9fac8",200:"#d8f5a2",300:"#c0eb75",400:"#a9e34b",500:"#94d82d",600:"#82c91e",700:"#74b816",800:"#66a80f",900:"#5c940d"},yellow:{50:"#fff9db",100:"#fff3bf",200:"#ffec99",300:"#ffe066",400:"#ffd43b",500:"#fcc419",600:"#fab005",700:"#f59f00",800:"#f08c00",900:"#e67700"},orange:{50:"#fff4e6",100:"#ffe8cc",200:"#ffd8a8",300:"#ffc078",400:"#ffa94d",500:"#ff922b",600:"#fd7e14",700:"#f76707",800:"#e8590c",900:"#d9480f"}}},plugins:[]});var pn=_u(fu),n=pn.theme,mu={dark:n.colors.gray[700],light:n.colors.gray[50],missing:n.colors.gray[400],off:n.colors.red[900],on:n.colors.green[900],scale:Ji().range([n.colors.indigo[900],n.colors.yellow[600],n.colors.red[900],n.colors.green[900],n.colors.orange[600],n.colors.grape[900],n.colors.cyan[600],n.colors.pink[600],n.colors.lime[600],n.colors.blue[300],n.colors.pink[300],n.colors.lime[300],n.colors.violet[300],n.colors.cyan[100],n.colors.orange[100],n.colors.green[100],n.colors.grape[100],n.colors.red[100]])};
|
|
613
613
|
/**
|
|
614
614
|
Returns a color based on a key, whether it is present in a user supplied object or in the default object.
|
|
615
615
|
@returns {String}
|
|
@@ -673,7 +673,7 @@ if(!(arguments.length<2)){
|
|
|
673
673
|
// Otherwise, if a null callback was specified, remove callbacks of the given name.
|
|
674
674
|
if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<s;)if(e=(t=r[o]).type)a[e]=Mu(a[e],t.name,n);else if(null==n)for(e in a)a[e]=Mu(a[e],t.name,null);return this}for(;++o<s;)if(e=(e=(t=r[o]).type)&&((t,n)=>{for(var e,i=0,a=t.length;i<a;++i)if((e=t[i]).name===n)return e.value})(a[e],t.name))return e},copy:function(){var t,n={},e=this._;for(t in e)n[t]=e[t].slice();return new Au(n)},call:function(t,n){if(0<(e=arguments.length-2))for(var e,i,a=new Array(e),r=0;r<e;++r)a[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=0,e=(i=this._[t]).length;r<e;++r)i[r].value.apply(n,a)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],a=0,r=i.length;a<r;++a)i[a].value.apply(n,e)}};var Tu=zu("application/json",function(t){return JSON.parse(t.responseText)}),Bu=zu("text/plain",function(t){return t.responseText}),Du={},Nu={};function Pu(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}
|
|
675
675
|
// Compute unique columns in order of discovery.
|
|
676
|
-
function
|
|
676
|
+
function Fu(t){var e=Object.create(null),i=[];return t.forEach(function(t){for(var n in t)n in e||i.push(e[n]=n)}),i}function Lu(t,n){var t=t+"",e=t.length;return e<n?new Array(n-e+1).join(0)+t:t}function Ou(t){var n,e=t.getUTCHours(),i=t.getUTCMinutes(),a=t.getUTCSeconds(),r=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((n=t.getUTCFullYear())<0?"-"+Lu(-n,6):9999<n?"+"+Lu(n,6):Lu(n,4))+"-"+Lu(t.getUTCMonth()+1,2)+"-"+Lu(t.getUTCDate(),2)+(r?"T"+Lu(e,2)+":"+Lu(i,2)+":"+Lu(a,2)+"."+Lu(r,3)+"Z":a?"T"+Lu(e,2)+":"+Lu(i,2)+":"+Lu(a,2)+"Z":i||e?"T"+Lu(e,2)+":"+Lu(i,2)+"Z":"")}function Ru(i){var n=new RegExp('["'+i+"\n\r]"),c=i.charCodeAt(0);function e(i,t){var n,e=[],a=i.length,r=0,o=0,s=a<=0,l=!1;// current token followed by EOL?
|
|
677
677
|
// Strip the trailing newline.
|
|
678
678
|
function u(){if(s)return Nu;if(l)return l=!1,Du;
|
|
679
679
|
// Unescape quotes.
|
|
@@ -681,7 +681,7 @@ var t,n,e=r;if(34===i.charCodeAt(e)){for(;r++<a&&34!==i.charCodeAt(r)||34===i.ch
|
|
|
681
681
|
// Find next delimiter or newline.
|
|
682
682
|
for(;r<a;){if(10===(n=i.charCodeAt(t=r++)))l=!0;else if(13===n)l=!0,10===i.charCodeAt(r)&&++r;else if(n!==c)continue;return i.slice(e,t)}
|
|
683
683
|
// Return last token before EOF.
|
|
684
|
-
return s=!0,i.slice(e,a)}for(10===i.charCodeAt(a-1)&&--a,13===i.charCodeAt(a-1)&&--a;(n=u())!==Nu;){for(var h=[];n!==Du&&n!==Nu;)h.push(n),n=u();t&&null==(h=t(h,o++))||e.push(h)}return e}function a(t,e){return t.map(function(n){return e.map(function(t){return o(n[t])}).join(i)})}function r(t){return t.map(o).join(i)}function o(t){return null==t?"":t instanceof Date?Ou(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,r){var o,s;return(t=e(t,function(t,n){if(o)return o(t,n-1);var e,i,a;s=t,o=r?(i=r,a=Pu(e=t),function(t,n){return i(a(t),n,e)}):Pu(t)})).columns=s||[],t},parseRows:e,format:function(t,n){return[(n=null==n?
|
|
684
|
+
return s=!0,i.slice(e,a)}for(10===i.charCodeAt(a-1)&&--a,13===i.charCodeAt(a-1)&&--a;(n=u())!==Nu;){for(var h=[];n!==Du&&n!==Nu;)h.push(n),n=u();t&&null==(h=t(h,o++))||e.push(h)}return e}function a(t,e){return t.map(function(n){return e.map(function(t){return o(n[t])}).join(i)})}function r(t){return t.map(o).join(i)}function o(t){return null==t?"":t instanceof Date?Ou(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,r){var o,s;return(t=e(t,function(t,n){if(o)return o(t,n-1);var e,i,a;s=t,o=r?(i=r,a=Pu(e=t),function(t,n){return i(a(t),n,e)}):Pu(t)})).columns=s||[],t},parseRows:e,format:function(t,n){return[(n=null==n?Fu(t):n).map(o).join(i)].concat(a(t,n)).join("\n")},formatBody:function(t,n){return a(t,n=null==n?Fu(t):n).join("\n")},formatRows:function(t){return t.map(r).join("\n")},formatRow:r,formatValue:o}}Rl=Ru(",").parse,Il=Ru("\t").parse;function ju(e,r){return function(t,i,n){arguments.length<3&&(n=i,i=null);var a=Eu(t).mimeType(e);return a.row=function(t){return arguments.length?a.response((n=r,e=i=t,function(t){return n(t.responseText,e)})):i;var n,e},a.row(i),n?a.get(n):a}}var Iu=ju("text/csv",Rl),Hu=ju("text/tab-separated-values",Il);
|
|
685
685
|
/**
|
|
686
686
|
@function dataFold
|
|
687
687
|
@desc Given a JSON object where the data values and headers have been split into separate key lookups, this function will combine the data values with the headers and returns one large array of objects.
|
|
@@ -1021,7 +1021,7 @@ return function t(n,e,i,a,r){for(var o,s,l,u,h,c,g,d=a,f=e+1;f<i;f++){s=n[f],p=n
|
|
|
1021
1021
|
// For visualization debugging purposes
|
|
1022
1022
|
var i,a=[],r=yh((
|
|
1023
1023
|
// User's input normalization
|
|
1024
|
-
e=Object.assign({angle:
|
|
1024
|
+
e=Object.assign({angle:Ft(-90,95,5),cache:!0,maxAspectRatio:15,minAspectRatio:1,minHeight:0,minWidth:0,nTries:20,tolerance:.02,verbose:!1},e)).angle,Array)?e.angle:"number"==typeof e.angle?[e.angle]:"string"!=typeof e.angle||isNaN(e.angle)?[]:[Number(e.angle)],L=yh(e.aspectRatio,Array)?e.aspectRatio:"number"==typeof e.aspectRatio?[e.aspectRatio]:"string"!=typeof e.aspectRatio||isNaN(e.aspectRatio)?[]:[Number(e.aspectRatio)],o=e.origin&&yh(e.origin,Array)?yh(e.origin[0],Array)?e.origin:[e.origin]:[];if(e.cache&&(i=ii(t).join(","),i=(i=(i=(i=(i=(i+="-".concat(e.minAspectRatio))+"-".concat(e.maxAspectRatio))+"-".concat(e.minHeight))+"-".concat(e.minWidth))+"-".concat(r.join(",")))+"-".concat(o.join(",")),bh[i]))return bh[i];var O=Math.abs((t=>{for(var n,e=-1,i=t.length,a=t[i-1],r=0;++e<i;)n=a,a=t[e],r+=n[1]*a[0]-n[0]*a[1];return r/2})(t));// take absolute value of the signed area
|
|
1025
1025
|
if(0===O)return e.verbose&&console.error("polygon has 0 area",t),null;
|
|
1026
1026
|
// get the width of the bounding box of the original polygon to determine tolerance
|
|
1027
1027
|
var n=vh(Re(t,function(t){return t[0]}),2),s=n[0],n=n[1],l=vh(Re(t,function(t){return t[1]}),2),u=l[0],l=l[1],l=Math.min(n-s,l-u)*e.tolerance,n=(0<l&&(t=_h(t,l)),e.events&&a.push({type:"simplify",poly:t}),s=(
|
|
@@ -1041,18 +1041,18 @@ for(var H=e.nTries;H;){var G=[Math.random()*R+s,Math.random()*j+u];ah(t,G)&&o.pu
|
|
|
1041
1041
|
// generate improved origins
|
|
1042
1042
|
y&&m&&b.push([(y[0]+m[0])/2,(y[1]+m[1])/2]),// average along with width axis
|
|
1043
1043
|
v&&_&&b.push([(v[0]+_[0])/2,(v[1]+_[1])/2]),// average along with height axis
|
|
1044
|
-
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]}),vh(dh(t,w,f),2)),C=S[0],S=S[1];if(null!==C&&null!==S){var C=Math.min(hh(w,C),hh(w,S)),k=2*Math.sqrt(C),S=vh(dh(t,w,f+Math.PI/2),2),C=S[0],S=S[1];if(null!==C&&null!==S){var C=Math.min(hh(w,C),hh(w,S)),A=2*Math.sqrt(C);if(!(k*A<h)){var M=
|
|
1044
|
+
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]}),vh(dh(t,w,f),2)),C=S[0],S=S[1];if(null!==C&&null!==S){var C=Math.min(hh(w,C),hh(w,S)),k=2*Math.sqrt(C),S=vh(dh(t,w,f+Math.PI/2),2),C=S[0],S=S[1];if(null!==C&&null!==S){var C=Math.min(hh(w,C),hh(w,S)),A=2*Math.sqrt(C);if(!(k*A<h)){var M=L;M.length||(M=Ft(Math.max(e.minAspectRatio,e.minWidth/A,h/(A*A)),Math.min(e.maxAspectRatio,k/e.minHeight,k*k/h)+.5,.5));for(var K=0;K<M.length;K++){var E=M[K],z=Math.max(e.minWidth,Math.sqrt(h*E)),T=Math.min(k,A*E);
|
|
1045
1045
|
// do a binary search to find the max width that works
|
|
1046
|
-
if(!(T*A<h))for(e.events&&I<=T-z&&a.push({type:"aRatio",aRatio:E});I<=T-z;){var B=(z+T)/2,D=B/E,N=vh(w,2),P=N[0],N=N[1],
|
|
1046
|
+
if(!(T*A<h))for(e.events&&I<=T-z&&a.push({type:"aRatio",aRatio:E});I<=T-z;){var B=(z+T)/2,D=B/E,N=vh(w,2),P=N[0],N=N[1],F=[[P-B/2,N-D/2],[P+B/2,N-D/2],[P+B/2,N+D/2],[P-B/2,N+D/2]],$=uh(F=function(t,n,e
|
|
1047
1047
|
/**
|
|
1048
1048
|
@desc square distance from a point to a segment
|
|
1049
1049
|
@param {Array} point
|
|
1050
1050
|
@param {Array} segmentAnchor1
|
|
1051
1051
|
@param {Array} segmentAnchor2
|
|
1052
1052
|
@private
|
|
1053
|
-
*/){var i=2<arguments.length&&void 0!==e?e:[0,0];return t.map(function(t){return fh(t,n,i)})}(
|
|
1053
|
+
*/){var i=2<arguments.length&&void 0!==e?e:[0,0];return t.map(function(t){return fh(t,n,i)})}(F,f,w),t);$?(
|
|
1054
1054
|
// we know that the area is already greater than the maxArea found so far
|
|
1055
|
-
h=B*D,
|
|
1055
|
+
h=B*D,F.push(F[0]),c={area:h,cx:P,cy:N,width:B,height:D,angle:-d,points:F},z=B):T=B,e.events&&a.push({type:"rectangle",areaFraction:B*D/O,cx:P,cy:N,width:B,height:D,angle:d,insidePoly:$})}}}}}}}}return e.cache&&(bh[i]=c),e.events?Object.assign(c||{},{events:a}):c}
|
|
1056
1056
|
/**
|
|
1057
1057
|
@function pointDistance
|
|
1058
1058
|
@desc Calculates the pixel distance between two points.
|
|
@@ -1197,7 +1197,7 @@ h=B*D,L.push(L[0]),c={area:h,cx:P,cy:N,width:B,height:D,angle:-d,points:L},z=B):
|
|
|
1197
1197
|
* @private
|
|
1198
1198
|
*/function Ph(n,e){for(let t=0;t<e.length;t++){var i=e[t];for(let t=n.length-1;0<=t;t--)if(n[t].classList.contains(i))return t;// Return the index if found
|
|
1199
1199
|
}return 0;// Return -1 if no element is found with the class
|
|
1200
|
-
}class
|
|
1200
|
+
}class Fh extends Ri{
|
|
1201
1201
|
/**
|
|
1202
1202
|
@memberof Shape
|
|
1203
1203
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -1287,7 +1287,7 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
1287
1287
|
@memberof Shape
|
|
1288
1288
|
@desc Adds labels to each shape group.
|
|
1289
1289
|
@private
|
|
1290
|
-
*/_renderLabels(){let h=[];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),u=e.labelConfig&&e.labelConfig.rotate?e.labelConfig.rotate:void 0!==a.angle?a.angle:0,l=(u+=l,0!==l?[-1*s.x||0,-1*s.y||0]:[s.width/2,s.height/2]);h.push({__d3plus__:!0,data:e,height:s.height,l:t,id:this._id(e,n)+"_"+t,r:u,rotateAnchor:l,text:i[t],width:s.width,x:r+s.x,y:o+s.y})}}}}),this._labelClass.data(h).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(Dt(`g.d3plus-${this._name}-text`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).config(
|
|
1290
|
+
*/_renderLabels(){let h=[];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),u=e.labelConfig&&e.labelConfig.rotate?e.labelConfig.rotate:void 0!==a.angle?a.angle:0,l=(u+=l,0!==l?[-1*s.x||0,-1*s.y||0]:[s.width/2,s.height/2]);h.push({__d3plus__:!0,data:e,height:s.height,l:t,id:this._id(e,n)+"_"+t,r:u,rotateAnchor:l,text:i[t],width:s.width,x:r+s.x,y:o+s.y})}}}}),this._labelClass.data(h).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(Dt(`g.d3plus-${this._name}-text`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).config(Lt.bind(this)(this._labelConfig)).render()}
|
|
1291
1291
|
/**
|
|
1292
1292
|
@memberof Shape
|
|
1293
1293
|
@desc Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
@@ -1580,7 +1580,7 @@ this._renderHover(),this):this._hover}
|
|
|
1580
1580
|
@memberof Shape
|
|
1581
1581
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1582
1582
|
@private
|
|
1583
|
-
*/constructor(t="g"){super(),this._activeOpacity=.25,this._activeStyle={stroke:(t,n)=>{let e=this._fill(t,n);return Mn(e=["transparent","none"].includes(e)?this._stroke(t,n):e).darker(1)},"stroke-width":(t,n)=>3*(this._strokeWidth(t,n)||1)},this._ariaLabel=Ot(""),this._backgroundImage=Ot(!1),this._backgroundImageClass=new Nh,this._data=[],this._duration=600,this._fill=Ot("black"),this._fillOpacity=Ot(1),this._hoverOpacity=.5,this._hoverStyle={stroke:(t,n)=>{let e=this._fill(t,n);return Mn(e=["transparent","none"].includes(e)?this._stroke(t,n):e).darker(.5)},"stroke-width":(t,n)=>2*(this._strokeWidth(t,n)||1)},this._id=(t,n)=>void 0!==t.id?t.id:n,this._label=Ot(!1),this._labelClass=new Cc,this._labelConfig={fontColor:(t,n)=>bu(this._fill(t,n)),fontSize:12,padding:5},this._name="Shape",this._opacity=Ot(1),this._pointerEvents=Ot("visiblePainted"),this._role=Ot("presentation"),this._rotate=Ot(0),this._rx=Ot(0),this._ry=Ot(0),this._scale=Ot(1),this._shapeRendering=Ot("geometricPrecision"),this._stroke=(t,n)=>Mn(this._fill(t,n)).darker(1).formatHex(),this._strokeDasharray=Ot("0"),this._strokeLinecap=Ot("butt"),this._strokeOpacity=Ot(1),this._strokeWidth=Ot(0),this._tagName=t,this._textAnchor=Ot("start"),this._texture=Ot(!1),this._textureDefault={},this._textureDefs={},this._vectorEffect=Ot("non-scaling-stroke"),this._verticalAlign=Ot("top"),this._x=p("x",0),this._y=p("y",0)}}function
|
|
1583
|
+
*/constructor(t="g"){super(),this._activeOpacity=.25,this._activeStyle={stroke:(t,n)=>{let e=this._fill(t,n);return Mn(e=["transparent","none"].includes(e)?this._stroke(t,n):e).darker(1)},"stroke-width":(t,n)=>3*(this._strokeWidth(t,n)||1)},this._ariaLabel=Ot(""),this._backgroundImage=Ot(!1),this._backgroundImageClass=new Nh,this._data=[],this._duration=600,this._fill=Ot("black"),this._fillOpacity=Ot(1),this._hoverOpacity=.5,this._hoverStyle={stroke:(t,n)=>{let e=this._fill(t,n);return Mn(e=["transparent","none"].includes(e)?this._stroke(t,n):e).darker(.5)},"stroke-width":(t,n)=>2*(this._strokeWidth(t,n)||1)},this._id=(t,n)=>void 0!==t.id?t.id:n,this._label=Ot(!1),this._labelClass=new Cc,this._labelConfig={fontColor:(t,n)=>bu(this._fill(t,n)),fontSize:12,padding:5},this._name="Shape",this._opacity=Ot(1),this._pointerEvents=Ot("visiblePainted"),this._role=Ot("presentation"),this._rotate=Ot(0),this._rx=Ot(0),this._ry=Ot(0),this._scale=Ot(1),this._shapeRendering=Ot("geometricPrecision"),this._stroke=(t,n)=>Mn(this._fill(t,n)).darker(1).formatHex(),this._strokeDasharray=Ot("0"),this._strokeLinecap=Ot("butt"),this._strokeOpacity=Ot(1),this._strokeWidth=Ot(0),this._tagName=t,this._textAnchor=Ot("start"),this._texture=Ot(!1),this._textureDefault={},this._textureDefs={},this._vectorEffect=Ot("non-scaling-stroke"),this._verticalAlign=Ot("top"),this._x=p("x",0),this._y=p("y",0)}}function Lh(n,t){var e,i=Object.keys(n);return Object.getOwnPropertySymbols&&(e=Object.getOwnPropertySymbols(n),t&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),i.push.apply(i,e)),i}function Oh(i){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Lh(Object(a),!0).forEach(function(t){var n,e;n=i,e=a[t=t],t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):Lh(Object(a)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(a,t))})}return i}function Rh(t){return(Rh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jh(){return(jh=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e,i=arguments[n];for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t}).apply(this,arguments)}function Ih(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 Hh(t,n){var e,i,a,r,o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(o)return i=!(e=!0),{s:function(){o=o.call(t)},n:function(){var t=o.next();return e=t.done,t},e:function(t){i=!0,a=t},f:function(){try{e||null==o.return||o.return()}finally{if(i)throw a}}};if(Array.isArray(t)||(o=((t,n)=>{var e;if(t)return"string"==typeof t?Ih(t,n):"Map"===(e="Object"===(e=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ih(t,n):void 0})(t))||n)return o&&(t=o),r=0,{s:n=function(){},n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}
|
|
1584
1584
|
/**
|
|
1585
1585
|
* de Casteljau's algorithm for drawing and splitting bezier curves.
|
|
1586
1586
|
* Inspired by https://pomax.github.io/bezierinfo/
|
|
@@ -1785,7 +1785,7 @@ var e,i=u[n],a=h[n],r=g[n],o=Hh(Uh[r.type]);try{for(o.s();!(e=o.n()).done;){var
|
|
|
1785
1785
|
// at 1 return the final value without the extensions used during interpolation
|
|
1786
1786
|
if(1===t&&o)return null==a?"":a;var n,e="",i=Hh(r(t));// convert to a string (fastest concat: https://jsperf.com/join-concat/150)
|
|
1787
1787
|
try{for(i.s();!(n=i.n()).done;)e+=(n=>"".concat(n.type).concat(Uh[n.type].map(function(t){return n[t]}).join(",")))(n.value)}catch(t){i.e(t)}finally{i.f()}return e}):function(){return""}}// Add lower case entries too matching uppercase (e.g. 'm' == 'M')
|
|
1788
|
-
Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
1788
|
+
Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends Fh{
|
|
1789
1789
|
/**
|
|
1790
1790
|
@memberof Area
|
|
1791
1791
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -1857,7 +1857,7 @@ Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
|
1857
1857
|
@memberof Area
|
|
1858
1858
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
1859
1859
|
@private
|
|
1860
|
-
*/constructor(){super(),this._curve=Ot("linear"),this._defined=()=>!0,this._labelBounds=(t,n,e)=>{e=xh(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,n),y:e.cy-e.height/2-this._y(t,n)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=p("x"),this._x0=p("x"),this._x1=null,this._y=Ot(0),this._y0=Ot(0),this._y1=p("y")}}class Qh extends
|
|
1860
|
+
*/constructor(){super(),this._curve=Ot("linear"),this._defined=()=>!0,this._labelBounds=(t,n,e)=>{e=xh(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,n),y:e.cy-e.height/2-this._y(t,n)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=p("x"),this._x0=p("x"),this._x1=null,this._y=Ot(0),this._y0=Ot(0),this._y1=p("y")}}class Qh extends Fh{
|
|
1861
1861
|
/**
|
|
1862
1862
|
@memberof Bar
|
|
1863
1863
|
@desc Draws the bars.
|
|
@@ -1953,7 +1953,7 @@ Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
|
1953
1953
|
@memberof Bar
|
|
1954
1954
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
1955
1955
|
@private
|
|
1956
|
-
*/constructor(){super("rect"),this._name="Bar",this._height=Ot(10),this._labelBounds=(t,n,e)=>({width:e.width,height:e.height,x:null!==this._x1?this._getX(t,n):-e.width/2,y:null===this._x1?this._getY(t,n):-e.height/2}),this._width=Ot(10),this._x=p("x"),this._x0=p("x"),this._x1=null,this._y=Ot(0),this._y0=Ot(0),this._y1=p("y")}}class tc extends
|
|
1956
|
+
*/constructor(){super("rect"),this._name="Bar",this._height=Ot(10),this._labelBounds=(t,n,e)=>({width:e.width,height:e.height,x:null!==this._x1?this._getX(t,n):-e.width/2,y:null===this._x1?this._getY(t,n):-e.height/2}),this._width=Ot(10),this._x=p("x"),this._x0=p("x"),this._x1=null,this._y=Ot(0),this._y0=Ot(0),this._y1=p("y")}}class tc extends Fh{
|
|
1957
1957
|
/**
|
|
1958
1958
|
@memberof Circle
|
|
1959
1959
|
@desc Provides the default positioning to the <rect> elements.
|
|
@@ -1986,7 +1986,7 @@ Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
|
1986
1986
|
@memberof Circle
|
|
1987
1987
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
1988
1988
|
@private
|
|
1989
|
-
*/constructor(){super("circle"),this._labelBounds=(t,n,e)=>({width:1.5*e.r,height:1.5*e.r,x:.75*-e.r,y:.75*-e.r}),this._labelConfig=Tt(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Circle",this._r=p("r")}}class nc extends
|
|
1989
|
+
*/constructor(){super("circle"),this._labelBounds=(t,n,e)=>({width:1.5*e.r,height:1.5*e.r,x:.75*-e.r,y:.75*-e.r}),this._labelConfig=Tt(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Circle",this._r=p("r")}}class nc extends Fh{
|
|
1990
1990
|
/**
|
|
1991
1991
|
@memberof Rect
|
|
1992
1992
|
@desc Draws the rectangles.
|
|
@@ -2030,7 +2030,7 @@ Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
|
2030
2030
|
@memberof Rect
|
|
2031
2031
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
2032
2032
|
@private
|
|
2033
|
-
*/constructor(){super("rect"),this._height=p("height"),this._labelBounds=(t,n,e)=>({width:e.width,height:e.height,x:-e.width/2,y:-e.height/2}),this._name="Rect",this._width=p("width")}}class ec extends
|
|
2033
|
+
*/constructor(){super("rect"),this._height=p("height"),this._labelBounds=(t,n,e)=>({width:e.width,height:e.height,x:-e.width/2,y:-e.height/2}),this._name="Rect",this._width=p("width")}}class ec extends Fh{
|
|
2034
2034
|
/**
|
|
2035
2035
|
@memberof Line
|
|
2036
2036
|
@desc Filters/manipulates the data array before binding each point to an SVG group.
|
|
@@ -2079,9 +2079,9 @@ Object.keys(Uh).forEach(function(t){Uh[t.toLowerCase()]=Uh[t]});class Jh extends
|
|
|
2079
2079
|
@chainable
|
|
2080
2080
|
*/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})}),
|
|
2081
2081
|
// Draw whisker line.
|
|
2082
|
-
this._line=(new ec).data(s).select(Dt("g.d3plus-Whisker",{parent:this._select}).node()).config(
|
|
2082
|
+
this._line=(new ec).data(s).select(Dt("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});
|
|
2083
2083
|
// Draw whisker endpoint.
|
|
2084
|
-
return this._whiskerEndpoint=[],Ki().key(t=>t.endpoint).entries(t).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new ic[n]).data(t.values).select(Dt("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(
|
|
2084
|
+
return this._whiskerEndpoint=[],Ki().key(t=>t.endpoint).entries(t).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new ic[n]).data(t.values).select(Dt("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}
|
|
2085
2085
|
/**
|
|
2086
2086
|
@memberof Whisker
|
|
2087
2087
|
@desc Sets the highlight accessor to the Shape class's active function.
|
|
@@ -2174,16 +2174,16 @@ a.height=this._rectWidth(a.data,a.i),a.width=t,a.x=a.first+t/2,a.y=this._y(a.dat
|
|
|
2174
2174
|
// Compute data for outliers.
|
|
2175
2175
|
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});
|
|
2176
2176
|
// Draw box.
|
|
2177
|
-
this._box=(new nc).data(t).x(t=>t.x).y(t=>t.y).select(Dt("g.d3plus-Box",{parent:this._select}).node()).config(
|
|
2177
|
+
this._box=(new nc).data(t).x(t=>t.x).y(t=>t.y).select(Dt("g.d3plus-Box",{parent:this._select}).node()).config(Lt.bind(this)(this._rectConfig,"shape")).render(),
|
|
2178
2178
|
// Draw median.
|
|
2179
|
-
this._median=(new nc).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(Dt("g.d3plus-Box-Median",{parent:this._select}).node()).config(
|
|
2179
|
+
this._median=(new nc).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(Dt("g.d3plus-Box-Median",{parent:this._select}).node()).config(Lt.bind(this)(this._medianConfig,"shape")).render();
|
|
2180
2180
|
// Draw 2 lines using Whisker class.
|
|
2181
2181
|
// Construct coordinates for whisker startpoints and push it to the whiskerData.
|
|
2182
2182
|
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"}))}),
|
|
2183
2183
|
// Draw whiskers.
|
|
2184
|
-
this._whisker=(new ac).data(l).select(Dt("g.d3plus-Box-Whisker",{parent:this._select}).node()).config(
|
|
2184
|
+
this._whisker=(new ac).data(l).select(Dt("g.d3plus-Box-Whisker",{parent:this._select}).node()).config(Lt.bind(this)(this._whiskerConfig,"shape")).render(),
|
|
2185
2185
|
// Draw outliers.
|
|
2186
|
-
this._whiskerEndpoint=[],Ki().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new rc[n]).data(t.values).select(Dt("g.d3plus-Box-Outlier-"+n,{parent:this._select}).node()).config(
|
|
2186
|
+
this._whiskerEndpoint=[],Ki().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.key;this._whiskerEndpoint.push((new rc[n]).data(t.values).select(Dt("g.d3plus-Box-Outlier-"+n,{parent:this._select}).node()).config(Lt.bind(this)(this._outlierConfig,"shape",n)).render())}),this}
|
|
2187
2187
|
/**
|
|
2188
2188
|
@memberof Box
|
|
2189
2189
|
@desc Sets the highlight accessor to the Shape class's active function.
|
|
@@ -2284,7 +2284,7 @@ this._whiskerEndpoint=[],Ki().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2284
2284
|
@memberof Box
|
|
2285
2285
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
|
|
2286
2286
|
@private
|
|
2287
|
-
*/constructor(){super(),this._medianConfig={fill:Ot("black")},this._orient=p("orient","vertical"),this._outlier=p("outlier","Circle"),this._outlierConfig={Circle:{r:p("r",5)},Rect:{height:(t,n)=>"vertical"===this._orient(t,n)?5:20,width:(t,n)=>"vertical"===this._orient(t,n)?20:5}},this._rectConfig={fill:Ot("white"),stroke:Ot("black"),strokeWidth:Ot(1)},this._rectWidth=Ot(50),this._whiskerConfig={},this._whiskerMode=["tukey","tukey"],this._x=p("x",250),this._y=p("y",250)}}let sc=class extends
|
|
2287
|
+
*/constructor(){super(),this._medianConfig={fill:Ot("black")},this._orient=p("orient","vertical"),this._outlier=p("outlier","Circle"),this._outlierConfig={Circle:{r:p("r",5)},Rect:{height:(t,n)=>"vertical"===this._orient(t,n)?5:20,width:(t,n)=>"vertical"===this._orient(t,n)?20:5}},this._rectConfig={fill:Ot("white"),stroke:Ot("black"),strokeWidth:Ot(1)},this._rectWidth=Ot(50),this._whiskerConfig={},this._whiskerMode=["tukey","tukey"],this._x=p("x",250),this._y=p("y",250)}}let sc=class extends Fh{
|
|
2288
2288
|
/**
|
|
2289
2289
|
@memberof Path
|
|
2290
2290
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -2312,7 +2312,7 @@ this._whiskerEndpoint=[],Ki().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2312
2312
|
@memberof Path
|
|
2313
2313
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
2314
2314
|
@private
|
|
2315
|
-
*/constructor(){super("path"),this._d=p("path"),this._labelBounds=(t,n,e)=>{e=xh(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 lc=Object.freeze({__proto__:null,Area:Jh,Bar:Qh,Box:oc,Circle:tc,Image:Nh,Line:ec,Path:sc,Rect:nc,Shape:
|
|
2315
|
+
*/constructor(){super("path"),this._d=p("path"),this._labelBounds=(t,n,e)=>{e=xh(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 lc=Object.freeze({__proto__:null,Area:Jh,Bar:Qh,Box:oc,Circle:tc,Image:Nh,Line:ec,Path:sc,Rect:nc,Shape:Fh,Whisker:ac});let uc=pn.theme,hc=t=>t<0||Object.is(t,-0),cc=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,hc(t)),gc=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,hc(t)),dc=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};
|
|
2316
2316
|
/* catches for -0 and less */
|
|
2317
2317
|
/**
|
|
2318
2318
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
@@ -2323,7 +2323,7 @@ this._whiskerEndpoint=[],Ki().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2323
2323
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
2324
2324
|
* @param {scale} scale A d3-scale object
|
|
2325
2325
|
* @private
|
|
2326
|
-
*/function(t,n=!1){var e=ka().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=Re(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),Pt([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*dc(i[1]-i[0]));i=i.filter(t=>{var t=Math.abs(t)%e,n=dc(t);return n!==t?!n||n===e:0==t})}}else{var e=r.map(t=>Math.log10(t)%1==0?t:(o?gc:cc)(t)),s=e[1]<e[0],e=e.map(t=>(hc(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):
|
|
2326
|
+
*/function(t,n=!1){var e=ka().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=Re(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),Pt([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*dc(i[1]-i[0]));i=i.filter(t=>{var t=Math.abs(t)%e,n=dc(t);return n!==t?!n||n===e:0==t})}}else{var e=r.map(t=>Math.log10(t)%1==0?t:(o?gc:cc)(t)),s=e[1]<e[0],e=e.map(t=>(hc(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):Ft(e[0],e[1],e[1]<e[0]?-1:1).concat([e[1]]).filter(t=>Math.abs(t)%n==0).map(t=>+(""+(hc(t)?-1:1)*(t?Math.pow(10,Math.abs(t)):0<Math.sign(1/t)?1:-1)).replace(/9+/g,"1"))}
|
|
2327
2327
|
// forces min/max into ticks, if not present
|
|
2328
2328
|
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
2329
2329
|
if(this._d3ScaleNegative&&hc(r[o?1:0])!==i.some(t=>hc(t))||i.map(Number).includes(+r[0])||i.unshift(r[0]),this._d3ScaleNegative&&hc(r[o?0:1])!==i.some(t=>hc(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 pc extends Ri{
|
|
@@ -2386,7 +2386,7 @@ t.includes(-n)&&t.includes(n)&&t.splice(t.indexOf(-n),1)}return t}
|
|
|
2386
2386
|
/**
|
|
2387
2387
|
* Calculates the internal "range" array to use, including
|
|
2388
2388
|
* fallbacks if not specified with the "range" method.
|
|
2389
|
-
*/x=i?i.slice():[void 0,void 0];let[t,n]=m,e=(this._range&&(void 0!==this._range[0]&&(t=this._range[0]),void 0!==this._range[this._range.length-1])&&(n=this._range[this._range.length-1]),(void 0===x[0]||x[0]<t)&&(x[0]=t),(void 0===x[1]||x[1]>n)&&(x[1]=n),n-t);if("ordinal"===this._scale&&this._domain.length>x.length)if(i===this._range){let n=this._domain.length+1;x=(x=
|
|
2389
|
+
*/x=i?i.slice():[void 0,void 0];let[t,n]=m,e=(this._range&&(void 0!==this._range[0]&&(t=this._range[0]),void 0!==this._range[this._range.length-1])&&(n=this._range[this._range.length-1]),(void 0===x[0]||x[0]<t)&&(x[0]=t),(void 0===x[1]||x[1]>n)&&(x[1]=n),n-t);if("ordinal"===this._scale&&this._domain.length>x.length)if(i===this._range){let n=this._domain.length+1;x=(x=Ft(n).map(t=>x[0]+e*(t/(n-1))).slice(1,n)).map(t=>t-x[0]/2)}else{let n=this._domain.length,e=x[1]-x[0];x=Ft(n).map(t=>x[0]+e*(t/(n-1)))}
|
|
2390
2390
|
// else if (newRange === this._range) {
|
|
2391
2391
|
// const tickScale = scales.scaleSqrt().domain([10, 400]).range([10, 50]);
|
|
2392
2392
|
// const domain = this._scale === "time" ? this._domain.map(date) : this._domain;
|
|
@@ -2436,7 +2436,7 @@ if(hc(r[0])&&hc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain
|
|
|
2436
2436
|
/**
|
|
2437
2437
|
* "spillover" will contain the pixel spillover of the first and last label,
|
|
2438
2438
|
* and then adjust the scale range accordingly.
|
|
2439
|
-
*/,[0,1].map(t=>{var n,e,i,a=k[t?k.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))})),[E,z]=x,M=[E+M[0],z-M[1]];this._range&&(void 0!==this._range[0]&&(M[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(M[1]=this._range[this._range.length-1]),M[0]===E&&M[1]===z||(s.bind(this)(M),u.bind(this)(A?2:1));let T=Nt(k,t=>t.height)||0,B=(this._labelRotation=d&&void 0===this._labelRotation?k.some(t=>{var{i:t,height:n,position:e,truncated:i}=t,a=k[t-1];return i||t&&a.position+a.height/2>e-n/2}):this._labelRotation,this._labelOffset?Nt(k,t=>t.offset||0):0);k.forEach(t=>t.offset=t.offset?B:0);E="Line"===this._shape?0:C;let D=this._outerBounds={[h]:(Nt(k,t=>Math.ceil(t[t.rotate||!d?"width":"height"]+t.offset))||0)+(k.length?_:0),[n]:m[m.length-1]-m[0],[c]:m[0]};D[h]=Nt([this._minSize,D[h]]),v[this._orient]+=C,v[f]=void 0!==this._gridSize?Nt([this._gridSize,E]):this["_"+h]-v[this._orient]-D[h]-_,D[h]+=v[f]+v[this._orient],D[g]="start"===this._align?this._padding:"end"===this._align?this["_"+h]-D[h]-this._padding:this["_"+h]/2-D[h]/2;z=Dt("g#d3plus-Axis-"+this._uuid,{parent:i}),M=Dt("g.grid",{parent:this._group=z}).selectAll("line").data((0!==this._gridSize?this._grid||"log"===this._scale&&!this._gridLog?b:w:[]).map(t=>({id:t})),t=>t.id),M.exit().transition(a).attr("opacity",0).call(this._gridPosition.bind(this)).remove(),M.enter().append("line").attr("opacity",0).attr("clip-path",`url(#${e})`).call(this._gridPosition.bind(this),!0).merge(M).transition(a).attr("opacity",1).call(this._gridPosition.bind(this)),A=b.filter((t,n)=>k[n].lines.length&&!w.includes(t));let N=k.some(t=>t.rotate),P=w.concat(A).map(n=>{var t=k.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:D.width-v[this._position.opposite]-C-v[this._orient]+_,u=v[f],s=(C+s)*(p?-1:1),u=p?D[g]+D[h]-u:D[g]+u;return{id:n,labelBounds:N&&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-T-o:-i/2,width:d?i:l,height:d?T: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]:u}});"Line"===this._shape&&(P=P.concat(P.map(t=>{var n=Object.assign({},t);return n[g]+=t.size,n}))),(new lc[this._shape]).data(P).duration(this._duration).labelConfig({ellipsis:t=>t&&t.length?t+"...":"",rotate:t=>t.rotate?-90:0}).select(Dt("g.ticks",{parent:z}).node()).config(
|
|
2439
|
+
*/,[0,1].map(t=>{var n,e,i,a=k[t?k.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))})),[E,z]=x,M=[E+M[0],z-M[1]];this._range&&(void 0!==this._range[0]&&(M[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(M[1]=this._range[this._range.length-1]),M[0]===E&&M[1]===z||(s.bind(this)(M),u.bind(this)(A?2:1));let T=Nt(k,t=>t.height)||0,B=(this._labelRotation=d&&void 0===this._labelRotation?k.some(t=>{var{i:t,height:n,position:e,truncated:i}=t,a=k[t-1];return i||t&&a.position+a.height/2>e-n/2}):this._labelRotation,this._labelOffset?Nt(k,t=>t.offset||0):0);k.forEach(t=>t.offset=t.offset?B:0);E="Line"===this._shape?0:C;let D=this._outerBounds={[h]:(Nt(k,t=>Math.ceil(t[t.rotate||!d?"width":"height"]+t.offset))||0)+(k.length?_:0),[n]:m[m.length-1]-m[0],[c]:m[0]};D[h]=Nt([this._minSize,D[h]]),v[this._orient]+=C,v[f]=void 0!==this._gridSize?Nt([this._gridSize,E]):this["_"+h]-v[this._orient]-D[h]-_,D[h]+=v[f]+v[this._orient],D[g]="start"===this._align?this._padding:"end"===this._align?this["_"+h]-D[h]-this._padding:this["_"+h]/2-D[h]/2;z=Dt("g#d3plus-Axis-"+this._uuid,{parent:i}),M=Dt("g.grid",{parent:this._group=z}).selectAll("line").data((0!==this._gridSize?this._grid||"log"===this._scale&&!this._gridLog?b:w:[]).map(t=>({id:t})),t=>t.id),M.exit().transition(a).attr("opacity",0).call(this._gridPosition.bind(this)).remove(),M.enter().append("line").attr("opacity",0).attr("clip-path",`url(#${e})`).call(this._gridPosition.bind(this),!0).merge(M).transition(a).attr("opacity",1).call(this._gridPosition.bind(this)),A=b.filter((t,n)=>k[n].lines.length&&!w.includes(t));let N=k.some(t=>t.rotate),P=w.concat(A).map(n=>{var t=k.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:D.width-v[this._position.opposite]-C-v[this._orient]+_,u=v[f],s=(C+s)*(p?-1:1),u=p?D[g]+D[h]-u:D[g]+u;return{id:n,labelBounds:N&&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-T-o:-i/2,width:d?i:l,height:d?T: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]:u}});"Line"===this._shape&&(P=P.concat(P.map(t=>{var n=Object.assign({},t);return n[g]+=t.size,n}))),(new lc[this._shape]).data(P).duration(this._duration).labelConfig({ellipsis:t=>t&&t.length?t+"...":"",rotate:t=>t.rotate?-90:0}).select(Dt("g.ticks",{parent:z}).node()).config(Lt.bind(this)(this._shapeConfig)).labelConfig({padding:0}).render();E=z.selectAll("line.bar").data([null]);return E.enter().append("line").attr("class","bar").attr("opacity",0).call(this._barPosition.bind(this)).merge(E).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(Dt("g.d3plus-Axis-title",{parent:z}).node()).text(t=>t.text).verticalAlign("middle").width(x[x.length-1]-x[0]).x(d?x[0]:"left"===this._orient?D.x+v.left/2-(x[x.length-1]-x[0])/2:D.x+D.width-v.right/2-(x[x.length-1]-x[0])/2).y(d?"bottom"===this._orient?D.y+D.height-v.bottom:D.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}
|
|
2440
2440
|
/**
|
|
2441
2441
|
@memberof Axis
|
|
2442
2442
|
@desc If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance.
|
|
@@ -2705,7 +2705,7 @@ if(hc(r[0])&&hc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain
|
|
|
2705
2705
|
// Legend Container <g> Groups
|
|
2706
2706
|
this._group=Dt("g.d3plus-Legend",{parent:this._select}),this._titleGroup=Dt("g.d3plus-Legend-title",{parent:this._group}),this._shapeGroup=Dt("g.d3plus-Legend-shape",{parent:this._group});let u=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=gi().fontFamily(n).fontSize(e).lineHeight(t).width(this._width).height(this._height)(this._title);this._titleHeight=t+n.lines.length+this._padding,this._titleWidth=Nt(n.widths),u-=this._titleHeight}
|
|
2707
2707
|
// Calculate Text Sizes
|
|
2708
|
-
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=u-(this._data.length+1)*this._padding,s=this._width,i=gi().fontFamily(n).fontSize(e).lineHeight(t).width(s).height(o)(r);(l=Object.assign(l,i)).width=Math.ceil(Nt(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=Nt(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&&u>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=gi().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(Nt(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(ai(s.map(t=>Nt(t,t=>Nt([t.height,t.shapeHeight]))))>u){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||ai(s,this._rowHeight.bind(this))+this._padding>u){i=ai(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&&ai(s,this._rowHeight.bind(this))+this._padding<u&&(s.forEach((t,n)=>{t.forEach(t=>{n&&(t.y=ai(s.slice(0,n),this._rowHeight.bind(this)))})}),i=Nt(s,this._rowWidth.bind(this)))}e=Nt(this._lineData,(t,n)=>Nt([t.height,this._fetchConfig("height",t.data,n)])+t.y)+this._titleHeight,n=Nt([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=[],
|
|
2708
|
+
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=u-(this._data.length+1)*this._padding,s=this._width,i=gi().fontFamily(n).fontSize(e).lineHeight(t).width(s).height(o)(r);(l=Object.assign(l,i)).width=Math.ceil(Nt(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=Nt(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&&u>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=gi().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(Nt(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(ai(s.map(t=>Nt(t,t=>Nt([t.height,t.shapeHeight]))))>u){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||ai(s,this._rowHeight.bind(this))+this._padding>u){i=ai(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&&ai(s,this._rowHeight.bind(this))+this._padding<u&&(s.forEach((t,n)=>{t.forEach(t=>{n&&(t.y=ai(s.slice(0,n),this._rowHeight.bind(this)))})}),i=Nt(s,this._rowWidth.bind(this)))}e=Nt(this._lineData,(t,n)=>Nt([t.height,this._fetchConfig("height",t.data,n)])+t.y)+this._titleHeight,n=Nt([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},h=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)}));
|
|
2709
2709
|
// Legend Shapes
|
|
2710
2710
|
return this._shapes=[],["Circle","Rect"].forEach(n=>{this._shapes.push((new lc[n]).parent(this).data(h.filter(t=>t.shape===n)).duration(this._duration).labelConfig({padding:0}).select(this._shapeGroup.node()).verticalAlign("top").config(Tt({},o,s)).render())}),t&&setTimeout(t,this._duration+100),this}
|
|
2711
2711
|
/**
|
|
@@ -2832,7 +2832,7 @@ return this._shapes=[],["Circle","Rect"].forEach(n=>{this._shapes.push((new lc[n
|
|
|
2832
2832
|
@chainable
|
|
2833
2833
|
*/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",u=s?"width":"height",h=s?"x":"y",c=s?"y":"x";
|
|
2834
2834
|
// Shape <g> Group
|
|
2835
|
-
this._group=Dt("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||Re(i);let n=g[0]<this._midpoint;var d=g[1]>this._midpoint,f=n&&d;let r=Pt([this._buckets instanceof Array?this._buckets.length:this._buckets,f&&"jenks"!==this._scale?2*Math.floor(Yu(i).length/2)-1:Yu(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=
|
|
2835
|
+
this._group=Dt("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||Re(i);let n=g[0]<this._midpoint;var d=g[1]>this._midpoint,f=n&&d;let r=Pt([this._buckets instanceof Array?this._buckets.length:this._buckets,f&&"jenks"!==this._scale?2*Math.floor(Yu(i).length/2)-1:Yu(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=Ft(0,r,1).map(t=>wu(p,(t+1)/r)).reverse()),"jenks"===this._scale){var y=Pt([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=(C=Oe(v=i.filter(t=>t<this._midpoint)))<(S=Oe(w=i.concat(this._midpoint).filter(t=>t>=this._midpoint)))?1:0,S=th(v,Pt([b+o*(S<C?1:0),v.length])),C=th(w,Pt([b+o*x,w.length])),S.concat(C)):th(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?wu(p[0],n/e.length):p[0]),x=b.map(()=>p[1]),w=i.map((t,n)=>n===i.length-1?p[2]:wu(p[2],1-(n+1)/i.length));p=o.concat(x).concat(w)}else p=Ft(0,r,1).map(t=>wu(this._colorMax,t/r)).reverse();p=[(p=m.length<=y?p.slice(-m.length):p)[0]].concat(p),this._colorScale=$a().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=Wn.gamma(2.2)(this._colorMin,this._colorMid);var S=Ft(0,n,1).map(t=>e(t/n)),C=(r%2?[0]:[]).map(()=>this._colorMid);let i=Wn.gamma(2.2)(this._colorMax,this._colorMid);var v=Ft(0,n,1).map(t=>i(t/n)).reverse();p=S.concat(C).concat(v),a||(b=(p.length-1)/2,a=[g[0],this._midpoint,g[1]],a=Ft(g[0],this._midpoint,-(g[0]-this._midpoint)/b).concat(Ft(this._midpoint,g[1],(g[1]-this._midpoint)/b)).concat([g[1]]))}else p||("buckets"===this._scale||"quantile"===this._scale?(p=Ft(0,r,1).map(t=>wu(n?this._colorMin:this._colorMax,t/r)),d&&(p=p.reverse())):p=n?[this._colorMin,wu(this._colorMin,.8)]:[wu(this._colorMax,.8),this._colorMax]),a=a||("quantile"===this._scale?Ft(0,1+(o=1/(p.length-1))/2,o).map(t=>ni(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=Ft(g[0],this._midpoint,w),C=Ft(this._midpoint,g[1]+y/2,y),S.concat(C)):(v=(g[1]-g[0])/(p.length-1),Ft(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?$a:ka)().domain(a).range(p)}this._colorScale.clamp&&this._colorScale.clamp(!0);o=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale),f=Se().duration(this._duration),x={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:f,update:{opacity:1}},w=Dt("g.d3plus-ColorScale-labels",Object.assign({condition:o},x)),y=Dt("g.d3plus-ColorScale-Rect",Object.assign({condition:o},x)),S=Dt("g.d3plus-ColorScale-legend",Object.assign({condition:!o},x));if(o){C={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=Tt({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=Tt({height:this["_"+l]/2,width:this["_"+u]/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["_"+u]/2&&(f.push(this._labelMin),g+=this._padding,s&&(C.x+=g),b[u]-=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["_"+u]/2&&(f.push(this._labelMax),g+=this._padding,s||(C.y+=g),b[u]-=g),this._axisTest.select(Dt("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(b).duration(0).render(),this._axisTest.outerBounds()),g=(this._outerBounds[u]=this["_"+u]-2*this._padding,this._outerBounds[l]=v[l]+this._size,this._outerBounds[h]=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(${C.x+(s?0:g)}, ${C.y+(s?g:0)})`;this._axisClass.select(Dt("g.d3plus-ColorScale-axis",Tt(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(h+"1",s?"0%":"100%").attr(h+"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=ka().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=Tt({duration:this._duration,fill:m?t=>this._colorScale(t):`url(#gradient-${this._uuid})`,[h]: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+C[h],[c]:this._outerBounds[c]+(["top","left"].includes(this._orient)?v[l]:0)+this._size/2+C[c],[u]: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[u],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{Dt("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=Tt({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:Tt({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}
|
|
2836
2836
|
/**
|
|
2837
2837
|
@memberof ColorScale
|
|
2838
2838
|
@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/).
|
|
@@ -3300,13 +3300,13 @@ var n=new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);return t.match(n)?t=t.rep
|
|
|
3300
3300
|
*/constructor(){super(),this._ariaHidden=Ot("false"),this._delay=0,this._duration=0,this._ellipsis=(t,n)=>n?t.replace(/\.|,$/g,"")+"...":"",this._fontColor=Ot("black"),this._fontFamily=Ot(Ee),this._fontMax=Ot(50),this._fontMin=Ot(8),this._fontOpacity=Ot(1),this._fontResize=Ot(!1),this._fontSize=Ot(10),this._fontStroke=Ot("transparent"),this._fontStrokeWidth=Ot(0),this._fontWeight=Ot(400),this._height=p("height",200),this._html=Sc,this._id=(t,n)=>t.id||""+n,this._lineHeight=(t,n)=>1.2*this._fontSize(t,n),this._maxLines=Ot(null),this._on={},this._overflow=Ot(!1),this._padding=Ot(0),this._pointerEvents=Ot("auto"),this._rotate=Ot(0),this._rotateAnchor=t=>[t.w/2,t.h/2],this._split=ui,this._text=p("text"),this._textAnchor=Ot("start"),this._verticalAlign=Ot("top"),this._width=p("width",200),this._x=p("x",0),this._y=p("y",0)}}
|
|
3301
3301
|
// These are typically used in conjunction with noevent to ensure that we can
|
|
3302
3302
|
// preventDefault on the event.
|
|
3303
|
-
let kc={capture:!0,passive:!1};function Ac(t){t.preventDefault(),t.stopImmediatePropagation()}function Mc(t){var n=t.document.documentElement,t=H(t).on("dragstart.drag",Ac,kc);"onselectstart"in n?t.on("selectstart.drag",Ac,kc):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Ec(t,n){var e=t.document.documentElement,i=H(t).on("dragstart.drag",null);n&&(i.on("click.drag",Ac,kc),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in e?i.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var zc=t=>()=>t;function Tc(t,{sourceEvent:n,target:e,selection:i,mode:a,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:i,enumerable:!0,configurable:!0},mode:{value:a,enumerable:!0,configurable:!0},_:{value:r}})}function Bc(t){t.preventDefault(),t.stopImmediatePropagation()}var Dc={name:"drag"},Nc={name:"space"},Pc={name:"handle"},
|
|
3303
|
+
let kc={capture:!0,passive:!1};function Ac(t){t.preventDefault(),t.stopImmediatePropagation()}function Mc(t){var n=t.document.documentElement,t=H(t).on("dragstart.drag",Ac,kc);"onselectstart"in n?t.on("selectstart.drag",Ac,kc):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Ec(t,n){var e=t.document.documentElement,i=H(t).on("dragstart.drag",null);n&&(i.on("click.drag",Ac,kc),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in e?i.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var zc=t=>()=>t;function Tc(t,{sourceEvent:n,target:e,selection:i,mode:a,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:i,enumerable:!0,configurable:!0},mode:{value:a,enumerable:!0,configurable:!0},_:{value:r}})}function Bc(t){t.preventDefault(),t.stopImmediatePropagation()}var Dc={name:"drag"},Nc={name:"space"},Pc={name:"handle"},Fc={name:"center"};let{abs:Lc,max:Oc,min:Rc}=Math;function jc(t){return[+t[0],+t[1]]}function Ic(t){return[jc(t[0]),jc(t[1])]}var Hc={name:"x",handles:["w","e"].map(Vc),input:function(t,n){return null==t?null:[[+t[0],n[0][1]],[+t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Gc={},Kc={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Vc),input:function(t){return null==t?null:Ic(t)},output:function(t){return t}},$c={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},qc={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Uc={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Wc={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Yc={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Vc(t){return{type:t}}
|
|
3304
3304
|
// Ignore right-click, since that should open the context menu.
|
|
3305
3305
|
function Zc(t){return!t.ctrlKey&&!t.button}function Xc(){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 Jc(){return navigator.maxTouchPoints||"ontouchstart"in this}
|
|
3306
3306
|
// Like d3.local, but with the name “__brush” rather than auto-generated.
|
|
3307
|
-
function Qc(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function tg(
|
|
3308
|
-
M&&(d=h[0][0],v=h[1][0]),E&&(_=h[0][1],w=h[1][1]),h[0][0]===d&&h[0][1]===_&&h[1][0]===v&&h[1][1]===w||(u.selection=[[d,_],[v,w]],j.call(r),T.brush(t,o.name))}function P(t){if(t.stopImmediatePropagation(),t.touches){if(t.touches.length)return;
|
|
3309
|
-
(n=h)[0][0]!==n[1][0]&&n[0][1]!==n[1][1]||(u.selection=null,j.call(r)),T.end(t,o.name)}
|
|
3307
|
+
function Qc(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function tg(F){var L,n=Xc,O=Zc,e=Jc,R=!0,a=xt("start","brush","end"),i=6;function r(t){var n=t.property("__brush",h).selectAll(".overlay").data([Vc("overlay")]),n=(n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",$c.overlay).merge(n).each(function(){var t=Qc(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([Vc("selection")]).enter().append("rect").attr("class","selection").attr("cursor",$c.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges"),t.selectAll(".handle").data(F.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 $c[t.type]}),t.each(j).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",u).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function j(){var t=H(this),n=Qc(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 I(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,u,h,c,g,d,f,p,_,m,y,v,b,x,w,S,C,k,A,M,E,z,T,n,e,B,i;function D(t){for(var n of t.changedTouches||[t])for(var e of z)e.identifier===n.identifier&&(e.cur=vt(n,r));var i,a;!A||M||E||1!==z.length||(i=z[0],Lc(i.cur[0]-i[0])>Lc(i.cur[1]-i[1])?E=!0:M=!0);for(a of z)a.cur&&(a[0]=a.cur[0],a[1]=a.cur[1]);k=!0,Bc(t),N(t)}function N(t){var n,e=z[0],i=e.point0;switch(S=e[0]-i[0],C=e[1]-i[1],o){case Nc:case Dc:s&&(S=Oc(c-g,Rc(m-y,S)),d=g+S,v=y+S),l&&(C=Oc(f-p,Rc(b-x,C)),_=p+C,w=x+C);break;case Pc:z[1]?(s&&(d=Oc(c,Rc(m,z[0][0])),v=Oc(c,Rc(m,z[1][0])),s=1),l&&(_=Oc(f,Rc(b,z[0][1])),w=Oc(f,Rc(b,z[1][1])),l=1)):(s<0?(S=Oc(c-g,Rc(m-g,S)),d=g+S,v=y):0<s&&(S=Oc(c-y,Rc(m-y,S)),d=g,v=y+S),l<0?(C=Oc(f-p,Rc(b-p,C)),_=p+C,w=x):0<l&&(C=Oc(f-x,Rc(b-x,C)),_=p,w=x+C));break;case Fc:s&&(d=Oc(c,Rc(m,g-S*s)),v=Oc(c,Rc(m,y+S*s))),l&&(_=Oc(f,Rc(b,p-C*l)),w=Oc(f,Rc(b,x+C*l)))}v<d&&(s*=-1,n=g,g=y,y=n,n=d,d=v,v=n,a in qc)&&B.attr("cursor",$c[a=qc[a]]),w<_&&(l*=-1,n=p,p=x,x=n,n=_,_=w,w=n,a in Uc)&&B.attr("cursor",$c[a=Uc[a]]),u.selection&&(h=u.selection),// May be set by brush.move!
|
|
3308
|
+
M&&(d=h[0][0],v=h[1][0]),E&&(_=h[0][1],w=h[1][1]),h[0][0]===d&&h[0][1]===_&&h[1][0]===v&&h[1][1]===w||(u.selection=[[d,_],[v,w]],j.call(r),T.brush(t,o.name))}function P(t){if(t.stopImmediatePropagation(),t.touches){if(t.touches.length)return;L&&clearTimeout(L),L=setTimeout(function(){L=null},500)}else Ec(t.view,k),i.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);var n;e.attr("pointer-events","all"),B.attr("cursor",$c.overlay),u.selection&&(h=u.selection),// May be set by brush.move (on start)!
|
|
3309
|
+
(n=h)[0][0]!==n[1][0]&&n[0][1]!==n[1][1]||(u.selection=null,j.call(r)),T.end(t,o.name)}L&&!t.touches||O.apply(this,arguments)&&(r=this,a=t.target.__data__.type,o="selection"===(R&&t.metaKey?a="overlay":a)?Dc:R&&t.altKey?Fc:Pc,s=F===Gc?null:Wc[a],l=F===Hc?null:Yc[a],n=(u=Qc(r)).extent,h=u.selection,c=n[0][0],f=n[0][1],m=n[1][0],b=n[1][1],C=S=0,A=s&&l&&R&&t.shiftKey,z=Array.from(t.touches||[t],t=>{var n=t.identifier;return(t=vt(t,r)).point0=t.slice(),t.identifier=n,t}),cn(r),T=I(r,arguments,!0).beforestart(),"overlay"===a?(h&&(k=!0),n=[z[0],z[1]||z[0]],u.selection=h=[[g=F===Gc?c:Rc(n[0][0],n[1][0]),p=F===Hc?f:Rc(n[0][1],n[1][1])],[y=F===Gc?m:Oc(n[0][0],n[1][0]),x=F===Hc?b:Oc(n[0][1],n[1][1])]],1<z.length&&N(t)):(g=h[0][0],p=h[0][1],y=h[1][0],x=h[1][1]),d=g,_=p,v=y,w=x,e=H(r).attr("pointer-events","none"),B=e.selectAll(".overlay").attr("cursor",$c[a]),t.touches?(T.moved=D,T.ended=P):(i=H(t.view).on("mousemove.brush",D,!0).on("mouseup.brush",P,!0),R&&i.on("keydown.brush",function(t){switch(t.keyCode){case 16:A=s&&l;break;case 18:o===Pc&&(s&&(y=v-S*s,g=d+S*s),l&&(x=w-C*l,p=_+C*l),o=Fc,N(t));break;case 32:o!==Pc&&o!==Fc||(s<0?y=v-S:0<s&&(g=d-S),l<0?x=w-C:0<l&&(p=_-C),o=Nc,B.attr("cursor",$c.selection),N(t));break;default:return}Bc(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:A&&(M=E=A=!1,N(t));break;case 18:o===Fc&&(s<0?y=v:0<s&&(g=d),l<0?x=w:0<l&&(p=_),o=Pc,N(t));break;case 32:o===Nc&&(o=t.altKey?(s&&(y=v-S*s,g=d+S*s),l&&(x=w-C*l,p=_+C*l),Fc):(s<0?y=v:0<s&&(g=d),l<0?x=w:0<l&&(p=_),Pc),B.attr("cursor",$c[a]),N(t));break;default:return}Bc(t)},!0),Mc(t.view)),j.call(r),T.start(t,o.name))}function l(t){I(this,arguments).moved(t)}function u(t){I(this,arguments).ended(t)}function h(){var t=this.__brush||{selection:null};return t.extent=Ic(n.apply(this,arguments)),t.dim=F,t}return r.move=function(t,s,i){t.tween?t.on("start.brush",function(t){I(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){I(this,arguments).end(t)}).tween("brush",function(){var n=this,e=n.__brush,i=I(n,arguments),t=e.selection,a=F.input("function"==typeof s?s.apply(this,arguments):s,e.extent),r=ee(t,a);function o(t){e.selection=1===t&&null===a?null:r(t),j.call(n),i.brush()}return null!==t&&null!==a?o:o(1)}):t.each(function(){var t=arguments,n=this.__brush,e=F.input("function"==typeof s?s.apply(this,t):s,n.extent),t=I(this,t).beforestart();cn(this),n.selection=null===e?null:e,j.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 Tc(t,{sourceEvent:n,target:r,selection:F.output(this.state.selection),mode:e,dispatch:a}),i)}},r.extent=function(t){return arguments.length?(n="function"==typeof t?t:zc(Ic(t)),r):n},r.filter=function(t){return arguments.length?(O="function"==typeof t?t:zc(!!t),r):O},r.touchable=function(t){return arguments.length?(e="function"==typeof t?t:zc(!!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 ng="#bbb";class eg extends pc{
|
|
3310
3310
|
/**
|
|
3311
3311
|
@memberof Timeline
|
|
3312
3312
|
@desc Triggered on brush "brush".
|
|
@@ -3488,18 +3488,18 @@ return((bg(t)?t.ownerDocument:t.document)||window.document).documentElement}func
|
|
|
3488
3488
|
t.assignedSlot||// step into the shadow DOM of the parent of a slotted node
|
|
3489
3489
|
t.parentNode||(wg(t)?t.host:null)||// ShadowRoot detected
|
|
3490
3490
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
3491
|
-
Ng(t)}function
|
|
3491
|
+
Ng(t)}function Fg(t){return xg(t)&&// https://github.com/popperjs/popper-core/issues/837
|
|
3492
3492
|
"fixed"!==Dg(t).position?t.offsetParent:null}// `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
3493
3493
|
// return the containing block
|
|
3494
3494
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
3495
3495
|
// such as table ancestors and cross browser bugs.
|
|
3496
|
-
function
|
|
3496
|
+
function Lg(t){for(var n,e=vg(t),i=Fg(t);i&&(n=i,0<=["table","td","th"].indexOf(yg(n)))&&"static"===Dg(i).position;)i=Fg(i);return(!i||"html"!==yg(i)&&("body"!==yg(i)||"static"!==Dg(i).position))&&(i||(t=>{var n=/firefox/i.test(Mg()),e=/Trident/i.test(Mg());if(!e||!xg(t)||"fixed"!==Dg(t).position){var i=Pg(t);for(wg(i)&&(i=i.host);xg(i)&&["html","body"].indexOf(yg(i))<0;){var a=Dg(i);// This is non-exhaustive but covers the most common CSS properties that
|
|
3497
3497
|
// create a containing block.
|
|
3498
3498
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
3499
3499
|
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 Og(t){return 0<=["top","bottom"].indexOf(t)?"x":"y"}function Rg(t,n,e){return Cg(t,kg(n,e))}function jg(){return{top:0,right:0,bottom:0,left:0}}function Ig(t){return Object.assign({},jg(),t)}function Hg(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function Gg(t){return t.split("-")[1]}var Kg={top:"auto",right:"auto",bottom:"auto",left:"auto"};// Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
3500
3500
|
// Zooming can change the DPR, but it seems to report a value that will
|
|
3501
3501
|
// cleanly divide the values into the appropriate subpixels.
|
|
3502
|
-
function $g(t){var n,e=t.popper,i=t.popperRect,a=t.placement,r=t.variation,o=t.offsets,s=t.position,l=t.gpuAcceleration,u=t.adaptive,h=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 h?h({x:c,y:g}):{x:c,y:g},d=(c=d.x,g=d.y,o.hasOwnProperty("x")),o=o.hasOwnProperty("y"),f=og,p=ig,_=window,m=(u&&(m="clientHeight",n="clientWidth",(y=
|
|
3502
|
+
function $g(t){var n,e=t.popper,i=t.popperRect,a=t.placement,r=t.variation,o=t.offsets,s=t.position,l=t.gpuAcceleration,u=t.adaptive,h=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 h?h({x:c,y:g}):{x:c,y:g},d=(c=d.x,g=d.y,o.hasOwnProperty("x")),o=o.hasOwnProperty("y"),f=og,p=ig,_=window,m=(u&&(m="clientHeight",n="clientWidth",(y=Lg(e))===vg(e)&&"static"!==Dg(y=Ng(e)).position&&"absolute"===s&&(m="scrollHeight",n="scrollWidth"),a!==ig&&(a!==og&&a!==rg||r!==hg)||(p=ag,g=(g-((t&&y===_&&_.visualViewport?_.visualViewport.height:y[m])-i.height))*(l?1:-1)),a!==og&&(a!==ig&&a!==ag||r!==hg)||(f=rg,c=(c-((t&&y===_&&_.visualViewport?_.visualViewport.width:y[n])-i.width))*(l?1:-1))),Object.assign({position:s},u&&Kg)),y=!0===h?(a={x:c,y:g},r=vg(e),t=a.x,a=a.y,r=r.devicePixelRatio||1,{x:Ag(t*r)/r||0,y:Ag(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
|
|
3503
3503
|
var qg={passive:!0};// eslint-disable-next-line import/no-unused-modules
|
|
3504
3504
|
var Ug={left:"right",right:"left",bottom:"top",top:"bottom"};function Wg(t){return t.replace(/left|right|bottom|top/g,function(t){return Ug[t]})}var Yg={start:"end",end:"start"};function Vg(t){return t.replace(/start|end/g,function(t){return Yg[t]})}function Zg(t){t=vg(t);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Xg(t){
|
|
3505
3505
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
@@ -3524,7 +3524,7 @@ var i,a,r,o,s,l,u,h}// A "clipping parent" is an overflowable container with the
|
|
|
3524
3524
|
// `initial`
|
|
3525
3525
|
// Gets the maximum area that the element is visible in due to any number of
|
|
3526
3526
|
// clipping parents
|
|
3527
|
-
function ed(e,t,n,i){var a,r="clippingParents"===t?(o=Qg(Pg(r=e)),bg(a=0<=["absolute","fixed"].indexOf(Dg(r).position)&&xg(r)?
|
|
3527
|
+
function ed(e,t,n,i){var a,r="clippingParents"===t?(o=Qg(Pg(r=e)),bg(a=0<=["absolute","fixed"].indexOf(Dg(r).position)&&xg(r)?Lg(r):r)?o.filter(function(t){return bg(t)&&Bg(t,a)&&"body"!==yg(t)}):[]):[].concat(t),o=[].concat(r,[n]),t=o[0],n=o.reduce(function(t,n){n=nd(e,n,i);return t.top=Cg(n.top,t.top),t.right=kg(n.right,t.right),t.bottom=kg(n.bottom,t.bottom),t.left=Cg(n.left,t.left),t},nd(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 id(t){var n,e=t.reference,i=t.element,t=t.placement,a=t?Sg(t):null,t=t?Gg(t):null,r=e.x+e.width/2-i.width/2,o=e.y+e.height/2-i.height/2;switch(a){case ig:n={x:r,y:e.y-i.height};break;case ag:n={x:r,y:e.y+e.height};break;case rg:n={x:e.x+e.width,y:o};break;case og:n={x:e.x-i.width,y:o};break;default:n={x:e.x,y:e.y}}var s=a?Og(a):null;if(null!=s){var l="y"===s?"height":"width";switch(t){case ug:n[s]=n[s]-(e[l]/2-i[l]/2);break;case hg:n[s]=n[s]+(e[l]/2-i[l]/2)}}return n}function ad(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?cg:r,o=n.rootBoundary,o=void 0===o?gg:o,s=n.elementContext,s=void 0===s?dg:s,l=n.altBoundary,l=void 0!==l&&l,n=n.padding,n=void 0===n?0:n,n=Ig("number"!=typeof n?n:Hg(n,lg)),u=t.rects.popper,l=t.elements[l?s===dg?fg:dg:s],l=ed(bg(l)?l:l.contextElement||Ng(t.elements.popper),r,o,a),r=zg(t.elements.reference),o=id({reference:r,element:u,placement:e}),a=td(Object.assign({},u,o)),u=s===dg?a:r,h={top:l.top-u.top+n.top,bottom:u.bottom-l.bottom+n.bottom,left:l.left-u.left+n.left,right:u.right-l.right+n.right},o=t.modifiersData.offset;// Offsets can be applied only to the popper element
|
|
3528
3528
|
return s===dg&&o&&(i=o[e],Object.keys(h).forEach(function(t){var n=0<=[rg,ag].indexOf(t)?1:-1,e=0<=[ig,ag].indexOf(t)?"y":"x";h[t]+=i[e]*n})),h}function rd(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 od(n){return[ig,rg,ag,og].some(function(t){return 0<=n[t]})}// Returns the composite rect of an element relative to its offsetParent.
|
|
3529
3529
|
// Composite means it takes into account transforms as well as layout.
|
|
3530
3530
|
function sd(t,n,e){void 0===e&&(e=!1);var i=xg(n),a=xg(n)&&(o=(a=n).getBoundingClientRect(),r=Ag(o.width)/a.offsetWidth||1,o=Ag(o.height)/a.offsetHeight||1,1!==r||1!==o),r=Ng(n),o=zg(t,a,e),t={scrollLeft:0,scrollTop:0},s={x:0,y:0};return!i&&e||("body"===yg(n)&&// https://github.com/popperjs/popper-core/issues/1078
|
|
@@ -3541,7 +3541,7 @@ return o.orderedModifiers=t.filter(function(t){return t.enabled}),o.orderedModif
|
|
|
3541
3541
|
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
|
|
3542
3542
|
// anymore
|
|
3543
3543
|
if(hd(n,t)){// Store the reference and popper rects to be read by modifiers
|
|
3544
|
-
o.rects={reference:sd(n,
|
|
3544
|
+
o.rects={reference:sd(n,Lg(t),"fixed"===o.options.strategy),popper:Tg(t)},// Modifiers have the ability to reset the current update cycle. The
|
|
3545
3545
|
// most common use case for this is the `flip` modifier changing the
|
|
3546
3546
|
// placement, which then needs to re-run all the modifiers, because the
|
|
3547
3547
|
// logic was previously ran for the previous placement and is therefore
|
|
@@ -3569,8 +3569,8 @@ xg(n)&&yg(n)&&(Object.assign(n.style,t),Object.keys(e).forEach(function(t){n.rem
|
|
|
3569
3569
|
},{name:"flip",enabled:!0,phase:"main",fn:function(t){var c=t.state,n=t.options,t=t.name;if(!c.modifiersData[t]._skip){for(var e=n.mainAxis,i=void 0===e||e,e=n.altAxis,a=void 0===e||e,e=n.fallbackPlacements,g=n.padding,d=n.boundary,f=n.rootBoundary,r=n.altBoundary,o=n.flipVariations,p=void 0===o||o,_=n.allowedAutoPlacements,o=c.options.placement,n=Sg(o),e=e||(n===o||!p?[Wg(o)]:Sg(e=o)===sg?[]:(n=Wg(e),[Vg(e),n,Vg(n)])),s=[o].concat(e).reduce(function(t,n){return t.concat(Sg(n)===sg?(e=c,i=(t=t=void 0===(t={placement:n,boundary:d,rootBoundary:f,padding:g,flipVariations:p,allowedAutoPlacements:_})?{}:t).placement,a=t.boundary,r=t.rootBoundary,o=t.padding,s=t.flipVariations,l=void 0===(t=t.allowedAutoPlacements)?_g:t,u=Gg(i),t=u?s?pg:pg.filter(function(t){return Gg(t)===u}):lg,h=(i=0===(i=t.filter(function(t){return 0<=l.indexOf(t)})).length?t:i).reduce(function(t,n){return t[n]=ad(e,{placement:n,boundary:a,rootBoundary:r,padding:o})[Sg(n)],t},{}),Object.keys(h).sort(function(t,n){return h[t]-h[n]})):n);var e,i,a,r,o,s,l,u,h},[]),l=c.rects.reference,u=c.rects.popper,h=new Map,m=!0,y=s[0],v=0;v<s.length;v++){var b=s[v],x=Sg(b),w=Gg(b)===ug,S=0<=[ig,ag].indexOf(x),C=S?"width":"height",k=ad(c,{placement:b,boundary:d,rootBoundary:f,altBoundary:r,padding:g}),S=S?w?rg:og:w?ag:ig,w=(l[C]>u[C]&&(S=Wg(S)),Wg(S)),C=[];if(i&&C.push(k[x]<=0),a&&C.push(k[S]<=0,k[w]<=0),C.every(function(t){return t})){y=b,m=!1;break}h.set(b,C)}if(m)for(
|
|
3570
3570
|
// `2` may be desired in some cases – research later
|
|
3571
3571
|
var A=p?3:1;0<A;A--)if("break"===(n=>{var t=s.find(function(t){t=h.get(t);if(t)return t.slice(0,n).every(function(t){return t})});if(t)return y=t,"break"})(A))break;c.placement!==y&&(c.modifiersData[t]._skip=!0,c.placement=y,c.reset=!0)}}// eslint-disable-next-line import/no-unused-modules
|
|
3572
|
-
,requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n,e,i,a,r,o,s,l,u,h=t.state,c=t.options,t=t.name,g=void 0===(g=c.mainAxis)||g,d=void 0!==(d=c.altAxis)&&d,f=void 0===(f=c.tether)||f,p=void 0===(p=c.tetherOffset)?0:p,c=ad(h,{boundary:c.boundary,rootBoundary:c.rootBoundary,padding:c.padding,altBoundary:c.altBoundary}),_=Sg(h.placement),m=Gg(h.placement),y=!m,v=Og(_),b="x"===v?"y":"x",x=h.modifiersData.popperOffsets,w=h.rects.reference,S=h.rects.popper,p="number"==typeof(p="function"==typeof p?p(Object.assign({},h.rects,{placement:h.placement})):p)?{mainAxis:p,altAxis:p}:Object.assign({mainAxis:0,altAxis:0},p),C=h.modifiersData.offset?h.modifiersData.offset[h.placement]:null,k={x:0,y:0};x&&(g&&(g="y"===v?"height":"width",o=(s=x[v])+c[e="y"===v?ig:og],l=s-c[u="y"===v?ag:rg],n=f?-S[g]/2:0,a=(m===ug?w:S)[g],m=m===ug?-S[g]:-w[g],r=h.elements.arrow,r=f&&r?Tg(r):{width:0,height:0},e=(i=h.modifiersData["arrow#persistent"]?h.modifiersData["arrow#persistent"].padding:jg())[e],i=i[u],u=Rg(0,w[g],r[g]),r=y?w[g]/2-n-u-e-p.mainAxis:a-u-e-p.mainAxis,a=y?-w[g]/2+n+u+i+p.mainAxis:m+u+i+p.mainAxis,y=(e=h.elements.arrow&&
|
|
3573
|
-
,requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,e,i,a,r=t.state,o=t.name,t=t.options,s=r.elements.arrow,l=r.modifiersData.popperOffsets,u=Og(h=Sg(r.placement)),h=0<=[og,rg].indexOf(h)?"height":"width";s&&l&&(t=t.padding,e=r,e=Ig("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Hg(t,lg)),t=Tg(s),a="y"===u?ig:og,i="y"===u?ag:rg,n=r.rects.reference[h]+r.rects.reference[u]-l[u]-r.rects.popper[h],l=l[u]-r.rects.reference[u],s=(s=
|
|
3572
|
+
,requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n,e,i,a,r,o,s,l,u,h=t.state,c=t.options,t=t.name,g=void 0===(g=c.mainAxis)||g,d=void 0!==(d=c.altAxis)&&d,f=void 0===(f=c.tether)||f,p=void 0===(p=c.tetherOffset)?0:p,c=ad(h,{boundary:c.boundary,rootBoundary:c.rootBoundary,padding:c.padding,altBoundary:c.altBoundary}),_=Sg(h.placement),m=Gg(h.placement),y=!m,v=Og(_),b="x"===v?"y":"x",x=h.modifiersData.popperOffsets,w=h.rects.reference,S=h.rects.popper,p="number"==typeof(p="function"==typeof p?p(Object.assign({},h.rects,{placement:h.placement})):p)?{mainAxis:p,altAxis:p}:Object.assign({mainAxis:0,altAxis:0},p),C=h.modifiersData.offset?h.modifiersData.offset[h.placement]:null,k={x:0,y:0};x&&(g&&(g="y"===v?"height":"width",o=(s=x[v])+c[e="y"===v?ig:og],l=s-c[u="y"===v?ag:rg],n=f?-S[g]/2:0,a=(m===ug?w:S)[g],m=m===ug?-S[g]:-w[g],r=h.elements.arrow,r=f&&r?Tg(r):{width:0,height:0},e=(i=h.modifiersData["arrow#persistent"]?h.modifiersData["arrow#persistent"].padding:jg())[e],i=i[u],u=Rg(0,w[g],r[g]),r=y?w[g]/2-n-u-e-p.mainAxis:a-u-e-p.mainAxis,a=y?-w[g]/2+n+u+i+p.mainAxis:m+u+i+p.mainAxis,y=(e=h.elements.arrow&&Lg(h.elements.arrow))?"y"===v?e.clientTop||0:e.clientLeft||0:0,m=s+a-(n=null!=(g=null==C?void 0:C[v])?g:0),u=Rg(f?kg(o,s+r-n-y):o,s,f?Cg(l,m):l),x[v]=u,k[v]=u-s),d&&(i="y"==b?"height":"width",a=(e=x[b])+c["x"===v?ig:og],g=e-c["x"===v?ag:rg],r=-1!==[ig,og].indexOf(_),y=null!=(n=null==C?void 0:C[b])?n:0,o=r?a:e-w[i]-S[i]-y+p.altAxis,m=r?e+w[i]+S[i]-y-p.altAxis:g,s=f&&r?(l=Rg(l=o,e,u=m),u<l?u:l):Rg(f?o:a,e,f?m:g),x[b]=s,k[b]=s-e),h.modifiersData[t]=k)}// eslint-disable-next-line import/no-unused-modules
|
|
3573
|
+
,requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,e,i,a,r=t.state,o=t.name,t=t.options,s=r.elements.arrow,l=r.modifiersData.popperOffsets,u=Og(h=Sg(r.placement)),h=0<=[og,rg].indexOf(h)?"height":"width";s&&l&&(t=t.padding,e=r,e=Ig("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Hg(t,lg)),t=Tg(s),a="y"===u?ig:og,i="y"===u?ag:rg,n=r.rects.reference[h]+r.rects.reference[u]-l[u]-r.rects.popper[h],l=l[u]-r.rects.reference[u],s=(s=Lg(s))?"y"===u?s.clientHeight||0:s.clientWidth||0:0,a=e[a],e=s-t[h]-e[i],a=Rg(a,i=s/2-t[h]/2+(n/2-l/2),e),r.modifiersData[o]=((s={})[u]=a,s.centerOffset=a-i,s))},effect:function(t){var n=t.state;null!=(t=void 0===(t=t.options.element)?"[data-popper-arrow]":t)&&("string"!=typeof t||(t=n.elements.popper.querySelector(t)))&&Bg(n.elements.popper,t)&&(n.elements.arrow=t);// CSS selector
|
|
3574
3574
|
}// eslint-disable-next-line import/no-unused-modules
|
|
3575
3575
|
,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,t=t.name,e=n.rects.reference,i=n.rects.popper,a=n.modifiersData.preventOverflow,r=ad(n,{elementContext:"reference"}),o=ad(n,{altBoundary:!0}),r=rd(r,e),e=rd(o,i,a),o=od(r),i=od(e);n.modifiersData[t]={referenceClippingOffsets:r,popperEscapeOffsets:e,isReferenceHidden:o,hasPopperEscaped:i},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":o,"data-popper-escaped":i})}// eslint-disable-next-line import/no-unused-modules
|
|
3576
3576
|
}]});// eslint-disable-next-line import/no-unused-modules
|
|
@@ -3829,16 +3829,16 @@ bd(t)}function bd(t){var n;!t._active&&t._call&&(n=t._data,t._data=void 0,// all
|
|
|
3829
3829
|
t._call(t._error,n))}function xd(t){if(null==t)t=1/0;else if(!(1<=(t=+t)))throw new Error("invalid concurrency");return new md(t)}md.prototype=xd.prototype={constructor:md,defer:function(t){if("function"!=typeof t)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");var n;return null==this._error&&((n=pd.call(arguments,1)).push(t),++this._waiting,this._tasks.push(n),yd(this)),this},abort:function(){return null==this._error&&vd(this,new Error("abort")),this},await:function(e){if("function"!=typeof e)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(t,n){e.apply(null,[t].concat(n))},bd(this),this},awaitAll:function(t){if("function"!=typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=t,bd(this),this}};var wd=t=>()=>t;function Sd(t,{sourceEvent:n,target:e,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Cd(t,n,e){this.k=t,this.x=n,this.y=e}Cd.prototype={constructor:Cd,scale:function(t){return 1===t?this:new Cd(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Cd(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var kd=new Cd(1,0,0);function Ad(t){for(;!t.__zoom;)if(!(t=t.parentNode))return kd;return t.__zoom}function Md(t){t.stopImmediatePropagation()}function Ed(t){t.preventDefault(),t.stopImmediatePropagation()}
|
|
3830
3830
|
// Ignore right-click, since that should open the context menu.
|
|
3831
3831
|
// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event
|
|
3832
|
-
function zd(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Td(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||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]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Bd(){return this.__zoom||kd}function Dd(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Nd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pd(t,n,e){var i=t.invertX(n[0][0])-e[0][0],a=t.invertX(n[1][0])-e[1][0],r=t.invertY(n[0][1])-e[0][1],n=t.invertY(n[1][1])-e[1][1];return t.translate(i<a?(i+a)/2:Math.min(0,i)||Math.max(0,a),r<n?(r+n)/2:Math.min(0,r)||Math.max(0,n))}function
|
|
3832
|
+
function zd(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Td(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||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]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Bd(){return this.__zoom||kd}function Dd(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Nd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pd(t,n,e){var i=t.invertX(n[0][0])-e[0][0],a=t.invertX(n[1][0])-e[1][0],r=t.invertY(n[0][1])-e[0][1],n=t.invertY(n[1][1])-e[1][1];return t.translate(i<a?(i+a)/2:Math.min(0,i)||Math.max(0,a),r<n?(r+n)/2:Math.min(0,r)||Math.max(0,n))}function Fd(){var u,h,s,c=zd,g=Td,d=Pd,r=Dd,n=Nd,o=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],l=250,p=ge,e=xt("start","zoom","end"),_=500,m=150,y=0,v=10;function b(t){t.property("__zoom",Bd).on("wheel.zoom",a,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",M).filter(n).on("touchstart.zoom",E).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(t,n){return(n=Math.max(o[0],Math.min(o[1],n)))===t.k?t:new Cd(n,t.x,t.y)}function w(t,n,e){var i=n[0]-e[0]*t.k,n=n[1]-e[1]*t.k;return i===t.x&&n===t.y?t:new Cd(t.k,i,n)}function S(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function C(t,e,l,u){t.on("start.zoom",function(){k(this,arguments).event(u).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(u).end()}).tween("zoom",function(){var t=arguments,i=k(this,t).event(u),n=g.apply(this,t),a=null==l?S(n):"function"==typeof l?l.apply(this,t):l,r=Math.max(n[1][0]-n[0][0],n[1][1]-n[0][1]),n=this.__zoom,o="function"==typeof e?e.apply(this,t):e,s=p(n.invert(a).concat(r/n.k),o.invert(a).concat(r/o.k));return function(t){var n,e;t=1===t?o:(n=s(t),new Cd(e=r/n[2],a[0]-n[0]*e,a[1]-n[1]*e)),i.zoom(null,t)}})}function k(t,n,e){return!e&&t.__zooming||new i(t,n)}function i(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=g.apply(t,n),this.taps=0}function a(t,...n){if(c.apply(this,arguments)){var e=k(this,n).event(t),n=this.__zoom,i=Math.max(o[0],Math.min(o[1],n.k*Math.pow(2,r.apply(this,arguments)))),a=vt(t);
|
|
3833
3833
|
// If the mouse is in the same location as before, reuse it.
|
|
3834
3834
|
// If there were recent wheel events, reset the wheel idle timeout.
|
|
3835
3835
|
if(e.wheel)e.mouse[0][0]===a[0]&&e.mouse[0][1]===a[1]||(e.mouse[1]=n.invert(e.mouse[0]=a)),clearTimeout(e.wheel);else{if(n.k===i)return;e.mouse=[a,n.invert(a)],cn(this),e.start()}Ed(t),e.wheel=setTimeout(function(){e.wheel=null,e.end()},m),e.zoom("mouse",d(w(x(n,i),e.mouse[0],e.mouse[1]),e.extent,f))}}function A(t,...n){var i,a,e,r,o;!s&&c.apply(this,arguments)&&(i=t.currentTarget,a=k(this,n,!0).event(t),e=H(t.view).on("mousemove.zoom",function(t){{var n,e;Ed(t),a.moved||(n=t.clientX-r,e=t.clientY-o,a.moved=y<n*n+e*e)}a.event(t).zoom("mouse",d(w(a.that.__zoom,a.mouse[0]=vt(t,i),a.mouse[1]),a.extent,f))},!0).on("mouseup.zoom",function(t){e.on("mousemove.zoom mouseup.zoom",null),Ec(t.view,a.moved),Ed(t),a.event(t).end()},!0),n=vt(t,i),r=t.clientX,o=t.clientY,Mc(t.view),Md(t),a.mouse=[n,this.__zoom.invert(n)],cn(this),a.start())}function M(t,...n){var e,i,a,r;c.apply(this,arguments)&&(r=this.__zoom,e=vt(t.changedTouches?t.changedTouches[0]:t,this),i=r.invert(e),a=r.k*(t.shiftKey?.5:2),r=d(w(x(r,a),e,i),g.apply(this,n),f),Ed(t),0<l?H(this).transition().duration(l).call(C,r,e,t):H(this).call(b.transform,r,e,t))}function E(t,...n){if(c.apply(this,arguments)){var e,i,a,r,o=t.touches,s=o.length,l=k(this,n,t.changedTouches.length===s).event(t);for(Md(t),i=0;i<s;++i)r=[r=vt(a=o[i],this),this.__zoom.invert(r),a.identifier],l.touch0?l.touch1||l.touch0[2]===r[2]||(l.touch1=r,l.taps=0):(l.touch0=r,e=!0,l.taps=1+!!u);u=u&&clearTimeout(u),e&&(l.taps<2&&(h=r[0],u=setTimeout(function(){u=null},_)),cn(this),l.start())}}function z(t,...n){if(this.__zooming){var e,i=k(this,n).event(t),a=t.changedTouches,r=a.length;for(Ed(t),e=0;e<r;++e)c=vt(h=a[e],this),i.touch0&&i.touch0[2]===h.identifier?i.touch0[0]=c:i.touch1&&i.touch1[2]===h.identifier&&(i.touch1[0]=c);if(h=i.that.__zoom,i.touch1)var n=i.touch0[0],t=i.touch0[1],o=i.touch1[0],s=i.touch1[1],l=(l=o[0]-n[0])*l+(l=o[1]-n[1])*l,u=(u=s[0]-t[0])*u+(u=s[1]-t[1])*u,h=x(h,Math.sqrt(l/u)),c=[(n[0]+o[0])/2,(n[1]+o[1])/2],l=[(t[0]+s[0])/2,(t[1]+s[1])/2];else{if(!i.touch0)return;c=i.touch0[0],l=i.touch0[1]}i.zoom("touch",d(w(h,c,l),i.extent,f))}}function T(t,...n){if(this.__zooming){var e,i,a=k(this,n).event(t),r=t.changedTouches,o=r.length;for(Md(t),s&&clearTimeout(s),s=setTimeout(function(){s=null},_),e=0;e<o;++e)i=r[e],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0?a.touch0[1]=this.__zoom.invert(a.touch0[0]):(a.end(),
|
|
3836
3836
|
// If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
|
|
3837
|
-
2===a.taps&&(i=vt(i,this),Math.hypot(h[0]-i[0],h[1]-i[1])<v)&&(n=H(this).on("dblclick.zoom"))&&n.apply(this,arguments))}}return b.transform=function(t,n,e,i){var a=t.selection?t.selection():t;a.property("__zoom",Bd),t!==a?C(t,n,e,i):a.interrupt().each(function(){k(this,arguments).event(i).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},b.scaleBy=function(t,n,e,i){b.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)},e,i)},b.scaleTo=function(t,r,o,n){b.transform(t,function(){var t=g.apply(this,arguments),n=this.__zoom,e=null==o?S(t):"function"==typeof o?o.apply(this,arguments):o,i=n.invert(e),a="function"==typeof r?r.apply(this,arguments):r;return d(w(x(n,a),e,i),t,f)},o,n)},b.translateBy=function(t,n,e,i){b.transform(t,function(){return d(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),g.apply(this,arguments),f)},null,i)},b.translateTo=function(t,i,a,r,n){b.transform(t,function(){var t=g.apply(this,arguments),n=this.__zoom,e=null==r?S(t):"function"==typeof r?r.apply(this,arguments):r;return d(kd.translate(e[0],e[1]).scale(n.k).translate("function"==typeof i?-i.apply(this,arguments):-i,"function"==typeof a?-a.apply(this,arguments):-a),t,f)},r,n)},i.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this).emit("start"),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=H(this.that).datum();e.call(t,this.that,new Sd(t,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:e}),n)}},b.wheelDelta=function(t){return arguments.length?(r="function"==typeof t?t:wd(+t),b):r},b.filter=function(t){return arguments.length?(c="function"==typeof t?t:wd(!!t),b):c},b.touchable=function(t){return arguments.length?(n="function"==typeof t?t:wd(!!t),b):n},b.extent=function(t){return arguments.length?(g="function"==typeof t?t:wd([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),b):g},b.scaleExtent=function(t){return arguments.length?(o[0]=+t[0],o[1]=+t[1],b):[o[0],o[1]]},b.translateExtent=function(t){return arguments.length?(f[0][0]=+t[0][0],f[1][0]=+t[1][0],f[0][1]=+t[0][1],f[1][1]=+t[1][1],b):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},b.constrain=function(t){return arguments.length?(d=t,b):d},b.duration=function(t){return arguments.length?(l=+t,b):l},b.interpolate=function(t){return arguments.length?(p=t,b):p},b.on=function(){var t=e.on.apply(e,arguments);return t===e?b:t},b.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,b):Math.sqrt(y)},b.tapDistance=function(t){return arguments.length?(v=+t,b):v},b}Ad.prototype=Cd.prototype;var
|
|
3837
|
+
2===a.taps&&(i=vt(i,this),Math.hypot(h[0]-i[0],h[1]-i[1])<v)&&(n=H(this).on("dblclick.zoom"))&&n.apply(this,arguments))}}return b.transform=function(t,n,e,i){var a=t.selection?t.selection():t;a.property("__zoom",Bd),t!==a?C(t,n,e,i):a.interrupt().each(function(){k(this,arguments).event(i).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},b.scaleBy=function(t,n,e,i){b.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)},e,i)},b.scaleTo=function(t,r,o,n){b.transform(t,function(){var t=g.apply(this,arguments),n=this.__zoom,e=null==o?S(t):"function"==typeof o?o.apply(this,arguments):o,i=n.invert(e),a="function"==typeof r?r.apply(this,arguments):r;return d(w(x(n,a),e,i),t,f)},o,n)},b.translateBy=function(t,n,e,i){b.transform(t,function(){return d(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),g.apply(this,arguments),f)},null,i)},b.translateTo=function(t,i,a,r,n){b.transform(t,function(){var t=g.apply(this,arguments),n=this.__zoom,e=null==r?S(t):"function"==typeof r?r.apply(this,arguments):r;return d(kd.translate(e[0],e[1]).scale(n.k).translate("function"==typeof i?-i.apply(this,arguments):-i,"function"==typeof a?-a.apply(this,arguments):-a),t,f)},r,n)},i.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this).emit("start"),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=H(this.that).datum();e.call(t,this.that,new Sd(t,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:e}),n)}},b.wheelDelta=function(t){return arguments.length?(r="function"==typeof t?t:wd(+t),b):r},b.filter=function(t){return arguments.length?(c="function"==typeof t?t:wd(!!t),b):c},b.touchable=function(t){return arguments.length?(n="function"==typeof t?t:wd(!!t),b):n},b.extent=function(t){return arguments.length?(g="function"==typeof t?t:wd([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),b):g},b.scaleExtent=function(t){return arguments.length?(o[0]=+t[0],o[1]=+t[1],b):[o[0],o[1]]},b.translateExtent=function(t){return arguments.length?(f[0][0]=+t[0][0],f[1][0]=+t[1][0],f[0][1]=+t[0][1],f[1][1]=+t[1][1],b):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},b.constrain=function(t){return arguments.length?(d=t,b):d},b.duration=function(t){return arguments.length?(l=+t,b):l},b.interpolate=function(t){return arguments.length?(p=t,b):p},b.on=function(){var t=e.on.apply(e,arguments);return t===e?b:t},b.clickDistance=function(t){return arguments.length?(y=(t=+t)*t,b):Math.sqrt(y)},b.tapDistance=function(t){return arguments.length?(v=+t,b):v},b}Ad.prototype=Cd.prototype;var Ld,Kl={exports:{}};function Od(t){if(!(this instanceof Od))return new Od(t);this._LRUCacheState=new Rd(t)}function Rd(t){this.capacity=0<t?+t:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,this.data=Object.create?Object.create(null):{},this.hash=Object.create?Object.create(null):{},this.linkedList=new jd}function jd(){this.length=0,this.head=null,this.end=null}function Id(t){this.key=t,this.p=null,this.n=null}
|
|
3838
3838
|
// 更新链表,把get或put方法操作的key提到链表head,即表示最新
|
|
3839
3839
|
function Hd(t,n){n!==t.head&&(t.end?t.end===n&&(t.end=n.n):t.end=n,Gd(n.n,n.p),Gd(n,t.head),t.head=n,t.head.n=null)}
|
|
3840
3840
|
// 对两个链表对象建立链接,形成一条链
|
|
3841
|
-
function Gd(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}
|
|
3841
|
+
function Gd(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}Ld||(Ld=1,Kl.exports=((ql=Od.prototype).get=function(t){var n=this._LRUCacheState,e=n.hash[t];if(e)return Hd(n.linkedList,e),n.data[t]},ql.set=function(t,n){var e=this._LRUCacheState,i=e.hash[t];return void 0!==n&&(i||(e.hash[t]=new Id(t),e.linkedList.length+=1,i=e.hash[t]),Hd(e.linkedList,i),e.data[t]=n,e.linkedList.length>e.capacity)&&this.remove(e.linkedList.end.key),this},ql.update=function(t,n){return this.has(t)&&this.set(t,n(this.get(t))),this},ql.remove=function(t){var n=this._LRUCacheState,e=n.hash[t];return e&&(e===n.linkedList.head&&(n.linkedList.head=e.p),e===n.linkedList.end&&(n.linkedList.end=e.n),Gd(e.n,e.p),delete n.hash[t],delete n.data[t],--n.linkedList.length),this},ql.removeAll=function(){return this._LRUCacheState=new Rd(this._LRUCacheState.capacity),this},ql.info=function(){var t=this._LRUCacheState;return{capacity:t.capacity,length:t.linkedList.length}},ql.keys=function(){for(var t=[],n=this._LRUCacheState.linkedList.head;n;)t.push(n.key),n=n.p;return t},ql.has=function(t){return!!this._LRUCacheState.hash[t]},ql.staleKey=function(){return this._LRUCacheState.linkedList.end&&this._LRUCacheState.linkedList.end.key},ql.popStale=function(){var t,n=this.staleKey();return n?(t=[n,this._LRUCacheState.data[n]],this.remove(n),t):null},Od));var Kd=_u(Kl.exports);
|
|
3842
3842
|
/**
|
|
3843
3843
|
@function _drawBack
|
|
3844
3844
|
@desc Draws a back button if there are states in this._history.
|
|
@@ -3859,7 +3859,7 @@ function Gd(t,n){t!==n&&(t&&(t.p=n),n)&&(n.n=t)}Fd||(Fd=1,Kl.exports=((ql=Od.pro
|
|
|
3859
3859
|
@desc Renders the legend if this._legend is not falsy.
|
|
3860
3860
|
@param {Array} data The filtered data array to be displayed.
|
|
3861
3861
|
@private
|
|
3862
|
-
*/function Wd(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)=>qd.map(t=>i(n,e,t)).join("_"),a=(Ke(this._colorScale?t.filter((t,n)=>void 0===this._colorScale(t,n)):t,t=>e.push(Vu(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 u=["top","bottom"].includes(l),h=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},c={transform:`translate(${u?this._margin.left+h.left:this._margin.left}, ${u?this._margin.top:this._margin.top+h.top})`},s=this._legend.bind(this)(s,e),c=Dt("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(u?"center":l).direction(u?"row":"column").duration(this._duration).data(s?e:[]).height(u?this._height-(this._margin.bottom+this._margin.top):this._height-(this._margin.bottom+this._margin.top+h.bottom+h.top)).locale(this._locale).parent(this).select(c).verticalAlign(u?l:"middle").width(u?this._width-(this._margin.left+this._margin.right+h.left+h.right):this._width-(this._margin.left+this._margin.right)).shapeConfig(
|
|
3862
|
+
*/function Wd(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)=>qd.map(t=>i(n,e,t)).join("_"),a=(Ke(this._colorScale?t.filter((t,n)=>void 0===this._colorScale(t,n)):t,t=>e.push(Vu(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 u=["top","bottom"].includes(l),h=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},c={transform:`translate(${u?this._margin.left+h.left:this._margin.left}, ${u?this._margin.top:this._margin.top+h.top})`},s=this._legend.bind(this)(s,e),c=Dt("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(u?"center":l).direction(u?"row":"column").duration(this._duration).data(s?e:[]).height(u?this._height-(this._margin.bottom+this._margin.top):this._height-(this._margin.bottom+this._margin.top+h.bottom+h.top)).locale(this._locale).parent(this).select(c).verticalAlign(u?l:"middle").width(u?this._width-(this._margin.left+this._margin.right+h.left+h.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]+=u?t.height+2*this._legendClass.padding():t.width+2*this._legendClass.padding())}
|
|
3863
3863
|
/**
|
|
3864
3864
|
@function _drawSubtitle
|
|
3865
3865
|
@desc Draws a subtitle if this._subtitle is defined.
|
|
@@ -4030,7 +4030,7 @@ let t=H(this._select.node().parentNode);"static"===t.style("position")&&t.style(
|
|
|
4030
4030
|
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),H(this._resizeContainer).on("resize."+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&&!xi(this._select.node()))H(this._scrollContainer).on("scroll."+this._uuid,()=>{this._scrollPoll||(this._scrollPoll=setTimeout(()=>{xi(this._select.node())&&(H(this._scrollContainer).on("scroll."+this._uuid,null),this.render(i)),this._scrollPoll=clearTimeout(this._scrollPoll)},this._detectVisibleInterval))});else{let e=xd();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(()=>{
|
|
4031
4031
|
// creates a data table as DOM elements inside of the SVG for accessibility
|
|
4032
4032
|
// only if this._ariaHidden is set to true
|
|
4033
|
-
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?
|
|
4033
|
+
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?Ft(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),
|
|
4034
4034
|
// finishes the draw cycle
|
|
4035
4035
|
this._preDraw(),this._draw(i),Zd.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(Ci,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)&&H(this._resizeContainer).on("resize."+this._uuid,()=>{this._resizePoll=clearTimeout(this._resizePoll),this._resizePoll=setTimeout(()=>{this._resizePoll=clearTimeout(this._resizePoll),a.bind(this)(),this.render(i)},this._detectResizeDelay)}),i&&setTimeout(i,this._duration+100)})}
|
|
4036
4036
|
// Attaches touchstart event listener to the BODY to hide the tooltip when the user touches any element without data
|
|
@@ -4619,7 +4619,7 @@ this._on[t].toString()!==n),r=this._on["click.shape"]&&this._on["click.shape"].t
|
|
|
4619
4619
|
this._select.style("cursor",e||r&&o?"pointer":"auto"),a.touches?[a.touches[0].clientX,a.touches[0].clientY]:[a.clientX,a.clientY]);
|
|
4620
4620
|
// does the shape still have our default "click.shape" event?
|
|
4621
4621
|
// (if the user only sets "click", both functions will fire)
|
|
4622
|
-
this._tooltipClass.data([i||t]).footer(!(!r||!o)&&this._translate("Click to Expand")).title(this._drawLabel).position(e).config(
|
|
4622
|
+
this._tooltipClass.data([i||t]).footer(!(!r||!o)&&this._translate("Click to Expand")).title(this._drawLabel).position(e).config(Lt.bind(this)(this._tooltipConfig)).render()}}.bind(this),"mousemove.legend":function(e,i,a,r){var r=r.touches?[r.touches[0].clientX,r.touches[0].clientY]:[r.clientX,r.clientY],o=ii(this._legendClass.data().map((t,n)=>{let e=this._id(t,n);return e=e instanceof Array?e:[e]})).length;if(e&&this._tooltip(e,i)){let t=this._id(e,i);t instanceof Array&&(t=t[0]);i=this._translate;let n=i0.bind(this).toString();
|
|
4623
4623
|
// does the legend have any user-defined click events?
|
|
4624
4624
|
var s=Object.keys(this._on).some(t=>// all valid click event keys,
|
|
4625
4625
|
["click","click.legend"].includes(t)&&// truthy values (no nulls),
|
|
@@ -4629,7 +4629,7 @@ this._on[t].toString()!==n),l=this._on["click.legend"]&&this._on["click.legend"]
|
|
|
4629
4629
|
this._select.style("cursor",s||l&&u?"pointer":"auto"),this._legendFilterInvert.bind(this)()),u=this._solo.includes(t),h=this._hidden.includes(t);
|
|
4630
4630
|
// does the legend still have our default "click.legend" event?
|
|
4631
4631
|
// (if the user only sets "click", both functions will fire)
|
|
4632
|
-
this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!u||h?i("Click to Highlight"):1===this._solo.length&&u||this._hidden.length===o-1?i("Click to Show All"):i("Click to Highlight")+"<br />"+i("Shift+Click to Hide"):this._solo.length&&!u||h?i("Click to Show")+"<br />"+i("Shift+Click to Highlight"):1===this._solo.length&&u||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():Ud.bind(this)).position(r).config(
|
|
4632
|
+
this._tooltipClass.data([a||e]).footer(!!l&&(s?this._solo.length&&!u||h?i("Click to Highlight"):1===this._solo.length&&u||this._hidden.length===o-1?i("Click to Show All"):i("Click to Highlight")+"<br />"+i("Shift+Click to Hide"):this._solo.length&&!u||h?i("Click to Show")+"<br />"+i("Shift+Click to Highlight"):1===this._solo.length&&u||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():Ud.bind(this)).position(r).config(Lt.bind(this)(this._tooltipConfig)).config(Lt.bind(this)(this._legendTooltip)).render()}}.bind(this)},this._queue=[],this._resizeContainer="undefined"==typeof window?"":window,this._scrollContainer="undefined"==typeof window?"":window,this._shape=Ot("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 Mn(t)?t:vu("string"==typeof t?t:JSON.stringify(t),this._colorDefaults)},labelConfig:{fontColor:(t,n)=>bu("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill)},opacity:Ot(1),stroke:(t,n)=>Mn("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill).darker(.25),role:"presentation",strokeWidth:Ot(0)},this._solo=[],this._subtitleClass=new Cc,this._subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},this._subtitlePadding=a0,this._svgDesc="",this._svgTitle="",this._timeline=!0,this._timelineClass=(new eg).align("end"),this._timelineConfig={brushing:!1,padding:5},this._timelinePadding=a0,this._threshold=Ot(1e-4),this._thresholdKey=void 0,this._thresholdName=()=>this._translate("Values"),this._titleClass=new Cc,this._titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},this._titlePadding=a0,this._tooltip=Ot(!0),this._tooltipClass=new fd,this._tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},this._totalClass=new Cc,this._totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},this._totalFormat=t=>this._translate("Total")+": "+kh(t,this._locale),this._totalPadding=a0,this._zoom=!1,this._zoomBehavior=Fd(),this._zoomBrush=tg(Kc),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 "+Me(Ee),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}}
|
|
4633
4633
|
/**
|
|
4634
4634
|
@module discreteBuffer
|
|
4635
4635
|
@desc Adds left/right padding to a point or time scale.
|
|
@@ -4733,19 +4733,19 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
4733
4733
|
Extends the draw behavior of the abstract Viz class.
|
|
4734
4734
|
@private
|
|
4735
4735
|
*/_draw(ot){if(this._filteredData.length||this._annotations.length){
|
|
4736
|
-
/* 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,
|
|
4736
|
+
/* 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,L=this._y2Time=st&&this._y2(this._filteredData[0],0)===st,O=this._yTime=st&&this._y(this._filteredData[0],0)===st,R=a||i||O||L,j=(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:j(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?Bt(this._x(t,n)):this._x(t,n),x2:i?Bt(this._x2(t,n)):this._x2(t,n),y:O?Bt(this._y(t,n)):this._y(t,n),y2:L?Bt(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=Re(s,t=>this._size(t.data)),this._sizeScaleD3=ss["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(st).range([st[0]===st[1]?this._sizeMax:Pt([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,I=this._discrete?"x"===this._discrete?"y2":"x2":void 0,H=[d,I].filter(t=>t),n=this._select,e=this._transition,v=this._width-this._margin.left-this._margin.right;
|
|
4737
4737
|
/**
|
|
4738
4738
|
* @desc Returns all unique values for a given axis.
|
|
4739
4739
|
* @param {String} axis
|
|
4740
4740
|
* @returns {Array}
|
|
4741
4741
|
* @private
|
|
4742
|
-
*/var ut=Et.bind(this)("x"),ht=Et.bind(this)("x2"),ct=Et.bind(this)("y"),gt=Et.bind(this)("y2");let G,f,p,_;if(this._stacked){var dt=s.filter(t=>["Area","Bar"].includes(t.shape));let a=Ki().key(t=>t.group).entries(dt).reduce((t,n)=>(t[n.key]||(t[n.key]=0),t[n.key]+=ai(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=Ki().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=j(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===ou&&_.sort((t,n)=>t.localeCompare(n)),p=uu().keys(_).offset(this._stackOffset).order(e instanceof Array?ou:e).value((t,n)=>{t=t.filter(t=>t.id===n);return t.length?t[0][d]:0})(p);dt="x"===this._discrete?ut:ct;f={[this._discrete]:this[`_${this._discrete}Time`]?Re(dt):dt,[d]:[Pt(p.map(t=>Pt(t.map(t=>t[0])))),Nt(p.map(t=>Nt(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?ut:Re(ut),x2:!i&&"x"===this._discrete||this._x2Sort?ht:Re(ht),y:!O&&"y"===this._discrete||this._ySort?ct:Re(ct),y2:!
|
|
4742
|
+
*/var ut=Et.bind(this)("x"),ht=Et.bind(this)("x2"),ct=Et.bind(this)("y"),gt=Et.bind(this)("y2");let G,f,p,_;if(this._stacked){var dt=s.filter(t=>["Area","Bar"].includes(t.shape));let a=Ki().key(t=>t.group).entries(dt).reduce((t,n)=>(t[n.key]||(t[n.key]=0),t[n.key]+=ai(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=Ki().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=j(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===ou&&_.sort((t,n)=>t.localeCompare(n)),p=uu().keys(_).offset(this._stackOffset).order(e instanceof Array?ou:e).value((t,n)=>{t=t.filter(t=>t.id===n);return t.length?t[0][d]:0})(p);dt="x"===this._discrete?ut:ct;f={[this._discrete]:this[`_${this._discrete}Time`]?Re(dt):dt,[d]:[Pt(p.map(t=>Pt(t.map(t=>t[0])))),Nt(p.map(t=>Nt(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?ut:Re(ut),x2:!i&&"x"===this._discrete||this._x2Sort?ht:Re(ht),y:!O&&"y"===this._discrete||this._ySort?ct:Re(ct),y2:!L&&"y"===this._discrete||this._y2Sort?gt:Re(gt)}}
|
|
4743
4743
|
/**
|
|
4744
4744
|
* Determins default scale type and domain for a given axis.
|
|
4745
4745
|
* @param {String} axis
|
|
4746
4746
|
* @private
|
|
4747
|
-
*/let[K,m,$,q]=zt.bind(this)("x"),[U,y,W,Y]=zt.bind(this)("y");dt=(n,t)=>{var e,i=this[`_${n}Config`].scale;return"auto"===i?this._discrete===n?t:3<Oe(e=s.map(t=>t[n]))/ei(e)?"log":"linear":i||t};let r=this._yConfigScale=dt("y",y).toLowerCase(),l=this._y2ConfigScale=dt("y2",Y).toLowerCase(),u=this._xConfigScale=dt("x",m).toLowerCase(),h=this._x2ConfigScale=dt("x2",q).toLowerCase(),b=(f={x:K,x2:$||K,y:U,y2:W||U},Object.keys(f).forEach(n=>{"log"===this[`_${n}ConfigScale`]&&f[n].includes(0)&&(Pt(f[n])<0?f[n][1]=Nt(o.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))):f[n][0]=Pt(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))}),ss["scale"+m]().domain(f.x).range(
|
|
4748
|
-
/** */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=u.find(t=>t<n),e.defaultY-l<h)&&(r.newY=l,i)&&t(r,i-1,a)}}.bind(this))}),et=E.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)-z):("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)-z),this._xAxis.barConfig()["stroke-width"]);D&&(D/=2),(new nc).data([{}]).select(mt.node()).x(B[0]+(B[1]-B[0])/2).width(B[1]-B[0]).y(this._margin.top+Ct+T[0]+(T[1]-T[0])/2).height(T[1]-T[0]).config(this._backgroundConfig).render();yt=E.filter(t=>void 0!==t.newY);if(yt.length){ot=Dt("g.d3plus-plot-connectors",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let t=yt.map(t=>Tt({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue),y:t.defaultY},t)).concat(yt.map(t=>Tt({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t)));(new ec).config({data:t,stroke:t=>t.fontColor,x:t=>t.x,y:t=>t.y}).config(this._labelConnectorConfig).select(ot).render()}let it=Dt("g.d3plus-plot-annotations",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();pt=Dt("g.d3plus-plot-shapes",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let at=Dt("g.d3plus-plot-annotations-front",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node(),N=(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 lc[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])-D,y1:"y"===this._discrete?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-D}).select(e).render()}),this._previousAnnotations[n].filter(t=>!i.includes(t)).forEach(t=>{(new lc[t]).data([]).select(e).render()}),this._previousAnnotations[n]=i}),this._discrete||"x"),P={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"===N?t=>t.x2?b(t.x2,"x2"):b(t.x):b("number"==typeof this._baseline?this._baseline:f.x[0]),x1:"x"===N?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"===N?t=>t.y2?x(t.y2,"y2"):x(t.y):x("number"==typeof this._baseline?this._baseline:f.y[1])-D,y1:"y"===N?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-D},rt=Object.keys(this._on),
|
|
4747
|
+
*/let[K,m,$,q]=zt.bind(this)("x"),[U,y,W,Y]=zt.bind(this)("y");dt=(n,t)=>{var e,i=this[`_${n}Config`].scale;return"auto"===i?this._discrete===n?t:3<Oe(e=s.map(t=>t[n]))/ei(e)?"log":"linear":i||t};let r=this._yConfigScale=dt("y",y).toLowerCase(),l=this._y2ConfigScale=dt("y2",Y).toLowerCase(),u=this._xConfigScale=dt("x",m).toLowerCase(),h=this._x2ConfigScale=dt("x2",q).toLowerCase(),b=(f={x:K,x2:$||K,y:U,y2:W||U},Object.keys(f).forEach(n=>{"log"===this[`_${n}ConfigScale`]&&f[n].includes(0)&&(Pt(f[n])<0?f[n][1]=Nt(o.map(t=>t[n]).filter(t=>![NaN,void 0,!1].includes(t))):f[n][0]=Pt(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))}),ss["scale"+m]().domain(f.x).range(Ft(0,1+v,v/(f.x.length-1)))),V=ss["scale"+q]().domain(f.x2).range(Ft(0,1+v,v/(f.x2.length-1))),x=ss["scale"+y]().domain(f.y.reverse()).range(Ft(0,1+t,t/(f.y.length-1))),Z=ss["scale"+Y]().domain(f.y2.reverse()).range(Ft(0,1+t,t/(f.y2.length-1)));dt=Ki().key(t=>t.shape).entries(o).sort((t,n)=>this._shapeSort(t.key,n.key));"Point"!==("x"===this._discrete?y:m)&&Ki().key(t=>t.shape).entries(s).forEach(t=>{var n;["Bar","Box"].includes(t.key)&&s0("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:u,config:this._shapeConfig[t.key]}),b=n[0],x=n[1],n=this._buffer[t.key].bind(this)({data:t.values,x:V,y:Z,yScale:l,xScale:h,x2:!0,y2:!0,config:this._shapeConfig[t.key]}),V=n[0],Z=n[1])});let w=b.domain(),X=V.domain(),S=x.domain(),c=Z.domain();var ft={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},ht=st?{data:ht}: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}),Dt("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:Ot(mt.label):this._drawLabel,g=s.map(t=>J(t.data,t.i)).filter(t=>"number"==typeof t||t).map(String),C=Yu(s.map(t=>t.x2)),k=(C="Point"===q&&C.every(t=>g.includes(""+t))?[]:null,Yu(s.map(t=>t.x))),Q=(k="Point"===m&&k.every(t=>g.includes(""+t))?[]:null,Yu(s.map(t=>t.y2))),A=(Q="Point"===Y&&Q.every(t=>g.includes(""+t))?[]:null,Yu(s.map(t=>t.y)));A="Point"===y&&A.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(A).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,ut={data:ut,locale:this._locale,rounding:this._xDomain?"none":"outside",scalePadding:b.padding?b.padding():0};!pt&&ft&&(ut.barConfig={stroke:"transparent"},ut.tickSize=0,ut.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=>k&&t.id===k[0]?"start":"end"},labelRotation:!1});let M=void 0;ft&&this._xTest.domain(w).height(t).maxSize(t/2).range([void 0,M]).select(_t.node()).ticks(k).width(v).config(ut).config(this._xConfig).scale(u).render();let tt,E=[],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=Ki().key(t=>t.id).entries(xt);if(xt.length){var wt=Lt.bind(this)(this._shapeConfig,"shape","Line"),St=(g0.config(wt),g0.labelConfig());let c=void 0!==St.fontColor?St.fontColor:d0.fontColor(),g=void 0!==St.fontSize?St.fontSize:d0.fontSize(),d=void 0!==St.fontWeight?St.fontWeight:d0.fontWeight(),f=void 0!==St.fontFamily?St.fontFamily:d0.fontFamily(),p=void 0!==St.padding?St.padding:d0.padding(),_=wt.label||this._drawLabel,m=t=>("log"===u&&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=(E=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 u=Nt(t.values.map(t=>m(t.x)));var h=t.values.find(t=>m(t.x)===u).y;return{id:t.key,labelWidth:i+2*l,spaceNeeded:i+4*l,value:h,yEstimate:y(h),padding:l,fontSize:r,fontColor:a,maxX:u,xValue:Nt(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}),Nt(E,t=>t.maxX));tt=Nt(E.map(t=>t.labelWidth));St=n===this._xTest._getRange.bind(this._xTest)()[1]?Nt(E.filter(t=>t.maxX===n),t=>t.spaceNeeded):0;St&&(wt=Pt([St,v/4]),M=v-wt-this._margin.right)}}ft&&M&&this._xTest.domain(w).height(t).maxSize(t/2).range([void 0,M]).select(_t.node()).ticks(k).width(v).config(ut).config(this._xConfig).scale(u).render(),st&&this._x2Test.domain(X).height(t).range([void 0,M]).select(_t.node()).ticks(C).width(v).config(ut).tickSize(0).config(ht).config(this._x2Config).scale(h).render();xt=this._xTest._getRange(),St=this._x2Test._getRange(),wt=this._x2Test.outerBounds();let z=st?wt.height+this._x2Test.padding():0;var wt=Nt([yt,xt[0],St[0]]),Ct=(ft&&this._xTest.range([wt,void 0]).render(),pt?this._yTest.shapeConfig().labelConfig.fontSize()/2:0),kt=Nt([bt,v-xt[1],v-St[1]]),At=this._xTest.outerBounds().height+(pt?this._xTest.padding():0),ot=(this._padding.left+=wt,this._padding.right+=kt,this._padding.bottom+=At,this._padding.top+=z+Ct,super._draw(ot),this._margin.left+this._margin.right),Mt=this._margin.top+this._margin.bottom;let T=[z,t-(At+Ct+Mt)],B=(pt&&this._yTest.domain(S).height(t).maxSize(v/2).range(T).select(_t.node()).ticks(A).width(v).config(ct).config(this._yConfig).scale(r).render(),wt=Nt([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(T).select(_t.node()).width(v-Nt([0,kt-bt])).title(!1).config(this._y2Config).config(gt).scale(l).render(),kt=Nt([0,bt=(vt=this._y2Test.outerBounds()).width?vt.width+this._y2Test.padding():void 0,v-xt[1],v-St[1]]),[wt,v-(kt+ot)]);mt=Dt("g.d3plus-plot-background",{parent:n,transition:e}),_t=`translate(${this._margin.left}, ${this._margin.top+z+Ct})`,vt=`translate(${this._margin.left}, ${this._margin.top+Ct})`,xt=Dt("g.d3plus-plot-x-axis",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t,opacity:ft?1:0}}),St=st&&Dt("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+Ct})`,ft=Dt("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+Ct})`,wt=lt&&Dt("g.d3plus-plot-y2-axis",{parent:n,transition:e,enter:{transform:vt},update:{transform:vt}});this._xAxis.domain(w).height(t-(z+Ct+Mt)).maxSize(t/2).range(B).select(xt.node()).ticks(k).width(v).config(ut).config(this._xConfig).scale(u).render(),st&&this._x2Axis.domain(X).height(t-(At+Ct+Mt)).range(B).select(St.node()).ticks(C).width(v).config(ut).config(ht).config(this._x2Config).scale(h).render(),this._xFunc=b=(t,n)=>("x2"===n?("log"===h&&0===t&&(t=X[0]<0?this._x2Axis._d3Scale.domain()[1]:this._x2Axis._d3Scale.domain()[0]),this._x2Axis._getPosition.bind(this._x2Axis)):("log"===u&&0===t&&(t=w[0]<0?this._xAxis._d3Scale.domain()[1]:this._xAxis._d3Scale.domain()[0]),this._xAxis._getPosition.bind(this._xAxis)))(t),T=[this._xAxis.outerBounds().y+z,t-(At+Ct+Mt)],this._yAxis.domain(S).height(t).maxSize(v/2).range(T).select(ft.node()).ticks(A).width(B[B.length-1]).config(ct).config(this._yConfig).scale(r).render(),lt&&this._y2Axis.config(ct).domain(lt?c:S).gridSize(0).height(t).range(T).select(wt.node()).width(v-Nt([0,kt-bt])).title(!1).config(this._y2Config).config(gt).scale(l).render();let et={},D=(E&&(Ki().key(t=>t.xValue).entries(E).forEach(({values:t})=>{var n=Nt(t.map(t=>t.fontSize));let u=Ft(T[0],T[1],n).reverse(),h=(T[1]-T[0])/8;t.forEach(
|
|
4748
|
+
/** */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=u.find(t=>t<n),e.defaultY-l<h)&&(r.newY=l,i)&&t(r,i-1,a)}}.bind(this))}),et=E.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)-z):("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)-z),this._xAxis.barConfig()["stroke-width"]);D&&(D/=2),(new nc).data([{}]).select(mt.node()).x(B[0]+(B[1]-B[0])/2).width(B[1]-B[0]).y(this._margin.top+Ct+T[0]+(T[1]-T[0])/2).height(T[1]-T[0]).config(this._backgroundConfig).render();yt=E.filter(t=>void 0!==t.newY);if(yt.length){ot=Dt("g.d3plus-plot-connectors",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let t=yt.map(t=>Tt({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue),y:t.defaultY},t)).concat(yt.map(t=>Tt({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t)));(new ec).config({data:t,stroke:t=>t.fontColor,x:t=>t.x,y:t=>t.y}).config(this._labelConnectorConfig).select(ot).render()}let it=Dt("g.d3plus-plot-annotations",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();pt=Dt("g.d3plus-plot-shapes",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node();let at=Dt("g.d3plus-plot-annotations-front",{parent:n,transition:e,enter:{transform:_t},update:{transform:_t}}).node(),N=(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 lc[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])-D,y1:"y"===this._discrete?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-D}).select(e).render()}),this._previousAnnotations[n].filter(t=>!i.includes(t)).forEach(t=>{(new lc[t]).data([]).select(e).render()}),this._previousAnnotations[n]=i}),this._discrete||"x"),P={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"===N?t=>t.x2?b(t.x2,"x2"):b(t.x):b("number"==typeof this._baseline?this._baseline:f.x[0]),x1:"x"===N?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"===N?t=>t.y2?x(t.y2,"y2"):x(t.y):x("number"==typeof this._baseline?this._baseline:f.y[1])-D,y1:"y"===N?null:t=>t.y2?x(t.y2,"y2"):x(t.y)-D},rt=Object.keys(this._on),F=(dt.forEach(r=>{var o=Object.assign({},P);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 lc[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,u="x"===this._discrete?B:T;t="Point"!==o&&2===l.length?((o=Array.from(new Set(r.values.map(t=>n(t[this._discrete]))))).unshift(u[0]-o[0]-u[0]),o.push(u[1]+u[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]):u[u.length-1]-u[0],this._groupPadding<t&&(t-=this._groupPadding);let i=t||1;o=Ki().key(t=>t[this._discrete]).key(t=>t.group).entries(r.values),l=ii(o.map(t=>t.values.map(t=>t.key)));let a=Array.from(new Set(l));if(1===Nt(o.map(t=>t.values.length)))s[this._discrete]((t,n)=>P[this._discrete](t,n));else{i=(i-this._barPadding*a.length-1)/a.length;u=t/2-i/2;let e=ka().domain([0,a.length-1]).range([-u,u]);s[this._discrete]((t,n)=>P[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({},P),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]);u=(new Jh).config(l).data(r.values),o=Object.assign(this._shapeConfig,this._confidenceConfig);u.config(Tt(Lt.bind(this)(o,"shape","Line"),Lt.bind(this)(o,"shape","Area"))).render(),this._shapes.push(u)}s.config({discrete:P.discrete||"x",label:!!nt&&((e,t)=>{if("function"!=typeof this._lineLabels||this._lineLabels(e.data,e.i)){var i=E.find(t=>t.id===e.id);if(i){let n=i.newY||i.defaultY;i=E.filter(t=>t.newY===n);return 1<i.length?i[0].id===e.id&&`+${kh(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 h=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<h.length;a++)s.on(h[a],(t,n,e,i)=>this._on[h[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 tc).data(this._lineMarkers?r.values:[]).config(P).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<h.length;a++)t.on(h[a],(t,n,e,i)=>this._on[h[a]](t.data,t.i,e,i));t.render(),this._shapes.push(t)}}),dt.map(t=>t.key));function Et(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?Ki().key(t=>t[e]).rollup(t=>1===t.length?t[0].data:Vu(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?Bt(t.key):a?parseFloat(t.key,10):t.key):Yu(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 zt(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]}F.includes("Line")&&(this._confidence&&F.push("Area"),this._lineMarkers)&&F.push("Circle"),this._previousShapes.filter(t=>!F.includes(t)).forEach(t=>{(new lc[t]).config(P).data([]).render()}),this._previousShapes=F}return this}
|
|
4749
4749
|
/**
|
|
4750
4750
|
@memberof Plot
|
|
4751
4751
|
@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).
|
|
@@ -5008,7 +5008,7 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5008
5008
|
@memberof Plot
|
|
5009
5009
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
5010
5010
|
@private
|
|
5011
|
-
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Tt({},f0,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,n)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke,fillOpacity:Ot(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Ot("auto"),this._lineMarkerConfig={fill:(t,n)=>vu(this._id(t,n)),r:Ot(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Ot("Circle"),this._shapeConfig=Tt(this._shapeConfig,{Area:{label:(t,n)=>!!this._stacked&&this._drawLabel(t,n),labelBounds:(t,n,e)=>{let i=xh(e.points,{angle:
|
|
5011
|
+
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Tt({},f0,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,n)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke,fillOpacity:Ot(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Ot("auto"),this._lineMarkerConfig={fill:(t,n)=>vu(this._id(t,n)),r:Ot(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Ot("Circle"),this._shapeConfig=Tt(this._shapeConfig,{Area:{label:(t,n)=>!!this._stacked&&this._drawLabel(t,n),labelBounds:(t,n,e)=>{let i=xh(e.points,{angle:Ft(-20,20,5)});if(!(i=!i||i.height<20||i.width<50?xh(e.points,{angle:Ft(-80,80,5)}):i))return null;let a=Pt(e.points,t=>t[0]);e=Nt(e.points.filter(t=>t[0]===a),t=>t[1]);return{angle:i.angle,width:i.width,height:i.height,x:i.cx-i.width/2-a,y:i.cy-i.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,n)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,n),void 0!==this._x(t,n)&&(e+=", x: "+this._x(t,n)),void 0!==this._y(t,n)&&(e+=", y: "+this._y(t,n)),void 0!==this._x2(t,n)&&(e+=", x2: "+this._x2(t,n)),void 0!==this._y2(t,n)&&(e+=", y2: "+this._y2(t,n))),e+"."},Bar:{labelBounds(t,n,e){var i="y"===this._discrete?"width":"height",a="y"===this._discrete?"height":"width",r="x"===this._discrete.charAt(0)?"y":"x",o="y"==r,r=this._discrete.replace(this._discrete.charAt(0),r),s=this[`_${r}Axis`]._d3Scale.range(),s=Math.abs(s[1]-s[0]),r=this["_"+r](t,n)<0;return b0.bind(this)(t,n)?{[i]:s-e[i],[a]:e[a],x:o?-e.width/2:r?-s:e.width+1,y:o?r?e.height+1:-s:-e.height/2+1}:{[i]:e[i],[a]:e[a],x:o?-e.width/2:r?(this._stacked,1-e.width):-1,y:o?r?(this._stacked,1):1-e.height:-e.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(t,n){return b0.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?mu.dark:bu(this._backgroundConfig.fill):bu("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill)},fontStroke(t,n){return b0.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?mu.dark:bu(this._backgroundConfig.fill):"transparent"},fontStrokeWidth(t,n){return b0.bind(this)(t,n)?.1:0},padding:3,textAnchor(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0,i=i?"middle":b0.bind(this)(t,n)?e?"end":"start":e?"start":"end";return Si()?"start"==i?"end":"end"==i?"start":i:i},verticalAlign(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0;return i?b0.bind(this)(t,n)?e?"top":"bottom":e?"bottom":"top":"middle"}}},Circle:{r:p0.bind(this)},Line:{curve:()=>this._discrete?"monotone"+this._discrete.charAt(0).toUpperCase():"linear",fill:Ot("none"),labelConfig:{fontColor:(t,n)=>xu("function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke),fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:Ot(2)},Rect:{height:t=>2*p0.bind(this)(t),width:t=>2*p0.bind(this)(t)}}),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this._shapeSort=(t,n)=>this._shapeOrder.indexOf(t)-this._shapeOrder.indexOf(n),this._sizeMax=20,this._sizeMin=5,this._sizeScale="sqrt",this._stackOffset=v0,this._stackOrder=m0,this._timelineConfig=Tt(this._timelineConfig,{brushing:!0,brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=p("x"),this._xAxis=(new _c).align("end"),this._xKey="x",this._xTest=(new _c).align("end").gridSize(0),this._xConfig={gridConfig:{stroke:t=>this._discrete&&"x"===this._discrete.charAt(0)||this._xAxis.range()[0]===this._xAxis._getPosition.bind(this._xAxis)(t.id)?"transparent":c0.colors.gray[200]}},this._xCutoff=150,this._x2=p("x2"),this._x2Axis=(new vc).align("start"),this._x2Test=(new vc).align("start").gridSize(0),this._x2Config={padding:0},this._y=p("y"),this._yAxis=(new mc).align("start"),this._yKey="y",this._yTest=(new mc).align("start").gridSize(0),this._yConfig={gridConfig:{stroke:t=>{var n;return this._discrete&&"y"===this._discrete.charAt(0)||(n=this._yAxis.range())[n.length-1]===this._yAxis._getPosition.bind(this._yAxis)(t.id)?"transparent":c0.colors.gray[200]}}},this._yCutoff=150,this._y2=p("y2"),this._y2Axis=(new yc).align("end"),this._y2Test=(new mc).align("end").gridSize(0),this._y2Config={}}}class w0 extends x0{
|
|
5012
5012
|
/**
|
|
5013
5013
|
@memberof AreaPlot
|
|
5014
5014
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
@@ -5032,7 +5032,7 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5032
5032
|
/**
|
|
5033
5033
|
Extends the draw behavior of the abstract Viz class.
|
|
5034
5034
|
@private
|
|
5035
|
-
*/_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=Pt([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}),Ns().innerRadius(this._innerRadius).outerRadius(e)),n=`translate(${n/2+this._margin.left}, ${t/2+this._margin.top})`;return this._shapes.push((new sc).data(i).d(e).select(Dt("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(
|
|
5035
|
+
*/_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=Pt([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}),Ns().innerRadius(this._innerRadius).outerRadius(e)),n=`translate(${n/2+this._margin.left}, ${t/2+this._margin.top})`;return this._shapes.push((new sc).data(i).d(e).select(Dt("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}
|
|
5036
5036
|
/**
|
|
5037
5037
|
@memberof Pie
|
|
5038
5038
|
@desc The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).
|
|
@@ -5073,7 +5073,7 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5073
5073
|
@memberof Donut
|
|
5074
5074
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
5075
5075
|
@private
|
|
5076
|
-
*/constructor(){super(),this._innerRadius=()=>Pt([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var T=1e-6,E0=1e-12,M=Math.PI,z0=M/2,T0=M/4,B0=2*M,D0=180/M,B=M/180,D=Math.abs,N0=Math.atan,P0=Math.atan2,E=Math.cos,
|
|
5076
|
+
*/constructor(){super(),this._innerRadius=()=>Pt([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var T=1e-6,E0=1e-12,M=Math.PI,z0=M/2,T0=M/4,B0=2*M,D0=180/M,B=M/180,D=Math.abs,N0=Math.atan,P0=Math.atan2,E=Math.cos,F0=Math.ceil,L0=Math.exp,O0=Math.hypot,R0=Math.log,j0=Math.pow,z=Math.sin,I0=Math.sign||function(t){return 0<t?1:t<0?-1:0},H0=Math.sqrt,G0=Math.tan;function K0(t){return 1<t?0:t<-1?M:Math.acos(t)}function $0(t){return 1<t?z0:t<-1?-z0:Math.asin(t)}function q0(t){return(t=z(t/2))*t}function U0(){}function W0(t,n){t&&V0.hasOwnProperty(t.type)&&V0[t.type](t,n)}var Y0={Feature:function(t,n){W0(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)W0(e[i].geometry,n)}},V0={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){Z0(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)Z0(e[i],n,0)},Polygon:function(t,n){X0(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)X0(e[i],n)},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)W0(e[i],n)}};function Z0(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 X0(t,n){var e=-1,i=t.length;for(n.polygonStart();++e<i;)Z0(t[e],n,1);n.polygonEnd()}function J0(t,n){t&&Y0.hasOwnProperty(t.type)?Y0[t.type](t,n):W0(t,n)}var Q0,tf,nf,ef,af,rf,of,sf,lf,uf,hf,cf,gf,df,ff,pf,_f=new je,mf=new je,yf={point:U0,lineStart:U0,lineEnd:U0,polygonStart:function(){_f=new je,yf.lineStart=vf,yf.lineEnd=bf},polygonEnd:function(){var t=+_f;mf.add(t<0?B0+t:t),this.lineStart=this.lineEnd=this.point=U0},sphere:function(){mf.add(B0)}};
|
|
5077
5077
|
// hello?
|
|
5078
5078
|
function vf(){yf.point=xf}function bf(){wf(Q0,tf)}function xf(t,n){yf.point=wf,Q0=t,tf=n,nf=t*=B,ef=E(n=(n*=B)/2+T0),af=z(n)}function wf(t,n){// half the angular distance from south pole
|
|
5079
5079
|
// Spherical excess E for a spherical triangle with vertices: south pole,
|
|
@@ -5085,7 +5085,7 @@ nf=t,ef=a,af=n}function Sf(t){return[P0(t[1],t[0]),$0(t[2])]}function Cf(t){var
|
|
|
5085
5085
|
// TODO return a
|
|
5086
5086
|
function Mf(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Ef(t,n){return[t[0]*n,t[1]*n,t[2]*n]}
|
|
5087
5087
|
// TODO return d
|
|
5088
|
-
function zf(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 Tf,Bf,Df,Nf,Pf,Lf,
|
|
5088
|
+
function zf(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 Tf,Bf,Df,Nf,Pf,Ff,Lf,Of,Rf,jf,If,Hf,Gf,Kf,$f,qf,Uf={point:Wf,lineStart:Vf,lineEnd:Zf,polygonStart:function(){Uf.point=Xf,Uf.lineStart=Jf,Uf.lineEnd=Qf,df=new je,yf.polygonStart()},polygonEnd:function(){yf.polygonEnd(),Uf.point=Wf,Uf.lineStart=Vf,Uf.lineEnd=Zf,_f<0?(rf=-(sf=180),of=-(lf=90)):T<df?lf=90:df<-1e-6&&(of=-90),pf[0]=rf,pf[1]=sf},sphere:function(){rf=-(sf=180),of=-(lf=90)}};function Wf(t,n){ff.push(pf=[rf=t,sf=t]),n<of&&(of=n),lf<n&&(lf=n)}function Yf(t,n){var e,i,a,r,o,s=Cf([t*B,n*B]);gf?(e=Af(gf,s),zf(e=Af([e[1],-e[0],0],e)),e=Sf(e),o=t-uf,a=e[0]*D0*(i=0<o?1:-1),(o=180<D(o))^(i*uf<a&&a<i*t)?(r=e[1]*D0,lf<r&&(lf=r)):o^(i*uf<(a=(360+a)%360-180)&&a<i*t)?(r=-e[1]*D0)<of&&(of=r):(n<of&&(of=n),lf<n&&(lf=n)),o?t<uf?t1(rf,t)>t1(rf,sf)&&(sf=t):t1(t,sf)>t1(rf,sf)&&(rf=t):rf<=sf?(t<rf&&(rf=t),sf<t&&(sf=t)):uf<t?t1(rf,t)>t1(rf,sf)&&(sf=t):t1(t,sf)>t1(rf,sf)&&(rf=t)):ff.push(pf=[rf=t,sf=t]),n<of&&(of=n),lf<n&&(lf=n),gf=s,uf=t}function Vf(){Uf.point=Yf}function Zf(){pf[0]=rf,pf[1]=sf,Uf.point=Wf,gf=null}function Xf(t,n){var e;gf?(e=t-uf,df.add(180<D(e)?e+(0<e?360:-360):e)):(hf=t,cf=n),yf.point(t,n),Yf(t,n)}function Jf(){yf.lineStart()}function Qf(){Xf(hf,cf),yf.lineEnd(),D(df)>T&&(rf=-(sf=180)),pf[0]=rf,pf[1]=sf,gf=null}
|
|
5089
5089
|
// Finds the left-right distance between two longitudes.
|
|
5090
5090
|
// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want
|
|
5091
5091
|
// the distance between ±180° to be 360°.
|
|
@@ -5099,13 +5099,13 @@ for(ff.sort(n1),n=1,r=[i=ff[0]];n<e;++n)e1(i,(a=ff[n])[0])||e1(i,a[1])?(t1(i[0],
|
|
|
5099
5099
|
for(o=-1/0,n=0,i=r[e=r.length-1];n<=e;i=a,++n)(s=t1(i[1],(a=r[n])[0]))>o&&(o=s,rf=a[0],sf=i[1])}return ff=pf=null,rf===1/0||of===1/0?[[NaN,NaN],[NaN,NaN]]:[[rf,of],[sf,lf]]}// previous point
|
|
5100
5100
|
var a1={sphere:U0,point:r1,lineStart:s1,lineEnd:h1,polygonStart:function(){a1.lineStart=c1,a1.lineEnd=g1},polygonEnd:function(){a1.lineStart=s1,a1.lineEnd=h1}};
|
|
5101
5101
|
// Arithmetic mean of Cartesian vectors.
|
|
5102
|
-
function r1(t,n){t*=B;var e=E(n*=B);o1(e*E(t),e*z(t),z(n))}function o1(t,n,e){Df+=(t-Df)/++Tf,Nf+=(n-Nf)/Tf,Pf+=(e-Pf)/Tf}function s1(){a1.point=l1}function l1(t,n){t*=B;var e=E(n*=B);Kf=e*E(t),$f=e*z(t),qf=z(n),a1.point=u1,o1(Kf,$f,qf)}function u1(t,n){t*=B;var e=E(n*=B),i=e*E(t),e=e*z(t),t=z(n),n=P0(H0((n=$f*t-qf*e)*n+(n=qf*i-Kf*t)*n+(n=Kf*e-$f*i)*n),Kf*i+$f*e+qf*t);Bf+=n,
|
|
5102
|
+
function r1(t,n){t*=B;var e=E(n*=B);o1(e*E(t),e*z(t),z(n))}function o1(t,n,e){Df+=(t-Df)/++Tf,Nf+=(n-Nf)/Tf,Pf+=(e-Pf)/Tf}function s1(){a1.point=l1}function l1(t,n){t*=B;var e=E(n*=B);Kf=e*E(t),$f=e*z(t),qf=z(n),a1.point=u1,o1(Kf,$f,qf)}function u1(t,n){t*=B;var e=E(n*=B),i=e*E(t),e=e*z(t),t=z(n),n=P0(H0((n=$f*t-qf*e)*n+(n=qf*i-Kf*t)*n+(n=Kf*e-$f*i)*n),Kf*i+$f*e+qf*t);Bf+=n,Ff+=n*(Kf+(Kf=i)),Lf+=n*($f+($f=e)),Of+=n*(qf+(qf=t)),o1(Kf,$f,qf)}function h1(){a1.point=r1}
|
|
5103
5103
|
// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
|
|
5104
5104
|
// J. Applied Mechanics 42, 239 (1975).
|
|
5105
5105
|
function c1(){a1.point=d1}function g1(){f1(Hf,Gf),a1.point=r1}function d1(t,n){Hf=t,Gf=n,t*=B,n*=B,a1.point=f1;var e=E(n);Kf=e*E(t),$f=e*z(t),qf=z(n),o1(Kf,$f,qf)}function f1(t,n){t*=B;var e=E(n*=B),i=e*E(t),e=e*z(t),t=z(n),n=$f*t-qf*e,a=qf*i-Kf*t,r=Kf*e-$f*i,o=O0(n,a,r),s=$0(o),o=o&&-s/o;// area weight multiplier
|
|
5106
|
-
Rf.add(o*n),jf.add(o*a),If.add(o*r),Bf+=s,
|
|
5106
|
+
Rf.add(o*n),jf.add(o*a),If.add(o*r),Bf+=s,Ff+=s*(Kf+(Kf=i)),Lf+=s*($f+($f=e)),Of+=s*(qf+(qf=t)),o1(Kf,$f,qf)}function p1(t){Tf=Bf=Df=Nf=Pf=Ff=Lf=Of=0,Rf=new je,jf=new je,If=new je,J0(t,a1);var t=+Rf,n=+jf,e=+If,i=O0(t,n,e);
|
|
5107
5107
|
// If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.
|
|
5108
|
-
return i<E0&&(t=
|
|
5108
|
+
return i<E0&&(t=Ff,n=Lf,e=Of,
|
|
5109
5109
|
// If the feature has zero length, fall back to arithmetic mean of point vectors.
|
|
5110
5110
|
Bf<T&&(t=Df,n=Nf,e=Pf),(i=O0(t,n,e))<E0)?[NaN,NaN]:[P0(n,t)*D0,$0(e/i)*D0]}function _1(t){return function(){return t}}function m1(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 y1(t,n){return D(t)>M&&(t-=Math.round(t/B0)*B0),[t,n]}function v1(t,n,e){return(t%=B0)?n||e?m1(x1(t),w1(n,e)):x1(t):n||e?w1(n,e):y1}function b1(e){return function(t,n){return D(t+=e)>M&&(t-=Math.round(t/B0)*B0),[t,n]}}function x1(t){var n=b1(t);return n.invert=b1(-t),n}function w1(t,n){var a=E(t),r=z(t),o=E(n),s=z(n);function e(t,n){var e=E(n),i=E(t)*e,t=z(t)*e,e=z(n),n=e*a+i*r;return[P0(t*o-n*s,i*a-e*r),$0(n*o+t*s)]}return e.invert=function(t,n){var e=E(n),i=E(t)*e,t=z(t)*e,e=z(n),n=e*o-t*s;return[P0(t*o+e*s,i*a+n*r),$0(n*a-i*r)]},e}function S1(n){function t(t){return(t=n(t[0]*B,t[1]*B))[0]*=D0,t[1]*=D0,t}return n=v1(n[0]*B,n[1]*B,2<n.length?n[2]*B:0),t.invert=function(t){return(t=n.invert(t[0]*B,t[1]*B))[0]*=D0,t[1]*=D0,t},t}
|
|
5111
5111
|
// Generates a circle centered at [0°, 0°], with a given radius and precision.
|
|
@@ -5136,15 +5136,15 @@ k^e<=d^e<=v&&(zf(A=Af(Cf(g),Cf(y))),zf(C=Af(a,A)),(S=(k^0<=w?-1:1)*$0(C[2]))<i||
|
|
|
5136
5136
|
// Second, count the (signed) number of times a segment crosses a lambda
|
|
5137
5137
|
// from the point to the South pole. If it is zero, then the point is the
|
|
5138
5138
|
// same side as the South pole.
|
|
5139
|
-
return(r<-1e-6||r<T&&s<-1e-12)^1&o}function P1(_,m,y,v){return function(s){var l,u,h,e=m(s),c=M1(),g=m(c),d=!1,n={point:i,lineStart:a,lineEnd:r,polygonStart:function(){n.point=f,n.lineStart=o,n.lineEnd=p,u=[],l=[]},polygonEnd:function(){n.point=i,n.lineStart=a,n.lineEnd=r,u=ii(u);var t=N1(l,v);u.length?(d||(s.polygonStart(),d=!0),T1(u,
|
|
5139
|
+
return(r<-1e-6||r<T&&s<-1e-12)^1&o}function P1(_,m,y,v){return function(s){var l,u,h,e=m(s),c=M1(),g=m(c),d=!1,n={point:i,lineStart:a,lineEnd:r,polygonStart:function(){n.point=f,n.lineStart=o,n.lineEnd=p,u=[],l=[]},polygonEnd:function(){n.point=i,n.lineStart=a,n.lineEnd=r,u=ii(u);var t=N1(l,v);u.length?(d||(s.polygonStart(),d=!0),T1(u,L1,t,y,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),y(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),u=l=null},sphere:function(){s.polygonStart(),s.lineStart(),y(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function i(t,n){_(t,n)&&s.point(t,n)}function t(t,n){e.point(t,n)}function a(){n.point=t,e.lineStart()}function r(){n.point=i,e.lineEnd()}function f(t,n){h.push([t,n]),g.point(t,n)}function o(){g.lineStart(),h=[]}function p(){f(h[0][0],h[0][1]),g.lineEnd();var t,n,e,i,a=g.clean(),r=c.result(),o=r.length;if(h.pop(),l.push(h),h=null,o)
|
|
5140
5140
|
// No intersections.
|
|
5141
5141
|
if(1&a){if(0<(n=(e=r[0]).length-1)){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t<n;++t)s.point((i=e[t])[0],i[1]);s.lineEnd()}}else
|
|
5142
5142
|
// Rejoin connected segments.
|
|
5143
5143
|
// TODO reuse ringBuffer.rejoin()?
|
|
5144
|
-
1<o&&2&a&&r.push(r.pop().concat(r.shift())),u.push(r.filter(
|
|
5144
|
+
1<o&&2&a&&r.push(r.pop().concat(r.shift())),u.push(r.filter(F1))}return n}}function F1(t){return 1<t.length}
|
|
5145
5145
|
// Intersections are sorted along the clip edge. For both antimeridian cutting
|
|
5146
5146
|
// and circle clipping, the same comparison is used.
|
|
5147
|
-
function
|
|
5147
|
+
function L1(t,n){return((t=t.x)[0]<0?t[1]-z0-T:z0-t[1])-((n=n.x)[0]<0?n[1]-z0-T:z0-n[1])}y1.invert=y1;var O1=P1(function(){return 1},
|
|
5148
5148
|
// Takes a line and cuts into visible segments. Return values: 0 - there were
|
|
5149
5149
|
// intersections or the line was empty; 1 - no intersections; 2 - there were
|
|
5150
5150
|
// intersections, and the first and last segments should be rejoined.
|
|
@@ -5190,9 +5190,9 @@ function q1(m,y,v,b){function x(t,n){return m<=t&&t<=v&&y<=n&&n<=b}function w(t,
|
|
|
5190
5190
|
// clipping issues.
|
|
5191
5191
|
,lineEnd:function(){a&&(_(o,s),l&&g&&t.rejoin(),a.push(t.result()));n.point=e,g&&p.lineEnd()},polygonStart:
|
|
5192
5192
|
// Buffer geometry within a polygon and then clip it en masse.
|
|
5193
|
-
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],u=l[0],h=l[1];o<s;++o)i=u,a=h,l=r[o],u=l[0],h=l[1],a<=b?b<h&&(h-a)*(m-i)<(u-i)*(b-a)&&++t:h<=b&&(u-i)*(b-a)<(h-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=ii(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&T1(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,u=1,h=n[0]-o,c=n[1]-s,e=e-o;if(h||!(0<e)){if(e/=h,h<0){if(e<l)return;e<u&&(u=e)}else if(0<h){if(u<e)return;l<e&&(l=e)}if(e=a-o,h||!(e<0)){if(e/=h,h<0){if(u<e)return;l<e&&(l=e)}else if(0<h){if(e<l)return;e<u&&(u=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<u&&(u=e)}else if(0<c){if(u<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(u<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<u&&(u=e)}return 0<l&&(t[0]=o+l*h,t[1]=s+l*c),u<1&&(n[0]=o+u*h,n[1]=s+u*c),1}}}}})(e=[u=Math.max($1,Math.min(K1,u)),h=Math.max($1,Math.min(K1,h))],i=[t=Math.max($1,Math.min(K1,t)),n=Math.max($1,Math.min(K1,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),u=t,h=n,g=a}return n}}var U1={sphere:U0,point:U0,lineStart:function(){U1.point=Y1,U1.lineEnd=W1},lineEnd:U0,polygonStart:U0,polygonEnd:U0};function W1(){U1.point=U1.lineEnd=U0}function Y1(t,n){I1=t*=B,H1=z(n*=B),G1=E(n),U1.point=V1}function V1(t,n){t*=B;var e=z(n*=B),n=E(n),i=D(t-I1),a=E(i),i=n*z(i),r=G1*e-H1*n*a,a=H1*e+G1*n*a;j1.add(P0(H0(i*i+r*r),a)),I1=t,H1=e,G1=n}function Z1(t){return j1=new je,J0(t,U1),+j1}var X1=[null,null],J1={type:"LineString",coordinates:X1};function Q1(t,n){return X1[0]=t,X1[1]=n,Z1(J1)}var tp={Feature:function(t,n){return ep(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)if(ep(e[i].geometry,n))return!0;return!1}},np={Sphere:function(){return!0},Point:function(t,n){return ip(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(ip(e[i],n))return!0;return!1},LineString:function(t,n){return ap(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(ap(e[i],n))return!0;return!1},Polygon:function(t,n){return rp(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(rp(e[i],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)if(ep(e[i],n))return!0;return!1}};function ep(t,n){return!(!t||!np.hasOwnProperty(t.type))&&np[t.type](t,n)}function ip(t,n){return 0===Q1(t,n)}function ap(t,n){for(var e,i,a,r=0,o=t.length;r<o;r++){if(0===(i=Q1(t[r],n)))return!0;if(0<r&&0<(a=Q1(t[r],t[r-1]))&&e<=a&&i<=a&&(e+i-a)*(1-Math.pow((e-i)/a,2))<E0*a)return!0;e=i}return!1}function rp(t,n){return!!N1(t.map(op),sp(n))}function op(t){return(t=t.map(sp)).pop(),t}function sp(t){return[t[0]*B,t[1]*B]}function lp(t,n,e){var i=
|
|
5193
|
+
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],u=l[0],h=l[1];o<s;++o)i=u,a=h,l=r[o],u=l[0],h=l[1],a<=b?b<h&&(h-a)*(m-i)<(u-i)*(b-a)&&++t:h<=b&&(u-i)*(b-a)<(h-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=ii(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&T1(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,u=1,h=n[0]-o,c=n[1]-s,e=e-o;if(h||!(0<e)){if(e/=h,h<0){if(e<l)return;e<u&&(u=e)}else if(0<h){if(u<e)return;l<e&&(l=e)}if(e=a-o,h||!(e<0)){if(e/=h,h<0){if(u<e)return;l<e&&(l=e)}else if(0<h){if(e<l)return;e<u&&(u=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<u&&(u=e)}else if(0<c){if(u<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(u<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<u&&(u=e)}return 0<l&&(t[0]=o+l*h,t[1]=s+l*c),u<1&&(n[0]=o+u*h,n[1]=s+u*c),1}}}}})(e=[u=Math.max($1,Math.min(K1,u)),h=Math.max($1,Math.min(K1,h))],i=[t=Math.max($1,Math.min(K1,t)),n=Math.max($1,Math.min(K1,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),u=t,h=n,g=a}return n}}var U1={sphere:U0,point:U0,lineStart:function(){U1.point=Y1,U1.lineEnd=W1},lineEnd:U0,polygonStart:U0,polygonEnd:U0};function W1(){U1.point=U1.lineEnd=U0}function Y1(t,n){I1=t*=B,H1=z(n*=B),G1=E(n),U1.point=V1}function V1(t,n){t*=B;var e=z(n*=B),n=E(n),i=D(t-I1),a=E(i),i=n*z(i),r=G1*e-H1*n*a,a=H1*e+G1*n*a;j1.add(P0(H0(i*i+r*r),a)),I1=t,H1=e,G1=n}function Z1(t){return j1=new je,J0(t,U1),+j1}var X1=[null,null],J1={type:"LineString",coordinates:X1};function Q1(t,n){return X1[0]=t,X1[1]=n,Z1(J1)}var tp={Feature:function(t,n){return ep(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)if(ep(e[i].geometry,n))return!0;return!1}},np={Sphere:function(){return!0},Point:function(t,n){return ip(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(ip(e[i],n))return!0;return!1},LineString:function(t,n){return ap(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(ap(e[i],n))return!0;return!1},Polygon:function(t,n){return rp(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)if(rp(e[i],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)if(ep(e[i],n))return!0;return!1}};function ep(t,n){return!(!t||!np.hasOwnProperty(t.type))&&np[t.type](t,n)}function ip(t,n){return 0===Q1(t,n)}function ap(t,n){for(var e,i,a,r=0,o=t.length;r<o;r++){if(0===(i=Q1(t[r],n)))return!0;if(0<r&&0<(a=Q1(t[r],t[r-1]))&&e<=a&&i<=a&&(e+i-a)*(1-Math.pow((e-i)/a,2))<E0*a)return!0;e=i}return!1}function rp(t,n){return!!N1(t.map(op),sp(n))}function op(t){return(t=t.map(sp)).pop(),t}function sp(t){return[t[0]*B,t[1]*B]}function lp(t,n,e){var i=Ft(t,n-T,e).concat(n);return function(n){return i.map(function(t){return[n,t]})}}function up(t,n,e){var i=Ft(t,n-T,e).concat(n);return function(n){return i.map(function(t){return[t,n]})}}function hp(){var n,e,i,a,r,o,s,l,u,h,c,g,d=10,f=d,p=90,_=360,m=2.5;function y(){return{type:"MultiLineString",coordinates:t()}}function t(){return Ft(F0(a/p)*p,i,p).map(c).concat(Ft(F0(l/_)*_,s,_).map(g)).concat(Ft(F0(e/d)*d,n,d).filter(function(t){return D(t%p)>T}).map(u)).concat(Ft(F0(o/f)*f,r,f).filter(function(t){return D(t%_)>T}).map(h))}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,u=lp(o,r,90),h=up(e,n,m),c=lp(l,s,90),g=up(a,i,m),y):m},y.extentMajor([[-180,-90+T],[180,90-T]]).extentMinor([[-180,-80-T],[180,80+T]])}function cp(t,n){var e=t[0]*B,i=t[1]*B,t=n[0]*B,n=n[1]*B,a=E(i),r=z(i),o=E(n),s=z(n),l=a*E(e),u=a*z(e),h=o*E(t),c=o*z(t),g=2*$0(H0(q0(n-i)+a*o*q0(t-e))),d=z(g),n=g?function(t){var n=z(t*=g)/d,t=z(g-t)/d,e=t*l+n*h,i=t*u+n*c,t=t*r+n*s;return[P0(i,e)*D0,P0(t,H0(e*e+i*i))*D0]}:function(){return[e*D0,i*D0]};return n.distance=g,n}var gp,dp,fp,pp,_p=t=>t,mp=new je,yp=new je,vp={point:U0,lineStart:U0,lineEnd:U0,polygonStart:function(){vp.lineStart=bp,vp.lineEnd=Sp},polygonEnd:function(){vp.lineStart=vp.lineEnd=vp.point=U0,mp.add(D(yp)),yp=new je},result:function(){var t=mp/2;return mp=new je,t}};function bp(){vp.point=xp}function xp(t,n){vp.point=wp,gp=fp=t,dp=pp=n}function wp(t,n){yp.add(pp*t-fp*n),fp=t,pp=n}function Sp(){wp(gp,dp)}var Cp=1/0,kp=Cp,Ap=-Cp,Mp=Ap,Ep={point:function(t,n){t<Cp&&(Cp=t);Ap<t&&(Ap=t);n<kp&&(kp=n);Mp<n&&(Mp=n)}
|
|
5194
5194
|
// TODO Enforce positive area for exterior, negative area for interior?
|
|
5195
|
-
,lineStart:U0,lineEnd:U0,polygonStart:U0,polygonEnd:U0,result:function(){var t=[[Cp,kp],[Ap,Mp]];return Ap=Mp=-(kp=Cp=1/0),t}};var zp,Tp,Bp,Dp,Np=0,Pp=0,
|
|
5195
|
+
,lineStart:U0,lineEnd:U0,polygonStart:U0,polygonEnd:U0,result:function(){var t=[[Cp,kp],[Ap,Mp]];return Ap=Mp=-(kp=Cp=1/0),t}};var zp,Tp,Bp,Dp,Np=0,Pp=0,Fp=0,Lp=0,Op=0,Rp=0,jp=0,Ip=0,Hp=0,Gp={point:Kp,lineStart:$p,lineEnd:Wp,polygonStart:function(){Gp.lineStart=Yp,Gp.lineEnd=Vp},polygonEnd:function(){Gp.point=Kp,Gp.lineStart=$p,Gp.lineEnd=Wp},result:function(){var t=Hp?[jp/Hp,Ip/Hp]:Rp?[Lp/Rp,Op/Rp]:Fp?[Np/Fp,Pp/Fp]:[NaN,NaN];return Np=Pp=Fp=Lp=Op=Rp=jp=Ip=Hp=0,t}};function Kp(t,n){Np+=t,Pp+=n,++Fp}function $p(){Gp.point=qp}function qp(t,n){Gp.point=Up,Kp(Bp=t,Dp=n)}function Up(t,n){var e=t-Bp,i=n-Dp,e=H0(e*e+i*i);Lp+=e*(Bp+t)/2,Op+=e*(Dp+n)/2,Rp+=e,Kp(Bp=t,Dp=n)}function Wp(){Gp.point=Kp}function Yp(){Gp.point=Zp}function Vp(){Xp(zp,Tp)}function Zp(t,n){Gp.point=Xp,Kp(zp=Bp=t,Tp=Dp=n)}function Xp(t,n){var e=t-Bp,i=n-Dp,e=H0(e*e+i*i);Lp+=e*(Bp+t)/2,Op+=e*(Dp+n)/2,Rp+=e,jp+=(e=Dp*t-Bp*n)*(Bp+t),Ip+=e*(Dp+n),Hp+=3*e,Kp(Bp=t,Dp=n)}function Jp(t){this._context=t}Jp.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,B0)}},result:U0};var Qp,t_,n_,e_,i_,a_=new je,r_={point:U0,lineStart:function(){r_.point=o_},lineEnd:function(){Qp&&s_(t_,n_),r_.point=U0},polygonStart:function(){Qp=!0},polygonEnd:function(){Qp=null},result:function(){var t=+a_;return a_=new je,t}};function o_(t,n){r_.point=s_,t_=e_=t,n_=i_=n}function s_(t,n){e_-=t,i_-=n,a_.add(H0(e_*e_+i_*i_)),e_=t,i_=n}
|
|
5196
5196
|
// Simple caching for constant-radius points.
|
|
5197
5197
|
let l_,u_,h_,c_;class g_{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===h_&&this._append===u_||(e=this._radius,i=this._,this._="",// stash the old string so we can cache the circle path fragment
|
|
5198
5198
|
this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,h_=e,u_=this._append,c_=this._,this._=i),this._+=c_}}result(){var t=this._;return this._="",t.length?t:null}constructor(t){this._append=null==t?d_:(t=>{var n=Math.floor(t);if(!(0<=n))throw new RangeError("invalid digits: "+t);if(15<n)return d_;if(n!==l_){let i=10**n;l_=n,u_=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 u_})(t),this._radius=4.5,this._=""}}function d_(t){let n=1;this._+=t[0];for(var e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function f_(i){return function(t){var n,e=new p_;for(n in i)e[n]=i[n];return e.stream=t,e}}function p_(){}function __(t,n,e){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),J0(e,t.stream(Ep)),n(Ep.result()),null!=i&&t.clipExtent(i),t}function m_(a,r,t){return __(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 y_(t,n,e){return m_(t,[[0,0],n],e)}function v_(i,a,t){return __(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 b_(a,r,t){return __(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)}p_.prototype={constructor:p_,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 x_=16,w_=E(30*B);// cos(minimum angular distance)
|
|
@@ -5202,21 +5202,21 @@ function t(t,n){t=M(t,n),i.point(t[0],t[1])}function n(){h=NaN,p.point=_,i.lineS
|
|
|
5202
5202
|
return D(o)<T?(e=E(t),s.invert=function(t,n){return[t/e,$0(n*e)]},s):(a=H0(i=1+r*(2*o-r))/o,l.invert=function(t,n){var n=a-n,e=P0(t,D(n))*I0(n);return n*o<0&&(e-=M*I0(t)*I0(n)),[e/o,$0((i-(t*t+n*n)*o*o)/(2*o))]},l);function s(t,n){return[t*e,z(n)/e]}function l(t,n){n=H0(i-2*o*z(n))/o;return[n*z(t*=o),a-n*E(t)]}}function z_(){return M_(E_).scale(155.424).center([0,33.6442])}function T_(){return z_().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}
|
|
5203
5203
|
// The projections must have mutually exclusive clip regions on the sphere,
|
|
5204
5204
|
// as this will avoid emitting interleaving lines and polygons.
|
|
5205
|
-
function B_(a){return function(t,n){var e=E(t),i=E(n),e=a(e*i);return e===1/0?[2,0]:[e*i*z(t),e*z(n)]}}function D_(r){return function(t,n){var e=H0(t*t+n*n),i=r(e),a=z(i),i=E(i);return[P0(t*a,e*i),$0(e&&n*a/e)]}}var N_=B_(function(t){return H0(2/(1+t))});N_.invert=D_(function(t){return 2*$0(t/2)});var P_=B_(function(t){return(t=K0(t))&&t/z(t)});function
|
|
5206
|
-
function c(){var t=M*s(),n=o(S1(o.rotate()).invert([0,0]));return u(null==h?[[n[0]-t,n[1]-t],[n[0]+t,n[1]+t]]:e===
|
|
5205
|
+
function B_(a){return function(t,n){var e=E(t),i=E(n),e=a(e*i);return e===1/0?[2,0]:[e*i*z(t),e*z(n)]}}function D_(r){return function(t,n){var e=H0(t*t+n*n),i=r(e),a=z(i),i=E(i);return[P0(t*a,e*i),$0(e&&n*a/e)]}}var N_=B_(function(t){return H0(2/(1+t))});N_.invert=D_(function(t){return 2*$0(t/2)});var P_=B_(function(t){return(t=K0(t))&&t/z(t)});function F_(t,n){return[t,R0(G0((z0+n)/2))]}function L_(e){var i,a,r,o=d(e),n=o.center,s=o.scale,l=o.translate,u=o.clipExtent,h=null;// clip extent
|
|
5206
|
+
function c(){var t=M*s(),n=o(S1(o.rotate()).invert([0,0]));return u(null==h?[[n[0]-t,n[1]-t],[n[0]+t,n[1]+t]]:e===F_?[[Math.max(n[0]-t,h),i],[Math.min(n[0]+t,a),r]]:[[h,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?h=i=a=r=null:(h=+t[0][0],i=+t[0][1],a=+t[1][0],r=+t[1][1]),c()):null==h?null:[[h,i],[a,r]]},c()}function O_(t){return G0((z0+t)/2)}function R_(t,n){var e=E(t),a=t===n?z(t):R0(e/E(n))/R0(O_(n)/O_(t)),r=e*j0(O_(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=I0(a)*H0(t*t+n*n),i=P0(t,D(n))*I0(n);return n*a<0&&(i-=M*I0(t)*I0(n)),[i/a,2*N0(j0(r/e,1/a))-z0]},i):F_;function i(t,n){0<r?n<-z0+T&&(n=-z0+T):z0-T<n&&(n=z0-T);n=r/j0(O_(n),a);return[n*z(a*t),r-n*E(a*t)]}}function j_(t,n){return[t,n]}function I_(){return d(j_).scale(152.63)}function H_(t,n){var e=E(t),i=t===n?z(t):(e-E(n))/(n-t),a=e/i+t;return D(i)<T?j_:(r.invert=function(t,n){var n=a-n,e=P0(t,D(n))*I0(n);return n*i<0&&(e-=M*I0(t)*I0(n)),[e/i,a-I0(i)*H0(t*t+n*n)]},r);function r(t,n){n=a-n,t*=i;return[n*z(t),a-n*E(t)]}}P_.invert=D_(function(t){return t}),F_.invert=function(t,n){return[t,2*N0(L0(n))-z0]},j_.invert=j_;var G_=1.340264,K_=-.081106,$_=893e-6,q_=.003796,U_=H0(3)/2;function W_(t,n){var n=$0(U_*z(n)),e=n*n,i=e*e*e;return[t*E(n)/(U_*(G_+3*K_*e+i*(7*$_+9*q_*e))),n*(G_+K_*e+i*($_+q_*e))]}function Y_(t,n){var e=E(n),i=E(t)*e;return[e*z(t)/i,z(n)/i]}function V_(){return d(Y_).scale(144.049).clipAngle(60)}function Z_(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 X_(t,n){return[E(n)*z(t),z(n)]}function J_(){return d(X_).scale(249.5).clipAngle(90+T)}function Q_(t,n){var e=E(n),i=1+E(t)*e;return[e*z(t)/i,z(n)/i]}function tm(t,n){return[R0(G0((z0+n)/2)),-t]}W_.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*(G_+K_*a+r*($_+q_*a))-n)/(G_+3*K_*a+r*(7*$_+9*q_*a)))*i)*a*a,!(D(e)<E0));++o);return[U_*t*(G_+3*K_*a+r*(7*$_+9*q_*a))/E(i),$0(z(i)/U_)]},Y_.invert=D_(N0),Z_.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))),D(r)>T&&0<--i);return[t/(.8707+(a=e*e)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),e]},X_.invert=D_($0),Q_.invert=D_(function(t){return 2*N0(t)}),tm.invert=function(t,n){return[-n,2*N0(L0(t))-z0]};var Wl=Object.freeze({__proto__:null,geoAlbers:T_,geoAlbersUsa:
|
|
5207
5207
|
// A composite projection for the United States, configured by default for
|
|
5208
5208
|
// 960×500. The projection also works quite well at 960×600 if you change the
|
|
5209
5209
|
// scale to 1285 and adjust the translate accordingly. The set of standard
|
|
5210
5210
|
// parallels for each region comes from USGS, which is published here:
|
|
5211
5211
|
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
|
|
5212
|
-
function(){var n,e,a,r,o,i,s=T_(),l=z_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=z_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={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?u:s).invert(t)},c.stream=function(t){return n&&e===t?n:(i=[s.stream(e=t),l.stream(t),u.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),u.precision(t),g()):s.precision()},c.scale=function(t){return arguments.length?(s.scale(t),l.scale(.35*t),u.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(h),r=l.translate([e-.307*n,i+.201*n]).clipExtent([[e-.425*n+T,i+.12*n+T],[e-.214*n-T,i+.234*n-T]]).stream(h),o=u.translate([e-.205*n,i+.212*n]).clipExtent([[e-.214*n+T,i+.166*n+T],[e-.115*n-T,i+.234*n-T]]).stream(h),g()):s.translate()},c.fitExtent=function(t,n){return m_(c,t,n)},c.fitSize=function(t,n){return y_(c,t,n)},c.fitWidth=function(t,n){return v_(c,t,n)},c.fitHeight=function(t,n){return b_(c,t,n)},c.scale(1070)},geoArea:function(t){return mf=new je,J0(t,yf),2*mf},geoAzimuthalEqualArea:function(){return d(N_).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:N_,geoAzimuthalEquidistant:function(){return d(P_).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:P_,geoBounds:i1,geoCentroid:p1,geoCircle:A1,geoClipAntimeridian:O1,geoClipCircle:R1,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=q1(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:q1,geoConicConformal:function(){return M_(R_).scale(109.5).parallels([30,30])},geoConicConformalRaw:R_,geoConicEqualArea:z_,geoConicEqualAreaRaw:E_,geoConicEquidistant:function(){return M_(H_).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:H_,geoContains:function(t,n){return(t&&tp.hasOwnProperty(t.type)?tp[t.type]:ep)(t,n)},geoDistance:Q1,geoEqualEarth:function(){return d(W_).scale(177.158)},geoEqualEarthRaw:W_,geoEquirectangular:I_,geoEquirectangularRaw:j_,geoGnomonic:V_,geoGnomonicRaw:Y_,geoGraticule:hp,geoGraticule10:function(){return hp()()},geoIdentity:function(){var i,a,n,e,r,o,s,l=1,u=0,h=0,c=1,g=1,d=0,f=null,p=1,_=1,m=f_({point:function(t,n){t=b([t,n]);this.stream.point(t[0],t[1])}}),y=_p;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+u,t+h]}return b.invert=function(t){var n,e=t[0]-u,t=t[1]-h;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,_p):q1(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?(u=+t[0],h=+t[1],v()):[u,h]},b.angle=function(t){return arguments.length?(a=z(d=t%360*B),i=E(d),v()):d*D0},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 m_(b,t,n)},b.fitSize=function(t,n){return y_(b,t,n)},b.fitWidth=function(t,n){return v_(b,t,n)},b.fitHeight=function(t,n){return b_(b,t,n)},b},geoInterpolate:cp,geoLength:Z1,geoMercator:function(){return F_
|
|
5212
|
+
function(){var n,e,a,r,o,i,s=T_(),l=z_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=z_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={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?u:s).invert(t)},c.stream=function(t){return n&&e===t?n:(i=[s.stream(e=t),l.stream(t),u.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),u.precision(t),g()):s.precision()},c.scale=function(t){return arguments.length?(s.scale(t),l.scale(.35*t),u.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(h),r=l.translate([e-.307*n,i+.201*n]).clipExtent([[e-.425*n+T,i+.12*n+T],[e-.214*n-T,i+.234*n-T]]).stream(h),o=u.translate([e-.205*n,i+.212*n]).clipExtent([[e-.214*n+T,i+.166*n+T],[e-.115*n-T,i+.234*n-T]]).stream(h),g()):s.translate()},c.fitExtent=function(t,n){return m_(c,t,n)},c.fitSize=function(t,n){return y_(c,t,n)},c.fitWidth=function(t,n){return v_(c,t,n)},c.fitHeight=function(t,n){return b_(c,t,n)},c.scale(1070)},geoArea:function(t){return mf=new je,J0(t,yf),2*mf},geoAzimuthalEqualArea:function(){return d(N_).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:N_,geoAzimuthalEquidistant:function(){return d(P_).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:P_,geoBounds:i1,geoCentroid:p1,geoCircle:A1,geoClipAntimeridian:O1,geoClipCircle:R1,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=q1(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:q1,geoConicConformal:function(){return M_(R_).scale(109.5).parallels([30,30])},geoConicConformalRaw:R_,geoConicEqualArea:z_,geoConicEqualAreaRaw:E_,geoConicEquidistant:function(){return M_(H_).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:H_,geoContains:function(t,n){return(t&&tp.hasOwnProperty(t.type)?tp[t.type]:ep)(t,n)},geoDistance:Q1,geoEqualEarth:function(){return d(W_).scale(177.158)},geoEqualEarthRaw:W_,geoEquirectangular:I_,geoEquirectangularRaw:j_,geoGnomonic:V_,geoGnomonicRaw:Y_,geoGraticule:hp,geoGraticule10:function(){return hp()()},geoIdentity:function(){var i,a,n,e,r,o,s,l=1,u=0,h=0,c=1,g=1,d=0,f=null,p=1,_=1,m=f_({point:function(t,n){t=b([t,n]);this.stream.point(t[0],t[1])}}),y=_p;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+u,t+h]}return b.invert=function(t){var n,e=t[0]-u,t=t[1]-h;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,_p):q1(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?(u=+t[0],h=+t[1],v()):[u,h]},b.angle=function(t){return arguments.length?(a=z(d=t%360*B),i=E(d),v()):d*D0},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 m_(b,t,n)},b.fitSize=function(t,n){return y_(b,t,n)},b.fitWidth=function(t,n){return v_(b,t,n)},b.fitHeight=function(t,n){return b_(b,t,n)},b},geoInterpolate:cp,geoLength:Z1,geoMercator:function(){return L_(F_).scale(961/B0)},geoMercatorRaw:F_,geoNaturalEarth1:function(){return d(Z_).scale(175.295)},geoNaturalEarth1Raw:Z_,geoOrthographic:J_,geoOrthographicRaw:X_,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)),J0(t,r(o))),o.result()}return s.area=function(t){return J0(t,r(vp)),vp.result()},s.measure=function(t){return J0(t,r(r_)),r_.result()},s.bounds=function(t){return J0(t,r(Ep)),Ep.result()},s.centroid=function(t){return J0(t,r(Gp)),Gp.result()},s.projection=function(t){return arguments.length?(r=null==t?(n=null,_p):(n=t).stream,s):n},s.context=function(t){return arguments.length?(o=null==t?(e=null,new g_(i)):new Jp(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 g_(i)),s},s.projection(n).digits(i).context(e)},geoProjection:d,geoProjectionMutator:A_,geoRotation:S1,geoStereographic:function(){return d(Q_).scale(250).clipAngle(142)},geoStereographicRaw:Q_,geoStream:J0,geoTransform:function(t){return{stream:f_(t)}},geoTransverseMercator:function(){var t=L_(tm),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:tm}),N=Math.abs,nm=Math.atan,b=Math.atan2,P=Math.cos,em=Math.exp,im=Math.floor,am=Math.log,rm=Math.max,om=Math.min,sm=Math.pow,lm=Math.round,y=Math.sign||function(t){return 0<t?1:t<0?-1:0},F=Math.sin,g=Math.tan,L=1e-6,um=1e-12,O=Math.PI,R=O/2,hm=O/4,cm=Math.SQRT1_2,gm=I(2),dm=I(O),fm=2*O,m=180/O,x=O/180;function j(t){return 1<t?R:t<-1?-R:Math.asin(t)}function pm(t){return 1<t?0:t<-1?O:Math.acos(t)}function I(t){return 0<t?Math.sqrt(t):0}function _m(t){return(em(t)-em(-t))/2}function mm(t){return(em(t)+em(-t))/2}function ym(h){var t=g(h/2),c=2*am(P(h/2))/(t*t);function n(t,n){var e=P(t),i=P(n),n=F(n),e=i*e,e=-((1-e?am((1+e)/2)/(1-e):-.5)+c/(1+e));return[e*i*F(t),e*n]}return n.invert=function(t,n){var e=I(t*t+n*n),i=-h/2,a=50;if(!e)return[0,0];do{var r=i/2,o=P(r),r=F(r),s=r/o,l=-am(N(o))}while(i-=s=(2/s*l-c*s-e)/(-l/(r*r)+1-c/(2*o*o))*(o<0?.7:1),N(s)>L&&0<--a);var u=F(i);return[b(t*u,e*P(i)),j(n*u/e)]},n}function vm(t,n){var e=P(n),i=(i=pm(e*P(t/=2)))?i/Math.sin(i):1;return[2*e*F(t)*i,F(n)*i]}
|
|
5213
5213
|
// Abort if [x, y] is not within an ellipse centered at [0, 0] with
|
|
5214
5214
|
// semi-major axis pi and semi-minor axis pi/2.
|
|
5215
|
-
function bm(t){var f=
|
|
5216
|
-
t=i+j(O/e*
|
|
5215
|
+
function bm(t){var f=F(t),p=P(t),_=0<=t?1:-1,m=g(_*t),y=(1+f-p)/2;function n(t,n){var e=P(n),i=P(t/=2);return[(1+e)*F(t),(_*n>-b(i,m)-.001?0:10*-_)+y+F(n)*p-(1+e)*f*i]}return n.invert=function(t,n){var e=0,i=0,a=50;do{var r=P(e),o=F(e),s=P(i),l=F(i),u=1+s,h=u*o-t,c=y+l*p-u*f*r-n,g=u*r/2,d=-o*l,u=f*u*o/2,o=p*s+f*r*l,s=d*u-o*g,r=(c*d-h*o)/s/2,l=(h*u-c*g)/s}while(2<N(l)&&(l/=2),e-=r,i-=l,(N(r)>L||N(l)>L)&&0<--a);return _*i>-b(P(e),m)-.001?[2*e,i]:null},n}function xm(t,n){var n=g(n/2),e=I(1-n*n),i=1+e*P(t/=2),t=F(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)]}vm.invert=function(t,n){if(!(O*O+L<t*t+4*n*n)){var e=t,i=n,a=25;do{var r,o=F(e),s=F(e/2),l=P(e/2),u=F(i),h=P(i),c=F(2*i),g=u*u,d=h*h,f=s*s,p=1-d*l*l,p=p?pm(h*l)*I(r=1/p):r=0,_=2*p*h*s-t,m=p*u-n,y=r*(d*f+p*h*l*g),v=r*(.5*o*c-2*p*u*s),c=.25*r*(c*s-p*u*d*o),s=r*(g*l+p*f*h),u=v*c-s*y;if(!u)break;d=(m*v-_*s)/u,o=(_*c-m*y)/u}while(e-=d,i-=o,(N(d)>L||N(o)>L)&&0<--a);return[e,i]}},xm.invert=function(t,n){var e,i,a,r,o;return n*=3/8,!(t*=3/8)&&1<N(n)?null:(e=j(o=I(((o=1+t*t+n*n)-I(o*o-4*n*n))/2))/3,o=o?(o=N(n/o),am(o+I(o*o-1))/3):(o=N(t),am(o+I(o*o+1))/3),i=P(e),r=(a=mm(o))*a-i*i,[2*y(t)*b(_m(o)*i,.25-r),2*y(n)*b(a*F(e),.25+r)])};var wm=I(8),Sm=am(1+gm);function Cm(t,n){var e=N(n);return e<hm?[t,am(g(hm+n/2))]:[t*P(e)*(2*gm-1/F(e)),y(n)*(2*gm*(e-hm)-am(g(e/2)))]}function km(t){var s=2*O/t;function n(t,n){var e,i,a,n=P_(t,n);return N(t)>R&&(t=b(n[1],n[0]),e=I(n[0]*n[0]+n[1]*n[1]),i=s*lm((t-R)/s)+R,a=b(F(t-=i),2-P(t)),// angle relative to lobe end
|
|
5216
|
+
t=i+j(O/e*F(a))-a,n[0]=e*P(t),n[1]=e*F(t)),n}return n.invert=function(t,n){var e,i,a,r,o=I(t*t+n*n);return R<o&&(r=b(n,t),i=(e=s*lm((r-R)/s)+R)<r?-1:1,a=o*P(e-r),a=1/g(i*pm((a-O)/I(O*(O-2*a)+o*o))),r=e+2*nm((a+i*I(a*a-3))/3),t=o*P(r),n=o*F(r)),P_.invert(t,n)},n}function Am(e,i){return 1===(i=arguments.length<2?e:i)?N_:i===1/0?Mm:(t.invert=function(t,n){t=N_.invert(t/e,n);return t[0]*=i,t},t);function t(t,n){t=N_(t/i,n);return t[0]*=e,t}}function Mm(t,n){return[t*P(n)/P(n/=2),2*F(n)]}
|
|
5217
5217
|
// Approximate Newton-Raphson
|
|
5218
5218
|
// Solve f(x) = y, start from x
|
|
5219
|
-
function Em(t,n,e){var i,a,r=100;for(e=void 0===e?0:+e,n=+n;i=t(e),a=t(e+
|
|
5219
|
+
function Em(t,n,e){var i,a,r=100;for(e=void 0===e?0:+e,n=+n;i=t(e),a=t(e+L),e-=i=-1*L*(i-n)/(i-(a=i===a?i+L:a)),0<r--&&N(i)>L;);return r<0?NaN:e}
|
|
5220
5220
|
// Approximate Newton-Raphson in 2D
|
|
5221
5221
|
// Solve f(a,b) = [x,y]
|
|
5222
5222
|
function zm(_,m,y){return void 0===m&&(m=40),void 0===y&&(y=um),function(t,n,e,i){e=void 0===e?0:+e,i=void 0===i?0:+i;for(var a=0;a<m;a++){var r=_(e,i),// diffs
|
|
@@ -5230,31 +5230,31 @@ g=(N(r)<.5?.5:1)/r;if(e+=u=(s*l-o*f)*g,i+=h=(o*d-s*p)*g,N(u)<y&&N(h)<y)break;//
|
|
|
5230
5230
|
}}return[e,i]}}
|
|
5231
5231
|
// Bertin 1953 as a modified Briesemeister
|
|
5232
5232
|
// https://bl.ocks.org/Fil/5b9ee9636dfb6ffa53443c9006beb642
|
|
5233
|
-
function Tm(){var i=Am(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*
|
|
5233
|
+
function Tm(){var i=Am(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*F(n+O/2));var e=i(t,n),t=(1-P(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=zm(t),t}function Bm(t,n){for(var e,i=t*F(n),a=30;n-=e=(n+F(n)-i)/(1+P(n)),N(e)>L&&0<--a;);return n/2}function Dm(e,i,a){function t(t,n){return[e*t*P(n=Bm(a,n)),i*F(n)]}return t.invert=function(t,n){return n=j(n/i),[t/(e*P(n)),j((2*n+F(2*n))/a)]},t}Cm.invert=function(t,n){if((e=N(n))<Sm)return[t,2*nm(em(n))-R];var e,i=hm,a=25;do{var r=P(i/2),o=g(i/2)}while(i-=r=(wm*(i-hm)-am(o)-e)/(wm-r*r/(2*o)),N(r)>um&&0<--a);return[t/(P(i)*(wm-1/F(i))),y(n)*i]},Mm.invert=function(t,n){n=2*j(n/2);return[t*P(n/2)/P(n),n]};var Nm=Dm(gm/R,gm,O);var Pm=2.00276;function Fm(t,n){var e=Bm(O,n);return[Pm*t/(1/P(n)+1.11072/P(e)),(n+gm*F(e))/Pm]}function Lm(t){var n=0,e=A_(t),t=e(n);return t.parallel=function(t){return arguments.length?e(n=t*x):n*m},t}function Om(t,n){return[t*P(n),n]}function Rm(a){var r;return a?(r=1/g(a),t.invert=function(t,n){var e=I(t*t+(n=r-n)*n),i=r+a-e;return[e/P(i)*b(t,n),i]},t):Om;function t(t,n){var e=r+a-n,t=e&&t*P(n)/e;return[e*F(t),r-e*P(t)]}}function jm(i){function t(t,n){n=R-n,t=n&&t*i*F(n)/n;return[n*F(t)/i,R-n*P(t)]}return t.invert=function(t,n){var t=t*i,n=R-n,e=I(t*t+n*n),t=b(t,n);return[(e?e/F(e):1)*t/i,R-e]},t}Fm.invert=function(t,n){for(var e,i,a=Pm*n,r=n<0?-hm:hm,o=25;i=a-gm*F(r),r-=e=(F(2*r)+2*r-O*F(i))/(2*P(2*r)+2+O*P(i)*gm*P(r)),N(e)>L&&0<--o;);return i=a-gm*F(r),[t*(1/P(i)+1.11072/P(r))/Pm,i]},Om.invert=function(t,n){return[t/P(n),n]};var Im=Dm(1,4/O,O);
|
|
5234
5234
|
// Azimuthal distance.
|
|
5235
|
-
function Hm(t,n,e,i,a,r){var o=P(r);return t=1<N(t)||1<N(r)?pm(e*a+n*i*o):2*j(I((t=
|
|
5235
|
+
function Hm(t,n,e,i,a,r){var o=P(r);return t=1<N(t)||1<N(r)?pm(e*a+n*i*o):2*j(I((t=F(t/2))*t+n*i*(t=F(r/2))*t)),N(t)>L?[t,b(i*F(r),n*a-e*i*o)]:[0,0]}
|
|
5236
5236
|
// Angle opposite a, and contained between sides of lengths b and c.
|
|
5237
5237
|
function Gm(t,n,e){return pm((t*t+n*n-e*e)/(2*t*n))}
|
|
5238
5238
|
// Normalize longitude.
|
|
5239
|
-
function Km(t,n,e){for(var i,u=[[t[0],t[1],
|
|
5239
|
+
function Km(t,n,e){for(var i,u=[[t[0],t[1],F(t[1]),P(t[1])],[n[0],n[1],F(n[1]),P(n[1])],[e[0],e[1],F(e[1]),P(e[1])]],a=u[2],r=0;r<3;++r,a=i)i=u[r],a.v=Hm(i[1]-a[1],a[3],a[2],i[3],i[2],i[0]-a[0]),a.point=[0,0];var t=Gm(u[0].v[0],u[2].v[0],u[1].v[0]),h=Gm(u[0].v[0],u[1].v[0],u[2].v[0]),c=O-t,g=(u[2].point[1]=0,u[0].point[0]=-(u[1].point[0]=u[0].v[0]/2),[u[2].point[0]=u[0].point[0]+u[2].v[0]*P(t),2*(u[0].point[1]=u[1].point[1]=u[2].v[0]*F(t))]);return function(t,n){
|
|
5240
5240
|
// Compute distance and azimuth from control points.
|
|
5241
|
-
for(var e=
|
|
5241
|
+
for(var e=F(n),i=P(n),a=new Array(3),r=0;r<3;++r){var o=u[r];if(a[r]=Hm(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*O*im((o+O)/(2*O))}
|
|
5242
5242
|
// Arithmetic mean of interception points.
|
|
5243
|
-
var s=g.slice();for(r=0;r<3;++r){var l=2==r?0:r+1,l=Gm(u[r].v[0],a[r][0],a[l][0]);a[r][1]<0&&(l=-l),r?1==r?(s[0]-=a[r][0]*P(l=h-l),s[1]-=a[r][0]*
|
|
5243
|
+
var s=g.slice();for(r=0;r<3;++r){var l=2==r?0:r+1,l=Gm(u[r].v[0],a[r][0],a[l][0]);a[r][1]<0&&(l=-l),r?1==r?(s[0]-=a[r][0]*P(l=h-l),s[1]-=a[r][0]*F(l)):(s[0]+=a[r][0]*P(l=c-l),s[1]+=a[r][0]*F(l)):(s[0]+=a[r][0]*P(l),s[1]-=a[r][0]*F(l))}return s[0]/=3,s[1]/=3,s}}function $m(t){return t[0]*=x,t[1]*=x,t}function qm(t,n,e){var i=p1({type:"MultiPoint",coordinates:[t,n,e]}),i=[-i[0],-i[1]],a=S1(i),t=Km($m(a(t)),$m(a(n)),$m(a(e))),n=(t.invert=zm(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 Um(t,n){n=I(1-F(n));return[2/dm*t*n,dm*(1-n)]}function Wm(t){var i=g(t);function n(t,n){return[t,(t?t/F(t):1)*(F(n)*P(t)-i*P(n))]}return n.invert=i?function(t,n){t&&(n*=F(t)/t);var e=P(t);return[t,2*b(I(e*e+i*i-n*n)-e,i-n)]}:function(t,n){return[t,j(t?n*g(t)/t:n)]},n}Um.invert=function(t,n){n=(n=n/dm-1)*n;return[0<n?t*I(O/n)/2:0,j(1-n)]};var Ym=I(3);function Vm(t,n){return[Ym*t*(2*P(2*n/3)-1)/dm,Ym*dm*F(n/3)]}function Zm(t){var e=P(t);function n(t,n){return[t*e,F(n)/e]}return n.invert=function(t,n){return[t/e,j(n*e)]},n}function Xm(t){var e=P(t);function n(t,n){return[t*e,(1+e)*g(n/2)]}return n.invert=function(t,n){return[t/e,2*nm(n/(1+e))]},n}function Jm(t,n){var e=I(8/(3*O));return[e*t*(1-N(n)/O),e*n]}function Qm(t,n){var e=I(4-3*F(N(n)));return[2/I(6*O)*t*e,y(n)*I(2*O/3)*(2-e)]}function ty(t,n){var e=I(O*(4+O));return[2/e*t*(1+I(1-4*n*n/(O*O))),4/e*n]}function ny(t,n){var e=(2+R)*F(n);n/=2;for(var i=0,a=1/0;i<10&&N(a)>L;i++){var r=P(n);n-=a=(n+F(n)*(r+2)-e)/(2*r*(1+r))}return[2/I(O*(4+O))*t*(1+P(n)),2*I(O/(4+O))*F(n)]}function ey(t,n){return[t*(1+P(n))/I(2+O),2*n/I(2+O)]}function iy(t,n){for(var e=(1+R)*F(n),i=0,a=1/0;i<10&&N(a)>L;i++)n-=a=(n+F(n)-e)/(1+P(n));return e=I(2+O),[t*(1+P(n))/e,2*n/e]}Vm.invert=function(t,n){n=3*j(n/(Ym*dm));return[dm*t/(Ym*(2*P(2*n/3)-1)),n]},Jm.invert=function(t,n){var e=I(8/(3*O)),n=n/e;return[t/(e*(1-N(n)/O)),n]},Qm.invert=function(t,n){var e=2-N(n)/I(2*O/3);return[t*I(6*O)/(2*e),y(n)*j((4-e*e)/3)]},ty.invert=function(t,n){var e=I(O*(4+O))/2;return[t*e/(1+I(1-n*n*(4+O)/(4*O))),n*e/2]},ny.invert=function(t,n){var n=n*I((4+O)/O)/2,e=j(n),i=P(e);return[t/(2/I(O*(4+O))*(1+i)),j((e+n*(i+2))/(2+R))]},ey.invert=function(t,n){var e=I(2+O),n=n*e/2;return[e*t/(1+P(n)),n]},iy.invert=function(t,n){var e=1+R,i=I(e/2);return[2*t*i/(1+P(n*=i)),j((n+F(n))/e)]};var ay=3+2*gm;function ry(t,n){var e=F(t/=2),t=P(t),i=I(P(n)),a=P(n/=2),n=F(n)/(a+gm*t*i),r=I(2/(1+n*n)),a=I((gm*a+(t+e)*i)/(gm*a+(t-e)*i));return[ay*(r*(a-1/a)-2*am(a)),ay*(r*n*(a+1/a)-2*nm(n))]}ry.invert=function(t,n){if(!(e=xm.invert(t/1.2,1.065*n)))return null;var e,i=e[0],a=e[1],r=20;t/=ay,n/=ay;do{var o=i/2,s=a/2,l=F(o),o=P(o),u=F(s),s=P(s),h=P(a),c=I(h),g=u/(s+gm*o*c),d=g*g,f=I(2/(1+d)),p=(gm*s+(o+l)*c)/(gm*s+(o-l)*c),_=I(p),m=_-1/_,y=_+1/_,v=f*m-2*am(_)-t,b=f*g*y-2*nm(g)-n,x=u&&cm*c*l*d/u,w=(gm*o*s+c)/(2*(s+gm*o*c)*(s+gm*o*c)*c),S=-.5*g*f*f*f,C=S*x,S=S*w,k=(k=2*s+gm*c*(o-l))*k*_,o=(gm*o*s*c+h)/k,s=-gm*l*u/(c*k),h=m*C-2*o/_+f*(o+o/p),l=m*S-2*s/_+f*(s+s/p),u=g*y*C-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),k=l*u-c*h;if(!k)break;m=(b*l-v*c)/k,_=(v*u-b*h)/k}while(i-=m,a=rm(-R,om(R,a-_)),(N(m)>L||N(_)>L)&&0<--r);return N(N(a)-R)<L?[0,a]:r&&[i,a]};var oy=P(35*x);function sy(t,n){n=g(n/2);return[t*oy*I(1-n*n),(1+oy)*n]}function ly(t,n){var e=n/2,i=P(e);return[2*t/dm*P(n)*i*i,dm*g(e)]}function uy(a){var r=1-a,t=i(O,0)[0]-i(-O,0)[0],e=I(2*(i(0,R)[1]-i(0,-R)[1])/t);function i(t,n){var e=P(n),i=F(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=Em(o,n);return[t/e*(a+r/P(n)),n]},n}function hy(t){return[t[0]/2,j(g(t[1]/2*x))*m]}function cy(t){return[2*t[0],2*nm(F(t[1]*x))*m]}function gy(m,t){var y=2*O/t,v=m*m;function n(t,n){var t=P_(t,n),e=t[0],n=t[1],i=e*e+n*n;if(v<i){for(var a,r=I(i),i=b(n,e),o=y*lm(i/y),i=i-o,s=m*P(i),l=(m*F(i)-i*F(s))/(R-s),u=dy(i,l),h=(O-m)/fy(u,s,O),e=r,c=50;e-=a=(m+fy(u,s,e)*h-r)/(u(e)*h),N(a)>L&&0<--c;);n=i*F(e),e<R&&(n-=l*(e-R));i=F(o),l=P(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=I(e),i=b(n,t),a=y*lm(i/y),r=i-a,o=(t=e*P(r),n=e*F(r),t-R),s=F(t),l=n/s,u=t<R?1/0:0,h=10;;){var c=m*F(l),g=m*P(l),d=F(g),f=R-g,p=(c-l*d)/f,_=dy(l,p);if(N(u)<um||!--h)break;l-=u=(l*s-p*o-n)/(s-2*o*(f*(g+l*c*P(g)-d)-c*(c-l*d))/(f*f))}t=(e=m+fy(_,g,t)*(O-m)/fy(_,g,O))*P(i=a+l),n=e*F(i)}return P_.invert(t,n)},n}function dy(e,i){return function(t){var n=e*P(t);return t<R&&(n-=i),I(1+n*n)}}
|
|
5244
5244
|
// Numerical integration: trapezoidal rule.
|
|
5245
|
-
function fy(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 py(m,y,v,b,x,w,S,C){function t(t,n){var e,i,a;return n?(a=t*j((i=m+(e=n*n)*(y+e*(v+e*b)))/(i=(i*i+(i=n*(x-1+e*(w-C+e*S)))*i)/(2*i)))/O,[i*
|
|
5245
|
+
function fy(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 py(m,y,v,b,x,w,S,C){function t(t,n){var e,i,a;return n?(a=t*j((i=m+(e=n*n)*(y+e*(v+e*b)))/(i=(i*i+(i=n*(x-1+e*(w-C+e*S)))*i)/(2*i)))/O,[i*F(a),n*(1+e*C)+i*(1-P(a))]):[m*t/O,0]}return arguments.length<8&&(C=0),t.invert=function(t,n){var e=O*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-C+r*S)),l=o*o+s*s,u=2*s,h=l/u,c=h*h,g=j(o/h)/O,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))*u-l*(2*(_-1)))/(u*u),l=P(d),_=F(d),u=h*l,d=h*_,f=e/O*(1/I(1-f/c))*(p*h-o*s)/c,p=d-t,o=i*(1+r*C)+h-u-n,c=s*_+u*f,r=u*g,h=1+s-(s*l-d*f),_=d*g,u=c*_-h*r}while(u&&(e-=s=(o*c-p*h)/u,i-=l=(p*_-o*r)/u,(N(s)>L||N(l)>L)&&0<--a));return[e,i]},t}sy.invert=function(t,n){n/=1+oy;return[t&&t/(oy*I(1-n*n)),2*nm(n)]},ly.invert=function(t,n){var n=nm(n/dm),e=P(n),n=2*n;return[t*dm/2/(P(n)*e*e),n]};var _y=py(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555);var my=py(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742);var yy=py(5/6*O,-.62636,-.0344,0,1.3493,-.05524,0,.045);function vy(t,n){var e=t*t,i=n*n;return[t*(1-.162388*i)*(.87-952426e-9*e*e),n*(1+i/12)]}vy.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),N(e)>L&&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),N(e)>L&&0<--r);return[i,a]};var by=py(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);function xy(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*O,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*O;return n<-O?n+=2*O:O<n&&(n-=2*O),t[0]=n,t}),t}function wy(t,n){var e=y(t),i=y(n),a=P(n),r=P(t)*a,a=F(t)*a,o=F(i*n),a=(t=N(b(a,o)),n=j(r),N(t-R)>L&&(t%=R),((t,n)=>{if(n===R)return[0,0];var e,i,a=F(n),r=a*a,o=r*r,s=1+o,l=1+3*o,u=1-o,h=j(1/I(s)),c=u+r*s*h,g=(1-a)/c,d=I(g),f=g*s,p=I(f),_=d*u;if(0===t)return[0,-(_+r*p)];var m=P(n),y=1/m,v=2*a*m,b=-y*v,x=-y*(r*s*(m=(-c*m-(-3*r+h*l)*v*(1-a))/(c*c))+g*l*v),w=-2*y*(.5*m/d*u-2*r*d*v),S=4*t/O;
|
|
5246
5246
|
// Slower but accurate bisection method.
|
|
5247
|
-
if(.222*O<t||n<O/4&&.175*O<t){if(e=(_+r*I(f*(1+o)-_*_))/(1+o),O/4<t)return[e,e];var C=e,k=.5*e;e=.5*(k+C),i=50;do{var A=I(f-e*e),A=e*(w+b*A)+x*j(e/p)-S}while(A&&(A<0?k=e:C=e,e=.5*(k+C),N(C-k)>
|
|
5247
|
+
if(.222*O<t||n<O/4&&.175*O<t){if(e=(_+r*I(f*(1+o)-_*_))/(1+o),O/4<t)return[e,e];var C=e,k=.5*e;e=.5*(k+C),i=50;do{var A=I(f-e*e),A=e*(w+b*A)+x*j(e/p)-S}while(A&&(A<0?k=e:C=e,e=.5*(k+C),N(C-k)>L&&0<--i))}else{e=L,i=25;do{var M=e*e,E=I(f-M),z=w+b*E,T=e*z+x*j(e/p)-S,z=z+(x-b*M)/E}while(e-=M=E?T/z:0,N(M)>L&&0<--i)}return[e,-_-r*I(f-e*e)]})(O/4<t?R-t:t,n));return O/4<t&&(o=a[0],a[0]=-a[1],a[1]=-o),a[0]*=e,a[1]*=-i,a}
|
|
5248
5248
|
// Returns [sn, cn, dn, ph](u|m).
|
|
5249
|
-
function Sy(t,n){var e,i,a,r;if(n<
|
|
5249
|
+
function Sy(t,n){var e,i,a,r;if(n<L)return[(a=F(t))-(e=n*(t-a*(u=P(t)))/4)*u,u+e*a,1-n*a*a/2,t-e];if(1-L<=n)return e=(1-n)/4,i=1/(u=mm(t)),[(a=((r=em(2*(r=t)))-1)/(r+1))+e*((h=u*_m(t))-t)/(u*u),i-e*a*i*(h-t),i+e*a*i*(h+t),2*nm(em(t))-R+e*(h-t)/u];for(var o=[1,0,0,0,0,0,0,0,0],s=[I(n),0,0,0,0,0,0,0,0],l=0,u=I(1-n),h=1;N(s[l]/o[l])>L&&l<8;)e=o[l++],s[l]=(e-u)/2,o[l]=(e+u)/2,u=I(e*u),h*=2;for(i=h*o[l]*t;i=(j(a=s[l]*F(u=i)/o[l])+i)/2,--l;);return[F(i),a=P(i),a/P(i-u),i]}
|
|
5250
5250
|
// Calculate F(phi+iPsi|m).
|
|
5251
5251
|
// See Abramowitz and Stegun, 17.4.11.
|
|
5252
5252
|
// Calculate F(phi|m) where m = k² = sin²α.
|
|
5253
5253
|
// See Abramowitz and Stegun, 17.6.7.
|
|
5254
|
-
function Cy(t,n){if(!n)return t;if(1===n)return am(g(t/2+hm));for(var e,i=1,a=I(1-n),r=I(n),o=0;N(r)>
|
|
5254
|
+
function Cy(t,n){if(!n)return t;if(1===n)return am(g(t/2+hm));for(var e,i=1,a=I(1-n),r=I(n),o=0;N(r)>L;o++)t%O?((e=nm(a*g(t)/i))<0&&(e+=O),t+=e+~~(t/O)*O):t+=t,r=(i+a)/2,a=I(i*a),r=((i=r)-a)/2;return t/(sm(2,o)*i)}function ky(t,n){var e,i=(gm-1)/(gm+1),a=I(1-i*i),r=Cy(R,a*a),o=am(g(O/4+N(n)/2)),o=em(-1*o)/I(i),i=(i=o*P(-1*t),o=o*F(-1*t),t=o+1,[.5*((0<=i?R:-R)-b(o=1-(s=i*i)-o*o,2*i)),-.25*am(o*o+4*s)+.5*am(t*t+s)]),s=(o=i[1],t=a*a,a=N(s=i[0]),i=_m(N(o)),a?(e=1/F(a),e=(-(e=-((a=1/(g(a)*g(a)))+t*(i*i*e*e)-1+t))+I(e*e-4*((t-1)*a)))/2,[Cy(nm(1/I(e)),t)*y(s),Cy(nm(I((e/a-1)/t)),1-t)*y(o)]):[0,Cy(nm(i),1-t)*y(o)]);return[-s[1],(0<=n?1:-1)*(.5*r-s[0])]}function Ay(t){var u=F(t),o=P(t),h=My(t);function n(t,n){var e=h(t,n),e=(t=e[0],F(n=e[1])),n=P(n),i=P(t),a=pm(u*e+o*n*i),r=F(a),a=N(r)>L?a/r:1;return[a*o*F(t),(N(t)>R?a:-a)*(u*n-o*e*i)]}return h.invert=My(-t),n.invert=function(t,n){var e=I(t*t+n*n),i=-F(e),a=P(e),r=e*a,o=-n*i,s=e*u,l=I(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*P(o)*a+n*F(o)*i);return h.invert(s,o)},n}
|
|
5255
5255
|
// Latitudinal rotation by phi0.
|
|
5256
5256
|
// Temporary hack until D3 supports arbitrary small-circle clipping origins.
|
|
5257
|
-
function My(t){var a=
|
|
5257
|
+
function My(t){var a=F(t),r=P(t);return function(t,n){var e=P(n),i=P(t)*e,t=F(t)*e,e=F(n);return[b(t,i*r-e*a),j(e*r+i*a)]}}wy.invert=function(t,n){1<N(t)&&(t=2*y(t)-t),1<N(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,u=50;;){var h=l*l,c=I(l),g=j(1/I(1+h)),d=1-h+l*(1+h)*g,f=(1-c)/d,p=I(f),_=f*(1+h),m=p*(1-h),y=I(_-t*t),m=n+m+l*y;if(N(s-o)<um||0==--u||0===m)break;0<m?o=l:s=l,l=.5*(o+s)}return u?(e=j(c),a=P(e),[O/4*(t*(-2*(i=1/a)*((1-h)*(.5*(r=(-d*a-(1-c)*((-3*l+g*(1+3*h))*(a=2*c*a)))/(d*d))/p)-2*l*p*a)+-i*a*y)+-i*(l*(1+h)*r+f*(1+3*h)*a)*j(t/I(_))),e]):null})(a?n:t,a?t:n),n=t[0],t=t[1],r=P(t);return[e*(b(F(n=a?-R-n:n)*r,-F(t))+O),i*j(P(n)*r)]},ky.invert=function(t,n){var e=(gm-1)/(gm+1),i=I(1-e*e),a=Cy(R,i*i),n=(t=-t,i=i*i,(a=.5*a-n)?(a=Sy(a,i),t?(n=(r=Sy(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=Sy(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*nm(em(-.5*am(e*r[0]*r[0]+e*r[1]*r[1])))-R]};var Ey=j(1-1/3)*m,zy=Zm(0);function Ty(r){var o=Ey*x,s=Um(O,o)[0]-Um(-O,o)[0],l=zy(0,o)[1],u=Um(0,o)[1],h=dm-u,c=fm/r,g=4/fm,d=l+h*h*4/fm;function t(t,n){var e,i,a=N(n);return o<a?(i=om(r-1,rm(0,im((t+O)/c))),(e=Um(t+=O*(r-1)/r-i*c,a))[0]=e[0]*fm/s-fm*(r-1)/(2*r)+i*fm/r,e[1]=l+4*(e[1]-u)*h/fm,n<0&&(e[1]=-e[1])):e=zy(t,n),e[0]*=g,e[1]/=d,e}return t.invert=function(t,n){t/=g;var e,i=N(n*=d);return l<i?(e=om(r-1,rm(0,im((t+O)/c))),t=(t+O*(r-1)/r-e*c)*s/fm,(i=Um.invert(t,.25*(i-l)*fm/h+u))[0]-=O*(r-1)/r-e*c,n<0&&(i[1]=-i[1]),i):zy.invert(t,n)},t}function By(t,n){return[t,1&n?90-L:Ey]}function Dy(t,n){return[t,1&n?-90+L:-Ey]}function Ny(t){return[t[0]*(1-L),t[1]]}function Py(c){var g,d=1+c,f=j(F(1/d)),p=2*I(O/(g=O+4*f*d)),_=.5*p*(d+I(c*(2+c))),m=c*c,y=d*d;function t(t,n){var e,i,a=1-F(n);if(a&&a<2){var r=R-n,o=25;do{var s=F(r),l=P(r),u=f+b(s,d-l),h=1+y-2*d*l}while(r-=l=(r-m*f-d*s+h*u-.5*a*g)/(2*d*s*u),N(l)>um&&0<--o);e=p*I(h),i=t*u/O}else e=p*(c+a),i=t*f/O;return[e*F(i),_-e*P(i)]}return t.invert=function(t,n){var n=t*t+(n-=_)*n,e=(1+y-n/(p*p))/(2*d),i=pm(e),a=F(i),r=f+b(a,d-e);return[j(t/I(n))*O/r,j(1-2*(i-m*f-d*a+(1+y-2*d*e)*r)/g)]},t}var Fy=.7109889596207567,Ly=.0528035274542;function Oy(t,n){return-.7109889596207567<n?((t=Nm(t,n))[1]+=Ly,t):Om(t,n)}function Ry(t,n){return N(n)>Fy?((t=Nm(t,n))[1]-=0<n?Ly:-.0528035274542,t):Om(t,n)}function jy(n,e,i,t){var a=I(4*O/(2*i+(1+n-e/2)*F(2*i)+(n+e)/2*F(4*i)+e/2*F(6*i))),r=I(t*F(i)*I((1+n*P(2*i)+e*P(4*i))/(1+n+e))),o=i*l(1);function s(t){return I(1+n*P(2*t)+e*P(4*t))}function l(t){t*=i;return(2*t+(1+n-e/2)*F(2*t)+(n+e)/2*F(4*t)+e/2*F(6*t))/i}function u(t){return s(t)*F(t)}var h=function(t,n){var e=i*Em(l,o*F(n)/i,n/O),n=(isNaN(e)&&(e=i*y(n)),a*s(e));return[n*r*t/O*P(e),n/r*F(e)]};return h.invert=function(t,n){n=Em(u,n*r/a);return[t*O/(P(n)*a*r*s(n)),j(i*l(n/i)/o)]},0===i&&(a=I(t/O),(h=function(t,n){return[t*a,F(n)/a]}).invert=function(t,n){return[t/a,j(n*a)]}),h}function Iy(t,n,e,i,a){void 0===a&&(a=20);var r=t(n),o=t(.5*(n+e)),s=t(e);
|
|
5258
5258
|
/*
|
|
5259
5259
|
if (state.maxDepthCount > 0 && console && console.warn) {
|
|
5260
5260
|
console.warn('integrate-adaptive-simpson: Warning: maximum recursion depth (' + maxdepth + ') reached ' + state.maxDepthCount + ' times');
|
|
@@ -5271,25 +5271,25 @@ return function t(n,e,i,a,r,o,s,l,u,h,c){if(c.nanEncountered)return NaN;var g,d,
|
|
|
5271
5271
|
// Simple check for NaN:
|
|
5272
5272
|
if(!isNaN(_)&&!isNaN(m))return s=((f=(g=p*(a+4*_+r)/12)+(d=p*(r+4*m+o)/12))-s)/15,u<h?(c.maxDepthCount++,f+s):Math.abs(s)<l?f+s:(s=t(n,e,f=e+.5*p,a,_,r,g,.5*l,u,h+1,c),isNaN(s)||(e=t(n,f,i,r,m,o,d,.5*l,u,h+1,c),isNaN(e))?(c.nanEncountered=!0,NaN):s+e);
|
|
5273
5273
|
// Simple check for NaN:
|
|
5274
|
-
c.nanEncountered=!0}(t,n,e,r,o,s,(r+4*o+s)*(e-n)/6,i,a,1,{maxDepthCount:0,nanEncountered:!1})}function Hy(n,e,t){function i(t){return n+(1-n)*sm(1-sm(t,e),1/e)}function a(t){return Iy(i,0,t,1e-4)}for(var r=1/a(1),o=(1+1e-8)*r,s=[],l=0;l<=1e3;l++)s.push(a(l/1e3)*o);function u(t){for(var n=0,e=1e3,i=500;t<s[i]?e=i:n=i,n<(i=n+e>>1););var a=s[i+1]-s[i];return(i+1+(a=a&&(t-s[i+1])/a))/1e3}function h(t,n){var e=u(N(
|
|
5274
|
+
c.nanEncountered=!0}(t,n,e,r,o,s,(r+4*o+s)*(e-n)/6,i,a,1,{maxDepthCount:0,nanEncountered:!1})}function Hy(n,e,t){function i(t){return n+(1-n)*sm(1-sm(t,e),1/e)}function a(t){return Iy(i,0,t,1e-4)}for(var r=1/a(1),o=(1+1e-8)*r,s=[],l=0;l<=1e3;l++)s.push(a(l/1e3)*o);function u(t){for(var n=0,e=1e3,i=500;t<s[i]?e=i:n=i,n<(i=n+e>>1););var a=s[i+1]-s[i];return(i+1+(a=a&&(t-s[i+1])/a))/1e3}function h(t,n){var e=u(N(F(n))),t=i(e)*t;return e/=c,[t,0<=n?e:-e]}var c=2*u(1)/O*r/t;return h.invert=function(t,n){var e;return N(n*=c)<1&&(e=y(n)*j(a(N(n))*r)),[t/i(N(n)),e]},h}function Gy(t,n){for(var e=-1,i=t.length,a=t[0],r=[];++e<i;){for(var o,s=((o=t[e])[0]-a[0])/n,l=(o[1]-a[1])/n,u=0;u<n;++u)r.push([a[0]+u*s,a[1]+u*l]);a=o}return r.push(o),r}function Ky(u,h,t){var a,c;function g(t,n){for(var e=n<0?-1:1,i=h[+(n<0)],a=0,r=i.length-1;a<r&&t>i[a][2][0];++a);var o=u(t-i[a][1][0],n);return o[0]+=u(i[a][1][0],e*n>e*i[a][0][1]?i[a][0][1]:n)[0],o}t?g.invert=t(g):u.invert&&(g.invert=function(t,n){for(var e,i,a=c[+(n<0)],r=h[+(n<0)],o=0,s=a.length;o<s;++o){var l=a[o];if(l[0][0]<=t&&t<l[1][0]&&l[0][1]<=n&&n<l[1][1])return(l=u.invert(t-u(r[o][1][0],0)[0],n))[0]+=r[o][1][0],e=g(l[0],l[1]),i=[t,n],N(e[0]-i[0])<L&&N(e[1]-i[1])<L?l:null}});var r=d(g),o=r.stream;return 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(){J0(a,i)},e},r.lobes=function(t){return arguments.length?(a=(t=>{
|
|
5275
5275
|
// Northern Hemisphere
|
|
5276
|
-
for(var n,e,i,a,r,o,s=[],l=t[0].length,u=0;u<l;++u)e=(n=t[0][u])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(Gy([[e+
|
|
5276
|
+
for(var n,e,i,a,r,o,s=[],l=t[0].length,u=0;u<l;++u)e=(n=t[0][u])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(Gy([[e+L,i+L],[e+L,a-L],[r-L,a-L],[r-L,o+L]],30));
|
|
5277
5277
|
// Southern Hemisphere
|
|
5278
|
-
for(u=t[1].length-1;0<=u;--u)e=(n=t[1][u])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(Gy([[r-
|
|
5279
|
-
n=sm((1+(n=2*n/(1+i+e)))/(1-n),1/a),[b(2*t,1-i-e)/a,j((n-1)/(n+1))])},t}Zy.invert=function(t,n){return[fm/3*t/I(O*O/3-n*n),n]};var Jy=O/gm;function Qy(t,n){return[t*(1+I(P(n)))/2,n/(P(n/2)*P(t/6))]}function tv(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 nv(t,n){return[
|
|
5278
|
+
for(u=t[1].length-1;0<=u;--u)e=(n=t[1][u])[0][0],i=n[0][1],a=n[1][1],r=n[2][0],o=n[2][1],s.push(Gy([[r-L,o-L],[r-L,a+L],[e+L,a+L],[e+L,i-L]],30));return{type:"Polygon",coordinates:[ii(s)]}})(t),h=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=h.map(function(t){return t.map(function(t){var n,e=u(t[0][0],t[0][1])[0],i=u(t[2][0],t[2][1])[0],a=u(t[1][0],t[0][1])[1],t=u(t[1][0],t[1][1])[1];return t<a&&(n=a,a=t,t=n),[[e,a],[i,t]]})}),r):h.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!=h&&r.lobes(h),r}Oy.invert=function(t,n){return-.7109889596207567<n?Nm.invert(t,n-Ly):Om.invert(t,n)},Ry.invert=function(t,n){return N(n)>Fy?Nm.invert(t,n+(0<n?Ly:-.0528035274542)):Om.invert(t,n)};var $y=[[[[-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 qy=[[[[-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 Uy=[[[[-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 Wy=[[[[-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 Yy=[[[[-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 Vy=[[[[-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 Zy(t,n){return[3/fm*t*I(O*O/3-n*n),n]}function Xy(a){function t(t,n){var e;return N(N(n)-R)<L?[0,n<0?-2:2]:(n=F(n),e=.5*((n=sm((1+n)/(1-n),a/2))+1/n)+P(t*=a),[2*F(t)/e,(n-1/n)/e])}return t.invert=function(t,n){var e,i=N(n);return N(i-2)<L?t?null:[0,y(n)*R]:2<i?null:(i=(t/=2)*t,e=(n/=2)*n,// tanh(nPhi)
|
|
5279
|
+
n=sm((1+(n=2*n/(1+i+e)))/(1-n),1/a),[b(2*t,1-i-e)/a,j((n-1)/(n+1))])},t}Zy.invert=function(t,n){return[fm/3*t/I(O*O/3-n*n),n]};var Jy=O/gm;function Qy(t,n){return[t*(1+I(P(n)))/2,n/(P(n/2)*P(t/6))]}function tv(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 nv(t,n){return[F(t)/P(n),g(n)*P(t)]}function ev(a){var r=P(a),o=g(hm+a/2);function t(t,n){var e=n-a,i=N(e)<L?t*r:N(i=hm+n/2)<L||N(N(i)-R)<L?0:t*e/am(g(i)/o);return[i,e]}return t.invert=function(t,n){var e,i=n+a;return[N(n)<L?t/r:N(e=hm+i/2)<L||N(N(e)-R)<L?0:t*am(g(e)/o)/n,i]},t}function iv(t,n){return[t,1.25*am(g(hm+.4*n))]}function av(m){var y=m.length-1;function t(t,n){for(var e,i=P(n),a=2/(1+i*P(t)),r=a*i*F(t),o=a*F(n),s=y,l=m[s],u=l[0],h=l[1];0<=--s;)u=(l=m[s])[0]+r*(e=u)-o*h,h=l[1]+r*h+o*e;return[u=r*(e=u)-o*h,h=r*h+o*e]}return t.invert=function(t,n){var e,i,a,r=20,o=t,s=n;do{for(var l,u=y,h=m[u],c=h[0],g=h[1],d=0,f=0;0<=--u;)d=c+o*(l=d)-s*f,f=g+o*f+s*l,c=(h=m[u])[0]+o*(l=c)-s*g,g=h[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)/_,N(p)+N(_)>L*L&&0<--r);if(r)return e=I(o*o+s*s),i=2*nm(.5*e),a=F(i),[b(o*a,e*P(i)),e?j(s*a/e):0]},t}Qy.invert=function(t,n){var e=N(t),i=N(n),a=L,r=R;i<Jy?r*=i/Jy:a+=6*pm(Jy/i);for(var o=0;o<25;o++){var s=F(r),l=I(P(r)),u=F(r/2),h=P(r/2),c=F(a/6),g=P(a/6),d=.5*a*(1+l)-e,f=r/(h*g)-i,s=l?-.25*a*s/l:0,l=.5*(1+l),u=(1+.5*r*u/h)/(h*g),h=r/h*(c/6)/(g*g),c=s*h-u*l,g=(d*h-f*l)/c,h=(f*s-d*u)/c;if(r-=g,a-=h,N(g)<L&&N(h)<L)break}return[t<0?-a:a,n<0?-r:r]},tv.invert=function(t,n){var e=y(t)*O,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,u=i*(1.00384+r*(.0802894+-.02855*o+199025e-9*r)+o*(.0998909+-.0491032*o))-n,h=.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*h,c=(u*c-l*r)/o,r=(l*s-u*h)/o}while(e-=c,i-=r,(N(c)>L||N(r)>L)&&0<--a);return a&&[e,i]},nv.invert=function(t,n){var e=t*t,i=1+n*n,a=e+i,a=t?cm*I((a-I(a*a-4*e))/e):1/I(i);return[j(t*a),y(n)*pm(a)]},iv.invert=function(t,n){return[t,2.5*nm(em(.8*n))-.625*O]};var rv=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],ov=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],sv=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],lv=[[.9245,0],[0,0],[.01943,0]],uv=[[.721316,0],[0,0],[-.00881625,-.00617325]];function hv(t,n){var t=d(av(t)).rotate(n).clipAngle(90),e=S1(n),i=t.center;return delete t.rotate,t.center=function(t){return arguments.length?i(e(t)):e.invert(i())},t}var cv=I(6),gv=I(7);function dv(t,n){n=j(7*F(n)/(3*cv));return[cv*t*(2*P(2*n/3)-1)/gv,9*F(n/3)/gv]}function fv(t,n){for(var e,i=(1+cm)*F(n),a=n,r=0;r<25&&(a-=e=(F(a/2)+F(a)-i)/(.5*P(a/2)+P(a)),!(N(e)<L));r++);return[t*(1+2*P(a)/P(a/2))/(3*gm),2*I(3)*F(a/2)/I(2+gm)]}function pv(t,n){for(var e,i=I(6/(4+O)),a=(1+O/4)*F(n),r=n/2,o=0;o<25&&(r-=e=(r/2+F(r)-a)/(.5+P(r)),!(N(e)<L));o++);return[i*(.5+P(r))*t/1.5,i*r]}function _v(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 mv(t,n){return[t*(1+P(n))/2,2*(n-g(n/2))]}dv.invert=function(t,n){n=3*j(n*gv/9);return[t*gv/(cv*(2*P(2*n/3)-1)),j(3*F(n)*cv/7)]},fv.invert=function(t,n){var n=n*I(2+gm)/(2*I(3)),e=2*j(n);return[3*gm*t/(1+2*P(e)/P(e/2)),j((n+F(e))/(1+cm))]},pv.invert=function(t,n){var e=I(6/(4+O)),n=n/e;return N(N(n)-R)<L&&(n=n<0?-R:R),[1.5*t/(e*(.5+P(n))),j((n/2+F(n))/(1+O/4))]},_v.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)),N(e)>um&&0<--o;);return[t/(.84719-.13063*(i=r*r)+(t=i*(a=i*i))*t*(.05494*i-.04515-.02326*a+.00331*t)),r]},mv.invert=function(t,n){for(var e=n/2,i=0,a=1/0;i<10&&N(a)>L;++i){var r=P(n/2);n-=a=(n-g(n/2)-e)/(1-.5/(r*r))}return[2*t/(1+P(n)),n]};var yv=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];
|
|
5280
5280
|
// Based on Torben Jansen's implementation
|
|
5281
5281
|
// https://beta.observablehq.com/@toja/nicolosi-globular-projection
|
|
5282
5282
|
// https://beta.observablehq.com/@toja/nicolosi-globular-inverse
|
|
5283
|
-
function vv(t,n){var e,i,a,r,o,s=
|
|
5283
|
+
function vv(t,n){var e,i,a,r,o,s=F(n),l=P(n),u=y(t);return 0===t||N(n)===R?[0,n]:0===n?[t,0]:N(t)===R?[t*l,R*s]:(o=(r=((i=(a=(1-(a=2*n/O)*a)/(s-a))*a)*s/(e=(t=O/(2*t)-2*t/O)*t)+a/2)/(o=1+i/e))*r-(i*s*s/e+a*s-1)/o,[R*((a=(t*s/a-t/2)/(s=1+e/i))+I(a*a+l*l/s)*u),R*(r+I(o<0?0:o)*y(-n*t)*u)])}vv.invert=function(t,n){var e=(t/=R)*t,i=e+(n/=R)*n,a=O*O;return[t?(i-1+I((1-i)*(1-i)+4*e))/(2*t)*R:0,Em(function(t){return i*(O*F(t)-2*t)*O+4*t*t*(n-F(t))+2*O*t-a*n},0)]};
|
|
5284
5284
|
// Based on Java implementation by Bojan Savric.
|
|
5285
5285
|
// https://github.com/OSUCartography/JMapProjLib/blob/master/src/com/jhlabs/map/proj/PattersonProjection.java
|
|
5286
|
-
var bv=1.0148,xv=.23185,wv=-.14499,Sv=.02406,Cv=1.790857183;function kv(t,n){var e=n*n;return[t,n*(bv+e*e*(xv+e*(wv+Sv*e)))]}function Av(t,n){var e;return N(n)<
|
|
5286
|
+
var bv=1.0148,xv=.23185,wv=-.14499,Sv=.02406,Cv=1.790857183;function kv(t,n){var e=n*n;return[t,n*(bv+e*e*(xv+e*(wv+Sv*e)))]}function Av(t,n){var e;return N(n)<L?[t,0]:(e=g(n),t=t*F(n),[F(t)/e,n+(1-P(t))/e])}
|
|
5287
5287
|
// Note: 6-element arrays are used to denote the 3x3 affine transform matrix:
|
|
5288
5288
|
// [a, b, c,
|
|
5289
5289
|
// d, e, f,
|
|
5290
5290
|
// 0, 0, 1] - this redundant row is left out.
|
|
5291
5291
|
// Transform matrix for [a0, a1] -> [b0, b1].
|
|
5292
|
-
function Mv(t,n){var e=Tv(t[1],t[0]),i=Tv(n[1],n[0]),a=b(e[0]*i[1]-e[1]*i[0],e[0]*i[0]+e[1]*i[1]),e=Bv(e)/Bv(i);return zv([1,0,t[0][0],0,1,t[0][1]],zv([e,0,0,0,e,0],zv([P(a),
|
|
5292
|
+
function Mv(t,n){var e=Tv(t[1],t[0]),i=Tv(n[1],n[0]),a=b(e[0]*i[1]-e[1]*i[0],e[0]*i[0]+e[1]*i[1]),e=Bv(e)/Bv(i);return zv([1,0,t[0][0],0,1,t[0][1]],zv([e,0,0,0,e,0],zv([P(a),F(a),0,-F(a),P(a),0],[1,0,-n[0][0],0,1,-n[0][1]])))}
|
|
5293
5293
|
// Inverts a transform matrix.
|
|
5294
5294
|
function Ev(t){var n=1/(t[0]*t[4]-t[1]*t[3]);return[n*t[4],-n*t[1],n*(t[1]*t[5]-t[2]*t[4]),-n*t[3],n*t[0],n*(t[2]*t[3]-t[0]*t[5])]}
|
|
5295
5295
|
// Multiplies two 3x2 matrices.
|
|
@@ -5307,29 +5307,29 @@ function Bv(t){return I(t[0]*t[0]+t[1]*t[1])}
|
|
|
5307
5307
|
function Dv(a,i){function t(t,n){var e=i(t,n),t=e.project([t*m,n*m]);return(n=e.transform)?[n[0]*t[0]+n[1]*t[1]+n[2],-(n[3]*t[0]+n[4]*t[1]+n[5])]:(t[1]=-t[1],t)}
|
|
5308
5308
|
// Naive inverse! A faster solution would use bounding boxes, or even a
|
|
5309
5309
|
// polygonal quadtree.
|
|
5310
|
-
function h(t){return i(t[0]*x,t[1]*x)}!function n(e,t){e.edges=
|
|
5310
|
+
function h(t){return i(t[0]*x,t[1]*x)}!function n(e,t){e.edges=Fv(e.face);
|
|
5311
5311
|
// Find shared edge.
|
|
5312
|
-
if(t.face){for(var i=e.shared=Pv(e.face,t.face),a=Mv(i.map(t.project),i.map(e.project)),r=(e.transform=t.transform?zv(t.transform,a):a,t.edges),o=0,s=r.length;o<s;++o)Nv(i[0],r[o][1])&&Nv(i[1],r[o][0])&&(r[o]=e),Nv(i[0],r[o][0])&&Nv(i[1],r[o][1])&&(r[o]=e);for(r=e.edges,o=0,s=r.length;o<s;++o)Nv(i[0],r[o][0])&&Nv(i[1],r[o][1])&&(r[o]=t),Nv(i[0],r[o][1])&&Nv(i[1],r[o][0])&&(r[o]=t)}else e.transform=t.transform;e.children&&e.children.forEach(function(t){n(t,e)});return e}(a,{transform:null}),
|
|
5312
|
+
if(t.face){for(var i=e.shared=Pv(e.face,t.face),a=Mv(i.map(t.project),i.map(e.project)),r=(e.transform=t.transform?zv(t.transform,a):a,t.edges),o=0,s=r.length;o<s;++o)Nv(i[0],r[o][1])&&Nv(i[1],r[o][0])&&(r[o]=e),Nv(i[0],r[o][0])&&Nv(i[1],r[o][1])&&(r[o]=e);for(r=e.edges,o=0,s=r.length;o<s;++o)Nv(i[0],r[o][0])&&Nv(i[1],r[o][1])&&(r[o]=t),Nv(i[0],r[o][1])&&Nv(i[1],r[o][0])&&(r[o]=t)}else e.transform=t.transform;e.children&&e.children.forEach(function(t){n(t,e)});return e}(a,{transform:null}),Lv(a)&&(t.invert=function(t,n){t=function t(n,e){var i=n.project.invert,a=n.transform,r=e;a&&(a=Ev(a),r=[a[0]*r[0]+a[1]*r[1]+a[2],a[3]*r[0]+a[4]*r[1]+a[5]]);if(i&&n===h(o=i(r)))return o;var o,s=n.children;for(var l=0,u=s&&s.length;l<u;++l)if(o=t(s[l],e))return o}(a,[t,-n]);return t&&(t[0]*=x,t[1]*=x,t)});var r=d(t),o=r.stream;return 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(){i.polygonStart(),i.lineStart(),function t(n,e,i){var a,r,o=e.edges,s=o.length,l={type:"MultiPoint",coordinates:e.face},u=e.face.filter(function(t){return 90!==N(t[1])}),u=i1({type:"MultiPoint",coordinates:u}),h=!1,c=-1,g=u[1][0]-u[0][0];
|
|
5313
5313
|
// TODO
|
|
5314
5314
|
var d=180==g||360==g?[(u[0][0]+u[1][0])/2,(u[0][1]+u[1][1])/2]:p1(l);
|
|
5315
5315
|
// First find the shared edge…
|
|
5316
|
-
if(i)for(;++c<s&&o[c]!==i;);++c;for(var f=0;f<s;++f)r=o[(f+c)%s],Array.isArray(r)?(h||(n.point((a=cp(r[0],d)(
|
|
5316
|
+
if(i)for(;++c<s&&o[c]!==i;);++c;for(var f=0;f<s;++f)r=o[(f+c)%s],Array.isArray(r)?(h||(n.point((a=cp(r[0],d)(L))[0],a[1]),h=!0),n.point((a=cp(r[1],d)(L))[0],a[1])):(h=!1,r!==i&&t(n,r,e))}
|
|
5317
5317
|
// Tests equality of two spherical points.
|
|
5318
5318
|
(i,a),i.lineEnd(),i.polygonEnd()},e},r.angle(-30)}function Nv(t,n){return t&&n&&t[0]===n[0]&&t[1]===n[1]}
|
|
5319
5319
|
// Finds a shared edge given two clockwise polygons.
|
|
5320
5320
|
function Pv(t,n){for(var e,i=t.length,a=null,r=0;r<i;++r)for(var o=t[r],s=n.length;0<=--s;)if(e=n[s],o[0]===e[0]&&o[1]===e[1]){if(a)return[a,o];a=o}}
|
|
5321
5321
|
// Converts an array of n face vertices to an array of n + 1 edges.
|
|
5322
|
-
function
|
|
5322
|
+
function Fv(t){for(var n=t.length,e=[],i=t[n-1],a=0;a<n;++a)e.push([i,i=t[a]]);return e}function Lv(t){return t.project.invert||t.children&&t.children.some(Lv)}
|
|
5323
5323
|
// TODO generate on-the-fly to avoid external modification.
|
|
5324
|
-
kv.invert=function(t,n){Cv<n?n=Cv:n<-1.790857183&&(n=-1.790857183);var e=n;do{var i=e*e}while(e-=i=(e*(bv+i*i*(xv+i*(wv+Sv*i)))-n)/(1.0148+i*i*(1.1592500000000001+i*(.21654*i-1.01493))),N(i)>
|
|
5324
|
+
kv.invert=function(t,n){Cv<n?n=Cv:n<-1.790857183&&(n=-1.790857183);var e=n;do{var i=e*e}while(e-=i=(e*(bv+i*i*(xv+i*(wv+Sv*i)))-n)/(1.0148+i*i*(1.1592500000000001+i*(.21654*i-1.01493))),N(i)>L);return[t,e]},Av.invert=function(t,n){if(N(n)<L)return[t,0];var e=t*t+n*n,i=.5*n,a=10;do{var r=g(i),o=1/P(i),s=e-2*n*i+i*i}while(i-=s=(r*s+2*(i-n))/(2+s*o*o+2*(i-n)*r),N(s)>L&&0<--a);return r=g(i),[(N(n)<N(i+1/r)?j(t*r):y(n)*y(t)*(pm(N(t*r))+R))/F(i),i]};var Ov=[[0,90],[-90,0],[0,0],[90,0],[180,0],[0,-90]],Rv=[[0,2,1],[0,3,2],[5,1,2],[5,2,3],[0,1,4],[0,4,3],[5,4,1],[5,3,4]].map(function(t){return t.map(function(t){return Ov[t]})});var jv=2/I(3);function Iv(t,n){t=Um(t,n);return[t[0]*jv,t[1]]}function Hv(t,n){for(var e=0,i=t.length,a=0;e<i;++e)a+=t[e]*n[e];return a}
|
|
5325
5325
|
// Converts 3D Cartesian to spherical coordinates (degrees).
|
|
5326
5326
|
function Gv(t){return[b(t[1],t[0])*m,j(rm(-1,om(1,t[2])))*m]}
|
|
5327
5327
|
// Converts spherical coordinates (degrees) to 3D Cartesian.
|
|
5328
|
-
function Kv(t){var n=t[0]*x,t=t[1]*x,e=P(t);return[e*P(n),e*
|
|
5328
|
+
function Kv(t){var n=t[0]*x,t=t[1]*x,e=P(t);return[e*P(n),e*F(n),F(t)]}Iv.invert=function(t,n){return Um.invert(t/jv,n)};_n=()=>{};function $v(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return qv(t,n)})}}function qv(t,n){return{type:"Feature",id:t.id,properties:t.properties,geometry:Uv(t.geometry,n)}}function Uv(t,n){if(!t)return null;if("GeometryCollection"===t.type)return e=n,{type:"GeometryCollection",geometries:t.geometries.map(function(t){return Uv(t,e)})};var e,i;switch(t.type){case"Point":case"MultiPoint":i=Vv;break;case"LineString":case"MultiLineString":i=Zv;break;case"Polygon":case"MultiPolygon":case"Sphere":i=Xv;break;default:return null}return J0(t,n(i)),i.result()}var Wv=[],Yv=[],Vv={point:function(t,n){Wv.push([t,n])},result:function(){var t=Wv.length?Wv.length<2?{type:"Point",coordinates:Wv[0]}:{type:"MultiPoint",coordinates:Wv}:null;return Wv=[],t}},Zv={lineStart:_n,point:function(t,n){Wv.push([t,n])},lineEnd:function(){Wv.length&&(Yv.push(Wv),Wv=[])},result:function(){var t=Yv.length?Yv.length<2?{type:"LineString",coordinates:Yv[0]}:{type:"MultiLineString",coordinates:Yv}:null;return Yv=[],t}},Xv={polygonStart:_n,lineStart:_n,point:function(t,n){Wv.push([t,n])},lineEnd:function(){var t=Wv.length;if(t){for(;Wv.push(Wv[0].slice()),++t<4;);Yv.push(Wv),Wv=[]}},polygonEnd:_n,result:function(){var i,n;return Yv.length&&(i=[],n=[],
|
|
5329
5329
|
// https://github.com/d3/d3/issues/1558
|
|
5330
|
-
Yv.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],u=l[0],l=l[1],h=t[s],c=h[0],h=h[1];i<l^i<h&&e<(c-u)*(i-l)/(h-l)+u&&(a=!a)}return a})(t[0],e))return t.push(n),!0})||i.push([n])}),Yv=[],i.length)?1<i.length?{type:"MultiPolygon",coordinates:i}:{type:"Polygon",coordinates:i[0]}:null}};function Jv(s){var l=s(R,0)[0]-s(-R,0)[0];function t(t,n){var e,i=N(t)<R,t=s(i?t:0<t?t-O:t+O,n),n=(t[0]-t[1])*cm,t=(t[0]+t[1])*cm;return i?[n,t]:(i=l*cm,[(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)*cm,r=(n-t)*cm,o=N(a)<.5*l&&N(r)<.5*l,n=(o||(a=(-(e=-(i=0<a^0<r?-1:1)*t+(0<r?1:-1)*(t=l*cm))-(i=-i*n+(0<a?1:-1)*t))*cm,r=(e-i)*cm),s.invert(a,r));return o||(n[0]+=0<a?O:-O),n}),d(t).rotate([-90,-90,45]).clipAngle(179.999)}function Qv(l){var u=
|
|
5330
|
+
Yv.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],u=l[0],l=l[1],h=t[s],c=h[0],h=h[1];i<l^i<h&&e<(c-u)*(i-l)/(h-l)+u&&(a=!a)}return a})(t[0],e))return t.push(n),!0})||i.push([n])}),Yv=[],i.length)?1<i.length?{type:"MultiPolygon",coordinates:i}:{type:"Polygon",coordinates:i[0]}:null}};function Jv(s){var l=s(R,0)[0]-s(-R,0)[0];function t(t,n){var e,i=N(t)<R,t=s(i?t:0<t?t-O:t+O,n),n=(t[0]-t[1])*cm,t=(t[0]+t[1])*cm;return i?[n,t]:(i=l*cm,[(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)*cm,r=(n-t)*cm,o=N(a)<.5*l&&N(r)<.5*l,n=(o||(a=(-(e=-(i=0<a^0<r?-1:1)*t+(0<r?1:-1)*(t=l*cm))-(i=-i*n+(0<a?1:-1)*t))*cm,r=(e-i)*cm),s.invert(a,r));return o||(n[0]+=0<a?O:-O),n}),d(t).rotate([-90,-90,45]).clipAngle(179.999)}function Qv(l){var u=F(l);function t(t,n){var e,i,t=u?g(t*u/2)/u:t/2;return n?(e=2*nm(t*F(n)),i=1/g(n),[F(e)*i,n+(1-P(e))*i-l]):[2*t,-l]}
|
|
5331
5331
|
// TODO return null for points outside outline.
|
|
5332
|
-
return t.invert=function(t,n){if(N(n+=l)<
|
|
5332
|
+
return t.invert=function(t,n){if(N(n+=l)<L)return[u?2*nm(u*t/2)/u:t,0];var e=t*t+n*n,i=0,a=10;do{var r=g(i),o=1/P(i),s=e-2*n*i+i*i}while(i-=s=(r*s+2*(i-n))/(2+s*o*o+2*(i-n)*r),N(s)>L&&0<--a);t*=r=g(i),t=g(N(n)<N(i+1/r)?.5*j(t):.5*pm(t)+O/4)/F(i);return[u?2*nm(u*t)/u:2*t,i]},t}var t2=[[.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 n2(t,n){var e=om(18,36*N(n)/O),i=im(e),e=e-i,a=(l=t2[i])[0],r=l[1],o=(l=t2[++i])[0],s=l[1],i=(l=t2[om(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 e2(i,t){a=i,n.invert=function(t,n){var e=t*t+n*n,i=I(e),e=(a-I(1-e*(a+1)/(a-1)))/((a-1)/i+i/(a-1));return[b(t*e,i*I(1-e*e)),i?j(n*e/i):0]};var a,r,o,s=n;function n(t,n){var e=P(n),i=(a-1)/(a-e*P(t));return[i*e*F(t),i*F(n)]}return t?(r=P(t),o=F(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]}}t2.forEach(function(t){t[1]*=1.593415793900743}),n2.invert=function(t,n){var e=om(18,N((g=90*n)/5)),i=rm(0,im(e));do{var a=t2[i][1],r=t2[i+1][1],o=t2[om(19,i+2)][1],s=o-a,l=o-2*r+a,u=2*(N(n)-r)/s,l=l/s,h=u*(1-l*u*(1-2*l*u));if(0<=h||1===i){for(var c,g=(0<=n?5:-5)*(h+e),d=50;h=(e=om(18,N(g)/5))-(i=im(e)),a=t2[i][1],r=t2[i+1][1],o=t2[om(19,i+2)][1],g-=(c=y(n)*(r+h*(o-a)/2+h*h*(o-2*r+a)/2)-n)*m,N(c)>um&&0<--d;);break}}while(0<=--i);var f=t2[i][0],p=t2[i+1][0],_=t2[om(19,i+2)][0];return[t/(p+h*(_-f)/2+h*h*(_-2*p+f)/2),g*x]};var i2=1e4,a2=-180,r2=a2+1e-4,o2=180,s2=o2-1e-4,l2=-90,u2=l2+1e-4,h2=90,c2=h2-1e-4;function g2(t){return 0<t.length}function d2(t){return t===l2||t===h2?[0,t]:[a2,Math.floor(t*i2)/i2];// pole or antimeridian?
|
|
5333
5333
|
}function f2(t){var n=t[0],e=t[1],i=!1;return n<=r2?(n=a2,i=!0):s2<=n&&(n=o2,i=!0),e<=u2?(e=l2,i=!0):c2<=e&&(e=h2,i=!0),i?[n,e]:t}function p2(t){return t.map(f2)}
|
|
5334
5334
|
// For each ring, detect where it crosses the antimeridian or pole.
|
|
5335
5335
|
function _2(t,n,e){for(var i=0,a=t.length;i<a;++i){var r=t[i].slice();
|
|
@@ -5368,36 +5368,36 @@ t[i.index]=null,n={index:-1,polygon:i.polygon,ring:i.ring.concat(n.ring)},i===r?
|
|
|
5368
5368
|
// Connect both ends to this single fragment to create a ring.
|
|
5369
5369
|
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
|
|
5370
5370
|
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
|
|
5371
|
-
n.polygon.push(n.ring)))}function y2(t){var n={type:"Feature",geometry:v2(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 v2(t){if(null==t)return t;var n;switch(t.type){case"GeometryCollection":n={type:"GeometryCollection",geometries:t.geometries.map(v2)};break;case"Point":n={type:"Point",coordinates:f2(t.coordinates)};break;case"MultiPoint":case"LineString":n={type:t.type,coordinates:p2(t.coordinates)};break;case"MultiLineString":n={type:"MultiLineString",coordinates:t.coordinates.map(p2)};break;case"Polygon":var e=[];_2(t.coordinates,e,i=[]),m2(i),n={type:"Polygon",coordinates:e};break;case"MultiPolygon":for(var i=[],a=-1,r=t.coordinates.length,o=new Array(r);++a<r;)_2(t.coordinates[a],o[a]=[],i);m2(i),n={type:"MultiPolygon",coordinates:o.filter(g2)};break;default:return t}return null!=t.bbox&&(n.bbox=t.bbox),n}function b2(t,n){var n=g(n/2),e=
|
|
5371
|
+
n.polygon.push(n.ring)))}function y2(t){var n={type:"Feature",geometry:v2(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 v2(t){if(null==t)return t;var n;switch(t.type){case"GeometryCollection":n={type:"GeometryCollection",geometries:t.geometries.map(v2)};break;case"Point":n={type:"Point",coordinates:f2(t.coordinates)};break;case"MultiPoint":case"LineString":n={type:t.type,coordinates:p2(t.coordinates)};break;case"MultiLineString":n={type:"MultiLineString",coordinates:t.coordinates.map(p2)};break;case"Polygon":var e=[];_2(t.coordinates,e,i=[]),m2(i),n={type:"Polygon",coordinates:e};break;case"MultiPolygon":for(var i=[],a=-1,r=t.coordinates.length,o=new Array(r);++a<r;)_2(t.coordinates[a],o[a]=[],i);m2(i),n={type:"MultiPolygon",coordinates:o.filter(g2)};break;default:return t}return null!=t.bbox&&(n.bbox=t.bbox),n}function b2(t,n){var n=g(n/2),e=F(hm*n);return[t*(.74482-.34588*e*e),1.70711*n]}
|
|
5372
5372
|
// Compute the origin as the midpoint of the two reference points.
|
|
5373
5373
|
// Rotate one of the reference points by the origin.
|
|
5374
5374
|
// Apply the spherical law of sines to compute gamma rotation.
|
|
5375
|
-
function x2(t,n,e){var e=cp(n,e),i=e(.5),n=S1([-i[0],-i[1]])(n),e=e.distance/2,a=-j(
|
|
5375
|
+
function x2(t,n,e){var e=cp(n,e),i=e(.5),n=S1([-i[0],-i[1]])(n),e=e.distance/2,a=-j(F(n[1]*x)/F(e)),i=[-i[0],-i[1],-(0<n[0]?O-a:a)*m],n=d(t(e)).rotate(i),r=S1(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 w2(t){var e=P(t);function n(t,n){t=Y_(t,n);return t[0]*=e,t}return n.invert=function(t,n){return Y_.invert(t/e,n)},n}function S2(t,n){return x2(w2,t,n)}function C2(i){var r,o,a,s,l;return(i*=2)?(a=i*i,s=g(o=-(r=-i/2)),l=.5/F(o),t.invert=function(t,n){var e,i=n*n,a=P(I(i+(e=t+r)*e)),i=P(I(i+(e=t+o)*e));return[b(t=a-i,e=(a+i)*s),(n<0?-1:1)*pm(I(e*e+t*t)*l)]},t):P_;function t(t,n){var e=pm(P(n)*P(t-r)),t=pm(P(n)*P(t-o));return[((e*=e)-(t*=t))/(2*i),(n<0?-1:1)*I(4*a*t-(a-e+t)*(a-e+t))/(2*i)]}}function k2(t,n){return x2(C2,t,n)}function A2(t,n){var e,i,a,r,o,s,l,u;return N(n)<L?[t,0]:(a=j(r=N(n/R)),N(t)<L||N(N(n)-R)<L?[0,y(n)*O*g(a/2)]:(s=(o=(r=(a=(a=P(a))/(r+a-1))*(2/r-1))*r)+(i=(e=N(O/t-t/O)/2)*e),l=a-o,u=i+a,[y(t)*O*(e*l+I(i*l*l-s*(a*a-o)))/s,y(n)*O*(r*u-e*I((1+i)*s-u*u))/s]))}function M2(t,n){var e,i,a,r;return N(n)<L?[t,0]:(r=j(e=N(n/R)),N(t)<L||N(N(n)-R)<L?[0,y(n)*O*g(r/2)]:(r=(r=P(r))*(I(1+(a=(i=N(O/t-t/O)/2)*i))-i*r)/(1+a*e*e),[y(t)*O*r,y(n)*O*I(1-r*(2*i+r))]))}function E2(t,n){var e,i;return N(n)<L?[t,0]:(e=j(i=n/R),N(t)<L||N(N(n)-R)<L?[0,O*g(e/2)]:(n=(O/t-t/O)/2,i=i/(1+P(e)),[O*(y(t)*I(n*n+1-i*i)-n),O*i]))}function z2(t,n){var e,i,a,r,o,s,l;return n?(r=N(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(N(t)-R)*I(o*o-4))*(a+e-1)+2*I(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*I(1+o*N(l)-l*l)]):[0,n]):[t,0]}function T2(t,n,e,i){
|
|
5376
5376
|
// 60 is always used as reference parallel
|
|
5377
5377
|
var a,r,o,s,l,u=O/3,e=(
|
|
5378
5378
|
// sanitizing the input values
|
|
5379
5379
|
// poleline and parallels may approximate but never equal 0
|
|
5380
|
-
t=rm(t,
|
|
5380
|
+
t=rm(t,L),n=rm(n,L),
|
|
5381
5381
|
// poleline must be <= 90; parallels may approximate but never equal 180
|
|
5382
|
-
t=om(t,R),n=om(n,O-
|
|
5382
|
+
t=om(t,R),n=om(n,O-L),
|
|
5383
5383
|
// 0 <= inflation <= 99.999
|
|
5384
|
-
e=rm(e,0),(e=om(e,100-
|
|
5384
|
+
e=rm(e,0),(e=om(e,100-L))/100+1),i=(
|
|
5385
5385
|
// ratio > 0.
|
|
5386
5386
|
// sensible values, i.e. something that renders a map which still can be
|
|
5387
5387
|
// recognized as world map, are e.g. 20 <= ratio <= 1000.
|
|
5388
|
-
i=rm(i,
|
|
5388
|
+
i=rm(i,L))/100,e=pm(e*P(u))/u,u=F(t)/F(e*R),h=n/O,i=I(i*F(t/2)/F(n/2)),t=i/I(h*u*e),n=1/(i*I(h*u*e));return a=t,r=n,o=u,s=e,l=h,c.invert=function(t,n){var e=t/a,i=n/r,e=I(e*e+i*i),i=2*j(e/2);return[b(t*g(i),a*e)/l,e&&j(n*F(i)/(r*o*e))/s]},c;function c(t,n){var n=o*F(s*n),e=I(1-n*n),i=I(2/(1+e*P(t*=l)));return[a*e*i*F(t),r*n*i]}}function B2(){
|
|
5389
5389
|
// default values generate wagner8
|
|
5390
|
-
var n=65*x,e=60*x,i=20,a=200,r=A_(T2),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)}b2.invert=function(t,n){var n=n/1.70711,e=
|
|
5390
|
+
var n=65*x,e=60*x,i=20,a=200,r=A_(T2),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)}b2.invert=function(t,n){var n=n/1.70711,e=F(hm*n);return[t/(.74482-.34588*e*e),2*nm(n)]},A2.invert=function(t,n){var e,i,a,r,o,s,l,u;return N(n)<L?[t,0]:N(t)<L?[0,R*F(2*nm(n/O))]:(r=(a=(e=(t/=O)*t)+(i=(n/=O)*n))*a,u=pm(3*(i/(s=-2*(l=-N(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*I(-l/3))))/3,[O*(a-1+I(1+2*(e-i)+r))/(2*t),y(n)*O*(-l*P(u+O/3)-o/(3*s))])},M2.invert=function(t,n){var e,i,a;return t?(a=I(1+(i=(1-(e=N(t/O))*e-(n/=O)*n)/(2*e))*i),[y(t)*O*(a-i),y(n)*R*F(2*b(I((1-2*i*e)*(i+a)-e),I(a+i+e)))]):[0,R*F(2*nm(n/O))]},E2.invert=function(t,n){var e;return n?(e=(O*O*(1-(n=n/O)*n)-t*t)/(2*O*t),[t?O*(y(t)*I(e*e+1)-e):0,R*F(2*nm(n))]):[t,0]},z2.invert=function(t,n){if(!t||!n)return[t,n];var e=y(n),i=(n=N(n)/O,y(t)*t/R),a=(i*i-1+4*n*n)/N(i),r=a*a,o=n*(2-(.5<n?om(n,N(t)):0)),s=t*t+n*n,l=50;do{var u=o*o,h=(8*o-u*(2+u)-5)/(2*u*(o-1)),c=(3*o-u*o-10)/(2*u*o),g=h*h,d=o*h,f=o+h,p=f*f,_=o+3*h,m=-2*f*(4*d*g+(1-4*u+3*u*u)*(1+c)+g*(14*u-6-r+(8*u-8-2*r)*c)+d*(12*u-8+(10*u-10-r)*c)),u=I(p*(u+g*r-1)+(1-u)*(u*(_*_+4*g)+g*(12*d+4*g)))}while(o-=_=(a*(p+g-1)+2*u-i*(4*p+r))/(a*(2*h*c+2*f*(1+c))+m/u-8*f*(a*(g-1+p)+2*u)*(1+c)/(r+4*p)),L<_*s*s&&0<--l);return[y(t)*(I(a*a+4)+a)*O/4,e*R*o]};var ri=4*O+3*I(3),gr=2*I(2*O*I(3)/ri),D2=Dm(gr*I(3)/O,gr,ri/6);function N2(t,n){return[t*I(1-3*n*n/(O*O)),n]}function P2(t,n){var e=P(n),i=P(t)*e,a=1-i,n=P(t=b(F(t)*e,-F(n))),t=F(t);return[t*(e=I(1-i*i))-n*a,-n*e-t*a]}function F2(t,n){var e=vm(t,n);return[(e[0]+t/R)/2,(e[1]+n)/2]}N2.invert=function(t,n){return[t/I(1-3*n*n/(O*O)),n]},P2.invert=function(t,n){var e=(t*t+n*n)/-2,i=I(-e*(2+e)),a=n*e+t*i,t=t*e-n*i,n=I(t*t+a*a);return[b(i*a,n*(1+e)),n?-j(i*t/n):0]},F2.invert=function(t,n){var e=t,i=n,a=25;do{var r,o=P(i),s=F(i),l=F(2*i),u=s*s,h=o*o,c=F(e),g=P(e/2),d=F(e/2),f=d*d,p=1-h*g*g,p=p?pm(o*g)*I(r=1/p):r=0,_=.5*(2*p*o*d+e/R)-t,m=.5*(p*s+i)-n,y=.5*r*(h*f+p*o*g*u)+.5/R,v=r*(c*l/4-p*s*d),l=.125*r*(l*d-p*s*h*c),d=.5*r*(u*g+p*f*o)+.5,s=v*l-d*y,h=(m*v-_*d)/s,c=(_*l-m*y)/s}while(e-=h,i-=c,(N(h)>L||N(c)>L)&&0<--a);return[e,i]};var L2=Object.freeze({__proto__:null,geoAiry:function(){var n=R,e=A_(ym),t=e(n);return t.radius=function(t){return arguments.length?e(n=t*x):n*m},t.scale(179.976).clipAngle(147)},geoAiryRaw:ym,geoAitoff:function(){return d(vm).scale(152.63)},geoAitoffRaw:vm,geoArmadillo:function(){var r=20*x,o=0<=r?1:-1,s=g(o*r),n=A_(bm),l=n(r),u=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=u(t),i=(l.rotate([0,0]),u(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(P(t*x/2),s)*m);i.lineEnd(),i.polygonEnd()},e},l.scale(218.695).center([0,28.0974])},geoArmadilloRaw:bm,geoAugust:function(){return d(xm).scale(66.1603)},geoAugustRaw:xm,geoBaker:function(){return d(Cm).scale(112.314)},geoBakerRaw:Cm,geoBerghaus:function(){var o=5,n=A_(km),i=n(o),a=i.stream,s=-P(.01*x),l=F(.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*O/o,i=90-180/o,a=R;t<o;++t,i-=n,a-=e)r.point(b(l*P(a),s)*m,j(l*F(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:km,geoBertin1953:function(){
|
|
5391
5391
|
// this projection should not be rotated
|
|
5392
|
-
return d(Tm()).rotate([-16.5,-42]).scale(176.57).center([7.93,.09])},geoBertin1953Raw:Tm,geoBoggs:function(){return d(
|
|
5393
|
-
},geoCylindricalEqualAreaRaw:Zm,geoCylindricalStereographic:function(){return
|
|
5394
|
-
function e(t){return n(hy(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 cy(n.invert(t))}),e.stream=function(t){var e=n.stream(t),t=i.stream({point:function(t,n){e.point(t/2,j(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(hy(t)),e):cy(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=P(n),o=
|
|
5392
|
+
return d(Tm()).rotate([-16.5,-42]).scale(176.57).center([7.93,.09])},geoBertin1953Raw:Tm,geoBoggs:function(){return d(Fm).scale(160.857)},geoBoggsRaw:Fm,geoBonne:function(){return Lm(Rm).scale(123.082).center([0,26.1441]).parallel(45)},geoBonneRaw:Rm,geoBottomley:function(){var n=.5,e=A_(jm),t=e(n);return t.fraction=function(t){return arguments.length?e(n=+t):n},t.scale(158.837)},geoBottomleyRaw:jm,geoBromley:function(){return d(Im).scale(152.63)},geoBromleyRaw:Im,geoChamberlin:qm,geoChamberlinAfrica:function(){return qm([0,22],[45,22],[22.5,-22]).scale(380).center([22.5,2])},geoChamberlinRaw:Km,geoCollignon:function(){return d(Um).scale(95.6464).center([0,30])},geoCollignonRaw:Um,geoCraig:function(){return Lm(Wm).scale(249.828).clipAngle(90)},geoCraigRaw:Wm,geoCraster:function(){return d(Vm).scale(156.19)},geoCrasterRaw:Vm,geoCylindricalEqualArea:function(){return Lm(Zm).parallel(38.58).scale(195.044);// width / (sqrt(width / height / pi) * 2 * pi)
|
|
5393
|
+
},geoCylindricalEqualAreaRaw:Zm,geoCylindricalStereographic:function(){return Lm(Xm).scale(124.75)},geoCylindricalStereographicRaw:Xm,geoEckert1:function(){return d(Jm).scale(165.664)},geoEckert1Raw:Jm,geoEckert2:function(){return d(Qm).scale(165.664)},geoEckert2Raw:Qm,geoEckert3:function(){return d(ty).scale(180.739)},geoEckert3Raw:ty,geoEckert4:function(){return d(ny).scale(180.739)},geoEckert4Raw:ny,geoEckert5:function(){return d(ey).scale(173.044)},geoEckert5Raw:ey,geoEckert6:function(){return d(iy).scale(173.044)},geoEckert6Raw:iy,geoEisenlohr:function(){return d(ry).scale(62.5271)},geoEisenlohrRaw:ry,geoFahey:function(){return d(sy).scale(137.152)},geoFaheyRaw:sy,geoFoucaut:function(){return d(ly).scale(135.264)},geoFoucautRaw:ly,geoFoucautSinusoidal:function(){var n=.5,e=A_(uy),t=e(n);return t.alpha=function(t){return arguments.length?e(n=+t):n},t.scale(168.725)},geoFoucautSinusoidalRaw:uy,geoGilbert:function(t){var n=(t=null==t?J_:t)(),i=I_().scale(m).precision(0).clipAngle(null).translate([0,0]);// antimeridian cutting
|
|
5394
|
+
function e(t){return n(hy(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 cy(n.invert(t))}),e.stream=function(t){var e=n.stream(t),t=i.stream({point:function(t,n){e.point(t/2,j(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(hy(t)),e):cy(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=P(n),o=F(n),e=A_(gy),s=e(n,a),l=s.stream,u=-P(.01*x),h=F(.01*x);return s.radius=function(t){return arguments.length?(r=P(n=t*x),o=F(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*O/a,e=0;t<a;++t,e-=n)i.point(b(h*P(e),u)*m,j(h*F(e))*m),i.point(b(o*P(e-n/2),r)*m,j(o*F(e-n/2))*m);i.lineEnd(),i.polygonEnd()},e},s.rotate([90,-40]).scale(91.7095).clipAngle(179.999)},geoGingeryRaw:gy,geoGinzburg4:function(){return d(_y).scale(149.995)},geoGinzburg4Raw:_y,geoGinzburg5:function(){return d(my).scale(153.93)},geoGinzburg5Raw:my,geoGinzburg6:function(){return d(yy).scale(130.945)},geoGinzburg6Raw:yy,geoGinzburg8:function(){return d(vy).scale(131.747)},geoGinzburg8Raw:vy,geoGinzburg9:function(){return d(by).scale(131.087)},geoGinzburg9Raw:by,geoGringorten:function(){return d(xy(wy)).scale(239.75)}
|
|
5395
5395
|
// Returns [sn, cn, dn](u + iv|m).
|
|
5396
5396
|
,geoGringortenQuincuncial:function(){return Jv(wy).scale(176.423)},geoGringortenRaw:wy,geoGuyou:function(){return d(xy(ky)).scale(151.496)},geoGuyouRaw:ky,geoHammer:function(){var n=2,e=A_(Am),t=e(n);return t.coefficient=function(t){return arguments.length?e(n=+t):n},t.scale(169.529)},geoHammerRaw:Am,geoHammerRetroazimuthal:function(){var e=0,i=A_(Ay),a=i(e),n=a.rotate,t=a.stream,r=A1();return a.parallel=function(t){var n;return arguments.length?(n=a.rotate(),i(e=t*x).rotate(n)):e*m},
|
|
5397
5397
|
// Temporary hack; see hammerRetroazimuthalRotation.
|
|
5398
|
-
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:Ay,geoHealpix:function(){var a=4,n=A_(Ty),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;J0((t=180/a,n=[].concat(
|
|
5398
|
+
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:Ay,geoHealpix:function(){var a=4,n=A_(Ty),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;J0((t=180/a,n=[].concat(Ft(-180,180+t/2,t).map(By),Ft(180,-180-t/2,-t).map(Dy)),{type:"Polygon",coordinates:[180===t?n.map(Ny):n]}),i)},e},r.scale(239.75)},geoHealpixRaw:Ty,geoHill:function(){var n=1,e=A_(Py),t=e(n);return t.ratio=function(t){return arguments.length?e(n=+t):n},t.scale(167.774).center([0,18.67])},geoHillRaw:Py,geoHomolosine:function(){return d(Ry).scale(152.63)},geoHomolosineRaw:Ry,geoHufnagel:function(){var n=1,e=0,i=45*x,a=2,r=A_(jy),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:jy,geoHyperelliptical:function(){var n=0,e=2.5,i=1.183136,a=A_(Hy),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:Hy,geoInterrupt:Ky,geoInterruptedBoggs:function(){return Ky(Fm,$y).scale(160.857)},geoInterruptedHomolosine:function(){return Ky(Ry,qy).scale(152.63)},geoInterruptedMollweide:function(){return Ky(Nm,Uy).scale(169.529)},geoInterruptedMollweideHemispheres:function(){return Ky(Nm,Wy).scale(169.529).rotate([20,0])},geoInterruptedQuarticAuthalic:function(){return Ky(Am(1/0),yv).rotate([20,0]).scale(152.63)},geoInterruptedSinuMollweide:function(){return Ky(Oy,Yy,zm).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoInterruptedSinusoidal:function(){return Ky(Om,Vy).scale(152.63).rotate([-20,0])},geoKavrayskiy7:function(){return d(Zy).scale(158.837)},geoKavrayskiy7Raw:Zy,geoLagrange:function(){var n=.5,e=A_(Xy),t=e(n);return t.spacing=function(t){return arguments.length?e(n=+t):n},t.scale(124.75)},geoLagrangeRaw:Xy,geoLarrivee:function(){return d(Qy).scale(97.2672)},geoLarriveeRaw:Qy,geoLaskowski:function(){return d(tv).scale(139.98)},geoLaskowskiRaw:tv,geoLittrow:function(){return d(nv).scale(144.049).clipAngle(89.999)},geoLittrowRaw:nv,geoLoximuthal:function(){return Lm(ev).parallel(40).scale(158.837)},geoLoximuthalRaw:ev,geoMiller:function(){return d(iv).scale(108.318)},geoMillerRaw:iv,geoModifiedStereographic:hv,geoModifiedStereographicAlaska:function(){return hv(rv,[152,-64]).scale(1400).center([-160.908,62.4864]).clipAngle(30).angle(7.8)},geoModifiedStereographicGs48:function(){return hv(ov,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])},geoModifiedStereographicGs50:function(){return hv(sv,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])},geoModifiedStereographicLee:function(){return hv(uv,[165,10]).scale(250).clipAngle(130).center([-165,-10])},geoModifiedStereographicMiller:function(){return hv(lv,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)},geoModifiedStereographicRaw:av,geoMollweide:function(){return d(Nm).scale(169.529)},geoMollweideRaw:Nm,geoMtFlatPolarParabolic:function(){return d(dv).scale(164.859)},geoMtFlatPolarParabolicRaw:dv,geoMtFlatPolarQuartic:function(){return d(fv).scale(188.209)},geoMtFlatPolarQuarticRaw:fv,geoMtFlatPolarSinusoidal:function(){return d(pv).scale(166.518)},geoMtFlatPolarSinusoidalRaw:pv,geoNaturalEarth2:function(){return d(_v).scale(175.295)},geoNaturalEarth2Raw:_v,geoNellHammer:function(){return d(mv).scale(152.63)},geoNellHammerRaw:mv,geoNicolosi:function(){return d(vv).scale(127.267)},geoNicolosiRaw:vv,geoPatterson:function(){return d(kv).scale(139.319)},geoPattersonRaw:kv,geoPeirceQuincuncial:function(){return Jv(ky).scale(111.48)},geoPolyconic:function(){return d(Av).scale(103.74)},geoPolyconicRaw:Av,geoPolyhedral:Dv,geoPolyhedralButterfly:function(n){n=n||function(t){t=p1({type:"MultiPoint",coordinates:t});return V_().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var e=Rv.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])}),Dv(e[0],function(t,n){return e[t<-O/2?n<0?6:4:t<0?n<0?2:0:t<O/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=p1({type:"MultiPoint",coordinates:t});return d(Iv).translate([0,0]).scale(1).rotate(0<t[1]?[-t[0],0]:[180-t[0],180])};var e=Rv.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])}),Dv(e[0],function(t,n){return e[t<-O/2?n<0?6:4:t<0?n<0?2:0:t<O/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?p1({type:"MultiPoint",coordinates:t}):t[0];return V_().scale(1).translate([0,0]).rotate([-t[0],-t[1]])};var l=Rv.map(function(t){for(var n,e=t.map(Kv),i=e.length,a=e[i-1],r=[],o=0;o<i;++o)n=e[o],r.push(Gv([.9486832980505138*a[0]+.31622776601683794*n[0],.9486832980505138*a[1]+.31622776601683794*n[1],.9486832980505138*a[2]+.31622776601683794*n[2]]),Gv([.9486832980505138*n[0]+.31622776601683794*a[0],.9486832980505138*n[1]+.31622776601683794*a[1],.9486832980505138*n[2]+.31622776601683794*a[2]])),a=n;return r}),u=[],h=[-1,0,0,1,0,1,4,5],i=(l.forEach(function(t,n){for(var e,i,a=Rv[n],r=a.length,o=u[n]=[],s=0;s<r;++s)l.push([a[s],t[(2*s+2)%(2*r)],t[(2*s+1)%(2*r)]]),h.push(n),o.push((e=Kv(t[(2*s+2)%(2*r)]),i=Kv(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 h.forEach(function(t,n){t=i[t];t&&(t.children||(t.children=[])).push(i[n])}),Dv(i[0],function(t,n){var e=[(e=P(n))*P(t),e*F(t),F(n)];return i[Hv((n=u[t=t<-O/2?n<0?6:4:t<0?n<0?2:0:t<O/2?n<0?3:1:n<0?7:5])[0],e)<0?8+3*t:Hv(n[1],e)<0?8+3*t+1:Hv(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=qv;break;case"FeatureCollection":e=$v;break;default:e=Uv}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:Jv,geoRectangularPolyconic:function(){return Lm(Qv).scale(131.215)},geoRectangularPolyconicRaw:Qv,geoRobinson:function(){return d(n2).scale(152.63)},geoRobinsonRaw:n2,geoSatellite:function(){var n=2,e=0,i=A_(e2),t=i(n,e);
|
|
5399
5399
|
// As a multiple of radius.
|
|
5400
|
-
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(pm(1/n)*m-1e-6)},geoSatelliteRaw:e2,geoSinuMollweide:function(){return d(Oy).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoSinuMollweideRaw:Oy,geoSinusoidal:function(){return d(Om).scale(152.63)},geoSinusoidalRaw:Om,geoStitch:function(t){if(null==t)return t;switch(t.type){case"Feature":return y2(t);case"FeatureCollection":var n={type:"FeatureCollection",features:t.features.map(y2)};return null!=t.bbox&&(n.bbox=t.bbox),n;default:return v2(t)}},geoTimes:function(){return d(b2).scale(146.153)},geoTimesRaw:b2,geoTwoPointAzimuthal:S2,geoTwoPointAzimuthalRaw:w2,geoTwoPointAzimuthalUsa:function(){return S2([-158,21.5],[-77,39]).clipAngle(60).scale(400)},geoTwoPointEquidistant:k2,geoTwoPointEquidistantRaw:C2,geoTwoPointEquidistantUsa:function(){return k2([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)},geoVanDerGrinten:function(){return d(A2).scale(79.4183)},geoVanDerGrinten2:function(){return d(M2).scale(79.4183)},geoVanDerGrinten2Raw:M2,geoVanDerGrinten3:function(){return d(E2).scale(79.4183)},geoVanDerGrinten3Raw:E2,geoVanDerGrinten4:function(){return d(z2).scale(127.16)},geoVanDerGrinten4Raw:z2,geoVanDerGrintenRaw:A2,geoWagner:B2,geoWagner4:function(){return d(D2).scale(176.84)},geoWagner4Raw:D2,geoWagner6:function(){return d(N2).scale(152.63)},geoWagner6Raw:N2,geoWagner7:function(){return B2().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)},geoWagnerRaw:T2,geoWiechel:function(){return d(P2).rotate([0,-90,45]).scale(124.75).clipAngle(179.999)},geoWiechelRaw:P2,geoWinkel3:function(){return d(
|
|
5400
|
+
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(pm(1/n)*m-1e-6)},geoSatelliteRaw:e2,geoSinuMollweide:function(){return d(Oy).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},geoSinuMollweideRaw:Oy,geoSinusoidal:function(){return d(Om).scale(152.63)},geoSinusoidalRaw:Om,geoStitch:function(t){if(null==t)return t;switch(t.type){case"Feature":return y2(t);case"FeatureCollection":var n={type:"FeatureCollection",features:t.features.map(y2)};return null!=t.bbox&&(n.bbox=t.bbox),n;default:return v2(t)}},geoTimes:function(){return d(b2).scale(146.153)},geoTimesRaw:b2,geoTwoPointAzimuthal:S2,geoTwoPointAzimuthalRaw:w2,geoTwoPointAzimuthalUsa:function(){return S2([-158,21.5],[-77,39]).clipAngle(60).scale(400)},geoTwoPointEquidistant:k2,geoTwoPointEquidistantRaw:C2,geoTwoPointEquidistantUsa:function(){return k2([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)},geoVanDerGrinten:function(){return d(A2).scale(79.4183)},geoVanDerGrinten2:function(){return d(M2).scale(79.4183)},geoVanDerGrinten2Raw:M2,geoVanDerGrinten3:function(){return d(E2).scale(79.4183)},geoVanDerGrinten3Raw:E2,geoVanDerGrinten4:function(){return d(z2).scale(127.16)},geoVanDerGrinten4Raw:z2,geoVanDerGrintenRaw:A2,geoWagner:B2,geoWagner4:function(){return d(D2).scale(176.84)},geoWagner4Raw:D2,geoWagner6:function(){return d(N2).scale(152.63)},geoWagner6Raw:N2,geoWagner7:function(){return B2().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)},geoWagnerRaw:T2,geoWiechel:function(){return d(P2).rotate([0,-90,45]).scale(124.75).clipAngle(179.999)},geoWiechelRaw:P2,geoWinkel3:function(){return d(F2).scale(158.837)},geoWinkel3Raw:F2}),G=1e-6;
|
|
5401
5401
|
// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
|
|
5402
5402
|
class O2{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 R2(t){return Array.from(function*(t){for(var n of t)yield*n}(t))}var j2=1e-6,K=Math.PI,I2=K/2,H2=K/4,G2=2*K,K2=180/K,$2=K/180,q2=Math.abs,U2=Math.atan,W2=Math.atan2,Y2=Math.cos,V2=Math.exp,Z2=Math.log,X2=Math.pow,$=Math.sin,J2=Math.sign||function(t){return 0<t?1:t<0?-1:0},Q2=Math.sqrt,t3=Math.tan;function n3(t){return 1<t?I2:t<-1?-I2:Math.asin(t)}function e3(){}function i3(t,n){t&&r3.hasOwnProperty(t.type)&&r3[t.type](t,n)}var a3={Feature:function(t,n){i3(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,i=-1,a=e.length;++i<a;)i3(e[i].geometry,n)}},r3={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){o3(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)o3(e[i],n,0)},Polygon:function(t,n){s3(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,i=-1,a=e.length;++i<a;)s3(e[i],n)},GeometryCollection:function(t,n){for(var e=t.geometries,i=-1,a=e.length;++i<a;)i3(e[i],n)}};function o3(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 s3(t,n){var e=-1,i=t.length;for(n.polygonStart();++e<i;)o3(t[e],n,1);n.polygonEnd()}function l3(t,n){t&&a3.hasOwnProperty(t.type)?a3[t.type](t,n):i3(t,n)}function u3(t){return[W2(t[1],t[0]),n3(t[2])]}function h3(t){var n=t[0],t=t[1],e=Y2(t);return[e*Y2(n),e*$(n),$(t)]}function c3(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function g3(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]]}
|
|
5403
5403
|
// TODO return a
|
|
@@ -5474,19 +5474,19 @@ e=m(o,i),r.point(e[0],e[1],2),r.lineEnd()),o=e):g&&o&&c^a&&(
|
|
|
5474
5474
|
t&s||!(n=m(i,o,!0))||(h=0,c?(r.lineStart(),r.point(n[0][0],n[0][1]),r.point(n[1][0],n[1][1]),r.lineEnd()):(r.point(n[1][0],n[1][1]),r.lineEnd(),r.lineStart(),r.point(n[0][0],n[0][1],3)))),!a||o&&C3(o,i)||r.point(i[0],i[1]),o=i,l=a,s=t},lineEnd:function(){l&&r.lineEnd(),o=null},
|
|
5475
5475
|
// Rejoin first and last segments if there were intersections and the first
|
|
5476
5476
|
// and last points were visible.
|
|
5477
|
-
clean:function(){return h|(u&&l)<<1}}},function(t,n,e,i){var a=i,i=d,r=f,o=e,e=t,s=n;if(r){var l=Y2(i),u=$(i),h=o*r;null==e?(e=i+o*G2,s=i-h/2):(e=w3(l,e),s=w3(l,s),(0<o?e<s:s<e)&&(e+=o*G2));for(var c,g=e;0<o?s<g:g<s;g-=h)c=u3([l,-u*Y2(g),-u*$(g)]),a.point(c[0],c[1])}},c?[0,-d]:[-K,d-K])}var P3=1e9,
|
|
5477
|
+
clean:function(){return h|(u&&l)<<1}}},function(t,n,e,i){var a=i,i=d,r=f,o=e,e=t,s=n;if(r){var l=Y2(i),u=$(i),h=o*r;null==e?(e=i+o*G2,s=i-h/2):(e=w3(l,e),s=w3(l,s),(0<o?e<s:s<e)&&(e+=o*G2));for(var c,g=e;0<o?s<g:g<s;g-=h)c=u3([l,-u*Y2(g),-u*$(g)]),a.point(c[0],c[1])}},c?[0,-d]:[-K,d-K])}var P3=1e9,F3=-1e9;
|
|
5478
5478
|
// TODO Use d3-polygon’s polygonContains here for the ring check?
|
|
5479
5479
|
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
|
|
5480
|
-
function
|
|
5480
|
+
function L3(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 q2(t[0]-m)<j2?0<n?0:3:q2(t[0]-v)<j2?0<n?2:1:q2(t[1]-y)<j2?0<n?1:0:0<n?3:2;// abs(p[1] - y1) < epsilon
|
|
5481
5481
|
}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,u,h,g,d,f,p=i,t=S3(),n={point:e,lineStart:function(){n.point=_,c&&c.push(r=[]);d=!0,g=!1,u=h=NaN}
|
|
5482
5482
|
// TODO rather than special-case polygons, simply handle them separately.
|
|
5483
5483
|
// Ideally, coincident intersection points should be jittered to avoid
|
|
5484
5484
|
// clipping issues.
|
|
5485
5485
|
,lineEnd:function(){a&&(_(o,s),l&&g&&t.rejoin(),a.push(t.result()));n.point=e,g&&p.lineEnd()},polygonStart:
|
|
5486
5486
|
// Buffer geometry within a polygon and then clip it en masse.
|
|
5487
|
-
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],u=l[0],h=l[1];o<s;++o)i=u,a=h,l=r[o],u=l[0],h=l[1],a<=b?b<h&&(h-a)*(m-i)<(u-i)*(b-a)&&++t:h<=b&&(u-i)*(b-a)<(h-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=R2(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&A3(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,u=1,h=n[0]-o,c=n[1]-s,e=e-o;if(h||!(0<e)){if(e/=h,h<0){if(e<l)return;e<u&&(u=e)}else if(0<h){if(u<e)return;l<e&&(l=e)}if(e=a-o,h||!(e<0)){if(e/=h,h<0){if(u<e)return;l<e&&(l=e)}else if(0<h){if(e<l)return;e<u&&(u=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<u&&(u=e)}else if(0<c){if(u<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(u<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<u&&(u=e)}return 0<l&&(t[0]=o+l*h,t[1]=s+l*c),u<1&&(n[0]=o+u*h,n[1]=s+u*c),1}}}}})(e=[u=Math.max(
|
|
5487
|
+
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],u=l[0],h=l[1];o<s;++o)i=u,a=h,l=r[o],u=l[0],h=l[1],a<=b?b<h&&(h-a)*(m-i)<(u-i)*(b-a)&&++t:h<=b&&(u-i)*(b-a)<(h-a)*(m-i)&&--t;return t})(),n=f&&t,e=(a=R2(a)).length;(n||e)&&(i.polygonStart(),n&&(i.lineStart(),w(null,null,1,i),i.lineEnd()),e&&A3(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,u=1,h=n[0]-o,c=n[1]-s,e=e-o;if(h||!(0<e)){if(e/=h,h<0){if(e<l)return;e<u&&(u=e)}else if(0<h){if(u<e)return;l<e&&(l=e)}if(e=a-o,h||!(e<0)){if(e/=h,h<0){if(u<e)return;l<e&&(l=e)}else if(0<h){if(e<l)return;e<u&&(u=e)}if(e=i-s,c||!(0<e)){if(e/=c,c<0){if(e<l)return;e<u&&(u=e)}else if(0<c){if(u<e)return;l<e&&(l=e)}if(e=r-s,c||!(e<0)){if(e/=c,c<0){if(u<e)return;l<e&&(l=e)}else if(0<c){if(e<l)return;e<u&&(u=e)}return 0<l&&(t[0]=o+l*h,t[1]=s+l*c),u<1&&(n[0]=o+u*h,n[1]=s+u*c),1}}}}})(e=[u=Math.max(F3,Math.min(P3,u)),h=Math.max(F3,Math.min(P3,h))],i=[t=Math.max(F3,Math.min(P3,t)),n=Math.max(F3,Math.min(P3,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),u=t,h=n,g=a}return n}}var O3=t=>t,R3=1/0,j3=R3,I3=-R3,H3=I3,G3={point:function(t,n){t<R3&&(R3=t);I3<t&&(I3=t);n<j3&&(j3=n);H3<n&&(H3=n)},lineStart:e3,lineEnd:e3,polygonStart:e3,polygonEnd:e3,result:function(){var t=[[R3,j3],[I3,H3]];return I3=H3=-(j3=R3=1/0),t}};function K3(i){return function(t){var n,e=new $3;for(n in i)e[n]=i[n];return e.stream=t,e}}function $3(){}function q3(t,n,e){var i=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=i&&t.clipExtent(null),l3(e,t.stream(G3)),n(G3.result()),null!=i&&t.clipExtent(i),t}function U3(a,r,t){return q3(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)}$3.prototype={constructor:$3,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 W3=16,Y3=Y2(30*$2);// cos(minimum angular distance)
|
|
5488
5488
|
function V3(t,n){return+n?(M=t,E=n,function(i){var e,a,r,o,s,l,u,h,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
|
|
5489
|
-
function t(t,n){t=M(t,n),i.point(t[0],t[1])}function n(){h=NaN,p.point=_,i.lineStart()}function _(t,n){var e=h3([t,n]),n=M(t,n);z(h,c,u,g,d,f,h=n[0],c=n[1],u=t,g=e[0],d=e[1],f=e[2],W3,i),i.point(h,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=h,r=c,o=g,s=d,l=f,p.point=_}function b(){z(h,c,u,g,d,f,a,r,e,o,s,l,W3,i),p.lineEnd=m,m()}return p}):(e=t,K3({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}}));var e,M,E;function z(t,n,e,i,a,r,o,s,l,u,h,c,g,d){var f,p,_,m,y,v,b,x,w,S,C=o-t,k=s-n,A=C*C+k*k;4*E<A&&g--&&(_=r+c,b=n3(_/=m=Q2((f=i+u)*f+(p=a+h)*p+_*_)),y=q2(q2(_)-1)<j2||q2(e-l)<j2?(e+l)/2:W2(p,f),v=(b=M(y,b))[0],E<(S=k*(x=v-t)-C*(w=(b=b[1])-n))*S/A||.3<q2((C*x+k*w)/A-.5)||i*u+a*h+r*c<Y3)&&(z(t,n,e,i,a,r,v,b,y,f/=m,p/=m,_,g,d),d.point(v,b),z(v,b,y,f,p,_,o,s,l,u,h,c,g,d))}}var Z3,X3=K3({point:function(t,n){this.stream.point(t*$2,n*$2)}});function J3(t,e,i,a,r,n){var o,s,l,u,h,c,g,d,f,p,_,m;return n?(c=Y2(n),n=$(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,u=a,h=r,y.invert=function(t,n){return[(t-s)/o*u,(l-n)/o*h]},y);function y(t,n){return[s+o*(t*=u),l-o*(n*=h)]}function v(t,n){return[g*(t*=a)-d*(n*=r)+e,i-d*t-g*n]}}function Q3(t){return t6(function(){return t})()}function t6(t){var n,i,e,a,r,o,s,l,u,h,c=150,g=480,d=250,f=0,p=0,_=0,m=0,y=0,v=0,b=1,x=1,w=null,S=D3,C=null,k=O3,A=.5;function M(t){return l(t[0]*$2,t[1]*$2)}function E(t){return(t=l.invert(t[0],t[1]))&&[t[0]*K2,t[1]*K2]}function z(){var t=J3(c,0,0,b,x,v).apply(null,n(f,p)),t=J3(c,g-t[0],d-t[1],b,x,v);return i=y3(_,m,y),s=_3(n,t),l=_3(i,s),o=V3(s,A),T()}function T(){return u=h=null,M}return M.stream=function(t){return u&&h===t?u:u=X3((e=i,K3({point:function(t,n){t=e(t,n);return this.stream.point(t[0],t[1])}})(S(o(k(h=t))))));var e},M.preclip=function(t){return arguments.length?(S=t,w=void 0,T()):S},M.postclip=function(t){return arguments.length?(k=t,C=e=a=r=null,T()):k},M.clipAngle=function(t){return arguments.length?(S=+t?N3(w=t*$2):(w=null,D3),T()):w*K2},M.clipExtent=function(t){return arguments.length?(k=null==t?(C=e=a=r=null,O3):
|
|
5489
|
+
function t(t,n){t=M(t,n),i.point(t[0],t[1])}function n(){h=NaN,p.point=_,i.lineStart()}function _(t,n){var e=h3([t,n]),n=M(t,n);z(h,c,u,g,d,f,h=n[0],c=n[1],u=t,g=e[0],d=e[1],f=e[2],W3,i),i.point(h,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=h,r=c,o=g,s=d,l=f,p.point=_}function b(){z(h,c,u,g,d,f,a,r,e,o,s,l,W3,i),p.lineEnd=m,m()}return p}):(e=t,K3({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}}));var e,M,E;function z(t,n,e,i,a,r,o,s,l,u,h,c,g,d){var f,p,_,m,y,v,b,x,w,S,C=o-t,k=s-n,A=C*C+k*k;4*E<A&&g--&&(_=r+c,b=n3(_/=m=Q2((f=i+u)*f+(p=a+h)*p+_*_)),y=q2(q2(_)-1)<j2||q2(e-l)<j2?(e+l)/2:W2(p,f),v=(b=M(y,b))[0],E<(S=k*(x=v-t)-C*(w=(b=b[1])-n))*S/A||.3<q2((C*x+k*w)/A-.5)||i*u+a*h+r*c<Y3)&&(z(t,n,e,i,a,r,v,b,y,f/=m,p/=m,_,g,d),d.point(v,b),z(v,b,y,f,p,_,o,s,l,u,h,c,g,d))}}var Z3,X3=K3({point:function(t,n){this.stream.point(t*$2,n*$2)}});function J3(t,e,i,a,r,n){var o,s,l,u,h,c,g,d,f,p,_,m;return n?(c=Y2(n),n=$(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,u=a,h=r,y.invert=function(t,n){return[(t-s)/o*u,(l-n)/o*h]},y);function y(t,n){return[s+o*(t*=u),l-o*(n*=h)]}function v(t,n){return[g*(t*=a)-d*(n*=r)+e,i-d*t-g*n]}}function Q3(t){return t6(function(){return t})()}function t6(t){var n,i,e,a,r,o,s,l,u,h,c=150,g=480,d=250,f=0,p=0,_=0,m=0,y=0,v=0,b=1,x=1,w=null,S=D3,C=null,k=O3,A=.5;function M(t){return l(t[0]*$2,t[1]*$2)}function E(t){return(t=l.invert(t[0],t[1]))&&[t[0]*K2,t[1]*K2]}function z(){var t=J3(c,0,0,b,x,v).apply(null,n(f,p)),t=J3(c,g-t[0],d-t[1],b,x,v);return i=y3(_,m,y),s=_3(n,t),l=_3(i,s),o=V3(s,A),T()}function T(){return u=h=null,M}return M.stream=function(t){return u&&h===t?u:u=X3((e=i,K3({point:function(t,n){t=e(t,n);return this.stream.point(t[0],t[1])}})(S(o(k(h=t))))));var e},M.preclip=function(t){return arguments.length?(S=t,w=void 0,T()):S},M.postclip=function(t){return arguments.length?(k=t,C=e=a=r=null,T()):k},M.clipAngle=function(t){return arguments.length?(S=+t?N3(w=t*$2):(w=null,D3),T()):w*K2},M.clipExtent=function(t){return arguments.length?(k=null==t?(C=e=a=r=null,O3):L3(C=+t[0][0],e=+t[0][1],a=+t[1][0],r=+t[1][1]),T()):null==C?null:[[C,e],[a,r]]},M.scale=function(t){return arguments.length?(c=+t,z()):c},M.translate=function(t){return arguments.length?(g=+t[0],d=+t[1],z()):[g,d]},M.center=function(t){return arguments.length?(f=t[0]%360*$2,p=t[1]%360*$2,z()):[f*K2,p*K2]},M.rotate=function(t){return arguments.length?(_=t[0]%360*$2,m=t[1]%360*$2,y=2<t.length?t[2]%360*$2:0,z()):[_*K2,m*K2,y*K2]},M.angle=function(t){return arguments.length?(v=t%360*$2,z()):v*K2},M.reflectX=function(t){return arguments.length?(b=t?-1:1,z()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,z()):x<0},M.precision=function(t){return arguments.length?(o=V3(s,A=t*t),T()):Q2(A)},M.fitExtent=function(t,n){return U3(M,t,n)},M.fitSize=function(t,n){return U3(M,[[0,0],t],n)},M.fitWidth=function(t,n){return a=t,q3(i=M,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},M.fitHeight=function(t,n){return r=t,q3(a=M,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),M.invert=n.invert&&E,z()}}function n6(t){var n=0,e=K/3,i=t6(t),t=i(n,e);return t.parallels=function(t){return arguments.length?i(n=t[0]*$2,e=t[1]*$2):[n*K2,e*K2]},t}function e6(t,n){var e,i,a,r=$(t),o=(r+$(n))/2;
|
|
5490
5490
|
// Are the parallels symmetrical around the Equator?
|
|
5491
5491
|
return q2(o)<j2?(e=Y2(t),s.invert=function(t,n){return[t/e,n3(n*e)]},s):(a=Q2(i=1+r*(2*o-r))/o,l.invert=function(t,n){var n=a-n,e=W2(t,q2(n))*J2(n);return n*o<0&&(e-=K*J2(t)*J2(n)),[e/o,n3((i-(t*t+n*n)*o*o)/(2*o))]},l);function s(t,n){return[t*e,$(n)/e]}function l(t,n){n=Q2(i-2*o*$(n))/o;return[n*$(t*=o),a-n*Y2(t)]}}function i6(){return n6(e6).scale(155.424).center([0,33.6442])}function a6(){return i6().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function r6(t,n){return[t,Z2(t3((I2+n)/2))]}function o6(){return s6(r6).scale(961/G2)}function s6(i){var a,r,o,s=Q3(i),n=s.center,l=s.scale,e=s.translate,u=s.clipExtent,h=null;// clip extent
|
|
5492
5492
|
function c(){var n,t=K*l(),e=s((n=y3((n=s.rotate())[0]*$2,n[1]*$2,2<n.length?n[2]*$2:0),function(t){return(t=n.invert(t[0]*$2,t[1]*$2))[0]*=K2,t[1]*=K2,t}([0,0])));return u(null==h?[[e[0]-t,e[1]-t],[e[0]+t,e[1]+t]]:i===r6?[[Math.max(e[0]-t,h),a],[Math.min(e[0]+t,r),o]]:[[h,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?h=a=r=o=null:(h=+t[0][0],a=+t[0][1],r=+t[1][0],o=+t[1][1]),c()):null==h?null:[[h,a],[r,o]]},c()}function l6(t){return t3((I2+t)/2)}function u6(t,n){var e=Y2(t),a=t===n?$(t):Z2(e/Y2(n))/Z2(l6(n)/l6(t)),r=e*X2(l6(t),a)/a;return a?(i.invert=function(t,n){var n=r-n,e=J2(a)*Q2(t*t+n*n),i=W2(t,q2(n))*J2(n);return n*a<0&&(i-=K*J2(t)*J2(n)),[i/a,2*U2(X2(r/e,1/a))-I2]},i):r6;function i(t,n){0<r?n<-I2+j2&&(n=-I2+j2):I2-j2<n&&(n=I2-j2);n=r/X2(l6(n),a);return[n*$(a*t),r-n*Y2(a*t)]}}function h6(){return n6(u6).scale(109.5).parallels([30,30])}function c6(t,n){return[t,n]}function g6(){return Q3(c6).scale(152.63)}function d6(t,n){var e=Y2(t),i=t===n?$(t):(e-Y2(n))/(n-t),a=e/i+t;return q2(i)<j2?c6:(r.invert=function(t,n){var n=a-n,e=W2(t,q2(n))*J2(n);return n*i<0&&(e-=K*J2(t)*J2(n)),[e/i,a-J2(i)*Q2(t*t+n*n)]},r);function r(t,n){n=a-n,t*=i;return[n*$(t),a-n*Y2(t)]}}function f6(){return n6(d6).scale(131.154).center([0,13.9389])}function p6(t,n){var e=Y2(n),i=1+Y2(t)*e;return[e*$(t)/i,$(n)/i]}function _6(t,n){return[Z2(t3((I2+n)/2)),-t]}function m6(){}r6.invert=function(t,n){return[t,2*U2(V2(n))-I2]},c6.invert=c6,p6.invert=(Z3=function(t){return 2*U2(t)},function(t,n){var e=Q2(t*t+n*n),i=Z3(e),a=$(i),i=Y2(i);return[W2(t*a,e*i),n3(e&&n*a/e)]}),_6.invert=function(t,n){return[-n,2*U2(V2(t))-I2]};var y6=1/0,v6=y6,b6=-y6,x6=b6,w6={point:function(t,n){t<y6&&(y6=t);b6<t&&(b6=t);n<v6&&(v6=n);x6<n&&(x6=n)},lineStart:m6,lineEnd:m6,polygonStart:m6,polygonEnd:m6,result:function(){var t=[[y6,v6],[b6,x6]];return b6=x6=-(v6=y6=1/0),t}};function S6(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),l3(e,t.stream(w6)),w6.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 C6(t,n,e){return S6(t,[[0,0],n],e)}let k6=Math.PI,A6=2*k6,M6=1e-6,E6=A6-M6;function z6(){this._x0=this._y0=this._x1=this._y1=null,// end of current subpath
|
|
@@ -6258,21 +6258,21 @@ function(){t=s6(_6),l=t.center,u=t.rotate,t.center=function(t){return arguments.
|
|
|
6258
6258
|
console.info("UR BBOX:", mainland.invert([pascua.clipExtent()[1][0], pascua.clipExtent()[0][1]]));
|
|
6259
6259
|
console.info("LD BBOX:", mainland.invert([pascua.clipExtent()[1][0], pascua.clipExtent()[1][1]]));
|
|
6260
6260
|
console.info("LL BBOX:", mainland.invert([pascua.clipExtent()[0][0], pascua.clipExtent()[1][1]]));
|
|
6261
|
-
*/var n=d([-82.6999,-51.3043]),e=d([-77.5442,-51.6631]),i=d([-78.0254,-55.186]),a=d([-83.6106,-54.7785]),r=d([-80.0638,-35.984]),o=d([-76.2153,-36.1811]),s=d([-76.2994,-37.6839]),l=d([-80.2231,-37.4757]),u=d([-78.442,-37.706]),h=d([-76.263,-37.8054]),c=d([-76.344,-39.1595]),g=d([-78.5638,-39.0559]);t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),t.moveTo(r[0],r[1]),t.lineTo(o[0],o[1]),t.lineTo(s[0],s[1]),t.lineTo(s[0],s[1]),t.lineTo(l[0],l[1]),t.closePath(),t.moveTo(u[0],u[1]),t.lineTo(h[0],h[1]),t.lineTo(c[0],c[1]),t.lineTo(c[0],c[1]),t.lineTo(g[0],g[1]),t.closePath()},p.getCompositionBorders=function(){var t=T6();return this.drawCompositionBorders(t),t.toString()},p.scale(700)}});function B6(t){return t.k}function D6(t){return[t.x,t.y]}function N6(t){return function(){return t}}function P6(t){return t}function
|
|
6261
|
+
*/var n=d([-82.6999,-51.3043]),e=d([-77.5442,-51.6631]),i=d([-78.0254,-55.186]),a=d([-83.6106,-54.7785]),r=d([-80.0638,-35.984]),o=d([-76.2153,-36.1811]),s=d([-76.2994,-37.6839]),l=d([-80.2231,-37.4757]),u=d([-78.442,-37.706]),h=d([-76.263,-37.8054]),c=d([-76.344,-39.1595]),g=d([-78.5638,-39.0559]);t.moveTo(n[0],n[1]),t.lineTo(e[0],e[1]),t.lineTo(i[0],i[1]),t.lineTo(i[0],i[1]),t.lineTo(a[0],a[1]),t.closePath(),t.moveTo(r[0],r[1]),t.lineTo(o[0],o[1]),t.lineTo(s[0],s[1]),t.lineTo(s[0],s[1]),t.lineTo(l[0],l[1]),t.closePath(),t.moveTo(u[0],u[1]),t.lineTo(h[0],h[1]),t.lineTo(c[0],c[1]),t.lineTo(c[0],c[1]),t.lineTo(g[0],g[1]),t.closePath()},p.getCompositionBorders=function(){var t=T6();return this.drawCompositionBorders(t),t.toString()},p.scale(700)}});function B6(t){return t.k}function D6(t){return[t.x,t.y]}function N6(t){return function(){return t}}function P6(t){return t}function F6(t,n){var d,f,e=n.id,i=n.bbox,a=null==n.properties?{}:n.properties,t=(d=(t=>{var r,o,s,l,u,h;return null==t?P6:(s=t.scale[0],l=t.scale[1],u=t.translate[0],h=t.translate[1],function(t,n){n||(r=o=0);var e=2,i=t.length,a=new Array(i);for(a[0]=(r+=t[0])*s+u,a[1]=(o+=t[1])*l+h;e<i;)a[e]=t[e],++e;return a})})(t.transform),f=t.arcs,function t(n){var e,i=n.type;switch(i){case"GeometryCollection":return{type:i,geometries:n.geometries.map(t)};case"Point":e=r(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(r);break;case"LineString":e=o(n.arcs);break;case"MultiLineString":e=n.arcs.map(o);break;case"Polygon":e=l(n.arcs);break;case"MultiPolygon":e=n.arcs.map(l);break;default:return null}return{type:i,coordinates:e}}(n));function r(t){return d(t)}function o(t){for(var n=[],e=0,i=t.length;e<i;++e){g=c=u=h=l=s=o=r=a=void 0;var a=t[e],r=n;r.length&&r.pop();for(var o=f[a<0?~a:a],s=0,l=o.length;s<l;++s)r.push(d(o[s],s));if(a<0)for(var u,h=r,a=l,c=h.length,g=c-a;g<--c;)u=h[g],h[g++]=h[c],h[c]=u}// This should never happen per the specification.
|
|
6262
6262
|
return n.length<2&&n.push(n[0]),n}function s(t){for(var n=o(t);n.length<4;)n.push(n[0]);// This may happen if an arc has only two points.
|
|
6263
|
-
return n}function l(t){return t.map(s)}return null==e&&null==i?{type:"Feature",properties:a,geometry:t}:null==i?{type:"Feature",id:e,properties:a,geometry:t}:{type:"Feature",id:e,bbox:i,properties:a,geometry:t}}var
|
|
6263
|
+
return n}function l(t){return t.map(s)}return null==e&&null==i?{type:"Feature",properties:a,geometry:t}:null==i?{type:"Feature",id:e,properties:a,geometry:t}:{type:"Feature",id:e,bbox:i,properties:a,geometry:t}}var L6=[{matches:["cartodb","cartocdn"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors, © <a href='https://carto.com/attribution' target='_blank'>CARTO</a>"},{matches:["opentopomap.org"],text:"© <a href='http://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors"},{matches:["arcgisonline.com"],text:"Powered by <a href='https://developers.arcgis.com/terms/attribution/' target='_blank'>Esri</a>"},{matches:["/watercolor/"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://www.openstreetmap.org/copyright' target='_blank'>ODbL</a>."},{matches:["stamen-tiles","stamen.com"],text:"Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0' target='_blank'>CC BY SA</a>."}];let O6=Object.assign({},Wl,L2,n);
|
|
6264
6264
|
/**
|
|
6265
6265
|
* @name findAttribution
|
|
6266
6266
|
* @param {String} url
|
|
6267
6267
|
* @private
|
|
6268
|
-
*/function R6(n){var t=
|
|
6268
|
+
*/function R6(n){var t=L6.find(t=>t.matches.some(t=>n.includes(t)));return!!t&&t.text}
|
|
6269
6269
|
/**
|
|
6270
6270
|
@name topo2feature
|
|
6271
6271
|
@desc Converts a specific topojson object key into a feature ready for projection.
|
|
6272
6272
|
@param {Object} *topo* A valid topojson json object.
|
|
6273
6273
|
@param {String} [*key*] The topojson object key to be used. If undefined, the first key available will be used.
|
|
6274
6274
|
@private
|
|
6275
|
-
*/function j6(t,n){var e,n=n&&t.objects[n]?n:Object.keys(t.objects)[0];return e=t,"GeometryCollection"===(t="string"==typeof(t=n)?e.objects[t]:t).type?{type:"FeatureCollection",features:t.geometries.map(function(t){return
|
|
6275
|
+
*/function j6(t,n){var e,n=n&&t.objects[n]?n:Object.keys(t.objects)[0];return e=t,"GeometryCollection"===(t="string"==typeof(t=n)?e.objects[t]:t).type?{type:"FeatureCollection",features:t.geometries.map(function(t){return F6(e,t)})}:F6(e,t)}class I6 extends o0{
|
|
6276
6276
|
/**
|
|
6277
6277
|
Renders map tiles based on the current zoom level.
|
|
6278
6278
|
@private
|
|
@@ -6280,7 +6280,7 @@ return n}function l(t){return t.map(s)}return null==e&&null==i?{type:"Feature",p
|
|
|
6280
6280
|
/**
|
|
6281
6281
|
Extends the draw behavior of the abstract Viz class.
|
|
6282
6282
|
@private
|
|
6283
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,i=(this._container=this._select.selectAll("svg.d3plus-geomap").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-geomap").attr("opacity",0).attr("width",n).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color",this._ocean||"transparent").merge(this._container),this._container.transition(this._transition).attr("opacity",1).attr("width",n).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));i.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(i).attr("width",n).attr("height",t).attr("fill",this._ocean||"transparent"),this._tileGroup=this._container.selectAll("g.d3plus-geomap-tileGroup").data([0]),this._tileGroup=this._tileGroup.enter().append("g").attr("class","d3plus-geomap-tileGroup").merge(this._tileGroup),this._zoomGroup=this._container.selectAll("g.d3plus-geomap-zoomGroup").data([0]),this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-geomap-zoomGroup").merge(this._zoomGroup);let e=this._zoomGroup.selectAll("g.d3plus-geomap-paths").data([0]);e=e.enter().append("g").attr("class","d3plus-geomap-paths").merge(e);i=this._coordData=this._topojson?j6(this._topojson,this._topojsonKey):{type:"FeatureCollection",features:[]};this._topojsonFilter&&(i.features=i.features.filter(this._topojsonFilter));let s=this._path=O6.geoPath().projection(this._projection);var a=this._filteredData.filter((t,n)=>this._point(t,n)instanceof Array);let r=this._filteredData.filter((t,n)=>!(this._point(t,n)instanceof Array)).reduce((t,n)=>(t[this._id(n)]=n,t),{});var o=i.features.reduce((t,n)=>{var e=this._topojsonId(n);return t.push({__d3plus__:!0,data:r[e],feature:n,id:e}),t},[]);let l=ss["scale"+this._pointSizeScale.charAt(0).toUpperCase()+this._pointSizeScale.slice(1)]().domain(Re(a,(t,n)=>this._pointSize(t,n))).range([this._pointSizeMin,this._pointSizeMax]);if(!this._zoomSet){i=this._fitObject?j6(this._fitObject,this._fitKey):i;if(this._extentBounds={type:"FeatureCollection",features:this._fitFilter?i.features.filter(this._fitFilter):i.features.slice()},this._extentBounds.features=this._extentBounds.features.reduce((t,o)=>{if(o.geometry){let e={type:o.type,id:o.id,geometry:{coordinates:o.geometry.coordinates,type:o.geometry.type}};if("MultiPolygon"===o.geometry.type&&1<o.geometry.coordinates.length){let i=[],a=[],n=(o.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],i.push(s.area(e))}),e.geometry.coordinates=[o.geometry.coordinates[i.indexOf(Nt(i))]],s.centroid(e)),r=(o.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],a.push(wh(s.centroid(e),n))}),ni(i.reduce((t,n,e)=>(n&&t.push(i[e]/n),t),[]),.9));e.geometry.coordinates=o.geometry.coordinates.filter((t,n)=>{var e=a[n];return 0===e||i[n]/e>=r})}t.push(e)}return t},[]),!this._extentBounds.features.length&&a.length){let e=[[void 0,void 0],[void 0,void 0]];a.forEach((t,n)=>{t=this._projection(this._point(t,n));(void 0===e[0][0]||t[0]<e[0][0])&&(e[0][0]=t[0]),(void 0===e[1][0]||t[0]>e[1][0])&&(e[1][0]=t[0]),(void 0===e[0][1]||t[1]<e[0][1])&&(e[0][1]=t[1]),(void 0===e[1][1]||t[1]>e[1][1])&&(e[1][1]=t[1])}),this._extentBounds={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"MultiPoint",coordinates:e.map(t=>this._projection.invert(t))}}]};i=Nt(a,(t,n)=>l(this._pointSize(t,n)));this._projectionPadding.top+=i,this._projectionPadding.right+=i,this._projectionPadding.bottom+=i,this._projectionPadding.left+=i}this._zoomBehavior.extent([[0,0],[n,t]]).scaleExtent([1,this._zoomMax]).translateExtent([[0,0],[n,t]]),this._zoomSet=!0}this._projection=this._projection.fitExtent(this._extentBounds.features.length?[[this._projectionPadding.left,this._projectionPadding.top],[n-this._projectionPadding.right,t-this._projectionPadding.bottom]]:[[0,0],[n,t]],this._extentBounds.features.length?this._extentBounds:{type:"Sphere"}),this._shapes.push((new sc).data(o).d(t=>s(t.feature)).select(e.node()).x(0).y(0).config(
|
|
6283
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,i=(this._container=this._select.selectAll("svg.d3plus-geomap").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-geomap").attr("opacity",0).attr("width",n).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color",this._ocean||"transparent").merge(this._container),this._container.transition(this._transition).attr("opacity",1).attr("width",n).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));i.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(i).attr("width",n).attr("height",t).attr("fill",this._ocean||"transparent"),this._tileGroup=this._container.selectAll("g.d3plus-geomap-tileGroup").data([0]),this._tileGroup=this._tileGroup.enter().append("g").attr("class","d3plus-geomap-tileGroup").merge(this._tileGroup),this._zoomGroup=this._container.selectAll("g.d3plus-geomap-zoomGroup").data([0]),this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-geomap-zoomGroup").merge(this._zoomGroup);let e=this._zoomGroup.selectAll("g.d3plus-geomap-paths").data([0]);e=e.enter().append("g").attr("class","d3plus-geomap-paths").merge(e);i=this._coordData=this._topojson?j6(this._topojson,this._topojsonKey):{type:"FeatureCollection",features:[]};this._topojsonFilter&&(i.features=i.features.filter(this._topojsonFilter));let s=this._path=O6.geoPath().projection(this._projection);var a=this._filteredData.filter((t,n)=>this._point(t,n)instanceof Array);let r=this._filteredData.filter((t,n)=>!(this._point(t,n)instanceof Array)).reduce((t,n)=>(t[this._id(n)]=n,t),{});var o=i.features.reduce((t,n)=>{var e=this._topojsonId(n);return t.push({__d3plus__:!0,data:r[e],feature:n,id:e}),t},[]);let l=ss["scale"+this._pointSizeScale.charAt(0).toUpperCase()+this._pointSizeScale.slice(1)]().domain(Re(a,(t,n)=>this._pointSize(t,n))).range([this._pointSizeMin,this._pointSizeMax]);if(!this._zoomSet){i=this._fitObject?j6(this._fitObject,this._fitKey):i;if(this._extentBounds={type:"FeatureCollection",features:this._fitFilter?i.features.filter(this._fitFilter):i.features.slice()},this._extentBounds.features=this._extentBounds.features.reduce((t,o)=>{if(o.geometry){let e={type:o.type,id:o.id,geometry:{coordinates:o.geometry.coordinates,type:o.geometry.type}};if("MultiPolygon"===o.geometry.type&&1<o.geometry.coordinates.length){let i=[],a=[],n=(o.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],i.push(s.area(e))}),e.geometry.coordinates=[o.geometry.coordinates[i.indexOf(Nt(i))]],s.centroid(e)),r=(o.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],a.push(wh(s.centroid(e),n))}),ni(i.reduce((t,n,e)=>(n&&t.push(i[e]/n),t),[]),.9));e.geometry.coordinates=o.geometry.coordinates.filter((t,n)=>{var e=a[n];return 0===e||i[n]/e>=r})}t.push(e)}return t},[]),!this._extentBounds.features.length&&a.length){let e=[[void 0,void 0],[void 0,void 0]];a.forEach((t,n)=>{t=this._projection(this._point(t,n));(void 0===e[0][0]||t[0]<e[0][0])&&(e[0][0]=t[0]),(void 0===e[1][0]||t[0]>e[1][0])&&(e[1][0]=t[0]),(void 0===e[0][1]||t[1]<e[0][1])&&(e[0][1]=t[1]),(void 0===e[1][1]||t[1]>e[1][1])&&(e[1][1]=t[1])}),this._extentBounds={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"MultiPoint",coordinates:e.map(t=>this._projection.invert(t))}}]};i=Nt(a,(t,n)=>l(this._pointSize(t,n)));this._projectionPadding.top+=i,this._projectionPadding.right+=i,this._projectionPadding.bottom+=i,this._projectionPadding.left+=i}this._zoomBehavior.extent([[0,0],[n,t]]).scaleExtent([1,this._zoomMax]).translateExtent([[0,0],[n,t]]),this._zoomSet=!0}this._projection=this._projection.fitExtent(this._extentBounds.features.length?[[this._projectionPadding.left,this._projectionPadding.top],[n-this._projectionPadding.right,t-this._projectionPadding.bottom]]:[[0,0],[n,t]],this._extentBounds.features.length?this._extentBounds:{type:"Sphere"}),this._shapes.push((new sc).data(o).d(t=>s(t.feature)).select(e.node()).x(0).y(0).config(Lt.bind(this)(this._shapeConfig,"shape","Path")).render());let u=this._zoomGroup.selectAll("g.d3plus-geomap-pins").data([0]);u=u.enter().append("g").attr("class","d3plus-geomap-pins").merge(u);var h=(new tc).config(Lt.bind(this)(this._shapeConfig,"shape","Circle")).data(a).r((t,n)=>l(this._pointSize(t,n))).select(u.node()).sort((t,n)=>this._pointSize(n)-this._pointSize(t)).x((t,n)=>this._projection(this._point(t,n))[0]).y((t,n)=>this._projection(this._point(t,n))[1]),i=Object.keys(this._on),c=i.filter(t=>t.includes(".Circle")),g=i.filter(t=>!t.includes(".")),d=i.filter(t=>t.includes(".shape"));for(let t=0;t<g.length;t++)h.on(g[t],this._on[g[t]]);for(let t=0;t<d.length;t++)h.on(d[t],this._on[d[t]]);for(let t=0;t<c.length;t++)h.on(c[t],this._on[c[t]]);return this._shapes.push(h.render()),this}
|
|
6284
6284
|
/**
|
|
6285
6285
|
@memberof Geomap
|
|
6286
6286
|
@desc Topojson files sometimes include small geographies that negatively impact how the library determines the default zoom level (for example, a small island or territory far off the coast that is barely visible to the eye). The fitFilter method can be used to remove specific geographies from the logic used to determine the zooming.
|
|
@@ -6419,7 +6419,7 @@ return n}function l(t){return t.map(s)}return null==e&&null==i?{type:"Feature",p
|
|
|
6419
6419
|
@memberof Matrix
|
|
6420
6420
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
6421
6421
|
@private
|
|
6422
|
-
*/_draw(l){var{rowValues:u,columnValues:h,shapeData:c}=G6.bind(this)(this._filteredData);if(u.length&&h.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/h.length<120,p=(t,n)=>Dt("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:i},n)).node(),_=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(u).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(h).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<u.length?a(u[1])-a(u[0]):this._rowAxis.height(),s=1<h.length?r(h[1])-r(h[0]):this._columnAxis.width();m=`translate(0, ${this._margin.top})`,f=
|
|
6422
|
+
*/_draw(l){var{rowValues:u,columnValues:h,shapeData:c}=G6.bind(this)(this._filteredData);if(u.length&&h.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/h.length<120,p=(t,n)=>Dt("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:i},n)).node(),_=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(u).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(h).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<u.length?a(u[1])-a(u[0]):this._rowAxis.height(),s=1<h.length?r(h[1])-r(h[0]):this._columnAxis.width();m=`translate(0, ${this._margin.top})`,f=Lt.bind(this)(this._shapeConfig,"shape","Rect");this._shapes.push((new nc).data(c).select(Dt("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}
|
|
6423
6423
|
/**
|
|
6424
6424
|
@memberof Matrix
|
|
6425
6425
|
@desc The pixel padding in between each cell.
|
|
@@ -6553,7 +6553,7 @@ if(t.length){for(i=a=r=0;r<4;++r)(n=t[r])&&(e=Math.abs(n.value))&&(o+=n.value,s+
|
|
|
6553
6553
|
// Limit forces for very close nodes; randomize direction if coincident.
|
|
6554
6554
|
if(o*o/_<s)return s<p&&(0===a&&(s+=(a=Q6(h))*a),0===r&&(s+=(r=Q6(h))*r),s<f&&(s=Math.sqrt(f*s)),u.vx+=a*t.value*c/s,u.vy+=r*t.value*c/s),!0;
|
|
6555
6555
|
// Limit forces for very close nodes; randomize direction if coincident.
|
|
6556
|
-
if(!(t.length||p<=s))for((t.data!==u||t.next)&&(0===a&&(s+=(a=Q6(h))*a),0===r&&(s+=(r=Q6(h))*r),s<f)&&(s=Math.sqrt(f*s));t.data!==u&&(o=g[t.data.index]*c/s,u.vx+=a*o,u.vy+=r*o),t=t.next;);}v=Re(r.map(t=>t.fx)),y=Re(r.map(t=>t.fy));let C=ka().domain(v).range([0,i]),k=ka().domain(y).range([0,n]);var v=(v[1]-v[0])/(y[1]-y[0])||1,y=i/n,A=(y<v?(A=n*y/v,k.range([(n-A)/2,n-(n-A)/2])):(A=i*v/y,C.range([(i-A)/2,i-(i-A)/2])),r.forEach(t=>{t.x=C(t.fx),t.y=k(t.fy)}),Re(r.map(t=>t.r))),M=this._sizeMax||Nt([1,Pt(ii(r.map(n=>r.map(t=>n===t?null:wh([n.x,n.y],[t.x,t.y])))))/2]);let E=ss["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(A).range([A[0]===A[1]?M:Pt([M/2,this._sizeMin]),M]),z=C.domain(),T=k.domain();var B=z[1]-z[0],D=T[1]-T[0],N=(r.forEach(t=>{var n=E(t.r);z[0]>C.invert(t.x-n)&&(z[0]=C.invert(t.x-n)),z[1]<C.invert(t.x+n)&&(z[1]=C.invert(t.x+n)),T[0]>k.invert(t.y-n)&&(T[0]=k.invert(t.y-n)),T[1]<k.invert(t.y+n)&&(T[1]=k.invert(t.y+n))}),z[1]-z[0]);M*=Pt([B/N,D/(T[1]-T[0])]),E.range([A[0]===A[1]?M:Pt([M/2,this._sizeMin]),M]),C.domain(z),k.domain(T);let P=(y<v?i:n)/2;r.forEach(t=>{t.x=C(t.fx),t.fx=t.x,t.y=k(t.fy),t.fy=t.y,t.r=E(t.r)||P,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);B=this._container.selectAll("rect.d3plus-network-hitArea").data([0]),B.enter().append("rect").attr("class","d3plus-network-hitArea").merge(B).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]),N=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup),D=Re(m,t=>t.size);if(D[0]!==D[1]){let n=ss["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(D).range([this._linkSizeMin,E.range()[0]]);m.forEach(t=>{t.size=n(t.size)})}A=
|
|
6556
|
+
if(!(t.length||p<=s))for((t.data!==u||t.next)&&(0===a&&(s+=(a=Q6(h))*a),0===r&&(s+=(r=Q6(h))*r),s<f)&&(s=Math.sqrt(f*s));t.data!==u&&(o=g[t.data.index]*c/s,u.vx+=a*o,u.vy+=r*o),t=t.next;);}v=Re(r.map(t=>t.fx)),y=Re(r.map(t=>t.fy));let C=ka().domain(v).range([0,i]),k=ka().domain(y).range([0,n]);var v=(v[1]-v[0])/(y[1]-y[0])||1,y=i/n,A=(y<v?(A=n*y/v,k.range([(n-A)/2,n-(n-A)/2])):(A=i*v/y,C.range([(i-A)/2,i-(i-A)/2])),r.forEach(t=>{t.x=C(t.fx),t.y=k(t.fy)}),Re(r.map(t=>t.r))),M=this._sizeMax||Nt([1,Pt(ii(r.map(n=>r.map(t=>n===t?null:wh([n.x,n.y],[t.x,t.y])))))/2]);let E=ss["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(A).range([A[0]===A[1]?M:Pt([M/2,this._sizeMin]),M]),z=C.domain(),T=k.domain();var B=z[1]-z[0],D=T[1]-T[0],N=(r.forEach(t=>{var n=E(t.r);z[0]>C.invert(t.x-n)&&(z[0]=C.invert(t.x-n)),z[1]<C.invert(t.x+n)&&(z[1]=C.invert(t.x+n)),T[0]>k.invert(t.y-n)&&(T[0]=k.invert(t.y-n)),T[1]<k.invert(t.y+n)&&(T[1]=k.invert(t.y+n))}),z[1]-z[0]);M*=Pt([B/N,D/(T[1]-T[0])]),E.range([A[0]===A[1]?M:Pt([M/2,this._sizeMin]),M]),C.domain(z),k.domain(T);let P=(y<v?i:n)/2;r.forEach(t=>{t.x=C(t.fx),t.fx=t.x,t.y=k(t.fy),t.fy=t.y,t.r=E(t.r)||P,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);B=this._container.selectAll("rect.d3plus-network-hitArea").data([0]),B.enter().append("rect").attr("class","d3plus-network-hitArea").merge(B).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]),N=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup),D=Re(m,t=>t.size);if(D[0]!==D[1]){let n=ss["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(D).range([this._linkSizeMin,E.range()[0]]);m.forEach(t=>{t.size=n(t.size)})}A=Lt.bind(this)(this._shapeConfig,"edge","Path");delete A.on,this._shapes.push((new sc).config(A).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(Dt("g.d3plus-network-links",{parent:N,duration:t,enter:{transform:e},update:{transform:e}}).node()).render());let F={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:Dt("g.d3plus-network-nodes",{parent:N,duration:t,enter:{transform:e},update:{transform:e}}).node()};return Ki().key(t=>t.shape).entries(r).forEach(t=>{this._shapes.push((new lc[t.key]).config(Lt.bind(this)(this._shapeConfig,"shape",t.key)).config(F).config(F[t.key]||{}).data(t.values).render())}),this}
|
|
6557
6557
|
/**
|
|
6558
6558
|
@memberof Network
|
|
6559
6559
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -6653,7 +6653,7 @@ for(e=0;e<t.length;++e)if(Ab(n,t[e])&&Eb(zb(t[e],n),t))return[t[e],n];
|
|
|
6653
6653
|
// If we get here then B must have at least two elements.
|
|
6654
6654
|
for(e=0;e<t.length-1;++e)for(i=e+1;i<t.length;++i)if(Ab(zb(t[e],t[i]),n)&&Ab(zb(t[e],n),t[i])&&Ab(zb(t[i],n),t[e])&&Eb(Tb(t[e],t[i],n),t))return[t[e],t[i],n];
|
|
6655
6655
|
// If we get here then something is very wrong.
|
|
6656
|
-
throw new Error})(o,e)),a=0);return i}function Ab(t,n){var e=t.r-n.r,i=n.x-t.x,n=n.y-t.y;return e<0||e*e<i*i+n*n}function Mb(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),i=n.x-t.x,n=n.y-t.y;return 0<e&&i*i+n*n<e*e}function Eb(t,n){for(var e=0;e<n.length;++e)if(!Mb(t,n[e]))return;return 1}function zb(t,n){var e=t.x,i=t.y,t=t.r,a=n.x,r=n.y,n=n.r,o=a-e,s=r-i,l=n-t,u=Math.sqrt(o*o+s*s);return{x:(e+a+o/u*l)/2,y:(i+r+s/u*l)/2,r:(u+t+n)/2}}function Tb(t,n,e){var i=t.x,a=t.y,t=t.r,r=n.x,o=n.y,n=n.r,s=e.x,l=e.y,e=e.r,u=i-r,h=i-s,c=a-o,g=a-l,d=n-t,f=e-t,p=i*i+a*a-t*t,r=p-r*r-o*o+n*n,o=p-s*s-l*l+e*e,n=h*c-u*g,p=(c*o-g*r)/(2*n)-i,s=(g*d-c*f)/n,l=(h*r-u*o)/(2*n)-a,e=(u*f-h*d)/n,g=s*s+e*e-1,c=2*(t+p*s+l*e),r=p*p+l*l-t*t,o=-(1e-6<Math.abs(g)?(c+Math.sqrt(c*c-4*g*r))/(2*g):r/c);return{x:i+p+s*o,y:a+l+e*o,r:o}}function Bb(t,n,e){var i,a,r,o,s=t.x-n.x,l=t.y-n.y,u=s*s+l*l;u?(a=n.r+e.r,o=t.r+e.r,(o*=o)<(a*=a)?(i=(u+o-a)/(2*u),r=Math.sqrt(Math.max(0,o/u-i*i)),e.x=t.x-i*s-r*l,e.y=t.y-i*l+r*s):(i=(u+a-o)/(2*u),r=Math.sqrt(Math.max(0,a/u-i*i)),e.x=n.x+i*s-r*l,e.y=n.y+i*l+r*s)):(e.x=n.x+e.r,e.y=n.y)}function Db(t,n){var e=t.r+n.r-1e-6,i=n.x-t.x,n=n.y-t.y;return 0<e&&i*i+n*n<e*e}function Nb(t){var n=t._,t=t.next._,e=n.r+t.r,i=(n.x*t.r+t.x*n.r)/e,t=(n.y*t.r+t.y*n.r)/e;return i*i+t*t}function Pb(t){this._=t,this.next=null,this.previous=null}function
|
|
6656
|
+
throw new Error})(o,e)),a=0);return i}function Ab(t,n){var e=t.r-n.r,i=n.x-t.x,n=n.y-t.y;return e<0||e*e<i*i+n*n}function Mb(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),i=n.x-t.x,n=n.y-t.y;return 0<e&&i*i+n*n<e*e}function Eb(t,n){for(var e=0;e<n.length;++e)if(!Mb(t,n[e]))return;return 1}function zb(t,n){var e=t.x,i=t.y,t=t.r,a=n.x,r=n.y,n=n.r,o=a-e,s=r-i,l=n-t,u=Math.sqrt(o*o+s*s);return{x:(e+a+o/u*l)/2,y:(i+r+s/u*l)/2,r:(u+t+n)/2}}function Tb(t,n,e){var i=t.x,a=t.y,t=t.r,r=n.x,o=n.y,n=n.r,s=e.x,l=e.y,e=e.r,u=i-r,h=i-s,c=a-o,g=a-l,d=n-t,f=e-t,p=i*i+a*a-t*t,r=p-r*r-o*o+n*n,o=p-s*s-l*l+e*e,n=h*c-u*g,p=(c*o-g*r)/(2*n)-i,s=(g*d-c*f)/n,l=(h*r-u*o)/(2*n)-a,e=(u*f-h*d)/n,g=s*s+e*e-1,c=2*(t+p*s+l*e),r=p*p+l*l-t*t,o=-(1e-6<Math.abs(g)?(c+Math.sqrt(c*c-4*g*r))/(2*g):r/c);return{x:i+p+s*o,y:a+l+e*o,r:o}}function Bb(t,n,e){var i,a,r,o,s=t.x-n.x,l=t.y-n.y,u=s*s+l*l;u?(a=n.r+e.r,o=t.r+e.r,(o*=o)<(a*=a)?(i=(u+o-a)/(2*u),r=Math.sqrt(Math.max(0,o/u-i*i)),e.x=t.x-i*s-r*l,e.y=t.y-i*l+r*s):(i=(u+a-o)/(2*u),r=Math.sqrt(Math.max(0,a/u-i*i)),e.x=n.x+i*s-r*l,e.y=n.y+i*l+r*s)):(e.x=n.x+e.r,e.y=n.y)}function Db(t,n){var e=t.r+n.r-1e-6,i=n.x-t.x,n=n.y-t.y;return 0<e&&i*i+n*n<e*e}function Nb(t){var n=t._,t=t.next._,e=n.r+t.r,i=(n.x*t.r+t.x*n.r)/e,t=(n.y*t.r+t.y*n.r)/e;return i*i+t*t}function Pb(t){this._=t,this.next=null,this.previous=null}function Fb(t,n){if(!(r=(t="object"==typeof(e=t)&&"length"in e?e:Array.from(e)).length))return 0;var e,i,a,r,o,s,l,u,h,c,g,
|
|
6657
6657
|
// Place the first circle.
|
|
6658
6658
|
d=t[0];if(d.x=0,d.y=0,!(1<r))return d.r;
|
|
6659
6659
|
// Place the second circle.
|
|
@@ -6675,8 +6675,8 @@ o=Nb(d);(a=a.next)!==i;)(s=Nb(a))<o&&(d=a,o=s);i=d.next}
|
|
|
6675
6675
|
// Compute the enclosing circle of the front chain.
|
|
6676
6676
|
for(d=[i._],a=i;(a=a.next)!==i;)d.push(a._);
|
|
6677
6677
|
// Translate the circles to put the enclosing circle around the origin.
|
|
6678
|
-
for(a=kb(d,n),l=0;l<r;++l)(d=t[l]).x-=a.x,d.y-=a.y;return a.r}function
|
|
6679
|
-
()=>{let t=1;return()=>(t=(wb*t+Sb)%Cb)/Cb})();return t.x=i/2,t.y=a/2,e?t.eachBefore(Rb(e)).eachAfter(jb(r,.5,n)).eachBefore(Ib(1)):t.eachBefore(Rb(
|
|
6678
|
+
for(a=kb(d,n),l=0;l<r;++l)(d=t[l]).x-=a.x,d.y-=a.y;return a.r}function Lb(t){return Math.sqrt(t.value)}function Ob(){var e=null,i=1,a=1,r=bb;function n(t){var n=(// 2^32
|
|
6679
|
+
()=>{let t=1;return()=>(t=(wb*t+Sb)%Cb)/Cb})();return t.x=i/2,t.y=a/2,e?t.eachBefore(Rb(e)).eachAfter(jb(r,.5,n)).eachBefore(Ib(1)):t.eachBefore(Rb(Lb)).eachAfter(jb(bb,1,n)).eachAfter(jb(r,t.r/Math.min(i,a),n)).eachBefore(Ib(Math.min(i,a)/(2*t.r))),t}return n.radius=function(t){return arguments.length?(e=null==(t=t)?null:vb(t),n):e},n.size=function(t){return arguments.length?(i=+t[0],a=+t[1],n):[i,a]},n.padding=function(t){return arguments.length?(r="function"==typeof t?t:xb(+t),n):r},n}function Rb(n){return function(t){t.children||(t.r=Math.max(0,+n(t)||0))}}function jb(o,s,l){return function(t){if(n=t.children){var n,e,i,a=n.length,r=o(t)*s||0;if(r)for(e=0;e<a;++e)n[e].r+=r;if(i=Fb(n,l),r)for(e=0;e<a;++e)n[e].r-=r;t.r=i+r}}}function Ib(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function Hb(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Gb(t,n,e,i,a){for(var r,o=t.children,s=-1,l=o.length,u=t.value&&(i-n)/t.value;++s<l;)(r=o[s]).y0=e,r.y1=a,r.x0=n,r.x1=n+=r.value*u}function Kb(t,n){return t.parent===n.parent?1:2}
|
|
6680
6680
|
// function radialSeparation(a, b) {
|
|
6681
6681
|
// return (a.parent === b.parent ? 1 : 2) / a.depth;
|
|
6682
6682
|
// }
|
|
@@ -6738,7 +6738,7 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
6738
6738
|
/**
|
|
6739
6739
|
Extends the draw behavior of the abstract Viz class.
|
|
6740
6740
|
@private
|
|
6741
|
-
*/_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=Ki();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])(db({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 tc).data(t).select(Dt("g.d3plus-Pack",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(
|
|
6741
|
+
*/_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=Ki();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])(db({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 tc).data(t).select(Dt("g.d3plus-Pack",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(Lt.bind(this)(this._shapeConfig,"shape","Circle")).render()),this}
|
|
6742
6742
|
/**
|
|
6743
6743
|
@memberof Pack
|
|
6744
6744
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -6782,7 +6782,7 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
6782
6782
|
@memberof Priestley
|
|
6783
6783
|
@desc Extends the render behavior of the abstract Viz class.
|
|
6784
6784
|
@private
|
|
6785
|
-
*/_draw(r){if(super._draw(r),this._filteredData){r=this._filteredData.map((t,n)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?Bt(this._end(t,n)):this._end(t,n),i:n,id:this._id(t,n),start:"time"===this._axisConfig.scale?Bt(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=Ki();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:[Pt(r,t=>t.start)||0,Nt(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(Dt("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render(),this._axis.config(s).config(this._axisConfig).select(Dt("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).render(),this._axisTest._padding);let n=this._axis._d3Scale,e=Qi().domain(
|
|
6785
|
+
*/_draw(r){if(super._draw(r),this._filteredData){r=this._filteredData.map((t,n)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?Bt(this._end(t,n)):this._end(t,n),i:n,id:this._id(t,n),start:"time"===this._axisConfig.scale?Bt(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=Ki();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:[Pt(r,t=>t.start)||0,Nt(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(Dt("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render(),this._axis.config(s).config(this._axisConfig).select(Dt("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:l},update:{transform:l}}).node()).render(),this._axisTest._padding);let n=this._axis._d3Scale,e=Qi().domain(Ft(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 nc).data(r).duration(this._duration).height(a).label((t,n)=>this._drawLabel(t.data,n)).select(Dt("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}
|
|
6786
6786
|
/**
|
|
6787
6787
|
@memberof Priestley
|
|
6788
6788
|
@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.
|
|
@@ -6821,7 +6821,7 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
6821
6821
|
/**
|
|
6822
6822
|
Extends the draw behavior of the abstract Viz class.
|
|
6823
6823
|
@private
|
|
6824
|
-
*/_draw(t){super._draw(t);let u=this._height-this._margin.top-this._margin.bottom,h=this._width-this._margin.left-this._margin.right,c=Pt([u,h])/2-this._outerPadding,n=`translate(${h/2}, ${u/2})`;var t=Ki().key(this._metric).entries(this._filteredData),e=Ki().key(this._id).key(this._metric).entries(this._filteredData);let i=Nt(e.map(t=>t.values.map(t=>ai(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=
|
|
6824
|
+
*/_draw(t){super._draw(t);let u=this._height-this._margin.top-this._margin.bottom,h=this._width-this._margin.left-this._margin.right,c=Pt([u,h])/2-this._outerPadding,n=`translate(${h/2}, ${u/2})`;var t=Ki().key(this._metric).entries(this._filteredData),e=Ki().key(this._id).key(this._metric).entries(this._filteredData);let i=Nt(e.map(t=>t.values.map(t=>ai(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 tc).data(a).select(Dt("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=n9/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:Vu(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 nc).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(Dt("g.d3plus-Radar-text",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).render(),(new sc).data(a).d(t=>`M0,0 ${-t.x},`+-t.y).select(Dt("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=ai(t.values,(t,n)=>this._value(t,n))/i*c,n=n9/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=>Vu(t.values,this._aggs)),id:t.key,points:n,d:e,__d3plus__:!0,data:Vu(t.values.map(t=>Vu(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+h/2),r=t.points.map(t=>t.y+u/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(Pt(r))],n,e,i)}}return this._shapes.push((new sc).data(r).d(t=>t.d).select(Dt("g.d3plus-Radar-items",{parent:this._select,enter:{transform:n},update:{transform:n}}).node()).config(o).render()),this}
|
|
6825
6825
|
/**
|
|
6826
6826
|
@memberof Radar
|
|
6827
6827
|
@desc Sets the config method used for the radial spokes, circles, and labels.
|
|
@@ -6862,7 +6862,7 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
6862
6862
|
/**
|
|
6863
6863
|
* Extracts the axis config "labels" Array, if it exists, it filters
|
|
6864
6864
|
* the column labels by the values included in the Array.
|
|
6865
|
-
*/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(Dt("g.d3plus-RadialMatrix-columns",{parent:g,transition:d,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(o),i=(o-e)/u.length,a=1<n.length?n[1].radians-n[0].radians:i9,r=u.slice().reverse();f=Ns().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[h.indexOf(t.column)].radians-a/2).endAngle(t=>n[h.indexOf(t.column)].radians+a/2);this._shapes.push((new sc).data(c).d(f).select(Dt("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(
|
|
6865
|
+
*/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(Dt("g.d3plus-RadialMatrix-columns",{parent:g,transition:d,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(o),i=(o-e)/u.length,a=1<n.length?n[1].radians-n[0].radians:i9,r=u.slice().reverse();f=Ns().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[h.indexOf(t.column)].radians-a/2).endAngle(t=>n[h.indexOf(t.column)].radians+a/2);this._shapes.push((new sc).data(c).d(f).select(Dt("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}
|
|
6866
6866
|
/**
|
|
6867
6867
|
@memberof RadialMatrix
|
|
6868
6868
|
@desc The pixel padding in between each cell.
|
|
@@ -6937,7 +6937,7 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
6937
6937
|
/**
|
|
6938
6938
|
Extends the draw behavior of the abstract Viz class.
|
|
6939
6939
|
@private
|
|
6940
|
-
*/_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,u=this._height-this._margin.top-this._margin.bottom,n=`translate(${this._margin.left}, ${this._margin.top})`,h=this._width-this._margin.left-this._margin.right,c=[],o=Pt([u,h])/2,g=o/3,d=g,f=2*g,p=i[this._center],s=(p.x=h/2,p.y=u/2,p.r=this._sizeMin?Nt([this._sizeMin,.65*d]):this._sizeMax?Pt([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=h/2+d*Math.cos(r),i.y=u/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=h/2+f*Math.cos(e),t.y=u/2+f*Math.sin(e),m.push(t)})});var x=g/2,w=g/4;let S=x/2-4,C=(x/2-4<8&&(S=Pt([x/2,8])),w/2-4);(C=(C=w/2-4<4?Pt([w/2,4]):C)>g/10?g/10:C)>S&&10<C&&(C=.75*S),S>1.5*C&&(S=1.5*C),S=Math.floor(S),C=Math.floor(C);let k;this._size?((x=Re(a,t=>t.size))[0]===x[1]&&(x[0]=0),k=ka().domain(x).rangeRound([3,Pt([S,C])]),w=p.size,p.r=k(w)):k=ka().domain([1,2]).rangeRound([S,C]),m.forEach(t=>{t.ring=2;var n=this._size?t.size:2;t.r=this._sizeMin?Nt([this._sizeMin,k(n)]):this._sizeMax?Pt([this._sizeMax,k(n)]):k(n)}),_.forEach(t=>{t.ring=1;var n=this._size?t.size:1;t.r=this._sizeMin?Nt([this._sizeMin,k(n)]):this._sizeMax?Pt([this._sizeMax,k(n)]):k(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=h/2,i=u/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=Re(e,t=>t.size);if(x[0]!==x[1]){let t=Pt(l,t=>t.r),n=ss["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=
|
|
6940
|
+
*/_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,u=this._height-this._margin.top-this._margin.bottom,n=`translate(${this._margin.left}, ${this._margin.top})`,h=this._width-this._margin.left-this._margin.right,c=[],o=Pt([u,h])/2,g=o/3,d=g,f=2*g,p=i[this._center],s=(p.x=h/2,p.y=u/2,p.r=this._sizeMin?Nt([this._sizeMin,.65*d]):this._sizeMax?Pt([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=h/2+d*Math.cos(r),i.y=u/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=h/2+f*Math.cos(e),t.y=u/2+f*Math.sin(e),m.push(t)})});var x=g/2,w=g/4;let S=x/2-4,C=(x/2-4<8&&(S=Pt([x/2,8])),w/2-4);(C=(C=w/2-4<4?Pt([w/2,4]):C)>g/10?g/10:C)>S&&10<C&&(C=.75*S),S>1.5*C&&(S=1.5*C),S=Math.floor(S),C=Math.floor(C);let k;this._size?((x=Re(a,t=>t.size))[0]===x[1]&&(x[0]=0),k=ka().domain(x).rangeRound([3,Pt([S,C])]),w=p.size,p.r=k(w)):k=ka().domain([1,2]).rangeRound([S,C]),m.forEach(t=>{t.ring=2;var n=this._size?t.size:2;t.r=this._sizeMin?Nt([this._sizeMin,k(n)]):this._sizeMax?Pt([this._sizeMax,k(n)]):k(n)}),_.forEach(t=>{t.ring=1;var n=this._size?t.size:1;t.r=this._sizeMin?Nt([this._sizeMin,k(n)]):this._sizeMax?Pt([this._sizeMax,k(n)]):k(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=h/2,i=u/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=Re(e,t=>t.size);if(x[0]!==x[1]){let t=Pt(l,t=>t.r),n=ss["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 sc).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(Dt("g.d3plus-rings-links",{parent:this._select,duration:t,enter:{transform:n},update:{transform:n}}).node()).render());let A=this,M={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(A)(A._shapeConfig,"shape",t.key).labelConfig.fontColor(t):xu(Lt.bind(A)(A._shapeConfig,"shape",t.key).fill(t)),fontResize:t=>t.id===this._center,padding:0,textAnchor:t=>i[t.id].textAnchor||Lt.bind(A)(A._shapeConfig,"shape",t.key).labelConfig.textAnchor,verticalAlign:t=>t.id===this._center?"middle":"top"},rotate:t=>i[t.id].rotate||0,select:Dt("g.d3plus-rings-nodes",{parent:this._select,duration:t,enter:{transform:n},update:{transform:n}}).node()};return Ki().key(t=>t.shape).entries(l).forEach(t=>{this._shapes.push((new lc[t.key]).config(Lt.bind(this)(this._shapeConfig,"shape",t.key)).config(M).data(t.values).render())}),this}
|
|
6941
6941
|
/**
|
|
6942
6942
|
@memberof Rings
|
|
6943
6943
|
@desc Sets the center node to be the node with the given id.
|
|
@@ -7027,10 +7027,10 @@ m.push(o={value:h,dice:l<u,children:y.slice(v,b)}),o.dice?Gb(o,e,i,a,w?i+=u*h/w:
|
|
|
7027
7027
|
// Need to resets margins and padding because we are
|
|
7028
7028
|
// skipping over the default render method and using
|
|
7029
7029
|
// _draw directly.
|
|
7030
|
-
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=Ot("Circle"),this._shapeConfig=Tt(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 o9(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 s9(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 l9(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 u9(t){return t.target.depth}function h9(t,n){return t.sourceLinks.length?t.depth:n-1}function c9(t){return function(){return t}}function g9(t,n){return f9(t.source,n.source)||t.index-n.index}function d9(t,n){return f9(t.target,n.target)||t.index-n.index}function f9(t,n){return t.y0-n.y0}function p9(t){return t.value}function _9(t){return t.index}function m9(t){return t.nodes}function y9(t){return t.links}function v9(t,n){t=t.get(n);if(t)return t;throw new Error("missing: "+n)}function b9({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 x9(){let S=0,C=0,k=1,A=1,M=24,E=8,z,T=_9,B=h9,D,N,P=m9,
|
|
7031
|
-
function n(){var t,n,a={nodes:P.apply(null,arguments),links:
|
|
7030
|
+
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=Ot("Circle"),this._shapeConfig=Tt(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 o9(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 s9(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 l9(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 u9(t){return t.target.depth}function h9(t,n){return t.sourceLinks.length?t.depth:n-1}function c9(t){return function(){return t}}function g9(t,n){return f9(t.source,n.source)||t.index-n.index}function d9(t,n){return f9(t.target,n.target)||t.index-n.index}function f9(t,n){return t.y0-n.y0}function p9(t){return t.value}function _9(t){return t.index}function m9(t){return t.nodes}function y9(t){return t.links}function v9(t,n){t=t.get(n);if(t)return t;throw new Error("missing: "+n)}function b9({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 x9(){let S=0,C=0,k=1,A=1,M=24,E=8,z,T=_9,B=h9,D,N,P=m9,F=y9,L=6;// extent
|
|
7031
|
+
function n(){var t,n,a={nodes:P.apply(null,arguments),links:F.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)=>[T(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=v9(s,t)),"object"!=typeof n&&(n=o.target=v9(s,n)),t.sourceLinks.push(o),n.targetLinks.push(o)}if(null!=N)for(var{sourceLinks:l,targetLinks:u}of e)l.sort(N),u.sort(N);var h,r=a.nodes;for(h of r)h.value=void 0===h.fixedValue?Math.max(l9(h.sourceLinks,p9),l9(h.targetLinks,p9)):h.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=o9(t,t=>t.depth)+1,i=(k-S-M)/(e-1),a=new Array(e);for(n of t){var r=Math.max(0,Math.min(e-1,Math.floor(B.call(null,n,e))));n.layer=r,n.x0=S+r*i,n.x1=n.x0+M,a[r]?a[r].push(n):a[r]=[n]}if(D)for(var o of a)o.sort(D);return a})(r),r=(z=Math.min(E,(A-C)/(o9(_,t=>t.length)-1)),_),m=s9(r,t=>(A-C-(t.length-1)*z)/l9(t,p9));for(p of r){let n=C;for(var y of p){y.y0=n,y.y1=n+y.value*m,n=y.y1+z;for(var v of y.sourceLinks)v.width=v.value*m}n=(A-n+z)/(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===N)for(var{sourceLinks:n,targetLinks:e}of t)n.sort(d9),e.sort(g9)}
|
|
7032
7032
|
// Returns the target.y0 that would produce an ideal link from source to target.
|
|
7033
|
-
)(p)}for(let t=0;t<
|
|
7033
|
+
)(p)}for(let t=0;t<L;++t){var x=Math.pow(.99,t),w=Math.max(1-x,(t+1)/L);(
|
|
7034
7034
|
// Reposition each node based on its outgoing (source) links.
|
|
7035
7035
|
(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:u}of r.sourceLinks){u=u*(l.layer-r.layer);t+=(
|
|
7036
7036
|
// Returns the source.y0 that would produce an ideal link from source to target.
|
|
@@ -7040,7 +7040,7 @@ function n(){var t,n,a={nodes:P.apply(null,arguments),links:L.apply(null,argumen
|
|
|
7040
7040
|
// Push any overlapping nodes down.
|
|
7041
7041
|
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+z}}
|
|
7042
7042
|
// Push any overlapping nodes up.
|
|
7043
|
-
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-z}}function R({sourceLinks:n,targetLinks:e}){if(void 0===N){for(let{source:{sourceLinks:t}}of e)t.sort(d9);for(let{target:{targetLinks:t}}of n)t.sort(g9)}}return n.update=function(t){return b9(t),t},n.nodeId=function(t){return arguments.length?(T="function"==typeof t?t:c9(t),n):T},n.nodeAlign=function(t){return arguments.length?(B="function"==typeof t?t:c9(t),n):B},n.nodeSort=function(t){return arguments.length?(D=t,n):D},n.nodeWidth=function(t){return arguments.length?(M=+t,n):M},n.nodePadding=function(t){return arguments.length?(E=z=+t,n):E},n.nodes=function(t){return arguments.length?(P="function"==typeof t?t:c9(t),n):P},n.links=function(t){return arguments.length?(
|
|
7043
|
+
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-z}}function R({sourceLinks:n,targetLinks:e}){if(void 0===N){for(let{source:{sourceLinks:t}}of e)t.sort(d9);for(let{target:{targetLinks:t}}of n)t.sort(g9)}}return n.update=function(t){return b9(t),t},n.nodeId=function(t){return arguments.length?(T="function"==typeof t?t:c9(t),n):T},n.nodeAlign=function(t){return arguments.length?(B="function"==typeof t?t:c9(t),n):B},n.nodeSort=function(t){return arguments.length?(D=t,n):D},n.nodeWidth=function(t){return arguments.length?(M=+t,n):M},n.nodePadding=function(t){return arguments.length?(E=z=+t,n):E},n.nodes=function(t){return arguments.length?(P="function"==typeof t?t:c9(t),n):P},n.links=function(t){return arguments.length?(F="function"==typeof t?t:c9(t),n):F},n.linkSort=function(t){return arguments.length?(N=t,n):N},n.size=function(t){return arguments.length?(S=C=0,k=+t[0],A=+t[1],n):[k-S,A-C]},n.extent=function(t){return arguments.length?(S=+t[0][0],k=+t[1][0],C=+t[0][1],A=+t[1][1],n):[[S,C],[k,A]]},n.iterations=function(t){return arguments.length?(L=+t,n):L},n}var w9=Math.PI,S9=2*w9,C9=1e-6,k9=S9-C9;function A9(){this._x0=this._y0=this._x1=this._y1=null,// end of current subpath
|
|
7044
7044
|
this._=""}function M9(){return new A9}function E9(t){return function(){return t}}function z9(t){return t[0]}function T9(t){return t[1]}A9.prototype=M9.prototype={constructor:A9,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,u=(e=+e)-(t=+t),h=(i=+i)-(n=+n),c=s-t,g=l-n,d=c*c+g*g;
|
|
7045
7045
|
// Is the radius negative? Error.
|
|
7046
7046
|
if((a=+a)<0)throw new Error("negative radius: "+a);
|
|
@@ -7057,11 +7057,11 @@ e&&(
|
|
|
7057
7057
|
// Is this a complete circle? Draw two arcs to complete the circle.
|
|
7058
7058
|
k9<(
|
|
7059
7059
|
// Does the angle go the wrong way? Flip the direction.
|
|
7060
|
-
r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):C9<r&&(this._+="A"+e+","+e+",0,"+ +(w9<=r)+","+h+","+(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 B9=Array.prototype.slice;function D9(t){return t.source}function N9(t){return t.target}function P9(t,n,e,i,a){t.moveTo(n,e),t.bezierCurveTo(n=(n+i)/2,e,n,a,i,a)}function
|
|
7060
|
+
r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):C9<r&&(this._+="A"+e+","+e+",0,"+ +(w9<=r)+","+h+","+(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 B9=Array.prototype.slice;function D9(t){return t.source}function N9(t){return t.target}function P9(t,n,e,i,a){t.moveTo(n,e),t.bezierCurveTo(n=(n+i)/2,e,n,a,i,a)}function F9(){return a=P9,r=D9,o=N9,s=z9,l=T9,u=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:E9(+t),n):s},n.y=function(t){return arguments.length?(l="function"==typeof t?t:E9(+t),n):l},n.context=function(t){return arguments.length?(u=null==t?null:t,n):u},n;function n(){var t,n=B9.call(arguments),e=r.apply(this,n),i=o.apply(this,n);if(u=u||(t=M9()),a(u,+s.apply(this,(n[0]=e,n)),+l.apply(this,n),+s.apply(this,(n[0]=i,n)),+l.apply(this,n)),t)return u=null,t+""||null}var a,r,o,s,l,u}function L9(t){return[t.source.x1,t.y0]}function O9(t){return[t.target.x0,t.y1]}let R9={center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?s9(t.sourceLinks,u9)-1:0},justify:h9,left:function(t){return t.depth},right:function(t,n){return n-1-t.height}};class j9 extends o0{
|
|
7061
7061
|
/**
|
|
7062
7062
|
Extends the draw behavior of the abstract Viz class.
|
|
7063
7063
|
@private
|
|
7064
|
-
*/_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 sc).config(this._shapeConfig.Path).data(a).d(this._path).select(Dt("g.d3plus-Links",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).render()),Ki().key(t=>t.shape).entries(e).forEach(t=>{this._shapes.push((new lc[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(Dt("g.d3plus-sankey-nodes",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).config(
|
|
7064
|
+
*/_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 sc).config(this._shapeConfig.Path).data(a).d(this._path).select(Dt("g.d3plus-Links",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).render()),Ki().key(t=>t.shape).entries(e).forEach(t=>{this._shapes.push((new lc[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(Dt("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}
|
|
7065
7065
|
/**
|
|
7066
7066
|
@memberof Sankey
|
|
7067
7067
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -7134,7 +7134,7 @@ r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7134
7134
|
@memberof Sankey
|
|
7135
7135
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
7136
7136
|
@private
|
|
7137
|
-
*/constructor(){super(),this._nodeId=p("id"),this._links=p("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=p("nodes"),this._nodeAlign=R9.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let n=this._on["mousemove.shape"];this._on["mousemove.shape"]=(a,r,o,t)=>{if(n(a,r,o,t),this._focus&&this._focus===a.id)this.hover(!1),this._on.mouseenter.bind(this)(a,r,o,t),this._focus=void 0;else{let e=this._nodeId(a,r),t=this._nodeLookup[e],n=Object.keys(this._nodeLookup).reduce((t,n)=>(t[this._nodeLookup[n]]=isNaN(n)?n:parseInt(n,10),t),{});o=this._linkLookup[t];let i=[e];o.forEach(t=>{i.push(n[t])}),this.hover((t,n)=>t.source&&t.target?t.source.id===e||t.target.id===e:i.includes(this._nodeId(t,n)))}},this._path=
|
|
7137
|
+
*/constructor(){super(),this._nodeId=p("id"),this._links=p("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=p("nodes"),this._nodeAlign=R9.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let n=this._on["mousemove.shape"];this._on["mousemove.shape"]=(a,r,o,t)=>{if(n(a,r,o,t),this._focus&&this._focus===a.id)this.hover(!1),this._on.mouseenter.bind(this)(a,r,o,t),this._focus=void 0;else{let e=this._nodeId(a,r),t=this._nodeLookup[e],n=Object.keys(this._nodeLookup).reduce((t,n)=>(t[this._nodeLookup[n]]=isNaN(n)?n:parseInt(n,10),t),{});o=this._linkLookup[t];let i=[e];o.forEach(t=>{i.push(n[t])}),this.hover((t,n)=>t.source&&t.target?t.source.id===e||t.target.id===e:i.includes(this._nodeId(t,n)))}},this._path=F9().source(L9).target(O9),this._sankey=x9(),this._shape=Ot("Rect"),this._shapeConfig=Tt(this._shapeConfig,{Path:{fill:"none",hoverStyle:{"stroke-width":t=>Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)},label:!1,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:t=>Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)},Rect:{}}),this._value=Ot(1)}}class I9 extends w0{
|
|
7138
7138
|
/**
|
|
7139
7139
|
@memberof StackedArea
|
|
7140
7140
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
@@ -7147,7 +7147,7 @@ r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7147
7147
|
/**
|
|
7148
7148
|
Merges the values of a given nest branch.
|
|
7149
7149
|
@private
|
|
7150
|
-
*/t.forEach((t,n)=>{t.data.key&&t.data.values&&(t.data=function n(t){return Vu(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=Ot(a));var s=Nt(t,t=>1===t.depth?a(t.data,t.i):0),l=Nt(t,t=>t.children?0:a(t.data,t.i)),u=Re(t,t=>t.y);this._labelHeight=Pt(["vertical"===this._orient?50:100,(u[1]-s-l)/(this._groupBy.length+1)]),this._labelWidths=Zu(t,t=>t.depth).map(a=>a.values.reduce((t,n,e)=>{var i=e<a.values.length-1?a.values[e+1].x:o+this._margin[r],e=e?a.values[e-1].x:this._margin[r];return Pt([t,i-n.x,n.x-e])},o));let h=ka().domain(u).range([s+this._labelHeight,n-l-this._labelHeight]);t.forEach(t=>{var n=h(t.y);"horizontal"===this._orient?(t.y=t.x,t.x=n):t.y=n});u={parent:this._select,enter:{transform:i},update:{transform:i}};return this._shapes.push((new sc).data(t.filter(t=>1<t.depth)).select(Dt("g.d3plus-Tree-Links",u).node()).config(
|
|
7150
|
+
*/t.forEach((t,n)=>{t.data.key&&t.data.values&&(t.data=function n(t){return Vu(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=Ot(a));var s=Nt(t,t=>1===t.depth?a(t.data,t.i):0),l=Nt(t,t=>t.children?0:a(t.data,t.i)),u=Re(t,t=>t.y);this._labelHeight=Pt(["vertical"===this._orient?50:100,(u[1]-s-l)/(this._groupBy.length+1)]),this._labelWidths=Zu(t,t=>t.depth).map(a=>a.values.reduce((t,n,e)=>{var i=e<a.values.length-1?a.values[e+1].x:o+this._margin[r],e=e?a.values[e-1].x:this._margin[r];return Pt([t,i-n.x,n.x-e])},o));let h=ka().domain(u).range([s+this._labelHeight,n-l-this._labelHeight]);t.forEach(t=>{var n=h(t.y);"horizontal"===this._orient?(t.y=t.x,t.x=n):t.y=n});u={parent:this._select,enter:{transform:i},update:{transform:i}};return this._shapes.push((new sc).data(t.filter(t=>1<t.depth)).select(Dt("g.d3plus-Tree-Links",u).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+("vertical"===this._orient?0:n),t=t.parent.y-t.y+("vertical"===this._orient?n:0),i="vertical"===this._orient?0:-n,a="vertical"===this._orient?-n:0;return"vertical"===this._orient?`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).join("-")}).render()),this._shapes.push((new tc).data(t).select(Dt("g.d3plus-Tree-Shapes",u).node()).config(Lt.bind(this)(this._shapeConfig,"shape","Circle")).config({id:(t,n)=>this._ids(t,n).join("-"),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=>"vertical"===this._orient?"middle":t.data.children&&t.data.depth!==this._groupBy.length?"end":"start",verticalAlign:t=>"vertical"===this._orient?1===t.data.depth?"bottom":"top":"middle"},hitArea:(t,n,e)=>{var i=this._labelHeight,a=this._labelWidths[t.depth-1];return{width:"vertical"===this._orient?a:2*e.r+a,height:"horizontal"===this._orient?i:2*e.r+i,x:"vertical"===this._orient?-a/2:t.children&&t.depth!==this._groupBy.length?-(e.r+a):-e.r,y:"horizontal"===this._orient?-i/2:t.children&&t.depth!==this._groupBy.length?-(e.r+this._labelHeight):-e.r}},labelBounds:(t,n,e)=>{var i=this._labelHeight,a="vertical"===this._orient?"height":"width",r=this._labelWidths[t.depth-1];return{["vertical"===this._orient?"width":"height"]:r,[a]:i,["vertical"===this._orient?"x":"y"]:-r/2,["vertical"===this._orient?"y":"x"]:t.children&&t.depth!==this._groupBy.length?-(e.r+i):e.r}}}).render()),this}
|
|
7151
7151
|
/**
|
|
7152
7152
|
@memberof Tree
|
|
7153
7153
|
@desc If *value* is specified, sets the orientation to the specified value. If *value* is not specified, returns the current orientation.
|
|
@@ -7179,7 +7179,7 @@ r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7179
7179
|
@memberof Treemap
|
|
7180
7180
|
@desc Flattens and merges treemap data.
|
|
7181
7181
|
@private
|
|
7182
|
-
*/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=Vu(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=
|
|
7182
|
+
*/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=Vu(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,u=i.labelConfig.padding;return this._shapes.push((new nc).data(r).label(t=>[this._drawLabel(t.data,t.i),kh(100*t.share,this._locale)+"%"]).select(Dt("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*u));return a<l&&(a=0),[{width:e.width,height:i-a,x:-e.width/2,y:-i/2},{width:e.width,height:a+2*u,x:-e.width/2,y:i/2-a-2*u}]},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}
|
|
7183
7183
|
/**
|
|
7184
7184
|
* Applies the threshold algorithm for Treemaps.
|
|
7185
7185
|
* @param {Array} data The data to process.
|
|
@@ -7226,5 +7226,5 @@ r=r<0?r%S9+S9:r)?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7226
7226
|
@memberof Treemap
|
|
7227
7227
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
7228
7228
|
@private
|
|
7229
|
-
*/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(Hb),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]=u(t)/2,e+=d(t)-n,i+=h(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,u,h,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=Tt({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Tt({},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=Zb,this._tooltipConfig=Tt({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,n,e)=>kh(100*e.share,this._locale)+"%"]]}),this._treemap=(o=Zb,a=!1,s=r=1,l=[0],d=g=c=h=u=bb,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=vb(t),n):o},n.padding=function(t){return arguments.length?n.paddingInner(t).paddingOuter(t):n.paddingInner()},n.paddingInner=function(t){return arguments.length?(u="function"==typeof t?t:xb(+t),n):u},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?(h="function"==typeof t?t:xb(+t),n):h},n.paddingRight=function(t){return arguments.length?(c="function"==typeof t?t:xb(+t),n):c},n.paddingBottom=function(t){return arguments.length?(g="function"==typeof t?t:xb(+t),n):g},n.paddingLeft=function(t){return arguments.length?(d="function"==typeof t?t:xb(+t),n):d},n.round(!0));let f=t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation}}t.Area=Jh,t.AreaPlot=w0,t.Axis=pc,t.AxisBottom=_c,t.AxisLeft=mc,t.AxisRight=yc,t.AxisTop=vc,t.Bar=Qh,t.BarChart=S0,t.BaseClass=Ri,t.Box=oc,t.BoxWhisker=C0,t.BumpChart=k0,t.Circle=tc,t.ColorScale=xc,t.Donut=M0,t.Geomap=I6,t.Image=Nh,t.Legend=bc,t.Line=ec,t.LinePlot=H6,t.Matrix=$6,t.Message=wc,t.Network=cb,t.Pack=Qb,t.Path=sc,t.Pie=A0,t.Plot=x0,t.Priestley=t9,t.RESET=Pi,t.Radar=e9,t.RadialMatrix=a9,t.Rect=nc,t.Rings=r9,t.Sankey=j9,t.Shape=
|
|
7229
|
+
*/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(Hb),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]=u(t)/2,e+=d(t)-n,i+=h(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,u,h,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=Tt({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Tt({},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=Zb,this._tooltipConfig=Tt({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,n,e)=>kh(100*e.share,this._locale)+"%"]]}),this._treemap=(o=Zb,a=!1,s=r=1,l=[0],d=g=c=h=u=bb,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=vb(t),n):o},n.padding=function(t){return arguments.length?n.paddingInner(t).paddingOuter(t):n.paddingInner()},n.paddingInner=function(t){return arguments.length?(u="function"==typeof t?t:xb(+t),n):u},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?(h="function"==typeof t?t:xb(+t),n):h},n.paddingRight=function(t){return arguments.length?(c="function"==typeof t?t:xb(+t),n):c},n.paddingBottom=function(t){return arguments.length?(g="function"==typeof t?t:xb(+t),n):g},n.paddingLeft=function(t){return arguments.length?(d="function"==typeof t?t:xb(+t),n):d},n.round(!0));let f=t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation}}t.Area=Jh,t.AreaPlot=w0,t.Axis=pc,t.AxisBottom=_c,t.AxisLeft=mc,t.AxisRight=yc,t.AxisTop=vc,t.Bar=Qh,t.BarChart=S0,t.BaseClass=Ri,t.Box=oc,t.BoxWhisker=C0,t.BumpChart=k0,t.Circle=tc,t.ColorScale=xc,t.Donut=M0,t.Geomap=I6,t.Image=Nh,t.Legend=bc,t.Line=ec,t.LinePlot=H6,t.Matrix=$6,t.Message=wc,t.Network=cb,t.Pack=Qb,t.Path=sc,t.Pie=A0,t.Plot=x0,t.Priestley=t9,t.RESET=Pi,t.Radar=e9,t.RadialMatrix=a9,t.Rect=nc,t.Rings=r9,t.Sankey=j9,t.Shape=Fh,t.StackedArea=I9,t.TextBox=Cc,t.Timeline=eg,t.Tooltip=fd,t.Tree=H9,t.Treemap=K9,t.Viz=o0,t.Whisker=ac,t.accessor=p,t.configPrep=Lt,t.constant=Ot,t.uuid=Li});
|
|
7230
7230
|
//# sourceMappingURL=d3plus-core.full.js.map
|