@d3plus/core 3.0.0-alpha.2 → 3.0.0-alpha.4
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 +183 -240
- package/es/src/charts/AreaPlot.js +0 -1
- package/es/src/charts/BarChart.js +0 -1
- package/es/src/charts/BoxWhisker.js +0 -1
- package/es/src/charts/BumpChart.js +0 -2
- package/es/src/charts/LinePlot.js +0 -1
- package/es/src/charts/Pack.js +7 -6
- package/es/src/charts/Plot.js +12 -21
- package/es/src/charts/Viz.js +3 -0
- package/es/src/components/Tooltip.js +1 -1
- package/es/src/shapes/Shape.js +30 -3
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +56 -53
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +445 -449
- package/umd/d3plus-core.js +54 -34
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +125 -121
package/umd/d3plus-core.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.0-alpha.
|
|
2
|
+
@d3plus/core v3.0.0-alpha.4
|
|
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
|
|
@@ -231,7 +231,14 @@
|
|
|
231
231
|
@memberof Image
|
|
232
232
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
233
233
|
@private
|
|
234
|
-
*/constructor(){this._duration=600,this._height=s("height"),this._id=s("id"),this._opacity=Ht(1),this._pointerEvents=Ht("auto"),this._select,this._url=s("url"),this._width=s("width"),this._x=s("x",0),this._y=s("y",0)}}
|
|
234
|
+
*/constructor(){this._duration=600,this._height=s("height"),this._id=s("id"),this._opacity=Ht(1),this._pointerEvents=Ht("auto"),this._select,this._url=s("url"),this._width=s("width"),this._x=s("x",0),this._y=s("y",0)}}
|
|
235
|
+
/**
|
|
236
|
+
* @param {*} nodeList
|
|
237
|
+
* @param {*} classNames
|
|
238
|
+
* @private
|
|
239
|
+
*/function Y(i,e){for(let t=0;t<e.length;t++){var s=e[t];for(let t=i.length-1;0<=t;t--)if(i[t].classList.contains(s))return t;// Return the index if found
|
|
240
|
+
}return 0;// Return -1 if no element is found with the class
|
|
241
|
+
}class r extends h{
|
|
235
242
|
/**
|
|
236
243
|
@memberof Shape
|
|
237
244
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -308,7 +315,7 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
308
315
|
@memberof Shape
|
|
309
316
|
@desc Modifies existing shapes to show hover status.
|
|
310
317
|
@private
|
|
311
|
-
*/_renderHover(){let
|
|
318
|
+
*/_renderHover(){let r=this;this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text, g.d3plus-${this._name}-hover`).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(t,i){(t=t||{}).parentNode||(t.parentNode=this.parentNode),t.dataIndex||(t.dataIndex=i);var e=t.dataIndex,s=t.parentNode,h=j.select(this).classed("d3plus-textBox")?"textBox":j.select(this).classed("d3plus-Image")?"Image":"Shape";if((t="textBox"==h?t.data:t).__d3plusShape__||t.__d3plus__)for(;t&&(t.__d3plusShape__||t.__d3plus__);)i=t.i,t=t.data;else i=r._data.indexOf(t);var n=!r._hover||"function"!=typeof r._hover||!r._hover(t,i)?s:r._hoverGroup.node();n!==this.parentNode&&(h="textBox"==h?Y(n.childNodes,["d3plus-Image","d3plus-Shape"]):"Image"==h?Y(n.childNodes,["d3plus-Shape"]):0,n.insertBefore(this,n.childNodes[h+e])),this.className.baseVal.includes("d3plus-Shape")&&(s===n?j.select(this).call(r._applyStyle.bind(r)):j.select(this).call(r._updateStyle.bind(r,j.select(this),r._hoverStyle)))}),
|
|
312
319
|
// this._renderImage();
|
|
313
320
|
// this._renderLabels();
|
|
314
321
|
this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text`).attr("opacity",this._hover?this._hoverOpacity:this._active?this._activeOpacity:1)}
|
|
@@ -686,7 +693,7 @@ this._renderHover(),this):this._hover}
|
|
|
686
693
|
@memberof Area
|
|
687
694
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
688
695
|
@private
|
|
689
|
-
*/constructor(){super(),this._curve=Ht("linear"),this._defined=()=>!0,this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,i),y:e.cy-e.height/2-this._y(t,i)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class
|
|
696
|
+
*/constructor(){super(),this._curve=Ht("linear"),this._defined=()=>!0,this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,i),y:e.cy-e.height/2-this._y(t,i)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class K extends r{
|
|
690
697
|
/**
|
|
691
698
|
@memberof Bar
|
|
692
699
|
@desc Draws the bars.
|
|
@@ -900,7 +907,7 @@ this._renderHover(),this):this._hover}
|
|
|
900
907
|
@memberof Line
|
|
901
908
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
902
909
|
@private
|
|
903
|
-
*/constructor(){super(),this._curve=Ht("linear"),this._defined=t=>t,this._fill=Ht("none"),this._hitArea=Ht({d:t=>this._path(t.values),fill:"none","stroke-width":10,transform:null}),this._name="Line",this._path=Et.line(),this._stroke=Ht("black"),this._strokeWidth=Ht(1)}}let U={Circle:Rt,Rect:Ft};class
|
|
910
|
+
*/constructor(){super(),this._curve=Ht("linear"),this._defined=t=>t,this._fill=Ht("none"),this._hitArea=Ht({d:t=>this._path(t.values),fill:"none","stroke-width":10,transform:null}),this._name="Line",this._path=Et.line(),this._stroke=Ht("black"),this._strokeWidth=Ht(1)}}let U={Circle:Rt,Rect:Ft};class X extends h{
|
|
904
911
|
/**
|
|
905
912
|
@memberof Whisker
|
|
906
913
|
@desc Draws the whisker.
|
|
@@ -989,7 +996,7 @@ return this._whiskerEndpoint=[],Ot.nest().key(t=>t.endpoint).entries(t).forEach(
|
|
|
989
996
|
@memberof Whisker
|
|
990
997
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
|
|
991
998
|
@private
|
|
992
|
-
*/constructor(){super(),this._endpoint=s("endpoint","Rect"),this._endpointConfig={Circle:{r:s("r",5)}},this._length=s("length",25),this._lineConfig={},this._orient=s("orient","top"),this._x=s("x",0),this._y=s("y",0)}}let
|
|
999
|
+
*/constructor(){super(),this._endpoint=s("endpoint","Rect"),this._endpointConfig={Circle:{r:s("r",5)}},this._length=s("length",25),this._lineConfig={},this._orient=s("orient","top"),this._x=s("x",0),this._y=s("y",0)}}let J={Circle:Rt,Rect:Ft};class Q extends h{
|
|
993
1000
|
/**
|
|
994
1001
|
@memberof Box
|
|
995
1002
|
@desc Draws the Box.
|
|
@@ -1010,9 +1017,9 @@ this._median=(new Ft).data(t).x(t=>"vertical"===t.orient?t.x:t.median).y(t=>"ver
|
|
|
1010
1017
|
// Construct coordinates for whisker startpoints and push it to the whiskerData.
|
|
1011
1018
|
let o=[];return t.forEach((t,i)=>{var e,s,h=t.x,n=t.y,r=t.first-t.lowerLimit,a=t.upperLimit-t.third;"vertical"===t.orient?(e=n-t.height/2,s=n+t.height/2,o.push({__d3plus__:!0,data:t,i:i,x:h,y:e,length:r,orient:"top"},{__d3plus__:!0,data:t,i:i,x:h,y:s,length:a,orient:"bottom"})):"horizontal"===t.orient&&(e=h+t.width/2,s=h-t.width/2,o.push({__d3plus__:!0,data:t,i:i,x:e,y:n,length:a,orient:"right"},{__d3plus__:!0,data:t,i:i,x:s,y:n,length:r,orient:"left"}))}),
|
|
1012
1019
|
// Draw whiskers.
|
|
1013
|
-
this._whisker=(new
|
|
1020
|
+
this._whisker=(new X).data(o).select(Pt.elem("g.d3plus-Box-Whisker",{parent:this._select}).node()).config(jt.bind(this)(this._whiskerConfig,"shape")).render(),
|
|
1014
1021
|
// Draw outliers.
|
|
1015
|
-
this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var i=t.key;this._whiskerEndpoint.push((new
|
|
1022
|
+
this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var i=t.key;this._whiskerEndpoint.push((new J[i]).data(t.values).select(Pt.elem("g.d3plus-Box-Outlier-"+i,{parent:this._select}).node()).config(jt.bind(this)(this._outlierConfig,"shape",i)).render())}),this}
|
|
1016
1023
|
/**
|
|
1017
1024
|
@memberof Box
|
|
1018
1025
|
@desc Sets the highlight accessor to the Shape class's active function.
|
|
@@ -1141,18 +1148,18 @@ this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var
|
|
|
1141
1148
|
@memberof Path
|
|
1142
1149
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
1143
1150
|
@private
|
|
1144
|
-
*/constructor(){super("path"),this._d=s("path"),this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,i):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 Wt=Object.freeze({__proto__:null,Area:Nt,Bar:
|
|
1151
|
+
*/constructor(){super("path"),this._d=s("path"),this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,i):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 Wt=Object.freeze({__proto__:null,Area:Nt,Bar:K,Box:Q,Circle:Rt,Image:V,Line:It,Path:B,Rect:Ft,Shape:r,Whisker:X});let Z=c.theme,R=t=>t<0||Object.is(t,-0),F=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,R(t)),W=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,R(t)),tt=t=>{var i,e=""+t;return e.includes("e-")||"0"===e?0:(i=e.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/))?+(""+i[1]+(+i[2]+1)):(i=e.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/))?+(""+i[1]+ +i[2]):t};
|
|
1145
1152
|
/* catches for -0 and less */
|
|
1146
1153
|
/**
|
|
1147
1154
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
1148
1155
|
* @param {scale} scale A d3-scale object
|
|
1149
1156
|
* @private
|
|
1150
|
-
*/function
|
|
1157
|
+
*/function it(t,e=!1){let s=[];var h=
|
|
1151
1158
|
/**
|
|
1152
1159
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
1153
1160
|
* @param {scale} scale A d3-scale object
|
|
1154
1161
|
* @private
|
|
1155
|
-
*/function(t,i=!1){var e=$t.scaleLinear().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let s=Math.floor(e(t));return"time"===this._scale&&(s=this._data&&this._data.length?(e=Dt.extent(this._data),t=this._data.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0),e=Math.round((e[1]-e[0])/t),Dt.min([s*(i?2:.5),e])):i?2*s:s/2),Math.floor(s)}.bind(this)(t,e),n=t.domain();let r=n[1]<n[0];if(e||"log"!==this._scale){if(s=t.ticks(h),!e&&!["log","time"].includes(this._scale)&&1<s.length){let e=Math.abs(2*
|
|
1162
|
+
*/function(t,i=!1){var e=$t.scaleLinear().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let s=Math.floor(e(t));return"time"===this._scale&&(s=this._data&&this._data.length?(e=Dt.extent(this._data),t=this._data.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0),e=Math.round((e[1]-e[0])/t),Dt.min([s*(i?2:.5),e])):i?2*s:s/2),Math.floor(s)}.bind(this)(t,e),n=t.domain();let r=n[1]<n[0];if(e||"log"!==this._scale){if(s=t.ticks(h),!e&&!["log","time"].includes(this._scale)&&1<s.length){let e=Math.abs(2*tt(s[1]-s[0]));s=s.filter(t=>{var t=Math.abs(t)%e,i=tt(t);return i!==t?!i||i===e:0==t})}}else{var e=n.map(t=>Math.log10(t)%1==0?t:(r?W:F)(t)),a=e[1]<e[0],e=e.map(t=>(R(t)?-1:1)*([-1,1].includes(t)||Math.abs(t)<1?1:Math.log10(Math.abs(t))));let i=Math.ceil((Math.abs(e[1]-e[0])+1)/(.65*h));s=i<=1&&e[0]===e[1]||a!=r?t.ticks(h).filter(t=>+(""+t).replace("0.","")%2==0):Dt.range(e[0],e[1],e[1]<e[0]?-1:1).concat([e[1]]).filter(t=>Math.abs(t)%i==0).map(t=>+(""+(R(t)?-1:1)*(t?Math.pow(10,Math.abs(t)):0<Math.sign(1/t)?1:-1)).replace(/9+/g,"1"))}
|
|
1156
1163
|
// forces min/max into ticks, if not present
|
|
1157
1164
|
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
1158
1165
|
if(this._d3ScaleNegative&&R(n[r?1:0])!==s.some(t=>R(t))||s.map(Number).includes(+n[0])||s.unshift(n[0]),this._d3ScaleNegative&&R(n[r?0:1])!==s.some(t=>R(t))||s.map(Number).includes(+n[1])||s.push(n[1]),"time"===this._scale&&this._data.length){let i=this._data.map(Number);s=s.filter(t=>i.includes(+t))}return s}class o extends h{
|
|
@@ -1182,7 +1189,7 @@ if(this._d3ScaleNegative&&R(n[r?1:0])!==s.some(t=>R(t))||s.map(Number).includes(
|
|
|
1182
1189
|
@memberof Axis
|
|
1183
1190
|
@desc Returns the scale's labels, taking into account negative and positive log scales.
|
|
1184
1191
|
@private
|
|
1185
|
-
*/_getLabels(){let t=[];if((this._d3ScaleNegative&&(t=t.concat(
|
|
1192
|
+
*/_getLabels(){let t=[];if((this._d3ScaleNegative&&(t=t.concat(it.bind(this)(this._d3ScaleNegative,!1))),this._d3Scale&&(t=t.concat(it.bind(this)(this._d3Scale,!1))),"log"===this._scale)&&(t.some(t=>R(t))&&t.some(t=>0<t))){let i=Dt.min([...this._d3ScaleNegative.domain().map(Math.abs),...this._d3Scale.domain()]);
|
|
1186
1193
|
// add minValue if it does not exist, and should
|
|
1187
1194
|
t.includes(i)||t.splice(t.findIndex(t=>t>i),0,i),
|
|
1188
1195
|
// remove -minValue if minValue also exists
|
|
@@ -1191,7 +1198,7 @@ t.includes(-i)&&t.includes(i)&&t.splice(t.indexOf(-i),1)}return t}
|
|
|
1191
1198
|
@memberof Axis
|
|
1192
1199
|
@desc Returns the scale's ticks, taking into account negative and positive log scales.
|
|
1193
1200
|
@private
|
|
1194
|
-
*/_getTicks(){if(["band","ordinal","point","time"].includes(this._scale)&&this._data.length&&this._data.length<this._width/4)return"time"===this._scale?this._data.map(Pt.date):this._data;let t=[];return this._d3ScaleNegative&&(t=t.concat(
|
|
1201
|
+
*/_getTicks(){if(["band","ordinal","point","time"].includes(this._scale)&&this._data.length&&this._data.length<this._width/4)return"time"===this._scale?this._data.map(Pt.date):this._data;let t=[];return this._d3ScaleNegative&&(t=t.concat(it.bind(this)(this._d3ScaleNegative,!0))),this._d3Scale&&(t=t.concat(it.bind(this)(this._d3Scale,!0))),"log"===this._scale&&t.includes(-1)&&t.includes(1)&&t.splice(t.indexOf(-1),1),t}
|
|
1195
1202
|
/**
|
|
1196
1203
|
@memberof Axis
|
|
1197
1204
|
@desc Sets positioning for the grid lines.
|
|
@@ -1232,7 +1239,7 @@ t.includes(-i)&&t.includes(i)&&t.splice(t.indexOf(-i),1)}return t}
|
|
|
1232
1239
|
/**
|
|
1233
1240
|
* Sets up the initial d3 scale, using this._domain and the
|
|
1234
1241
|
* previously defined range variable.
|
|
1235
|
-
*/var s="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let h=this._domain.slice();if(this._d3Scale=$t[s]().domain("time"===this._scale?h.map(Pt.date):h).range(v),"none"!==this._rounding&&(s=()=>{var t=t=>{if(e){if(!t)return 0;var i=(""+t).match(/0\.(0*)/);if(i)return+`0.${Array(i[1].length+1).fill(0).join("")}1`}return(""+Math.round(Math.abs(t))).length};let e=h.every(t=>Math.abs(t)<1);var t=[t(h[0]),t(h[1])].filter(Boolean).sort(),i=h.some(t=>R(t))&&h.some(t=>0<t),i=1===t.length?t[0]:1<t[0]&&t[0]===t[1]?t[0]-1:"outside"!==this._rounding&&i?Dt.max(t):t[0]+(t[1]-t[0])/2;let s=i<1?
|
|
1242
|
+
*/var s="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let h=this._domain.slice();if(this._d3Scale=$t[s]().domain("time"===this._scale?h.map(Pt.date):h).range(v),"none"!==this._rounding&&(s=()=>{var t=t=>{if(e){if(!t)return 0;var i=(""+t).match(/0\.(0*)/);if(i)return+`0.${Array(i[1].length+1).fill(0).join("")}1`}return(""+Math.round(Math.abs(t))).length};let e=h.every(t=>Math.abs(t)<1);var t=[t(h[0]),t(h[1])].filter(Boolean).sort(),i=h.some(t=>R(t))&&h.some(t=>0<t),i=1===t.length?t[0]:1<t[0]&&t[0]===t[1]?t[0]-1:"outside"!==this._rounding&&i?Dt.max(t):t[0]+(t[1]-t[0])/2;let s=i<1?tt(i):+("1"+Array(Math.floor(tt(i))-1).fill(0).join(""));s>=Math.abs(h[1]-h[0])&&(s/=2);t=h[1]<h[0],i=[Math["outside"===this._rounding?t?"ceil":"floor":t?"floor":"ceil"](h[0]/s)*s,Math["outside"===this._rounding?t?"floor":"ceil":t?"ceil":"floor"](h[1]/s)*s];"log"===this._scale&&(0===i[0]&&(i[0]=h[0]),0===i[1])&&(i[1]=h[1]),this._d3Scale.domain(i.map(tt))},"linear"===this._scale?s.bind(this)():"log"===this._scale&&(a=[],r=h[1]<h[0],a[0]=("outside"===this._rounding?R(h[0])?r?F:W:r?W:F:R(h[0])?r?W:F:r?F:W)(h[0]),a[1]=("inside"===this._rounding?R(h[1])?r?F:W:r?W:F:R(h[1])?r?W:F:r?F:W)(h[1]),n=a[1]<a[0],a[0]!==a[1]&&a.some(t=>10<Math.abs(t))&&n==r?this._d3Scale.domain(a):s.bind(this)())),this._d3Scale.padding&&this._d3Scale.padding(this._scalePadding),this._d3Scale.paddingInner&&this._d3Scale.paddingInner(this._paddingInner),this._d3Scale.paddingOuter&&this._d3Scale.paddingOuter(this._paddingOuter)
|
|
1236
1243
|
/**
|
|
1237
1244
|
* Constructs a separate "negative only" scale for logarithmic
|
|
1238
1245
|
* domains, as they cannot pass zero.
|
|
@@ -1504,27 +1511,27 @@ if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n
|
|
|
1504
1511
|
@memberof Axis
|
|
1505
1512
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1506
1513
|
@private
|
|
1507
|
-
*/constructor(){super(),this._align="middle",this._barConfig={stroke:
|
|
1514
|
+
*/constructor(){super(),this._align="middle",this._barConfig={stroke:Z.colors.gray[600],"stroke-width":1},this._data=[],this._domain=[0,10],this._duration=600,this._gridConfig={stroke:A.colorDefaults.light,"stroke-width":1},this._gridLog=!1,this._height=400,this._labelOffset=!1,this._labelRotation=!1,this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._paddingInner=.1,this._paddingOuter=.1,this._rounding="none",this._roundingInsideMinPrefix="< ",this._roundingInsideMinSuffix="",this._roundingInsideMaxPrefix="",this._roundingInsideMaxSuffix="+",this._scale="linear",this._scalePadding=.5,this._shape="Line",this._shapeConfig={fill:Z.colors.gray[600],height:t=>t.tick?8:0,label:t=>t.text,labelBounds:t=>t.labelBounds,labelConfig:{fontColor:Z.colors.gray[600],fontResize:!1,fontSize:Ht(12),padding:5,textAnchor:()=>{var t=Pt.rtl(this._select.node());return"left"===this._orient?t?"start":"end":"right"===this._orient?t?"end":"start":this._labelRotation?"bottom"===this._orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this._orient?"top":"top"===this._orient?"bottom":"middle"},r:t=>t.tick?4:0,stroke:Z.colors.gray[600],strokeWidth:1,width:t=>t.tick?8:0},this._tickSize=8,this._tickSuffix="normal",this._tickUnit=0,this._timeLocale=void 0,this._titleClass=new l,this._titleConfig={fontColor:A.colorDefaults.dark,fontSize:12,textAnchor:"middle"},this._width=400}}class et extends o{
|
|
1508
1515
|
/**
|
|
1509
1516
|
@memberof AxisBottom
|
|
1510
1517
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1511
1518
|
@private
|
|
1512
|
-
*/constructor(){super(),this.orient("bottom")}}class
|
|
1519
|
+
*/constructor(){super(),this.orient("bottom")}}class st extends o{
|
|
1513
1520
|
/**
|
|
1514
1521
|
@memberof AxisLeft
|
|
1515
1522
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1516
1523
|
@private
|
|
1517
|
-
*/constructor(){super(),this.orient("left")}}class
|
|
1524
|
+
*/constructor(){super(),this.orient("left")}}class ht extends o{
|
|
1518
1525
|
/**
|
|
1519
1526
|
@memberof AxisRight
|
|
1520
1527
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1521
1528
|
@private
|
|
1522
|
-
*/constructor(){super(),this.orient("right")}}class
|
|
1529
|
+
*/constructor(){super(),this.orient("right")}}class nt extends o{
|
|
1523
1530
|
/**
|
|
1524
1531
|
@memberof AxisTop
|
|
1525
1532
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1526
1533
|
@private
|
|
1527
|
-
*/constructor(){super(),this.orient("top")}}class
|
|
1534
|
+
*/constructor(){super(),this.orient("top")}}class rt extends h{_fetchConfig(t,i,e){var s=(void 0!==this._shapeConfig[t]?this._shapeConfig:this._shapeConfig.labelConfig)[t];return s||"lineHeight"!==t?"function"==typeof s?s(i,e):s:1.4*this._fetchConfig("fontSize",i,e)}_rowHeight(t){return Dt.max(t.map(t=>t.height).concat(t.map(t=>t.shapeHeight)))+this._padding}_rowWidth(e){return Dt.sum(e.map((t,i)=>{i=this._padding*(i===e.length-1?0:t.width?2:1);return t.shapeWidth+t.width+i}))}
|
|
1528
1535
|
/**
|
|
1529
1536
|
@memberof Legend
|
|
1530
1537
|
@desc Renders the current Legend to the page. If a *callback* is specified, it will be called once the legend is done drawing.
|
|
@@ -1653,7 +1660,7 @@ return this._shapes=[],["Circle","Rect"].forEach(i=>{this._shapes.push((new Wt[i
|
|
|
1653
1660
|
@memberof Legend
|
|
1654
1661
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1655
1662
|
@private
|
|
1656
|
-
*/constructor(){super(),this._titleClass=new l,this._align="center",this._data=[],this._direction="row",this._duration=600,this._height=200,this._id=s("id"),this._label=s("id"),this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={fill:s("color"),height:Ht(12),hitArea:(t,i)=>{var i=this._lineData[i],e=Dt.max([i.height,i.shapeHeight]);return{width:i.width+i.shapeWidth,height:e,x:-i.shapeWidth/2,y:-e/2}},labelBounds:(t,i)=>{i=this._lineData[i];let e=i.shapeWidth/2;"Circle"===i.shape&&(e-=i.shapeR/2);var s=Dt.max([i.shapeHeight,i.height]),h=this._rtl?i.shapeWidth+i.width+2*this._padding:0;return{width:i.width,height:s,x:e+5-h,y:-s/2}},labelConfig:{fontColor:Ht(A.colorDefaults.dark),fontFamily:this._titleClass.fontFamily(),fontResize:!1,fontSize:Ht(10),verticalAlign:"middle"},opacity:1,r:Ht(6),width:Ht(12),x:(t,i)=>{var e=this._lineData[i];let s=e.y;var h="left"===this._align||"right"===this._align&&"column"===this._direction?0:"center"===this._align?(this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)))/2:this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)),i=this._lineData.slice(0,i).filter(t=>s===t.y),n=this._rtl?e.width+this._padding:0;return this._rowWidth(i)+this._padding*(i.length?e.sentence?2:1:0)+this._outerBounds.x+e.shapeWidth/2+h+n},y:(t,i)=>{let e=this._lineData[i];return e.y+this._titleHeight+this._outerBounds.y+Dt.max(this._lineData.filter(t=>e.y===t.y).map(t=>t.height).concat(this._data.map((t,i)=>this._fetchConfig("height",t,i))))/2}},this._titleConfig={fontSize:12},this._verticalAlign="middle",this._width=400}}class
|
|
1663
|
+
*/constructor(){super(),this._titleClass=new l,this._align="center",this._data=[],this._direction="row",this._duration=600,this._height=200,this._id=s("id"),this._label=s("id"),this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={fill:s("color"),height:Ht(12),hitArea:(t,i)=>{var i=this._lineData[i],e=Dt.max([i.height,i.shapeHeight]);return{width:i.width+i.shapeWidth,height:e,x:-i.shapeWidth/2,y:-e/2}},labelBounds:(t,i)=>{i=this._lineData[i];let e=i.shapeWidth/2;"Circle"===i.shape&&(e-=i.shapeR/2);var s=Dt.max([i.shapeHeight,i.height]),h=this._rtl?i.shapeWidth+i.width+2*this._padding:0;return{width:i.width,height:s,x:e+5-h,y:-s/2}},labelConfig:{fontColor:Ht(A.colorDefaults.dark),fontFamily:this._titleClass.fontFamily(),fontResize:!1,fontSize:Ht(10),verticalAlign:"middle"},opacity:1,r:Ht(6),width:Ht(12),x:(t,i)=>{var e=this._lineData[i];let s=e.y;var h="left"===this._align||"right"===this._align&&"column"===this._direction?0:"center"===this._align?(this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)))/2:this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)),i=this._lineData.slice(0,i).filter(t=>s===t.y),n=this._rtl?e.width+this._padding:0;return this._rowWidth(i)+this._padding*(i.length?e.sentence?2:1:0)+this._outerBounds.x+e.shapeWidth/2+h+n},y:(t,i)=>{let e=this._lineData[i];return e.y+this._titleHeight+this._outerBounds.y+Dt.max(this._lineData.filter(t=>e.y===t.y).map(t=>t.height).concat(this._data.map((t,i)=>this._fetchConfig("height",t,i))))/2}},this._titleConfig={fontSize:12},this._verticalAlign="middle",this._width=400}}class at extends h{
|
|
1657
1664
|
/**
|
|
1658
1665
|
@memberof ColorScale
|
|
1659
1666
|
@desc Renders the current ColorScale to the page. If a *callback* is specified, it will be called once the ColorScale is done drawing.
|
|
@@ -1844,7 +1851,7 @@ this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._dat
|
|
|
1844
1851
|
@memberof ColorScale
|
|
1845
1852
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1846
1853
|
@private
|
|
1847
|
-
*/constructor(){super(),this._axisClass=new o,this._axisConfig={gridSize:0},this._axisTest=new o,this._align="middle",this._buckets=5,this._bucketAxis=!1,this._bucketFormat=(i,t,e,s)=>{var h=this._axisConfig.tickFormat||Tt.formatAbbreviate;let n=e[t+1];var r=!!t&&e[t-1],e=t===e.length-1;return i===n||e?(e=e&&i<Dt.max(s)?"+":"",h(i)+e):(e=1<=(e=n?n/100:i/100)||e<=-1?Math.round(e).toString().length-1:-1*e.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,e=Math.pow(10,e),r=h(r===i&&1===t?Dt.min([i+e,s.find(t=>i<t&&t<n)]):i),h=h(i&&1===t?n:Dt.max([n-e,s.reverse().find(t=>i<t&&t<n)])),this._bucketJoiner(r,h))},this._bucketJoiner=(t,i)=>t!==i?t+" - "+i:""+t,this._centered=!0,this._color=["#54478C","#2C699A","#0DB39E","#83E377","#EFEA5A"],this._colorMax=A.colorDefaults.on,this._colorMid=A.colorDefaults.light,this._colorMin=A.colorDefaults.off,this._data=[],this._duration=600,this._height=200,this._labelClass=new l,this._labelConfig={fontColor:A.colorDefaults.dark,fontSize:12},this._legendClass=new
|
|
1854
|
+
*/constructor(){super(),this._axisClass=new o,this._axisConfig={gridSize:0},this._axisTest=new o,this._align="middle",this._buckets=5,this._bucketAxis=!1,this._bucketFormat=(i,t,e,s)=>{var h=this._axisConfig.tickFormat||Tt.formatAbbreviate;let n=e[t+1];var r=!!t&&e[t-1],e=t===e.length-1;return i===n||e?(e=e&&i<Dt.max(s)?"+":"",h(i)+e):(e=1<=(e=n?n/100:i/100)||e<=-1?Math.round(e).toString().length-1:-1*e.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,e=Math.pow(10,e),r=h(r===i&&1===t?Dt.min([i+e,s.find(t=>i<t&&t<n)]):i),h=h(i&&1===t?n:Dt.max([n-e,s.reverse().find(t=>i<t&&t<n)])),this._bucketJoiner(r,h))},this._bucketJoiner=(t,i)=>t!==i?t+" - "+i:""+t,this._centered=!0,this._color=["#54478C","#2C699A","#0DB39E","#83E377","#EFEA5A"],this._colorMax=A.colorDefaults.on,this._colorMid=A.colorDefaults.light,this._colorMin=A.colorDefaults.off,this._data=[],this._duration=600,this._height=200,this._labelClass=new l,this._labelConfig={fontColor:A.colorDefaults.dark,fontSize:12},this._legendClass=new rt,this._legendConfig={shapeConfig:{stroke:A.colorDefaults.dark,strokeWidth:1}},this._midpoint=0,this._orient="bottom",this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._rectClass=(new Ft).parent(this),this._rectConfig={stroke:"#999",strokeWidth:1},this._scale="linear",this._size=10,this._value=s("value"),this._width=400}}class ot{
|
|
1848
1855
|
/**
|
|
1849
1856
|
@memberof Message
|
|
1850
1857
|
@desc Removes the message from the page.
|
|
@@ -1865,7 +1872,7 @@ this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._dat
|
|
|
1865
1872
|
@memberof Message
|
|
1866
1873
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1867
1874
|
@private
|
|
1868
|
-
*/constructor(){this._isVisible=!1}}let
|
|
1875
|
+
*/constructor(){this._isVisible=!1}}let lt={i:"font-style: italic;",em:"font-style: italic;",b:"font-weight: bold;",strong:"font-weight: bold;"};class l extends h{
|
|
1869
1876
|
/**
|
|
1870
1877
|
@memberof TextBox
|
|
1871
1878
|
@desc Renders the text boxes. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
@@ -2005,7 +2012,7 @@ var i=new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);return t.match(i)?t=t.rep
|
|
|
2005
2012
|
strong: 'font-weight: bold;'
|
|
2006
2013
|
}]
|
|
2007
2014
|
@chainable
|
|
2008
|
-
*/html(t){return arguments.length?(this._html="boolean"==typeof t?!!t&&
|
|
2015
|
+
*/html(t){return arguments.length?(this._html="boolean"==typeof t?!!t&<:t,this):this._html}
|
|
2009
2016
|
/**
|
|
2010
2017
|
@memberof TextBox
|
|
2011
2018
|
@desc Defines the unique id for each box to the specified accessor function or static number.
|
|
@@ -2126,7 +2133,7 @@ var i=new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);return t.match(i)?t=t.rep
|
|
|
2126
2133
|
@memberof TextBox
|
|
2127
2134
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
2128
2135
|
@private
|
|
2129
|
-
*/constructor(){super(),this._ariaHidden=Ht("false"),this._delay=0,this._duration=0,this._ellipsis=(t,i)=>i?t.replace(/\.|,$/g,"")+"...":"",this._fontColor=Ht("black"),this._fontFamily=Ht(H.fontFamily),this._fontMax=Ht(50),this._fontMin=Ht(8),this._fontOpacity=Ht(1),this._fontResize=Ht(!1),this._fontSize=Ht(10),this._fontStroke=Ht("transparent"),this._fontStrokeWidth=Ht(0),this._fontWeight=Ht(400),this._height=s("height",200),this._html=
|
|
2136
|
+
*/constructor(){super(),this._ariaHidden=Ht("false"),this._delay=0,this._duration=0,this._ellipsis=(t,i)=>i?t.replace(/\.|,$/g,"")+"...":"",this._fontColor=Ht("black"),this._fontFamily=Ht(H.fontFamily),this._fontMax=Ht(50),this._fontMin=Ht(8),this._fontOpacity=Ht(1),this._fontResize=Ht(!1),this._fontSize=Ht(10),this._fontStroke=Ht("transparent"),this._fontStrokeWidth=Ht(0),this._fontWeight=Ht(400),this._height=s("height",200),this._html=lt,this._id=(t,i)=>t.id||""+i,this._lineHeight=(t,i)=>1.2*this._fontSize(t,i),this._maxLines=Ht(null),this._on={},this._overflow=Ht(!1),this._padding=Ht(0),this._pointerEvents=Ht("auto"),this._rotate=Ht(0),this._rotateAnchor=t=>[t.w/2,t.h/2],this._split=H.textSplit,this._text=s("text"),this._textAnchor=Ht("start"),this._verticalAlign=Ht("top"),this._width=s("width",200),this._x=s("x",0),this._y=s("y",0)}}let _t="#bbb";class dt extends o{
|
|
2130
2137
|
/**
|
|
2131
2138
|
@memberof Timeline
|
|
2132
2139
|
@desc Triggered on brush "brush".
|
|
@@ -2288,14 +2295,14 @@ return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-n,y:"bu
|
|
|
2288
2295
|
@memberof Timeline
|
|
2289
2296
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
2290
2297
|
@private
|
|
2291
|
-
*/constructor(){super(),this._barConfig=Pt.assign({},this._barConfig,{stroke:()=>"buttons"===this._buttonBehaviorCurrent?"transparent":
|
|
2298
|
+
*/constructor(){super(),this._barConfig=Pt.assign({},this._barConfig,{stroke:()=>"buttons"===this._buttonBehaviorCurrent?"transparent":_t,"stroke-width":()=>"buttons"===this._buttonBehaviorCurrent?0:1}),this._brushing=!0,this._brushFilter=t=>!t.button&&t.detail<2,this._brushMin=Ht(1),this._buttonAlign="middle",this._buttonBehavior="auto",this._buttonPadding=10,this._buttonHeight=24,this._domain=[2001,2010],this._gridSize=0,this._handleConfig={fill:A.colorDefaults.light,stroke:"#228be6","stroke-width":2,rx:2,ry:2},this._handleSize=6,this._height=100,this._labelOffset=!1,this._on={},this.orient("bottom"),this._playButton=!0,this._playButtonClass=(new l).on("click",()=>{
|
|
2292
2299
|
// if playing, pause
|
|
2293
|
-
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let h=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(Pt.date).map(Number)).length&&t.push(t[0]);var i=this._ticks.map(Number),e=i.indexOf(t[0]),s=i.indexOf(t[t.length-1]);(s===i.length-1?h?this.selection([this._ticks[0],this._ticks[s-e]]):(clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass):(s+1===i.length-1&&(clearInterval(this._playTimer),this._playTimer=!1),this.selection([this._ticks[e+1],this._ticks[s+1]]))).render(),h=!1};this._playTimer=setInterval(t,this._playButtonInterval),t()}}).on("mousemove",()=>this._playButtonClass.select().style("cursor","pointer")),this._playButtonConfig={fontColor:A.colorDefaults.dark,fontSize:15,text:()=>this._playTimer?"⏸︎":"⏵",textAnchor:"middle",verticalAlign:"middle"},this._playButtonInterval=1e3,this._selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===this._buttonBehaviorCurrent?.3:1,"stroke-width":0},this._shape="Rect",this._shapeConfig=Pt.assign({},this._shapeConfig,{labelBounds:t=>"buttons"===this._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-this._buttonHeight/2+1,width:t.labelBounds.width,height:this._buttonHeight}:t.labelBounds,labelConfig:{fontColor:A.colorDefaults.dark,fontSize:()=>12,verticalAlign:()=>"buttons"===this._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===this._buttonBehaviorCurrent?"#fff":
|
|
2300
|
+
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let h=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(Pt.date).map(Number)).length&&t.push(t[0]);var i=this._ticks.map(Number),e=i.indexOf(t[0]),s=i.indexOf(t[t.length-1]);(s===i.length-1?h?this.selection([this._ticks[0],this._ticks[s-e]]):(clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass):(s+1===i.length-1&&(clearInterval(this._playTimer),this._playTimer=!1),this.selection([this._ticks[e+1],this._ticks[s+1]]))).render(),h=!1};this._playTimer=setInterval(t,this._playButtonInterval),t()}}).on("mousemove",()=>this._playButtonClass.select().style("cursor","pointer")),this._playButtonConfig={fontColor:A.colorDefaults.dark,fontSize:15,text:()=>this._playTimer?"⏸︎":"⏵",textAnchor:"middle",verticalAlign:"middle"},this._playButtonInterval=1e3,this._selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===this._buttonBehaviorCurrent?.3:1,"stroke-width":0},this._shape="Rect",this._shapeConfig=Pt.assign({},this._shapeConfig,{labelBounds:t=>"buttons"===this._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-this._buttonHeight/2+1,width:t.labelBounds.width,height:this._buttonHeight}:t.labelBounds,labelConfig:{fontColor:A.colorDefaults.dark,fontSize:()=>12,verticalAlign:()=>"buttons"===this._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===this._buttonBehaviorCurrent?"#fff":_t,stroke:()=>"buttons"===this._buttonBehaviorCurrent?_t:"transparent",height:t=>"buttons"===this._buttonBehaviorCurrent?this._buttonHeight:t.tick?this._handleSize:0,width:t=>"buttons"===this._buttonBehaviorCurrent?this._ticksWidth/this._availableTicks.length:t.tick?this._domain.map(Number).includes(t.id)?2:1:0,y:t=>"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2:"start"===this._align?this._margin.top+this._buttonHeight/2:this._height-this._buttonHeight/2-this._margin.bottom:t.y,rx:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0,ry:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0}),this._snapping=!0}}
|
|
2294
2301
|
/**
|
|
2295
2302
|
* Creates a reference element for popper.
|
|
2296
2303
|
* @param {Number[]} position
|
|
2297
|
-
* @
|
|
2298
|
-
*/function
|
|
2304
|
+
* @private
|
|
2305
|
+
*/function gt(t=[0,0]){return()=>({width:0,height:0,top:t[1],right:t[0],bottom:t[1],left:t[0]})}class ct extends h{
|
|
2299
2306
|
/**
|
|
2300
2307
|
The inner return object and draw function that gets assigned the public methods.
|
|
2301
2308
|
@private
|
|
@@ -2311,7 +2318,7 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2311
2318
|
/**
|
|
2312
2319
|
Sets styles for both enter and update.
|
|
2313
2320
|
@private
|
|
2314
|
-
*/function r(t){t.style("background",o._background).style(o._prefix+"border-radius",o._borderRadius).style("pointer-events",o._pointerEvents).style("padding",o._padding).style("width",o._width).style("height",o._height).style("border",o._border)}Pt.stylize(h,this._tooltipStyle),e("title"),e("body");var a=s.append("table").attr("class","d3plus-tooltip-table"),l=h.select(".d3plus-tooltip-table"),l=(Pt.stylize(l,this._tableStyle),a.append("thead").attr("class","d3plus-tooltip-thead"),h.select(".d3plus-tooltip-thead")),l=(Pt.stylize(l,this._theadStyle),l.selectAll("tr").data([0])),_=l.enter().append("tr"),l=(l.exit().remove(),l.merge(_)),_=(Pt.stylize(l,this._trStyle),l.selectAll("th").data(this._thead)),l=(_.enter().append("th").merge(_).html(n),_.exit().remove(),a.append("tbody").attr("class","d3plus-tooltip-tbody"),h.select(".d3plus-tooltip-tbody")),_=(Pt.stylize(l,this._tbodyStyle),l.selectAll("tr").data(this._tbody)),a=_.enter().append("tr"),l=(_.exit().remove(),_.merge(a)),_=(Pt.stylize(l,this._trStyle),l.selectAll("td").data(t=>t));return _.enter().append("td").merge(_).html(n),Pt.stylize(_,this._tdStyle),e("footer"),e("arrow"),s.attr("id",(t,i)=>"d3plus-tooltip-"+(t?this._id(t,i):"")).call(r).each((t,i)=>{var e=o._id(t,i),s=document.getElementById("d3plus-tooltip-"+e),h=document.getElementById("d3plus-tooltip-arrow-"+e);let n=h.offsetHeight;var r=h.getBoundingClientRect().height/2,a=(h.style.bottom=`-${n/2}px`,o._position(t,i)),a=Array.isArray(a)?{getBoundingClientRect:
|
|
2321
|
+
*/function r(t){t.style("background",o._background).style(o._prefix+"border-radius",o._borderRadius).style("pointer-events",o._pointerEvents).style("padding",o._padding).style("width",o._width).style("height",o._height).style("border",o._border)}Pt.stylize(h,this._tooltipStyle),e("title"),e("body");var a=s.append("table").attr("class","d3plus-tooltip-table"),l=h.select(".d3plus-tooltip-table"),l=(Pt.stylize(l,this._tableStyle),a.append("thead").attr("class","d3plus-tooltip-thead"),h.select(".d3plus-tooltip-thead")),l=(Pt.stylize(l,this._theadStyle),l.selectAll("tr").data([0])),_=l.enter().append("tr"),l=(l.exit().remove(),l.merge(_)),_=(Pt.stylize(l,this._trStyle),l.selectAll("th").data(this._thead)),l=(_.enter().append("th").merge(_).html(n),_.exit().remove(),a.append("tbody").attr("class","d3plus-tooltip-tbody"),h.select(".d3plus-tooltip-tbody")),_=(Pt.stylize(l,this._tbodyStyle),l.selectAll("tr").data(this._tbody)),a=_.enter().append("tr"),l=(_.exit().remove(),_.merge(a)),_=(Pt.stylize(l,this._trStyle),l.selectAll("td").data(t=>t));return _.enter().append("td").merge(_).html(n),Pt.stylize(_,this._tdStyle),e("footer"),e("arrow"),s.attr("id",(t,i)=>"d3plus-tooltip-"+(t?this._id(t,i):"")).call(r).each((t,i)=>{var e=o._id(t,i),s=document.getElementById("d3plus-tooltip-"+e),h=document.getElementById("d3plus-tooltip-arrow-"+e);let n=h.offsetHeight;var r=h.getBoundingClientRect().height/2,a=(h.style.bottom=`-${n/2}px`,o._position(t,i)),a=Array.isArray(a)?{getBoundingClientRect:gt(a)}:a;this._popperClasses[e]=x.createPopper(a,s,{placement:"top",modifiers:[{name:"arrow",options:{element:h}},{name:"offset",options:{offset:[0,o._offset(t,i)+r]}},{name:"preventOverflow",options:{boundary:"scrollParent",padding:5}},{name:"flip",options:{behavior:"flip",boundary:"viewport",fallbackPlacements:["bottom"],padding:5}},{name:"update",enabled:!0,phase:"afterWrite",fn(t){var t=t.state,i=t.elements.arrow,e=t.styles.arrow,t=t.modifiersData.flip._skip,s=parseFloat(i.style.borderRightWidth,10);t?(i.style.transform=e.transform+"rotate(225deg)",i.style.top=`-${n/2+s}px`):(i.style.transform=e.transform+"rotate(45deg)",i.style.bottom=`-${n/2+s}px`)}}],removeOnDestroy:!0})}),h.each((t,i)=>{var e=o._id(t,i),t=o._position(t,i),i=this._popperClasses[e];i&&(i.state.elements.reference.getBoundingClientRect=Array.isArray(t)?gt(t):t,i.update())}).call(r),i.exit().each((t,i)=>{t=o._id(t,i),i=this._popperClasses[t];i&&(i.destroy(),delete this._popperClasses[t])}).remove(),t&&setTimeout(t,100),this}
|
|
2315
2322
|
/**
|
|
2316
2323
|
@memberof Tooltip
|
|
2317
2324
|
@desc Sets the inner HTML content of the arrow element, which by default is empty.
|
|
@@ -2543,18 +2550,18 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2543
2550
|
@function _drawColorScale
|
|
2544
2551
|
@desc Renders the color scale if this._colorScale is not falsey.
|
|
2545
2552
|
@private
|
|
2546
|
-
*/function
|
|
2553
|
+
*/function ut(){var t=this._data;let i=this._colorScalePosition.bind(this)(this.config());[!1,"top","bottom","left","right"].includes(i)||(i="bottom");var e=["top","bottom"].includes(i),s=this._colorScale&&i,h=this._colorScalePadding()?this._padding:{top:0,right:0,bottom:0,left:0},n=this._width-(this._margin.left+this._margin.right+h.left+h.right),r=e?Dt.min([this._colorScaleMaxSize,n]):this._width-(this._margin.left+this._margin.right),a=this._height-(this._margin.bottom+this._margin.top+h.bottom+h.top),o=e?this._height-(this._margin.bottom+this._margin.top):Dt.min([this._colorScaleMaxSize,a]),n={opacity:i?1:0,transform:`translate(${e?this._margin.left+h.left+(n-r)/2:this._margin.left}, ${e?this._margin.top:this._margin.top+h.top+(a-o)/2})`},h=Pt.elem("g.d3plus-viz-colorScale",{condition:s&&!this._colorScaleConfig.select,enter:n,parent:this._select,duration:this._duration,update:n}).node();this._colorScale&&(a=t.filter((t,i)=>{t=this._colorScale(t,i);return null!=t}),this._colorScaleClass.align({bottom:"end",left:"start",right:"end",top:"start"}[i]||"bottom").duration(this._duration).data(a).height(o).locale(this._locale).orient(i).select(h).value(this._colorScale).width(r).config(this._colorScaleConfig).render(),s)&&(n=this._colorScaleClass.outerBounds(),!this._colorScaleConfig.select)&&n.height&&(this._margin[i]+=e?n.height+2*this._legendClass.padding():n.width+2*this._legendClass.padding())}let pt=["fill","opacity","texture"];
|
|
2547
2554
|
/**
|
|
2548
2555
|
@function legendLabel
|
|
2549
2556
|
@desc Default label function for the legend.
|
|
2550
2557
|
@private
|
|
2551
|
-
*/function
|
|
2558
|
+
*/function ft(t,i){return this._drawLabel(t,i,this._legendDepth)}
|
|
2552
2559
|
/**
|
|
2553
2560
|
@function _drawLegend
|
|
2554
2561
|
@desc Renders the legend if this._legend is not falsy.
|
|
2555
2562
|
@param {Array} data The filtered data array to be displayed.
|
|
2556
2563
|
@private
|
|
2557
|
-
*/function
|
|
2564
|
+
*/function mt(t=[]){let e=[],s=(t,i,e)=>{var s=this._shape(t,i),s=("fill"===e&&"Line"===s&&(e="stroke"),(this._shapeConfig[s]&&this._shapeConfig[s][e]?this._shapeConfig[s]:this._shapeConfig)[e]);return"function"==typeof s?s.bind(this)(t,i):s};var i=(i,e)=>pt.map(t=>s(i,e,t)).join("_"),t=this._colorScale?t.filter((t,i)=>void 0===this._colorScale(t,i)):t,h=(Dt.rollup(t,t=>e.push(Lt.merge(t,this._aggs)),i),e.sort(this._legendSort),e.map((t,i)=>this._ids(t,i).slice(0,this._drawDepth+1)));for(let i=this._legendDepth=0;i<=this._drawDepth;i++){var n=h.map(t=>t[i]);if(!n.some(t=>t instanceof Array)&&Array.from(new Set(n)).length===e.length){this._legendDepth=i;break}}let r=(t,i)=>{let e=this._id(t,i);return e instanceof Array&&(e=e[0]),this._hidden.includes(e)||this._solo.length&&!this._solo.includes(e)};var t=this._legendClass.outerBounds(),a=this.config();let o=this._legendPosition.bind(this)(a);[!1,"top","bottom","left","right"].includes(o)||(o="bottom");var l=["top","bottom"].includes(o),_=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},d={transform:`translate(${l?this._margin.left+_.left:this._margin.left}, ${l?this._margin.top:this._margin.top+_.top})`},a=this._legend.bind(this)(a,e),d=Pt.elem("g.d3plus-viz-legend",{condition:a&&!this._legendConfig.select,enter:d,parent:this._select,duration:this._duration,update:d}).node();this._legendClass.id(i).align(l?"center":o).direction(l?"row":"column").duration(this._duration).data(a?e:[]).height(l?this._height-(this._margin.bottom+this._margin.top):this._height-(this._margin.bottom+this._margin.top+_.bottom+_.top)).locale(this._locale).parent(this).select(d).verticalAlign(l?o:"middle").width(l?this._width-(this._margin.left+this._margin.right+_.left+_.right):this._width-(this._margin.left+this._margin.right)).shapeConfig(jt.bind(this)(this._shapeConfig,"legend")).shapeConfig({fill:(t,i)=>r(t,i)?this._hiddenColor(t,i):s(t,i,"fill"),labelConfig:{fontOpacity:(t,i)=>r(t,i)?this._hiddenOpacity(t,i):1}}).config(this._legendConfig).render(),!this._legendConfig.select&&t.height&&(this._margin[o]+=l?t.height+2*this._legendClass.padding():t.width+2*this._legendClass.padding())}
|
|
2558
2565
|
/**
|
|
2559
2566
|
@function _drawSubtitle
|
|
2560
2567
|
@desc Draws a subtitle if this._subtitle is defined.
|
|
@@ -2566,22 +2573,22 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2566
2573
|
@desc Determines whether or not to update the timeFilter method of the Viz.
|
|
2567
2574
|
@param {Array|Date} The timeline selection given from the d3 brush.
|
|
2568
2575
|
@private
|
|
2569
|
-
*/function
|
|
2576
|
+
*/function yt(i){i instanceof Array||(i=[i,i]),JSON.stringify(i)!==JSON.stringify(this._timelineSelection)&&(i=(this._timelineSelection=i).map(Number),this.timeFilter(t=>{t=Pt.date(this._time(t)).getTime();return t>=i[0]&&t<=i[1]}).render())}
|
|
2570
2577
|
/**
|
|
2571
2578
|
@function _drawTimeline
|
|
2572
2579
|
@desc Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
|
|
2573
2580
|
@param {Array} data The filtered data array to be displayed.
|
|
2574
2581
|
@private
|
|
2575
|
-
*/let
|
|
2582
|
+
*/let xt=!1;
|
|
2576
2583
|
/**
|
|
2577
2584
|
@name zoomControls
|
|
2578
2585
|
@desc Sets up initial zoom events and controls.
|
|
2579
2586
|
@private
|
|
2580
|
-
*/function
|
|
2587
|
+
*/function bt(){if(this._container&&this._zoomGroup){let t=this._zoomHeight||this._height-this._margin.top-this._margin.bottom,i=this,e=this._zoomWidth||this._width-this._margin.left-this._margin.right,s=(this._zoomBehavior.extent([[0,0],[e,t]]).scaleExtent([1,this._zoomMax]).translateExtent([[0,0],[e,t]]).on("zoom",t=>Ct.bind(this)(t.transform)),this._zoomToBounds=kt.bind(this),j.select(this._select.node().parentNode).selectAll("div.d3plus-zoom-control").data(this._zoom?[0]:[]));var h=s.enter().append("div").attr("class","d3plus-zoom-control"),h=(s.exit().remove(),s=s.merge(h).style("position","absolute").style("top",this._margin.top+"px").style("left",this._margin.left+"px"),h.append("div").attr("class","zoom-control zoom-in"),s.select(".zoom-in").on("click",wt.bind(this,this._zoomFactor)).html("+"),h.append("div").attr("class","zoom-control zoom-out"),s.select(".zoom-out").on("click",wt.bind(this,1/this._zoomFactor)).html("-"),h.append("div").attr("class","zoom-control zoom-reset"),s.select(".zoom-reset").on("click",wt.bind(this,0)).html("↺"),h.append("div").attr("class","zoom-control zoom-brush"),s.select(".zoom-brush").on("click",function(){j.select(this).classed("active",!xt).call(Pt.stylize,xt?i._zoomControlStyle||{}:i._zoomControlStyleActive||{}),vt.bind(i)(!xt)}).html("¤"),s.selectAll(".zoom-control").call(Pt.stylize,i._zoomControlStyle).on("mouseenter",function(){j.select(this).call(Pt.stylize,i._zoomControlStyleHover||{})}).on("mouseleave",function(){j.select(this).call(Pt.stylize,j.select(this).classed("active")?i._zoomControlStyleActive||{}:i._zoomControlStyle||{})}),this._zoomBrush.extent([[0,0],[e,t]]).filter(t=>!t.button&&t.detail<2).handleSize(this._zoomBrushHandleSize).on("start",
|
|
2581
2588
|
/**
|
|
2582
2589
|
@desc Triggered on brush "start".
|
|
2583
2590
|
@private
|
|
2584
|
-
*/function(){
|
|
2591
|
+
*/function(){St.bind(this)()}
|
|
2585
2592
|
/**
|
|
2586
2593
|
@desc Overrides the default brush styles.
|
|
2587
2594
|
@private
|
|
@@ -2589,37 +2596,37 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2589
2596
|
/**
|
|
2590
2597
|
@desc Triggered on brush "brush".
|
|
2591
2598
|
@private
|
|
2592
|
-
*/function(){
|
|
2599
|
+
*/function(){St.bind(this)()}
|
|
2593
2600
|
/**
|
|
2594
2601
|
@desc Triggered on brush "end".
|
|
2595
2602
|
@private
|
|
2596
2603
|
*/.bind(this)).on("end",function(t){t.selection&&(// Only transition after input.
|
|
2597
|
-
this._brushGroup.call(this._zoomBrush.move,null),
|
|
2604
|
+
this._brushGroup.call(this._zoomBrush.move,null),kt.bind(this)(t.selection))}.bind(this)),this._container.selectAll("g.brush").data([0]));this._brushGroup=h.enter().append("g").attr("class","brush").merge(h).call(this._zoomBrush),vt.bind(this)(),this._renderTiles&&this._renderTiles(d.zoomTransform(this._container.node()),0)}}
|
|
2598
2605
|
/**
|
|
2599
2606
|
@name zoomEvents
|
|
2600
2607
|
@desc Handles adding/removing zoom event listeners.
|
|
2601
2608
|
@private
|
|
2602
|
-
*/function
|
|
2609
|
+
*/function vt(t=!1){(xt=t)?this._brushGroup.style("display","inline"):this._brushGroup.style("display","none"),!xt&&this._zoom?(this._container.call(this._zoomBehavior),this._zoomScroll||this._container.on("wheel.zoom",null),this._zoomPan||this._container.on("mousedown.zoom mousemove.zoom",null).on("touchstart.zoom touchmove.zoom touchend.zoom touchcancel.zoom",null)):this._container.on(".zoom",null)}
|
|
2603
2610
|
/**
|
|
2604
2611
|
@name zoomed
|
|
2605
2612
|
@desc Handles events dispatched from this._zoomBehavior
|
|
2606
2613
|
@param {Object} [*transform* = event.transform]
|
|
2607
2614
|
@param {Number} [*duration* = 0]
|
|
2608
2615
|
@private
|
|
2609
|
-
*/function
|
|
2616
|
+
*/function Ct(t=!1,i=0){this._zoomGroup&&(i?this._zoomGroup.transition().duration(i):this._zoomGroup).attr("transform",t),this._renderTiles&&this._renderTiles(d.zoomTransform(this._container.node()),i)}
|
|
2610
2617
|
/**
|
|
2611
2618
|
@name zoomMath
|
|
2612
2619
|
@desc Zooms in or out based on the provided multiplier.
|
|
2613
2620
|
@param {Number} [*factor* = 0]
|
|
2614
2621
|
@private
|
|
2615
|
-
*/function
|
|
2622
|
+
*/function wt(t=0){var i,e,s,h;this._container&&(i=this._zoomBehavior.extent().bind(document)()[1].map(t=>t/2),e=this._zoomBehavior.scaleExtent(),s=d.zoomTransform(this._container.node()),!t||(h=[(i[0]-s.x)/s.k,(i[1]-s.y)/s.k],s.k=Math.min(e[1],s.k*t),s.k<=e[0])?(s.k=e[0],s.x=0,s.y=0):(s.x+=i[0]-(h[0]*s.k+s.x),s.y+=i[1]-(h[1]*s.k+s.y)),Ct.bind(this)(s,this._duration))}
|
|
2616
2623
|
/**
|
|
2617
2624
|
@name zoomToBounds
|
|
2618
2625
|
@desc Zooms to given bounds.
|
|
2619
2626
|
@param {Array} *bounds*
|
|
2620
2627
|
@param {Number} [*duration* = 0]
|
|
2621
2628
|
@private
|
|
2622
|
-
*/function
|
|
2629
|
+
*/function kt(s,t=this._duration){var h=this._zoomBehavior.scaleExtent(),n=d.zoomTransform(this._container.node());if(s){var[r,a]=this._zoomBehavior.translateExtent()[1],o=s[1][0]-s[0][0],l=s[1][1]-s[0][1];let t=Math.min(h[1],1/Math.max(o/r,l/a)),i,e;o/l<r/a?(t*=(a-2*this._zoomPadding)/a,i=(r-o*t)/2/t,e=this._zoomPadding/t):(t*=(r-2*this._zoomPadding)/r,e=(a-l*t)/2/t,i=this._zoomPadding/t),n.x=(n.x-s[0][0]+i)*(n.k*t/n.k),n.y=(n.y-s[0][1]+e)*(n.k*t/n.k),n.k*=t,0<n.x?n.x=0:n.x<r*-n.k+r&&(n.x=r*-n.k+r),0<n.y?n.y=0:n.y<a*-n.k+a&&(n.y=a*-n.k+a)}else n.k=h[0],n.x=0,n.y=0;Ct.bind(this)(n,t)}function St(){this._brushGroup.selectAll(".selection").call(Pt.attrize,this._zoomBrushSelectionStyle||{}),this._brushGroup.selectAll(".handle").call(Pt.attrize,this._zoomBrushHandleStyle||{})}
|
|
2623
2630
|
/**
|
|
2624
2631
|
@name _drawAttribution
|
|
2625
2632
|
@desc Draws absolute positioned attribution text.
|
|
@@ -2631,14 +2638,14 @@ this._brushGroup.call(this._zoomBrush.move,null),wt.bind(this)(t.selection))}.bi
|
|
|
2631
2638
|
@param {Object} *d* The data object being interacted with.
|
|
2632
2639
|
@param {Number} *i* The index of the data object being interacted with.
|
|
2633
2640
|
@private
|
|
2634
|
-
*/function
|
|
2641
|
+
*/function zt(t,i,e,s){if(s.stopPropagation(),this._drawDepth<this._groupBy.length-1){this._select.style("cursor","auto");let e=this._groupBy[this._drawDepth],s=e(t,i),h=(this.hover(!1),this._tooltip(t,i)&&this._tooltipClass.data([]).render(),this._filter);this._history.push({depth:this._depth,filter:h}),this.config({depth:this._drawDepth+1,filter:(t,i)=>(!h||h(t,i))&&e(t,i)===s}).render()}}
|
|
2635
2642
|
/**
|
|
2636
2643
|
@module clickLegend
|
|
2637
2644
|
@desc On click event for all legend shapes in a Viz.
|
|
2638
2645
|
@param {Object} *d* The data object being interacted with.
|
|
2639
2646
|
@param {Number} *i* The index of the data object being interacted with.
|
|
2640
2647
|
@private
|
|
2641
|
-
*/function
|
|
2648
|
+
*/function Mt(t,i,e,s){this._select.style("cursor","auto"),this._tooltip(t,i)&&this._tooltipClass.data([]).render();let h=this._id(t,i);h instanceof Array||(h=[h]);var t=this._hidden.indexOf(h[0]),i=this._solo.indexOf(h[0]),n=Dt.merge(this._legendClass.data().map((t,i)=>{let e=this._id(t,i);return e=e instanceof Array?e:[e]})).length;this._legendFilterInvert.bind(this)()?s.shiftKey?t<0&&!this._solo.length?(this._hidden=this._hidden.concat(h),0<=i&&(this._solo=[]),this._hidden.length===n&&(this._hidden=[]),this.render()):0<=i&&(this._solo=[],this._hidden=[],this.render()):(i<0&&this._hidden.length<n-1?this._solo=h:this._solo=[],this._hidden=[],this.render()):s.shiftKey&&i<0?(this._solo=h,this._hidden=[],this.render()):s.shiftKey||(0<=t?this._hidden.splice(t,h.length):0<=i?(this._solo=[],this._hidden=[]):this._solo.length&&i<0?(this._solo=this._solo.concat(h),this._solo.length===n&&(this._solo=[])):(this._hidden=this._hidden.concat(h),this._hidden.length===n&&(this._hidden=[])),this.render())}
|
|
2642
2649
|
/**
|
|
2643
2650
|
@module mouseEnter
|
|
2644
2651
|
@desc On mouseenter event for all shapes in a Viz.
|
|
@@ -2648,9 +2655,11 @@ this._brushGroup.call(this._zoomBrush.move,null),wt.bind(this)(t.selection))}.bi
|
|
|
2648
2655
|
*/
|
|
2649
2656
|
/**
|
|
2650
2657
|
* Default padding logic that will return false if the screen is less than 600 pixels wide.
|
|
2651
|
-
|
|
2658
|
+
* @private
|
|
2659
|
+
*/function At(){return"undefined"==typeof window||600<window.innerWidth}
|
|
2652
2660
|
/**
|
|
2653
2661
|
* Turns an array of values into a list string.
|
|
2662
|
+
* @private
|
|
2654
2663
|
*/
|
|
2655
2664
|
/**
|
|
2656
2665
|
* A function that introspects the `d` Data Object for internally nested
|
|
@@ -2659,7 +2668,7 @@ this._brushGroup.call(this._zoomBrush.move,null),wt.bind(this)(t.selection))}.bi
|
|
|
2659
2668
|
* @param {Object} d Data Object
|
|
2660
2669
|
* @param {Number} i Index of Data Object in Array
|
|
2661
2670
|
* @private
|
|
2662
|
-
*/function
|
|
2671
|
+
*/function Bt(t,i,e){for(;i.__d3plus__&&i.data;)e=(i=i.data).i;return t(i,e)}class _ extends h{
|
|
2663
2672
|
/**
|
|
2664
2673
|
@memberof Viz
|
|
2665
2674
|
@desc Called by draw before anything is drawn. Formats the data and performs preparations for draw.
|
|
@@ -2669,9 +2678,9 @@ this._brushGroup.call(this._zoomBrush.move,null),wt.bind(this)(t.selection))}.bi
|
|
|
2669
2678
|
// set the default timeFilter if it has not been specified
|
|
2670
2679
|
if(this._drawDepth=void 0!==this._depth?Dt.min([0<=this._depth?this._depth:0,this._groupBy.length-1]):this._groupBy.length-1,
|
|
2671
2680
|
// Returns the current unique ID for a data point, coerced to a String.
|
|
2672
|
-
this._id=(t,i)=>{t=
|
|
2681
|
+
this._id=(t,i)=>{t=Bt(this._groupBy[this._drawDepth],t,i);return"number"==typeof t?""+t:t},
|
|
2673
2682
|
// Returns an array of the current unique groupBy ID for a data point, coerced to Strings.
|
|
2674
|
-
this._ids=(i,e)=>this._groupBy.map(t=>""+
|
|
2683
|
+
this._ids=(i,e)=>this._groupBy.map(t=>""+Bt(t,i,e)).filter(Boolean),this._drawLabel=(t,i,e=this._drawDepth)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;var s;return t._isAggregation?`${this._thresholdName(t,i)} < ${Tt.formatAbbreviate(100*t._threshold,this._locale)}%`:this._label&&e===this._drawDepth?""+this._label(t,i):(e=h._ids(t,i).slice(0,e+1),(e=e.reverse().find(t=>!(t instanceof Array))||e[e.length-1])instanceof Array?(s=e).reduce((t,i,e)=>(e?e===s.length-1&&1===e?t+=" and "+i:e===s.length-1?t+=", and "+i:t+=", "+i:t+=i,t),""):""+e)},this._time&&!this._timeFilter&&this._data.length){var t=this._data.map(this._time).map(Pt.date),i=this._data[0];if(this._discrete&&"_"+this._discrete in this&&this["_"+this._discrete](i,0)===this._time(i,0))this._timeFilter=()=>!0;else{let e=+Dt.max(t);this._timeFilter=(t,i)=>+Pt.date(this._time(t,i))==e}}this._filteredData=[],this._legendData=[];let e=[];if(this._data.length){e=this._timeFilter?this._data.filter(this._timeFilter):this._data,this._filter&&(e=e.filter(this._filter));var s=[];for(let t=0;t<=this._drawDepth;t++)s.push(this._groupBy[t]);this._discrete&&"_"+this._discrete in this&&s.push(this["_"+this._discrete]),this._discrete&&`_${this._discrete}2`in this&&s.push(this[`_${this._discrete}2`]);i=Dt.rollup(e,t=>{var i=this._data.indexOf(t[0]),e=this._shape(t[0],i),i=this._id(t[0],i),s=Lt.merge(t,this._aggs);this._hidden.includes(i)||this._solo.length&&!this._solo.includes(i)||(this._discrete||"Line"!==e?this._filteredData.push(s):this._filteredData=this._filteredData.concat(t)),this._legendData.push(s)},...s);this._filteredData=this._thresholdFunction(this._filteredData,i)}
|
|
2675
2684
|
// overrides the hoverOpacity of shapes if data is larger than cutoff
|
|
2676
2685
|
Dt.group(this._filteredData,this._id).size>this._dataCutoff?(void 0===this._userHover&&(this._userHover=this._shapeConfig.hoverOpacity||.5),void 0===this._userDuration&&(this._userDuration=this._shapeConfig.duration||600),this._shapeConfig.hoverOpacity=1,this._shapeConfig.duration=0):void 0!==this._userHover&&(this._shapeConfig.hoverOpacity=this._userHover,this._shapeConfig.duration=this._userDuration),this._noDataMessage&&!this._filteredData.length&&(this._messageClass.render({container:this._select.node().parentNode,html:this._noDataHTML(this),mask:!1,style:this._messageStyle}),this._select.transition().duration(this._duration).attr("opacity",0))}
|
|
2677
2686
|
/**
|
|
@@ -2682,7 +2691,7 @@ Dt.group(this._filteredData,this._id).size>this._dataCutoff?(void 0===this._user
|
|
|
2682
2691
|
// Sanitizes user input for legendPosition and colorScalePosition
|
|
2683
2692
|
let t=this._legendPosition.bind(this)(this.config()),i=([!1,"top","bottom","left","right"].includes(t)||(t="bottom"),this._colorScalePosition.bind(this)(this.config()));[!1,"top","bottom","left","right"].includes(i)||(i="bottom"),
|
|
2684
2693
|
// Draws legend and colorScale if they are positioned "left" or "right"
|
|
2685
|
-
"left"!==t&&"right"!==t||
|
|
2694
|
+
"left"!==t&&"right"!==t||mt.bind(this)(this._legendData),"left"!==i&&"right"!==i&&!1!==i||ut.bind(this)(this._filteredData),
|
|
2686
2695
|
// Draws all of the top/bottom UI elements
|
|
2687
2696
|
function(){var t=this._history.length,i=Pt.elem("g.d3plus-viz-back",{parent:this._select,duration:this._duration,update:{transform:`translate(${this._margin.left}, ${this._margin.top})`}}).node();this._backClass.data(t?[{text:"← "+this._translate("Back"),x:0,y:0}]:[]).select(i).config(this._backConfig).render(),this._margin.top+=t?this._backClass.fontSize()()+2*this._backClass.padding()():0}.bind(this)(),
|
|
2688
2697
|
/**
|
|
@@ -2696,12 +2705,13 @@ function(){var t=this._history.length,i=Pt.elem("g.d3plus-viz-back",{parent:this
|
|
|
2696
2705
|
@desc Draws a total title if this._total is defined.
|
|
2697
2706
|
@param {Array} [*data*] The currently filtered dataset.
|
|
2698
2707
|
@private
|
|
2699
|
-
*/.bind(this)(this._filteredData),function(t=[]){var t=!!this._subtitle&&this._subtitle(t),i=this._subtitlePadding()?this._padding:{right:0,left:0},e={transform:`translate(${this._margin.left+i.left}, ${this._margin.top})`},e=Pt.elem("g.d3plus-viz-subtitle",{enter:e,parent:this._select,duration:0,update:e}).node();this._subtitleClass.data(t?[{text:t}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+i.left+i.right)).config(this._subtitleConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._subtitleConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var t="function"==typeof this._total?Dt.sum(t.map(this._total)):!(!0!==this._total||!this._size)&&Dt.sum(t.map(this._size)),i=this._totalPadding()?this._padding:{right:0,left:0},e={transform:`translate(${this._margin.left+i.left}, ${this._margin.top})`},e=Pt.elem("g.d3plus-viz-total",{enter:e,parent:this._select,duration:0,update:e}).node();this._totalClass.data(t?[{text:this._totalFormat(t)}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+i.left+i.right)).config(this._totalConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._totalConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var e=(s=this._time&&this._timeline)?Lt.unique(this._data.map(this._time)).map(Pt.date):[],s=s&&1<e.length,h=this._timelinePadding()?this._padding:{right:0,left:0},n={transform:`translate(${this._margin.left+h.left}, 0)`},n=Pt.elem("g.d3plus-viz-timeline",{condition:s,enter:n,parent:this._select,duration:this._duration,update:n}).node();if(s){s=this._timelineClass.domain(Dt.extent(e)).duration(this._duration).height(this._height-this._margin.bottom).locale(this._locale).select(n).ticks(e.sort((t,i)=>+t-+i)).width(this._width-(this._margin.left+this._margin.right+h.left+h.right)),n=Dt.extent(t.map(this._time).map(Pt.date));this._timelineSelection?(this._timelineSelection[0]<n[0]&&(this._timelineSelection[0]=n[0]),this._timelineSelection[1]>n[1]&&(this._timelineSelection[1]=n[1])):this._timelineSelection=this._timelineDefault||n,s.selection(this._timelineSelection);let i=this._timelineConfig;s.config(i).on("brush",t=>{
|
|
2708
|
+
*/.bind(this)(this._filteredData),function(t=[]){var t=!!this._subtitle&&this._subtitle(t),i=this._subtitlePadding()?this._padding:{right:0,left:0},e={transform:`translate(${this._margin.left+i.left}, ${this._margin.top})`},e=Pt.elem("g.d3plus-viz-subtitle",{enter:e,parent:this._select,duration:0,update:e}).node();this._subtitleClass.data(t?[{text:t}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+i.left+i.right)).config(this._subtitleConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._subtitleConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var t="function"==typeof this._total?Dt.sum(t.map(this._total)):!(!0!==this._total||!this._size)&&Dt.sum(t.map(this._size)),i=this._totalPadding()?this._padding:{right:0,left:0},e={transform:`translate(${this._margin.left+i.left}, ${this._margin.top})`},e=Pt.elem("g.d3plus-viz-total",{enter:e,parent:this._select,duration:0,update:e}).node();this._totalClass.data(t?[{text:this._totalFormat(t)}]:[]).locale(this._locale).select(e).width(this._width-(this._margin.left+this._margin.right+i.left+i.right)).config(this._totalConfig).render(),this._margin.top+=t?e.getBBox().height+2*this._totalConfig.padding:0}.bind(this)(this._filteredData),function(t=[]){var e=(s=this._time&&this._timeline)?Lt.unique(this._data.map(this._time)).map(Pt.date):[],s=s&&1<e.length,h=this._timelinePadding()?this._padding:{right:0,left:0},n={transform:`translate(${this._margin.left+h.left}, 0)`},n=Pt.elem("g.d3plus-viz-timeline",{condition:s,enter:n,parent:this._select,duration:this._duration,update:n}).node();if(s){s=this._timelineClass.domain(Dt.extent(e)).duration(this._duration).height(this._height-this._margin.bottom).locale(this._locale).select(n).ticks(e.sort((t,i)=>+t-+i)).width(this._width-(this._margin.left+this._margin.right+h.left+h.right)),n=Dt.extent(t.map(this._time).map(Pt.date));this._timelineSelection?(this._timelineSelection[0]<n[0]&&(this._timelineSelection[0]=n[0]),this._timelineSelection[1]>n[1]&&(this._timelineSelection[1]=n[1])):this._timelineSelection=this._timelineDefault||n,s.selection(this._timelineSelection);let i=this._timelineConfig;s.config(i).on("brush",t=>{yt.bind(this)(t),i.on&&i.on.brush&&i.on.brush(t)}).on("end",t=>{yt.bind(this)(t),i.on&&i.on.end&&i.on.end(t)}).render(),this._margin.bottom+=s.outerBounds().height+2*s.padding()}}.bind(this)(this._filteredData),
|
|
2700
2709
|
// Draws legend and colorScale if they are positioned "top" or "bottom"
|
|
2701
|
-
"top"!==t&&"bottom"!==t||
|
|
2710
|
+
"top"!==t&&"bottom"!==t||mt.bind(this)(this._legendData),"top"!==i&&"bottom"!==i||ut.bind(this)(this._filteredData),this._shapes=[]}
|
|
2702
2711
|
/**
|
|
2703
2712
|
* Applies the threshold algorithm according to the type of chart used.
|
|
2704
2713
|
* @param {Array} data The data to process.
|
|
2714
|
+
* @private
|
|
2705
2715
|
*/_thresholdFunction(t){return t}
|
|
2706
2716
|
/**
|
|
2707
2717
|
@memberof Viz
|
|
@@ -2724,7 +2734,7 @@ null===this._select.attr("opacity")&&this._select.attr("opacity",1);var i=this._
|
|
|
2724
2734
|
// only if this._ariaHidden is set to true
|
|
2725
2735
|
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]:[]),i=t.enter().append("g").attr("class","data-table").attr("role","table"),t=(t.exit().remove(),t.merge(i).selectAll("text").data(this._data instanceof Array?Dt.range(0,this._data.length+1):[])),i=(t.exit().remove(),t.merge(t.enter().append("text").attr("role","row")).selectAll("tspan").data((t,i)=>e.map(t=>({role:i?"cell":"columnheader",text:i?this._data[i-1][t]:t}))));i.exit().remove(),i.merge(i.enter().append("tspan")).attr("role",t=>t.role).attr("dy","-1000px").html(t=>t.text),
|
|
2726
2736
|
// finishes the draw cycle
|
|
2727
|
-
this._preDraw(),this._draw(s),
|
|
2737
|
+
this._preDraw(),this._draw(s),bt.bind(this)(),function(){let t=j.select(this._select.node().parentNode).selectAll("div.d3plus-attribution").data(this._attribution?[0]:[]);var i=t.enter().append("div").attr("class","d3plus-attribution");t.exit().remove(),t=t.merge(i).style("position","absolute").html(this._attribution).style("right",this._margin.right+"px").style("bottom",this._margin.bottom+"px").call(Pt.stylize,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)&&j.select(this._resizeContainer).on("resize."+this._uuid,()=>{this._resizePoll=clearTimeout(this._resizePoll),this._resizePoll=setTimeout(()=>{this._resizePoll=clearTimeout(this._resizePoll),h.bind(this)(),this.render(s)},this._detectResizeDelay)}),s&&setTimeout(s,this._duration+100)})}
|
|
2728
2738
|
// Attaches touchstart event listener to the BODY to hide the tooltip when the user touches any element without data
|
|
2729
2739
|
return j.select("body").on("touchstart."+this._uuid,
|
|
2730
2740
|
/**
|
|
@@ -3271,14 +3281,14 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
3271
3281
|
@memberof Viz
|
|
3272
3282
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3273
3283
|
@private
|
|
3274
|
-
*/constructor(){super(),this._aggs={},this._ariaHidden=!0,this._attribution=!1,this._attributionStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.25)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"400 11px/11px "+H.fontFamilyStringify(H.fontFamily),margin:"5px",opacity:.75,padding:"4px 6px 3px"},this._backClass=(new l).on("click",()=>{(this._history.length?this.config(this._history.pop()):this.depth(this._drawDepth-1).filter(!1)).render()}).on("mousemove",()=>this._backClass.select().style("cursor","pointer")),this._backConfig={fontSize:10,padding:5,resize:!1},this._cache=!0,this._color=(t,i)=>this._groupBy[0](t,i),this._colorDefaults={...A.colorDefaults,scale:S.scaleOrdinal().range(A.colorDefaults.scale.range())},this._colorScaleClass=new
|
|
3284
|
+
*/constructor(){super(),this._aggs={},this._ariaHidden=!0,this._attribution=!1,this._attributionStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.25)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"400 11px/11px "+H.fontFamilyStringify(H.fontFamily),margin:"5px",opacity:.75,padding:"4px 6px 3px"},this._backClass=(new l).on("click",()=>{(this._history.length?this.config(this._history.pop()):this.depth(this._drawDepth-1).filter(!1)).render()}).on("mousemove",()=>this._backClass.select().style("cursor","pointer")),this._backConfig={fontSize:10,padding:5,resize:!1},this._cache=!0,this._color=(t,i)=>this._groupBy[0](t,i),this._colorDefaults={...A.colorDefaults,scale:S.scaleOrdinal().range(A.colorDefaults.scale.range())},this._colorScaleClass=new at,this._colorScaleConfig={axisConfig:{rounding:"inside"},scale:"jenks"},this._colorScalePadding=At,this._colorScalePosition=()=>this._width>1.5*this._height?"right":"bottom",this._colorScaleMaxSize=600,this._data=[],this._dataCutoff=100,this._detectResize=!0,this._detectResizeDelay=400,this._detectVisible=!0,this._detectVisibleInterval=1e3,this._downloadButton=!1,this._downloadConfig={type:"png"},this._downloadPosition="top",this._duration=600,this._fontFamily=H.fontFamily,this._hidden=[],this._hiddenColor=Ht("#aaa"),this._hiddenOpacity=Ht(.5),this._history=[],this._groupBy=[s("id")],this._legend=(t,i)=>{var e=Dt.max(i,(t,i)=>{t=this._groupBy[this._legendDepth].bind(this)(t,i);return t instanceof Array?t.length:1});return 1<i.length&&e<=2},this._legendClass=new rt,this._legendConfig={label:ft.bind(this),shapeConfig:{ariaLabel:ft.bind(this),labelConfig:{fontColor:void 0,fontResize:!1,padding:0}}},this._legendFilterInvert=Ht(!1),this._legendPadding=At,this._legendPosition=()=>this._width>1.5*this._height?"right":"bottom",this._legendSort=(t,i)=>this._drawLabel(t).localeCompare(this._drawLabel(i)),this._legendTooltip={},this._loadingHTML=()=>`
|
|
3275
3285
|
<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
|
|
3276
3286
|
<strong>${this._translate("Loading Visualization")}</strong>
|
|
3277
3287
|
<sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">${this._translate("Powered by D3plus")}</a></sub>
|
|
3278
|
-
</div>`,this._loadingMessage=!0,this._lrucache=v(10),this._messageClass=new
|
|
3288
|
+
</div>`,this._loadingMessage=!0,this._lrucache=v(10),this._messageClass=new ot,this._messageMask="rgba(0, 0, 0, 0.05)",this._messageStyle={bottom:"0",left:"0",position:"absolute",right:"0","text-align":"center",top:"0"},this._noDataHTML=()=>`
|
|
3279
3289
|
<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
|
|
3280
3290
|
<strong>${this._translate("No Data Available")}</strong>
|
|
3281
|
-
</div>`,this._noDataMessage=!0,this._on={"click.shape":
|
|
3291
|
+
</div>`,this._noDataMessage=!0,this._on={"click.shape":zt.bind(this),"click.legend":Mt.bind(this),mouseenter:function(t,i){if(1!==this._shapeConfig.hoverOpacity){let s=this._id(t,i);s instanceof Array||(s=[s]),this.hover((t,i)=>{let e=this._id(t,i);return e instanceof Array||(e=[e]),s.some(t=>e.includes(t))})}}
|
|
3282
3292
|
/**
|
|
3283
3293
|
@module mouseLeave
|
|
3284
3294
|
@desc On mouseleave event for all shapes in a Viz.
|
|
@@ -3301,7 +3311,7 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
3301
3311
|
@param {Number} *i* The index of the data object being interacted with.
|
|
3302
3312
|
@param {Object} [*config*] Optional configuration methods for the Tooltip class.
|
|
3303
3313
|
@private
|
|
3304
|
-
*/function(t,e,s,h){if(t&&this._tooltip(t,e)){let i=
|
|
3314
|
+
*/function(t,e,s,h){if(t&&this._tooltip(t,e)){let i=zt.bind(this).toString();
|
|
3305
3315
|
// does the shape have any user-defined click events?
|
|
3306
3316
|
var e=Object.keys(this._on).some(t=>// all valid click event keys,
|
|
3307
3317
|
["click","click.shape"].includes(t)&&// truthy values (no nulls),
|
|
@@ -3311,7 +3321,7 @@ this._on[t].toString()!==i),n=this._on["click.shape"]&&this._on["click.shape"].t
|
|
|
3311
3321
|
this._select.style("cursor",e||n&&r?"pointer":"auto"),h.touches?[h.touches[0].clientX,h.touches[0].clientY]:[h.clientX,h.clientY]);
|
|
3312
3322
|
// does the shape still have our default "click.shape" event?
|
|
3313
3323
|
// (if the user only sets "click", both functions will fire)
|
|
3314
|
-
this._tooltipClass.data([s||t]).footer(!(!n||!r)&&this._translate("Click to Expand")).title(this._drawLabel).position(e).config(jt.bind(this)(this._tooltipConfig)).render()}}.bind(this),"mousemove.legend":function(e,s,h,n){var n=n.touches?[n.touches[0].clientX,n.touches[0].clientY]:[n.clientX,n.clientY],r=Dt.merge(this._legendClass.data().map((t,i)=>{let e=this._id(t,i);return e=e instanceof Array?e:[e]})).length;if(e&&this._tooltip(e,s)){let t=this._id(e,s);t instanceof Array&&(t=t[0]);s=this._translate;let i=
|
|
3324
|
+
this._tooltipClass.data([s||t]).footer(!(!n||!r)&&this._translate("Click to Expand")).title(this._drawLabel).position(e).config(jt.bind(this)(this._tooltipConfig)).render()}}.bind(this),"mousemove.legend":function(e,s,h,n){var n=n.touches?[n.touches[0].clientX,n.touches[0].clientY]:[n.clientX,n.clientY],r=Dt.merge(this._legendClass.data().map((t,i)=>{let e=this._id(t,i);return e=e instanceof Array?e:[e]})).length;if(e&&this._tooltip(e,s)){let t=this._id(e,s);t instanceof Array&&(t=t[0]);s=this._translate;let i=Mt.bind(this).toString();
|
|
3315
3325
|
// does the legend have any user-defined click events?
|
|
3316
3326
|
var a=Object.keys(this._on).some(t=>// all valid click event keys,
|
|
3317
3327
|
["click","click.legend"].includes(t)&&// truthy values (no nulls),
|
|
@@ -3321,7 +3331,7 @@ this._on[t].toString()!==i),o=this._on["click.legend"]&&this._on["click.legend"]
|
|
|
3321
3331
|
this._select.style("cursor",a||o&&l?"pointer":"auto"),this._legendFilterInvert.bind(this)()),l=this._solo.includes(t),_=this._hidden.includes(t);
|
|
3322
3332
|
// does the legend still have our default "click.legend" event?
|
|
3323
3333
|
// (if the user only sets "click", both functions will fire)
|
|
3324
|
-
this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click to Highlight"):1===this._solo.length&&l||this._hidden.length===r-1?s("Click to Show All"):s("Click to Highlight")+"<br />"+s("Shift+Click to Hide"):this._solo.length&&!l||_?s("Click to Show")+"<br />"+s("Shift+Click to Highlight"):1===this._solo.length&&l||this._hidden.length===r-1?s("Click to Show All"):s("Click to Hide")+"<br />"+s("Shift+Click to Highlight"))).title(this._legendConfig.label?this._legendClass.label():
|
|
3334
|
+
this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click to Highlight"):1===this._solo.length&&l||this._hidden.length===r-1?s("Click to Show All"):s("Click to Highlight")+"<br />"+s("Shift+Click to Hide"):this._solo.length&&!l||_?s("Click to Show")+"<br />"+s("Shift+Click to Highlight"):1===this._solo.length&&l||this._hidden.length===r-1?s("Click to Show All"):s("Click to Hide")+"<br />"+s("Shift+Click to Highlight"))).title(this._legendConfig.label?this._legendClass.label():ft.bind(this)).position(n).config(jt.bind(this)(this._tooltipConfig)).config(jt.bind(this)(this._legendTooltip)).render()}}.bind(this)},this._queue=[],this._resizeContainer="undefined"==typeof window?"":window,this._scrollContainer="undefined"==typeof window?"":window,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={ariaLabel:(t,i)=>this._drawLabel(t,i),fill:(i,e)=>{for(;i.__d3plus__&&i.data;)e=(i=i.data).i;if(this._colorScale){let t=this._colorScale(i,e);var s,h;if(null!=t)return s=this._colorScaleClass._colorScale,h=this._colorScaleClass.color(),s?s.domain().length?s(t):s.range()[s.range().length-1]:h instanceof Array?h[h.length-1]:h}let t=this._color(i,e);return n.color(t)?t:A.colorAssign("string"==typeof t?t:JSON.stringify(t),this._colorDefaults)},labelConfig:{fontColor:(t,i)=>{t="function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill;return A.colorContrast(t)}},opacity:Ht(1),stroke:(t,i)=>{t="function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill;return n.color(t).darker(.25)},role:"presentation",strokeWidth:Ht(0)},this._solo=[],this._subtitleClass=new l,this._subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},this._subtitlePadding=At,this._svgDesc="",this._svgTitle="",this._timeline=!0,this._timelineClass=(new dt).align("end"),this._timelineConfig={brushing:!1,padding:5},this._timelinePadding=At,this._threshold=Ht(1e-4),this._thresholdKey=void 0,this._thresholdName=()=>this._translate("Values"),this._titleClass=new l,this._titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},this._titlePadding=At,this._tooltip=Ht(!0),this._tooltipClass=new ct,this._tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},this._totalClass=new l,this._totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},this._totalFormat=t=>this._translate("Total")+": "+Tt.formatAbbreviate(t,this._locale),this._totalPadding=At,this._zoom=!1,this._zoomBehavior=d.zoom(),this._zoomBrush=y.brush(),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 "+H.fontFamilyStringify(H.fontFamily),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}}
|
|
3325
3335
|
/**
|
|
3326
3336
|
@module discreteBuffer
|
|
3327
3337
|
@desc Adds left/right padding to a point or time scale.
|
|
@@ -3336,11 +3346,11 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3336
3346
|
@param {Object} [config]
|
|
3337
3347
|
@param {Number} [buffer = 10]
|
|
3338
3348
|
@private
|
|
3339
|
-
*/let
|
|
3349
|
+
*/let Gt=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,t<0),Vt=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,t<0);
|
|
3340
3350
|
/**
|
|
3341
3351
|
@module numericBuffer
|
|
3342
3352
|
@private
|
|
3343
|
-
*/function p(n,r,a,o,t,i,l,_){if(void 0===a||isNaN(i[0])||isNaN(i[1]))return i;if(_&&(i=i.slice().reverse(),t=t.slice().reverse()),i[0]===i[1])i=i.slice(),"log"===r?(i=[
|
|
3353
|
+
*/function p(n,r,a,o,t,i,l,_){if(void 0===a||isNaN(i[0])||isNaN(i[1]))return i;if(_&&(i=i.slice().reverse(),t=t.slice().reverse()),i[0]===i[1])i=i.slice(),"log"===r?(i=[Gt(i[0]),Vt(i[0])])[1]<i[0]&&i.reverse():(t=Math.abs(parseFloat(i[0].toPrecision(1).replace(/[0-9]{1}$/,"1"))),i[0]-=t,i[1]+=t),n.domain(_?i.slice().reverse():i);else{var e=i[0]===i[1]?10:Math.abs(Math.log(i[1]-i[0])/100),s=()=>{let e=n.copy(),s=!1;if("log"===r){let t=n.domain().slice(),i=n.range().slice();_&&(t=t.reverse(),i=i.reverse()),(s=t[0]*t[1]<0)&&(h=(h=S.scaleLog().domain([1e-6,Math.abs(t[l])]).range([0,1])(Math.abs(t[l?0:1])))/(h+1)*(i[1]-i[0]),t=(0===l?[t[0],1e-6]:[1e-6,t[1]]).map(Math.abs),i=0===l?[i[0],i[0]+h]:[i[0]+h,i[1]]),e=S.scaleLog().domain(t).range(i)}let t=!1;var h=e.range();let i;return i="log"===r&&s?e(Math.abs(a)):e(a),_?0===l?t=i+o>h[l]:1===l&&(t=i-o<h[l]):0===l?t=i-o<h[l]:1===l&&(t=i+o>h[l]),t};if(n.invert&&s())if("log"===r){let t=0;for(;t<10&&s();){var h=(0===l?-1:1)*(i[l]<0?-1:1);i[l]+=i[l]*e*h,n.domain(_?i.slice().reverse():i),t++}}else 0===l?(t=n.invert(n(a)+(o+10)*(_?1:-1)))<i[l]&&(i[l]=t,n.domain(_?i.slice().reverse():i)):1===l&&(t=n.invert(n(a)+(o+10)*(_?-1:1)))>i[l]&&(i[l]=t,n.domain(_?i.slice().reverse():i))}return _?i.reverse():i}
|
|
3344
3354
|
/**
|
|
3345
3355
|
@module circleBuffer
|
|
3346
3356
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3350,7 +3360,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3350
3360
|
@param {Object} [config]
|
|
3351
3361
|
@param {Number} [buffer] Defaults to the radius of the largest Circle.
|
|
3352
3362
|
@private
|
|
3353
|
-
*/let
|
|
3363
|
+
*/let Yt=c.theme,Kt=new It,Ut=new l,Xt={Bar:function({data:t,x:i,y:e,x2:s,y2:h,buffer:n=10}){let r=s?"x2":"x",a=h?"y2":"y";var o,h=(s="x"===this._discrete?e:i).domain().slice();let l="x"===this._discrete;l&&h.reverse();let _,d,g=(_=this._stacked?(o=Ot.nest().key(t=>t[this._discrete]+"_"+t.group).entries(t).map(t=>t.values.map(t=>t[l?a:r])),d=o.map(t=>Dt.sum(t.filter(t=>0<t))),o.map(t=>Dt.sum(t.filter(t=>t<0)))):(o=t.map(t=>t[l?a:r]),d=o.filter(t=>0<t),o.filter(t=>t<0)),s(Dt.max(d))),c=((l?g<s(0):g>s(0))&&(g+=l?-n:n),g=s.invert(g),s(Dt.min(_)));return(l?c>s(0):c<s(0))&&(c+=l?n:-n),c=s.invert(c),g>h[1]&&(h[1]=g),c<h[0]&&(h[0]=c),l&&h.reverse(),s.domain(h),[i,e]}
|
|
3354
3364
|
/**
|
|
3355
3365
|
@module boxBuffer
|
|
3356
3366
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3384,33 +3394,33 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3384
3394
|
/**
|
|
3385
3395
|
@desc Logic for determining default sizes of shapes using the sizeScaleD3 internal function.
|
|
3386
3396
|
@private
|
|
3387
|
-
*/function
|
|
3397
|
+
*/function Jt(t){return this._sizeScaleD3(this._size?this._size(t):null)}
|
|
3388
3398
|
/**
|
|
3389
3399
|
@desc Logic for determining stackOrder ascending using groups.
|
|
3390
3400
|
@private
|
|
3391
|
-
*/function
|
|
3401
|
+
*/function Qt(t){let e=t.map(ti),s=t.map(t=>t.key.split("_")[0]);return Et.stackOrderNone(t).sort((t,i)=>s[i].localeCompare(s[t])||e[t]-e[i])}
|
|
3392
3402
|
/**
|
|
3393
3403
|
@desc Logic for determining stackOrder descending using groups.
|
|
3394
3404
|
@private
|
|
3395
|
-
*/function
|
|
3405
|
+
*/function Zt(t){return Qt(t).reverse()}
|
|
3396
3406
|
/**
|
|
3397
3407
|
@desc Logic for determining default sum of shapes using the stackSum function used in d3Shape.
|
|
3398
3408
|
@private
|
|
3399
|
-
*/function
|
|
3409
|
+
*/function ti(t){let i=-1,e=0,s;for(var h=t.length;++i<h;)(s=+t[i][1])&&(e+=s);return e}
|
|
3400
3410
|
/**
|
|
3401
3411
|
@desc Logic for determining default sum of shapes using the stackSum function used in d3Shape.
|
|
3402
3412
|
@private
|
|
3403
|
-
*/function
|
|
3413
|
+
*/function ii(r,a){var o;if(0<(o=r.length)){let i,e,s,h,n;var l=r[a[0]].length;for(let t=0;t<l;++t)for(n=h=0,s=0;s<o;++s)0<=(e=(i=r[a[s]][t])[1]-i[0])?(i[0]=n,i[1]=n+=e):e<0?(i[1]=h,i[0]=h+=e):i[0]=n}}
|
|
3404
3414
|
/**
|
|
3405
3415
|
* Determines if a Bar label should be placed outside of the Bar.
|
|
3406
3416
|
* @param {@} d
|
|
3407
3417
|
* @param {*} i
|
|
3408
3418
|
* @private
|
|
3409
|
-
*/function
|
|
3419
|
+
*/function ei(t,i){
|
|
3410
3420
|
// Force all Stacked Bars to use "inside" labels.
|
|
3411
3421
|
var e,s,h;
|
|
3412
3422
|
// Detect user "outside" or "inside" override.
|
|
3413
|
-
return!this._stacked&&("outside"===(h=this._labelPosition(t,i))||"inside"!==h&&(h="x"===this._discrete.charAt(0)?"y":"x",h=this._discrete.replace(this._discrete.charAt(0),h),s=this[`_${h}Axis`]._d3Scale.range(),i=(t=this["_"+h](t,i))<0,e=this[`_${h}Axis`]._getPosition(0),s="y"===h?i?s[1]-e:e-s[0]:i?e-s[0]:s[1]-e,h=this[`_${h}Axis`]._getPosition(t),Math.abs(i?e-h:h-e)<s/2))}class
|
|
3423
|
+
return!this._stacked&&("outside"===(h=this._labelPosition(t,i))||"inside"!==h&&(h="x"===this._discrete.charAt(0)?"y":"x",h=this._discrete.replace(this._discrete.charAt(0),h),s=this[`_${h}Axis`]._d3Scale.range(),i=(t=this["_"+h](t,i))<0,e=this[`_${h}Axis`]._getPosition(0),s="y"===h?i?s[1]-e:e-s[0]:i?e-s[0]:s[1]-e,h=this[`_${h}Axis`]._getPosition(t),Math.abs(i?e-h:h-e)<s/2))}class si extends _{
|
|
3414
3424
|
/**
|
|
3415
3425
|
Extends the preDraw behavior of the abstract Viz class.
|
|
3416
3426
|
@private
|
|
@@ -3436,7 +3446,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3436
3446
|
* Determins default scale type and domain for a given axis.
|
|
3437
3447
|
* @param {String} axis
|
|
3438
3448
|
* @private
|
|
3439
|
-
*/let[I,m,q,G]=Bt.bind(this)("x"),[V,y,Y,
|
|
3449
|
+
*/let[I,m,q,G]=Bt.bind(this)("x"),[V,y,Y,K]=Bt.bind(this)("y");ct=(i,t)=>{var e,s=this[`_${i}Config`].scale;return"auto"===s?this._discrete===i?t:(e=a.map(t=>t[i]),3<Dt.deviation(e)/Dt.mean(e)?"log":"linear"):s||t};let n=this._yConfigScale=ct("y",y).toLowerCase(),o=this._y2ConfigScale=ct("y2",K).toLowerCase(),l=this._xConfigScale=ct("x",m).toLowerCase(),_=this._x2ConfigScale=ct("x2",G).toLowerCase(),b=(u={x:I,x2:q||I,y:V,y2:Y||V},Object.keys(u).forEach(i=>{"log"===this[`_${i}ConfigScale`]&&u[i].includes(0)&&(Dt.min(u[i])<0?u[i][1]=Dt.max(r.map(t=>t[i]).filter(t=>![NaN,void 0,!1].includes(t))):u[i][0]=Dt.min(a.map(t=>t[i]).filter(t=>![NaN,void 0,!1].includes(t))))}),W.forEach(t=>{var i;this[`_${t}Config`].domain?(i=this[`_${t}Config`].domain,"x"===this._discrete&&i.reverse(),u[t]=i):t&&void 0!==this._baseline&&(i=this._baseline,u[t]&&u[t][0]>i?u[t][0]=i:u[t]&&u[t][1]<i&&(u[t][1]=i))}),$t["scale"+m]().domain(u.x).range(Dt.range(0,1+x,x/(u.x.length-1)))),U=$t["scale"+G]().domain(u.x2).range(Dt.range(0,1+x,x/(u.x2.length-1))),v=$t["scale"+y]().domain(u.y.reverse()).range(Dt.range(0,1+t,t/(u.y.length-1))),X=$t["scale"+K]().domain(u.y2.reverse()).range(Dt.range(0,1+t,t/(u.y2.length-1)));ct=Ot.nest().key(t=>t.shape).entries(r).sort((t,i)=>this._shapeSort(t.key,i.key));"Point"!==("x"===this._discrete?y:m)&&Ot.nest().key(t=>t.shape).entries(a).forEach(t=>{var i;["Bar","Box"].includes(t.key)&&qt("x"===this._discrete?b:v,r,this._discrete),this._buffer[t.key]&&(i=this._buffer[t.key].bind(this)({data:t.values,x:b,y:v,yScale:n,xScale:l,config:this._shapeConfig[t.key]}),b=i[0],v=i[1],i=this._buffer[t.key].bind(this)({data:t.values,x:U,y:X,yScale:o,xScale:_,x2:!0,y2:!0,config:this._shapeConfig[t.key]}),U=i[0],X=i[1])});let C=b.domain(),J=U.domain(),w=v.domain(),d=X.domain();var ut={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},_t=at?{data:_t}:ut,gt=ot?{data:gt}:ut,ut=("x"!==this._discrete||this._width>this._discreteCutoff)&&this._width>this._xCutoff,pt=("y"!==this._discrete||this._height>this._discreteCutoff)&&this._height>this._yCutoff,dt={data:dt,locale:this._locale,rounding:this._yDomain?"none":"outside",scalePadding:v.padding?v.padding():0},ft=(!ut&&pt&&(dt.barConfig={stroke:"transparent"},dt.tickSize=0,dt.shapeConfig={labelBounds:(t,i)=>{var{width:t,y:e}=t.labelBounds,s=this._height/2;return{x:i?-s:0,y:e,width:t,height:s}},labelConfig:{padding:0,rotate:0},labelRotation:!1}),Pt.elem("g.d3plus-plot-test",{enter:{opacity:0},parent:this._select})),mt=jt.bind(this)(this._shapeConfig,"shape","Bar");let Q=void 0!==mt.label?"function"==typeof mt.label?mt.label:Ht(mt.label):this._drawLabel,g=a.map(t=>Q(t.data,t.i)).filter(t=>"number"==typeof t||t).map(String),k=Lt.unique(a.map(t=>t.x2)),S=(k="Point"===G&&k.every(t=>g.includes(""+t))?[]:null,Lt.unique(a.map(t=>t.x))),Z=(S="Point"===m&&S.every(t=>g.includes(""+t))?[]:null,Lt.unique(a.map(t=>t.y2))),z=(Z="Point"===K&&Z.every(t=>g.includes(""+t))?[]:null,Lt.unique(a.map(t=>t.y)));z="Point"===y&&z.every(t=>g.includes(""+t))?[]:null,pt&&this._yTest.domain(w).height(t).maxSize(x/2).range([void 0,void 0]).select(ft.node()).ticks(z).width(x).config(dt).config(this._yConfig).scale(n).render();var mt=this._yTest.outerBounds(),yt=mt.width?mt.width+this._yTest.padding():void 0,xt=(ot&&this._y2Test.domain(d).height(t).range([void 0,void 0]).select(ft.node()).ticks(Z).width(x).config(dt).config(gt).config(this._y2Config).scale(o).render(),this._y2Test.outerBounds()),bt=xt.width?xt.width+this._y2Test.padding():void 0,lt={data:lt,locale:this._locale,rounding:this._xDomain?"none":"outside",scalePadding:b.padding?b.padding():0};!pt&&ut&&(lt.barConfig={stroke:"transparent"},lt.tickSize=0,lt.shapeConfig={labelBounds:(t,i)=>{var{height:t,y:e}=t.labelBounds,s=this._width/2;return{x:i?-s:0,y:e,width:s,height:t}},labelConfig:{padding:0,rotate:0,textAnchor:t=>S&&t.id===S[0]?"start":"end"},labelRotation:!1});let M=void 0;ut&&this._xTest.domain(C).height(t).maxSize(t/2).range([void 0,M]).select(ft.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render();let tt,A=[],it=this._lineLabels&&!ot;if(it){var vt=r.filter(t=>"Line"===t.shape&&("function"!=typeof this._lineLabels||this._lineLabels(t.data,t.i))),vt=Ot.nest().key(t=>t.id).entries(vt);if(vt.length){var Ct=jt.bind(this)(this._shapeConfig,"shape","Line"),wt=(Kt.config(Ct),Kt.labelConfig());let d=void 0!==wt.fontColor?wt.fontColor:Ut.fontColor(),g=void 0!==wt.fontSize?wt.fontSize:Ut.fontSize(),c=void 0!==wt.fontWeight?wt.fontWeight:Ut.fontWeight(),u=void 0!==wt.fontFamily?wt.fontFamily:Ut.fontFamily(),p=void 0!==wt.padding?wt.padding:Ut.padding(),f=Ct.label||this._drawLabel,m=t=>("log"===l&&0===t&&(t=C[0]<0?this._xTest._d3Scale.domain()[1]:this._xTest._d3Scale.domain()[0]),this._xTest._getPosition.bind(this._xTest)(t)),y=t=>("log"===n&&0===t&&(t=w[0]<0?this._yTest._d3Scale.domain()[1]:this._yTest._d3Scale.domain()[0]),this._yTest._getPosition.bind(this._yTest)(t)),i=(A=vt.map(t=>{let i=t.values[t.values.length-1],e;for(;i.__d3plus__&&i.data;)i=i.data,e=i.i;var s="function"==typeof f?f(i,e):f,h="function"==typeof d?d(i,e):d,n="function"==typeof g?g(i,e):g,r="function"==typeof c?c(i,e):c;let a="function"==typeof u?u(i,e):u;a instanceof Array&&(a=a.map(t=>`'${t}'`).join(", "));var o="function"==typeof p?p(i,e):p,s=Pt.textWidth(s,{"font-size":n,"font-family":a,"font-weight":r}),r=t.values.map(t=>[m(t.x),y(t.y)]);let l=Dt.max(t.values.map(t=>m(t.x)));var _=t.values.find(t=>m(t.x)===l).y;return{id:t.key,labelWidth:s+2*o,spaceNeeded:s+4*o,value:_,yEstimate:y(_),padding:o,fontSize:n,fontColor:h,maxX:l,xValue:Dt.max(t.values,t=>t.x),coords:r}}).sort((t,i)=>w[1]>w[0]?t.value-i.value:i.value-t.value).filter((t,i,e)=>{let{fontSize:s,id:h,labelWidth:n,maxX:r,yEstimate:a}=t;return 0===e.filter(i=>i.id!==h&&i.coords.some(t=>(t[0]>r||t[0]===r&&i.maxX!==r)&&t[0]<=r+n&&t[1]<=a+.75*s&&t[1]>=a-.75*s)).length}),Dt.max(A,t=>t.maxX));tt=Dt.max(A.map(t=>t.labelWidth));wt=i===this._xTest._getRange.bind(this._xTest)()[1]?Dt.max(A.filter(t=>t.maxX===i),t=>t.spaceNeeded):0;wt&&(Ct=Dt.min([wt,x/4]),M=x-Ct-this._margin.right)}}ut&&M&&this._xTest.domain(C).height(t).maxSize(t/2).range([void 0,M]).select(ft.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render(),at&&this._x2Test.domain(J).height(t).range([void 0,M]).select(ft.node()).ticks(k).width(x).config(lt).tickSize(0).config(_t).config(this._x2Config).scale(_).render();vt=this._xTest._getRange(),wt=this._x2Test._getRange(),Ct=this._x2Test.outerBounds();let B=at?Ct.height+this._x2Test.padding():0;var Ct=Dt.max([yt,vt[0],wt[0]]),kt=(ut&&this._xTest.range([Ct,void 0]).render(),pt?this._yTest.shapeConfig().labelConfig.fontSize()/2:0),St=Dt.max([bt,x-vt[1],x-wt[1]]),zt=this._xTest.outerBounds().height+(pt?this._xTest.padding():0),rt=(this._padding.left+=Ct,this._padding.right+=St,this._padding.bottom+=zt,this._padding.top+=B+kt,super._draw(rt),this._margin.left+this._margin.right),Mt=this._margin.top+this._margin.bottom;let P=[B,t-(zt+kt+Mt)],D=(pt&&this._yTest.domain(w).height(t).maxSize(x/2).range(P).select(ft.node()).ticks(z).width(x).config(dt).config(this._yConfig).scale(n).render(),yt=(mt=this._yTest.outerBounds()).width?mt.width+this._yTest.padding():void 0,Ct=Dt.max([yt,vt[0],wt[0]]),ot&&this._y2Test.config(dt).domain(d).gridSize(0).height(t).range(P).select(ft.node()).width(x-Dt.max([0,St-bt])).title(!1).config(this._y2Config).config(gt).scale(o).render(),bt=(xt=this._y2Test.outerBounds()).width?xt.width+this._y2Test.padding():void 0,St=Dt.max([0,bt,x-vt[1],x-wt[1]]),[Ct,x-(St+rt)]);mt=Pt.elem("g.d3plus-plot-background",{parent:i,transition:e}),ft=`translate(${this._margin.left}, ${this._margin.top+B+kt})`,xt=`translate(${this._margin.left}, ${this._margin.top+kt})`,vt=Pt.elem("g.d3plus-plot-x-axis",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft,opacity:ut?1:0}}),wt=at&&Pt.elem("g.d3plus-plot-x2-axis",{parent:i,transition:e,enter:{transform:xt},update:{transform:xt}}),rt=`translate(${this._margin.left+(yt<Ct?Ct-yt:0)}, ${this._margin.top+kt})`,ut=Pt.elem("g.d3plus-plot-y-axis",{parent:i,transition:e,enter:{transform:rt},update:{transform:rt,opacity:pt?1:0}}),xt=`translate(-${this._margin.right}, ${this._margin.top+kt})`,Ct=ot&&Pt.elem("g.d3plus-plot-y2-axis",{parent:i,transition:e,enter:{transform:xt},update:{transform:xt}});this._xAxis.domain(C).height(t-(B+kt+Mt)).maxSize(t/2).range(D).select(vt.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render(),at&&this._x2Axis.domain(J).height(t-(zt+kt+Mt)).range(D).select(wt.node()).ticks(k).width(x).config(lt).config(_t).config(this._x2Config).scale(_).render(),this._xFunc=b=(t,i)=>("x2"===i?("log"===_&&0===t&&(t=J[0]<0?this._x2Axis._d3Scale.domain()[1]:this._x2Axis._d3Scale.domain()[0]),this._x2Axis._getPosition.bind(this._x2Axis)):("log"===l&&0===t&&(t=C[0]<0?this._xAxis._d3Scale.domain()[1]:this._xAxis._d3Scale.domain()[0]),this._xAxis._getPosition.bind(this._xAxis)))(t),P=[this._xAxis.outerBounds().y+B,t-(zt+kt+Mt)],this._yAxis.domain(w).height(t).maxSize(x/2).range(P).select(ut.node()).ticks(z).width(D[D.length-1]).config(dt).config(this._yConfig).scale(n).render(),ot&&this._y2Axis.config(dt).domain(ot?d:w).gridSize(0).height(t).range(P).select(Ct.node()).width(x-Dt.max([0,St-bt])).title(!1).config(this._y2Config).config(gt).scale(o).render();let et={},O=(A&&(Ot.nest().key(t=>t.xValue).entries(A).forEach(({values:t})=>{var i=Dt.max(t.map(t=>t.fontSize));let l=Dt.range(P[0],P[1],i).reverse(),_=(P[1]-P[0])/8;t.forEach(
|
|
3440
3450
|
/** */function t(e,s,h){if(e.defaultY||(e.defaultY=this._yAxis._getPosition(e.value)),s){var n=h[s-1],{fontSize:r,padding:a}=e,o=e.newY||e.defaultY;let i=n.newY||n.defaultY;o-r/2-a<i&&(o=l.find(t=>t<i),e.defaultY-o<_)&&(n.newY=o,s)&&t(n,s-1,h)}}.bind(this))}),et=A.reduce((t,i)=>(i.newY&&(t[i.id]=i.newY),t),{})),this._yFunc=v=(t,i)=>"y2"===i?("log"===o&&0===t&&(t=d[1]<0?this._y2Axis._d3ScaleNegative.domain()[0]:this._y2Axis._d3Scale.domain()[1]),this._y2Axis._getPosition.bind(this._y2Axis)(t)-B):("log"===n&&0===t&&(t=w[1]<0?this._yAxis._d3ScaleNegative.domain()[0]:this._yAxis._d3Scale.domain()[1]),this._yAxis._getPosition.bind(this._yAxis)(t)-B),this._xAxis.barConfig()["stroke-width"]);O&&(O/=2),(new Ft).data([{}]).select(mt.node()).x(D[0]+(D[1]-D[0])/2).width(D[1]-D[0]).y(this._margin.top+kt+P[0]+(P[1]-P[0])/2).height(P[1]-P[0]).config(this._backgroundConfig).render();yt=A.filter(t=>void 0!==t.newY);if(yt.length){rt=Pt.elem("g.d3plus-plot-connectors",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();let t=yt.map(t=>Pt.assign({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue),y:t.defaultY},t)).concat(yt.map(t=>Pt.assign({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t)));(new It).config({data:t,stroke:t=>t.fontColor,x:t=>t.x,y:t=>t.y}).config(this._labelConnectorConfig).select(rt).render()}let st=Pt.elem("g.d3plus-plot-annotations",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();pt=Pt.elem("g.d3plus-plot-shapes",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();let ht=Pt.elem("g.d3plus-plot-annotations-front",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node(),L=(Object.keys(this._previousAnnotations).forEach(i=>{let e="front"===i?ht:st;var t=this._annotations.filter(t=>"back"===i&&!t.layer||t.layer===i);let s=t.map(t=>t.shape);t.forEach(t=>{(new Wt[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(u.x[0]),x1:"x"===this._discrete?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>t.y2?v(t.y2,"y2"):v(t.y),y0:"y"===this._discrete?t=>t.y2?v(t.y2,"y2"):v(t.y):v(u.y[1])-O,y1:"y"===this._discrete?null:t=>t.y2?v(t.y2,"y2"):v(t.y)-O}).select(e).render()}),this._previousAnnotations[i].filter(t=>!s.includes(t)).forEach(t=>{(new Wt[t]).data([]).select(e).render()}),this._previousAnnotations[i]=s}),this._discrete||"x"),T={discrete:this._discrete,duration:this._duration,label:t=>this._drawLabel(t.data,t.i),select:pt,x:t=>void 0!==t.x2?b(t.x2,"x2"):b(t.x),x0:"x"===L?t=>t.x2?b(t.x2,"x2"):b(t.x):b("number"==typeof this._baseline?this._baseline:u.x[0]),x1:"x"===L?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>void 0!==t.y2?v(t.y2,"y2"):v(t.y),y0:"y"===L?t=>t.y2?v(t.y2,"y2"):v(t.y):v("number"==typeof this._baseline?this._baseline:u.y[1])-O,y1:"y"===L?null:t=>t.y2?v(t.y2,"y2"):v(t.y)-O},nt=Object.keys(this._on),$=(ct.forEach(n=>{var r=Object.assign({},T);if(this._stacked&&["Area","Bar"].includes(n.key)){let s="x"===c?b:v;r[""+c]=r[c+"0"]=t=>{var i=f.indexOf(t.id),e=N.indexOf(t.discrete),t=t[c]<0?1:0;return 0<=i?s(p[i][e][t]):s(u[c]["x"===c?0:1])},r[c+"1"]=t=>{var i=f.indexOf(t.id),e=N.indexOf(t.discrete),t=t[c]<0?0:1;return 0<=i?s(p[i][e][t]):s(u[c]["x"===c?0:1])}}var a=(new Wt[n.key]).config(r).data(n.values);if("Bar"===n.key){let t,i="x"===this._discrete?b:v;var r="x"===this._discrete?m:y,o="x"===this._discrete?C:w,l="x"===this._discrete?D:P;t="Point"!==r&&2===o.length?((r=Array.from(new Set(n.values.map(t=>i(t[this._discrete]))))).unshift(l[0]-r[0]-l[0]),r.push(l[1]+l[1]-r[r.length-1]),r.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0)):1<o.length?i(o[1])-i(o[0]):l[l.length-1]-l[0],this._groupPadding<t&&(t-=this._groupPadding);let s=t||1;r=Ot.nest().key(t=>t[this._discrete]).key(t=>t.group).entries(n.values),o=Dt.merge(r.map(t=>t.values.map(t=>t.key)));let h=Array.from(new Set(o));if(1===Dt.max(r.map(t=>t.values.length)))a[this._discrete]((t,i)=>T[this._discrete](t,i));else{s=(s-this._barPadding*h.length-1)/h.length;l=t/2-s/2;let e=$t.scaleLinear().domain([0,h.length-1]).range([-l,l]);a[this._discrete]((t,i)=>T[this._discrete](t,i)+e(h.indexOf(t.group)))}a.width(s),a.height(s)}else if("Line"===n.key){if(a.duration(1.5*x),this._confidence){o=Object.assign({},T),r=this._discrete||"x";let i="x"===r?"y":"x",e="x"===r?v:b;o[i+"0"]=t=>e(this._confidence[0]?t.lci:t[i]),o[i+"1"]=t=>e(this._confidence[1]?t.hci:t[i]);l=(new Nt).config(o).data(n.values),r=Object.assign(this._shapeConfig,this._confidenceConfig);l.config(Pt.assign(jt.bind(this)(r,"shape","Line"),jt.bind(this)(r,"shape","Area"))).render(),this._shapes.push(l)}a.config({discrete:T.discrete||"x",label:!!it&&((e,t)=>{if("function"!=typeof this._lineLabels||this._lineLabels(e.data,e.i)){var s=A.find(t=>t.id===e.id);if(s){let i=s.newY||s.defaultY;s=A.filter(t=>t.newY===i);return 1<s.length?s[0].id===e.id&&`+${Tt.formatAbbreviate(s.length,this._locale)} `+this._translate("more"):this._drawLabel(e,t)}}return!1}),labelBounds:!!it&&((t,i,e)=>{var[s,h]=e.points[0],[e,n]=e.points[e.points.length-1],r=this._height/4;return{x:e-s,y:n-h-r/2-(et[t.id]?n-et[t.id]:0),width:tt,height:r}})})}let _=nt.filter(t=>t.includes("."+n.key)),d=nt.filter(t=>!t.includes(".")),g=nt.filter(t=>t.includes(".shape"));for(let h=0;h<d.length;h++)a.on(d[h],(t,i,e,s)=>this._on[d[h]](t.data,t.i,e,s));for(let h=0;h<g.length;h++)a.on(g[h],(t,i,e,s)=>this._on[g[h]](t.data,t.i,e,s));for(let h=0;h<_.length;h++)a.on(_[h],(t,i,e,s)=>this._on[_[h]](t.data,t.i,e,s));o=jt.bind(this)(this._shapeConfig,"shape",n.key);if(void 0===this._shapeConfig.duration&&delete o.duration,a.config(o).render(),this._shapes.push(a),"Line"===n.key){var t=(new Rt).data(this._lineMarkers?n.values:[]).config(T).config(this._lineMarkerConfig).id(t=>t.id+"_"+t.discrete);for(let h=0;h<d.length;h++)t.on(d[h],(t,i,e,s)=>this._on[d[h]](t.data,t.i,e,s));for(let h=0;h<g.length;h++)t.on(g[h],(t,i,e,s)=>this._on[g[h]](t.data,t.i,e,s));for(let h=0;h<_.length;h++)t.on(_[h],(t,i,e,s)=>this._on[_[h]](t.data,t.i,e,s));t.render(),this._shapes.push(t)}}),ct.map(t=>t.key));function At(e){let s=this[`_${e}Time`];var t=s?r:a,i=t.filter(t=>![NaN,void 0,!1].includes(t[e]));if(!i.length)return[];let h="number"==typeof i[0][e],n=this._discrete===e?Ot.nest().key(t=>t[e]).rollup(t=>1===t.length?t[0].data:Lt.merge(t.map(t=>t.data),this._aggs)).entries(i).sort((t,i)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.value,i.value):(s||h?parseFloat(t.key,10):t.key)-(s||h?parseFloat(i.key,10):i.key)).map(t=>s?Pt.date(t.key):h?parseFloat(t.key,10):t.key):Lt.unique(i.sort((t,i)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.data,i.data):t[e]-i[e]).map(t=>t[e]),t=>""+t);return n=this._discrete!==e.charAt(0)&&this._confidence&&(this._confidence[0]&&(n=n.concat(t.map(t=>t.lci))),this._confidence[1])?n.concat(t.map(t=>t.hci)):n}function Bt(t){var i=this[`_${t}Time`]?"Time":this._discrete===t||this[`_${t}Sort`]?"Point":"Linear",e=this[`_${t}Domain`]?this[`_${t}Domain`].slice():u[t],s=this[`_${t}2Domain`]?this[`_${t}2Domain`].slice():u[t+"2"];return"Point"!=i&&(e&&void 0===e[0]&&(e[0]=u[t][0]),e&&void 0===e[1]&&(e[1]=u[t][1]),s&&void 0===s[0]&&(s[0]=u[t+"2"][0]),s)&&void 0===s[1]&&(s[1]=u[t+"2"][1]),[e,i,s,i]}$.includes("Line")&&(this._confidence&&$.push("Area"),this._lineMarkers)&&$.push("Circle"),this._previousShapes.filter(t=>!$.includes(t)).forEach(t=>{(new Wt[t]).config(T).data([]).render()}),this._previousShapes=$}return this}
|
|
3441
3451
|
/**
|
|
3442
3452
|
@memberof Plot
|
|
@@ -3475,7 +3485,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3475
3485
|
@desc Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).
|
|
3476
3486
|
@param {Object|Boolean} [*value*]
|
|
3477
3487
|
@chainable
|
|
3478
|
-
*/buffer(t){if(arguments.length){if(t)if(!0===t)this._buffer=
|
|
3488
|
+
*/buffer(t){if(arguments.length){if(t)if(!0===t)this._buffer=Xt;else for(var i in this._buffer=Pt.assign({},this._buffer,t),this._buffer)!0===this._buffer[i]&&(this._buffer[i]=Xt[i]);else this._buffer={};return this}return this._buffer}
|
|
3479
3489
|
/**
|
|
3480
3490
|
@memberof Plot
|
|
3481
3491
|
@desc Sets the confidence to the specified array of lower and upper bounds.
|
|
@@ -3496,12 +3506,6 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3496
3506
|
@param {Object} [*value*]
|
|
3497
3507
|
@chainable
|
|
3498
3508
|
*/confidenceConfig(t){return arguments.length?(this._confidenceConfig=Pt.assign(this._confidenceConfig,t),this):this._confidenceConfig}
|
|
3499
|
-
/**
|
|
3500
|
-
@memberof Plot
|
|
3501
|
-
@desc Sets the discrete axis to the specified string. If *value* is not specified, returns the current discrete axis.
|
|
3502
|
-
@param {String} *value*
|
|
3503
|
-
@chainable
|
|
3504
|
-
*/discrete(t){return arguments.length?(this._discrete=t,this):this._discrete}
|
|
3505
3509
|
/**
|
|
3506
3510
|
@memberof Plot
|
|
3507
3511
|
@desc When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.
|
|
@@ -3591,17 +3595,17 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3591
3595
|
@desc Sets the stack order. If *value* is not specified, returns the current stack order function.
|
|
3592
3596
|
@param {Function|String|Array} *value* = "none"
|
|
3593
3597
|
@chainable
|
|
3594
|
-
*/stackOrder(t){return arguments.length?(this._stackOrder="string"==typeof t?"ascending"===t?
|
|
3598
|
+
*/stackOrder(t){return arguments.length?(this._stackOrder="string"==typeof t?"ascending"===t?Qt:"descending"===t?Zt:Et["stackOrder"+(t.charAt(0).toUpperCase()+t.slice(1))]:t,this):this._stackOrder}
|
|
3595
3599
|
/**
|
|
3596
3600
|
@memberof Plot
|
|
3597
|
-
@desc Sets the x accessor to the specified
|
|
3598
|
-
@param {Function|
|
|
3601
|
+
@desc Sets the x accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x accessor.
|
|
3602
|
+
@param {Function|String} *value*
|
|
3599
3603
|
@chainable
|
|
3600
3604
|
*/x(t){return arguments.length?("function"==typeof t?this._x=t:(this._x=s(t),this._xKey=t),this):this._x}
|
|
3601
3605
|
/**
|
|
3602
3606
|
@memberof Plot
|
|
3603
|
-
@desc Sets the x2 accessor to the specified
|
|
3604
|
-
@param {Function|
|
|
3607
|
+
@desc Sets the x2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x2 accessor.
|
|
3608
|
+
@param {Function|String} *value*
|
|
3605
3609
|
@chainable
|
|
3606
3610
|
*/x2(t){return arguments.length?("function"==typeof t?this._x2=t:(this._x2=s(t),this._x2Key=t),this):this._x2}
|
|
3607
3611
|
/**
|
|
@@ -3648,14 +3652,14 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3648
3652
|
*/x2Sort(t){return arguments.length?(this._x2Sort=t,this):this._x2Sort}
|
|
3649
3653
|
/**
|
|
3650
3654
|
@memberof Plot
|
|
3651
|
-
@desc Sets the y accessor to the specified
|
|
3652
|
-
@param {Function|
|
|
3655
|
+
@desc Sets the y accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y accessor.
|
|
3656
|
+
@param {Function|String} *value*
|
|
3653
3657
|
@chainable
|
|
3654
3658
|
*/y(t){return arguments.length?("function"==typeof t?this._y=t:(this._y=s(t),this._yKey=t),this):this._y}
|
|
3655
3659
|
/**
|
|
3656
3660
|
@memberof Plot
|
|
3657
|
-
@desc Sets the y2 accessor to the specified
|
|
3658
|
-
@param {Function|
|
|
3661
|
+
@desc Sets the y2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y2 accessor.
|
|
3662
|
+
@param {Function|String} *value*
|
|
3659
3663
|
@chainable
|
|
3660
3664
|
*/y2(t){return arguments.length?("function"==typeof t?this._y2=t:(this._y2=s(t),this._y2Key=t),this):this._y2}
|
|
3661
3665
|
/**
|
|
@@ -3706,27 +3710,27 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3706
3710
|
@memberof Plot
|
|
3707
3711
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3708
3712
|
@private
|
|
3709
|
-
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Pt.assign({},
|
|
3713
|
+
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Pt.assign({},Xt,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,i)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,i):this._shapeConfig.Line.stroke,fillOpacity:Ht(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Ht("auto"),this._lineMarkerConfig={fill:(t,i)=>A.colorAssign(this._id(t,i)),r:Ht(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{Area:{label:(t,i)=>!!this._stacked&&this._drawLabel(t,i),labelBounds:(t,i,e)=>{let s=E.largestRect(e.points,{angle:Dt.range(-20,20,5)});if(!(s=!s||s.height<20||s.width<50?E.largestRect(e.points,{angle:Dt.range(-80,80,5)}):s))return null;let h=Dt.min(e.points,t=>t[0]);e=Dt.max(e.points.filter(t=>t[0]===h),t=>t[1]);return{angle:s.angle,width:s.width,height:s.height,x:s.cx-s.width/2-h,y:s.cy-s.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,i)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,i),void 0!==this._x(t,i)&&(e+=", x: "+this._x(t,i)),void 0!==this._y(t,i)&&(e+=", y: "+this._y(t,i)),void 0!==this._x2(t,i)&&(e+=", x2: "+this._x2(t,i)),void 0!==this._y2(t,i)&&(e+=", y2: "+this._y2(t,i))),e+"."},Bar:{labelBounds(t,i,e){var s="y"===this._discrete?"width":"height",h="y"===this._discrete?"height":"width",n="x"===this._discrete.charAt(0)?"y":"x",r="y"==n,n=this._discrete.replace(this._discrete.charAt(0),n),a=this[`_${n}Axis`]._d3Scale.range(),a=Math.abs(a[1]-a[0]),n=this["_"+n](t,i)<0;return ei.bind(this)(t,i)?{[s]:a-e[s],[h]:e[h],x:r?-e.width/2:n?-a:e.width+1,y:r?n?e.height+1:-a:-e.height/2+1}:{[s]:e[s],[h]:e[h],x:r?-e.width/2:n?(this._stacked,1-e.width):-1,y:r?n?(this._stacked,1):1-e.height:-e.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(t,i){return ei.bind(this)(t,i)?"transparent"===this._backgroundConfig.fill?A.colorDefaults.dark:A.colorContrast(this._backgroundConfig.fill):A.colorContrast("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill)},fontStroke(t,i){return ei.bind(this)(t,i)?"transparent"===this._backgroundConfig.fill?A.colorDefaults.dark:A.colorContrast(this._backgroundConfig.fill):"transparent"},fontStrokeWidth(t,i){return ei.bind(this)(t,i)?.1:0},padding:3,textAnchor(t,i){var e="x"===this._discrete.charAt(0)?"y":"x",s="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,i)<0,s=s?"middle":ei.bind(this)(t,i)?e?"end":"start":e?"start":"end";return Pt.rtl()?"start"==s?"end":"end"==s?"start":s:s},verticalAlign(t,i){var e="x"===this._discrete.charAt(0)?"y":"x",s="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,i)<0;return s?ei.bind(this)(t,i)?e?"top":"bottom":e?"bottom":"top":"middle"}}},Circle:{r:Jt.bind(this)},Line:{curve:()=>this._discrete?"monotone"+this._discrete.charAt(0).toUpperCase():"linear",fill:Ht("none"),labelConfig:{fontColor:(t,i)=>{t="function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,i):this._shapeConfig.Line.stroke;return A.colorLegible(t)},fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:Ht(2)},Rect:{height:t=>2*Jt.bind(this)(t),width:t=>2*Jt.bind(this)(t)}}),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this._shapeSort=(t,i)=>this._shapeOrder.indexOf(t)-this._shapeOrder.indexOf(i),this._sizeMax=20,this._sizeMin=5,this._sizeScale="sqrt",this._stackOffset=ii,this._stackOrder=Zt,this._timelineConfig=Pt.assign(this._timelineConfig,{brushing:!0,brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=s("x"),this._xAxis=(new et).align("end"),this._xKey="x",this._xTest=(new et).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":Yt.colors.gray[200]}},this._xCutoff=150,this._x2=s("x2"),this._x2Axis=(new nt).align("start"),this._x2Test=(new nt).align("start").gridSize(0),this._x2Config={padding:0},this._y=s("y"),this._yAxis=(new st).align("start"),this._yKey="y",this._yTest=(new st).align("start").gridSize(0),this._yConfig={gridConfig:{stroke:t=>{var i;return this._discrete&&"y"===this._discrete.charAt(0)||(i=this._yAxis.range())[i.length-1]===this._yAxis._getPosition.bind(this._yAxis)(t.id)?"transparent":Yt.colors.gray[200]}}},this._yCutoff=150,this._y2=s("y2"),this._y2Axis=(new ht).align("end"),this._y2Test=(new st).align("end").gridSize(0),this._y2Config={}}}class hi extends si{
|
|
3710
3714
|
/**
|
|
3711
3715
|
@memberof AreaPlot
|
|
3712
3716
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3713
3717
|
@private
|
|
3714
|
-
*/constructor(){super(),this._baseline=0,this._discrete="x",this._shape=Ht("Area")
|
|
3718
|
+
*/constructor(){super(),this._baseline=0,this._discrete="x",this._shape=Ht("Area")}}class ni extends si{
|
|
3715
3719
|
/**
|
|
3716
3720
|
@memberof BarChart
|
|
3717
3721
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3718
3722
|
@private
|
|
3719
|
-
*/constructor(){super(),this._baseline=0,this._discrete="x";let e=this._legend;this._legend=(t,i)=>i.map(this._groupBy[this._legendDepth].bind(this)).sort().join()!==this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join()&&e.bind(this)(t,i),this._shape=Ht("Bar")
|
|
3723
|
+
*/constructor(){super(),this._baseline=0,this._discrete="x";let e=this._legend;this._legend=(t,i)=>i.map(this._groupBy[this._legendDepth].bind(this)).sort().join()!==this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join()&&e.bind(this)(t,i),this._shape=Ht("Bar")}}class ri extends si{
|
|
3720
3724
|
/**
|
|
3721
3725
|
@memberof BoxWhisker
|
|
3722
3726
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3723
3727
|
@private
|
|
3724
|
-
*/constructor(){super(),this._discrete="x",this._shape=Ht("Box"),this.
|
|
3728
|
+
*/constructor(){super(),this._discrete="x",this._shape=Ht("Box"),this._tooltipConfig=Pt.assign(this._tooltipConfig,{title:(t,i)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;var e;return this._label?this._label(t,i):(e=this._ids(t,i).slice(0,this._drawDepth))[e.length-1]}})}}class ai extends si{
|
|
3725
3729
|
/**
|
|
3726
3730
|
@memberof BumpChart
|
|
3727
3731
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3728
3732
|
@private
|
|
3729
|
-
*/constructor(){super(),this._discrete="x",this._shape=Ht("Line"),this.
|
|
3733
|
+
*/constructor(){super(),this._discrete="x",this._shape=Ht("Line"),this.y2(t=>this._y(t)),this.yConfig({tickFormat:i=>{var t=this._formattedData;let e=t[0].x instanceof Date?t[0].x.getTime():t[0].x;t=t.filter(t=>(t.x instanceof Date?t.x.getTime():t.x)===e).find(t=>t.y===i);return t?this._drawLabel(t,t.i):""}}),this.y2Config({tickFormat:i=>{var t=this._formattedData;let e=t[t.length-1].x instanceof Date?t[t.length-1].x.getTime():t[t.length-1].x;t=t.filter(t=>(t.x instanceof Date?t.x.getTime():t.x)===e).find(t=>t.y===i);return t?this._drawLabel(t,t.i):""}}),this.ySort((t,i)=>this._y(i)-this._y(t)),this.y2Sort((t,i)=>this._y(i)-this._y(t))}}class oi extends _{
|
|
3730
3734
|
/**
|
|
3731
3735
|
Extends the draw behavior of the abstract Viz class.
|
|
3732
3736
|
@private
|
|
@@ -3766,24 +3770,24 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3766
3770
|
@memberof Pie
|
|
3767
3771
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3768
3772
|
@private
|
|
3769
|
-
*/constructor(){super();let e=this._legend;this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._value(i)-this._value(t),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._pieData?`${++this._pieData[i].index}. ${this._drawLabel(t,i)}, ${this._value(t,i)}.`:"",Path:{labelConfig:{fontResize:!0}}}),this._innerRadius=0,this._legendSort=(t,i)=>this._value(i)-this._value(t),this._padPixel=0,this._pie=f.pie(),this._sort=(t,i)=>this._value(i)-this._value(t),this._value=s("value")}}class
|
|
3773
|
+
*/constructor(){super();let e=this._legend;this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._value(i)-this._value(t),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._pieData?`${++this._pieData[i].index}. ${this._drawLabel(t,i)}, ${this._value(t,i)}.`:"",Path:{labelConfig:{fontResize:!0}}}),this._innerRadius=0,this._legendSort=(t,i)=>this._value(i)-this._value(t),this._padPixel=0,this._pie=f.pie(),this._sort=(t,i)=>this._value(i)-this._value(t),this._value=s("value")}}class li extends oi{
|
|
3770
3774
|
/**
|
|
3771
3775
|
@memberof Donut
|
|
3772
3776
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3773
3777
|
@private
|
|
3774
|
-
*/constructor(){super(),this._innerRadius=()=>Dt.min([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var
|
|
3778
|
+
*/constructor(){super(),this._innerRadius=()=>Dt.min([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom])/4,this._padPixel=2}}var _i=[{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 di=Object.assign({},C,w,k);
|
|
3775
3779
|
/**
|
|
3776
3780
|
* @name findAttribution
|
|
3777
3781
|
* @param {String} url
|
|
3778
3782
|
* @private
|
|
3779
|
-
*/function
|
|
3783
|
+
*/function gi(i){var t=_i.find(t=>t.matches.some(t=>i.includes(t)));return!!t&&t.text}
|
|
3780
3784
|
/**
|
|
3781
3785
|
@name topo2feature
|
|
3782
3786
|
@desc Converts a specific topojson object key into a feature ready for projection.
|
|
3783
3787
|
@param {Object} *topo* A valid topojson json object.
|
|
3784
3788
|
@param {String} [*key*] The topojson object key to be used. If undefined, the first key available will be used.
|
|
3785
3789
|
@private
|
|
3786
|
-
*/function
|
|
3790
|
+
*/function ci(t,i){i=i&&t.objects[i]?i:Object.keys(t.objects)[0];return P.feature(t,i)}class ui extends _{
|
|
3787
3791
|
/**
|
|
3788
3792
|
Renders map tiles based on the current zoom level.
|
|
3789
3793
|
@private
|
|
@@ -3791,7 +3795,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3791
3795
|
/**
|
|
3792
3796
|
Extends the draw behavior of the abstract Viz class.
|
|
3793
3797
|
@private
|
|
3794
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,s=(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",i).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",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));s.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(s).attr("width",i).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);s=this._coordData=this._topojson?
|
|
3798
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,s=(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",i).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",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));s.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(s).attr("width",i).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);s=this._coordData=this._topojson?ci(this._topojson,this._topojsonKey):{type:"FeatureCollection",features:[]};this._topojsonFilter&&(s.features=s.features.filter(this._topojsonFilter));let a=this._path=di.geoPath().projection(this._projection);var h=this._filteredData.filter((t,i)=>this._point(t,i)instanceof Array);let n=this._filteredData.filter((t,i)=>!(this._point(t,i)instanceof Array)).reduce((t,i)=>(t[this._id(i)]=i,t),{});var r=s.features.reduce((t,i)=>{var e=this._topojsonId(i);return t.push({__d3plus__:!0,data:n[e],feature:i,id:e}),t},[]);let o=$t["scale"+this._pointSizeScale.charAt(0).toUpperCase()+this._pointSizeScale.slice(1)]().domain(Dt.extent(h,(t,i)=>this._pointSize(t,i))).range([this._pointSizeMin,this._pointSizeMax]);if(!this._zoomSet){s=this._fitObject?ci(this._fitObject,this._fitKey):s;if(this._extentBounds={type:"FeatureCollection",features:this._fitFilter?s.features.filter(this._fitFilter):s.features.slice()},this._extentBounds.features=this._extentBounds.features.reduce((t,r)=>{if(r.geometry){let e={type:r.type,id:r.id,geometry:{coordinates:r.geometry.coordinates,type:r.geometry.type}};if("MultiPolygon"===r.geometry.type&&1<r.geometry.coordinates.length){let s=[],h=[],i=(r.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],s.push(a.area(e))}),e.geometry.coordinates=[r.geometry.coordinates[s.indexOf(Dt.max(s))]],a.centroid(e)),n=(r.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],h.push(E.pointDistance(a.centroid(e),i))}),Dt.quantile(s.reduce((t,i,e)=>(i&&t.push(s[e]/i),t),[]),.9));e.geometry.coordinates=r.geometry.coordinates.filter((t,i)=>{var e=h[i];return 0===e||s[i]/e>=n})}t.push(e)}return t},[]),!this._extentBounds.features.length&&h.length){let e=[[void 0,void 0],[void 0,void 0]];h.forEach((t,i)=>{t=this._projection(this._point(t,i));(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))}}]};s=Dt.max(h,(t,i)=>o(this._pointSize(t,i)));this._projectionPadding.top+=s,this._projectionPadding.right+=s,this._projectionPadding.bottom+=s,this._projectionPadding.left+=s}this._zoomBehavior.extent([[0,0],[i,t]]).scaleExtent([1,this._zoomMax]).translateExtent([[0,0],[i,t]]),this._zoomSet=!0}this._projection=this._projection.fitExtent(this._extentBounds.features.length?[[this._projectionPadding.left,this._projectionPadding.top],[i-this._projectionPadding.right,t-this._projectionPadding.bottom]]:[[0,0],[i,t]],this._extentBounds.features.length?this._extentBounds:{type:"Sphere"}),this._shapes.push((new B).data(r).d(t=>a(t.feature)).select(e.node()).x(0).y(0).config(jt.bind(this)(this._shapeConfig,"shape","Path")).render());let l=this._zoomGroup.selectAll("g.d3plus-geomap-pins").data([0]);l=l.enter().append("g").attr("class","d3plus-geomap-pins").merge(l);var _=(new Rt).config(jt.bind(this)(this._shapeConfig,"shape","Circle")).data(h).r((t,i)=>o(this._pointSize(t,i))).select(l.node()).sort((t,i)=>this._pointSize(i)-this._pointSize(t)).x((t,i)=>this._projection(this._point(t,i))[0]).y((t,i)=>this._projection(this._point(t,i))[1]),s=Object.keys(this._on),d=s.filter(t=>t.includes(".Circle")),g=s.filter(t=>!t.includes(".")),c=s.filter(t=>t.includes(".shape"));for(let t=0;t<g.length;t++)_.on(g[t],this._on[g[t]]);for(let t=0;t<c.length;t++)_.on(c[t],this._on[c[t]]);for(let t=0;t<d.length;t++)_.on(d[t],this._on[d[t]]);return this._shapes.push(_.render()),this}
|
|
3795
3799
|
/**
|
|
3796
3800
|
@memberof Geomap
|
|
3797
3801
|
@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.
|
|
@@ -3852,7 +3856,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3852
3856
|
@desc Sets the map projection used when displaying topojson and coordinate points. All of the projections exported from [d3-geo](https://github.com/d3/d3-geo#projections), [d3-geo-projection](https://github.com/d3/d3-geo-projection#api-reference), and [d3-composite-projections](http://geoexamples.com/d3-composite-projections/) are accepted, whether as the string name (ie. "geoMercator") or the generator function itself. Map tiles are only usable when the projection is set to Mercator (which is also the default value).
|
|
3853
3857
|
@param {Function|String} *projection* = "geoMercator"
|
|
3854
3858
|
@chainable
|
|
3855
|
-
*/projection(t){return arguments.length&&"geoMercator"!==t&&this.tiles(!1),arguments.length?(this._projection="string"==typeof t?
|
|
3859
|
+
*/projection(t){return arguments.length&&"geoMercator"!==t&&this.tiles(!1),arguments.length?(this._projection="string"==typeof t?di[t]?di[t]():di.geoMercator():t,this):this._projection}
|
|
3856
3860
|
/**
|
|
3857
3861
|
@memberof Geomap
|
|
3858
3862
|
@desc The outer padding between the edge of the visualization and the shapes drawn. The value passed can be either a single number to be used on all sides, or a CSS string pattern (ie. `"20px 0 10px"`).
|
|
@@ -3870,13 +3874,13 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3870
3874
|
@desc Toggles the visibility of the map tiles.
|
|
3871
3875
|
@param {Boolean} [*value* = true]
|
|
3872
3876
|
@chainable
|
|
3873
|
-
*/tiles(t){var i;return arguments.length?(this._tiles=t,i=
|
|
3877
|
+
*/tiles(t){var i;return arguments.length?(this._tiles=t,i=gi(this._tileUrl),t&&""===this._attribution?this._attribution=i:t||this._attribution!==i||(this._attribution=""),this):this._tiles}
|
|
3874
3878
|
/**
|
|
3875
3879
|
@memberof Geomap
|
|
3876
3880
|
@desc By default, d3plus uses the `light_all` style provided by [CARTO](https://carto.com/location-data-services/basemaps/) for it's map tiles. The [tileUrl](https://d3plus.org/docs/#Geomap.tileUrl) method changes the base URL used for fetching the tiles, as long as the string passed contains `{x}`, `{y}`, and `{z}` variables enclosed in curly brackets for the zoom logic to load the correct tiles.
|
|
3877
3881
|
@param {String} [url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"]
|
|
3878
3882
|
@chainable
|
|
3879
|
-
*/tileUrl(t){return arguments.length?(this._tileUrl=t,this._tiles&&(this._attribution=
|
|
3883
|
+
*/tileUrl(t){return arguments.length?(this._tileUrl=t,this._tiles&&(this._attribution=gi(t)),this._tileGroup&&this._renderTiles.bind(this)(),this):this._tileUrl}
|
|
3880
3884
|
/**
|
|
3881
3885
|
@memberof Geomap
|
|
3882
3886
|
@desc The topojson to be used for drawing geographical paths. The value passed should either be a valid Topojson *Object* or a *String* representing a filepath or URL to be loaded.
|
|
@@ -3916,21 +3920,21 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3916
3920
|
@memberof Geomap
|
|
3917
3921
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3918
3922
|
@private
|
|
3919
|
-
*/constructor(){super(),this._fitObject=!1,this._noDataMessage=!1,this._ocean="#d4dadc",this._point=s("point"),this._pointSize=Ht(1),this._pointSizeMax=10,this._pointSizeMin=5,this._pointSizeScale="linear",this._projection=
|
|
3923
|
+
*/constructor(){super(),this._fitObject=!1,this._noDataMessage=!1,this._ocean="#d4dadc",this._point=s("point"),this._pointSize=Ht(1),this._pointSizeMax=10,this._pointSizeMin=5,this._pointSizeScale="linear",this._projection=di.geoMercator(),this._projectionPadding=Pt.parseSides(20),this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._drawLabel(t,i)+", "+this._pointSize(t,i),hoverOpacity:1,Path:{ariaLabel:(t,i)=>{var e=this._colorScale?", "+this._colorScale(t,i):"";return this._drawLabel(t,i)+e+"."},fill:(t,i)=>{if(this._colorScale&&!this._coordData.features.includes(t)){var e=this._colorScale(t);if(null!=e){if(this._colorScaleClass._colorScale)return this._colorScaleClass._colorScale(e);{let t=this._colorScaleClass.color();return t=t instanceof Array?t[t.length-1]:t}}}return this._topojsonFill(t,i)},on:{mouseenter:(t,i,e,s)=>this._coordData.features.includes(t)?null:this._on.mouseenter.bind(this)(t,i,e,s),"mousemove.shape":(t,i,e,s)=>this._coordData.features.includes(t)?null:this._on["mousemove.shape"].bind(this)(t,i,e,s),mouseleave:(t,i,e,s)=>this._coordData.features.includes(t)?null:this._on.mouseleave.bind(this)(t,i,e,s)},stroke:(t,i)=>{t="function"==typeof this._shapeConfig.Path.fill?this._shapeConfig.Path.fill(t,i):this._shapeConfig.Path.fill;return n.color(t).darker()},strokeWidth:1}}),this._tiles=!0,this._tileGen=M.tile(),this.tileUrl("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png"),this._topojson=!1,this._topojsonFill=Ht("#f5f5f3"),this._topojsonFilter=t=>!["010"].includes(t.id),this._topojsonId=s("id"),this._zoom=!0,this._zoomSet=!1}}class pi extends si{
|
|
3920
3924
|
/**
|
|
3921
3925
|
@memberof LinePlot
|
|
3922
3926
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3923
3927
|
@private
|
|
3924
|
-
*/constructor(){super(),this._discrete="x",this._shape=Ht("Line")
|
|
3928
|
+
*/constructor(){super(),this._discrete="x",this._shape=Ht("Line")}}
|
|
3925
3929
|
/**
|
|
3926
3930
|
@module matrixData
|
|
3927
3931
|
@private
|
|
3928
|
-
*/function
|
|
3932
|
+
*/function fi(){let h=this._filteredData;var t,e,i=(this._rowList||Lt.unique(h.map(this._row))).sort(this._rowSort),s=(this._columnList||Lt.unique(h.map(this._column))).sort(this._columnSort);return i.length&&s.length?(e=s,t=[].concat(...i.map(i=>e.map(t=>[].concat(i,t)))).map(([e,s])=>{var t={__d3plusTooltip__:!0,__d3plus__:!0,column:s,row:e},i=h.findIndex((t,i)=>this._row(t,i)===e&&this._column(t,i)===s);return 0<=i?(t.i=i,t.data=h[i]):t.data={row:e,column:s},t}),{rowValues:i,columnValues:s,shapeData:t}):this}let mi={align:"start",barConfig:{stroke:0},gridSize:0,padding:5,paddingInner:0,paddingOuter:0,scale:"band",tickSize:0};class yi extends _{
|
|
3929
3933
|
/**
|
|
3930
3934
|
@memberof Matrix
|
|
3931
3935
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
3932
3936
|
@private
|
|
3933
|
-
*/_draw(o){var{rowValues:l,columnValues:_,shapeData:d}=
|
|
3937
|
+
*/_draw(o){var{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){let t=this._height-this._margin.top-this._margin.bottom,e=this._select,s=this._transition,i=this._width-this._margin.left-this._margin.right;var g={opacity:0},c={opacity:1},u=i/_.length<120,p=(t,i)=>Pt.elem("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:s},i)).node(),f=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(l).height(t-this._margin.top-this._margin.bottom-this._padding.bottom-this._padding.top).maxSize(i/4).width(i).config(this._rowConfig).render(),this._rowAxis.outerBounds().width),m=(this._padding.left+=f,`translate(0, ${this._margin.top})`),g=Object.assign({transform:m},g),g=(this._columnAxis.select(p("column",{enter:g,update:g})).domain(_).range([this._margin.left+this._padding.left,i-this._margin.right+this._padding.right]).height(t).maxSize(t/4).width(i).labelRotation(u).config(this._columnConfig).render(),this._columnAxis.outerBounds().height),u=(this._padding.top+=g,super._draw(o),`translate(${this._margin.left}, ${this._margin.top})`),m=`translate(0, ${this._margin.top})`,o=Object.assign({transform:m},c);this._rowAxis.select(p("row",{update:Object.assign({transform:u},c)})).height(t-this._margin.top-this._margin.bottom-this._padding.bottom).maxSize(f).range([g+this._columnAxis.padding(),void 0]).render(),this._columnAxis.select(p("column",{update:o})).range([this._margin.left+this._padding.left+this._rowAxis.padding(),i-this._margin.right+this._padding.right]).maxSize(g).render();let h=this._rowAxis._getPosition.bind(this._rowAxis),n=this._columnAxis._getPosition.bind(this._columnAxis),r=1<l.length?h(l[1])-h(l[0]):this._rowAxis.height(),a=1<_.length?n(_[1])-n(_[0]):this._columnAxis.width();m=`translate(0, ${this._margin.top})`,u=jt.bind(this)(this._shapeConfig,"shape","Rect");this._shapes.push((new Ft).data(d).select(Pt.elem("g.d3plus-Matrix-cells",{parent:this._select,enter:{transform:m},update:{transform:m}}).node()).config({height:r-this._cellPadding,width:a-this._cellPadding,x:t=>n(t.column)+a/2,y:t=>h(t.row)+r/2}).config(u).render())}return this}
|
|
3934
3938
|
/**
|
|
3935
3939
|
@memberof Matrix
|
|
3936
3940
|
@desc The pixel padding in between each cell.
|
|
@@ -3998,15 +4002,15 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3998
4002
|
@memberof Matrix
|
|
3999
4003
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4000
4004
|
@private
|
|
4001
|
-
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnAxis=new o,this._columnConfig=Pt.assign({orient:"top"},
|
|
4005
|
+
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnAxis=new o,this._columnConfig=Pt.assign({orient:"top"},mi),this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._label=(t,i)=>a.bind(this)("row",t,i)+" / "+a.bind(this)("column",t,i);let r=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{r(t,i,e,s);let h=a.bind(this)("row",t,i),n=a.bind(this)("column",t,i);this.hover((t,i)=>a.bind(this)("row",t,i)===h||a.bind(this)("column",t,i)===n)},this._row=s("row"),this._rowAxis=new o,this._rowConfig=Pt.assign({orient:"left"},mi),this._rowSort=(t,i)=>(""+t).localeCompare(""+i)}}
|
|
4002
4006
|
/**
|
|
4003
4007
|
* Fetches the unique ID for a data point, whether it's defined by data or nodes.
|
|
4004
4008
|
* @private
|
|
4005
|
-
*/function
|
|
4009
|
+
*/function xi(t,i){return""+(this._id(t,i)||this._nodeGroupBy[Dt.min([this._drawDepth,this._nodeGroupBy.length-1])](t,i))}class bi extends _{
|
|
4006
4010
|
/**
|
|
4007
4011
|
Extends the draw behavior of the abstract Viz class.
|
|
4008
4012
|
@private
|
|
4009
|
-
*/_draw(t){super._draw(t);var t=this._duration,i=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,s=this._width-this._margin.left-this._margin.right;let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),n=this._nodes.reduce((t,i,e)=>(t[
|
|
4013
|
+
*/_draw(t){super._draw(t);var t=this._duration,i=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,s=this._width-this._margin.left-this._margin.right;let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),n=this._nodes.reduce((t,i,e)=>(t[xi.bind(this)(i,e)]=i,t),{}),r=(n=Array.from(new Set(Object.keys(h).concat(Object.keys(n)))).map((t,i)=>{var e=h[t],s=n[t];return void 0!==s&&{__d3plus__:!0,data:e||s,i:i,id:t,fx:void 0===e||isNaN(this._x(e))?this._x(s):this._x(e),fy:void 0===e||isNaN(this._y(e))?this._y(s):this._y(e),node:s,r:this._size?void 0!==e&&void 0!==this._size(e)?this._size(e):this._size(s):this._sizeMin,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(s)}}).filter(t=>t),this._nodeLookup=n.reduce((t,i)=>(t[i.id]=i,t),{})),a=n.map(t=>t.node);var o=this._links.map(t=>{var i=typeof t.source;return{size:this._linkSize(t),source:"number"==i?n[a.indexOf(this._nodes[t.source])]:"string"==i?r[t.source]:r[t.source.id],target:"number"==i?n[a.indexOf(this._nodes[t.target])]:"string"==i?r[t.target]:r[t.target.id]}}),l=(this._linkLookup=o.reduce((t,i)=>(t[i.source.id]||(t[i.source.id]=[]),t[i.source.id].push(i.target),t[i.target.id]||(t[i.target.id]=[]),t[i.target.id].push(i.source),t),{}),n.some(t=>void 0===t.fx||void 0===t.fy));if(l){let i=$t.scaleLinear().domain(Dt.extent(o,t=>t.size)).range([.1,.5]);var l=D.forceSimulation().force("link",D.forceLink(o).id(t=>t.id).distance(1).strength(t=>i(t.size)).iterations(4)).force("charge",D.forceManyBody().strength(-1)).stop(),_=1-Math.pow(.001,.01),_=(l.velocityDecay(0),l.alphaMin(.001),l.alphaDecay(_),l.alphaDecay(0),l.nodes(n),l.tick(100).stop(),n.map(t=>[t.vx,t.vy]));let e=0,s=0,h=0;2===_.length?e=100:2<_.length&&(l=O.polygonHull(_),_=E.largestRect(l,{verbose:!0}),e=_.angle,s=_.cx,h=_.cy),n.forEach(t=>{var i=E.pointRotate([t.vx,t.vy],Math.PI/180*e*-1,[s,h]);t.fx=i[0],t.fy=i[1]})}l=Dt.extent(n.map(t=>t.fx)),_=Dt.extent(n.map(t=>t.fy));let d=$t.scaleLinear().domain(l).range([0,s]),g=$t.scaleLinear().domain(_).range([0,i]);var l=(l[1]-l[0])/(_[1]-_[0])||1,_=s/i,c=(_<l?(c=i*_/l,g.range([(i-c)/2,i-(i-c)/2])):(c=s*l/_,d.range([(s-c)/2,s-(s-c)/2])),n.forEach(t=>{t.x=d(t.fx),t.y=g(t.fy)}),Dt.extent(n.map(t=>t.r))),u=this._sizeMax||Dt.max([1,Dt.min(Dt.merge(n.map(i=>n.map(t=>i===t?null:E.pointDistance([i.x,i.y],[t.x,t.y])))))/2]);let p=$t["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(c).range([c[0]===c[1]?u:Dt.min([u/2,this._sizeMin]),u]),f=d.domain(),m=g.domain();var y=f[1]-f[0],x=m[1]-m[0],b=(n.forEach(t=>{var i=p(t.r);f[0]>d.invert(t.x-i)&&(f[0]=d.invert(t.x-i)),f[1]<d.invert(t.x+i)&&(f[1]=d.invert(t.x+i)),m[0]>g.invert(t.y-i)&&(m[0]=g.invert(t.y-i)),m[1]<g.invert(t.y+i)&&(m[1]=g.invert(t.y+i))}),f[1]-f[0]),v=m[1]-m[0];u*=Dt.min([y/b,x/v]),p.range([c[0]===c[1]?u:Dt.min([u/2,this._sizeMin]),u]),d.domain(f),g.domain(m);let C=(_<l?s:i)/2;n.forEach(t=>{t.x=d(t.fx),t.fx=t.x,t.y=g(t.fy),t.fy=t.y,t.r=p(t.r)||C,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",s).attr("height",i).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",s).attr("height",i).attr("x",this._margin.left).attr("y",this._margin.top);y=this._container.selectAll("rect.d3plus-network-hitArea").data([0]),y.enter().append("rect").attr("class","d3plus-network-hitArea").merge(y).attr("width",s).attr("height",i).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]),b=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup),x=Dt.extent(o,t=>t.size);if(x[0]!==x[1]){let i=$t["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(x).range([this._linkSizeMin,p.range()[0]]);o.forEach(t=>{t.size=i(t.size)})}v=jt.bind(this)(this._shapeConfig,"edge","Path");delete v.on,this._shapes.push((new B).config(v).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(o).select(Pt.elem("g.d3plus-network-links",{parent:b,duration:t,enter:{transform:e},update:{transform:e}}).node()).render());let w={label:t=>!!(n.length<=this._dataCutoff||this._hover&&this._hover(t)||this._active&&this._active(t))&&this._drawLabel(t.data||t.node,t.i),select:Pt.elem("g.d3plus-network-nodes",{parent:b,duration:t,enter:{transform:e},update:{transform:e}}).node()};return Ot.nest().key(t=>t.shape).entries(n).forEach(t=>{this._shapes.push((new Wt[t.key]).config(jt.bind(this)(this._shapeConfig,"shape",t.key)).config(w).config(w[t.key]||{}).data(t.values).render())}),this}
|
|
4010
4014
|
/**
|
|
4011
4015
|
@memberof Network
|
|
4012
4016
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -4098,11 +4102,11 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4098
4102
|
@memberof Network
|
|
4099
4103
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4100
4104
|
@private
|
|
4101
|
-
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[s("id")],this._nodes=[],this._on["click.shape"]=(t,r,i,e)=>{if(this._tooltipClass.data([]).render(),this._hover&&this._drawDepth>=this._groupBy.length-1){let n=
|
|
4105
|
+
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[s("id")],this._nodes=[],this._on["click.shape"]=(t,r,i,e)=>{if(this._tooltipClass.data([]).render(),this._hover&&this._drawDepth>=this._groupBy.length-1){let n=xi.bind(this)(t,r);if(this._focus&&this._focus===n)this.active(!1),this._on.mouseenter.bind(this)(t,r,i,e),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);t=this._linkLookup[n],r=this._nodeLookup[n];let e=[n],i=[r.x-r.r,r.x+r.r],s=[r.y-r.r,r.y+r.r],h=(t.forEach(t=>{e.push(t.id),t.x-t.r<i[0]&&(i[0]=t.x-t.r),t.x+t.r>i[1]&&(i[1]=t.x+t.r),t.y-t.r<s[0]&&(s[0]=t.y-t.r),t.y+t.r>s[1]&&(s[1]=t.y+t.r)}),this.active((t,i)=>t.source&&t.target?t.source.id===n||t.target.id===n:e.includes(xi.bind(this)(t,i))),this._focus=n,d.zoomTransform(this._container.node()));i=i.map(t=>t*h.k+h.x),s=s.map(t=>t*h.k+h.y),this._zoomToBounds([[i[0],s[0]],[i[1],s[1]]])}}},this._on["click.legend"]=(t,i,e,s)=>{var n=this._id(t),r=(r=this._ids(t))[r.length-1];if(this._hover&&this._drawDepth>=this._groupBy.length-1){if(this._focus&&this._focus===n)this.active(!1),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);var a=n.map(t=>this._nodeLookup[t]);let e=[""+r],i=[a[0].x-a[0].r,a[0].x+a[0].r],s=[a[0].y-a[0].r,a[0].y+a[0].r],h=(a.forEach(t=>{e.push(t.id),t.x-t.r<i[0]&&(i[0]=t.x-t.r),t.x+t.r>i[1]&&(i[1]=t.x+t.r),t.y-t.r<s[0]&&(s[0]=t.y-t.r),t.y+t.r>s[1]&&(s[1]=t.y+t.r)}),this.active((t,i)=>t.source&&t.target?e.includes(t.source.id)&&e.includes(t.target.id):(t=this._ids(t,i),e.includes(""+t[t.length-1]))),this._focus=n,d.zoomTransform(this._container.node()));i=i.map(t=>t*h.k+h.x),s=s.map(t=>t*h.k+h.y),this._zoomToBounds([[i[0],s[0]],[i[1],s[1]]])}this._on.mouseenter.bind(this)(t,i,e,s),this._on["mousemove.legend"].bind(this)(t,i,e,s)}},this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let _=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{_(t,i,e,s);let h=xi.bind(this)(t,i),n=this._linkLookup[h]||[],r=this._nodeLookup[h],a=[h],o=[r.x-r.r,r.x+r.r],l=[r.y-r.r,r.y+r.r];n.forEach(t=>{a.push(t.id),t.x-t.r<o[0]&&(o[0]=t.x-t.r),t.x+t.r>o[1]&&(o[1]=t.x+t.r),t.y-t.r<l[0]&&(l[0]=t.y-t.r),t.y+t.r>l[1]&&(l[1]=t.y+t.r)}),this.hover((t,i)=>t.source&&t.target?t.source.id===h||t.target.id===h:a.includes(""+this._ids(t,i)[this._drawDepth]))},this._sizeMin=5,this._sizeScale="sqrt",this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>{var e=this._size?", "+this._size(t,i):"";return this._drawLabel(t,i)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee"}}),this._x=s("x"),this._y=s("y"),this._zoom=!0}}let vi=(t,i=[])=>(t.values?t.values.forEach(t=>{i.push(t),vi(t,i)}):i.push(t),i);class Ci extends _{
|
|
4102
4106
|
/**
|
|
4103
4107
|
Extends the draw behavior of the abstract Viz class.
|
|
4104
4108
|
@private
|
|
4105
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Math.min(t,i),i=`translate(${(i-e)/2}, ${(t-e)/2})`;let s=Ot.nest();for(let t=0;t<=this._drawDepth;t++)s.key(this._groupBy[t]);s=s.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(g.hierarchy({key:s.key,values:s},t=>t.values).sum(this._sum).sort(this._sort)).descendants()
|
|
4109
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Math.min(t,i),i=`translate(${(i-e)/2}, ${(t-e)/2})`;let s=Ot.nest();for(let t=0;t<=this._drawDepth;t++)s.key(this._groupBy[t]);s=s.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(g.hierarchy({key:s.key,values:s},t=>t.values).sum(this._sum).sort(this._sort)).descendants().filter((t,i)=>(t.__d3plus__=!0,t.i=i,t.id=t.parent?t.parent.data.key:"root",t.data.__d3plusOpacity__=t.height?this._packOpacity(t.data,i):1,t.data.__d3plusTooltip__=!t.height,!t.children||1<t.children.length));return this._shapes.push((new Rt).data(t).select(Pt.elem("g.d3plus-Pack",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(jt.bind(this)(this._shapeConfig,"shape","Circle")).render()),this}
|
|
4106
4110
|
/**
|
|
4107
4111
|
@memberof Pack
|
|
4108
4112
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -4141,7 +4145,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4141
4145
|
@memberof Pack
|
|
4142
4146
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4143
4147
|
@private
|
|
4144
|
-
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,r=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._on.mouseenter=()=>{},this._on["mousemove.legend"]),
|
|
4148
|
+
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,r=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._on.mouseenter=()=>{},this._on["mousemove.legend"]),n=(this._on["mousemove.legend"]=(e,t,i,s)=>{r(e,t,i,s);let h=this._ids(e,t),n=vi(e);this.hover(i=>(Object.keys(i).filter(t=>"value"!==t).every(t=>e[t]&&e[t].includes(i[t]))?n.push(i):h.includes(i.key)&&n.push(...vi(i,[i])),n.includes(i)))},this._on["mousemove.shape"]);this._on["mousemove.shape"]=(t,i,e,s)=>{t.__d3plusTooltip__&&n(t,i,e,s);let h=vi(t,[t]);this.hover(t=>h.includes(t))},this._pack=g.pack(),this._packOpacity=Ht(.25),this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{Circle:{label:t=>!(!t.parent||t.children)&&t.id,labelConfig:{fontResize:!0},opacity:t=>t.__d3plusOpacity__}}),this._sort=(t,i)=>i.value-t.value,this._sum=s("value")}}class wi extends _{
|
|
4145
4149
|
/**
|
|
4146
4150
|
@memberof Priestley
|
|
4147
4151
|
@desc Extends the render behavior of the abstract Viz class.
|
|
@@ -4181,11 +4185,11 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4181
4185
|
@memberof Priestley
|
|
4182
4186
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4183
4187
|
@private
|
|
4184
|
-
*/constructor(){super(),this._axis=(new o).align("end").orient("bottom"),this._axisConfig={scale:"time"},this._axisTest=(new o).align("end").gridSize(0).orient("bottom"),this.end("end"),this._paddingInner=.05,this._paddingOuter=.05,this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>`${this._drawLabel(t,i)}, ${this._start(t,i)} - ${this._end(t,i)}.`}),this.start("start")}}let
|
|
4188
|
+
*/constructor(){super(),this._axis=(new o).align("end").orient("bottom"),this._axisConfig={scale:"time"},this._axisTest=(new o).align("end").gridSize(0).orient("bottom"),this.end("end"),this._paddingInner=.05,this._paddingOuter=.05,this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>`${this._drawLabel(t,i)}, ${this._start(t,i)} - ${this._end(t,i)}.`}),this.start("start")}}let ki=2*Math.PI;class Si extends _{
|
|
4185
4189
|
/**
|
|
4186
4190
|
Extends the draw behavior of the abstract Viz class.
|
|
4187
4191
|
@private
|
|
4188
|
-
*/_draw(t){super._draw(t);let l=this._height-this._margin.top-this._margin.bottom,_=this._width-this._margin.left-this._margin.right,d=Dt.min([l,_])/2-this._outerPadding,i=`translate(${_/2}, ${l/2})`;var t=Ot.nest().key(this._metric).entries(this._filteredData),e=Ot.nest().key(this._id).key(this._metric).entries(this._filteredData);let s=Dt.max(e.map(t=>t.values.map(t=>Dt.sum(t.values,(t,i)=>this._value(t,i)))).flat());var h=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:d*((t+1)/this._levels)})),n=jt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete n.label,(new Rt).data(h).select(Pt.elem("g.d3plus-Radar-radial-circles",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(n).render();let g=t.length;var h=t.map((t,i)=>{var e=this._outerPadding,s=2*(1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(t,i)||11)),h=parseInt(360-360/g*i/90,10)%4+1,n=
|
|
4192
|
+
*/_draw(t){super._draw(t);let l=this._height-this._margin.top-this._margin.bottom,_=this._width-this._margin.left-this._margin.right,d=Dt.min([l,_])/2-this._outerPadding,i=`translate(${_/2}, ${l/2})`;var t=Ot.nest().key(this._metric).entries(this._filteredData),e=Ot.nest().key(this._id).key(this._metric).entries(this._filteredData);let s=Dt.max(e.map(t=>t.values.map(t=>Dt.sum(t.values,(t,i)=>this._value(t,i)))).flat());var h=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:d*((t+1)/this._levels)})),n=jt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete n.label,(new Rt).data(h).select(Pt.elem("g.d3plus-Radar-radial-circles",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(n).render();let g=t.length;var h=t.map((t,i)=>{var e=this._outerPadding,s=2*(1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(t,i)||11)),h=parseInt(360-360/g*i/90,10)%4+1,n=ki/g*i;let r=360/g*i,a="start",o=10;2!=h&&3!=h||(o=-e-10,a="end",r+=180);h={x:o,y:-s/2,width:e,height:s};return{__d3plus__:!0,data:Lt.merge(t.values,this._aggs),i:i,id:t.key,angle:r,textAnchor:a,labelBounds:h,rotateAnchor:[-o,s/2],x:d*Math.cos(n),y:d*Math.sin(n)}}).sort((t,i)=>t.key-i.key),n=((new Ft).data(h).rotate(t=>t.angle||0).width(0).height(0).x(t=>t.x).y(t=>t.y).label(t=>t.id).labelBounds(t=>t.labelBounds).labelConfig(this._axisConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-Radar-text",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).render(),(new B).data(h).d(t=>`M0,0 ${-t.x},`+-t.y).select(Pt.elem("g.d3plus-Radar-axis",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(jt.bind(this)(this._axisConfig.shapeConfig,"shape","Path")).render(),e.map(t=>{var i=t.values.map((t,i)=>{t=Dt.sum(t.values,(t,i)=>this._value(t,i))/s*d,i=ki/g*i;return{x:t*Math.cos(i),y:t*Math.sin(i)}}),e=`M ${i[0].x} ${i[0].y} ${i.map(t=>`L ${t.x} `+t.y).join(" ")} L ${i[0].x} `+i[0].y;return{arr:t.values.map(t=>Lt.merge(t.values,this._aggs)),id:t.key,points:i,d:e,__d3plus__:!0,data:Lt.merge(t.values.map(t=>Lt.merge(t.values,this._aggs)),this._aggs)}})),r=jt.bind(this)(this._shapeConfig,"shape","Path"),a=Object.keys(r.on);r.on={};for(let t=0;t<a.length;t++){let o=a[t];r.on[o]=(t,i,e,s)=>{var h=t.points.map(t=>t.x+_/2),n=t.points.map(t=>t.y+l/2);let r=j.pointer(s,this._select.node());h=h.map(t=>Math.abs(t-r[0]));let a=n.map(t=>Math.abs(t-r[1]));n=h.map((t,i)=>t+a[i]);this._on[o].bind(this)(t.arr[n.indexOf(Dt.min(n))],i,e,s)}}return this._shapes.push((new B).data(n).d(t=>t.d).select(Pt.elem("g.d3plus-Radar-items",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(r).render()),this}
|
|
4189
4193
|
/**
|
|
4190
4194
|
@memberof Radar
|
|
4191
4195
|
@desc Sets the config method used for the radial spokes, circles, and labels.
|
|
@@ -4217,16 +4221,16 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4217
4221
|
@memberof Radar
|
|
4218
4222
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Viz.
|
|
4219
4223
|
@private
|
|
4220
|
-
*/constructor(){super(),this._axisConfig={shapeConfig:{fill:Ht("none"),labelConfig:{fontColor:"#999",padding:0,textAnchor:(t,i,e)=>e.textAnchor,verticalAlign:"middle"},stroke:"#eee",strokeWidth:Ht(1)}},this._discrete="metric",this._levels=6,this._metric=s("metric"),this._outerPadding=100,this._shape=Ht("Path"),this._value=s("value")}}let
|
|
4224
|
+
*/constructor(){super(),this._axisConfig={shapeConfig:{fill:Ht("none"),labelConfig:{fontColor:"#999",padding:0,textAnchor:(t,i,e)=>e.textAnchor,verticalAlign:"middle"},stroke:"#eee",strokeWidth:Ht(1)}},this._discrete="metric",this._levels=6,this._metric=s("metric"),this._outerPadding=100,this._shape=Ht("Path"),this._value=s("value")}}let zi=2*Math.PI;class Mi extends _{
|
|
4221
4225
|
/**
|
|
4222
4226
|
@memberof RadialMatrix
|
|
4223
4227
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
4224
4228
|
@private
|
|
4225
|
-
*/_draw(o){let{rowValues:l,columnValues:_,shapeData:d}=
|
|
4229
|
+
*/_draw(o){let{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){super._draw(o);var o=this._height-this._margin.top-this._margin.bottom,g=this._select,c=this._transition,u=this._width-this._margin.left-this._margin.right;let r=Dt.min([o-100,u-200])/2,t=`translate(${u/2+this._margin.left}, ${o/2+this._margin.top})`;u=_.slice().reverse();u.unshift(u.pop());let a=u.length,i=u.map((t,i)=>{var i=i/a*zi,e=Math.round(180*i/Math.PI),s=Math.floor((e+90)/90%4+1),h=[0,180].includes(e)?-50:[2,3].includes(s)?-100:0,n=[90,270].includes(e)?-25:[2,1].includes(s)?-50:0;return{key:t,angle:e,quadrant:s,radians:i,x:r*Math.sin(i+Math.PI)+h,y:r*Math.cos(i+Math.PI)+n}});
|
|
4226
4230
|
/**
|
|
4227
4231
|
* Extracts the axis config "labels" Array, if it exists, it filters
|
|
4228
4232
|
* the column labels by the values included in the Array.
|
|
4229
|
-
*/o=this._columnConfig.labels instanceof Array?i.filter(t=>this._columnConfig.labels.includes(t.key)):i;this._columnLabels.data(o).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-RadialMatrix-columns",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(r),s=(r-e)/l.length,h=1<i.length?i[1].radians-i[0].radians:
|
|
4233
|
+
*/o=this._columnConfig.labels instanceof Array?i.filter(t=>this._columnConfig.labels.includes(t.key)):i;this._columnLabels.data(o).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-RadialMatrix-columns",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(r),s=(r-e)/l.length,h=1<i.length?i[1].radians-i[0].radians:zi,n=l.slice().reverse();u=f.arc().padAngle(this._cellPadding/r).innerRadius(t=>e+n.indexOf(t.row)*s+this._cellPadding/2).outerRadius(t=>e+(n.indexOf(t.row)+1)*s-this._cellPadding/2).startAngle(t=>i[_.indexOf(t.column)].radians-h/2).endAngle(t=>i[_.indexOf(t.column)].radians+h/2);this._shapes.push((new B).data(d).d(u).select(Pt.elem("g.d3plus-RadialMatrix-arcs",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).config({id:t=>this._ids(t).join("-"),x:0,y:0}).config(jt.bind(this)(this._shapeConfig,"shape","Path")).render())}return this}
|
|
4230
4234
|
/**
|
|
4231
4235
|
@memberof RadialMatrix
|
|
4232
4236
|
@desc The pixel padding in between each cell.
|
|
@@ -4297,7 +4301,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4297
4301
|
@memberof RadialMatrix
|
|
4298
4302
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4299
4303
|
@private
|
|
4300
|
-
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnConfig={shapeConfig:{labelConfig:{fontColor:"#000",padding:5,textAnchor:t=>[0,180].includes(t.angle)?"middle":[2,3].includes(t.quadrant)?"end":"start",verticalAlign:t=>[90,270].includes(t.angle)?"middle":[2,1].includes(t.quadrant)?"bottom":"top"}}},this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._innerRadius=t=>t/5,this._label=(t,i)=>a.bind(this)("row",t,i)+" / "+a.bind(this)("column",t,i);let r=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{r(t,i,e,s);let h=a.bind(this)("row",t,i),n=a.bind(this)("column",t,i);this.hover((t,i)=>a.bind(this)("row",t,i)===h||a.bind(this)("column",t,i)===n)},this._row=s("row"),this._rowSort=(t,i)=>(""+t).localeCompare(""+i),this._columnLabels=new l}}class
|
|
4304
|
+
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnConfig={shapeConfig:{labelConfig:{fontColor:"#000",padding:5,textAnchor:t=>[0,180].includes(t.angle)?"middle":[2,3].includes(t.quadrant)?"end":"start",verticalAlign:t=>[90,270].includes(t.angle)?"middle":[2,1].includes(t.quadrant)?"bottom":"top"}}},this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._innerRadius=t=>t/5,this._label=(t,i)=>a.bind(this)("row",t,i)+" / "+a.bind(this)("column",t,i);let r=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{r(t,i,e,s);let h=a.bind(this)("row",t,i),n=a.bind(this)("column",t,i);this.hover((t,i)=>a.bind(this)("row",t,i)===h||a.bind(this)("column",t,i)===n)},this._row=s("row"),this._rowSort=(t,i)=>(""+t).localeCompare(""+i),this._columnLabels=new l}}class Ai extends _{
|
|
4301
4305
|
/**
|
|
4302
4306
|
Extends the draw behavior of the abstract Viz class.
|
|
4303
4307
|
@private
|
|
@@ -4391,7 +4395,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4391
4395
|
// Need to resets margins and padding because we are
|
|
4392
4396
|
// skipping over the default render method and using
|
|
4393
4397
|
// _draw directly.
|
|
4394
|
-
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=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>{var e=this._size?", "+this._size(t,i):"";return this._drawLabel(t,i)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}}let
|
|
4398
|
+
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=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>{var e=this._size?", "+this._size(t,i):"";return this._drawLabel(t,i)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee",strokeWidth:1}})}}let Bi={center:e.sankeyCenter,justify:e.sankeyJustify,left:e.sankeyLeft,right:e.sankeyRight};class Pi extends _{
|
|
4395
4399
|
/**
|
|
4396
4400
|
Extends the draw behavior of the abstract Viz class.
|
|
4397
4401
|
@private
|
|
@@ -4428,7 +4432,7 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4428
4432
|
@desc Sets the nodeAlign property of the sankey layout, which can either be "left", "right", "center", or "justify".
|
|
4429
4433
|
@param {Function|String} [*value* = "justify"]
|
|
4430
4434
|
@chainable
|
|
4431
|
-
*/nodeAlign(t){return arguments.length?(this._nodeAlign="function"==typeof t?t:
|
|
4435
|
+
*/nodeAlign(t){return arguments.length?(this._nodeAlign="function"==typeof t?t:Bi[t],this):this._nodeAlign}
|
|
4432
4436
|
/**
|
|
4433
4437
|
@memberof Sankey
|
|
4434
4438
|
@desc If *value* is specified, sets the node id accessor(s) to the specified array of values and returns the current class instance. If *value* is not specified, returns the current node group accessor.
|
|
@@ -4468,12 +4472,12 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4468
4472
|
@memberof Sankey
|
|
4469
4473
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4470
4474
|
@private
|
|
4471
|
-
*/constructor(){super(),this._nodeId=s("id"),this._links=s("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=s("nodes"),this._nodeAlign=
|
|
4475
|
+
*/constructor(){super(),this._nodeId=s("id"),this._links=s("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=s("nodes"),this._nodeAlign=Bi.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let i=this._on["mousemove.shape"];this._on["mousemove.shape"]=(h,n,r,t)=>{if(i(h,n,r,t),this._focus&&this._focus===h.id)this.hover(!1),this._on.mouseenter.bind(this)(h,n,r,t),this._focus=void 0;else{let e=this._nodeId(h,n),t=this._nodeLookup[e],i=Object.keys(this._nodeLookup).reduce((t,i)=>(t[this._nodeLookup[i]]=isNaN(i)?i:parseInt(i,10),t),{});r=this._linkLookup[t];let s=[e];r.forEach(t=>{s.push(i[t])}),this.hover((t,i)=>t.source&&t.target?t.source.id===e||t.target.id===e:s.includes(this._nodeId(t,i)))}},this._path=e.sankeyLinkHorizontal(),this._sankey=e.sankey(),this._shape=Ht("Rect"),this._shapeConfig=Pt.assign(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=Ht(1)}}class Di extends hi{
|
|
4472
4476
|
/**
|
|
4473
4477
|
@memberof StackedArea
|
|
4474
4478
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
4475
4479
|
@private
|
|
4476
|
-
*/constructor(){super(),this._stacked=!0}}class
|
|
4480
|
+
*/constructor(){super(),this._stacked=!0}}class Oi extends _{
|
|
4477
4481
|
/**
|
|
4478
4482
|
Extends the draw behavior of the abstract Viz class.
|
|
4479
4483
|
@private
|
|
@@ -4503,7 +4507,7 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4503
4507
|
@memberof Tree
|
|
4504
4508
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4505
4509
|
@private
|
|
4506
|
-
*/constructor(){super(),this._orient="vertical",this._separation=(t,i)=>t.parent===i.parent?1:2,this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._treeData?`${this._treeData[i].depth}. ${this._drawLabel(t,i)}.`:"",labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:Ht(5),width:Ht(10),height:Ht(10)}),this._tree=g.tree()}}let
|
|
4510
|
+
*/constructor(){super(),this._orient="vertical",this._separation=(t,i)=>t.parent===i.parent?1:2,this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._treeData?`${this._treeData[i].depth}. ${this._drawLabel(t,i)}.`:"",labelConfig:{fontColor:"#444"},Path:{fill:"none",stroke:"#ccc",strokeWidth:1},r:Ht(5),width:Ht(10),height:Ht(10)}),this._tree=g.tree()}}let Li={treemapBinary:g.treemapBinary,treemapDice:g.treemapDice,treemapSlice:g.treemapSlice,treemapSliceDice:g.treemapSliceDice,treemapSquarify:g.treemapSquarify,treemapResquarify:g.treemapResquarify};class Ti extends _{
|
|
4507
4511
|
/**
|
|
4508
4512
|
@memberof Treemap
|
|
4509
4513
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
@@ -4555,10 +4559,10 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4555
4559
|
|
|
4556
4560
|
Can either be a string referring to a d3-hierarchy [tiling method](https://github.com/d3/d3-hierarchy#treemap-tiling), or a custom function in the same format.
|
|
4557
4561
|
@param {String|Function} [*value* = "squarify"]
|
|
4558
|
-
*/tile(t){return arguments.length?(this._tile="string"==typeof t?
|
|
4562
|
+
*/tile(t){return arguments.length?(this._tile="string"==typeof t?Li["treemap"+t.charAt(0).toUpperCase()+t.slice(1)]||g.treemapSquarify:t,this):this._tile}
|
|
4559
4563
|
/**
|
|
4560
4564
|
@memberof Treemap
|
|
4561
4565
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4562
4566
|
@private
|
|
4563
|
-
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,h=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._sum(i)-this._sum(t),this._legendTooltip=Pt.assign({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,i)+`, ${this._sum(t,i)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,i)=>{var e=h(t),s=h(i);return e&&!s?1:!e&&s?-1:i.value-t.value},this._sum=s("value"),this._thresholdKey=this._sum,this._tile=g.treemapSquarify,this._tooltipConfig=Pt.assign({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,i,e)=>Tt.formatAbbreviate(100*e.share,this._locale)+"%"]]}),this._treemap=g.treemap().round(!0),t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation)}}t.Area=Nt,t.AreaPlot=
|
|
4567
|
+
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,h=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._sum(i)-this._sum(t),this._legendTooltip=Pt.assign({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,i)+`, ${this._sum(t,i)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,i)=>{var e=h(t),s=h(i);return e&&!s?1:!e&&s?-1:i.value-t.value},this._sum=s("value"),this._thresholdKey=this._sum,this._tile=g.treemapSquarify,this._tooltipConfig=Pt.assign({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,i,e)=>Tt.formatAbbreviate(100*e.share,this._locale)+"%"]]}),this._treemap=g.treemap().round(!0),t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation)}}t.Area=Nt,t.AreaPlot=hi,t.Axis=o,t.AxisBottom=et,t.AxisLeft=st,t.AxisRight=ht,t.AxisTop=nt,t.Bar=K,t.BarChart=ni,t.BaseClass=h,t.Box=Q,t.BoxWhisker=ri,t.BumpChart=ai,t.Circle=Rt,t.ColorScale=at,t.Donut=li,t.Geomap=ui,t.Image=V,t.Legend=rt,t.Line=It,t.LinePlot=pi,t.Matrix=yi,t.Message=ot,t.Network=bi,t.Pack=Ci,t.Path=B,t.Pie=oi,t.Plot=si,t.Priestley=wi,t.RESET=T,t.Radar=Si,t.RadialMatrix=Mi,t.Rect=Ft,t.Rings=Ai,t.Sankey=Pi,t.Shape=r,t.StackedArea=Di,t.TextBox=l,t.Timeline=dt,t.Tooltip=ct,t.Tree=Oi,t.Treemap=Ti,t.Viz=_,t.Whisker=X,t.accessor=s,t.configPrep=jt,t.constant=Ht,t.uuid=q});
|
|
4564
4568
|
//# sourceMappingURL=d3plus-core.js.map
|