@visactor/vchart-extension 2.0.3-alpha.2 → 2.0.3
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/index.js +0 -374
- package/build/index.min.js +2 -2
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- package/cjs/charts/bar-3d/constant.js +2 -1
- package/cjs/charts/funnel-3d/constant.js +1 -2
- package/cjs/charts/funnel-3d/index.js +2 -1
- package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -2
- package/cjs/charts/image-cloud/image-cloud.js +1 -1
- package/cjs/charts/image-cloud/index.js +1 -1
- package/cjs/charts/image-cloud/interface.js +1 -1
- package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/cjs/charts/pictogram/element-select-by-graphic-name.js +1 -1
- package/cjs/charts/pictogram/index.js +1 -1
- package/cjs/charts/pictogram/interface.js +1 -1
- package/cjs/index.d.ts +0 -1
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/esm/charts/axis-3d/linear-axis.js +1 -2
- package/esm/charts/bar-3d/constant.js +2 -1
- package/esm/charts/funnel-3d/constant.js +1 -2
- package/esm/charts/funnel-3d/index.js +2 -1
- package/esm/charts/image-cloud/image-cloud-transformer.js +1 -2
- package/esm/charts/image-cloud/image-cloud.js +1 -1
- package/esm/charts/image-cloud/index.js +1 -1
- package/esm/charts/image-cloud/interface.js +1 -1
- package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/esm/charts/pictogram/element-select-by-graphic-name.js +1 -1
- package/esm/charts/pictogram/index.js +1 -1
- package/esm/charts/pictogram/interface.js +1 -1
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -2
- package/esm/index.js.map +1 -1
- package/package.json +9 -9
- package/cjs/charts/compare-sankey/compare-sankey-sub-data.d.ts +0 -9
- package/cjs/charts/compare-sankey/compare-sankey-sub-data.js +0 -38
- package/cjs/charts/compare-sankey/compare-sankey-sub-data.js.map +0 -1
- package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.d.ts +0 -2
- package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.js +0 -20
- package/cjs/charts/compare-sankey/compare-sankey-sub-nodes.js.map +0 -1
- package/cjs/charts/compare-sankey/compare-sankey-transformer.d.ts +0 -6
- package/cjs/charts/compare-sankey/compare-sankey-transformer.js +0 -22
- package/cjs/charts/compare-sankey/compare-sankey-transformer.js.map +0 -1
- package/cjs/charts/compare-sankey/compare-sankey.d.ts +0 -35
- package/cjs/charts/compare-sankey/compare-sankey.js +0 -187
- package/cjs/charts/compare-sankey/compare-sankey.js.map +0 -1
- package/cjs/charts/compare-sankey/constants.d.ts +0 -1
- package/cjs/charts/compare-sankey/constants.js +0 -2
- package/cjs/charts/compare-sankey/constants.js.map +0 -1
- package/cjs/charts/compare-sankey/index.d.ts +0 -2
- package/cjs/charts/compare-sankey/index.js +0 -21
- package/cjs/charts/compare-sankey/index.js.map +0 -1
- package/cjs/charts/compare-sankey/interface.d.ts +0 -23
- package/cjs/charts/compare-sankey/interface.js +0 -6
- package/cjs/charts/compare-sankey/interface.js.map +0 -1
- package/cjs/charts/compare-sankey/util.d.ts +0 -1
- package/cjs/charts/compare-sankey/util.js +0 -2
- package/cjs/charts/compare-sankey/util.js.map +0 -1
- package/esm/charts/compare-sankey/compare-sankey-sub-data.d.ts +0 -9
- package/esm/charts/compare-sankey/compare-sankey-sub-data.js +0 -33
- package/esm/charts/compare-sankey/compare-sankey-sub-data.js.map +0 -1
- package/esm/charts/compare-sankey/compare-sankey-sub-nodes.d.ts +0 -2
- package/esm/charts/compare-sankey/compare-sankey-sub-nodes.js +0 -12
- package/esm/charts/compare-sankey/compare-sankey-sub-nodes.js.map +0 -1
- package/esm/charts/compare-sankey/compare-sankey-transformer.d.ts +0 -6
- package/esm/charts/compare-sankey/compare-sankey-transformer.js +0 -14
- package/esm/charts/compare-sankey/compare-sankey-transformer.js.map +0 -1
- package/esm/charts/compare-sankey/compare-sankey.d.ts +0 -35
- package/esm/charts/compare-sankey/compare-sankey.js +0 -184
- package/esm/charts/compare-sankey/compare-sankey.js.map +0 -1
- package/esm/charts/compare-sankey/constants.d.ts +0 -1
- package/esm/charts/compare-sankey/constants.js +0 -2
- package/esm/charts/compare-sankey/constants.js.map +0 -1
- package/esm/charts/compare-sankey/index.d.ts +0 -2
- package/esm/charts/compare-sankey/index.js +0 -4
- package/esm/charts/compare-sankey/index.js.map +0 -1
- package/esm/charts/compare-sankey/interface.d.ts +0 -23
- package/esm/charts/compare-sankey/interface.js +0 -2
- package/esm/charts/compare-sankey/interface.js.map +0 -1
- package/esm/charts/compare-sankey/util.d.ts +0 -1
- package/esm/charts/compare-sankey/util.js +0 -2
- package/esm/charts/compare-sankey/util.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -722,12 +722,6 @@
|
|
|
722
722
|
return t => (d.setTime(aVal * (1 - t) + bVal * t), d);
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
function toValidNumber(v) {
|
|
726
|
-
if (isValidNumber$1(v)) return v;
|
|
727
|
-
const value = +v;
|
|
728
|
-
return isValidNumber$1(value) ? value : 0;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
725
|
const fakeRandom = () => {
|
|
732
726
|
let i = -1;
|
|
733
727
|
const arr = [0, .1, .2, .3, .4, .5, .6, .7, .8, .9];
|
|
@@ -20029,80 +20023,6 @@
|
|
|
20029
20023
|
})(ImageCloudMarkNameEnum || (ImageCloudMarkNameEnum = {}));
|
|
20030
20024
|
const imageCloudSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["image"]: { name: "image", type: "image" }, ["imageMask"]: { name: "imageMask", type: "rect" } });
|
|
20031
20025
|
|
|
20032
|
-
const calculateNodeValue = subTree => {
|
|
20033
|
-
let sum = 0;
|
|
20034
|
-
return subTree.forEach((node, index) => {
|
|
20035
|
-
var _a;
|
|
20036
|
-
isNil$1(node.value) && ((null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? node.value = calculateNodeValue(node.children) : node.value = 0), sum += Math.abs(node.value);
|
|
20037
|
-
}), sum;
|
|
20038
|
-
};
|
|
20039
|
-
function makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes = [], nodeMap = {}, originalLinks) {
|
|
20040
|
-
calculateNodeValue(originalNodes);
|
|
20041
|
-
const doSubTree = (subTree, depth, parents) => {
|
|
20042
|
-
subTree.forEach((node, index) => {
|
|
20043
|
-
const nodeKey = nodeKeyFunc ? nodeKeyFunc(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
20044
|
-
nodeValue = isNil$1(node.value) ? 0 : toValidNumber(node.value);
|
|
20045
|
-
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
20046
|
-
const nodeElement = {
|
|
20047
|
-
depth: depth,
|
|
20048
|
-
datum: node,
|
|
20049
|
-
index: index,
|
|
20050
|
-
key: nodeKey,
|
|
20051
|
-
value: nodeValue,
|
|
20052
|
-
sourceLinks: [],
|
|
20053
|
-
targetLinks: []
|
|
20054
|
-
};
|
|
20055
|
-
nodeMap[nodeKey] = nodeElement, nodes.push(nodeElement);
|
|
20056
|
-
}
|
|
20057
|
-
parents && originalLinks && originalLinks.push({
|
|
20058
|
-
source: parents[parents.length - 1].key,
|
|
20059
|
-
target: nodeKey,
|
|
20060
|
-
value: nodeValue,
|
|
20061
|
-
parents: parents
|
|
20062
|
-
}), node.children && node.children.length && doSubTree(node.children, depth + 1, parents ? parents.concat([nodeMap[nodeKey]]) : [nodeMap[nodeKey]]);
|
|
20063
|
-
});
|
|
20064
|
-
};
|
|
20065
|
-
return doSubTree(originalNodes, 0, null), nodes;
|
|
20066
|
-
}
|
|
20067
|
-
function computeHierarchicNodeLinks(originalNodes, nodeKeyFunc) {
|
|
20068
|
-
const nodes = [],
|
|
20069
|
-
links = [],
|
|
20070
|
-
nodeMap = {},
|
|
20071
|
-
linkMap = {},
|
|
20072
|
-
originalLinks = [];
|
|
20073
|
-
return makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes, nodeMap, originalLinks), originalLinks.forEach((link, index) => {
|
|
20074
|
-
const key = `${link.source}-${link.target}`,
|
|
20075
|
-
linkDatum = pickWithout(link, ["parents"]);
|
|
20076
|
-
if (linkDatum.parents = link.parents.map(node => pickWithout(node, ["sourceLinks", "targetLinks"])), linkMap[key]) return linkMap[key].value += toValidNumber(link.value), void linkMap[key].datum.push(linkDatum);
|
|
20077
|
-
const linkElement = {
|
|
20078
|
-
index: index,
|
|
20079
|
-
key: `${link.source}-${link.target}`,
|
|
20080
|
-
source: link.source,
|
|
20081
|
-
target: link.target,
|
|
20082
|
-
datum: [linkDatum],
|
|
20083
|
-
value: link.value,
|
|
20084
|
-
parents: link.parents.map(parent => parent.key)
|
|
20085
|
-
};
|
|
20086
|
-
links.push(linkElement), nodeMap[link.source].sourceLinks.push(linkElement), nodeMap[link.target].targetLinks.push(linkElement), linkMap[key] = linkElement;
|
|
20087
|
-
}), {
|
|
20088
|
-
nodes: nodes,
|
|
20089
|
-
links: links,
|
|
20090
|
-
nodeMap: nodeMap
|
|
20091
|
-
};
|
|
20092
|
-
}
|
|
20093
|
-
function computeNodeValues(nodes) {
|
|
20094
|
-
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
20095
|
-
const node = nodes[i];
|
|
20096
|
-
node.value = Math.max(isNil$1(node.value) ? 0 : toValidNumber(node.value), node.sourceLinks.reduce((sum, link) => {
|
|
20097
|
-
var _a;
|
|
20098
|
-
return sum + (null !== (_a = toValidNumber(link.value)) && void 0 !== _a ? _a : 0);
|
|
20099
|
-
}, 0), node.targetLinks.reduce((sum, link) => {
|
|
20100
|
-
var _a;
|
|
20101
|
-
return sum + (null !== (_a = toValidNumber(link.value)) && void 0 !== _a ? _a : 0);
|
|
20102
|
-
}, 0));
|
|
20103
|
-
}
|
|
20104
|
-
}
|
|
20105
|
-
|
|
20106
20026
|
const shapes = {
|
|
20107
20027
|
triangleForward: triangleForward,
|
|
20108
20028
|
triangleUpright: triangle,
|
|
@@ -22054,297 +21974,6 @@
|
|
|
22054
21974
|
vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
|
|
22055
21975
|
};
|
|
22056
21976
|
|
|
22057
|
-
class CompareSankeyChartSpecTransformer extends vchart.SankeyChartSpecTransformer {
|
|
22058
|
-
transformSpec(spec) {
|
|
22059
|
-
super.transformSpec(spec);
|
|
22060
|
-
}
|
|
22061
|
-
_getDefaultSeriesSpec(spec) {
|
|
22062
|
-
const seriesSpec = super._getDefaultSeriesSpec(spec);
|
|
22063
|
-
seriesSpec.subNodeGap = spec.subNodeGap;
|
|
22064
|
-
seriesSpec.compareNodeColor = spec.compareNodeColor;
|
|
22065
|
-
seriesSpec.compareLinkColor = spec.compareLinkColor;
|
|
22066
|
-
seriesSpec.activeLink = spec.activeLink;
|
|
22067
|
-
return seriesSpec;
|
|
22068
|
-
}
|
|
22069
|
-
}
|
|
22070
|
-
|
|
22071
|
-
const compareSankeySubNodes = (data) => {
|
|
22072
|
-
const viewData = data[0];
|
|
22073
|
-
if (!viewData.latestData) {
|
|
22074
|
-
return [];
|
|
22075
|
-
}
|
|
22076
|
-
const subData = Object.keys(viewData.latestData);
|
|
22077
|
-
if (!subData.length) {
|
|
22078
|
-
return {};
|
|
22079
|
-
}
|
|
22080
|
-
const subNodes = [];
|
|
22081
|
-
subData.forEach(key => {
|
|
22082
|
-
subNodes.push(...viewData.latestData[key].nodes);
|
|
22083
|
-
});
|
|
22084
|
-
return [{ nodes: subNodes }];
|
|
22085
|
-
};
|
|
22086
|
-
|
|
22087
|
-
const compareSankeySubData = (data, opt) => {
|
|
22088
|
-
var _a;
|
|
22089
|
-
const viewData = data[0];
|
|
22090
|
-
if (!((_a = viewData.latestData) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
22091
|
-
return {};
|
|
22092
|
-
}
|
|
22093
|
-
const rawDataTree = opt.rawData().latestData[0];
|
|
22094
|
-
const subNodeGap = opt.subNodeGap;
|
|
22095
|
-
const keyFunc = isFunction$1(opt.nodeKey) ? opt.nodeKey : opt.nodeKey ? field(opt.nodeKey) : null;
|
|
22096
|
-
const subNodeMap = {};
|
|
22097
|
-
rawDataTree.subNode.forEach((sunGroup) => {
|
|
22098
|
-
subNodeMap[sunGroup.type] = computeHierarchicNodeLinks(sunGroup.nodes, keyFunc);
|
|
22099
|
-
computeNodeValues(subNodeMap[sunGroup.type].nodes);
|
|
22100
|
-
});
|
|
22101
|
-
const subCount = Object.keys(subNodeMap).length;
|
|
22102
|
-
viewData.latestData[0].nodes.forEach((n) => {
|
|
22103
|
-
let path = [];
|
|
22104
|
-
if (n.targetLinks.length) {
|
|
22105
|
-
const link = n.targetLinks[0];
|
|
22106
|
-
path = [...link.parents];
|
|
22107
|
-
}
|
|
22108
|
-
path.push(n.key);
|
|
22109
|
-
let currentY = n.y0;
|
|
22110
|
-
const totalSize = n.y1 - n.y0 - (subCount - 1) * subNodeGap;
|
|
22111
|
-
const totalValue = n.value;
|
|
22112
|
-
rawDataTree.subNode.forEach((sunGroup) => {
|
|
22113
|
-
const subNode = subNodeMap[sunGroup.type].nodes.find(subN => subN.key === n.key);
|
|
22114
|
-
if (!subNode) {
|
|
22115
|
-
return;
|
|
22116
|
-
}
|
|
22117
|
-
const percent = subNode.value / totalValue;
|
|
22118
|
-
subNode.x0 = n.x0;
|
|
22119
|
-
subNode.x1 = n.x1;
|
|
22120
|
-
subNode.y0 = currentY;
|
|
22121
|
-
subNode.y1 = currentY + totalSize * percent;
|
|
22122
|
-
subNode.type = sunGroup.type;
|
|
22123
|
-
subNode.sourceNode = n;
|
|
22124
|
-
currentY += totalSize * percent + subNodeGap;
|
|
22125
|
-
});
|
|
22126
|
-
});
|
|
22127
|
-
return subNodeMap;
|
|
22128
|
-
};
|
|
22129
|
-
|
|
22130
|
-
class CompareSankeyChart extends vchart.SankeyChart {
|
|
22131
|
-
constructor() {
|
|
22132
|
-
super(...arguments);
|
|
22133
|
-
this.type = 'compareSankey';
|
|
22134
|
-
this.transformerConstructor = CompareSankeyChartSpecTransformer;
|
|
22135
|
-
}
|
|
22136
|
-
}
|
|
22137
|
-
CompareSankeyChart.type = 'compareSankey';
|
|
22138
|
-
CompareSankeyChart.transformerConstructor = CompareSankeyChartSpecTransformer;
|
|
22139
|
-
class CompareSankeySeries extends vchart.SankeySeries {
|
|
22140
|
-
constructor() {
|
|
22141
|
-
super(...arguments);
|
|
22142
|
-
this._fillCompareNode = (datum) => {
|
|
22143
|
-
var _a, _b, _c;
|
|
22144
|
-
if ((_a = this._spec.compareNodeColor) === null || _a === void 0 ? void 0 : _a[datum.type]) {
|
|
22145
|
-
return this._spec.compareNodeColor[datum.type];
|
|
22146
|
-
}
|
|
22147
|
-
return (_c = (_b = this._spec.node.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByNode(datum);
|
|
22148
|
-
};
|
|
22149
|
-
this._fillActiveLink = (datum) => {
|
|
22150
|
-
var _a, _b, _c;
|
|
22151
|
-
if ((_a = this._spec.compareLinkColor) === null || _a === void 0 ? void 0 : _a[datum.type]) {
|
|
22152
|
-
return this._spec.compareLinkColor[datum.type];
|
|
22153
|
-
}
|
|
22154
|
-
return (_c = (_b = this._spec.link.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByLink(datum);
|
|
22155
|
-
};
|
|
22156
|
-
}
|
|
22157
|
-
initData() {
|
|
22158
|
-
var _a;
|
|
22159
|
-
super.initData();
|
|
22160
|
-
const { dataSet } = this._option;
|
|
22161
|
-
const compareSubData = new DataView(dataSet, { name: `compare-sankey-sub-data-${this.id}-data` });
|
|
22162
|
-
compareSubData.parse([this.getViewData()], {
|
|
22163
|
-
type: 'dataview'
|
|
22164
|
-
});
|
|
22165
|
-
this._subData = compareSubData;
|
|
22166
|
-
const compareNodeData = new DataView(dataSet, { name: `compare-sankey-node-${this.id}-data` });
|
|
22167
|
-
compareNodeData.parse([compareSubData], {
|
|
22168
|
-
type: 'dataview'
|
|
22169
|
-
});
|
|
22170
|
-
vchart.registerDataSetInstanceTransform(this._dataSet, 'compareSankeySubData', compareSankeySubData);
|
|
22171
|
-
compareSubData.transform({
|
|
22172
|
-
type: 'compareSankeySubData',
|
|
22173
|
-
options: {
|
|
22174
|
-
rawData: () => this.getRawData(),
|
|
22175
|
-
valueField: this._valueField,
|
|
22176
|
-
nodeKey: this._spec.nodeKey,
|
|
22177
|
-
subNodeGap: (_a = this._spec.subNodeGap) !== null && _a !== void 0 ? _a : 2
|
|
22178
|
-
}
|
|
22179
|
-
});
|
|
22180
|
-
vchart.registerDataSetInstanceTransform(this._dataSet, 'compareSankeySubNodes', compareSankeySubNodes);
|
|
22181
|
-
compareNodeData.transform({
|
|
22182
|
-
type: 'compareSankeySubNodes'
|
|
22183
|
-
});
|
|
22184
|
-
this._nodesSeriesData.parse([compareNodeData], {
|
|
22185
|
-
type: 'dataview'
|
|
22186
|
-
});
|
|
22187
|
-
this._activeLinkData = new DataView(dataSet, { name: `compare-sankey-link-${this.id}-data` });
|
|
22188
|
-
}
|
|
22189
|
-
initEvent() {
|
|
22190
|
-
var _a;
|
|
22191
|
-
super.initEvent();
|
|
22192
|
-
(_a = this._activeLinkData) === null || _a === void 0 ? void 0 : _a.target.addListener('change', this.activeLinkDataUpdate.bind(this));
|
|
22193
|
-
}
|
|
22194
|
-
initMark() {
|
|
22195
|
-
super.initMark();
|
|
22196
|
-
const linkMark = this._createMark(Object.assign(Object.assign({}, vchart.SankeySeries.mark.link), { name: 'activeLink' }), {
|
|
22197
|
-
dataView: this._activeLinkData
|
|
22198
|
-
});
|
|
22199
|
-
if (linkMark) {
|
|
22200
|
-
this._activeLinkMark = linkMark;
|
|
22201
|
-
}
|
|
22202
|
-
}
|
|
22203
|
-
compileData() {
|
|
22204
|
-
var _a;
|
|
22205
|
-
super.compileData();
|
|
22206
|
-
(_a = this._activeLinkMark) === null || _a === void 0 ? void 0 : _a.compileData();
|
|
22207
|
-
}
|
|
22208
|
-
_initLinkMarkStyle() {
|
|
22209
|
-
super._initLinkMarkStyle();
|
|
22210
|
-
this._activeLinkMark.setGlyphConfig({
|
|
22211
|
-
direction: this.direction
|
|
22212
|
-
});
|
|
22213
|
-
this.setMarkStyle(this._activeLinkMark, {
|
|
22214
|
-
x0: (datum) => datum.x0,
|
|
22215
|
-
x1: (datum) => datum.x1,
|
|
22216
|
-
y0: (datum) => datum.y0,
|
|
22217
|
-
y1: (datum) => datum.y1,
|
|
22218
|
-
thickness: (datum) => datum.thickness
|
|
22219
|
-
}, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
|
|
22220
|
-
this.setMarkStyle(this._activeLinkMark, {
|
|
22221
|
-
fill: this._fillActiveLink
|
|
22222
|
-
}, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.User_Mark);
|
|
22223
|
-
}
|
|
22224
|
-
_initNodeMarkStyle() {
|
|
22225
|
-
super._initNodeMarkStyle();
|
|
22226
|
-
if (this._spec.compareNodeColor) {
|
|
22227
|
-
this.setMarkStyle(this._nodeMark, {
|
|
22228
|
-
fill: this._fillCompareNode
|
|
22229
|
-
}, 'normal', vchart.AttributeLevel.User_Mark);
|
|
22230
|
-
}
|
|
22231
|
-
}
|
|
22232
|
-
activeLinkDataUpdate() {
|
|
22233
|
-
this._activeLinkMark.getData().updateData();
|
|
22234
|
-
}
|
|
22235
|
-
_handleNodeRelatedClick(graphic) {
|
|
22236
|
-
const nodeDatum = vchart.getDatumOfGraphic(graphic);
|
|
22237
|
-
const allNodeElements = this._nodeMark.getGraphics();
|
|
22238
|
-
if (!allNodeElements || !allNodeElements.length) {
|
|
22239
|
-
return;
|
|
22240
|
-
}
|
|
22241
|
-
const allLinkElements = this._linkMark.getGraphics();
|
|
22242
|
-
if (!allLinkElements || !allLinkElements.length) {
|
|
22243
|
-
return;
|
|
22244
|
-
}
|
|
22245
|
-
allLinkElements.forEach(el => {
|
|
22246
|
-
el.removeState([vchart.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]);
|
|
22247
|
-
});
|
|
22248
|
-
this._highLightElements(allLinkElements, []);
|
|
22249
|
-
const nodeDatums = allNodeElements.map(el => vchart.getDatumOfGraphic(el));
|
|
22250
|
-
const pickNodeDatums = nodeDatums.filter(d => d.key === nodeDatum.key);
|
|
22251
|
-
const highlightLinksData = [];
|
|
22252
|
-
const highlightNodeKeys = [];
|
|
22253
|
-
this._activeTargetLink(nodeDatum, pickNodeDatums, allNodeElements, allLinkElements, highlightNodeKeys, highlightLinksData);
|
|
22254
|
-
this._activeSourceLink(nodeDatum, pickNodeDatums, nodeDatums, allNodeElements, highlightNodeKeys, highlightLinksData);
|
|
22255
|
-
this._highLightElements(allNodeElements, highlightNodeKeys);
|
|
22256
|
-
this._activeLinkData.parseNewData(highlightLinksData);
|
|
22257
|
-
this._needClear = true;
|
|
22258
|
-
}
|
|
22259
|
-
_activeTargetLink(nodeDatum, pickNodeDatums, allNodeElements, allLinkElements, highlightNodeKeys, highlightLinksData) {
|
|
22260
|
-
this._handleClearEmpty();
|
|
22261
|
-
const sourceNode = nodeDatum.sourceNode;
|
|
22262
|
-
const firstTarget = sourceNode.targetLinks[0];
|
|
22263
|
-
if (!firstTarget) {
|
|
22264
|
-
return;
|
|
22265
|
-
}
|
|
22266
|
-
let percent = 0;
|
|
22267
|
-
pickNodeDatums.forEach(n => {
|
|
22268
|
-
const link = n.targetLinks.find((l) => l.key === firstTarget.key);
|
|
22269
|
-
if (link) {
|
|
22270
|
-
const p = link.value / firstTarget.value;
|
|
22271
|
-
const key = firstTarget.key + '_' + n.type;
|
|
22272
|
-
const activeLink = Object.assign(Object.assign({}, firstTarget), { y0: firstTarget.y0 - firstTarget.thickness / 2 + (percent + p / 2) * firstTarget.thickness, y1: n.y0 + (p * firstTarget.thickness) / 2, thickness: p * firstTarget.thickness, key, type: n.type, [vchart.DEFAULT_DATA_INDEX]: highlightLinksData.length, [vchart.DEFAULT_DATA_KEY]: key });
|
|
22273
|
-
highlightLinksData.push(activeLink);
|
|
22274
|
-
percent += p;
|
|
22275
|
-
}
|
|
22276
|
-
});
|
|
22277
|
-
highlightNodeKeys.push(...firstTarget.parents, nodeDatum.key);
|
|
22278
|
-
const linkKeys = [];
|
|
22279
|
-
for (let i = 0; i < firstTarget.parents.length - 1; i++) {
|
|
22280
|
-
linkKeys.push(firstTarget.parents[i] + '-' + firstTarget.parents[i + 1]);
|
|
22281
|
-
}
|
|
22282
|
-
this._highLightElements(allLinkElements, linkKeys);
|
|
22283
|
-
}
|
|
22284
|
-
_activeSourceLink(nodeDatum, pickNodeDatums, allNodeDatums, allNodeElements, highlightNodeKeys, highlightLinksData) {
|
|
22285
|
-
this._handleClearEmpty();
|
|
22286
|
-
const sourceNode = nodeDatum.sourceNode;
|
|
22287
|
-
const sourceLinks = sourceNode.sourceLinks;
|
|
22288
|
-
if (!(sourceLinks === null || sourceLinks === void 0 ? void 0 : sourceLinks.length)) {
|
|
22289
|
-
return;
|
|
22290
|
-
}
|
|
22291
|
-
const sourceValueTemp = {};
|
|
22292
|
-
sourceLinks.forEach((sourceLink) => {
|
|
22293
|
-
highlightNodeKeys.push(sourceLink.target);
|
|
22294
|
-
pickNodeDatums.forEach((n, index) => {
|
|
22295
|
-
var _a;
|
|
22296
|
-
sourceValueTemp[n.type] = (_a = sourceValueTemp[n.type]) !== null && _a !== void 0 ? _a : 0;
|
|
22297
|
-
const link = n.sourceLinks.find((l) => l.key === sourceLink.key);
|
|
22298
|
-
if (link) {
|
|
22299
|
-
const p = link.value / n.value;
|
|
22300
|
-
const totalSize = n.y1 - n.y0;
|
|
22301
|
-
const size = totalSize * p;
|
|
22302
|
-
const key = sourceLink.key + '_' + n.type;
|
|
22303
|
-
const activeLink = Object.assign(Object.assign({}, sourceLink), { y0: n.y0 + sourceValueTemp[n.type] * totalSize + size / 2, thickness: size, key, type: n.type, [vchart.DEFAULT_DATA_INDEX]: highlightLinksData.length, [vchart.DEFAULT_DATA_KEY]: key });
|
|
22304
|
-
if (index === 0) {
|
|
22305
|
-
activeLink.y1 = sourceLink.y1 - sourceLink.thickness / 2 + size / 2;
|
|
22306
|
-
}
|
|
22307
|
-
else {
|
|
22308
|
-
const targetNode = allNodeDatums.find(_n => _n.key === link.target && _n.type === n.type);
|
|
22309
|
-
if (targetNode) {
|
|
22310
|
-
activeLink.y1 = targetNode.y0 + size / 2;
|
|
22311
|
-
}
|
|
22312
|
-
else {
|
|
22313
|
-
return;
|
|
22314
|
-
}
|
|
22315
|
-
}
|
|
22316
|
-
highlightLinksData.push(activeLink);
|
|
22317
|
-
sourceValueTemp[n.type] += p;
|
|
22318
|
-
}
|
|
22319
|
-
});
|
|
22320
|
-
});
|
|
22321
|
-
}
|
|
22322
|
-
_handleClearEmpty() {
|
|
22323
|
-
super._handleClearEmpty();
|
|
22324
|
-
this._activeLinkData.parseNewData([]);
|
|
22325
|
-
const allNodeElements = this._nodeMark.getGraphics();
|
|
22326
|
-
if (allNodeElements || !allNodeElements.length) {
|
|
22327
|
-
allNodeElements.forEach(el => {
|
|
22328
|
-
el.removeState(vchart.STATE_VALUE_ENUM.STATE_HOVER);
|
|
22329
|
-
});
|
|
22330
|
-
}
|
|
22331
|
-
const allLinkElements = this._linkMark.getGraphics();
|
|
22332
|
-
if (allLinkElements || !allLinkElements.length) {
|
|
22333
|
-
allLinkElements.forEach(el => {
|
|
22334
|
-
el.removeState(vchart.STATE_VALUE_ENUM.STATE_HOVER);
|
|
22335
|
-
});
|
|
22336
|
-
}
|
|
22337
|
-
}
|
|
22338
|
-
}
|
|
22339
|
-
const registerCompareSankeyChart = (option) => {
|
|
22340
|
-
vchart.registerMarkFilterTransform();
|
|
22341
|
-
const vchartConstructor = (option === null || option === void 0 ? void 0 : option.VChart) || vchart.VChart;
|
|
22342
|
-
if (vchartConstructor) {
|
|
22343
|
-
vchartConstructor.useChart([CompareSankeyChart]);
|
|
22344
|
-
vchartConstructor.useSeries([CompareSankeySeries]);
|
|
22345
|
-
}
|
|
22346
|
-
};
|
|
22347
|
-
|
|
22348
21977
|
const GROUP_ATTRIBUTES = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "visible", "clip", "pickable", "childrenPickable", "zIndex", "cursor"];
|
|
22349
21978
|
class AbstractComponent extends Group {
|
|
22350
21979
|
constructor(attributes, options) {
|
|
@@ -25415,8 +25044,6 @@
|
|
|
25415
25044
|
exports.Bar3dSeries = Bar3dSeries;
|
|
25416
25045
|
exports.Bar3dSeriesSpecTransformer = Bar3dSeriesSpecTransformer;
|
|
25417
25046
|
exports.BarLinkComponent = BarLinkComponent;
|
|
25418
|
-
exports.CompareSankeyChart = CompareSankeyChart;
|
|
25419
|
-
exports.CompareSankeySeries = CompareSankeySeries;
|
|
25420
25047
|
exports.ConversionFunnelChart = ConversionFunnelChart;
|
|
25421
25048
|
exports.ConversionFunnelSeries = ConversionFunnelSeries;
|
|
25422
25049
|
exports.DefaultBandWidth = DefaultBandWidth;
|
|
@@ -25461,7 +25088,6 @@
|
|
|
25461
25088
|
exports.registerBar3dChart = registerBar3dChart;
|
|
25462
25089
|
exports.registerBar3dSeries = registerBar3dSeries;
|
|
25463
25090
|
exports.registerBarLink = registerBarLink;
|
|
25464
|
-
exports.registerCompareSankeyChart = registerCompareSankeyChart;
|
|
25465
25091
|
exports.registerConversionFunnelChart = registerConversionFunnelChart;
|
|
25466
25092
|
exports.registerFunnel3dChart = registerFunnel3dChart;
|
|
25467
25093
|
exports.registerFunnel3dSeries = registerFunnel3dSeries;
|