@visactor/vchart 1.13.21-alpha.1 → 1.13.21-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es5/index.js +2 -2
- package/build/index.es.js +32 -10
- package/build/index.js +32 -10
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/sankey/sankey-transformer.js +1 -1
- package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.d.ts +2 -0
- package/cjs/core/vchart.js +3 -0
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/sankey.d.ts +2 -0
- package/cjs/data/transforms/sankey.js +2 -1
- package/cjs/data/transforms/sankey.js.map +1 -1
- package/cjs/plugin/chart/plugin-service.d.ts +1 -0
- package/cjs/plugin/chart/plugin-service.js +3 -0
- package/cjs/plugin/chart/plugin-service.js.map +1 -1
- package/cjs/plugin/chart/scroll/scroll.d.ts +16 -2
- package/cjs/plugin/chart/scroll/scroll.js +98 -23
- package/cjs/plugin/chart/scroll/scroll.js.map +1 -1
- package/cjs/series/sankey/interface.d.ts +4 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.js +3 -1
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/esm/chart/sankey/sankey-transformer.js +1 -1
- package/esm/chart/sankey/sankey-transformer.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.d.ts +2 -0
- package/esm/core/vchart.js +3 -0
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/sankey.d.ts +2 -0
- package/esm/data/transforms/sankey.js +2 -1
- package/esm/data/transforms/sankey.js.map +1 -1
- package/esm/plugin/chart/plugin-service.d.ts +1 -0
- package/esm/plugin/chart/plugin-service.js +3 -0
- package/esm/plugin/chart/plugin-service.js.map +1 -1
- package/esm/plugin/chart/scroll/scroll.d.ts +16 -2
- package/esm/plugin/chart/scroll/scroll.js +102 -23
- package/esm/plugin/chart/scroll/scroll.js.map +1 -1
- package/esm/series/sankey/interface.d.ts +4 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.js +3 -1
- package/esm/series/sankey/sankey.js.map +1 -1
- package/package.json +12 -12
package/build/index.es.js
CHANGED
|
@@ -62888,6 +62888,9 @@ class ChartPluginService extends BasePluginService {
|
|
|
62888
62888
|
super();
|
|
62889
62889
|
this.globalInstance = globalInstance;
|
|
62890
62890
|
}
|
|
62891
|
+
getPlugin(name) {
|
|
62892
|
+
return this._plugins.find(plugin => plugin.name === name);
|
|
62893
|
+
}
|
|
62891
62894
|
onInit(chartSpec) {
|
|
62892
62895
|
this._plugins.forEach(plugin => {
|
|
62893
62896
|
plugin.onInit && plugin.onInit(this, chartSpec);
|
|
@@ -63048,6 +63051,9 @@ class VChart {
|
|
|
63048
63051
|
getDataSet() {
|
|
63049
63052
|
return this._dataSet;
|
|
63050
63053
|
}
|
|
63054
|
+
get chartPlugin() {
|
|
63055
|
+
return this._chartPlugin;
|
|
63056
|
+
}
|
|
63051
63057
|
constructor(spec, options) {
|
|
63052
63058
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
63053
63059
|
this.id = createID();
|
|
@@ -64268,7 +64274,7 @@ const registerVChartCore = () => {
|
|
|
64268
64274
|
};
|
|
64269
64275
|
registerVChartCore();
|
|
64270
64276
|
|
|
64271
|
-
const version = "1.13.21-alpha.
|
|
64277
|
+
const version = "1.13.21-alpha.2";
|
|
64272
64278
|
|
|
64273
64279
|
const addVChartProperty = (data, op) => {
|
|
64274
64280
|
const context = op.beforeCall();
|
|
@@ -85797,7 +85803,10 @@ class SankeyLayout {
|
|
|
85797
85803
|
this._ascendingSourceBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.source], this._nodeMap[b.source]) || a.index - b.index, this._ascendingTargetBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.target], this._nodeMap[b.target]) || a.index - b.index, this.options = Object.assign({}, SankeyLayout.defaultOptions, options);
|
|
85798
85804
|
const keyOption = this.options.nodeKey,
|
|
85799
85805
|
keyFunc = isFunction$1(keyOption) ? keyOption : keyOption ? field$3(keyOption) : null;
|
|
85800
|
-
this._getNodeKey = keyFunc
|
|
85806
|
+
this._getNodeKey = keyFunc;
|
|
85807
|
+
const depthOption = this.options.depthKey,
|
|
85808
|
+
depthFunc = isFunction$1(depthOption) ? depthOption : depthOption ? field$3(depthOption) : null;
|
|
85809
|
+
this._getNodeDepth = depthFunc, this._logger = Logger.getInstance(), this._alignFunc = isFunction$1(this.options.setNodeLayer) ? node => this.options.setNodeLayer(node.datum) : alignFunctions[this.options.nodeAlign];
|
|
85801
85810
|
}
|
|
85802
85811
|
layout(data, config) {
|
|
85803
85812
|
if (!data) return null;
|
|
@@ -85902,11 +85911,12 @@ class SankeyLayout {
|
|
|
85902
85911
|
calculateNodeValue(originalNodes);
|
|
85903
85912
|
const doSubTree = (subTree, depth, parents) => {
|
|
85904
85913
|
subTree.forEach((node, index) => {
|
|
85914
|
+
var _a;
|
|
85905
85915
|
const nodeKey = this._getNodeKey ? this._getNodeKey(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
85906
85916
|
nodeValue = isNil$1(node.value) ? 0 : toValidNumber$1(node.value);
|
|
85907
85917
|
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
85908
85918
|
const nodeElement = {
|
|
85909
|
-
depth: depth,
|
|
85919
|
+
depth: this._getNodeDepth && null !== (_a = this._getNodeDepth(node)) && void 0 !== _a ? _a : depth,
|
|
85910
85920
|
datum: node,
|
|
85911
85921
|
index: index,
|
|
85912
85922
|
key: nodeKey,
|
|
@@ -86024,7 +86034,7 @@ class SankeyLayout {
|
|
|
86024
86034
|
}
|
|
86025
86035
|
}
|
|
86026
86036
|
computeNodeDepths(nodes) {
|
|
86027
|
-
var _a;
|
|
86037
|
+
var _a, _b;
|
|
86028
86038
|
const n = nodes.length;
|
|
86029
86039
|
let next,
|
|
86030
86040
|
nextMap,
|
|
@@ -86036,9 +86046,12 @@ class SankeyLayout {
|
|
|
86036
86046
|
next = [], nextMap = {};
|
|
86037
86047
|
for (let i = 0, curLen = current.length; i < curLen; i++) {
|
|
86038
86048
|
const node = current[i];
|
|
86039
|
-
if (node
|
|
86040
|
-
const
|
|
86041
|
-
|
|
86049
|
+
if (node) {
|
|
86050
|
+
const tempDepth = setNodeLayer && null !== (_a = setNodeLayer(node.datum)) && void 0 !== _a ? _a : depth;
|
|
86051
|
+
if (node.depth = this._getNodeDepth && null !== (_b = this._getNodeDepth(node.datum)) && void 0 !== _b ? _b : tempDepth, setNodeLayer && (maxDepth = Math.max(node.depth, maxDepth)), node.sourceLinks && node.sourceLinks.length) for (let j = 0, linkLen = node.sourceLinks.length; j < linkLen; j++) {
|
|
86052
|
+
const link = node.sourceLinks[j];
|
|
86053
|
+
nextMap[link.target] || (next.push(this._nodeMap[link.target]), nextMap[link.target] = !0);
|
|
86054
|
+
}
|
|
86042
86055
|
}
|
|
86043
86056
|
}
|
|
86044
86057
|
current = next, depth += 1;
|
|
@@ -86442,7 +86455,12 @@ const sankeyLayout = (data, op) => {
|
|
|
86442
86455
|
}
|
|
86443
86456
|
const layout = new SankeyLayout(op);
|
|
86444
86457
|
const result = [];
|
|
86445
|
-
|
|
86458
|
+
if (op.customLayout) {
|
|
86459
|
+
result.push(op.customLayout(layout, originalData, view, op));
|
|
86460
|
+
}
|
|
86461
|
+
else {
|
|
86462
|
+
result.push(layout.layout(originalData, view));
|
|
86463
|
+
}
|
|
86446
86464
|
return result;
|
|
86447
86465
|
};
|
|
86448
86466
|
|
|
@@ -86762,6 +86780,7 @@ class SankeySeries extends CartesianSeries {
|
|
|
86762
86780
|
maxLinkHeight: this._spec.maxLinkHeight,
|
|
86763
86781
|
iterations: this._spec.iterations,
|
|
86764
86782
|
nodeKey: this._spec.nodeKey,
|
|
86783
|
+
depthKey: this._spec.depthKey,
|
|
86765
86784
|
linkSortBy: this._spec.linkSortBy,
|
|
86766
86785
|
nodeSortBy: this._spec.nodeSortBy,
|
|
86767
86786
|
setNodeLayer: this._spec.setNodeLayer,
|
|
@@ -86770,7 +86789,8 @@ class SankeySeries extends CartesianSeries {
|
|
|
86770
86789
|
linkHeight: this._spec.linkHeight,
|
|
86771
86790
|
equalNodeHeight: this._spec.equalNodeHeight,
|
|
86772
86791
|
linkOverlap: this._spec.linkOverlap,
|
|
86773
|
-
inverse: this._spec.inverse
|
|
86792
|
+
inverse: this._spec.inverse,
|
|
86793
|
+
customLayout: this._spec.customLayout
|
|
86774
86794
|
},
|
|
86775
86795
|
level: TransformLevel.sankeyLayout
|
|
86776
86796
|
});
|
|
@@ -92704,6 +92724,7 @@ class SankeyChartSpecTransformer extends BaseChartSpecTransformer {
|
|
|
92704
92724
|
'linkOverlap',
|
|
92705
92725
|
'iterations',
|
|
92706
92726
|
'nodeKey',
|
|
92727
|
+
'depthKey',
|
|
92707
92728
|
'linkSortBy',
|
|
92708
92729
|
'nodeSortBy',
|
|
92709
92730
|
'setNodeLayer',
|
|
@@ -92711,7 +92732,8 @@ class SankeyChartSpecTransformer extends BaseChartSpecTransformer {
|
|
|
92711
92732
|
'link',
|
|
92712
92733
|
'emphasis',
|
|
92713
92734
|
'inverse',
|
|
92714
|
-
'overflow'
|
|
92735
|
+
'overflow',
|
|
92736
|
+
'customLayout'
|
|
92715
92737
|
]);
|
|
92716
92738
|
return series;
|
|
92717
92739
|
}
|
package/build/index.js
CHANGED
|
@@ -62894,6 +62894,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62894
62894
|
super();
|
|
62895
62895
|
this.globalInstance = globalInstance;
|
|
62896
62896
|
}
|
|
62897
|
+
getPlugin(name) {
|
|
62898
|
+
return this._plugins.find(plugin => plugin.name === name);
|
|
62899
|
+
}
|
|
62897
62900
|
onInit(chartSpec) {
|
|
62898
62901
|
this._plugins.forEach(plugin => {
|
|
62899
62902
|
plugin.onInit && plugin.onInit(this, chartSpec);
|
|
@@ -63054,6 +63057,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63054
63057
|
getDataSet() {
|
|
63055
63058
|
return this._dataSet;
|
|
63056
63059
|
}
|
|
63060
|
+
get chartPlugin() {
|
|
63061
|
+
return this._chartPlugin;
|
|
63062
|
+
}
|
|
63057
63063
|
constructor(spec, options) {
|
|
63058
63064
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
63059
63065
|
this.id = createID();
|
|
@@ -64274,7 +64280,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
64274
64280
|
};
|
|
64275
64281
|
registerVChartCore();
|
|
64276
64282
|
|
|
64277
|
-
const version = "1.13.21-alpha.
|
|
64283
|
+
const version = "1.13.21-alpha.2";
|
|
64278
64284
|
|
|
64279
64285
|
const addVChartProperty = (data, op) => {
|
|
64280
64286
|
const context = op.beforeCall();
|
|
@@ -85803,7 +85809,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
85803
85809
|
this._ascendingSourceBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.source], this._nodeMap[b.source]) || a.index - b.index, this._ascendingTargetBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.target], this._nodeMap[b.target]) || a.index - b.index, this.options = Object.assign({}, SankeyLayout.defaultOptions, options);
|
|
85804
85810
|
const keyOption = this.options.nodeKey,
|
|
85805
85811
|
keyFunc = isFunction$1(keyOption) ? keyOption : keyOption ? field$3(keyOption) : null;
|
|
85806
|
-
this._getNodeKey = keyFunc
|
|
85812
|
+
this._getNodeKey = keyFunc;
|
|
85813
|
+
const depthOption = this.options.depthKey,
|
|
85814
|
+
depthFunc = isFunction$1(depthOption) ? depthOption : depthOption ? field$3(depthOption) : null;
|
|
85815
|
+
this._getNodeDepth = depthFunc, this._logger = Logger.getInstance(), this._alignFunc = isFunction$1(this.options.setNodeLayer) ? node => this.options.setNodeLayer(node.datum) : alignFunctions[this.options.nodeAlign];
|
|
85807
85816
|
}
|
|
85808
85817
|
layout(data, config) {
|
|
85809
85818
|
if (!data) return null;
|
|
@@ -85908,11 +85917,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
85908
85917
|
calculateNodeValue(originalNodes);
|
|
85909
85918
|
const doSubTree = (subTree, depth, parents) => {
|
|
85910
85919
|
subTree.forEach((node, index) => {
|
|
85920
|
+
var _a;
|
|
85911
85921
|
const nodeKey = this._getNodeKey ? this._getNodeKey(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
85912
85922
|
nodeValue = isNil$1(node.value) ? 0 : toValidNumber$1(node.value);
|
|
85913
85923
|
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
85914
85924
|
const nodeElement = {
|
|
85915
|
-
depth: depth,
|
|
85925
|
+
depth: this._getNodeDepth && null !== (_a = this._getNodeDepth(node)) && void 0 !== _a ? _a : depth,
|
|
85916
85926
|
datum: node,
|
|
85917
85927
|
index: index,
|
|
85918
85928
|
key: nodeKey,
|
|
@@ -86030,7 +86040,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86030
86040
|
}
|
|
86031
86041
|
}
|
|
86032
86042
|
computeNodeDepths(nodes) {
|
|
86033
|
-
var _a;
|
|
86043
|
+
var _a, _b;
|
|
86034
86044
|
const n = nodes.length;
|
|
86035
86045
|
let next,
|
|
86036
86046
|
nextMap,
|
|
@@ -86042,9 +86052,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86042
86052
|
next = [], nextMap = {};
|
|
86043
86053
|
for (let i = 0, curLen = current.length; i < curLen; i++) {
|
|
86044
86054
|
const node = current[i];
|
|
86045
|
-
if (node
|
|
86046
|
-
const
|
|
86047
|
-
|
|
86055
|
+
if (node) {
|
|
86056
|
+
const tempDepth = setNodeLayer && null !== (_a = setNodeLayer(node.datum)) && void 0 !== _a ? _a : depth;
|
|
86057
|
+
if (node.depth = this._getNodeDepth && null !== (_b = this._getNodeDepth(node.datum)) && void 0 !== _b ? _b : tempDepth, setNodeLayer && (maxDepth = Math.max(node.depth, maxDepth)), node.sourceLinks && node.sourceLinks.length) for (let j = 0, linkLen = node.sourceLinks.length; j < linkLen; j++) {
|
|
86058
|
+
const link = node.sourceLinks[j];
|
|
86059
|
+
nextMap[link.target] || (next.push(this._nodeMap[link.target]), nextMap[link.target] = !0);
|
|
86060
|
+
}
|
|
86048
86061
|
}
|
|
86049
86062
|
}
|
|
86050
86063
|
current = next, depth += 1;
|
|
@@ -86448,7 +86461,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86448
86461
|
}
|
|
86449
86462
|
const layout = new SankeyLayout(op);
|
|
86450
86463
|
const result = [];
|
|
86451
|
-
|
|
86464
|
+
if (op.customLayout) {
|
|
86465
|
+
result.push(op.customLayout(layout, originalData, view, op));
|
|
86466
|
+
}
|
|
86467
|
+
else {
|
|
86468
|
+
result.push(layout.layout(originalData, view));
|
|
86469
|
+
}
|
|
86452
86470
|
return result;
|
|
86453
86471
|
};
|
|
86454
86472
|
|
|
@@ -86768,6 +86786,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86768
86786
|
maxLinkHeight: this._spec.maxLinkHeight,
|
|
86769
86787
|
iterations: this._spec.iterations,
|
|
86770
86788
|
nodeKey: this._spec.nodeKey,
|
|
86789
|
+
depthKey: this._spec.depthKey,
|
|
86771
86790
|
linkSortBy: this._spec.linkSortBy,
|
|
86772
86791
|
nodeSortBy: this._spec.nodeSortBy,
|
|
86773
86792
|
setNodeLayer: this._spec.setNodeLayer,
|
|
@@ -86776,7 +86795,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86776
86795
|
linkHeight: this._spec.linkHeight,
|
|
86777
86796
|
equalNodeHeight: this._spec.equalNodeHeight,
|
|
86778
86797
|
linkOverlap: this._spec.linkOverlap,
|
|
86779
|
-
inverse: this._spec.inverse
|
|
86798
|
+
inverse: this._spec.inverse,
|
|
86799
|
+
customLayout: this._spec.customLayout
|
|
86780
86800
|
},
|
|
86781
86801
|
level: TransformLevel.sankeyLayout
|
|
86782
86802
|
});
|
|
@@ -92710,6 +92730,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92710
92730
|
'linkOverlap',
|
|
92711
92731
|
'iterations',
|
|
92712
92732
|
'nodeKey',
|
|
92733
|
+
'depthKey',
|
|
92713
92734
|
'linkSortBy',
|
|
92714
92735
|
'nodeSortBy',
|
|
92715
92736
|
'setNodeLayer',
|
|
@@ -92717,7 +92738,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92717
92738
|
'link',
|
|
92718
92739
|
'emphasis',
|
|
92719
92740
|
'inverse',
|
|
92720
|
-
'overflow'
|
|
92741
|
+
'overflow',
|
|
92742
|
+
'customLayout'
|
|
92721
92743
|
]);
|
|
92722
92744
|
return series;
|
|
92723
92745
|
}
|