@visactor/vchart 2.0.7-alpha.2 → 2.0.7-alpha.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.es.js +1140 -564
- package/build/index.js +1140 -563
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/box-plot/box-plot.js +3 -2
- package/cjs/chart/box-plot/box-plot.js.map +1 -1
- package/cjs/chart/histogram/histogram.js +2 -2
- package/cjs/chart/histogram/histogram.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/interface.js +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/series/index.d.ts +2 -2
- package/cjs/series/index.js +6 -1
- package/cjs/series/index.js.map +1 -1
- package/esm/chart/box-plot/box-plot.js +4 -1
- package/esm/chart/box-plot/box-plot.js.map +1 -1
- package/esm/chart/histogram/histogram.js +4 -1
- package/esm/chart/histogram/histogram.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/interface.js +1 -1
- package/esm/core/util.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/series/index.d.ts +2 -2
- package/esm/series/index.js +2 -2
- package/esm/series/index.js.map +1 -1
- package/package.json +11 -11
package/build/index.js
CHANGED
|
@@ -1042,43 +1042,187 @@
|
|
|
1042
1042
|
return [min, max];
|
|
1043
1043
|
};
|
|
1044
1044
|
|
|
1045
|
+
function invNorm(p) {
|
|
1046
|
+
if (p <= 0 || p >= 1) return 0;
|
|
1047
|
+
const c1 = -.00778489400243029,
|
|
1048
|
+
c2 = -.322396458041136,
|
|
1049
|
+
c3 = -2.40075827716184,
|
|
1050
|
+
c4 = -2.54973253934373,
|
|
1051
|
+
c5 = 4.37466414146497,
|
|
1052
|
+
c6 = 2.93816398269878,
|
|
1053
|
+
d1 = .00778469570904146,
|
|
1054
|
+
d2 = .32246712907004,
|
|
1055
|
+
d3 = 2.445134137143,
|
|
1056
|
+
d4 = 3.75440866190742;
|
|
1057
|
+
let q, r;
|
|
1058
|
+
return p < .02425 ? (q = Math.sqrt(-2 * Math.log(p)), (((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1)) : p <= .97575 ? (q = p - .5, r = q * q, (((((-39.6968302866538 * r + 220.946098424521) * r - 275.928510446969) * r + 138.357751867269) * r - 30.6647980661472) * r + 2.50662827745924) * q / (((((-54.4760987982241 * r + 161.585836858041) * r - 155.698979859887) * r + 66.8013118877197) * r - 13.2806815528857) * r + 1)) : (q = Math.sqrt(-2 * Math.log(1 - p)), -(((((c1 * q + c2) * q + c3) * q + c4) * q + c5) * q + c6) / ((((d1 * q + d2) * q + d3) * q + d4) * q + 1));
|
|
1059
|
+
}
|
|
1060
|
+
function computeLinearCIComponents(data, x, y, predict) {
|
|
1061
|
+
let min = 1 / 0,
|
|
1062
|
+
max = -1 / 0,
|
|
1063
|
+
n = 0,
|
|
1064
|
+
sumX = 0;
|
|
1065
|
+
for (let i = 0; i < data.length; i++) {
|
|
1066
|
+
const d = data[i];
|
|
1067
|
+
let dx = x(d),
|
|
1068
|
+
dy = y(d);
|
|
1069
|
+
!isNil$1(dx) && (dx = +dx) >= dx && !isNil$1(dy) && (dy = +dy) >= dy && (dx < min && (min = dx), dx > max && (max = dx), n++, sumX += dx);
|
|
1070
|
+
}
|
|
1071
|
+
if (0 === n) return {
|
|
1072
|
+
min: min,
|
|
1073
|
+
max: max,
|
|
1074
|
+
n: n,
|
|
1075
|
+
X: 0,
|
|
1076
|
+
SSE: 0,
|
|
1077
|
+
Sxx: 0
|
|
1078
|
+
};
|
|
1079
|
+
const X = sumX / n;
|
|
1080
|
+
let SSE = 0,
|
|
1081
|
+
Sxx = 0;
|
|
1082
|
+
for (let i = 0; i < data.length; i++) {
|
|
1083
|
+
const d = data[i];
|
|
1084
|
+
let dx = x(d),
|
|
1085
|
+
dy = y(d);
|
|
1086
|
+
if (!isNil$1(dx) && (dx = +dx) >= dx && !isNil$1(dy) && (dy = +dy) >= dy) {
|
|
1087
|
+
const r = dy - predict(dx);
|
|
1088
|
+
SSE += r * r;
|
|
1089
|
+
const dxc = dx - X;
|
|
1090
|
+
Sxx += dxc * dxc;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
return {
|
|
1094
|
+
min: min,
|
|
1095
|
+
max: max,
|
|
1096
|
+
n: n,
|
|
1097
|
+
X: X,
|
|
1098
|
+
SSE: SSE,
|
|
1099
|
+
Sxx: Sxx
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
function stdErrorsAt(px, comps) {
|
|
1103
|
+
const {
|
|
1104
|
+
n: n,
|
|
1105
|
+
X: X,
|
|
1106
|
+
Sxx: Sxx,
|
|
1107
|
+
SSE: SSE
|
|
1108
|
+
} = comps,
|
|
1109
|
+
s2 = n > 2 ? SSE / (n - 2) : 0;
|
|
1110
|
+
return {
|
|
1111
|
+
seMean: Sxx > 0 ? Math.sqrt(s2 * (1 / n + (px - X) * (px - X) / Sxx)) : Math.sqrt(s2 / n),
|
|
1112
|
+
sePred: Math.sqrt(s2 * (1 + 1 / n + (Sxx > 0 ? (px - X) * (px - X) / Sxx : 0)))
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1045
1116
|
function ordinaryLeastSquares(uX, uY, uXY, uX2) {
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1117
|
+
const denom = uX2 - uX * uX;
|
|
1118
|
+
if (Math.abs(denom) < Number.EPSILON) return {
|
|
1119
|
+
a: uY,
|
|
1120
|
+
b: 0
|
|
1121
|
+
};
|
|
1122
|
+
const b = (uXY - uX * uY) / denom;
|
|
1123
|
+
return {
|
|
1124
|
+
a: uY - b * uX,
|
|
1125
|
+
b: b
|
|
1126
|
+
};
|
|
1049
1127
|
}
|
|
1050
1128
|
function visitPoints(data, x, y, callback) {
|
|
1051
|
-
let
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1129
|
+
for (let i = 0; i < data.length; i++) {
|
|
1130
|
+
const d = data[i];
|
|
1131
|
+
let xi = x(d),
|
|
1132
|
+
yi = y(d);
|
|
1133
|
+
!isNil$1(xi) && (xi = +xi) >= xi && !isNil$1(yi) && (yi = +yi) >= yi && callback(xi, yi, i);
|
|
1134
|
+
}
|
|
1057
1135
|
}
|
|
1058
1136
|
function rSquared(data, x, y, uY, predict) {
|
|
1059
|
-
let
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1137
|
+
let ssr = 0,
|
|
1138
|
+
sst = 0;
|
|
1139
|
+
for (let i = 0; i < data.length; i++) {
|
|
1140
|
+
const d = data[i];
|
|
1141
|
+
let yi = y(d);
|
|
1142
|
+
if (!isNil$1(yi) && (yi = +yi) >= yi) {
|
|
1143
|
+
const r = yi - predict(x(d));
|
|
1144
|
+
ssr += r * r;
|
|
1145
|
+
const t = yi - uY;
|
|
1146
|
+
sst += t * t;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
return 0 === sst ? 0 : 1 - ssr / sst;
|
|
1150
|
+
}
|
|
1151
|
+
function regressionLinear(data, x = d => d.x, y = d => d.y) {
|
|
1152
|
+
let n = 0,
|
|
1153
|
+
meanX = 0,
|
|
1154
|
+
meanY = 0,
|
|
1155
|
+
meanXY = 0,
|
|
1156
|
+
meanX2 = 0;
|
|
1157
|
+
visitPoints(data, x, y, (xi, yi) => {
|
|
1158
|
+
n++, meanX += (xi - meanX) / n, meanY += (yi - meanY) / n, meanXY += (xi * yi - meanXY) / n, meanX2 += (xi * xi - meanX2) / n;
|
|
1075
1159
|
});
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1160
|
+
const {
|
|
1161
|
+
a: a,
|
|
1162
|
+
b: b
|
|
1163
|
+
} = ordinaryLeastSquares(meanX, meanY, meanXY, meanX2),
|
|
1164
|
+
predict = xx => a + b * xx,
|
|
1165
|
+
comps = computeLinearCIComponents(data, x, y, predict);
|
|
1078
1166
|
return {
|
|
1079
|
-
coef:
|
|
1167
|
+
coef: {
|
|
1168
|
+
a: a,
|
|
1169
|
+
b: b
|
|
1170
|
+
},
|
|
1080
1171
|
predict: predict,
|
|
1081
|
-
rSquared: rSquared(data, x, y,
|
|
1172
|
+
rSquared: rSquared(data, x, y, meanY, predict),
|
|
1173
|
+
evaluateGrid: function (N) {
|
|
1174
|
+
const out = [];
|
|
1175
|
+
if (0 === comps.n || N <= 0) return out;
|
|
1176
|
+
if (comps.min === comps.max) {
|
|
1177
|
+
for (let i = 0; i < N; i++) out.push({
|
|
1178
|
+
x: comps.min,
|
|
1179
|
+
y: predict(comps.min)
|
|
1180
|
+
});
|
|
1181
|
+
return out;
|
|
1182
|
+
}
|
|
1183
|
+
const step = (comps.max - comps.min) / (N - 1);
|
|
1184
|
+
for (let i = 0; i < N; i++) {
|
|
1185
|
+
const px = i === N - 1 ? comps.max : comps.min + step * i;
|
|
1186
|
+
out.push({
|
|
1187
|
+
x: px,
|
|
1188
|
+
y: predict(px)
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
return out;
|
|
1192
|
+
},
|
|
1193
|
+
confidenceInterval: function (N = 50, alpha = .05) {
|
|
1194
|
+
const out = [];
|
|
1195
|
+
if (0 === comps.n || N <= 0) return out;
|
|
1196
|
+
const z = invNorm(1 - alpha / 2);
|
|
1197
|
+
if (comps.min === comps.max) {
|
|
1198
|
+
const m = predict(comps.min),
|
|
1199
|
+
errs = stdErrorsAt(comps.min, comps);
|
|
1200
|
+
for (let i = 0; i < N; i++) out.push({
|
|
1201
|
+
x: comps.min,
|
|
1202
|
+
mean: m,
|
|
1203
|
+
lower: m - z * errs.seMean,
|
|
1204
|
+
upper: m + z * errs.seMean,
|
|
1205
|
+
predLower: m - z * errs.sePred,
|
|
1206
|
+
predUpper: m + z * errs.sePred
|
|
1207
|
+
});
|
|
1208
|
+
return out;
|
|
1209
|
+
}
|
|
1210
|
+
const step = (comps.max - comps.min) / (N - 1);
|
|
1211
|
+
for (let i = 0; i < N; i++) {
|
|
1212
|
+
const px = i === N - 1 ? comps.max : comps.min + step * i,
|
|
1213
|
+
m = predict(px),
|
|
1214
|
+
errs = stdErrorsAt(px, comps);
|
|
1215
|
+
out.push({
|
|
1216
|
+
x: px,
|
|
1217
|
+
mean: m,
|
|
1218
|
+
lower: m - z * errs.seMean,
|
|
1219
|
+
upper: m + z * errs.seMean,
|
|
1220
|
+
predLower: m - z * errs.sePred,
|
|
1221
|
+
predUpper: m + z * errs.sePred
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
return out;
|
|
1225
|
+
}
|
|
1082
1226
|
};
|
|
1083
1227
|
}
|
|
1084
1228
|
|
|
@@ -5974,6 +6118,140 @@
|
|
|
5974
6118
|
return 0;
|
|
5975
6119
|
}
|
|
5976
6120
|
|
|
6121
|
+
const bin = (data, options) => {
|
|
6122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6123
|
+
const field = null == options ? void 0 : options.field;
|
|
6124
|
+
if (!field) return [];
|
|
6125
|
+
const n = data.length;
|
|
6126
|
+
let thresholds,
|
|
6127
|
+
min = 1 / 0,
|
|
6128
|
+
max = -1 / 0;
|
|
6129
|
+
if (null == options ? void 0 : options.extent) min = options.extent[0], max = options.extent[1];else for (let i = 0; i < n; i++) {
|
|
6130
|
+
const v = data[i][field];
|
|
6131
|
+
if (isNil$1(v)) continue;
|
|
6132
|
+
const num = +v;
|
|
6133
|
+
Number.isFinite(num) && (num < min && (min = num), num > max && (max = num));
|
|
6134
|
+
}
|
|
6135
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || 0 === n) return [];
|
|
6136
|
+
if (options && options.thresholds && options.thresholds.length) thresholds = options.thresholds.slice(), thresholds.sort((a, b) => a - b);else if (options && "number" == typeof options.step && options.step > 0) {
|
|
6137
|
+
const stepSize = options.step;
|
|
6138
|
+
let startMin = min;
|
|
6139
|
+
for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin < max;) startMin += stepSize, thresholds.push(startMin);
|
|
6140
|
+
} else {
|
|
6141
|
+
const bins = (null == options ? void 0 : options.bins) && options.bins > 0 ? Math.floor(options.bins) : 10,
|
|
6142
|
+
stepSize = (max - min) / bins;
|
|
6143
|
+
thresholds = new Array(bins + 1);
|
|
6144
|
+
for (let i = 0; i <= bins; i++) thresholds[i] = i === bins ? max : min + stepSize * i;
|
|
6145
|
+
}
|
|
6146
|
+
const numBins = Math.max(0, thresholds.length - 1);
|
|
6147
|
+
if (0 === numBins) return [];
|
|
6148
|
+
const x0Name = null !== (_b = null === (_a = options.outputNames) || void 0 === _a ? void 0 : _a.x0) && void 0 !== _b ? _b : "x0",
|
|
6149
|
+
x1Name = null !== (_d = null === (_c = options.outputNames) || void 0 === _c ? void 0 : _c.x1) && void 0 !== _d ? _d : "x1",
|
|
6150
|
+
countName = null !== (_f = null === (_e = options.outputNames) || void 0 === _e ? void 0 : _e.count) && void 0 !== _f ? _f : "count",
|
|
6151
|
+
valuesName = null !== (_h = null === (_g = options.outputNames) || void 0 === _g ? void 0 : _g.values) && void 0 !== _h ? _h : "values",
|
|
6152
|
+
out = new Array(numBins);
|
|
6153
|
+
for (let i = 0; i < numBins; i++) out[i] = {
|
|
6154
|
+
[x0Name]: thresholds[i],
|
|
6155
|
+
[x1Name]: thresholds[i + 1],
|
|
6156
|
+
[countName]: 0
|
|
6157
|
+
}, (null == options ? void 0 : options.includeValues) && (out[i][valuesName] = []);
|
|
6158
|
+
for (let i = 0; i < n; i++) {
|
|
6159
|
+
const v = data[i][field];
|
|
6160
|
+
if (null == v) continue;
|
|
6161
|
+
const num = +v;
|
|
6162
|
+
if (Number.isFinite(num)) for (let j = 0; j < numBins; j++) {
|
|
6163
|
+
const left = out[j][x0Name],
|
|
6164
|
+
right = out[j][x1Name];
|
|
6165
|
+
if (num >= left && num < right || j === numBins - 1 && num <= right) {
|
|
6166
|
+
out[j][countName]++, options && options.includeValues && out[j][valuesName].push(data[i]);
|
|
6167
|
+
break;
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
return out;
|
|
6172
|
+
};
|
|
6173
|
+
|
|
6174
|
+
const boxplot = (data, options) => {
|
|
6175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
6176
|
+
const field = null == options ? void 0 : options.field;
|
|
6177
|
+
if (!field) return [];
|
|
6178
|
+
const groupField = null == options ? void 0 : options.groupField;
|
|
6179
|
+
let whiskers = null !== (_a = null == options ? void 0 : options.whiskers) && void 0 !== _a ? _a : 1.5;
|
|
6180
|
+
const includeValues = !!(null == options ? void 0 : options.includeValues),
|
|
6181
|
+
names = null !== (_b = null == options ? void 0 : options.outputNames) && void 0 !== _b ? _b : {},
|
|
6182
|
+
keyName = null !== (_c = names.key) && void 0 !== _c ? _c : isArray$1(groupField) ? null : null !== (_d = groupField) && void 0 !== _d ? _d : "key",
|
|
6183
|
+
countName = null !== (_e = names.count) && void 0 !== _e ? _e : "count",
|
|
6184
|
+
meanName = null !== (_f = names.mean) && void 0 !== _f ? _f : "mean",
|
|
6185
|
+
q1Name = null !== (_g = names.q1) && void 0 !== _g ? _g : "q1",
|
|
6186
|
+
medianName = null !== (_h = names.median) && void 0 !== _h ? _h : "median",
|
|
6187
|
+
q3Name = null !== (_j = names.q3) && void 0 !== _j ? _j : "q3",
|
|
6188
|
+
iqrName = null !== (_k = names.iqr) && void 0 !== _k ? _k : "iqr",
|
|
6189
|
+
minName = null !== (_l = names.min) && void 0 !== _l ? _l : "min",
|
|
6190
|
+
maxName = null !== (_m = names.max) && void 0 !== _m ? _m : "max",
|
|
6191
|
+
lowerWhiskerName = null !== (_o = names.lowerWhisker) && void 0 !== _o ? _o : "lowerWhisker",
|
|
6192
|
+
upperWhiskerName = null !== (_p = names.upperWhisker) && void 0 !== _p ? _p : "upperWhisker",
|
|
6193
|
+
outliersName = null !== (_q = names.outliers) && void 0 !== _q ? _q : "outliers",
|
|
6194
|
+
valuesName = null !== (_r = names.values) && void 0 !== _r ? _r : "values",
|
|
6195
|
+
groups = new Map(),
|
|
6196
|
+
rawValues = new Map(),
|
|
6197
|
+
keyToGroup = new Map(),
|
|
6198
|
+
n = data.length;
|
|
6199
|
+
for (let i = 0; i < n; i++) {
|
|
6200
|
+
const d = data[i],
|
|
6201
|
+
v = d[field];
|
|
6202
|
+
if (isNil$1(v)) continue;
|
|
6203
|
+
const num = +v;
|
|
6204
|
+
if (!Number.isFinite(num)) continue;
|
|
6205
|
+
let key;
|
|
6206
|
+
key = isArray$1(groupField) ? groupField.map(f => String(d[f])).join("||") : groupField ? String(d[groupField]) : "___all", groups.has(key) || (groups.set(key, []), includeValues && rawValues.set(key, []), isArray$1(groupField) ? keyToGroup.set(key, Object.fromEntries(groupField.map(f => [f, d[f]]))) : keyToGroup.set(key, groupField ? d[groupField] : null));
|
|
6207
|
+
const arr = groups.get(key);
|
|
6208
|
+
if (arr && arr.push(num), includeValues) {
|
|
6209
|
+
const rv = rawValues.get(key);
|
|
6210
|
+
rv && rv.push(d);
|
|
6211
|
+
}
|
|
6212
|
+
}
|
|
6213
|
+
if (isArray$1(whiskers)) {
|
|
6214
|
+
whiskers = [clamp$1(Math.min.apply(null, whiskers), 0, 1), clamp$1(Math.max.apply(null, whiskers), 0, 1)];
|
|
6215
|
+
}
|
|
6216
|
+
const out = [];
|
|
6217
|
+
for (const [key, vals] of groups) {
|
|
6218
|
+
if (!vals || 0 === vals.length) continue;
|
|
6219
|
+
const sorted = vals.slice().sort((a, b) => a - b),
|
|
6220
|
+
count = sorted.length,
|
|
6221
|
+
dataMin = sorted[0],
|
|
6222
|
+
dataMax = sorted[sorted.length - 1];
|
|
6223
|
+
let sum = 0;
|
|
6224
|
+
for (let i = 0; i < sorted.length; i++) sum += sorted[i];
|
|
6225
|
+
const mean = sum / count,
|
|
6226
|
+
q1 = quantileSorted(sorted, .25),
|
|
6227
|
+
median = quantileSorted(sorted, .5),
|
|
6228
|
+
q3 = quantileSorted(sorted, .75),
|
|
6229
|
+
iqr = q3 - q1,
|
|
6230
|
+
lowerBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[0]) : q1 - whiskers * iqr,
|
|
6231
|
+
upperBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[1]) : q3 + whiskers * iqr;
|
|
6232
|
+
let lowerWhisker = dataMin;
|
|
6233
|
+
for (let i = 0; i < sorted.length; i++) if (sorted[i] >= lowerBound) {
|
|
6234
|
+
lowerWhisker = sorted[i];
|
|
6235
|
+
break;
|
|
6236
|
+
}
|
|
6237
|
+
let upperWhisker = dataMax;
|
|
6238
|
+
for (let i = sorted.length - 1; i >= 0; i--) if (sorted[i] <= upperBound) {
|
|
6239
|
+
upperWhisker = sorted[i];
|
|
6240
|
+
break;
|
|
6241
|
+
}
|
|
6242
|
+
const outliers = [];
|
|
6243
|
+
for (let i = 0; i < sorted.length; i++) (sorted[i] < lowerWhisker || sorted[i] > upperWhisker) && outliers.push(sorted[i]);
|
|
6244
|
+
const obj = {},
|
|
6245
|
+
representative = keyToGroup.get(key);
|
|
6246
|
+
if (null !== keyName) obj[keyName] = representative;else if (isArray$1(groupField)) {
|
|
6247
|
+
const groupObj = representative || {};
|
|
6248
|
+
for (const f of groupField) obj[f] = groupObj[f];
|
|
6249
|
+
}
|
|
6250
|
+
obj[countName] = count, obj[meanName] = mean, obj[q1Name] = q1, obj[medianName] = median, obj[q3Name] = q3, obj[iqrName] = iqr, obj[minName] = dataMin, obj[maxName] = dataMax, obj[lowerWhiskerName] = lowerWhisker, obj[upperWhiskerName] = upperWhisker, obj[outliersName] = outliers, includeValues && (obj[valuesName] = rawValues.get(key) || []), out.push(obj);
|
|
6251
|
+
}
|
|
6252
|
+
return out;
|
|
6253
|
+
};
|
|
6254
|
+
|
|
5977
6255
|
var EOL = {},
|
|
5978
6256
|
EOF = {},
|
|
5979
6257
|
QUOTE = 34,
|
|
@@ -38702,7 +38980,9 @@
|
|
|
38702
38980
|
space = bandSpace(n, this._paddingInner, this._paddingOuter);
|
|
38703
38981
|
return this._step = (stop - start) / Math.max(1, space || 1), this._round && (this._step = Math.floor(this._step)), start += (stop - start - this._step * (n - this._paddingInner)) * this._align, this.isBandwidthFixed() || (this._bandwidth = this._step * (1 - this._paddingInner)), this._round && (start = Math.round(start), this.isBandwidthFixed() || (this._bandwidth = Math.round(this._bandwidth))), this._bandRangeState = {
|
|
38704
38982
|
reverse: reverse,
|
|
38705
|
-
start: reverse ? start + this._step * (n - 1) : start,
|
|
38983
|
+
start: reverse ? clamp$1(start + this._step * (n - 1), wholeRange[1], wholeRange[0]) : clamp$1(start, wholeRange[0], wholeRange[1]),
|
|
38984
|
+
min: reverse ? wholeRange[1] : wholeRange[0],
|
|
38985
|
+
max: stop,
|
|
38706
38986
|
count: n
|
|
38707
38987
|
}, this.generateFishEyeTransform(), this;
|
|
38708
38988
|
}
|
|
@@ -38719,10 +38999,12 @@
|
|
|
38719
38999
|
const {
|
|
38720
39000
|
count: count,
|
|
38721
39001
|
start: start,
|
|
38722
|
-
reverse: reverse
|
|
39002
|
+
reverse: reverse,
|
|
39003
|
+
min: min,
|
|
39004
|
+
max: max
|
|
38723
39005
|
} = this._bandRangeState,
|
|
38724
39006
|
output = start + (reverse ? -1 : 1) * ((i - 1) % count) * this._step;
|
|
38725
|
-
return this._fishEyeTransform ? this._fishEyeTransform(output) : output;
|
|
39007
|
+
return clamp$1(this._fishEyeTransform ? this._fishEyeTransform(output) : output, min, max);
|
|
38726
39008
|
}
|
|
38727
39009
|
_calculateWholeRange(range, changeProperty) {
|
|
38728
39010
|
if (this._wholeRange) return this._wholeRange;
|
|
@@ -42230,6 +42512,19 @@
|
|
|
42230
42512
|
}
|
|
42231
42513
|
mixin(CircleAxisGrid, CircleAxisMixin);
|
|
42232
42514
|
|
|
42515
|
+
var DataZoomActiveTag;
|
|
42516
|
+
!function (DataZoomActiveTag) {
|
|
42517
|
+
DataZoomActiveTag.startHandler = "startHandler", DataZoomActiveTag.endHandler = "endHandler", DataZoomActiveTag.middleHandler = "middleHandler", DataZoomActiveTag.background = "background";
|
|
42518
|
+
}(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
42519
|
+
var IDataZoomInteractiveEvent;
|
|
42520
|
+
!function (IDataZoomInteractiveEvent) {
|
|
42521
|
+
IDataZoomInteractiveEvent.stateUpdate = "stateUpdate", IDataZoomInteractiveEvent.maskUpdate = "maskUpdate", IDataZoomInteractiveEvent.dataZoomUpdate = "dataZoomUpdate";
|
|
42522
|
+
}(IDataZoomInteractiveEvent || (IDataZoomInteractiveEvent = {}));
|
|
42523
|
+
var IDataZoomEvent;
|
|
42524
|
+
!function (IDataZoomEvent) {
|
|
42525
|
+
IDataZoomEvent.dataZoomChange = "dataZoomChange";
|
|
42526
|
+
}(IDataZoomEvent || (IDataZoomEvent = {}));
|
|
42527
|
+
|
|
42233
42528
|
const DEFAULT_HANDLER_PATH = "M -0.0544 0.25 C -0.0742 0.25 -0.0901 0.234 -0.0901 0.2143 L -0.0901 -0.1786 C -0.0901 -0.1983 -0.0742 -0.2143 -0.0544 -0.2143 L -0.0187 -0.2143 L -0.0187 -0.5 L 0.017 -0.5 L 0.017 -0.2143 L 0.0527 -0.2143 C 0.0724 -0.2143 0.0884 -0.1983 0.0884 -0.1786 L 0.0884 0.2143 C 0.0884 0.234 0.0724 0.25 0.0527 0.25 L 0.017 0.25 L 0.017 0.5 L -0.0187 0.5 L -0.0187 0.25 L -0.0544 0.25 Z M -0.0187 -0.1429 L -0.0544 -0.1429 L -0.0544 0.1786 L -0.0187 0.1786 L -0.0187 -0.1429 Z M 0.0527 -0.1429 L 0.017 -0.1429 L 0.017 0.1786 L 0.0527 0.1786 L 0.0527 -0.1429 Z";
|
|
42234
42529
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
42235
42530
|
orient: "bottom",
|
|
@@ -42347,14 +42642,17 @@
|
|
|
42347
42642
|
}
|
|
42348
42643
|
};
|
|
42349
42644
|
|
|
42350
|
-
|
|
42351
|
-
|
|
42352
|
-
|
|
42353
|
-
|
|
42354
|
-
|
|
42355
|
-
|
|
42356
|
-
|
|
42357
|
-
|
|
42645
|
+
const isTextOverflow = (componentBoundsLike, textBounds, layout, isHorizontal) => {
|
|
42646
|
+
if (!textBounds) return !1;
|
|
42647
|
+
if (isHorizontal) {
|
|
42648
|
+
if ("start" === layout) {
|
|
42649
|
+
if (textBounds.x1 < componentBoundsLike.x1) return !0;
|
|
42650
|
+
} else if (textBounds.x2 > componentBoundsLike.x2) return !0;
|
|
42651
|
+
} else if ("start" === layout) {
|
|
42652
|
+
if (textBounds.y1 < componentBoundsLike.y1) return !0;
|
|
42653
|
+
} else if (textBounds.y2 > componentBoundsLike.y2) return !0;
|
|
42654
|
+
return !1;
|
|
42655
|
+
};
|
|
42358
42656
|
|
|
42359
42657
|
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
42360
42658
|
var t = {};
|
|
@@ -42365,176 +42663,96 @@
|
|
|
42365
42663
|
}
|
|
42366
42664
|
return t;
|
|
42367
42665
|
};
|
|
42368
|
-
|
|
42369
|
-
|
|
42370
|
-
|
|
42371
|
-
|
|
42372
|
-
|
|
42373
|
-
|
|
42374
|
-
|
|
42666
|
+
class DataZoomRenderer {
|
|
42667
|
+
get startHandlerMask() {
|
|
42668
|
+
return this._startHandlerMask;
|
|
42669
|
+
}
|
|
42670
|
+
get middleHandlerSymbol() {
|
|
42671
|
+
return this._middleHandlerSymbol;
|
|
42672
|
+
}
|
|
42673
|
+
get middleHandlerRect() {
|
|
42674
|
+
return this._middleHandlerRect;
|
|
42675
|
+
}
|
|
42676
|
+
get endHandlerMask() {
|
|
42677
|
+
return this._endHandlerMask;
|
|
42678
|
+
}
|
|
42679
|
+
get selectedBackground() {
|
|
42680
|
+
return this._selectedBackground;
|
|
42681
|
+
}
|
|
42682
|
+
get dragMask() {
|
|
42683
|
+
return this._dragMask;
|
|
42684
|
+
}
|
|
42685
|
+
get startText() {
|
|
42686
|
+
return this._startText;
|
|
42687
|
+
}
|
|
42688
|
+
get endText() {
|
|
42689
|
+
return this._endText;
|
|
42690
|
+
}
|
|
42691
|
+
get startValue() {
|
|
42692
|
+
return this._startValue;
|
|
42693
|
+
}
|
|
42694
|
+
get endValue() {
|
|
42695
|
+
return this._endValue;
|
|
42696
|
+
}
|
|
42697
|
+
set showText(showText) {
|
|
42698
|
+
this._showText = showText;
|
|
42699
|
+
}
|
|
42700
|
+
get background() {
|
|
42701
|
+
return this._background;
|
|
42702
|
+
}
|
|
42703
|
+
set previewData(previewData) {
|
|
42704
|
+
this._previewData = previewData;
|
|
42705
|
+
}
|
|
42706
|
+
get previewGroup() {
|
|
42707
|
+
return this._previewGroup;
|
|
42708
|
+
}
|
|
42709
|
+
get selectedPreviewGroup() {
|
|
42710
|
+
return this._selectedPreviewGroup;
|
|
42711
|
+
}
|
|
42712
|
+
set previewPointsX(previewPointsX) {
|
|
42713
|
+
this._previewPointsX = previewPointsX;
|
|
42714
|
+
}
|
|
42715
|
+
set previewPointsY(previewPointsY) {
|
|
42716
|
+
this._previewPointsY = previewPointsY;
|
|
42717
|
+
}
|
|
42718
|
+
set previewPointsX1(previewPointsX1) {
|
|
42719
|
+
this._previewPointsX1 = previewPointsX1;
|
|
42720
|
+
}
|
|
42721
|
+
set previewPointsY1(previewPointsY1) {
|
|
42722
|
+
this._previewPointsY1 = previewPointsY1;
|
|
42723
|
+
}
|
|
42724
|
+
set statePointToData(statePointToData) {
|
|
42725
|
+
this._statePointToData = statePointToData;
|
|
42726
|
+
}
|
|
42727
|
+
_initAttrs(props) {
|
|
42728
|
+
this.attribute = props.attribute, this._isHorizontal = "top" === this.attribute.orient || "bottom" === this.attribute.orient;
|
|
42375
42729
|
const {
|
|
42376
|
-
start: start,
|
|
42377
|
-
end: end,
|
|
42378
|
-
orient: orient,
|
|
42379
42730
|
previewData: previewData,
|
|
42380
42731
|
previewPointsX: previewPointsX,
|
|
42381
42732
|
previewPointsY: previewPointsY,
|
|
42382
42733
|
previewPointsX1: previewPointsX1,
|
|
42383
42734
|
previewPointsY1: previewPointsY1
|
|
42384
42735
|
} = this.attribute;
|
|
42385
|
-
|
|
42386
|
-
const {
|
|
42387
|
-
width: width,
|
|
42388
|
-
height: height
|
|
42389
|
-
} = this.getLayoutAttrFromConfig();
|
|
42390
|
-
this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient, this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y", this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData), isFunction$1(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction$1(previewPointsY) && (this._previewPointsY = previewPointsY), isFunction$1(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction$1(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
42736
|
+
previewData && (this._previewData = previewData), isFunction$1(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction$1(previewPointsY) && (this._previewPointsY = previewPointsY), isFunction$1(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction$1(previewPointsY1) && (this._previewPointsY1 = previewPointsY1), this._getState = props.getState, this._getLayoutAttrFromConfig = props.getLayoutAttrFromConfig, this._getContainer = props.getContainer;
|
|
42391
42737
|
}
|
|
42392
|
-
constructor(
|
|
42393
|
-
|
|
42394
|
-
startPos: {
|
|
42395
|
-
x: 0,
|
|
42396
|
-
y: 0
|
|
42397
|
-
},
|
|
42398
|
-
lastPos: {
|
|
42399
|
-
x: 0,
|
|
42400
|
-
y: 0
|
|
42401
|
-
}
|
|
42402
|
-
}, this._layoutCache = {
|
|
42403
|
-
attPos: "x",
|
|
42404
|
-
attSize: "width",
|
|
42405
|
-
max: 0
|
|
42406
|
-
}, this.state = {
|
|
42407
|
-
start: 0,
|
|
42408
|
-
end: 1
|
|
42409
|
-
}, this._statePointToData = state => state, this._handleTouchMove = e => {
|
|
42410
|
-
this._activeState && e.preventDefault();
|
|
42411
|
-
}, this._onHandlerPointerDown = (e, tag) => {
|
|
42412
|
-
this._clearDragEvents(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler, this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler, this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background, this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e), this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
42413
|
-
const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
|
|
42414
|
-
triggers = getEndTriggersOfDrag();
|
|
42415
|
-
evtTarget.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
42416
|
-
capture: !0
|
|
42417
|
-
}), this.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
42418
|
-
capture: !0
|
|
42419
|
-
}), triggers.forEach(trigger => {
|
|
42420
|
-
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
42421
|
-
});
|
|
42422
|
-
}, this._pointerMove = e => {
|
|
42423
|
-
const {
|
|
42424
|
-
start: startAttr,
|
|
42425
|
-
end: endAttr,
|
|
42426
|
-
brushSelect: brushSelect,
|
|
42427
|
-
realTime = !0
|
|
42428
|
-
} = this.attribute,
|
|
42429
|
-
pos = this.eventPosToStagePos(e),
|
|
42430
|
-
{
|
|
42431
|
-
attPos: attPos,
|
|
42432
|
-
max: max
|
|
42433
|
-
} = this._layoutCache,
|
|
42434
|
-
dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
42435
|
-
let {
|
|
42436
|
-
start: start,
|
|
42437
|
-
end: end
|
|
42438
|
-
} = this.state;
|
|
42439
|
-
this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0), realTime && this._dispatchEvent("change", {
|
|
42440
|
-
start: start,
|
|
42441
|
-
end: end,
|
|
42442
|
-
tag: this._activeTag
|
|
42443
|
-
}));
|
|
42444
|
-
}, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap$2[this.attribute.delayType](this._pointerMove, this.attribute.delayTime), this._onHandlerPointerUp = e => {
|
|
42445
|
-
const {
|
|
42446
|
-
start: start,
|
|
42447
|
-
end: end,
|
|
42448
|
-
brushSelect: brushSelect,
|
|
42449
|
-
realTime = !0
|
|
42450
|
-
} = this.attribute;
|
|
42451
|
-
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
42452
|
-
const pos = this.eventPosToStagePos(e);
|
|
42453
|
-
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
42454
|
-
}
|
|
42455
|
-
this._activeState = !1, brushSelect && this.renderDragMask(), this._dispatchEvent("change", {
|
|
42456
|
-
start: this.state.start,
|
|
42457
|
-
end: this.state.end,
|
|
42458
|
-
tag: this._activeTag
|
|
42459
|
-
}), this._clearDragEvents();
|
|
42460
|
-
};
|
|
42738
|
+
constructor(props) {
|
|
42739
|
+
this._previewData = [], this._statePointToData = state => state;
|
|
42461
42740
|
const {
|
|
42462
|
-
position: position,
|
|
42463
42741
|
showDetail: showDetail
|
|
42464
|
-
} =
|
|
42465
|
-
this.
|
|
42742
|
+
} = props.attribute;
|
|
42743
|
+
this._showText = "auto" !== showDetail && showDetail, this._initAttrs(props);
|
|
42466
42744
|
}
|
|
42467
|
-
setAttributes(
|
|
42468
|
-
|
|
42745
|
+
setAttributes(props) {
|
|
42746
|
+
this._initAttrs(props);
|
|
42469
42747
|
}
|
|
42470
|
-
|
|
42471
|
-
|
|
42748
|
+
renderDataZoom(onlyStateChange = !1) {
|
|
42749
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42472
42750
|
const {
|
|
42473
|
-
|
|
42751
|
+
backgroundChartStyle = {},
|
|
42752
|
+
selectedBackgroundChartStyle = {},
|
|
42474
42753
|
brushSelect: brushSelect
|
|
42475
42754
|
} = this.attribute;
|
|
42476
|
-
this.
|
|
42477
|
-
const selectedTag = brushSelect ? "background" : "middleRect";
|
|
42478
|
-
this._selectedBackground && this._selectedBackground.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), brushSelect && this._background && this._background.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter), this.addEventListener("pointerleave", this._onHandlerPointerLeave)), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
42479
|
-
passive: !1
|
|
42480
|
-
});
|
|
42481
|
-
}
|
|
42482
|
-
dragMaskSize() {
|
|
42483
|
-
const {
|
|
42484
|
-
position: position
|
|
42485
|
-
} = this.attribute,
|
|
42486
|
-
{
|
|
42487
|
-
attPos: attPos,
|
|
42488
|
-
max: max
|
|
42489
|
-
} = this._layoutCache;
|
|
42490
|
-
return this._activeCache.lastPos[attPos] - position[attPos] > max ? max + position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - position[attPos] < 0 ? position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - this._activeCache.startPos[attPos];
|
|
42491
|
-
}
|
|
42492
|
-
setStateAttr(start, end, shouldRender) {
|
|
42493
|
-
const {
|
|
42494
|
-
zoomLock = !1,
|
|
42495
|
-
minSpan = 0,
|
|
42496
|
-
maxSpan = 1
|
|
42497
|
-
} = this.attribute,
|
|
42498
|
-
span = end - start;
|
|
42499
|
-
span !== this._spanCache && (zoomLock || span < minSpan || span > maxSpan) || (this._spanCache = span, this.state.start = start, this.state.end = end, shouldRender && this.setAttributes({
|
|
42500
|
-
start: start,
|
|
42501
|
-
end: end
|
|
42502
|
-
}));
|
|
42503
|
-
}
|
|
42504
|
-
_clearDragEvents() {
|
|
42505
|
-
const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
|
|
42506
|
-
triggers = getEndTriggersOfDrag();
|
|
42507
|
-
evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
42508
|
-
capture: !0
|
|
42509
|
-
}), triggers.forEach(trigger => {
|
|
42510
|
-
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
42511
|
-
}), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
42512
|
-
capture: !0
|
|
42513
|
-
});
|
|
42514
|
-
}
|
|
42515
|
-
_onHandlerPointerEnter(e) {
|
|
42516
|
-
this._showText = !0, this.renderText();
|
|
42517
|
-
}
|
|
42518
|
-
_onHandlerPointerLeave(e) {
|
|
42519
|
-
this._showText = !1, this.renderText();
|
|
42520
|
-
}
|
|
42521
|
-
backgroundDragZoom(startPos, endPos) {
|
|
42522
|
-
const {
|
|
42523
|
-
attPos: attPos,
|
|
42524
|
-
max: max
|
|
42525
|
-
} = this._layoutCache,
|
|
42526
|
-
{
|
|
42527
|
-
position: position
|
|
42528
|
-
} = this.attribute,
|
|
42529
|
-
startPosInComponent = startPos[attPos] - position[attPos],
|
|
42530
|
-
endPosInComponent = endPos[attPos] - position[attPos],
|
|
42531
|
-
start = Math.min(Math.max(Math.min(startPosInComponent, endPosInComponent) / max, 0), 1),
|
|
42532
|
-
end = Math.min(Math.max(Math.max(startPosInComponent, endPosInComponent) / max, 0), 1);
|
|
42533
|
-
Math.abs(start - end) < .01 ? this.moveZoomWithMiddle(start) : this.setStateAttr(start, end, !1);
|
|
42534
|
-
}
|
|
42535
|
-
moveZoomWithMiddle(middle) {
|
|
42536
|
-
let offset = middle - (this.state.start + this.state.end) / 2;
|
|
42537
|
-
0 !== offset && (offset > 0 ? this.state.end + offset > 1 && (offset = 1 - this.state.end) : offset < 0 && this.state.start + offset < 0 && (offset = -this.state.start), this.setStateAttr(this.state.start + offset, this.state.end + offset, !1));
|
|
42755
|
+
this._renderBackground(), (null === (_a = backgroundChartStyle.line) || void 0 === _a ? void 0 : _a.visible) && !onlyStateChange && this._setPreviewAttributes("line", this._getContainer()), (null === (_b = backgroundChartStyle.area) || void 0 === _b ? void 0 : _b.visible) && !onlyStateChange && this._setPreviewAttributes("area", this._getContainer()), brushSelect && this.renderDragMask(), this._renderSelectedBackground(), (null === (_c = selectedBackgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this._setSelectedPreviewClipAttributes("line", this._getContainer()), (null === (_d = selectedBackgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && !onlyStateChange && this._setSelectedPreviewAttributes("line"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this._setSelectedPreviewClipAttributes("area", this._getContainer()), (null === (_f = selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && !onlyStateChange && this._setSelectedPreviewAttributes("area"), this._renderHandler(), this._showText && this.renderText();
|
|
42538
42756
|
}
|
|
42539
42757
|
renderDragMask() {
|
|
42540
42758
|
const {
|
|
@@ -42544,254 +42762,104 @@
|
|
|
42544
42762
|
position: position,
|
|
42545
42763
|
width: width,
|
|
42546
42764
|
height: height
|
|
42547
|
-
} = this.
|
|
42548
|
-
|
|
42549
|
-
|
|
42765
|
+
} = this._getLayoutAttrFromConfig(),
|
|
42766
|
+
{
|
|
42767
|
+
start: start,
|
|
42768
|
+
end: end
|
|
42769
|
+
} = this._getState();
|
|
42770
|
+
return this._isHorizontal ? this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
|
|
42771
|
+
x: position.x + start * width,
|
|
42550
42772
|
y: position.y,
|
|
42551
|
-
width:
|
|
42773
|
+
width: (end - start) * width,
|
|
42552
42774
|
height: height
|
|
42553
|
-
}, dragMaskStyle), "rect") : this._dragMask = this.
|
|
42775
|
+
}, dragMaskStyle), "rect") : this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
|
|
42554
42776
|
x: position.x,
|
|
42555
|
-
y:
|
|
42777
|
+
y: position.y + start * height,
|
|
42556
42778
|
width: width,
|
|
42557
|
-
height:
|
|
42558
|
-
}, dragMaskStyle), "rect")
|
|
42559
|
-
|
|
42560
|
-
|
|
42561
|
-
|
|
42562
|
-
if (this._isHorizontal) {
|
|
42563
|
-
if ("start" === layout) {
|
|
42564
|
-
if (textBounds.x1 < componentBoundsLike.x1) return !0;
|
|
42565
|
-
} else if (textBounds.x2 > componentBoundsLike.x2) return !0;
|
|
42566
|
-
} else if ("start" === layout) {
|
|
42567
|
-
if (textBounds.y1 < componentBoundsLike.y1) return !0;
|
|
42568
|
-
} else if (textBounds.y2 > componentBoundsLike.y2) return !0;
|
|
42569
|
-
return !1;
|
|
42779
|
+
height: (end - start) * height
|
|
42780
|
+
}, dragMaskStyle), "rect"), {
|
|
42781
|
+
start: start,
|
|
42782
|
+
end: end
|
|
42783
|
+
};
|
|
42570
42784
|
}
|
|
42571
|
-
|
|
42572
|
-
var _a
|
|
42785
|
+
_renderBackground() {
|
|
42786
|
+
var _a;
|
|
42573
42787
|
const {
|
|
42574
|
-
|
|
42575
|
-
|
|
42788
|
+
backgroundStyle: backgroundStyle,
|
|
42789
|
+
brushSelect: brushSelect,
|
|
42790
|
+
zoomLock: zoomLock
|
|
42576
42791
|
} = this.attribute,
|
|
42577
42792
|
{
|
|
42578
|
-
formatMethod: startTextFormat
|
|
42579
|
-
} = startTextStyle,
|
|
42580
|
-
restStartTextStyle = __rest$1(startTextStyle, ["formatMethod"]),
|
|
42581
|
-
{
|
|
42582
|
-
formatMethod: endTextFormat
|
|
42583
|
-
} = endTextStyle,
|
|
42584
|
-
restEndTextStyle = __rest$1(endTextStyle, ["formatMethod"]),
|
|
42585
|
-
{
|
|
42586
|
-
start: start,
|
|
42587
|
-
end: end
|
|
42588
|
-
} = this.state;
|
|
42589
|
-
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
42590
|
-
const {
|
|
42591
42793
|
position: position,
|
|
42592
42794
|
width: width,
|
|
42593
42795
|
height: height
|
|
42594
|
-
} = this.
|
|
42595
|
-
|
|
42596
|
-
|
|
42597
|
-
componentBoundsLike = {
|
|
42598
|
-
x1: position.x,
|
|
42599
|
-
y1: position.y,
|
|
42600
|
-
x2: position.x + width,
|
|
42601
|
-
y2: position.y + height
|
|
42602
|
-
};
|
|
42603
|
-
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
42604
|
-
this._isHorizontal ? (startTextPosition = {
|
|
42605
|
-
x: position.x + start * width,
|
|
42606
|
-
y: position.y + height / 2
|
|
42607
|
-
}, endTextPosition = {
|
|
42608
|
-
x: position.x + end * width,
|
|
42609
|
-
y: position.y + height / 2
|
|
42610
|
-
}, startTextAlignStyle = {
|
|
42611
|
-
textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
|
|
42612
|
-
textBaseline: null !== (_b = null === (_a = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _a ? void 0 : _a.textBaseline) && void 0 !== _b ? _b : "middle"
|
|
42613
|
-
}, endTextAlignStyle = {
|
|
42614
|
-
textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
|
|
42615
|
-
textBaseline: null !== (_d = null === (_c = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _c ? void 0 : _c.textBaseline) && void 0 !== _d ? _d : "middle"
|
|
42616
|
-
}) : (startTextPosition = {
|
|
42617
|
-
x: position.x + width / 2,
|
|
42618
|
-
y: position.y + start * height
|
|
42619
|
-
}, endTextPosition = {
|
|
42620
|
-
x: position.x + width / 2,
|
|
42621
|
-
y: position.y + end * height
|
|
42622
|
-
}, startTextAlignStyle = {
|
|
42623
|
-
textAlign: null !== (_f = null === (_e = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _e ? void 0 : _e.textAlign) && void 0 !== _f ? _f : "center",
|
|
42624
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
|
|
42625
|
-
}, endTextAlignStyle = {
|
|
42626
|
-
textAlign: null !== (_h = null === (_g = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _g ? void 0 : _g.textAlign) && void 0 !== _h ? _h : "center",
|
|
42627
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
|
|
42628
|
-
}), this._startText = this.maybeAddLabel(this._container, merge$1({}, restStartTextStyle, {
|
|
42629
|
-
text: startTextValue,
|
|
42630
|
-
x: startTextPosition.x,
|
|
42631
|
-
y: startTextPosition.y,
|
|
42632
|
-
visible: this._showText,
|
|
42633
|
-
pickable: !1,
|
|
42634
|
-
childrenPickable: !1,
|
|
42635
|
-
textStyle: startTextAlignStyle
|
|
42636
|
-
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge$1({}, restEndTextStyle, {
|
|
42637
|
-
text: endTextValue,
|
|
42638
|
-
x: endTextPosition.x,
|
|
42639
|
-
y: endTextPosition.y,
|
|
42640
|
-
visible: this._showText,
|
|
42641
|
-
pickable: !1,
|
|
42642
|
-
childrenPickable: !1,
|
|
42643
|
-
textStyle: endTextAlignStyle
|
|
42644
|
-
}), `data-zoom-end-text-${position}`);
|
|
42645
|
-
}
|
|
42646
|
-
renderText() {
|
|
42647
|
-
let startTextBounds = null,
|
|
42648
|
-
endTextBounds = null;
|
|
42649
|
-
this.setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds, this.setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds;
|
|
42650
|
-
const {
|
|
42651
|
-
x1: x1,
|
|
42652
|
-
x2: x2,
|
|
42653
|
-
y1: y1,
|
|
42654
|
-
y2: y2
|
|
42655
|
-
} = startTextBounds,
|
|
42656
|
-
{
|
|
42657
|
-
dx: startTextDx = 0,
|
|
42658
|
-
dy: startTextDy = 0
|
|
42659
|
-
} = this.attribute.startTextStyle;
|
|
42660
|
-
if (new Bounds().set(x1, y1, x2, y2).intersects(endTextBounds)) {
|
|
42661
|
-
const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
|
|
42662
|
-
if (this._isHorizontal) {
|
|
42663
|
-
const boundsYDiff = Math.abs(endTextBounds.y1 - endTextBounds.y2);
|
|
42664
|
-
this._startText.setAttribute("dy", startTextDy + direction * (Number.isFinite(boundsYDiff) ? boundsYDiff : 0));
|
|
42665
|
-
} else {
|
|
42666
|
-
const boundsXDiff = Math.abs(endTextBounds.x1 - endTextBounds.x2);
|
|
42667
|
-
this._startText.setAttribute("dx", startTextDx + direction * (Number.isFinite(boundsXDiff) ? boundsXDiff : 0));
|
|
42668
|
-
}
|
|
42669
|
-
} else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
|
|
42670
|
-
}
|
|
42671
|
-
getLayoutAttrFromConfig() {
|
|
42672
|
-
var _a, _b, _c, _d, _e, _f;
|
|
42673
|
-
if (this._layoutAttrFromConfig) return this._layoutAttrFromConfig;
|
|
42674
|
-
const {
|
|
42675
|
-
position: positionConfig,
|
|
42676
|
-
size: size,
|
|
42677
|
-
orient: orient,
|
|
42678
|
-
middleHandlerStyle = {},
|
|
42679
|
-
startHandlerStyle = {},
|
|
42680
|
-
endHandlerStyle = {},
|
|
42681
|
-
backgroundStyle = {}
|
|
42682
|
-
} = this.attribute,
|
|
42683
|
-
{
|
|
42684
|
-
width: widthConfig,
|
|
42685
|
-
height: heightConfig
|
|
42686
|
-
} = size,
|
|
42687
|
-
middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
|
|
42688
|
-
let width, height, position;
|
|
42689
|
-
middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize, position = {
|
|
42690
|
-
x: positionConfig.x,
|
|
42691
|
-
y: positionConfig.y + middleHandlerSize
|
|
42692
|
-
}) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
|
|
42693
|
-
x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
|
|
42694
|
-
y: positionConfig.y
|
|
42695
|
-
}) : (width = widthConfig, height = heightConfig, position = positionConfig);
|
|
42696
|
-
const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width,
|
|
42697
|
-
endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
|
|
42698
|
-
return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
42699
|
-
x: position.x + startHandlerSize / 2,
|
|
42700
|
-
y: position.y
|
|
42701
|
-
}) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
42796
|
+
} = this._getLayoutAttrFromConfig(),
|
|
42797
|
+
group = this._getContainer();
|
|
42798
|
+
this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
|
|
42702
42799
|
x: position.x,
|
|
42703
|
-
y: position.y
|
|
42704
|
-
})), height += null !== (_e = backgroundStyle.lineWidth / 2) && void 0 !== _e ? _e : 1, width += null !== (_f = backgroundStyle.lineWidth / 2) && void 0 !== _f ? _f : 1, this._layoutAttrFromConfig = {
|
|
42705
|
-
position: position,
|
|
42800
|
+
y: position.y,
|
|
42706
42801
|
width: width,
|
|
42707
|
-
height: height
|
|
42708
|
-
|
|
42802
|
+
height: height,
|
|
42803
|
+
cursor: brushSelect ? "crosshair" : "auto"
|
|
42804
|
+
}, backgroundStyle), {
|
|
42805
|
+
pickable: !zoomLock && (null === (_a = backgroundStyle.pickable) || void 0 === _a || _a)
|
|
42806
|
+
}), "rect");
|
|
42709
42807
|
}
|
|
42710
|
-
|
|
42711
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2
|
|
42712
|
-
this._layoutAttrFromConfig = null;
|
|
42808
|
+
_renderHandler() {
|
|
42809
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
42713
42810
|
const {
|
|
42714
42811
|
orient: orient,
|
|
42715
|
-
backgroundStyle: backgroundStyle,
|
|
42716
|
-
backgroundChartStyle = {},
|
|
42717
|
-
selectedBackgroundStyle = {},
|
|
42718
|
-
selectedBackgroundChartStyle = {},
|
|
42719
42812
|
middleHandlerStyle = {},
|
|
42720
42813
|
startHandlerStyle = {},
|
|
42721
42814
|
endHandlerStyle = {},
|
|
42722
|
-
brushSelect: brushSelect,
|
|
42723
42815
|
zoomLock: zoomLock
|
|
42724
42816
|
} = this.attribute,
|
|
42725
42817
|
{
|
|
42726
42818
|
start: start,
|
|
42727
42819
|
end: end
|
|
42728
|
-
} = this.
|
|
42820
|
+
} = this._getState(),
|
|
42729
42821
|
{
|
|
42730
42822
|
position: position,
|
|
42731
42823
|
width: width,
|
|
42732
42824
|
height: height
|
|
42733
|
-
} = this.
|
|
42825
|
+
} = this._getLayoutAttrFromConfig(),
|
|
42734
42826
|
startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40,
|
|
42735
42827
|
endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40,
|
|
42736
|
-
group = this.
|
|
42737
|
-
if (this.
|
|
42738
|
-
x: position.x,
|
|
42739
|
-
y: position.y,
|
|
42740
|
-
width: width,
|
|
42741
|
-
height: height,
|
|
42742
|
-
cursor: brushSelect ? "crosshair" : "auto"
|
|
42743
|
-
}, backgroundStyle), {
|
|
42744
|
-
pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
|
|
42745
|
-
}), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group), (null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group), brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
42746
|
-
x: position.x + start * width,
|
|
42747
|
-
y: position.y,
|
|
42748
|
-
width: (end - start) * width,
|
|
42749
|
-
height: height,
|
|
42750
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
42751
|
-
}, selectedBackgroundStyle), {
|
|
42752
|
-
pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
|
|
42753
|
-
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
42754
|
-
x: position.x,
|
|
42755
|
-
y: position.y + start * height,
|
|
42756
|
-
width: width,
|
|
42757
|
-
height: (end - start) * height,
|
|
42758
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
42759
|
-
}, selectedBackgroundStyle), {
|
|
42760
|
-
pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
|
|
42761
|
-
}), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group), (null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group), this._isHorizontal) {
|
|
42828
|
+
group = this._getContainer();
|
|
42829
|
+
if (this._isHorizontal) {
|
|
42762
42830
|
if (middleHandlerStyle.visible) {
|
|
42763
|
-
const middleHandlerBackgroundSize = (null === (
|
|
42831
|
+
const middleHandlerBackgroundSize = (null === (_c = middleHandlerStyle.background) || void 0 === _c ? void 0 : _c.size) || 10;
|
|
42764
42832
|
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
42765
42833
|
x: position.x + start * width,
|
|
42766
42834
|
y: position.y - middleHandlerBackgroundSize,
|
|
42767
42835
|
width: (end - start) * width,
|
|
42768
42836
|
height: middleHandlerBackgroundSize
|
|
42769
|
-
}, null === (
|
|
42770
|
-
pickable: !zoomLock && (null === (
|
|
42837
|
+
}, null === (_d = middleHandlerStyle.background) || void 0 === _d ? void 0 : _d.style), {
|
|
42838
|
+
pickable: !zoomLock && (null === (_g = null === (_f = null === (_e = middleHandlerStyle.background) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.pickable) || void 0 === _g || _g)
|
|
42771
42839
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
42772
42840
|
x: position.x + (start + end) / 2 * width,
|
|
42773
42841
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
42774
42842
|
strokeBoundsBuffer: 0,
|
|
42775
42843
|
angle: 0,
|
|
42776
|
-
symbolType: null !== (
|
|
42844
|
+
symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square"
|
|
42777
42845
|
}, middleHandlerStyle.icon), {
|
|
42778
|
-
pickable: !zoomLock && (null === (
|
|
42846
|
+
pickable: !zoomLock && (null === (_k = middleHandlerStyle.icon.pickable) || void 0 === _k || _k)
|
|
42779
42847
|
}), "symbol");
|
|
42780
42848
|
}
|
|
42781
42849
|
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
42782
42850
|
x: position.x + start * width,
|
|
42783
42851
|
y: position.y + height / 2,
|
|
42784
42852
|
size: height,
|
|
42785
|
-
symbolType: null !== (
|
|
42853
|
+
symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
|
|
42786
42854
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
|
|
42787
|
-
pickable: !zoomLock && (null === (
|
|
42855
|
+
pickable: !zoomLock && (null === (_m = startHandlerStyle.pickable) || void 0 === _m || _m)
|
|
42788
42856
|
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
42789
42857
|
x: position.x + end * width,
|
|
42790
42858
|
y: position.y + height / 2,
|
|
42791
42859
|
size: height,
|
|
42792
|
-
symbolType: null !== (
|
|
42860
|
+
symbolType: null !== (_o = endHandlerStyle.symbolType) && void 0 !== _o ? _o : "square"
|
|
42793
42861
|
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
|
|
42794
|
-
pickable: !zoomLock && (null === (
|
|
42862
|
+
pickable: !zoomLock && (null === (_p = endHandlerStyle.pickable) || void 0 === _p || _p)
|
|
42795
42863
|
}), "symbol");
|
|
42796
42864
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
|
|
42797
42865
|
startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize),
|
|
@@ -42820,38 +42888,38 @@
|
|
|
42820
42888
|
}), "rect");
|
|
42821
42889
|
} else {
|
|
42822
42890
|
if (middleHandlerStyle.visible) {
|
|
42823
|
-
const middleHandlerBackgroundSize = (null === (
|
|
42891
|
+
const middleHandlerBackgroundSize = (null === (_q = middleHandlerStyle.background) || void 0 === _q ? void 0 : _q.size) || 10;
|
|
42824
42892
|
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
42825
42893
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
42826
42894
|
y: position.y + start * height,
|
|
42827
42895
|
width: middleHandlerBackgroundSize,
|
|
42828
42896
|
height: (end - start) * height
|
|
42829
|
-
}, null === (
|
|
42830
|
-
pickable: !zoomLock && (null === (
|
|
42897
|
+
}, null === (_r = middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), {
|
|
42898
|
+
pickable: !zoomLock && (null === (_u = null === (_t = null === (_s = middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.pickable) || void 0 === _u || _u)
|
|
42831
42899
|
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
42832
42900
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
42833
42901
|
y: position.y + (start + end) / 2 * height,
|
|
42834
42902
|
angle: Math.PI / 180 * 90,
|
|
42835
|
-
symbolType: null !== (
|
|
42903
|
+
symbolType: null !== (_w = null === (_v = middleHandlerStyle.icon) || void 0 === _v ? void 0 : _v.symbolType) && void 0 !== _w ? _w : "square",
|
|
42836
42904
|
strokeBoundsBuffer: 0
|
|
42837
42905
|
}, middleHandlerStyle.icon), {
|
|
42838
|
-
pickable: !zoomLock && (null === (
|
|
42906
|
+
pickable: !zoomLock && (null === (_y = null === (_x = middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.pickable) || void 0 === _y || _y)
|
|
42839
42907
|
}), "symbol");
|
|
42840
42908
|
}
|
|
42841
42909
|
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
42842
42910
|
x: position.x + width / 2,
|
|
42843
42911
|
y: position.y + start * height,
|
|
42844
42912
|
size: width,
|
|
42845
|
-
symbolType: null !== (
|
|
42913
|
+
symbolType: null !== (_z = startHandlerStyle.symbolType) && void 0 !== _z ? _z : "square"
|
|
42846
42914
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
42847
|
-
pickable: !zoomLock && (null === (
|
|
42915
|
+
pickable: !zoomLock && (null === (_0 = startHandlerStyle.pickable) || void 0 === _0 || _0)
|
|
42848
42916
|
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
42849
42917
|
x: position.x + width / 2,
|
|
42850
42918
|
y: position.y + end * height,
|
|
42851
42919
|
size: width,
|
|
42852
|
-
symbolType: null !== (
|
|
42920
|
+
symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square"
|
|
42853
42921
|
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
42854
|
-
pickable: !zoomLock && (null === (
|
|
42922
|
+
pickable: !zoomLock && (null === (_2 = endHandlerStyle.pickable) || void 0 === _2 || _2)
|
|
42855
42923
|
}), "symbol");
|
|
42856
42924
|
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
|
|
42857
42925
|
startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize),
|
|
@@ -42879,9 +42947,107 @@
|
|
|
42879
42947
|
pickable: !zoomLock
|
|
42880
42948
|
}), "rect");
|
|
42881
42949
|
}
|
|
42882
|
-
this._showText && this.renderText();
|
|
42883
42950
|
}
|
|
42884
|
-
|
|
42951
|
+
_renderSelectedBackground() {
|
|
42952
|
+
var _a, _b;
|
|
42953
|
+
const {
|
|
42954
|
+
selectedBackgroundStyle = {},
|
|
42955
|
+
selectedBackgroundChartStyle = {},
|
|
42956
|
+
brushSelect: brushSelect,
|
|
42957
|
+
zoomLock: zoomLock
|
|
42958
|
+
} = this.attribute,
|
|
42959
|
+
{
|
|
42960
|
+
start: start,
|
|
42961
|
+
end: end
|
|
42962
|
+
} = this._getState(),
|
|
42963
|
+
{
|
|
42964
|
+
position: position,
|
|
42965
|
+
width: width,
|
|
42966
|
+
height: height
|
|
42967
|
+
} = this._getLayoutAttrFromConfig(),
|
|
42968
|
+
group = this._getContainer();
|
|
42969
|
+
this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
42970
|
+
x: position.x + start * width,
|
|
42971
|
+
y: position.y,
|
|
42972
|
+
width: (end - start) * width,
|
|
42973
|
+
height: height,
|
|
42974
|
+
cursor: brushSelect ? "crosshair" : "move"
|
|
42975
|
+
}, selectedBackgroundStyle), {
|
|
42976
|
+
pickable: !zoomLock && (null === (_a = selectedBackgroundChartStyle.pickable) || void 0 === _a || _a)
|
|
42977
|
+
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
42978
|
+
x: position.x,
|
|
42979
|
+
y: position.y + start * height,
|
|
42980
|
+
width: width,
|
|
42981
|
+
height: (end - start) * height,
|
|
42982
|
+
cursor: brushSelect ? "crosshair" : "move"
|
|
42983
|
+
}, selectedBackgroundStyle), {
|
|
42984
|
+
pickable: !zoomLock && (null === (_b = selectedBackgroundStyle.pickable) || void 0 === _b || _b)
|
|
42985
|
+
}), "rect");
|
|
42986
|
+
}
|
|
42987
|
+
_setPreviewAttributes(type, group) {
|
|
42988
|
+
this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
|
|
42989
|
+
pickable: !1
|
|
42990
|
+
}, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
|
|
42991
|
+
curveType: "basis"
|
|
42992
|
+
}, "area");
|
|
42993
|
+
const {
|
|
42994
|
+
backgroundChartStyle = {}
|
|
42995
|
+
} = this.attribute;
|
|
42996
|
+
"line" === type && this._previewLine.setAttributes(Object.assign({
|
|
42997
|
+
points: this._getPreviewLinePoints(),
|
|
42998
|
+
curveType: "basis",
|
|
42999
|
+
pickable: !1
|
|
43000
|
+
}, backgroundChartStyle.line)), "area" === type && this._previewArea.setAttributes(Object.assign({
|
|
43001
|
+
points: this._getPreviewAreaPoints(),
|
|
43002
|
+
curveType: "basis",
|
|
43003
|
+
pickable: !1
|
|
43004
|
+
}, backgroundChartStyle.area));
|
|
43005
|
+
}
|
|
43006
|
+
_setSelectedPreviewClipAttributes(type, group) {
|
|
43007
|
+
this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
|
|
43008
|
+
pickable: !1
|
|
43009
|
+
}, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group"));
|
|
43010
|
+
const {
|
|
43011
|
+
start: start,
|
|
43012
|
+
end: end
|
|
43013
|
+
} = this._getState(),
|
|
43014
|
+
{
|
|
43015
|
+
position: position,
|
|
43016
|
+
width: width,
|
|
43017
|
+
height: height
|
|
43018
|
+
} = this._getLayoutAttrFromConfig();
|
|
43019
|
+
this._selectedPreviewGroupClip.setAttributes({
|
|
43020
|
+
x: this._isHorizontal ? position.x + start * width : position.x,
|
|
43021
|
+
y: this._isHorizontal ? position.y : position.y + start * height,
|
|
43022
|
+
width: this._isHorizontal ? (end - start) * width : width,
|
|
43023
|
+
height: this._isHorizontal ? height : (end - start) * height,
|
|
43024
|
+
clip: !0,
|
|
43025
|
+
pickable: !1
|
|
43026
|
+
}), this._selectedPreviewGroup.setAttributes({
|
|
43027
|
+
x: -(this._isHorizontal ? position.x + start * width : position.x),
|
|
43028
|
+
y: -(this._isHorizontal ? position.y : position.y + start * height),
|
|
43029
|
+
width: this._isHorizontal ? (end - start) * width : width,
|
|
43030
|
+
height: this._isHorizontal ? height : (end - start) * height,
|
|
43031
|
+
pickable: !1
|
|
43032
|
+
});
|
|
43033
|
+
}
|
|
43034
|
+
_setSelectedPreviewAttributes(type) {
|
|
43035
|
+
const {
|
|
43036
|
+
selectedBackgroundChartStyle = {}
|
|
43037
|
+
} = this.attribute;
|
|
43038
|
+
"line" === type ? this._selectedPreviewLine = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine", {}, "line") : this._selectedPreviewArea = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea", {
|
|
43039
|
+
curveType: "basis"
|
|
43040
|
+
}, "area"), "line" === type && this._selectedPreviewLine.setAttributes(Object.assign({
|
|
43041
|
+
points: this._getPreviewLinePoints(),
|
|
43042
|
+
curveType: "basis",
|
|
43043
|
+
pickable: !1
|
|
43044
|
+
}, selectedBackgroundChartStyle.line)), "area" === type && this._selectedPreviewArea.setAttributes(Object.assign({
|
|
43045
|
+
points: this._getPreviewAreaPoints(),
|
|
43046
|
+
curveType: "basis",
|
|
43047
|
+
pickable: !1
|
|
43048
|
+
}, selectedBackgroundChartStyle.area));
|
|
43049
|
+
}
|
|
43050
|
+
_computeBasePoints() {
|
|
42885
43051
|
const {
|
|
42886
43052
|
orient: orient
|
|
42887
43053
|
} = this.attribute,
|
|
@@ -42889,7 +43055,7 @@
|
|
|
42889
43055
|
position: position,
|
|
42890
43056
|
width: width,
|
|
42891
43057
|
height: height
|
|
42892
|
-
} = this.
|
|
43058
|
+
} = this._getLayoutAttrFromConfig();
|
|
42893
43059
|
let basePointStart, basePointEnd;
|
|
42894
43060
|
return this._isHorizontal ? (basePointStart = [{
|
|
42895
43061
|
x: position.x,
|
|
@@ -42914,7 +43080,7 @@
|
|
|
42914
43080
|
basePointEnd: basePointEnd
|
|
42915
43081
|
};
|
|
42916
43082
|
}
|
|
42917
|
-
|
|
43083
|
+
_simplifyPoints(points) {
|
|
42918
43084
|
var _a;
|
|
42919
43085
|
if (points.length > 1e4) {
|
|
42920
43086
|
const tolerance = null !== (_a = this.attribute.tolerance) && void 0 !== _a ? _a : this._previewData.length / 1e4;
|
|
@@ -42922,20 +43088,20 @@
|
|
|
42922
43088
|
}
|
|
42923
43089
|
return points;
|
|
42924
43090
|
}
|
|
42925
|
-
|
|
43091
|
+
_getPreviewLinePoints() {
|
|
42926
43092
|
let previewPoints = this._previewData.map(d => ({
|
|
42927
43093
|
x: this._previewPointsX && this._previewPointsX(d),
|
|
42928
43094
|
y: this._previewPointsY && this._previewPointsY(d)
|
|
42929
43095
|
}));
|
|
42930
43096
|
if (0 === previewPoints.length) return previewPoints;
|
|
42931
|
-
previewPoints = this.
|
|
43097
|
+
previewPoints = this._simplifyPoints(previewPoints);
|
|
42932
43098
|
const {
|
|
42933
43099
|
basePointStart: basePointStart,
|
|
42934
43100
|
basePointEnd: basePointEnd
|
|
42935
|
-
} = this.
|
|
43101
|
+
} = this._computeBasePoints();
|
|
42936
43102
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
42937
43103
|
}
|
|
42938
|
-
|
|
43104
|
+
_getPreviewAreaPoints() {
|
|
42939
43105
|
let previewPoints = this._previewData.map(d => ({
|
|
42940
43106
|
x: this._previewPointsX && this._previewPointsX(d),
|
|
42941
43107
|
y: this._previewPointsY && this._previewPointsY(d),
|
|
@@ -42943,99 +43109,459 @@
|
|
|
42943
43109
|
y1: this._previewPointsY1 && this._previewPointsY1(d)
|
|
42944
43110
|
}));
|
|
42945
43111
|
if (0 === previewPoints.length) return previewPoints;
|
|
42946
|
-
previewPoints = this.
|
|
43112
|
+
previewPoints = this._simplifyPoints(previewPoints);
|
|
42947
43113
|
const {
|
|
42948
43114
|
basePointStart: basePointStart,
|
|
42949
43115
|
basePointEnd: basePointEnd
|
|
42950
|
-
} = this.
|
|
43116
|
+
} = this._computeBasePoints();
|
|
42951
43117
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
42952
43118
|
}
|
|
42953
|
-
|
|
42954
|
-
|
|
42955
|
-
|
|
42956
|
-
|
|
42957
|
-
|
|
42958
|
-
|
|
42959
|
-
|
|
42960
|
-
|
|
42961
|
-
|
|
42962
|
-
|
|
42963
|
-
|
|
42964
|
-
|
|
42965
|
-
|
|
42966
|
-
|
|
42967
|
-
|
|
42968
|
-
|
|
42969
|
-
|
|
42970
|
-
|
|
43119
|
+
renderText() {
|
|
43120
|
+
let startTextBounds = null,
|
|
43121
|
+
endTextBounds = null;
|
|
43122
|
+
if (this._setTextAttr(startTextBounds, endTextBounds), this._showText) {
|
|
43123
|
+
startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds, this._setTextAttr(startTextBounds, endTextBounds), startTextBounds = this._startText.AABBBounds, endTextBounds = this._endText.AABBBounds;
|
|
43124
|
+
const {
|
|
43125
|
+
x1: x1,
|
|
43126
|
+
x2: x2,
|
|
43127
|
+
y1: y1,
|
|
43128
|
+
y2: y2
|
|
43129
|
+
} = startTextBounds,
|
|
43130
|
+
{
|
|
43131
|
+
dx: startTextDx = 0,
|
|
43132
|
+
dy: startTextDy = 0
|
|
43133
|
+
} = this.attribute.startTextStyle;
|
|
43134
|
+
if (new Bounds().set(x1, y1, x2, y2).intersects(endTextBounds)) {
|
|
43135
|
+
const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
|
|
43136
|
+
this._isHorizontal ? this._startText.setAttribute("dy", startTextDy + direction * Math.abs(endTextBounds.y1 - endTextBounds.y2)) : this._startText.setAttribute("dx", startTextDx + direction * Math.abs(endTextBounds.x1 - endTextBounds.x2));
|
|
43137
|
+
} else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
|
|
43138
|
+
}
|
|
42971
43139
|
}
|
|
42972
|
-
|
|
42973
|
-
|
|
42974
|
-
pickable: !1
|
|
42975
|
-
}, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group")), "line" === type ? this._selectedPreviewLine = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine", {}, "line") : this._selectedPreviewArea = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea", {
|
|
42976
|
-
curveType: "basis"
|
|
42977
|
-
}, "area");
|
|
43140
|
+
_setTextAttr(startTextBounds, endTextBounds) {
|
|
43141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42978
43142
|
const {
|
|
42979
|
-
|
|
43143
|
+
startTextStyle: startTextStyle,
|
|
43144
|
+
endTextStyle: endTextStyle
|
|
42980
43145
|
} = this.attribute,
|
|
43146
|
+
{
|
|
43147
|
+
formatMethod: startTextFormat
|
|
43148
|
+
} = startTextStyle,
|
|
43149
|
+
restStartTextStyle = __rest$1(startTextStyle, ["formatMethod"]),
|
|
43150
|
+
{
|
|
43151
|
+
formatMethod: endTextFormat
|
|
43152
|
+
} = endTextStyle,
|
|
43153
|
+
restEndTextStyle = __rest$1(endTextStyle, ["formatMethod"]),
|
|
42981
43154
|
{
|
|
42982
43155
|
start: start,
|
|
42983
43156
|
end: end
|
|
42984
|
-
} = this.
|
|
42985
|
-
|
|
43157
|
+
} = this._getState();
|
|
43158
|
+
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
43159
|
+
const {
|
|
42986
43160
|
position: position,
|
|
42987
43161
|
width: width,
|
|
42988
43162
|
height: height
|
|
42989
|
-
} = this.
|
|
42990
|
-
|
|
42991
|
-
|
|
42992
|
-
|
|
42993
|
-
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
|
|
42999
|
-
|
|
43000
|
-
|
|
43001
|
-
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43005
|
-
|
|
43006
|
-
|
|
43007
|
-
|
|
43008
|
-
|
|
43009
|
-
|
|
43010
|
-
|
|
43011
|
-
}
|
|
43163
|
+
} = this._getLayoutAttrFromConfig(),
|
|
43164
|
+
startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
43165
|
+
endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
43166
|
+
componentBoundsLike = {
|
|
43167
|
+
x1: position.x,
|
|
43168
|
+
y1: position.y,
|
|
43169
|
+
x2: position.x + width,
|
|
43170
|
+
y2: position.y + height
|
|
43171
|
+
};
|
|
43172
|
+
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
43173
|
+
this._isHorizontal ? (startTextPosition = {
|
|
43174
|
+
x: position.x + start * width,
|
|
43175
|
+
y: position.y + height / 2
|
|
43176
|
+
}, endTextPosition = {
|
|
43177
|
+
x: position.x + end * width,
|
|
43178
|
+
y: position.y + height / 2
|
|
43179
|
+
}, startTextAlignStyle = {
|
|
43180
|
+
textAlign: isTextOverflow(componentBoundsLike, startTextBounds, "start", this._isHorizontal) ? "left" : "right",
|
|
43181
|
+
textBaseline: null !== (_b = null === (_a = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _a ? void 0 : _a.textBaseline) && void 0 !== _b ? _b : "middle"
|
|
43182
|
+
}, endTextAlignStyle = {
|
|
43183
|
+
textAlign: isTextOverflow(componentBoundsLike, endTextBounds, "end", this._isHorizontal) ? "right" : "left",
|
|
43184
|
+
textBaseline: null !== (_d = null === (_c = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _c ? void 0 : _c.textBaseline) && void 0 !== _d ? _d : "middle"
|
|
43185
|
+
}) : (startTextPosition = {
|
|
43186
|
+
x: position.x + width / 2,
|
|
43187
|
+
y: position.y + start * height
|
|
43188
|
+
}, endTextPosition = {
|
|
43189
|
+
x: position.x + width / 2,
|
|
43190
|
+
y: position.y + end * height
|
|
43191
|
+
}, startTextAlignStyle = {
|
|
43192
|
+
textAlign: null !== (_f = null === (_e = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _e ? void 0 : _e.textAlign) && void 0 !== _f ? _f : "center",
|
|
43193
|
+
textBaseline: isTextOverflow(componentBoundsLike, startTextBounds, "start", this._isHorizontal) ? "top" : "bottom"
|
|
43194
|
+
}, endTextAlignStyle = {
|
|
43195
|
+
textAlign: null !== (_h = null === (_g = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _g ? void 0 : _g.textAlign) && void 0 !== _h ? _h : "center",
|
|
43196
|
+
textBaseline: isTextOverflow(componentBoundsLike, endTextBounds, "end", this._isHorizontal) ? "bottom" : "top"
|
|
43197
|
+
}), this._startText = this._maybeAddLabel(this._getContainer(), merge$1({}, restStartTextStyle, {
|
|
43198
|
+
text: startTextValue,
|
|
43199
|
+
x: startTextPosition.x,
|
|
43200
|
+
y: startTextPosition.y,
|
|
43201
|
+
visible: this._showText,
|
|
43202
|
+
pickable: !1,
|
|
43203
|
+
childrenPickable: !1,
|
|
43204
|
+
textStyle: startTextAlignStyle
|
|
43205
|
+
}), "data-zoom-start-text"), this._endText = this._maybeAddLabel(this._getContainer(), merge$1({}, restEndTextStyle, {
|
|
43206
|
+
text: endTextValue,
|
|
43207
|
+
x: endTextPosition.x,
|
|
43208
|
+
y: endTextPosition.y,
|
|
43209
|
+
visible: this._showText,
|
|
43210
|
+
pickable: !1,
|
|
43211
|
+
childrenPickable: !1,
|
|
43212
|
+
textStyle: endTextAlignStyle
|
|
43213
|
+
}), "data-zoom-end-text");
|
|
43012
43214
|
}
|
|
43013
|
-
|
|
43014
|
-
let labelShape =
|
|
43015
|
-
return labelShape ? labelShape.setAttributes(attributes) : (labelShape = new Tag(attributes), labelShape.name = name
|
|
43215
|
+
_maybeAddLabel(container, attributes, name) {
|
|
43216
|
+
let labelShape = container.find(node => node.name === name, !0);
|
|
43217
|
+
return labelShape ? labelShape.setAttributes(attributes) : (labelShape = new Tag(attributes), labelShape.name = name, container.add(labelShape)), labelShape;
|
|
43016
43218
|
}
|
|
43017
|
-
|
|
43219
|
+
}
|
|
43220
|
+
|
|
43221
|
+
const delayMap$2 = {
|
|
43222
|
+
debounce: debounce,
|
|
43223
|
+
throttle: throttle
|
|
43224
|
+
};
|
|
43225
|
+
class DataZoomInteraction extends EventEmitter {
|
|
43226
|
+
constructor(props) {
|
|
43227
|
+
super(), this._activeState = !1, this._activeCache = {
|
|
43228
|
+
startPos: {
|
|
43229
|
+
x: 0,
|
|
43230
|
+
y: 0
|
|
43231
|
+
},
|
|
43232
|
+
lastPos: {
|
|
43233
|
+
x: 0,
|
|
43234
|
+
y: 0
|
|
43235
|
+
}
|
|
43236
|
+
}, this._layoutCache = {
|
|
43237
|
+
attPos: "x",
|
|
43238
|
+
attSize: "width",
|
|
43239
|
+
size: 0
|
|
43240
|
+
}, this._handleTouchMove = e => {
|
|
43241
|
+
this._activeState && e.preventDefault();
|
|
43242
|
+
}, this._onHandlerPointerDown = (e, tag) => {
|
|
43243
|
+
this.clearDragEvents(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler, this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler, this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background, this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this._eventPosToStagePos(e), this._activeCache.lastPos = this._eventPosToStagePos(e);
|
|
43244
|
+
const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
|
|
43245
|
+
triggers = getEndTriggersOfDrag();
|
|
43246
|
+
evtTarget.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
43247
|
+
capture: !0
|
|
43248
|
+
}), this.on("pointermove", this._onHandlerPointerMove, {
|
|
43249
|
+
capture: !0
|
|
43250
|
+
}), triggers.forEach(trigger => {
|
|
43251
|
+
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
43252
|
+
});
|
|
43253
|
+
}, this._pointerMove = e => {
|
|
43254
|
+
const {
|
|
43255
|
+
brushSelect: brushSelect
|
|
43256
|
+
} = this.attribute,
|
|
43257
|
+
{
|
|
43258
|
+
position: position
|
|
43259
|
+
} = this._getLayoutAttrFromConfig(),
|
|
43260
|
+
pos = this._eventPosToStagePos(e),
|
|
43261
|
+
{
|
|
43262
|
+
attPos: attPos,
|
|
43263
|
+
size: size,
|
|
43264
|
+
attSize: attSize
|
|
43265
|
+
} = this._layoutCache,
|
|
43266
|
+
dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / size,
|
|
43267
|
+
statePos = (pos[attPos] - position[attPos]) / this._getLayoutAttrFromConfig()[attSize];
|
|
43268
|
+
let {
|
|
43269
|
+
start: start,
|
|
43270
|
+
end: end
|
|
43271
|
+
} = this._getState(),
|
|
43272
|
+
shouldRender = !0;
|
|
43273
|
+
this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? ({
|
|
43274
|
+
start: start,
|
|
43275
|
+
end: end
|
|
43276
|
+
} = this._moveZoomWithMiddle(dis)) : this._activeTag === DataZoomActiveTag.startHandler ? ({
|
|
43277
|
+
start: start,
|
|
43278
|
+
end: end
|
|
43279
|
+
} = this._moveZoomWithHandler(statePos, "start")) : this._activeTag === DataZoomActiveTag.endHandler ? ({
|
|
43280
|
+
start: start,
|
|
43281
|
+
end: end
|
|
43282
|
+
} = this._moveZoomWithHandler(statePos, "end")) : this._activeTag === DataZoomActiveTag.background && brushSelect && (({
|
|
43283
|
+
start: start,
|
|
43284
|
+
end: end
|
|
43285
|
+
} = this._moveZoomWithBackground(statePos)), shouldRender = !1, this._dispatchEvent(IDataZoomInteractiveEvent.maskUpdate)), this._activeCache.lastPos = pos), this._getState().start === start && this._getState().end === end || (this._setStateAttr(start, end), this._dispatchEvent(IDataZoomInteractiveEvent.stateUpdate, {
|
|
43286
|
+
start: this._getState().start,
|
|
43287
|
+
end: this._getState().end,
|
|
43288
|
+
shouldRender: shouldRender,
|
|
43289
|
+
tag: this._activeTag
|
|
43290
|
+
}), this.attribute.realTime && this._dispatchEvent(IDataZoomInteractiveEvent.dataZoomUpdate, {
|
|
43291
|
+
start: this._getState().start,
|
|
43292
|
+
end: this._getState().end,
|
|
43293
|
+
shouldRender: !0,
|
|
43294
|
+
tag: this._activeTag
|
|
43295
|
+
}));
|
|
43296
|
+
}, this._onHandlerPointerUp = e => {
|
|
43297
|
+
this._activeState && this._activeTag === DataZoomActiveTag.background && (this._setStateAttr(this._getState().start, this._getState().end), this._dispatchEvent(IDataZoomInteractiveEvent.stateUpdate, {
|
|
43298
|
+
start: this._getState().start,
|
|
43299
|
+
end: this._getState().end,
|
|
43300
|
+
shouldRender: !0,
|
|
43301
|
+
tag: this._activeTag
|
|
43302
|
+
})), this._activeState = !1, this._dispatchEvent(IDataZoomInteractiveEvent.dataZoomUpdate, {
|
|
43303
|
+
start: this._getState().start,
|
|
43304
|
+
end: this._getState().end,
|
|
43305
|
+
shouldRender: !0,
|
|
43306
|
+
tag: this._activeTag
|
|
43307
|
+
}), this.clearDragEvents();
|
|
43308
|
+
}, this._initAttrs(props);
|
|
43309
|
+
}
|
|
43310
|
+
setAttributes(props) {
|
|
43311
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43312
|
+
this._initAttrs(props), this._onHandlerPointerMove = 0 === (null !== (_b = null === (_a = this.attribute) || void 0 === _a ? void 0 : _a.delayTime) && void 0 !== _b ? _b : 0) ? this._pointerMove : delayMap$2[null !== (_d = null === (_c = this.attribute) || void 0 === _c ? void 0 : _c.delayType) && void 0 !== _d ? _d : "debounce"](this._pointerMove, null !== (_f = null === (_e = this.attribute) || void 0 === _e ? void 0 : _e.delayTime) && void 0 !== _f ? _f : 0);
|
|
43313
|
+
}
|
|
43314
|
+
_initAttrs(props) {
|
|
43315
|
+
this.stage = props.stage, this.attribute = props.attribute, this._startHandlerMask = props.startHandlerMask, this._endHandlerMask = props.endHandlerMask, this._middleHandlerSymbol = props.middleHandlerSymbol, this._middleHandlerRect = props.middleHandlerRect, this._selectedBackground = props.selectedBackground, this._background = props.background, this._previewGroup = props.previewGroup, this._selectedPreviewGroup = props.selectedPreviewGroup, this._getLayoutAttrFromConfig = props.getLayoutAttrFromConfig, this._getState = props.getState, this._setState = props.setState;
|
|
43018
43316
|
const {
|
|
43019
|
-
|
|
43020
|
-
|
|
43317
|
+
width: width,
|
|
43318
|
+
height: height
|
|
43319
|
+
} = this._getLayoutAttrFromConfig();
|
|
43320
|
+
this._spanCache = this._getState().end - this._getState().start;
|
|
43321
|
+
const isHorizontal = "top" === this.attribute.orient || "bottom" === this.attribute.orient;
|
|
43322
|
+
this._layoutCache.size = isHorizontal ? width : height, this._layoutCache.attPos = isHorizontal ? "x" : "y", this._layoutCache.attSize = isHorizontal ? "width" : "height", this._getGlobalTransMatrix = props.getGlobalTransMatrix;
|
|
43323
|
+
}
|
|
43324
|
+
clearDragEvents() {
|
|
43325
|
+
const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
|
|
43326
|
+
triggers = getEndTriggersOfDrag();
|
|
43327
|
+
evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
43328
|
+
capture: !0
|
|
43329
|
+
}), triggers.forEach(trigger => {
|
|
43330
|
+
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
43331
|
+
}), this.off("pointermove", this._onHandlerPointerMove, {
|
|
43332
|
+
capture: !0
|
|
43333
|
+
});
|
|
43334
|
+
}
|
|
43335
|
+
clearVGlobalEvents() {
|
|
43336
|
+
("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
43337
|
+
passive: !1
|
|
43338
|
+
});
|
|
43339
|
+
}
|
|
43340
|
+
bindEvents() {
|
|
43341
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
43342
|
+
const {
|
|
43343
|
+
brushSelect: brushSelect
|
|
43021
43344
|
} = this.attribute;
|
|
43022
|
-
|
|
43345
|
+
null === (_a = this._startHandlerMask) || void 0 === _a || _a.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "start")), null === (_b = this._endHandlerMask) || void 0 === _b || _b.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "end")), null === (_c = this._middleHandlerSymbol) || void 0 === _c || _c.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "middleSymbol")), null === (_d = this._middleHandlerRect) || void 0 === _d || _d.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "middleRect"));
|
|
43346
|
+
const selectedTag = brushSelect ? "background" : "middleRect";
|
|
43347
|
+
null === (_e = this._selectedBackground) || void 0 === _e || _e.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), brushSelect && (null === (_f = this._background) || void 0 === _f || _f.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background"))), brushSelect && (null === (_g = this._previewGroup) || void 0 === _g || _g.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background"))), null === (_h = this._selectedPreviewGroup) || void 0 === _h || _h.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
43348
|
+
passive: !1
|
|
43349
|
+
});
|
|
43350
|
+
}
|
|
43351
|
+
_setStateAttr(start, end) {
|
|
43352
|
+
const {
|
|
43353
|
+
zoomLock = !1,
|
|
43354
|
+
minSpan = 0,
|
|
43355
|
+
maxSpan = 1
|
|
43356
|
+
} = this.attribute,
|
|
43357
|
+
span = end - start;
|
|
43358
|
+
span !== this._spanCache && (zoomLock || span < minSpan || span > maxSpan) || (this._spanCache = span, this._setState({
|
|
43359
|
+
start: start,
|
|
43360
|
+
end: end
|
|
43361
|
+
}));
|
|
43362
|
+
}
|
|
43363
|
+
_moveZoomWithMiddle(dis) {
|
|
43364
|
+
const {
|
|
43365
|
+
start: staetState,
|
|
43366
|
+
end: endState
|
|
43367
|
+
} = this._getState();
|
|
43368
|
+
return dis > 0 && endState + dis > 1 ? dis = 1 - endState : dis < 0 && staetState + dis < 0 && (dis = -staetState), {
|
|
43369
|
+
start: clamp$1(staetState + dis, 0, 1),
|
|
43370
|
+
end: clamp$1(endState + dis, 0, 1)
|
|
43371
|
+
};
|
|
43372
|
+
}
|
|
43373
|
+
_moveZoomWithHandler(statePos, handler) {
|
|
43374
|
+
const {
|
|
43375
|
+
start: start,
|
|
43376
|
+
end: end
|
|
43377
|
+
} = this._getState();
|
|
43378
|
+
let newStart = start,
|
|
43379
|
+
newEnd = end;
|
|
43380
|
+
return "start" === handler ? statePos > end ? (newStart = end, newEnd = statePos, this._activeTag = DataZoomActiveTag.endHandler) : newStart = statePos : "end" === handler && (statePos < start ? (newEnd = start, newStart = statePos, this._activeTag = DataZoomActiveTag.startHandler) : newEnd = statePos), {
|
|
43381
|
+
start: clamp$1(newStart, 0, 1),
|
|
43382
|
+
end: clamp$1(newEnd, 0, 1)
|
|
43383
|
+
};
|
|
43384
|
+
}
|
|
43385
|
+
_moveZoomWithBackground(statePos) {
|
|
43386
|
+
const {
|
|
43387
|
+
position: position
|
|
43388
|
+
} = this._getLayoutAttrFromConfig(),
|
|
43389
|
+
{
|
|
43390
|
+
attSize: attSize
|
|
43391
|
+
} = this._layoutCache,
|
|
43392
|
+
startPos = (this._activeCache.startPos[this._layoutCache.attPos] - position[this._layoutCache.attPos]) / this._getLayoutAttrFromConfig()[attSize],
|
|
43393
|
+
endPos = statePos;
|
|
43394
|
+
let start = clamp$1(startPos, 0, 1),
|
|
43395
|
+
end = clamp$1(endPos, 0, 1);
|
|
43396
|
+
return start > end && ([start, end] = [end, start]), {
|
|
43397
|
+
start: start,
|
|
43398
|
+
end: end
|
|
43399
|
+
};
|
|
43400
|
+
}
|
|
43401
|
+
_eventPosToStagePos(e) {
|
|
43402
|
+
var _a, _b;
|
|
43403
|
+
const result = {
|
|
43404
|
+
x: 0,
|
|
43405
|
+
y: 0
|
|
43406
|
+
},
|
|
43407
|
+
stagePoints = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventPointTransform(e)) && void 0 !== _b ? _b : {
|
|
43408
|
+
x: 0,
|
|
43409
|
+
y: 0
|
|
43410
|
+
};
|
|
43411
|
+
return this._getGlobalTransMatrix().transformPoint(stagePoints, result), result;
|
|
43412
|
+
}
|
|
43413
|
+
_dispatchEvent(eventName, details) {
|
|
43414
|
+
this.emit(eventName, details);
|
|
43415
|
+
}
|
|
43416
|
+
}
|
|
43417
|
+
|
|
43418
|
+
function loadDataZoomComponent() {
|
|
43419
|
+
loadTagComponent(), registerRect(), registerSymbol(), registerArea(), registerLine();
|
|
43420
|
+
}
|
|
43421
|
+
|
|
43422
|
+
loadDataZoomComponent();
|
|
43423
|
+
let DataZoom$1 = class DataZoom extends AbstractComponent {
|
|
43424
|
+
constructor(attributes, options) {
|
|
43425
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, DataZoom.defaultAttributes, attributes)), this.name = "dataZoom", this._state = {
|
|
43426
|
+
start: 0,
|
|
43427
|
+
end: 1
|
|
43428
|
+
}, this.getLayoutAttrFromConfig = () => {
|
|
43429
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43430
|
+
if (this._layoutCacheFromConfig) return this._layoutCacheFromConfig;
|
|
43431
|
+
const {
|
|
43432
|
+
position: positionConfig,
|
|
43433
|
+
size: size,
|
|
43434
|
+
orient: orient,
|
|
43435
|
+
middleHandlerStyle = {},
|
|
43436
|
+
startHandlerStyle = {},
|
|
43437
|
+
endHandlerStyle = {},
|
|
43438
|
+
backgroundStyle = {}
|
|
43439
|
+
} = this.attribute,
|
|
43440
|
+
{
|
|
43441
|
+
width: widthConfig,
|
|
43442
|
+
height: heightConfig
|
|
43443
|
+
} = size,
|
|
43444
|
+
middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
|
|
43445
|
+
let width, height, position;
|
|
43446
|
+
middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize, position = {
|
|
43447
|
+
x: positionConfig.x,
|
|
43448
|
+
y: positionConfig.y + middleHandlerSize
|
|
43449
|
+
}) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
|
|
43450
|
+
x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
|
|
43451
|
+
y: positionConfig.y
|
|
43452
|
+
}) : (width = widthConfig, height = heightConfig, position = positionConfig);
|
|
43453
|
+
const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width,
|
|
43454
|
+
endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
|
|
43455
|
+
return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
43456
|
+
x: position.x + startHandlerSize / 2,
|
|
43457
|
+
y: position.y
|
|
43458
|
+
}) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
43459
|
+
x: position.x,
|
|
43460
|
+
y: position.y + startHandlerSize / 2
|
|
43461
|
+
})), height += (null !== (_e = backgroundStyle.lineWidth) && void 0 !== _e ? _e : 2) / 2, width += (null !== (_f = backgroundStyle.lineWidth) && void 0 !== _f ? _f : 2) / 2, this._layoutCacheFromConfig = {
|
|
43462
|
+
position: position,
|
|
43463
|
+
width: width,
|
|
43464
|
+
height: height
|
|
43465
|
+
}, this._layoutCacheFromConfig;
|
|
43466
|
+
};
|
|
43467
|
+
const {
|
|
43023
43468
|
start: start,
|
|
43024
43469
|
end: end,
|
|
43025
|
-
|
|
43470
|
+
orient: orient
|
|
43471
|
+
} = this.attribute;
|
|
43472
|
+
this._isHorizontal = "top" === orient || "bottom" === orient, start && (this._state.start = start), end && (this._state.end = end), this._renderer = new DataZoomRenderer(this._getRendererAttrs()), this._interaction = new DataZoomInteraction(this._getInteractionAttrs());
|
|
43473
|
+
}
|
|
43474
|
+
_getRendererAttrs() {
|
|
43475
|
+
return {
|
|
43476
|
+
attribute: this.attribute,
|
|
43477
|
+
getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
|
|
43478
|
+
setState: state => {
|
|
43479
|
+
this._state = state;
|
|
43480
|
+
},
|
|
43481
|
+
getState: () => this._state,
|
|
43482
|
+
getContainer: () => this._container
|
|
43483
|
+
};
|
|
43484
|
+
}
|
|
43485
|
+
_getInteractionAttrs() {
|
|
43486
|
+
return {
|
|
43487
|
+
stage: this.stage,
|
|
43488
|
+
attribute: this.attribute,
|
|
43489
|
+
startHandlerMask: this._renderer.startHandlerMask,
|
|
43490
|
+
endHandlerMask: this._renderer.endHandlerMask,
|
|
43491
|
+
middleHandlerSymbol: this._renderer.middleHandlerSymbol,
|
|
43492
|
+
middleHandlerRect: this._renderer.middleHandlerRect,
|
|
43493
|
+
selectedBackground: this._renderer.selectedBackground,
|
|
43494
|
+
background: this._renderer.background,
|
|
43495
|
+
previewGroup: this._renderer.previewGroup,
|
|
43496
|
+
selectedPreviewGroup: this._renderer.selectedPreviewGroup,
|
|
43497
|
+
getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
|
|
43498
|
+
setState: state => {
|
|
43499
|
+
this._state = state;
|
|
43500
|
+
},
|
|
43501
|
+
getState: () => this._state,
|
|
43502
|
+
getGlobalTransMatrix: () => this.globalTransMatrix
|
|
43503
|
+
};
|
|
43504
|
+
}
|
|
43505
|
+
bindEvents() {
|
|
43506
|
+
this.attribute.disableTriggerEvent ? this.setAttribute("childrenPickable", !1) : (this._interaction.bindEvents(), this._interaction.on(IDataZoomInteractiveEvent.stateUpdate, ({
|
|
43507
|
+
shouldRender: shouldRender
|
|
43508
|
+
}) => {
|
|
43509
|
+
shouldRender && this._renderer.renderDataZoom(!0);
|
|
43510
|
+
}), this._interaction.on(IDataZoomInteractiveEvent.dataZoomUpdate, ({
|
|
43511
|
+
start: start,
|
|
43512
|
+
end: end,
|
|
43513
|
+
tag: tag
|
|
43514
|
+
}) => {
|
|
43515
|
+
this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
|
|
43516
|
+
start: start,
|
|
43517
|
+
end: end,
|
|
43518
|
+
tag: tag
|
|
43519
|
+
});
|
|
43520
|
+
}), this._interaction.on(IDataZoomInteractiveEvent.maskUpdate, () => {
|
|
43521
|
+
this._renderer.renderDragMask();
|
|
43522
|
+
}), "auto" === this.attribute.showDetail && (this._container.addEventListener("pointerenter", () => {
|
|
43523
|
+
this._renderer.showText = !0, this._renderer.renderText();
|
|
43524
|
+
}), this._container.addEventListener("pointerleave", () => {
|
|
43525
|
+
this._renderer.showText = !1, this._renderer.renderText();
|
|
43026
43526
|
})));
|
|
43027
43527
|
}
|
|
43528
|
+
setAttributes(params, forceUpdateTag) {
|
|
43529
|
+
const {
|
|
43530
|
+
start: start,
|
|
43531
|
+
end: end
|
|
43532
|
+
} = this.attribute;
|
|
43533
|
+
start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
43534
|
+
}
|
|
43535
|
+
render() {
|
|
43536
|
+
this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"), this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
|
|
43537
|
+
}
|
|
43538
|
+
release(all) {
|
|
43539
|
+
super.release(all), this._interaction.clearDragEvents();
|
|
43540
|
+
}
|
|
43541
|
+
setStartAndEnd(start, end) {
|
|
43542
|
+
const {
|
|
43543
|
+
start: startState,
|
|
43544
|
+
end: endState
|
|
43545
|
+
} = this._state;
|
|
43546
|
+
isValid$1(start) && isValid$1(end) && (start !== startState || end !== endState) && (this._state = {
|
|
43547
|
+
start: start,
|
|
43548
|
+
end: end
|
|
43549
|
+
}, this._renderer.renderDataZoom(!0), this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
|
|
43550
|
+
start: start,
|
|
43551
|
+
end: end
|
|
43552
|
+
}));
|
|
43553
|
+
}
|
|
43028
43554
|
setPreviewData(data) {
|
|
43029
|
-
this.
|
|
43555
|
+
this._renderer.previewData = data;
|
|
43030
43556
|
}
|
|
43031
43557
|
setText(text, tag) {
|
|
43032
|
-
"start" === tag ? this.
|
|
43558
|
+
"start" === tag ? this._renderer.startText.setAttribute("text", text) : this._renderer.endText.setAttribute("text", text);
|
|
43033
43559
|
}
|
|
43034
43560
|
getStartValue() {
|
|
43035
|
-
return this.
|
|
43561
|
+
return this._renderer.startValue;
|
|
43036
43562
|
}
|
|
43037
43563
|
getEndTextValue() {
|
|
43038
|
-
return this.
|
|
43564
|
+
return this._renderer.endValue;
|
|
43039
43565
|
}
|
|
43040
43566
|
getMiddleHandlerSize() {
|
|
43041
43567
|
var _a, _b, _c, _d;
|
|
@@ -43047,24 +43573,19 @@
|
|
|
43047
43573
|
return Math.max(middleHandlerRectSize, ...array(middleHandlerSymbolSize));
|
|
43048
43574
|
}
|
|
43049
43575
|
setPreviewPointsX(callback) {
|
|
43050
|
-
isFunction$1(callback) && (this.
|
|
43576
|
+
isFunction$1(callback) && (this._renderer.previewPointsX = callback);
|
|
43051
43577
|
}
|
|
43052
43578
|
setPreviewPointsY(callback) {
|
|
43053
|
-
isFunction$1(callback) && (this.
|
|
43579
|
+
isFunction$1(callback) && (this._renderer.previewPointsY = callback);
|
|
43054
43580
|
}
|
|
43055
43581
|
setPreviewPointsX1(callback) {
|
|
43056
|
-
isFunction$1(callback) && (this.
|
|
43582
|
+
isFunction$1(callback) && (this._renderer.previewPointsX1 = callback);
|
|
43057
43583
|
}
|
|
43058
43584
|
setPreviewPointsY1(callback) {
|
|
43059
|
-
isFunction$1(callback) && (this.
|
|
43585
|
+
isFunction$1(callback) && (this._renderer.previewPointsY1 = callback);
|
|
43060
43586
|
}
|
|
43061
43587
|
setStatePointToData(callback) {
|
|
43062
|
-
isFunction$1(callback) && (this.
|
|
43063
|
-
}
|
|
43064
|
-
release(all) {
|
|
43065
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
43066
|
-
passive: !1
|
|
43067
|
-
}), this._clearDragEvents();
|
|
43588
|
+
isFunction$1(callback) && (this._renderer.statePointToData = callback);
|
|
43068
43589
|
}
|
|
43069
43590
|
};
|
|
43070
43591
|
DataZoom$1.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
@@ -58331,7 +58852,7 @@
|
|
|
58331
58852
|
});
|
|
58332
58853
|
};
|
|
58333
58854
|
|
|
58334
|
-
const version = "2.0.7-alpha.
|
|
58855
|
+
const version = "2.0.7-alpha.5";
|
|
58335
58856
|
|
|
58336
58857
|
const addVChartProperty = (data, op) => {
|
|
58337
58858
|
const context = op.beforeCall();
|
|
@@ -78407,6 +78928,72 @@
|
|
|
78407
78928
|
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);
|
|
78408
78929
|
}), sum;
|
|
78409
78930
|
};
|
|
78931
|
+
function makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes = [], nodeMap = {}, originalLinks) {
|
|
78932
|
+
calculateNodeValue(originalNodes);
|
|
78933
|
+
const doSubTree = (subTree, depth, parents) => {
|
|
78934
|
+
subTree.forEach((node, index) => {
|
|
78935
|
+
const nodeKey = nodeKeyFunc ? nodeKeyFunc(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
78936
|
+
nodeValue = isNil$1(node.value) ? 0 : toValidNumber$1(node.value);
|
|
78937
|
+
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
78938
|
+
const nodeElement = {
|
|
78939
|
+
depth: depth,
|
|
78940
|
+
datum: node,
|
|
78941
|
+
index: index,
|
|
78942
|
+
key: nodeKey,
|
|
78943
|
+
value: nodeValue,
|
|
78944
|
+
sourceLinks: [],
|
|
78945
|
+
targetLinks: []
|
|
78946
|
+
};
|
|
78947
|
+
nodeMap[nodeKey] = nodeElement, nodes.push(nodeElement);
|
|
78948
|
+
}
|
|
78949
|
+
parents && originalLinks && originalLinks.push({
|
|
78950
|
+
source: parents[parents.length - 1].key,
|
|
78951
|
+
target: nodeKey,
|
|
78952
|
+
value: nodeValue,
|
|
78953
|
+
parents: parents
|
|
78954
|
+
}), node.children && node.children.length && doSubTree(node.children, depth + 1, parents ? parents.concat([nodeMap[nodeKey]]) : [nodeMap[nodeKey]]);
|
|
78955
|
+
});
|
|
78956
|
+
};
|
|
78957
|
+
return doSubTree(originalNodes, 0, null), nodes;
|
|
78958
|
+
}
|
|
78959
|
+
function computeHierarchicNodeLinks(originalNodes, nodeKeyFunc) {
|
|
78960
|
+
const nodes = [],
|
|
78961
|
+
links = [],
|
|
78962
|
+
nodeMap = {},
|
|
78963
|
+
linkMap = {},
|
|
78964
|
+
originalLinks = [];
|
|
78965
|
+
return makeHierarchicNodes(originalNodes, nodeKeyFunc, nodes, nodeMap, originalLinks), originalLinks.forEach((link, index) => {
|
|
78966
|
+
const key = `${link.source}-${link.target}`,
|
|
78967
|
+
linkDatum = pickWithout(link, ["parents"]);
|
|
78968
|
+
if (linkDatum.parents = link.parents.map(node => pickWithout(node, ["sourceLinks", "targetLinks"])), linkMap[key]) return linkMap[key].value += toValidNumber$1(link.value), void linkMap[key].datum.push(linkDatum);
|
|
78969
|
+
const linkElement = {
|
|
78970
|
+
index: index,
|
|
78971
|
+
key: `${link.source}-${link.target}`,
|
|
78972
|
+
source: link.source,
|
|
78973
|
+
target: link.target,
|
|
78974
|
+
datum: [linkDatum],
|
|
78975
|
+
value: link.value,
|
|
78976
|
+
parents: link.parents.map(parent => parent.key)
|
|
78977
|
+
};
|
|
78978
|
+
links.push(linkElement), nodeMap[link.source].sourceLinks.push(linkElement), nodeMap[link.target].targetLinks.push(linkElement), linkMap[key] = linkElement;
|
|
78979
|
+
}), {
|
|
78980
|
+
nodes: nodes,
|
|
78981
|
+
links: links,
|
|
78982
|
+
nodeMap: nodeMap
|
|
78983
|
+
};
|
|
78984
|
+
}
|
|
78985
|
+
function computeNodeValues(nodes) {
|
|
78986
|
+
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
78987
|
+
const node = nodes[i];
|
|
78988
|
+
node.value = Math.max(isNil$1(node.value) ? 0 : toValidNumber$1(node.value), node.sourceLinks.reduce((sum, link) => {
|
|
78989
|
+
var _a;
|
|
78990
|
+
return sum + (null !== (_a = toValidNumber$1(link.value)) && void 0 !== _a ? _a : 0);
|
|
78991
|
+
}, 0), node.targetLinks.reduce((sum, link) => {
|
|
78992
|
+
var _a;
|
|
78993
|
+
return sum + (null !== (_a = toValidNumber$1(link.value)) && void 0 !== _a ? _a : 0);
|
|
78994
|
+
}, 0));
|
|
78995
|
+
}
|
|
78996
|
+
}
|
|
78410
78997
|
|
|
78411
78998
|
function left(node) {
|
|
78412
78999
|
return node.depth;
|
|
@@ -78540,55 +79127,7 @@
|
|
|
78540
79127
|
};
|
|
78541
79128
|
}
|
|
78542
79129
|
computeHierarchicNodeLinks(originalNodes) {
|
|
78543
|
-
|
|
78544
|
-
links = [],
|
|
78545
|
-
nodeMap = {},
|
|
78546
|
-
linkMap = {},
|
|
78547
|
-
originalLinks = [];
|
|
78548
|
-
calculateNodeValue(originalNodes);
|
|
78549
|
-
const doSubTree = (subTree, depth, parents) => {
|
|
78550
|
-
subTree.forEach((node, index) => {
|
|
78551
|
-
const nodeKey = this._getNodeKey ? this._getNodeKey(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
78552
|
-
nodeValue = isNil$1(node.value) ? 0 : toValidNumber$1(node.value);
|
|
78553
|
-
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
78554
|
-
const nodeElement = {
|
|
78555
|
-
depth: depth,
|
|
78556
|
-
datum: node,
|
|
78557
|
-
index: index,
|
|
78558
|
-
key: nodeKey,
|
|
78559
|
-
value: nodeValue,
|
|
78560
|
-
sourceLinks: [],
|
|
78561
|
-
targetLinks: []
|
|
78562
|
-
};
|
|
78563
|
-
nodeMap[nodeKey] = nodeElement, nodes.push(nodeElement);
|
|
78564
|
-
}
|
|
78565
|
-
parents && originalLinks.push({
|
|
78566
|
-
source: parents[parents.length - 1].key,
|
|
78567
|
-
target: nodeKey,
|
|
78568
|
-
value: nodeValue,
|
|
78569
|
-
parents: parents
|
|
78570
|
-
}), node.children && node.children.length && doSubTree(node.children, depth + 1, parents ? parents.concat([nodeMap[nodeKey]]) : [nodeMap[nodeKey]]);
|
|
78571
|
-
});
|
|
78572
|
-
};
|
|
78573
|
-
return doSubTree(originalNodes, 0, null), originalLinks.forEach((link, index) => {
|
|
78574
|
-
const key = `${link.source}-${link.target}`,
|
|
78575
|
-
linkDatum = pickWithout(link, ["parents"]);
|
|
78576
|
-
if (linkDatum.parents = link.parents.map(node => pickWithout(node, ["sourceLinks", "targetLinks"])), linkMap[key]) return linkMap[key].value += toValidNumber$1(link.value), void linkMap[key].datum.push(linkDatum);
|
|
78577
|
-
const linkElement = {
|
|
78578
|
-
index: index,
|
|
78579
|
-
key: `${link.source}-${link.target}`,
|
|
78580
|
-
source: link.source,
|
|
78581
|
-
target: link.target,
|
|
78582
|
-
datum: [linkDatum],
|
|
78583
|
-
value: link.value,
|
|
78584
|
-
parents: link.parents.map(parent => parent.key)
|
|
78585
|
-
};
|
|
78586
|
-
links.push(linkElement), nodeMap[link.source].sourceLinks.push(linkElement), nodeMap[link.target].targetLinks.push(linkElement), linkMap[key] = linkElement;
|
|
78587
|
-
}), {
|
|
78588
|
-
nodes: nodes,
|
|
78589
|
-
links: links,
|
|
78590
|
-
nodeMap: nodeMap
|
|
78591
|
-
};
|
|
79130
|
+
return computeHierarchicNodeLinks(originalNodes, this._getNodeKey);
|
|
78592
79131
|
}
|
|
78593
79132
|
computeSourceTargetNodeLinks(data) {
|
|
78594
79133
|
const nodes = [],
|
|
@@ -78658,16 +79197,7 @@
|
|
|
78658
79197
|
};
|
|
78659
79198
|
}
|
|
78660
79199
|
computeNodeValues(nodes) {
|
|
78661
|
-
|
|
78662
|
-
const node = nodes[i];
|
|
78663
|
-
node.value = Math.max(isNil$1(node.value) ? 0 : toValidNumber$1(node.value), node.sourceLinks.reduce((sum, link) => {
|
|
78664
|
-
var _a;
|
|
78665
|
-
return sum + (null !== (_a = toValidNumber$1(link.value)) && void 0 !== _a ? _a : 0);
|
|
78666
|
-
}, 0), node.targetLinks.reduce((sum, link) => {
|
|
78667
|
-
var _a;
|
|
78668
|
-
return sum + (null !== (_a = toValidNumber$1(link.value)) && void 0 !== _a ? _a : 0);
|
|
78669
|
-
}, 0));
|
|
78670
|
-
}
|
|
79200
|
+
return computeNodeValues(nodes);
|
|
78671
79201
|
}
|
|
78672
79202
|
computeNodeDepths(nodes) {
|
|
78673
79203
|
var _a;
|
|
@@ -79732,7 +80262,7 @@
|
|
|
79732
80262
|
return ret;
|
|
79733
80263
|
}
|
|
79734
80264
|
|
|
79735
|
-
function scaleSolution(solution, width, height, x0, y0) {
|
|
80265
|
+
function scaleSolution(solution, width, height, x0, y0, hasEmptySet = !1) {
|
|
79736
80266
|
width = Math.max(width, 1), height = Math.max(height, 1);
|
|
79737
80267
|
const circles = [],
|
|
79738
80268
|
setIds = [];
|
|
@@ -79742,9 +80272,20 @@
|
|
|
79742
80272
|
yRange = bounds.yRange;
|
|
79743
80273
|
if (xRange.max === xRange.min || yRange.max === yRange.min) return console.log("not scaling solution: zero size detected"), solution;
|
|
79744
80274
|
const xScaling = width / (xRange.max - xRange.min),
|
|
79745
|
-
yScaling = height / (yRange.max - yRange.min)
|
|
79746
|
-
|
|
79747
|
-
|
|
80275
|
+
yScaling = height / (yRange.max - yRange.min);
|
|
80276
|
+
let scaling;
|
|
80277
|
+
if (hasEmptySet) {
|
|
80278
|
+
const containerRadius = Math.min(width, height) / 2,
|
|
80279
|
+
centerX = (xRange.min + xRange.max) / 2,
|
|
80280
|
+
centerY = (yRange.min + yRange.max) / 2;
|
|
80281
|
+
let diagramRadius = 0;
|
|
80282
|
+
for (const circle of circles) {
|
|
80283
|
+
const maxDistanceForThisCircle = Math.sqrt(Math.pow(circle.x - centerX, 2) + Math.pow(circle.y - centerY, 2)) + circle.radius;
|
|
80284
|
+
diagramRadius = Math.max(diagramRadius, maxDistanceForThisCircle);
|
|
80285
|
+
}
|
|
80286
|
+
scaling = containerRadius / diagramRadius;
|
|
80287
|
+
} else scaling = Math.min(yScaling, xScaling);
|
|
80288
|
+
const xOffset = (width - (xRange.max - xRange.min) * scaling) / 2,
|
|
79748
80289
|
yOffset = (height - (yRange.max - yRange.min) * scaling) / 2,
|
|
79749
80290
|
scaled = {};
|
|
79750
80291
|
for (let i = 0; i < circles.length; ++i) {
|
|
@@ -79959,21 +80500,39 @@
|
|
|
79959
80500
|
setField = "sets",
|
|
79960
80501
|
valueField = "size",
|
|
79961
80502
|
orientation = Math.PI / 2,
|
|
79962
|
-
orientationOrder = null
|
|
80503
|
+
orientationOrder = null,
|
|
80504
|
+
emptySetKey: emptySetKey
|
|
79963
80505
|
} = options;
|
|
79964
80506
|
let circles = {},
|
|
79965
80507
|
textCenters = {};
|
|
79966
|
-
|
|
79967
|
-
|
|
80508
|
+
const hasEmptySet = upstreamData.some(area => {
|
|
80509
|
+
const sets = array(area[setField]);
|
|
80510
|
+
return !sets || 0 === sets.length;
|
|
80511
|
+
}),
|
|
80512
|
+
nonEmptyData = hasEmptySet ? upstreamData.filter(area => !isEmpty(array(area[setField]))) : upstreamData;
|
|
80513
|
+
if (nonEmptyData.length > 0) {
|
|
80514
|
+
const vennData = nonEmptyData.map(area => ({
|
|
79968
80515
|
sets: array(area[setField]),
|
|
79969
80516
|
size: area[valueField]
|
|
79970
80517
|
}));
|
|
79971
80518
|
let solution = venn$1(vennData, options);
|
|
79972
|
-
solution = normalizeSolution(solution, orientation, orientationOrder), circles = scaleSolution(solution, x1 - x0, y1 - y0, x0, y0), textCenters = computeTextCenters(circles, vennData);
|
|
80519
|
+
solution = normalizeSolution(solution, orientation, orientationOrder), circles = scaleSolution(solution, x1 - x0, y1 - y0, x0, y0, hasEmptySet), textCenters = computeTextCenters(circles, vennData);
|
|
79973
80520
|
}
|
|
79974
80521
|
return upstreamData.map(area => {
|
|
79975
|
-
const sets = array(area[setField])
|
|
79976
|
-
|
|
80522
|
+
const sets = array(area[setField]);
|
|
80523
|
+
if (!sets || 0 === sets.length) return Object.assign(Object.assign({}, area), {
|
|
80524
|
+
datum: area,
|
|
80525
|
+
sets: sets,
|
|
80526
|
+
key: emptySetKey || "others",
|
|
80527
|
+
size: area[valueField],
|
|
80528
|
+
labelX: void 0,
|
|
80529
|
+
labelY: void 0,
|
|
80530
|
+
type: "circle",
|
|
80531
|
+
x: x0 + (x1 - x0) / 2,
|
|
80532
|
+
y: y0 + (y1 - y0) / 2,
|
|
80533
|
+
radius: Math.min(x1 - x0, y1 - y0) / 2
|
|
80534
|
+
});
|
|
80535
|
+
const key = sets.toString(),
|
|
79977
80536
|
textCenter = textCenters[key],
|
|
79978
80537
|
basicDatum = Object.assign(Object.assign({}, area), {
|
|
79979
80538
|
datum: area,
|
|
@@ -80253,11 +80812,11 @@
|
|
|
80253
80812
|
if (1 === this._placeStatus) {
|
|
80254
80813
|
const maxSize0 = d.fontSize * this._originSize[0] / this.options.minFontSize,
|
|
80255
80814
|
distSize0 = Math.max(d.width, d.height);
|
|
80256
|
-
if (distSize0 <= maxSize0) this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
|
|
80815
|
+
if (distSize0 <= maxSize0) this._board = this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
|
|
80257
80816
|
if (!this.options.clip) return !0;
|
|
80258
|
-
this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
|
|
80817
|
+
this._board = this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
|
|
80259
80818
|
}
|
|
80260
|
-
} else this._placeStatus, this.expandBoard(this._board, this._bounds);
|
|
80819
|
+
} else this._placeStatus, this._board = this.expandBoard(this._board, this._bounds);
|
|
80261
80820
|
return this.updateBoardExpandStatus(d.fontSize), !1;
|
|
80262
80821
|
}
|
|
80263
80822
|
return this._tTemp = null, this._dtTemp = null, !0;
|
|
@@ -80268,7 +80827,7 @@
|
|
|
80268
80827
|
width: 1,
|
|
80269
80828
|
height: 1
|
|
80270
80829
|
}));
|
|
80271
|
-
this.contextAndRatio = contextAndRatio, this._board = new
|
|
80830
|
+
this.contextAndRatio = contextAndRatio, this._board = new Uint32Array((this._size[0] >> 5) * this._size[1]).fill(0), this._bounds = null;
|
|
80272
80831
|
words.length;
|
|
80273
80832
|
this.result = [];
|
|
80274
80833
|
const data = words.map((d, i) => ({
|
|
@@ -80335,18 +80894,33 @@
|
|
|
80335
80894
|
this._size = this._size.map(v => v * (1 - minRatio));
|
|
80336
80895
|
}
|
|
80337
80896
|
expandBoard(board, bounds, factor) {
|
|
80338
|
-
const
|
|
80897
|
+
const oldW = this._size[0],
|
|
80898
|
+
oldH = this._size[1],
|
|
80899
|
+
oldRowStride = oldW >> 5,
|
|
80900
|
+
expandedLeftWidth = oldW * (factor || 1.1) - oldW >> 5;
|
|
80339
80901
|
let diffWidth = 2 * expandedLeftWidth > 2 ? expandedLeftWidth : 2;
|
|
80340
80902
|
diffWidth % 2 != 0 && diffWidth++;
|
|
80341
|
-
let diffHeight = Math.ceil(
|
|
80903
|
+
let diffHeight = Math.ceil(oldH * (diffWidth << 5) / oldW);
|
|
80342
80904
|
diffHeight % 2 != 0 && diffHeight++;
|
|
80343
|
-
const
|
|
80344
|
-
|
|
80345
|
-
|
|
80346
|
-
|
|
80347
|
-
|
|
80348
|
-
|
|
80349
|
-
|
|
80905
|
+
const newW = oldW + (diffWidth << 5),
|
|
80906
|
+
newH = oldH + diffHeight,
|
|
80907
|
+
newRowStride = newW >> 5,
|
|
80908
|
+
paddingLeft = diffWidth / 2,
|
|
80909
|
+
paddingTop = diffHeight / 2,
|
|
80910
|
+
newBoard = new Uint32Array(newH * newRowStride).fill(0);
|
|
80911
|
+
for (let y = 0; y < oldH; y++) {
|
|
80912
|
+
const sourceStartIndex = y * oldRowStride,
|
|
80913
|
+
sourceEndIndex = sourceStartIndex + oldRowStride,
|
|
80914
|
+
destStartIndex = (y + paddingTop) * newRowStride + paddingLeft,
|
|
80915
|
+
rowData = board.slice(sourceStartIndex, sourceEndIndex);
|
|
80916
|
+
newBoard.set(rowData, destStartIndex);
|
|
80917
|
+
}
|
|
80918
|
+
if (this._size = [newW, newH], bounds) {
|
|
80919
|
+
const offsetX = (diffWidth << 5) / 2,
|
|
80920
|
+
offsetY = diffHeight / 2;
|
|
80921
|
+
bounds[0].x += offsetX, bounds[0].y += offsetY, bounds[1].x += offsetX, bounds[1].y += offsetY;
|
|
80922
|
+
}
|
|
80923
|
+
return newBoard;
|
|
80350
80924
|
}
|
|
80351
80925
|
insertZerosToArray(array, index, length) {
|
|
80352
80926
|
if (this.options.customInsertZerosToArray) return this.options.customInsertZerosToArray(array, index, length);
|
|
@@ -88835,6 +89409,7 @@
|
|
|
88835
89409
|
registerDimensionEvents();
|
|
88836
89410
|
registerDimensionHover();
|
|
88837
89411
|
registerBarSeries();
|
|
89412
|
+
Factory.registerTransform('bin', bin);
|
|
88838
89413
|
Factory.registerChart(HistogramChart.type, HistogramChart);
|
|
88839
89414
|
};
|
|
88840
89415
|
|
|
@@ -89534,6 +90109,7 @@
|
|
|
89534
90109
|
registerDimensionEvents();
|
|
89535
90110
|
registerDimensionHover();
|
|
89536
90111
|
registerBoxplotSeries();
|
|
90112
|
+
Factory.registerTransform('boxplot', boxplot);
|
|
89537
90113
|
Factory.registerChart(BoxPlotChart.type, BoxPlotChart);
|
|
89538
90114
|
};
|
|
89539
90115
|
|
|
@@ -102087,6 +102663,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
102087
102663
|
exports.registerAreaChart = registerAreaChart;
|
|
102088
102664
|
exports.registerAreaMark = registerAreaMark;
|
|
102089
102665
|
exports.registerAreaSeries = registerAreaSeries;
|
|
102666
|
+
exports.registerBarAnimation = registerBarAnimation;
|
|
102090
102667
|
exports.registerBarChart = registerBarChart;
|
|
102091
102668
|
exports.registerBarSeries = registerBarSeries;
|
|
102092
102669
|
exports.registerBoxplotChart = registerBoxplotChart;
|