Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
diff --git a/node_modules/echarts/lib/chart/line/helper.js b/node_modules/echarts/lib/chart/line/helper.js
index fa02e2f..176bfbc 100644
--- a/node_modules/echarts/lib/chart/line/helper.js
+++ b/node_modules/echarts/lib/chart/line/helper.js
@@ -108,16 +108,18 @@ function getValueStart(valueAxis, valueOrigin) {
return valueStart;
}
export function getStackedOnPoint(dataCoordInfo, coordSys, data, idx) {
- var value = NaN;
+ let stackedOverValue = NaN;
+ let stackResultValue = NaN;
if (dataCoordInfo.stacked) {
- value = data.get(data.getCalculationInfo('stackedOverDimension'), idx);
- }
- if (isNaN(value)) {
- value = dataCoordInfo.valueStart;
+ stackedOverValue = data.get(data.getCalculationInfo('stackedOverDimension'), idx);
+ stackResultValue = data.get(data.getCalculationInfo('stackResultDimension'), idx);
}
+ if (isNaN(stackedOverValue) && !(dataCoordInfo.stacked && isNaN(stackResultValue))) {
+ stackedOverValue = dataCoordInfo.valueStart;
+}
var baseDataOffset = dataCoordInfo.baseDataOffset;
var stackedData = [];
stackedData[baseDataOffset] = data.get(dataCoordInfo.baseDim, idx);
- stackedData[1 - baseDataOffset] = value;
+ stackedData[1 - baseDataOffset] = stackedOverValue;
return coordSys.dataToPoint(stackedData);
}
diff --git a/node_modules/echarts/lib/data/helper/dataStackHelper.js b/node_modules/echarts/lib/data/helper/dataStackHelper.js
index c25de1b..f94690e 100644
--- a/node_modules/echarts/lib/data/helper/dataStackHelper.js
+++ b/node_modules/echarts/lib/data/helper/dataStackHelper.js
@@ -83,6 +83,13 @@ export function enableDataStack(seriesModel, dimensionsInput, opt) {
var stackedDimInfo;
var stackResultDimension;
var stackedOverDimension;
+
+ var yCoordDimension = dimensionDefineList.find(
+ dimensionInfo => !isString(dimensionInfo) && dimensionInfo.coordDim === 'y'
+ );
+ var isYCoordDimensionStackable = yCoordDimension != null
+ && yCoordDimension.type !== 'ordinal' && yCoordDimension.type !== 'time';
+
each(dimensionDefineList, function (dimensionInfo, index) {
if (isString(dimensionInfo)) {
dimensionDefineList[index] = dimensionInfo = {
@@ -95,7 +102,10 @@ export function enableDataStack(seriesModel, dimensionsInput, opt) {
stackedByDimInfo = dimensionInfo;
}
// Find the first stackable dimension as the stackedDimInfo.
- if (!stackedDimInfo && dimensionInfo.type !== 'ordinal' && dimensionInfo.type !== 'time' && (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)) {
+ if (!stackedDimInfo && dimensionInfo.type !== 'ordinal'
+ && dimensionInfo.type !== 'time'
+ && (yCoordDimension == null || (dimensionInfo.coordDim !== 'x' && isYCoordDimensionStackable))
+ && (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)) {
stackedDimInfo = dimensionInfo;
}
}
@@ -105,6 +115,11 @@ export function enableDataStack(seriesModel, dimensionsInput, opt) {
// It may make sense if the user provides elaborately constructed data.
byIndex = true;
}
+ if (stackedDimInfo && !byIndex && !stackedByDimInfo) {
+ // Compatible with previous design, value axis (time axis) only stack by index.
+ // It may make sense if the user provides elaborately constructed data.
+ byIndex = true;
+ }
// Add stack dimension, they can be both calculated by coordinate system in `unionExtent`.
// That put stack logic in List is for using conveniently in echarts extensions, but it
// might not be a good way.