@d3plus/core 3.0.13 → 3.0.15
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 +78 -51
- package/es/src/charts/Sankey.js +37 -1
- package/es/src/components/Axis.js +21 -5
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +49 -8
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +27 -7
- package/umd/d3plus-core.js +49 -8
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +58 -38
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.15
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
6
6
|
*/
|
|
7
7
|
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function i(t){switch(t.nodeType){case 1:var n=t,e="";return e+="<"+n.tagName,n.hasAttributes()&&[].forEach.call(n.attributes,function(t){e+=" "+t.name+'="'+t.value+'"'}),e+=">",n.hasChildNodes()&&[].forEach.call(n.childNodes,function(t){e+=i(t)}),e+="</"+n.tagName+">";case 3:return t.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");case 8:return"\x3c!--"+t.nodeValue+"--\x3e"}}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var n="";return[].forEach.call(this.childNodes,function(t){n+=i(t)}),n},set:function(t){for(;this.firstChild;)this.removeChild(this.firstChild);try{var n=new DOMParser,e=(n.async=!1,"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>"),i=n.parseFromString(e,"text/xml").documentElement;[].forEach.call(i.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,!0))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}}),Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})}}),((t,n)=>{"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define("@d3plus/core",["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3plus={})})(this,function(t){
|
|
@@ -2411,14 +2411,16 @@ this._whiskerEndpoint=[],ca().key(t=>t.outlier).entries(r).forEach(t=>{var n=t.k
|
|
|
2411
2411
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
2412
2412
|
* @param {scale} scale A d3-scale object
|
|
2413
2413
|
* @private
|
|
2414
|
-
*/function Ec(t,e=!1){let i=[];var a=
|
|
2414
|
+
*/function Ec(t,e=!1){let i=[];var a=t.copy(),r=("time"===this._scale&&this._data.length&&(t=(r=Hi(this._data)).map(t),a.domain(r).range(t)),a.domain());let o=r[1]<r[0];t=
|
|
2415
2415
|
/**
|
|
2416
2416
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
2417
2417
|
* @param {scale} scale A d3-scale object
|
|
2418
2418
|
* @private
|
|
2419
|
-
*/function(t,n=!1){var e=$a().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let i=Math.floor(e(t));return"time"===this._scale&&(i=this._data&&this._data.length?(e=Hi(this._data),t=this._data.reduce((t,n,e,i)=>t=e&&(n=Math.abs(n-i[e-1]))<t?n:t,1/0),e=Math.round((e[1]-e[0])/t),Dt([i*(n?2:.5),e])):n?2*i:i/2),Math.floor(i)}.bind(this)(
|
|
2419
|
+
*/function(t,n=!1){var e=$a().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let i=Math.floor(e(t));return"time"===this._scale&&(i=this._data&&this._data.length?(e=Hi(this._data),t=this._data.reduce((t,n,e,i)=>t=e&&(n=Math.abs(n-i[e-1]))<t?n:t,1/0),e=Math.round((e[1]-e[0])/t),Dt([i*(n?2:.5),e])):n?2*i:i/2),Math.floor(i)}.bind(this)(a,e);if(e||"log"!==this._scale){if(i=a.ticks(t),!e&&!["log","time"].includes(this._scale)&&1<i.length){let e=Math.abs(2*Tc(i[1]-i[0]));i=i.filter(t=>{var t=Math.abs(t)%e,n=Tc(t);return n!==t?!n||n===e:0==t})}}else{var e=r.map(t=>Math.log10(t)%1==0?t:(o?zc:Ac)(t)),s=e[1]<e[0],e=e.map(t=>(Mc(t)?-1:1)*([-1,1].includes(t)||Math.abs(t)<1?1:Math.log10(Math.abs(t))));let n=Math.ceil((Math.abs(e[1]-e[0])+1)/(.65*t));i=n<=1&&e[0]===e[1]||s!=o?a.ticks(t).filter(t=>+(""+t).replace("0.","")%2==0):jt(e[0],e[1],e[1]<e[0]?-1:1).concat([e[1]]).filter(t=>Math.abs(t)%n==0).map(t=>+(""+(Mc(t)?-1:1)*(t?Math.pow(10,Math.abs(t)):0<Math.sign(1/t)?1:-1)).replace(/9+/g,"1"))}
|
|
2420
|
+
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
2421
|
+
if("time"===this._scale&&this._data.length){let e=this._data.map(Number);i=i.filter(t=>{let n=+t;return e.find(t=>t>=n-936e5&&t<=936e5+n)})}
|
|
2420
2422
|
// forces min/max into ticks, if not present
|
|
2421
|
-
return this._d3ScaleNegative&&Mc(r[o?1:0])!==i.some(t=>Mc(t))||i.map(Number).includes(+r[0])||i.unshift(r[0]),this._d3ScaleNegative&&Mc(r[o?0:1])!==i.some(t=>Mc(t))||i.map(Number).includes(+r[1])||i.push(r[1]),i
|
|
2423
|
+
return this._d3ScaleNegative&&Mc(r[o?1:0])!==i.some(t=>Mc(t))||i.map(Number).includes(+r[0])||i.unshift(r[0]),this._d3ScaleNegative&&Mc(r[o?0:1])!==i.some(t=>Mc(t))||i.map(Number).includes(+r[1])||i.push(r[1]),i}class Nc extends Bi{
|
|
2422
2424
|
/**
|
|
2423
2425
|
@memberof Axis
|
|
2424
2426
|
@desc Sets positioning for the axis bar.
|
|
@@ -7146,13 +7148,19 @@ r=r<0?r%I9+I9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7146
7148
|
/**
|
|
7147
7149
|
Extends the draw behavior of the abstract Viz class.
|
|
7148
7150
|
@private
|
|
7149
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=(Array.isArray(this._nodes)?this._nodes:this._links.reduce((t,n)=>(t.includes(n[this._linksSource])||t.push(n[this._linksSource]),t.includes(n[this._linksTarget])||t.push(n[this._linksTarget]),t),[]).map(t=>({id:t}))).map((t,n)=>({__d3plus__:!0,data:t,i:n,id:this._nodeId(t,n),node:t,shape:"Rect"}));let i=this._nodeLookup=e.reduce((t,n,e)=>(t[n.id]=e,t),{});var a=this._links.map((e,t)=>{var n=[this._linksSource,this._linksTarget].reduce((t,n)=>(t[n]=i[e[n]],t),{});return{source:n[this._linksSource],target:n[this._linksTarget],value:this._value(e,t)}});this._linkLookup=a.reduce((t,n)=>(t[n.source]||(t[n.source]=[]),t[n.source].push(n.target),t[n.target]||(t[n.target]=[]),t[n.target].push(n.source),t),{});let r=`translate(${this._margin.left}, ${this._margin.top})`;return this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(e).links(a).size([n,t])(),this._shapes.push((new Sc).config(this._shapeConfig.Path).data(a).d(this._path).select(Pt("g.d3plus-Links",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).render()),ca().key(t=>t.shape).entries(e).forEach(t=>{this._shapes.push((new kc[t.key]).data(t.values).height(t=>t.y1-t.y0).width(t=>t.x1-t.x0).x(t=>(t.x1+t.x0)/2).y(t=>(t.y1+t.y0)/2).select(Pt("g.d3plus-sankey-nodes",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).config(Bt.bind(this)(this._shapeConfig,"shape",t.key)).render())}),this}
|
|
7151
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,n=this._width-this._margin.left-this._margin.right,e=(Array.isArray(this._nodes)?this._nodes:this._links.reduce((t,n)=>(t.includes(n[this._linksSource])||t.push(n[this._linksSource]),t.includes(n[this._linksTarget])||t.push(n[this._linksTarget]),t),[]).map(t=>({id:t}))).map((t,n)=>({__d3plus__:!0,data:t,i:n,id:this._nodeId(t,n),node:t,shape:"Rect"}));let i=this._nodeLookup=e.reduce((t,n,e)=>(t[n.id]=e,t),{});var a=this._links.map((e,t)=>{var n=[this._linksSource,this._linksTarget].reduce((t,n)=>(t[n]=i[e[n]],t),{});return{source:n[this._linksSource],target:n[this._linksTarget],value:this._value(e,t)}});this._linkLookup=a.reduce((t,n)=>(t[n.source]||(t[n.source]=[]),t[n.source].push(n.target),t[n.target]||(t[n.target]=[]),t[n.target].push(n.source),t),{});let r=`translate(${this._margin.left}, ${this._margin.top})`;return this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(e).nodeSort(this._nodeSort).links(a).linkSort(this._linkSort).iterations(this._iterations).size([n,t])(),this._shapes.push((new Sc).config(this._shapeConfig.Path).data(a).d(this._path).select(Pt("g.d3plus-Links",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).render()),ca().key(t=>t.shape).entries(e).forEach(t=>{this._shapes.push((new kc[t.key]).data(t.values).height(t=>t.y1-t.y0).width(t=>t.x1-t.x0).x(t=>(t.x1+t.x0)/2).y(t=>(t.y1+t.y0)/2).select(Pt("g.d3plus-sankey-nodes",{parent:this._select,enter:{transform:r},update:{transform:r}}).node()).config(Bt.bind(this)(this._shapeConfig,"shape",t.key)).render())}),this}
|
|
7150
7152
|
/**
|
|
7151
7153
|
@memberof Sankey
|
|
7152
7154
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
7153
7155
|
@param {Function} [*value*]
|
|
7154
7156
|
@chainable
|
|
7155
7157
|
*/hover(n){return this._hover=n,this._shapes.forEach(t=>t.hover(n)),this._legend&&this._legendClass.hover(n),this}
|
|
7158
|
+
/**
|
|
7159
|
+
@memberof Sankey
|
|
7160
|
+
@desc A pass-through for the d3-sankey [iterations](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_iterations) function.
|
|
7161
|
+
@param {Number} [*value* = 6]
|
|
7162
|
+
@chainable
|
|
7163
|
+
*/iterations(t){return arguments.length?(this._iterations=t,this):this._iterations}
|
|
7156
7164
|
/**
|
|
7157
7165
|
@memberof Sankey
|
|
7158
7166
|
@desc A predefined *Array* of edges that connect each object passed to the [node](#Sankey.node) method. The `source` and `target` keys in each link need to map to the nodes in one of one way:
|
|
@@ -7162,6 +7170,12 @@ r=r<0?r%I9+I9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7162
7170
|
@param {Array} *links* = []
|
|
7163
7171
|
@chainable
|
|
7164
7172
|
*/links(t,n){return arguments.length?(lu.bind(this)(t,n,"links"),this):this._links}
|
|
7173
|
+
/**
|
|
7174
|
+
@memberof Sankey
|
|
7175
|
+
@desc A pass-through for the d3-sankey [linkSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_linkSort) function.
|
|
7176
|
+
@param {Function|undefined} [*value* = undefined]
|
|
7177
|
+
@chainable
|
|
7178
|
+
*/linkSort(t){return arguments.length?(this._linkSort=t,this):this._linkSort}
|
|
7165
7179
|
/**
|
|
7166
7180
|
@memberof Sankey
|
|
7167
7181
|
@desc The key inside of each link Object that references the source node.
|
|
@@ -7200,6 +7214,12 @@ r=r<0?r%I9+I9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7200
7214
|
@param {Number} [*value* = 8]
|
|
7201
7215
|
@chainable
|
|
7202
7216
|
*/nodePadding(t){return arguments.length?(this._nodePadding=t,this):this._nodePadding}
|
|
7217
|
+
/**
|
|
7218
|
+
@memberof Sankey
|
|
7219
|
+
@desc A pass-through for the d3-sankey [nodeSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_nodeSort) function.
|
|
7220
|
+
@param {Function|undefined} [*value* = undefined]
|
|
7221
|
+
@chainable
|
|
7222
|
+
*/nodeSort(t){return arguments.length?(this._nodeSort=t,this):this._nodeSort}
|
|
7203
7223
|
/**
|
|
7204
7224
|
@memberof Sankey
|
|
7205
7225
|
@desc If *value* is specified, sets the width of the node and returns the current class instance. If *value* is not specified, returns the current nodeWidth. By default, the nodeWidth size is 30.
|
|
@@ -7219,7 +7239,7 @@ r=r<0?r%I9+I9:r)?this._+="A"+e+","+e+",0,1,"+u+","+(t-o)+","+(n-s)+"A"+e+","+e+"
|
|
|
7219
7239
|
@memberof Sankey
|
|
7220
7240
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
7221
7241
|
@private
|
|
7222
|
-
*/constructor(){super(),this._nodeId=p("id"),this._links=p("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=p("nodes"),this._nodeAlign=tx.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let n=this._on["mousemove.shape"];this._on["mousemove.shape"]=(a,r,o,t)=>{if(n(a,r,o,t),this._focus&&this._focus===a.id)this.hover(!1),this._on.mouseenter.bind(this)(a,r,o,t),this._focus=void 0;else{let e=this._nodeId(a,r),t=this._nodeLookup[e],n=Object.keys(this._nodeLookup).reduce((t,n)=>(t[this._nodeLookup[n]]=isNaN(n)?n:parseInt(n,10),t),{});o=this._linkLookup[t];let i=[e];o.forEach(t=>{i.push(n[t])}),this.hover((t,n)=>t.source&&t.target?t.source.id===e||t.target.id===e:i.includes(this._nodeId(t,n)))}},this._path=X9().source(J9).target(Q9),this._sankey=j9(),this._shape=Lt("Rect"),this._shapeConfig=Et(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=Lt(1)}}class ex extends If{
|
|
7242
|
+
*/constructor(){super(),this._iterations=6,this._nodeId=p("id"),this._nodeSort=void 0,this._links=p("links"),this._linkSort=void 0,this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=p("nodes"),this._nodeAlign=tx.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let n=this._on["mousemove.shape"];this._on["mousemove.shape"]=(a,r,o,t)=>{if(n(a,r,o,t),this._focus&&this._focus===a.id)this.hover(!1),this._on.mouseenter.bind(this)(a,r,o,t),this._focus=void 0;else{let e=this._nodeId(a,r),t=this._nodeLookup[e],n=Object.keys(this._nodeLookup).reduce((t,n)=>(t[this._nodeLookup[n]]=isNaN(n)?n:parseInt(n,10),t),{});o=this._linkLookup[t];let i=[e];o.forEach(t=>{i.push(n[t])}),this.hover((t,n)=>t.source&&t.target?t.source.id===e||t.target.id===e:i.includes(this._nodeId(t,n)))}},this._path=X9().source(J9).target(Q9),this._sankey=j9(),this._shape=Lt("Rect"),this._shapeConfig=Et(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=Lt(1)}}class ex extends If{
|
|
7223
7243
|
/**
|
|
7224
7244
|
@memberof StackedArea
|
|
7225
7245
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
package/umd/d3plus-core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.15
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
|
-
Copyright (c)
|
|
4
|
+
Copyright (c) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -2711,6 +2711,7 @@
|
|
|
2711
2711
|
if (zeroMatch) return +`${zeroMatch[1]}${+zeroMatch[2]}`;
|
|
2712
2712
|
return d;
|
|
2713
2713
|
};
|
|
2714
|
+
const maxTimezoneOffset = 1000 * 60 * 60 * 26;
|
|
2714
2715
|
/**
|
|
2715
2716
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
2716
2717
|
* @param {scale} scale A d3-scale object
|
|
@@ -2753,9 +2754,15 @@
|
|
|
2753
2754
|
* @private
|
|
2754
2755
|
*/ function calculateTicks(scale, minorTicks = false) {
|
|
2755
2756
|
let ticks = [];
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2757
|
+
const scaleClone = scale.copy();
|
|
2758
|
+
if (this._scale === "time" && this._data.length) {
|
|
2759
|
+
const newDomain = d3Array.extent(this._data);
|
|
2760
|
+
const range = newDomain.map(scale);
|
|
2761
|
+
scaleClone.domain(newDomain).range(range);
|
|
2762
|
+
}
|
|
2763
|
+
const domain = scaleClone.domain();
|
|
2758
2764
|
const inverted = domain[1] < domain[0];
|
|
2765
|
+
const step = calculateStep.bind(this)(scaleClone, minorTicks);
|
|
2759
2766
|
if (!minorTicks && this._scale === "log") {
|
|
2760
2767
|
const roundDomain = domain.map((d)=>Math.log10(d) % 1 === 0 ? d : (inverted ? ceilPow : floorPow)(d));
|
|
2761
2768
|
const invertedRound = roundDomain[1] < roundDomain[0];
|
|
@@ -2764,11 +2771,11 @@
|
|
|
2764
2771
|
1
|
|
2765
2772
|
].includes(d) || Math.abs(d) < 1 ? 1 : Math.log10(Math.abs(d))));
|
|
2766
2773
|
const powMod = Math.ceil((Math.abs(powers[1] - powers[0]) + 1) / (step * 0.65));
|
|
2767
|
-
ticks = powMod <= 1 && powers[0] === powers[1] || invertedRound !== inverted ?
|
|
2774
|
+
ticks = powMod <= 1 && powers[0] === powers[1] || invertedRound !== inverted ? scaleClone.ticks(step).filter((d)=>+`${d}`.replace("0.", "") % 2 === 0) : d3Array.range(powers[0], powers[1], powers[1] < powers[0] ? -1 : 1).concat([
|
|
2768
2775
|
powers[1]
|
|
2769
2776
|
]).filter((d)=>Math.abs(d) % powMod === 0).map((d)=>+`${(isNegative(d) ? -1 : 1) * (d ? Math.pow(10, Math.abs(d)) : Math.sign(1 / d) > 0 ? 1 : -1)}`.replace(/9+/g, "1"));
|
|
2770
2777
|
} else {
|
|
2771
|
-
ticks =
|
|
2778
|
+
ticks = scaleClone.ticks(step);
|
|
2772
2779
|
if (!minorTicks && ![
|
|
2773
2780
|
"log",
|
|
2774
2781
|
"time"
|
|
@@ -2784,6 +2791,14 @@
|
|
|
2784
2791
|
});
|
|
2785
2792
|
}
|
|
2786
2793
|
}
|
|
2794
|
+
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
2795
|
+
if (this._scale === "time" && this._data.length) {
|
|
2796
|
+
const dataNumbers = this._data.map(Number);
|
|
2797
|
+
ticks = ticks.filter((t)=>{
|
|
2798
|
+
const tn = +t;
|
|
2799
|
+
return dataNumbers.find((n)=>n >= tn - maxTimezoneOffset && n <= tn + maxTimezoneOffset);
|
|
2800
|
+
});
|
|
2801
|
+
}
|
|
2787
2802
|
// forces min/max into ticks, if not present
|
|
2788
2803
|
if (!this._d3ScaleNegative || isNegative(domain[inverted ? 1 : 0]) === ticks.some((d)=>isNegative(d))) {
|
|
2789
2804
|
if (!ticks.map(Number).includes(+domain[0])) {
|
|
@@ -2795,7 +2810,6 @@
|
|
|
2795
2810
|
ticks.push(domain[1]);
|
|
2796
2811
|
}
|
|
2797
2812
|
}
|
|
2798
|
-
if (this._scale === "time" && this._data.length) ticks = this._data;
|
|
2799
2813
|
return ticks;
|
|
2800
2814
|
}
|
|
2801
2815
|
class Axis extends BaseClass {
|
|
@@ -13758,7 +13772,7 @@
|
|
|
13758
13772
|
return obj;
|
|
13759
13773
|
}, {});
|
|
13760
13774
|
const transform = `translate(${this._margin.left}, ${this._margin.top})`;
|
|
13761
|
-
this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(nodes).links(links).size([
|
|
13775
|
+
this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(nodes).nodeSort(this._nodeSort).links(links).linkSort(this._linkSort).iterations(this._iterations).size([
|
|
13762
13776
|
width,
|
|
13763
13777
|
height
|
|
13764
13778
|
])();
|
|
@@ -13795,6 +13809,14 @@
|
|
|
13795
13809
|
if (this._legend) this._legendClass.hover(_);
|
|
13796
13810
|
return this;
|
|
13797
13811
|
}
|
|
13812
|
+
/**
|
|
13813
|
+
@memberof Sankey
|
|
13814
|
+
@desc A pass-through for the d3-sankey [iterations](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_iterations) function.
|
|
13815
|
+
@param {Number} [*value* = 6]
|
|
13816
|
+
@chainable
|
|
13817
|
+
*/ iterations(_) {
|
|
13818
|
+
return arguments.length ? (this._iterations = _, this) : this._iterations;
|
|
13819
|
+
}
|
|
13798
13820
|
/**
|
|
13799
13821
|
@memberof Sankey
|
|
13800
13822
|
@desc A predefined *Array* of edges that connect each object passed to the [node](#Sankey.node) method. The `source` and `target` keys in each link need to map to the nodes in one of one way:
|
|
@@ -13810,6 +13832,14 @@
|
|
|
13810
13832
|
}
|
|
13811
13833
|
return this._links;
|
|
13812
13834
|
}
|
|
13835
|
+
/**
|
|
13836
|
+
@memberof Sankey
|
|
13837
|
+
@desc A pass-through for the d3-sankey [linkSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_linkSort) function.
|
|
13838
|
+
@param {Function|undefined} [*value* = undefined]
|
|
13839
|
+
@chainable
|
|
13840
|
+
*/ linkSort(_) {
|
|
13841
|
+
return arguments.length ? (this._linkSort = _, this) : this._linkSort;
|
|
13842
|
+
}
|
|
13813
13843
|
/**
|
|
13814
13844
|
@memberof Sankey
|
|
13815
13845
|
@desc The key inside of each link Object that references the source node.
|
|
@@ -13864,6 +13894,14 @@
|
|
|
13864
13894
|
*/ nodePadding(_) {
|
|
13865
13895
|
return arguments.length ? (this._nodePadding = _, this) : this._nodePadding;
|
|
13866
13896
|
}
|
|
13897
|
+
/**
|
|
13898
|
+
@memberof Sankey
|
|
13899
|
+
@desc A pass-through for the d3-sankey [nodeSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_nodeSort) function.
|
|
13900
|
+
@param {Function|undefined} [*value* = undefined]
|
|
13901
|
+
@chainable
|
|
13902
|
+
*/ nodeSort(_) {
|
|
13903
|
+
return arguments.length ? (this._nodeSort = _, this) : this._nodeSort;
|
|
13904
|
+
}
|
|
13867
13905
|
/**
|
|
13868
13906
|
@memberof Sankey
|
|
13869
13907
|
@desc If *value* is specified, sets the width of the node and returns the current class instance. If *value* is not specified, returns the current nodeWidth. By default, the nodeWidth size is 30.
|
|
@@ -13889,8 +13927,11 @@
|
|
|
13889
13927
|
@private
|
|
13890
13928
|
*/ constructor(){
|
|
13891
13929
|
super();
|
|
13930
|
+
this._iterations = 6;
|
|
13892
13931
|
this._nodeId = accessor("id");
|
|
13932
|
+
this._nodeSort = undefined;
|
|
13893
13933
|
this._links = accessor("links");
|
|
13934
|
+
this._linkSort = undefined;
|
|
13894
13935
|
this._linksSource = "source";
|
|
13895
13936
|
this._linksTarget = "target";
|
|
13896
13937
|
this._noDataMessage = false;
|