@visactor/vchart 1.9.4 → 1.9.5
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 +1 -1
- package/build/index.js +296 -187
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/utils.js +5 -5
- package/cjs/animation/utils.js.map +1 -1
- package/cjs/chart/base/base-chart-transformer.js +5 -6
- package/cjs/chart/base/base-chart-transformer.js.map +1 -1
- package/cjs/chart/base/base-chart.js +1 -1
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/base/util.d.ts +1 -1
- package/cjs/chart/base/util.js +20 -10
- package/cjs/chart/base/util.js.map +1 -1
- package/cjs/compile/compiler.js +5 -1
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/grammar-item.js +2 -1
- package/cjs/compile/mark/interface.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +6 -5
- package/cjs/component/axis/base-axis.js +24 -1
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +1 -5
- package/cjs/component/axis/cartesian/axis.js +7 -25
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/polar/axis.d.ts +1 -5
- package/cjs/component/axis/polar/axis.js +5 -23
- package/cjs/component/axis/polar/axis.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.js +2 -1
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/label/total-label.js +14 -1
- package/cjs/component/label/total-label.js.map +1 -1
- package/cjs/component/util.js +1 -2
- 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/data/transforms/waterfall.js +104 -29
- package/cjs/data/transforms/waterfall.js.map +1 -1
- package/cjs/interaction/interaction.d.ts +5 -0
- package/cjs/interaction/interaction.js +17 -1
- package/cjs/interaction/interaction.js.map +1 -1
- package/cjs/interaction/interface.d.ts +4 -1
- package/cjs/interaction/interface.js.map +1 -1
- package/cjs/series/bar/bar.js +3 -3
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +2 -0
- package/cjs/series/base/base-series.js +4 -1
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/interface/common.d.ts +1 -1
- package/cjs/series/interface/common.js.map +1 -1
- package/cjs/theme/builtin/common/series/box-plot.js +5 -0
- package/cjs/theme/builtin/common/series/box-plot.js.map +1 -1
- package/cjs/theme/builtin/common/series/rangeColumn.js +1 -0
- package/cjs/theme/builtin/common/series/rangeColumn.js.map +1 -1
- package/cjs/theme/builtin/common/series/waterfall.js +4 -1
- package/cjs/theme/builtin/common/series/waterfall.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +2 -0
- package/cjs/typings/spec/common.js.map +1 -1
- package/esm/animation/utils.js +5 -5
- package/esm/animation/utils.js.map +1 -1
- package/esm/chart/base/base-chart-transformer.js +6 -6
- package/esm/chart/base/base-chart-transformer.js.map +1 -1
- package/esm/chart/base/base-chart.js +1 -1
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/base/util.d.ts +1 -1
- package/esm/chart/base/util.js +21 -9
- package/esm/chart/base/util.js.map +1 -1
- package/esm/compile/compiler.js +5 -1
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/grammar-item.js +2 -1
- package/esm/compile/mark/interface.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +6 -5
- package/esm/component/axis/base-axis.js +25 -0
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +1 -5
- package/esm/component/axis/cartesian/axis.js +5 -23
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/polar/axis.d.ts +1 -5
- package/esm/component/axis/polar/axis.js +5 -23
- package/esm/component/axis/polar/axis.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.js +2 -1
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/label/total-label.js +14 -1
- package/esm/component/label/total-label.js.map +1 -1
- package/esm/component/util.js +1 -2
- 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/data/transforms/waterfall.js +104 -28
- package/esm/data/transforms/waterfall.js.map +1 -1
- package/esm/interaction/interaction.d.ts +5 -0
- package/esm/interaction/interaction.js +17 -1
- package/esm/interaction/interaction.js.map +1 -1
- package/esm/interaction/interface.d.ts +4 -1
- package/esm/interaction/interface.js.map +1 -1
- package/esm/series/bar/bar.js +2 -2
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +2 -0
- package/esm/series/base/base-series.js +4 -1
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/interface/common.d.ts +1 -1
- package/esm/series/interface/common.js.map +1 -1
- package/esm/theme/builtin/common/series/box-plot.js +5 -0
- package/esm/theme/builtin/common/series/box-plot.js.map +1 -1
- package/esm/theme/builtin/common/series/rangeColumn.js +1 -0
- package/esm/theme/builtin/common/series/rangeColumn.js.map +1 -1
- package/esm/theme/builtin/common/series/waterfall.js +4 -1
- package/esm/theme/builtin/common/series/waterfall.js.map +1 -1
- package/esm/typings/spec/common.d.ts +2 -0
- package/esm/typings/spec/common.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -50860,7 +50860,10 @@
|
|
|
50860
50860
|
label: {
|
|
50861
50861
|
visible: false,
|
|
50862
50862
|
offset: 12,
|
|
50863
|
-
position: 'inside'
|
|
50863
|
+
position: 'inside',
|
|
50864
|
+
style: {
|
|
50865
|
+
lineWidth: 2
|
|
50866
|
+
}
|
|
50864
50867
|
}
|
|
50865
50868
|
};
|
|
50866
50869
|
|
|
@@ -50951,6 +50954,7 @@
|
|
|
50951
50954
|
offset: 5,
|
|
50952
50955
|
position: 'inside',
|
|
50953
50956
|
style: {
|
|
50957
|
+
lineWidth: 2,
|
|
50954
50958
|
fill: { type: 'palette', key: 'axisMarkerFontColor' }
|
|
50955
50959
|
},
|
|
50956
50960
|
minLabel: {
|
|
@@ -51026,6 +51030,11 @@
|
|
|
51026
51030
|
style: {
|
|
51027
51031
|
lineWidth: 1
|
|
51028
51032
|
}
|
|
51033
|
+
},
|
|
51034
|
+
label: {
|
|
51035
|
+
style: {
|
|
51036
|
+
lineWidth: 2
|
|
51037
|
+
}
|
|
51029
51038
|
}
|
|
51030
51039
|
};
|
|
51031
51040
|
|
|
@@ -54307,7 +54316,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
54307
54316
|
}
|
|
54308
54317
|
});
|
|
54309
54318
|
Object.keys(regionCombindInteractions).forEach(key => {
|
|
54310
|
-
this._view.interaction(regionCombindInteractions[key].type, regionCombindInteractions[key]);
|
|
54319
|
+
const interaction = this._view.interaction(regionCombindInteractions[key].type, regionCombindInteractions[key]);
|
|
54320
|
+
if (this._compileChart) {
|
|
54321
|
+
const region = this._compileChart.getRegionsInIds([regionCombindInteractions[key].regionId])[0];
|
|
54322
|
+
if (region) {
|
|
54323
|
+
region.interaction.addVgrammarInteraction(regionCombindInteractions[key].vchartState, interaction);
|
|
54324
|
+
}
|
|
54325
|
+
}
|
|
54311
54326
|
});
|
|
54312
54327
|
}
|
|
54313
54328
|
}
|
|
@@ -54958,8 +54973,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
54958
54973
|
constructor() {
|
|
54959
54974
|
this._stateMarks = new Map();
|
|
54960
54975
|
this._stateElements = new Map();
|
|
54976
|
+
this._vgrammarInteractions = new Map();
|
|
54961
54977
|
this._disableTriggerEvent = false;
|
|
54962
54978
|
}
|
|
54979
|
+
addVgrammarInteraction(state, i) {
|
|
54980
|
+
if (!this._vgrammarInteractions.get(state)) {
|
|
54981
|
+
!this._vgrammarInteractions.set(state, [i]);
|
|
54982
|
+
}
|
|
54983
|
+
else {
|
|
54984
|
+
this._vgrammarInteractions.get(state).push(i);
|
|
54985
|
+
}
|
|
54986
|
+
}
|
|
54963
54987
|
static markStateEnable(mark, state) {
|
|
54964
54988
|
return !isEmpty(mark.stateStyle[state]);
|
|
54965
54989
|
}
|
|
@@ -55091,6 +55115,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55091
55115
|
}
|
|
55092
55116
|
}
|
|
55093
55117
|
}
|
|
55118
|
+
startInteraction(stateValue, element) {
|
|
55119
|
+
const interactions = this._vgrammarInteractions.get(stateValue);
|
|
55120
|
+
if (interactions) {
|
|
55121
|
+
interactions.forEach(vgInteraction => {
|
|
55122
|
+
vgInteraction.start(element);
|
|
55123
|
+
});
|
|
55124
|
+
}
|
|
55125
|
+
}
|
|
55126
|
+
resetInteraction(stateValue, element) {
|
|
55127
|
+
const interactions = this._vgrammarInteractions.get(stateValue);
|
|
55128
|
+
if (interactions) {
|
|
55129
|
+
interactions.forEach(vgInteraction => {
|
|
55130
|
+
vgInteraction.reset(element);
|
|
55131
|
+
});
|
|
55132
|
+
}
|
|
55133
|
+
}
|
|
55094
55134
|
}
|
|
55095
55135
|
|
|
55096
55136
|
class CompilableBase {
|
|
@@ -59873,7 +59913,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
59873
59913
|
registerChartPlugin(MediaQuery);
|
|
59874
59914
|
};
|
|
59875
59915
|
|
|
59876
|
-
const version = "1.9.
|
|
59916
|
+
const version = "1.9.5";
|
|
59877
59917
|
|
|
59878
59918
|
const addVChartProperty = (data, op) => {
|
|
59879
59919
|
const context = op.beforeCall();
|
|
@@ -60333,19 +60373,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
60333
60373
|
function userAnimationConfig(markName, spec, ctx) {
|
|
60334
60374
|
var _a, _b, _c, _d, _e;
|
|
60335
60375
|
const userConfig = {};
|
|
60336
|
-
if (spec.animationAppear) {
|
|
60376
|
+
if (isValid$3(spec.animationAppear)) {
|
|
60337
60377
|
userConfig.appear = (_a = spec.animationAppear[markName]) !== null && _a !== void 0 ? _a : spec.animationAppear;
|
|
60338
60378
|
}
|
|
60339
|
-
if (spec.animationDisappear) {
|
|
60379
|
+
if (isValid$3(spec.animationDisappear)) {
|
|
60340
60380
|
userConfig.disappear = (_b = spec.animationDisappear[markName]) !== null && _b !== void 0 ? _b : spec.animationDisappear;
|
|
60341
60381
|
}
|
|
60342
|
-
if (spec.animationEnter) {
|
|
60382
|
+
if (isValid$3(spec.animationEnter)) {
|
|
60343
60383
|
userConfig.enter = (_c = spec.animationEnter[markName]) !== null && _c !== void 0 ? _c : spec.animationEnter;
|
|
60344
60384
|
}
|
|
60345
|
-
if (spec.animationExit) {
|
|
60385
|
+
if (isValid$3(spec.animationExit)) {
|
|
60346
60386
|
userConfig.exit = (_d = spec.animationExit[markName]) !== null && _d !== void 0 ? _d : spec.animationExit;
|
|
60347
60387
|
}
|
|
60348
|
-
if (spec.animationUpdate) {
|
|
60388
|
+
if (isValid$3(spec.animationUpdate)) {
|
|
60349
60389
|
userConfig.update = (_e = spec.animationUpdate[markName]) !== null && _e !== void 0 ? _e : spec.animationUpdate;
|
|
60350
60390
|
}
|
|
60351
60391
|
if (spec.animationNormal && spec.animationNormal[markName]) {
|
|
@@ -61002,7 +61042,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61002
61042
|
dataView: false,
|
|
61003
61043
|
customShape: spec === null || spec === void 0 ? void 0 : spec.customShape,
|
|
61004
61044
|
componentType: spec.componentType,
|
|
61005
|
-
depend: options.depend
|
|
61045
|
+
depend: options.depend,
|
|
61046
|
+
key: spec.dataKey
|
|
61006
61047
|
});
|
|
61007
61048
|
if (!mark) {
|
|
61008
61049
|
return;
|
|
@@ -61074,6 +61115,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61074
61115
|
const res = [];
|
|
61075
61116
|
if (finalHoverSpec.enable) {
|
|
61076
61117
|
res.push({
|
|
61118
|
+
vchartState: STATE_VALUE_ENUM.STATE_HOVER,
|
|
61077
61119
|
seriesId: this.id,
|
|
61078
61120
|
regionId: this._region.id,
|
|
61079
61121
|
selector: mainMarks.map(mark => `#${mark.getProductId()}`),
|
|
@@ -61086,6 +61128,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61086
61128
|
}
|
|
61087
61129
|
if (finalSelectSpec.enable) {
|
|
61088
61130
|
res.push({
|
|
61131
|
+
vchartState: STATE_VALUE_ENUM.STATE_SELECTED,
|
|
61089
61132
|
type: 'element-select',
|
|
61090
61133
|
seriesId: this.id,
|
|
61091
61134
|
regionId: this._region.id,
|
|
@@ -63744,7 +63787,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63744
63787
|
}
|
|
63745
63788
|
}
|
|
63746
63789
|
pickElements.forEach(element => {
|
|
63747
|
-
r.interaction.
|
|
63790
|
+
r.interaction.startInteraction(stateKey, element);
|
|
63748
63791
|
});
|
|
63749
63792
|
}
|
|
63750
63793
|
});
|
|
@@ -63816,28 +63859,32 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63816
63859
|
}
|
|
63817
63860
|
|
|
63818
63861
|
const getRelatedRegionInfo = (modelInfo, currentChartSpecInfo) => {
|
|
63819
|
-
var _a
|
|
63820
|
-
const
|
|
63862
|
+
var _a;
|
|
63863
|
+
const spec = modelInfo.spec;
|
|
63864
|
+
const { regionId, regionIndex } = spec;
|
|
63821
63865
|
if (isValid$3(regionId)) {
|
|
63822
|
-
|
|
63866
|
+
const regionIdList = array(regionId);
|
|
63867
|
+
return (_a = currentChartSpecInfo.region) === null || _a === void 0 ? void 0 : _a.filter(({ spec }) => regionIdList.includes(spec.id));
|
|
63823
63868
|
}
|
|
63824
63869
|
else if (isValid$3(regionIndex)) {
|
|
63825
|
-
return (
|
|
63870
|
+
return array(regionIndex)
|
|
63871
|
+
.map((index) => { var _a; return (_a = currentChartSpecInfo.region) === null || _a === void 0 ? void 0 : _a[index]; })
|
|
63872
|
+
.filter(isValid$3);
|
|
63826
63873
|
}
|
|
63827
63874
|
return undefined;
|
|
63828
63875
|
};
|
|
63829
63876
|
const getRelatedSeriesInfo = (modelInfo, currentChartSpecInfo) => {
|
|
63830
|
-
var _a
|
|
63831
|
-
|
|
63832
|
-
const {
|
|
63877
|
+
var _a;
|
|
63878
|
+
const spec = modelInfo.spec;
|
|
63879
|
+
const { seriesId, seriesIndex } = spec;
|
|
63833
63880
|
if (isValid$3(seriesId)) {
|
|
63834
|
-
|
|
63881
|
+
const seriesIdList = array(seriesId);
|
|
63882
|
+
return (_a = currentChartSpecInfo.series) === null || _a === void 0 ? void 0 : _a.filter(({ spec }) => seriesIdList.includes(spec.id));
|
|
63835
63883
|
}
|
|
63836
63884
|
else if (isValid$3(seriesIndex)) {
|
|
63837
|
-
|
|
63838
|
-
|
|
63839
|
-
|
|
63840
|
-
return [series];
|
|
63885
|
+
return array(seriesIndex)
|
|
63886
|
+
.map((index) => { var _a; return (_a = currentChartSpecInfo.series) === null || _a === void 0 ? void 0 : _a[index]; })
|
|
63887
|
+
.filter(isValid$3);
|
|
63841
63888
|
}
|
|
63842
63889
|
return undefined;
|
|
63843
63890
|
};
|
|
@@ -63893,7 +63940,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63893
63940
|
this.forEachSeriesInSpec(chartSpec, transform, currentChartSpecInfo);
|
|
63894
63941
|
(_a = currentChartSpecInfo.series) === null || _a === void 0 ? void 0 : _a.forEach((seriesSpecInfo, i) => {
|
|
63895
63942
|
var _a, _b;
|
|
63896
|
-
const
|
|
63943
|
+
const relatedRegion = (_b = (_a = getRelatedRegionInfo(seriesSpecInfo, currentChartSpecInfo)) !== null && _a !== void 0 ? _a : currentChartSpecInfo.region) !== null && _b !== void 0 ? _b : [];
|
|
63944
|
+
const region = relatedRegion[0];
|
|
63897
63945
|
if (region) {
|
|
63898
63946
|
if (!region.seriesIndexes) {
|
|
63899
63947
|
region.seriesIndexes = [];
|
|
@@ -63904,20 +63952,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63904
63952
|
});
|
|
63905
63953
|
this.forEachComponentInSpec(chartSpec, transform, currentChartSpecInfo);
|
|
63906
63954
|
Object.values((_b = currentChartSpecInfo.component) !== null && _b !== void 0 ? _b : {}).forEach(specInfoList => specInfoList.forEach((componentSpecInfo, i) => {
|
|
63907
|
-
var _a, _b;
|
|
63955
|
+
var _a, _b, _c;
|
|
63908
63956
|
if (!componentSpecInfo) {
|
|
63909
63957
|
return;
|
|
63910
63958
|
}
|
|
63911
63959
|
if (!componentSpecInfo.regionIndexes) {
|
|
63912
|
-
const relatedRegion = getRelatedRegionInfo(componentSpecInfo, currentChartSpecInfo);
|
|
63913
|
-
|
|
63914
|
-
componentSpecInfo.regionIndexes = regionList.map(region => region.regionIndexes[0]);
|
|
63960
|
+
const relatedRegion = (_b = (_a = getRelatedRegionInfo(componentSpecInfo, currentChartSpecInfo)) !== null && _a !== void 0 ? _a : currentChartSpecInfo.region) !== null && _b !== void 0 ? _b : [];
|
|
63961
|
+
componentSpecInfo.regionIndexes = relatedRegion.map(region => region.regionIndexes[0]);
|
|
63915
63962
|
}
|
|
63916
63963
|
if (!componentSpecInfo.seriesIndexes) {
|
|
63917
63964
|
const seriesInfo = getRelatedSeriesInfo(componentSpecInfo, currentChartSpecInfo);
|
|
63918
63965
|
if (!seriesInfo) {
|
|
63919
63966
|
const seriesIndexSet = new Set();
|
|
63920
|
-
((
|
|
63967
|
+
((_c = componentSpecInfo.regionIndexes) !== null && _c !== void 0 ? _c : []).forEach(regionIndex => {
|
|
63921
63968
|
var _a, _b;
|
|
63922
63969
|
const region = (_a = currentChartSpecInfo.region) === null || _a === void 0 ? void 0 : _a[regionIndex];
|
|
63923
63970
|
(_b = region === null || region === void 0 ? void 0 : region.seriesIndexes) === null || _b === void 0 ? void 0 : _b.forEach(seriesIndex => seriesIndexSet.add(seriesIndex));
|
|
@@ -65135,7 +65182,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
65135
65182
|
return width;
|
|
65136
65183
|
}
|
|
65137
65184
|
_getPosition(direction, datum, scaleDepth, mark) {
|
|
65138
|
-
var _a, _b, _c, _d, _e
|
|
65185
|
+
var _a, _b, _c, _d, _e;
|
|
65139
65186
|
let axisHelper;
|
|
65140
65187
|
let sizeAttribute;
|
|
65141
65188
|
let dataToPosition;
|
|
@@ -65167,9 +65214,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
65167
65214
|
let offSet = 0;
|
|
65168
65215
|
for (let index = groupFields.length - 1; index >= 1; index--) {
|
|
65169
65216
|
const groupField = groupFields[index];
|
|
65170
|
-
const groupValues = (
|
|
65217
|
+
const groupValues = (_d = (_c = axisHelper.getScale(index)) === null || _c === void 0 ? void 0 : _c.domain()) !== null && _d !== void 0 ? _d : [];
|
|
65171
65218
|
const groupCount = groupValues.length;
|
|
65172
|
-
const gap = getActualNumValue((
|
|
65219
|
+
const gap = getActualNumValue((_e = barInGroup[index - 1]) !== null && _e !== void 0 ? _e : last(barInGroup), bandWidth);
|
|
65173
65220
|
const i = groupValues.indexOf(datum[groupField]);
|
|
65174
65221
|
if (index === groupFields.length - 1) {
|
|
65175
65222
|
totalWidth += groupCount * size + (groupCount - 1) * gap;
|
|
@@ -67500,7 +67547,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67500
67547
|
if (!lastData || lastData.length === 0) {
|
|
67501
67548
|
return lastData;
|
|
67502
67549
|
}
|
|
67503
|
-
const { indexField,
|
|
67550
|
+
const { indexField, total: totalSpec, groupData } = op;
|
|
67504
67551
|
const totalData = [];
|
|
67505
67552
|
const { dimensionValues, dimensionData } = groupData().latestData;
|
|
67506
67553
|
const indexValues = Array.from(dimensionValues[indexField]);
|
|
@@ -67515,82 +67562,163 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
67515
67562
|
isTotal: false
|
|
67516
67563
|
};
|
|
67517
67564
|
const indexData = dimensionData[key];
|
|
67518
|
-
indexData.
|
|
67519
|
-
|
|
67520
|
-
|
|
67521
|
-
|
|
67522
|
-
|
|
67523
|
-
d[startAs] = total.start;
|
|
67524
|
-
d[endAs] = total.end;
|
|
67525
|
-
isTotalTag = true;
|
|
67526
|
-
}
|
|
67527
|
-
}
|
|
67528
|
-
else if (totalSpec.type === 'field' || totalSpec.type === 'custom') {
|
|
67529
|
-
const tag = d[totalSpec.tagField];
|
|
67530
|
-
if (tag) {
|
|
67531
|
-
isTotalTag = true;
|
|
67532
|
-
if (totalSpec.type === 'custom') {
|
|
67533
|
-
const { start, end } = totalSpec.product(d, temp);
|
|
67534
|
-
d[startAs] = start;
|
|
67535
|
-
d[endAs] = end;
|
|
67536
|
-
total.end = end;
|
|
67537
|
-
total.start = start;
|
|
67538
|
-
}
|
|
67539
|
-
else {
|
|
67540
|
-
let start = 0;
|
|
67541
|
-
let end = total.end;
|
|
67542
|
-
if (totalSpec.collectCountField && !isNil$3(d[totalSpec.collectCountField])) {
|
|
67543
|
-
const startIndex = totalData.length - +d[totalSpec.collectCountField];
|
|
67544
|
-
const endIndex = totalData.length - 1;
|
|
67545
|
-
if (startIndex < 0) {
|
|
67546
|
-
console.warn('total.collectCountField error');
|
|
67547
|
-
}
|
|
67548
|
-
else {
|
|
67549
|
-
start = totalData[startIndex].start;
|
|
67550
|
-
}
|
|
67551
|
-
if (endIndex < 0) {
|
|
67552
|
-
console.warn('total.collectCountField error');
|
|
67553
|
-
}
|
|
67554
|
-
else {
|
|
67555
|
-
end = totalData[endIndex].end;
|
|
67556
|
-
}
|
|
67557
|
-
}
|
|
67558
|
-
else {
|
|
67559
|
-
if (totalSpec.startField && !isNil$3(d[totalSpec.startField])) {
|
|
67560
|
-
start = +d[totalSpec.startField];
|
|
67561
|
-
}
|
|
67562
|
-
if (totalSpec.valueField && !isNil$3(d[totalSpec.valueField])) {
|
|
67563
|
-
end = precisionAdd(start, +d[totalSpec.valueField]);
|
|
67564
|
-
}
|
|
67565
|
-
}
|
|
67566
|
-
d[startAs] = start;
|
|
67567
|
-
d[endAs] = end;
|
|
67568
|
-
d[valueField] = end - start;
|
|
67569
|
-
total.start = start;
|
|
67570
|
-
total.end = end;
|
|
67565
|
+
if (indexData.length > 1) {
|
|
67566
|
+
const isTotalCheck = (d) => {
|
|
67567
|
+
if (!totalSpec || totalSpec.type === 'end') {
|
|
67568
|
+
if (index === indexValues.length - 1) {
|
|
67569
|
+
return true;
|
|
67571
67570
|
}
|
|
67572
67571
|
}
|
|
67573
|
-
|
|
67574
|
-
|
|
67575
|
-
|
|
67576
|
-
d[endAs] = precisionAdd(d[startAs], +d[valueField]);
|
|
67577
|
-
total.end = d[endAs];
|
|
67578
|
-
}
|
|
67579
|
-
total.isTotal = isTotalTag;
|
|
67580
|
-
if (isNil$3(seriesField) || seriesField === WaterfallDefaultSeriesField) {
|
|
67581
|
-
if (isTotalTag) {
|
|
67582
|
-
d[WaterfallDefaultSeriesField] = seriesFieldName.total;
|
|
67583
|
-
}
|
|
67584
|
-
else {
|
|
67585
|
-
d[WaterfallDefaultSeriesField] = +d[valueField] >= 0 ? seriesFieldName.increase : seriesFieldName.decrease;
|
|
67572
|
+
else if (totalSpec.type === 'field' || totalSpec.type === 'custom') {
|
|
67573
|
+
const tag = d[totalSpec.tagField];
|
|
67574
|
+
return !!tag;
|
|
67586
67575
|
}
|
|
67576
|
+
return false;
|
|
67577
|
+
};
|
|
67578
|
+
const isTotalTag = indexData.some(d => isTotalCheck(d));
|
|
67579
|
+
if (isTotalTag) {
|
|
67580
|
+
temp = computeTotalWithMultipleData(indexData, key, total, totalData, temp, indexValues, index, op, isTotalCheck);
|
|
67581
|
+
totalData.push(total);
|
|
67582
|
+
return;
|
|
67587
67583
|
}
|
|
67588
|
-
}
|
|
67589
|
-
temp =
|
|
67584
|
+
}
|
|
67585
|
+
temp = computeNormalData(indexData, key, total, totalData, temp, indexValues, index, op);
|
|
67590
67586
|
totalData.push(total);
|
|
67591
67587
|
});
|
|
67592
67588
|
return totalData;
|
|
67593
67589
|
};
|
|
67590
|
+
function computeTotalWithMultipleData(indexData, key, total, totalData, temp, indexValues, index, op, isTotalCheck) {
|
|
67591
|
+
total.isTotal = true;
|
|
67592
|
+
const { valueField, startAs, endAs, total: totalSpec } = op;
|
|
67593
|
+
const _normalTemp = [];
|
|
67594
|
+
const _totalTemp = [];
|
|
67595
|
+
indexData.forEach(d => {
|
|
67596
|
+
if (isTotalCheck(d)) {
|
|
67597
|
+
_totalTemp.push(d);
|
|
67598
|
+
}
|
|
67599
|
+
else {
|
|
67600
|
+
_normalTemp.push(d);
|
|
67601
|
+
}
|
|
67602
|
+
});
|
|
67603
|
+
if (_totalTemp.length === indexData.length) {
|
|
67604
|
+
const result = computeNormalData([indexData[0]], key, total, totalData, temp, indexValues, index, op);
|
|
67605
|
+
_totalTemp.forEach(d => {
|
|
67606
|
+
d[startAs] = indexData[0][startAs];
|
|
67607
|
+
d[endAs] = indexData[0][endAs];
|
|
67608
|
+
d[valueField] = indexData[0][valueField];
|
|
67609
|
+
});
|
|
67610
|
+
return result;
|
|
67611
|
+
}
|
|
67612
|
+
const totalConfigData = _totalTemp[0];
|
|
67613
|
+
let { start, end } = getTotalStartEnd(totalConfigData, total, totalData, temp, totalSpec);
|
|
67614
|
+
total.start = start;
|
|
67615
|
+
total.end = end;
|
|
67616
|
+
let valueTemp = end - start;
|
|
67617
|
+
_normalTemp.forEach(d => {
|
|
67618
|
+
d[startAs] = +start;
|
|
67619
|
+
d[endAs] = precisionAdd(d[startAs], +d[valueField]);
|
|
67620
|
+
start = d[endAs];
|
|
67621
|
+
valueTemp = precisionSub(valueTemp, +d[valueField]);
|
|
67622
|
+
});
|
|
67623
|
+
_totalTemp.forEach(d => {
|
|
67624
|
+
d[startAs] = +start;
|
|
67625
|
+
d[endAs] = precisionAdd(d[startAs], valueTemp);
|
|
67626
|
+
d[valueField] = valueTemp;
|
|
67627
|
+
});
|
|
67628
|
+
return Object.assign(Object.assign({}, total), { lastIndex: key });
|
|
67629
|
+
}
|
|
67630
|
+
function computeNormalData(indexData, key, total, totalData, temp, indexValues, index, op) {
|
|
67631
|
+
const { valueField, startAs, endAs, total: totalSpec, seriesField, seriesFieldName } = op;
|
|
67632
|
+
indexData.forEach(d => {
|
|
67633
|
+
let isTotalTag = false;
|
|
67634
|
+
if (!totalSpec || totalSpec.type === 'end') {
|
|
67635
|
+
if (index === indexValues.length - 1) {
|
|
67636
|
+
total.start = 0;
|
|
67637
|
+
d[startAs] = total.start;
|
|
67638
|
+
d[endAs] = total.end;
|
|
67639
|
+
isTotalTag = true;
|
|
67640
|
+
}
|
|
67641
|
+
}
|
|
67642
|
+
else if (totalSpec.type === 'field' || totalSpec.type === 'custom') {
|
|
67643
|
+
const tag = d[totalSpec.tagField];
|
|
67644
|
+
if (tag) {
|
|
67645
|
+
isTotalTag = true;
|
|
67646
|
+
const { start, end } = getTotalStartEnd(d, total, totalData, temp, totalSpec);
|
|
67647
|
+
d[startAs] = start;
|
|
67648
|
+
d[endAs] = end;
|
|
67649
|
+
d[valueField] = end - start;
|
|
67650
|
+
total.start = start;
|
|
67651
|
+
total.end = end;
|
|
67652
|
+
}
|
|
67653
|
+
}
|
|
67654
|
+
if (!isTotalTag) {
|
|
67655
|
+
d[startAs] = +total.end;
|
|
67656
|
+
d[endAs] = precisionAdd(d[startAs], +d[valueField]);
|
|
67657
|
+
total.end = d[endAs];
|
|
67658
|
+
}
|
|
67659
|
+
total.isTotal = isTotalTag;
|
|
67660
|
+
if (isNil$3(seriesField) || seriesField === WaterfallDefaultSeriesField) {
|
|
67661
|
+
if (isTotalTag) {
|
|
67662
|
+
d[WaterfallDefaultSeriesField] = seriesFieldName.total;
|
|
67663
|
+
}
|
|
67664
|
+
else {
|
|
67665
|
+
d[WaterfallDefaultSeriesField] = +d[valueField] >= 0 ? seriesFieldName.increase : seriesFieldName.decrease;
|
|
67666
|
+
}
|
|
67667
|
+
}
|
|
67668
|
+
});
|
|
67669
|
+
return Object.assign(Object.assign({}, total), { lastIndex: key });
|
|
67670
|
+
}
|
|
67671
|
+
function getTotalStartEnd(d, total, totalData, temp, totalSpec) {
|
|
67672
|
+
if (!totalSpec || totalSpec.type === 'end') {
|
|
67673
|
+
return getTotalInEndType(total);
|
|
67674
|
+
}
|
|
67675
|
+
else if (totalSpec.type === 'field' || totalSpec.type === 'custom') {
|
|
67676
|
+
if (totalSpec.type === 'custom') {
|
|
67677
|
+
return getTotalInCustomType(d, temp, totalSpec);
|
|
67678
|
+
}
|
|
67679
|
+
if (totalSpec.collectCountField && !isNil$3(d[totalSpec.collectCountField])) {
|
|
67680
|
+
return getTotalInCollectField(d, totalData, total, totalSpec);
|
|
67681
|
+
}
|
|
67682
|
+
return getTotalInField(d, total, totalSpec);
|
|
67683
|
+
}
|
|
67684
|
+
return { start: 0, end: 0 };
|
|
67685
|
+
}
|
|
67686
|
+
function getTotalInEndType(total) {
|
|
67687
|
+
return { start: 0, end: total.end };
|
|
67688
|
+
}
|
|
67689
|
+
function getTotalInCustomType(d, temp, totalSpec) {
|
|
67690
|
+
return totalSpec.product(d, temp);
|
|
67691
|
+
}
|
|
67692
|
+
function getTotalInCollectField(d, totalData, total, totalSpec) {
|
|
67693
|
+
let start = 0;
|
|
67694
|
+
let end = total.end;
|
|
67695
|
+
const startIndex = totalData.length - +d[totalSpec.collectCountField];
|
|
67696
|
+
const endIndex = totalData.length - 1;
|
|
67697
|
+
if (startIndex < 0) {
|
|
67698
|
+
warn('total.collectCountField error');
|
|
67699
|
+
}
|
|
67700
|
+
else {
|
|
67701
|
+
start = totalData[startIndex].start;
|
|
67702
|
+
}
|
|
67703
|
+
if (endIndex < 0) {
|
|
67704
|
+
warn('total.collectCountField error');
|
|
67705
|
+
}
|
|
67706
|
+
else {
|
|
67707
|
+
end = totalData[endIndex].end;
|
|
67708
|
+
}
|
|
67709
|
+
return { start, end };
|
|
67710
|
+
}
|
|
67711
|
+
function getTotalInField(d, total, totalSpec) {
|
|
67712
|
+
let start = 0;
|
|
67713
|
+
let end = total.end;
|
|
67714
|
+
if (totalSpec.startField && !isNil$3(d[totalSpec.startField])) {
|
|
67715
|
+
start = +d[totalSpec.startField];
|
|
67716
|
+
}
|
|
67717
|
+
if (totalSpec.valueField && !isNil$3(d[totalSpec.valueField])) {
|
|
67718
|
+
end = precisionAdd(start, +d[totalSpec.valueField]);
|
|
67719
|
+
}
|
|
67720
|
+
return { start, end };
|
|
67721
|
+
}
|
|
67594
67722
|
const waterfallFillTotal = (data, op) => {
|
|
67595
67723
|
if (!data) {
|
|
67596
67724
|
return data;
|
|
@@ -82099,6 +82227,38 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82099
82227
|
tickData.target.addListener('change', this._forceLayout.bind(this));
|
|
82100
82228
|
this._tickData = [new CompilableData(this._option, tickData)];
|
|
82101
82229
|
}
|
|
82230
|
+
collectData(depth, rawData) {
|
|
82231
|
+
const data = [];
|
|
82232
|
+
eachSeries(this._regions, s => {
|
|
82233
|
+
var _a;
|
|
82234
|
+
let field = this.collectSeriesField(depth, s);
|
|
82235
|
+
field = (isArray$3(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
|
|
82236
|
+
if (!depth) {
|
|
82237
|
+
this._dataFieldText = s.getFieldAlias(field[0]);
|
|
82238
|
+
}
|
|
82239
|
+
if (field) {
|
|
82240
|
+
const viewData = s.getViewData();
|
|
82241
|
+
if (rawData) {
|
|
82242
|
+
field.forEach(f => {
|
|
82243
|
+
data.push(s.getRawDataStatisticsByField(f, false));
|
|
82244
|
+
});
|
|
82245
|
+
}
|
|
82246
|
+
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
82247
|
+
const seriesData = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s);
|
|
82248
|
+
field.forEach(f => {
|
|
82249
|
+
var _a;
|
|
82250
|
+
if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
|
|
82251
|
+
data.push(seriesData.latestData[f]);
|
|
82252
|
+
}
|
|
82253
|
+
});
|
|
82254
|
+
}
|
|
82255
|
+
}
|
|
82256
|
+
}, {
|
|
82257
|
+
userId: this._seriesUserId,
|
|
82258
|
+
specIndex: this._seriesIndex
|
|
82259
|
+
});
|
|
82260
|
+
return data;
|
|
82261
|
+
}
|
|
82102
82262
|
isSeriesDataEnable() {
|
|
82103
82263
|
let enable = true;
|
|
82104
82264
|
eachSeries(this._regions, s => {
|
|
@@ -82821,55 +82981,24 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82821
82981
|
});
|
|
82822
82982
|
return scales;
|
|
82823
82983
|
}
|
|
82824
|
-
|
|
82825
|
-
|
|
82826
|
-
|
|
82827
|
-
|
|
82828
|
-
|
|
82829
|
-
|
|
82830
|
-
|
|
82831
|
-
|
|
82832
|
-
|
|
82833
|
-
if (isXAxis(this.getOrient())) {
|
|
82834
|
-
field = s.getSpec().x2Field
|
|
82835
|
-
? [...s.fieldX, s.fieldX2]
|
|
82836
|
-
: s.fieldX;
|
|
82837
|
-
}
|
|
82838
|
-
else if (isZAxis(this.getOrient())) {
|
|
82839
|
-
field = s.fieldZ;
|
|
82840
|
-
}
|
|
82841
|
-
else {
|
|
82842
|
-
field = s.getSpec().y2Field
|
|
82843
|
-
? [...s.fieldY, s.fieldY2]
|
|
82844
|
-
: s.fieldY;
|
|
82845
|
-
}
|
|
82984
|
+
collectSeriesField(depth, series) {
|
|
82985
|
+
var _a, _b;
|
|
82986
|
+
let field;
|
|
82987
|
+
if (depth > 0) {
|
|
82988
|
+
field = (_b = (_a = series.getGroups()) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b[depth];
|
|
82989
|
+
}
|
|
82990
|
+
else {
|
|
82991
|
+
if (isXAxis(this.getOrient())) {
|
|
82992
|
+
field = series.getSpec().x2Field ? [...series.fieldX, series.fieldX2] : series.fieldX;
|
|
82846
82993
|
}
|
|
82847
|
-
|
|
82848
|
-
|
|
82849
|
-
this._dataFieldText = s.getFieldAlias(field[0]);
|
|
82994
|
+
else if (isZAxis(this.getOrient())) {
|
|
82995
|
+
field = series.fieldZ;
|
|
82850
82996
|
}
|
|
82851
|
-
|
|
82852
|
-
|
|
82853
|
-
if (rawData) {
|
|
82854
|
-
field.forEach(f => {
|
|
82855
|
-
data.push(s.getRawDataStatisticsByField(f, false));
|
|
82856
|
-
});
|
|
82857
|
-
}
|
|
82858
|
-
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
82859
|
-
const seriesData = (_c = s.getViewDataStatistics) === null || _c === void 0 ? void 0 : _c.call(s);
|
|
82860
|
-
field.forEach(f => {
|
|
82861
|
-
var _a;
|
|
82862
|
-
if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
|
|
82863
|
-
data.push(seriesData.latestData[f]);
|
|
82864
|
-
}
|
|
82865
|
-
});
|
|
82866
|
-
}
|
|
82997
|
+
else {
|
|
82998
|
+
field = series.getSpec().y2Field ? [...series.fieldY, series.fieldY2] : series.fieldY;
|
|
82867
82999
|
}
|
|
82868
|
-
}
|
|
82869
|
-
|
|
82870
|
-
specIndex: this._seriesIndex
|
|
82871
|
-
});
|
|
82872
|
-
return data;
|
|
83000
|
+
}
|
|
83001
|
+
return field;
|
|
82873
83002
|
}
|
|
82874
83003
|
updateSeriesScale() {
|
|
82875
83004
|
const orient = this.getOrient();
|
|
@@ -84051,44 +84180,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84051
84180
|
this._scale.range(newRange);
|
|
84052
84181
|
return true;
|
|
84053
84182
|
}
|
|
84054
|
-
|
|
84055
|
-
|
|
84056
|
-
|
|
84057
|
-
|
|
84058
|
-
|
|
84059
|
-
|
|
84060
|
-
|
|
84061
|
-
|
|
84062
|
-
|
|
84063
|
-
|
|
84064
|
-
this.getOrient() === 'radius' ? s.getRadiusField() : s.getAngleField();
|
|
84065
|
-
}
|
|
84066
|
-
field = (isArray$3(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
|
|
84067
|
-
if (!depth) {
|
|
84068
|
-
this._dataFieldText = s.getFieldAlias(field[0]);
|
|
84069
|
-
}
|
|
84070
|
-
if (field) {
|
|
84071
|
-
const viewData = s.getViewData();
|
|
84072
|
-
if (rawData) {
|
|
84073
|
-
field.forEach(f => {
|
|
84074
|
-
data.push(s.getRawDataStatisticsByField(f, false));
|
|
84075
|
-
});
|
|
84076
|
-
}
|
|
84077
|
-
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
84078
|
-
const seriesData = (_c = s.getViewDataStatistics) === null || _c === void 0 ? void 0 : _c.call(s);
|
|
84079
|
-
field.forEach(f => {
|
|
84080
|
-
var _a;
|
|
84081
|
-
if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
|
|
84082
|
-
data.push(seriesData.latestData[f]);
|
|
84083
|
-
}
|
|
84084
|
-
});
|
|
84085
|
-
}
|
|
84086
|
-
}
|
|
84087
|
-
}, {
|
|
84088
|
-
userId: this._seriesUserId,
|
|
84089
|
-
specIndex: this._seriesIndex
|
|
84090
|
-
});
|
|
84091
|
-
return data;
|
|
84183
|
+
collectSeriesField(depth, series) {
|
|
84184
|
+
var _a, _b;
|
|
84185
|
+
let field;
|
|
84186
|
+
if (depth > 0) {
|
|
84187
|
+
field = (_b = (_a = series.getGroups()) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b[depth];
|
|
84188
|
+
}
|
|
84189
|
+
else {
|
|
84190
|
+
field = this.getOrient() === 'radius' ? series.getRadiusField() : series.getAngleField();
|
|
84191
|
+
}
|
|
84192
|
+
return field;
|
|
84092
84193
|
}
|
|
84093
84194
|
updateSeriesScale() {
|
|
84094
84195
|
eachSeries(this._regions, s => {
|
|
@@ -91202,12 +91303,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
91202
91303
|
TotalLabel.type = ComponentTypeEnum.totalLabel;
|
|
91203
91304
|
TotalLabel.specKey = 'totalLabel';
|
|
91204
91305
|
function totalLabelPosition(series, type) {
|
|
91306
|
+
var _a, _b;
|
|
91205
91307
|
let position;
|
|
91308
|
+
const { direction } = series;
|
|
91309
|
+
const isInverse = direction === 'horizontal'
|
|
91310
|
+
? (_a = series.getXAxisHelper()) === null || _a === void 0 ? void 0 : _a.isInverse()
|
|
91311
|
+
: (_b = series.getYAxisHelper()) === null || _b === void 0 ? void 0 : _b.isInverse();
|
|
91312
|
+
const positionMap = { vertical: ['top', 'bottom'], horizontal: ['right', 'left'] };
|
|
91313
|
+
const index = isInverse ? 1 : 0;
|
|
91206
91314
|
switch (type) {
|
|
91207
91315
|
case 'rect':
|
|
91208
|
-
position = series.direction === 'horizontal' ? 'right' : 'top';
|
|
91209
|
-
break;
|
|
91210
91316
|
case 'symbol':
|
|
91317
|
+
position = positionMap[direction][index];
|
|
91318
|
+
break;
|
|
91211
91319
|
default:
|
|
91212
91320
|
position = 'top';
|
|
91213
91321
|
}
|
|
@@ -91884,7 +91992,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
91884
91992
|
}, {
|
|
91885
91993
|
skipBeforeLayouted: true,
|
|
91886
91994
|
attributeContext: this._getMarkAttributeContext(),
|
|
91887
|
-
componentType: spec.componentType
|
|
91995
|
+
componentType: spec.componentType,
|
|
91996
|
+
key: spec.dataKey
|
|
91888
91997
|
});
|
|
91889
91998
|
if (!mark) {
|
|
91890
91999
|
return;
|