@visactor/vchart 2.0.11-alpha.6 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es5/index.js +2 -2
- package/build/index.es.js +377 -141
- package/build/index.js +377 -141
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +6 -0
- package/cjs/component/axis/cartesian/axis.js +3 -0
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/crosshair/base.js +11 -3
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/label/util.d.ts +6 -1
- package/cjs/component/label/util.js +34 -3
- package/cjs/component/label/util.js.map +1 -1
- package/cjs/component/tooltip/tooltip.d.ts +2 -1
- package/cjs/component/tooltip/tooltip.js +20 -12
- package/cjs/component/tooltip/tooltip.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/data/transforms/box-plot.d.ts +1 -0
- package/cjs/data/transforms/box-plot.js +3 -2
- package/cjs/data/transforms/box-plot.js.map +1 -1
- package/cjs/mark/box-plot.d.ts +1 -0
- package/cjs/mark/box-plot.js +20 -1
- package/cjs/mark/box-plot.js.map +1 -1
- package/cjs/series/box-plot/box-plot-transformer.d.ts +5 -0
- package/cjs/series/box-plot/box-plot-transformer.js +16 -0
- package/cjs/series/box-plot/box-plot-transformer.js.map +1 -0
- package/cjs/series/box-plot/box-plot.d.ts +9 -4
- package/cjs/series/box-plot/box-plot.js +25 -16
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/cjs/typings/visual.d.ts +15 -6
- package/cjs/typings/visual.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +6 -0
- package/esm/component/axis/cartesian/axis.js +3 -0
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/crosshair/base.js +11 -3
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/label/util.d.ts +6 -1
- package/esm/component/label/util.js +31 -1
- package/esm/component/label/util.js.map +1 -1
- package/esm/component/tooltip/tooltip.d.ts +2 -1
- package/esm/component/tooltip/tooltip.js +18 -12
- package/esm/component/tooltip/tooltip.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/data/transforms/box-plot.d.ts +1 -0
- package/esm/data/transforms/box-plot.js +3 -3
- package/esm/data/transforms/box-plot.js.map +1 -1
- package/esm/mark/box-plot.d.ts +1 -0
- package/esm/mark/box-plot.js +20 -1
- package/esm/mark/box-plot.js.map +1 -1
- package/esm/series/box-plot/box-plot-transformer.d.ts +5 -0
- package/esm/series/box-plot/box-plot-transformer.js +8 -0
- package/esm/series/box-plot/box-plot-transformer.js.map +1 -0
- package/esm/series/box-plot/box-plot.d.ts +9 -4
- package/esm/series/box-plot/box-plot.js +26 -15
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/esm/typings/visual.d.ts +15 -6
- package/esm/typings/visual.js.map +1 -1
- package/package.json +10 -10
package/build/index.es.js
CHANGED
|
@@ -1316,7 +1316,9 @@ function rSquared(data, x, y, uY, predict) {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
return 0 === sst ? 0 : 1 - ssr / sst;
|
|
1318
1318
|
}
|
|
1319
|
-
function regressionLinear(data, x = d => d.x, y = d => d.y) {
|
|
1319
|
+
function regressionLinear(data, x = d => d.x, y = d => d.y, options) {
|
|
1320
|
+
var _a;
|
|
1321
|
+
const alpha = null !== (_a = null == options ? void 0 : options.alpha) && void 0 !== _a ? _a : .05;
|
|
1320
1322
|
let n = 0,
|
|
1321
1323
|
meanX = 0,
|
|
1322
1324
|
meanY = 0,
|
|
@@ -1358,7 +1360,7 @@ function regressionLinear(data, x = d => d.x, y = d => d.y) {
|
|
|
1358
1360
|
}
|
|
1359
1361
|
return out;
|
|
1360
1362
|
},
|
|
1361
|
-
confidenceInterval: function (N = 50
|
|
1363
|
+
confidenceInterval: function (N = 50) {
|
|
1362
1364
|
const out = [];
|
|
1363
1365
|
if (0 === comps.n || N <= 0) return out;
|
|
1364
1366
|
const z = invNorm(1 - alpha / 2);
|
|
@@ -1395,9 +1397,10 @@ function regressionLinear(data, x = d => d.x, y = d => d.y) {
|
|
|
1395
1397
|
}
|
|
1396
1398
|
|
|
1397
1399
|
function regressionLogistic(data, x = d => d.x, y = d => d.y, options) {
|
|
1398
|
-
var _a, _b;
|
|
1400
|
+
var _a, _b, _c;
|
|
1399
1401
|
const maxIter = null !== (_a = null == options ? void 0 : options.maxIteration) && void 0 !== _a ? _a : 25,
|
|
1400
1402
|
tol = null !== (_b = null == options ? void 0 : options.tol) && void 0 !== _b ? _b : 1e-6,
|
|
1403
|
+
alpha = null !== (_c = null == options ? void 0 : options.alpha) && void 0 !== _c ? _c : .05,
|
|
1401
1404
|
xs = [],
|
|
1402
1405
|
ys = [];
|
|
1403
1406
|
visitPoints(data, x, y, (dx, dy) => {
|
|
@@ -1469,7 +1472,7 @@ function regressionLogistic(data, x = d => d.x, y = d => d.y, options) {
|
|
|
1469
1472
|
}
|
|
1470
1473
|
return out;
|
|
1471
1474
|
},
|
|
1472
|
-
confidenceInterval: function (N = 50
|
|
1475
|
+
confidenceInterval: function (N = 50) {
|
|
1473
1476
|
const out = [];
|
|
1474
1477
|
if (N <= 0) return out;
|
|
1475
1478
|
const comps = computeLinearCIComponents(data, x, y, predict);
|
|
@@ -1513,37 +1516,67 @@ function tricube(u) {
|
|
|
1513
1516
|
const t = 1 - uu * uu * uu;
|
|
1514
1517
|
return t * t * t;
|
|
1515
1518
|
}
|
|
1519
|
+
function stratifiedSample(sortedData, maxSamples) {
|
|
1520
|
+
const n = sortedData.length;
|
|
1521
|
+
if (n <= maxSamples) return sortedData;
|
|
1522
|
+
const sampled = [],
|
|
1523
|
+
step = n / maxSamples;
|
|
1524
|
+
for (let i = 0; i < maxSamples; i++) {
|
|
1525
|
+
const idx = Math.min(Math.floor(i * step), n - 1);
|
|
1526
|
+
sampled.push(sortedData[idx]);
|
|
1527
|
+
}
|
|
1528
|
+
return sampled;
|
|
1529
|
+
}
|
|
1516
1530
|
function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
1531
|
+
var _a;
|
|
1517
1532
|
const span = options.span || .3,
|
|
1518
1533
|
degree = 0 === options.degree ? 0 : 1,
|
|
1534
|
+
alpha = null !== (_a = options.alpha) && void 0 !== _a ? _a : .05,
|
|
1519
1535
|
iterations = null == options.iterations ? 2 : options.iterations,
|
|
1520
|
-
|
|
1521
|
-
|
|
1536
|
+
maxSamples = options.maxSamples || 1e3,
|
|
1537
|
+
rawPoints = [];
|
|
1522
1538
|
visitPoints(data, x, y, (dx, dy) => {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1539
|
+
rawPoints.push({
|
|
1540
|
+
x: dx,
|
|
1541
|
+
y: dy
|
|
1542
|
+
});
|
|
1543
|
+
}), rawPoints.sort((a, b) => a.x - b.x);
|
|
1544
|
+
const sampledPoints = stratifiedSample(rawPoints, maxSamples),
|
|
1545
|
+
n = sampledPoints.length,
|
|
1546
|
+
ptsX = new Array(n),
|
|
1547
|
+
ptsY = new Array(n);
|
|
1548
|
+
for (let i = 0; i < n; i++) ptsX[i] = sampledPoints[i].x, ptsY[i] = sampledPoints[i].y;
|
|
1526
1549
|
function predictSingle(x0, robustWeights) {
|
|
1527
1550
|
if (0 === n) return 0;
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1551
|
+
let left = 0,
|
|
1552
|
+
right = n;
|
|
1553
|
+
for (; left < right;) {
|
|
1554
|
+
const mid = left + right >> 1;
|
|
1555
|
+
ptsX[mid] < x0 ? left = mid + 1 : right = mid;
|
|
1556
|
+
}
|
|
1534
1557
|
const m = Math.max(2, Math.min(n, Math.floor(span * n))),
|
|
1535
|
-
|
|
1536
|
-
|
|
1558
|
+
start = Math.max(0, left - Math.floor(m / 2)),
|
|
1559
|
+
end = Math.min(n, start + m),
|
|
1560
|
+
actualStart = Math.max(0, end - m);
|
|
1561
|
+
let maxDist = 0;
|
|
1562
|
+
const windowSize = end - actualStart,
|
|
1563
|
+
distances = new Array(windowSize);
|
|
1564
|
+
for (let i = actualStart; i < end; i++) {
|
|
1565
|
+
const dist = Math.abs(ptsX[i] - x0);
|
|
1566
|
+
distances[i - actualStart] = dist, dist > maxDist && (maxDist = dist);
|
|
1567
|
+
}
|
|
1537
1568
|
let sumw = 0;
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
let wi = tricube(0 === maxDist ? 0 :
|
|
1541
|
-
robustWeights && null != robustWeights[
|
|
1569
|
+
const w = new Array(windowSize);
|
|
1570
|
+
for (let i = 0; i < windowSize; i++) {
|
|
1571
|
+
let wi = tricube(0 === maxDist ? 0 : distances[i] / maxDist);
|
|
1572
|
+
robustWeights && null != robustWeights[actualStart + i] && (wi *= robustWeights[actualStart + i]), w[i] = wi, sumw += wi;
|
|
1573
|
+
}
|
|
1574
|
+
if (0 === sumw) {
|
|
1575
|
+
return ptsY[left < n ? left : n - 1];
|
|
1542
1576
|
}
|
|
1543
|
-
if (0 === sumw) return ptsY[dists[0].idx];
|
|
1544
1577
|
if (0 === degree) {
|
|
1545
1578
|
let s = 0;
|
|
1546
|
-
for (let i = 0; i <
|
|
1579
|
+
for (let i = 0; i < w.length; i++) s += w[i] * ptsY[actualStart + i];
|
|
1547
1580
|
return s / sumw;
|
|
1548
1581
|
}
|
|
1549
1582
|
let sw = 0,
|
|
@@ -1551,11 +1584,11 @@ function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
|
1551
1584
|
sy = 0,
|
|
1552
1585
|
sxx = 0,
|
|
1553
1586
|
sxy = 0;
|
|
1554
|
-
for (let i =
|
|
1555
|
-
const idx =
|
|
1556
|
-
xi = ptsX[
|
|
1557
|
-
yi = ptsY[
|
|
1558
|
-
wi = w[
|
|
1587
|
+
for (let i = actualStart; i < end; i++) {
|
|
1588
|
+
const idx = i - actualStart,
|
|
1589
|
+
xi = ptsX[i],
|
|
1590
|
+
yi = ptsY[i],
|
|
1591
|
+
wi = w[idx];
|
|
1559
1592
|
sw += wi, sx += wi * xi, sy += wi * yi, sxx += wi * xi * xi, sxy += wi * xi * yi;
|
|
1560
1593
|
}
|
|
1561
1594
|
const meanX = sx / sw,
|
|
@@ -1566,8 +1599,9 @@ function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
|
1566
1599
|
}
|
|
1567
1600
|
function predict(x0) {
|
|
1568
1601
|
if (Array.isArray(x0)) {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1602
|
+
const len = x0.length,
|
|
1603
|
+
out = new Array(len);
|
|
1604
|
+
for (let i = 0; i < len; i++) out[i] = predictSingle(x0[i]);
|
|
1571
1605
|
return out;
|
|
1572
1606
|
}
|
|
1573
1607
|
return predictSingle(x0);
|
|
@@ -1576,27 +1610,26 @@ function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
|
1576
1610
|
predict: predict,
|
|
1577
1611
|
evaluate: predict,
|
|
1578
1612
|
evaluateGrid: function (N) {
|
|
1579
|
-
|
|
1580
|
-
if (
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
max = -1
|
|
1584
|
-
for (let i = 0; i < n; i++) ptsX[i] < min && (min = ptsX[i]), ptsX[i] > max && (max = ptsX[i]);
|
|
1613
|
+
if (N <= 0) return [];
|
|
1614
|
+
if (0 === n) return [];
|
|
1615
|
+
const out = new Array(N),
|
|
1616
|
+
min = ptsX[0],
|
|
1617
|
+
max = ptsX[n - 1];
|
|
1585
1618
|
if (min === max) {
|
|
1586
1619
|
const v = predictSingle(min);
|
|
1587
|
-
for (let i = 0; i < N; i++) out
|
|
1620
|
+
for (let i = 0; i < N; i++) out[i] = {
|
|
1588
1621
|
x: min,
|
|
1589
1622
|
y: v
|
|
1590
|
-
}
|
|
1623
|
+
};
|
|
1591
1624
|
return out;
|
|
1592
1625
|
}
|
|
1593
1626
|
const step = (max - min) / (N - 1);
|
|
1594
1627
|
let robustWeights;
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
for (let i = 0; i < n; i++) res
|
|
1628
|
+
const effectiveIterations = null != options.iterations ? iterations : n > 500 ? 0 : iterations;
|
|
1629
|
+
if (effectiveIterations > 0) for (let iter = 0; iter < effectiveIterations; iter++) {
|
|
1630
|
+
const fits = new Array(n),
|
|
1631
|
+
res = new Array(n);
|
|
1632
|
+
for (let i = 0; i < n; i++) fits[i] = predictSingle(ptsX[i], robustWeights), res[i] = Math.abs(ptsY[i] - fits[i]);
|
|
1600
1633
|
const med = res.slice().sort((a, b) => a - b)[Math.floor(n / 2)] || 0;
|
|
1601
1634
|
robustWeights = new Array(n);
|
|
1602
1635
|
for (let i = 0; i < n; i++) {
|
|
@@ -1607,21 +1640,20 @@ function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
|
1607
1640
|
}
|
|
1608
1641
|
for (let i = 0; i < N; i++) {
|
|
1609
1642
|
const px = i === N - 1 ? max : min + step * i;
|
|
1610
|
-
out
|
|
1643
|
+
out[i] = {
|
|
1611
1644
|
x: px,
|
|
1612
1645
|
y: predictSingle(px, robustWeights)
|
|
1613
|
-
}
|
|
1646
|
+
};
|
|
1614
1647
|
}
|
|
1615
1648
|
return out;
|
|
1616
1649
|
},
|
|
1617
|
-
confidenceInterval: function (N = 50
|
|
1650
|
+
confidenceInterval: function (N = 50) {
|
|
1618
1651
|
const out = [];
|
|
1619
1652
|
if (N <= 0) return out;
|
|
1620
1653
|
if (0 === n) return out;
|
|
1621
|
-
|
|
1622
|
-
max = -1
|
|
1623
|
-
|
|
1624
|
-
if (min === 1 / 0 || max === -1 / 0) return out;
|
|
1654
|
+
const min = ptsX[0],
|
|
1655
|
+
max = ptsX[n - 1];
|
|
1656
|
+
if (void 0 === min || void 0 === max || min === 1 / 0 || max === -1 / 0) return out;
|
|
1625
1657
|
const comps = computeLinearCIComponents(data, x, y, xx => predictSingle(xx));
|
|
1626
1658
|
if (0 === comps.n) return out;
|
|
1627
1659
|
const z = Math.abs(invNorm(1 - alpha / 2));
|
|
@@ -1691,10 +1723,11 @@ function solveLinearSystem(A, b) {
|
|
|
1691
1723
|
return x;
|
|
1692
1724
|
}
|
|
1693
1725
|
function regressionPolynomial(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
1694
|
-
var _a;
|
|
1726
|
+
var _a, _b;
|
|
1695
1727
|
let degree = null !== (_a = options.degree) && void 0 !== _a ? _a : 0;
|
|
1696
1728
|
degree < 0 && (degree = 0);
|
|
1697
|
-
const
|
|
1729
|
+
const alpha = null !== (_b = options.alpha) && void 0 !== _b ? _b : .05,
|
|
1730
|
+
m = degree + 1,
|
|
1698
1731
|
sums = new Array(2 * degree + 1).fill(0);
|
|
1699
1732
|
visitPoints(data, x, y, (dx, dy) => {
|
|
1700
1733
|
let xp = 1;
|
|
@@ -1754,7 +1787,7 @@ function regressionPolynomial(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
|
1754
1787
|
}
|
|
1755
1788
|
return out;
|
|
1756
1789
|
},
|
|
1757
|
-
confidenceInterval(N = 50
|
|
1790
|
+
confidenceInterval(N = 50) {
|
|
1758
1791
|
const out = [];
|
|
1759
1792
|
if (N <= 0) return out;
|
|
1760
1793
|
const comps = computeLinearCIComponents(data, x, y, predict);
|
|
@@ -7578,30 +7611,122 @@ function sortData(a, b, sortFields) {
|
|
|
7578
7611
|
return 0;
|
|
7579
7612
|
}
|
|
7580
7613
|
|
|
7614
|
+
const subBin = (data, options) => {
|
|
7615
|
+
var _a, _b, _c, _d;
|
|
7616
|
+
const {
|
|
7617
|
+
numBins: numBins,
|
|
7618
|
+
thresholds: thresholds,
|
|
7619
|
+
countName: countName,
|
|
7620
|
+
percentageName: percentageName,
|
|
7621
|
+
valuesName: valuesName,
|
|
7622
|
+
countField: countField,
|
|
7623
|
+
field: field,
|
|
7624
|
+
n: n,
|
|
7625
|
+
x0Name: x0Name,
|
|
7626
|
+
x1Name: x1Name
|
|
7627
|
+
} = options,
|
|
7628
|
+
groupField = options.groupField,
|
|
7629
|
+
usingGroup = Array.isArray(groupField) ? groupField.length > 0 : !!groupField,
|
|
7630
|
+
out = [];
|
|
7631
|
+
if (!usingGroup) for (let i = 0; i < numBins; i++) {
|
|
7632
|
+
const rec = {
|
|
7633
|
+
[x0Name]: thresholds[i],
|
|
7634
|
+
[x1Name]: thresholds[i + 1],
|
|
7635
|
+
[countName]: 0
|
|
7636
|
+
};
|
|
7637
|
+
options.includeValues && (rec[valuesName] = []), out.push(rec);
|
|
7638
|
+
}
|
|
7639
|
+
const binGroupCounts = usingGroup ? new Array(numBins).fill(0).map(() => new Map()) : [],
|
|
7640
|
+
binGroupValues = usingGroup ? new Array(numBins).fill(0).map(() => new Map()) : [],
|
|
7641
|
+
groupKeyOrder = [],
|
|
7642
|
+
groupKeySet = new Set(),
|
|
7643
|
+
groupRepr = new Map();
|
|
7644
|
+
for (let i = 0; i < n; i++) {
|
|
7645
|
+
const v = data[i][field];
|
|
7646
|
+
if (null == v) continue;
|
|
7647
|
+
const num = +v;
|
|
7648
|
+
if (Number.isFinite(num)) for (let j = 0; j < numBins; j++) {
|
|
7649
|
+
const left = thresholds[j],
|
|
7650
|
+
right = thresholds[j + 1];
|
|
7651
|
+
if (num >= left && num < right || j === numBins - 1 && num <= right) {
|
|
7652
|
+
const datumCount = null !== (_a = data[i][countField]) && void 0 !== _a ? _a : 1;
|
|
7653
|
+
if (usingGroup) {
|
|
7654
|
+
let gk;
|
|
7655
|
+
gk = isArray$1(groupField) ? groupField.map(f => String(data[i][f])).join("||") : String(data[i][groupField]);
|
|
7656
|
+
const m = binGroupCounts[j],
|
|
7657
|
+
prev = null !== (_b = m.get(gk)) && void 0 !== _b ? _b : 0;
|
|
7658
|
+
if (m.set(gk, prev + datumCount), groupKeySet.has(gk) || (groupKeySet.add(gk), groupKeyOrder.push(gk), isArray$1(groupField) ? groupRepr.set(gk, Object.fromEntries(groupField.map(f => [f, data[i][f]]))) : groupRepr.set(gk, data[i][groupField])), options && options.includeValues) {
|
|
7659
|
+
const vv = binGroupValues[j];
|
|
7660
|
+
vv.has(gk) || vv.set(gk, []);
|
|
7661
|
+
const arr = vv.get(gk);
|
|
7662
|
+
arr && arr.push(data[i]);
|
|
7663
|
+
}
|
|
7664
|
+
} else out[j][countName] += datumCount;
|
|
7665
|
+
options && options.includeValues && !usingGroup && out[j][valuesName].push(data[i]);
|
|
7666
|
+
break;
|
|
7667
|
+
}
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
let totalCount = 0;
|
|
7671
|
+
const finalOut = [];
|
|
7672
|
+
if (usingGroup) {
|
|
7673
|
+
for (let j = 0; j < numBins; j++) for (const gk of groupKeyOrder) {
|
|
7674
|
+
const sum = null !== (_c = binGroupCounts[j].get(gk)) && void 0 !== _c ? _c : 0,
|
|
7675
|
+
rec = {
|
|
7676
|
+
[x0Name]: thresholds[j],
|
|
7677
|
+
[x1Name]: thresholds[j + 1],
|
|
7678
|
+
[countName]: sum
|
|
7679
|
+
},
|
|
7680
|
+
repr = null !== (_d = groupRepr.get(gk)) && void 0 !== _d ? _d : {};
|
|
7681
|
+
if (isArray$1(groupField)) for (const f of groupField) rec[f] = repr[f];else groupField && (rec[groupField] = repr);
|
|
7682
|
+
options && options.includeValues && (rec[valuesName] = binGroupValues[j].get(gk) || []), finalOut.push(rec), totalCount += sum;
|
|
7683
|
+
}
|
|
7684
|
+
const denominator = totalCount;
|
|
7685
|
+
for (const r of finalOut) r[percentageName] = denominator > 0 ? r[countName] / denominator : 0;
|
|
7686
|
+
} else {
|
|
7687
|
+
for (let i = 0, len = out.length; i < len; i++) totalCount += out[i][countName];
|
|
7688
|
+
for (let i = 0, len = out.length; i < len; i++) out[i][percentageName] = totalCount > 0 ? out[i][countName] / totalCount : 0, finalOut.push(out[i]);
|
|
7689
|
+
}
|
|
7690
|
+
return finalOut;
|
|
7691
|
+
};
|
|
7581
7692
|
const bin = (data, options) => {
|
|
7582
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7693
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7583
7694
|
const field = null == options ? void 0 : options.field;
|
|
7584
7695
|
if (!field) return [];
|
|
7585
|
-
const
|
|
7696
|
+
const countField = options.countField,
|
|
7697
|
+
n = data.length;
|
|
7586
7698
|
let thresholds,
|
|
7587
7699
|
min = 1 / 0,
|
|
7588
7700
|
max = -1 / 0;
|
|
7589
|
-
if (
|
|
7701
|
+
if (options.extent) min = options.extent[0], max = options.extent[1];else for (let i = 0; i < n; i++) {
|
|
7590
7702
|
const v = data[i][field];
|
|
7591
7703
|
if (isNil$1(v)) continue;
|
|
7592
7704
|
const num = +v;
|
|
7593
7705
|
Number.isFinite(num) && (num < min && (min = num), num > max && (max = num));
|
|
7594
7706
|
}
|
|
7595
7707
|
if (!Number.isFinite(min) || !Number.isFinite(max) || 0 === n) return [];
|
|
7596
|
-
if (options
|
|
7708
|
+
if (options.thresholds && options.thresholds.length) thresholds = options.thresholds.slice(), thresholds.sort((a, b) => a - b);else if ("number" == typeof options.step && options.step > 0) {
|
|
7597
7709
|
const stepSize = options.step;
|
|
7598
7710
|
let startMin = min;
|
|
7599
|
-
for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin
|
|
7711
|
+
for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin <= max;) startMin += stepSize, thresholds.push(startMin);
|
|
7600
7712
|
} else {
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7713
|
+
let bins = options.bins && options.bins > 0 ? Math.floor(options.bins) : 10;
|
|
7714
|
+
if (max - min > 1) {
|
|
7715
|
+
const start = Math.floor(min),
|
|
7716
|
+
stepSizeInt = Math.ceil((max - start) / bins);
|
|
7717
|
+
thresholds = new Array(bins + 1);
|
|
7718
|
+
for (let i = 0; i <= bins; i++) if (thresholds[i] = start + stepSizeInt * i, thresholds[i] > max) {
|
|
7719
|
+
bins = i, thresholds.length = bins + 1;
|
|
7720
|
+
break;
|
|
7721
|
+
}
|
|
7722
|
+
} else {
|
|
7723
|
+
const stepSize = (max - min) / bins;
|
|
7724
|
+
thresholds = new Array(bins + 1);
|
|
7725
|
+
for (let i = 0; i <= bins; i++) if (thresholds[i] = min + stepSize * i, thresholds[i] > max) {
|
|
7726
|
+
bins = i, thresholds.length = bins + 1;
|
|
7727
|
+
break;
|
|
7728
|
+
}
|
|
7729
|
+
}
|
|
7605
7730
|
}
|
|
7606
7731
|
const numBins = Math.max(0, thresholds.length - 1);
|
|
7607
7732
|
if (0 === numBins) return [];
|
|
@@ -7609,26 +7734,35 @@ const bin = (data, options) => {
|
|
|
7609
7734
|
x1Name = null !== (_d = null === (_c = options.outputNames) || void 0 === _c ? void 0 : _c.x1) && void 0 !== _d ? _d : "x1",
|
|
7610
7735
|
countName = null !== (_f = null === (_e = options.outputNames) || void 0 === _e ? void 0 : _e.count) && void 0 !== _f ? _f : "count",
|
|
7611
7736
|
valuesName = null !== (_h = null === (_g = options.outputNames) || void 0 === _g ? void 0 : _g.values) && void 0 !== _h ? _h : "values",
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
[
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
}
|
|
7631
|
-
return
|
|
7737
|
+
percentageName = null !== (_k = null === (_j = options.outputNames) || void 0 === _j ? void 0 : _j.percentage) && void 0 !== _k ? _k : "percentage",
|
|
7738
|
+
facetField = isArray$1(null == options ? void 0 : options.facetField) ? null == options ? void 0 : options.facetField : (null == options ? void 0 : options.facetField) ? [options.facetField] : [],
|
|
7739
|
+
groupField = isArray$1(null == options ? void 0 : options.groupField) ? null == options ? void 0 : options.groupField : (null == options ? void 0 : options.groupField) ? [options.groupField] : [],
|
|
7740
|
+
normalizedGroupField = groupField.length ? groupField : void 0,
|
|
7741
|
+
subViewOptions = Object.assign(Object.assign({}, options), {
|
|
7742
|
+
numBins: numBins,
|
|
7743
|
+
thresholds: thresholds,
|
|
7744
|
+
countName: countName,
|
|
7745
|
+
percentageName: percentageName,
|
|
7746
|
+
valuesName: valuesName,
|
|
7747
|
+
countField: countField,
|
|
7748
|
+
field: field,
|
|
7749
|
+
n: n,
|
|
7750
|
+
x0Name: x0Name,
|
|
7751
|
+
x1Name: x1Name,
|
|
7752
|
+
groupField: normalizedGroupField
|
|
7753
|
+
});
|
|
7754
|
+
if (!facetField.length) return subBin(data, subViewOptions);
|
|
7755
|
+
const subViewMap = {};
|
|
7756
|
+
return data.forEach(dataItem => {
|
|
7757
|
+
const subViewKey = facetField.map(field => null == dataItem ? void 0 : dataItem[field]).join("-&&-");
|
|
7758
|
+
subViewMap[subViewKey] ? subViewMap[subViewKey].push(dataItem) : subViewMap[subViewKey] = [dataItem];
|
|
7759
|
+
}), Object.values(subViewMap).map(subDataset => {
|
|
7760
|
+
const combinedGroupField = [...groupField, ...facetField];
|
|
7761
|
+
return subBin(subDataset, Object.assign(Object.assign({}, subViewOptions), {
|
|
7762
|
+
groupField: combinedGroupField.length ? combinedGroupField : void 0,
|
|
7763
|
+
n: subDataset.length
|
|
7764
|
+
}));
|
|
7765
|
+
}).flat();
|
|
7632
7766
|
};
|
|
7633
7767
|
|
|
7634
7768
|
const boxplot = (data, options) => {
|
|
@@ -7688,26 +7822,16 @@ const boxplot = (data, options) => {
|
|
|
7688
7822
|
q3 = quantileSorted(sorted, .75),
|
|
7689
7823
|
iqr = q3 - q1,
|
|
7690
7824
|
lowerBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[0]) : q1 - whiskers * iqr,
|
|
7691
|
-
upperBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[1]) : q3 + whiskers * iqr
|
|
7692
|
-
|
|
7693
|
-
for (let i = 0; i < sorted.length; i++)
|
|
7694
|
-
lowerWhisker = sorted[i];
|
|
7695
|
-
break;
|
|
7696
|
-
}
|
|
7697
|
-
let upperWhisker = dataMax;
|
|
7698
|
-
for (let i = sorted.length - 1; i >= 0; i--) if (sorted[i] <= upperBound) {
|
|
7699
|
-
upperWhisker = sorted[i];
|
|
7700
|
-
break;
|
|
7701
|
-
}
|
|
7702
|
-
const outliers = [];
|
|
7703
|
-
for (let i = 0; i < sorted.length; i++) (sorted[i] < lowerWhisker || sorted[i] > upperWhisker) && outliers.push(sorted[i]);
|
|
7825
|
+
upperBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[1]) : q3 + whiskers * iqr,
|
|
7826
|
+
outliers = [];
|
|
7827
|
+
for (let i = 0; i < sorted.length; i++) (sorted[i] < lowerBound || sorted[i] > upperBound) && outliers.push(sorted[i]);
|
|
7704
7828
|
const obj = {},
|
|
7705
7829
|
representative = keyToGroup.get(key);
|
|
7706
7830
|
if (null !== keyName) obj[keyName] = representative;else if (isArray$1(groupField)) {
|
|
7707
7831
|
const groupObj = representative || {};
|
|
7708
7832
|
for (const f of groupField) obj[f] = groupObj[f];
|
|
7709
7833
|
}
|
|
7710
|
-
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] =
|
|
7834
|
+
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] = lowerBound, obj[upperWhiskerName] = upperBound, obj[outliersName] = outliers, includeValues && (obj[valuesName] = rawValues.get(key) || []), out.push(obj);
|
|
7711
7835
|
}
|
|
7712
7836
|
return out;
|
|
7713
7837
|
};
|
|
@@ -33881,9 +34005,10 @@ function autoRotate(items, rotateConfig) {
|
|
|
33881
34005
|
} = rotateConfig;
|
|
33882
34006
|
if (0 === labelRotateAngle.length || items.some(item => !!item.attribute.angle)) return;
|
|
33883
34007
|
let i = 0,
|
|
33884
|
-
n = 0
|
|
33885
|
-
|
|
33886
|
-
|
|
34008
|
+
n = 0,
|
|
34009
|
+
testAngle = labelRotateAngle;
|
|
34010
|
+
for (items.length > 2 && ("bottom" === orient || "top" === orient ? Math.abs(items[1].attribute.x - items[0].attribute.x) < items[0].attribute.fontSize / 2 && (testAngle = [labelRotateAngle[labelRotateAngle.length - 1]]) : Math.abs(items[1].attribute.y - items[0].attribute.y) < items[0].attribute.fontSize / 2 && (testAngle = [labelRotateAngle[labelRotateAngle.length - 1]])), testAngle && testAngle.length > 0 && (n = testAngle.length); i < n;) {
|
|
34011
|
+
const angle = testAngle[i++];
|
|
33887
34012
|
if (items.forEach(item => {
|
|
33888
34013
|
item.attribute.angle = degreeToRadian(angle);
|
|
33889
34014
|
}), tryRotate(orient, items), !hasIntersect(items)) break;
|
|
@@ -42729,12 +42854,26 @@ function canPlace($, bitmap, bound, checkBound = !0, pad = 0) {
|
|
|
42729
42854
|
return (!checkBound || !outOfBounds) && (outOfBounds && (range = clampRangeByBitmap($, range)), !bitmap.getRange(range));
|
|
42730
42855
|
}
|
|
42731
42856
|
function placeToCandidates($, bitmap, text, candidates = [], clampForce = !0, pad = 0, changePosition = !1) {
|
|
42732
|
-
|
|
42857
|
+
var _a, _b, _c, _d;
|
|
42858
|
+
const validCandidates = candidates.filter(candidate => isValid$1(candidate)),
|
|
42859
|
+
curX = null !== (_a = text.attribute.x) && void 0 !== _a ? _a : 0,
|
|
42860
|
+
curY = null !== (_b = text.attribute.y) && void 0 !== _b ? _b : 0,
|
|
42861
|
+
base = text.AABBBounds,
|
|
42862
|
+
candidateBounds = {
|
|
42863
|
+
x1: base.x1,
|
|
42864
|
+
x2: base.x2,
|
|
42865
|
+
y1: base.y1,
|
|
42866
|
+
y2: base.y2
|
|
42867
|
+
};
|
|
42868
|
+
let lastCandidate;
|
|
42733
42869
|
for (let i = 0; i < validCandidates.length; i++) {
|
|
42734
|
-
|
|
42735
|
-
|
|
42870
|
+
const c = validCandidates[i];
|
|
42871
|
+
lastCandidate = c;
|
|
42872
|
+
const dx = (null !== (_c = c.x) && void 0 !== _c ? _c : curX) - curX,
|
|
42873
|
+
dy = (null !== (_d = c.y) && void 0 !== _d ? _d : curY) - curY;
|
|
42874
|
+
if (candidateBounds.x1 = base.x1 + dx, candidateBounds.x2 = base.x2 + dx, candidateBounds.y1 = base.y1 + dy, candidateBounds.y2 = base.y2 + dy, canPlace($, bitmap, candidateBounds, clampForce, pad)) return bitmap.setRange(boundToRange($, candidateBounds, !0)), c;
|
|
42736
42875
|
}
|
|
42737
|
-
return !1;
|
|
42876
|
+
return changePosition && lastCandidate && text.setAttributes(lastCandidate), !1;
|
|
42738
42877
|
}
|
|
42739
42878
|
function place$2($, bitmap, s, attrs, text, bounds, labeling) {
|
|
42740
42879
|
var _a, _b;
|
|
@@ -43334,7 +43473,7 @@ class LabelBase extends AnimateComponent {
|
|
|
43334
43473
|
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
|
|
43335
43474
|
const filteredLabels = [],
|
|
43336
43475
|
overlapLabels = labels;
|
|
43337
|
-
if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
|
|
43476
|
+
if (!isBoolean$1(overlap) && isFunction$1(null == overlap ? void 0 : overlap.filterBeforeOverlap)) {
|
|
43338
43477
|
const getRelatedGraphic = this.getRelatedGraphic.bind(this);
|
|
43339
43478
|
labels.forEach(label => {
|
|
43340
43479
|
overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
|
|
@@ -43428,7 +43567,7 @@ class LabelBase extends AnimateComponent {
|
|
|
43428
43567
|
} = this.attribute;
|
|
43429
43568
|
for (let i = 0; i < texts.length; i++) {
|
|
43430
43569
|
const text = texts[i];
|
|
43431
|
-
if (!text) return;
|
|
43570
|
+
if (!text) return [];
|
|
43432
43571
|
const textData = text.attribute,
|
|
43433
43572
|
baseMark = this.getRelatedGraphic(textData);
|
|
43434
43573
|
if (!baseMark) continue;
|
|
@@ -44085,7 +44224,7 @@ class ArcLabel extends LabelBase {
|
|
|
44085
44224
|
}
|
|
44086
44225
|
_layout(texts) {
|
|
44087
44226
|
var _a, _b, _c;
|
|
44088
|
-
if (!texts || !texts.length) return;
|
|
44227
|
+
if (!texts || !texts.length) return [];
|
|
44089
44228
|
const labels = super._layout(texts),
|
|
44090
44229
|
textBoundsArray = labels.map(label => this.getGraphicBounds(label)),
|
|
44091
44230
|
ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), {
|
|
@@ -61533,7 +61672,7 @@ const lookup = (data, opt) => {
|
|
|
61533
61672
|
});
|
|
61534
61673
|
};
|
|
61535
61674
|
|
|
61536
|
-
const version = "2.0.11
|
|
61675
|
+
const version = "2.0.11";
|
|
61537
61676
|
|
|
61538
61677
|
const addVChartProperty = (data, op) => {
|
|
61539
61678
|
const context = op.beforeCall();
|
|
@@ -66356,6 +66495,9 @@ class CartesianAxis extends AxisComponent {
|
|
|
66356
66495
|
getScales() {
|
|
66357
66496
|
return this._scales;
|
|
66358
66497
|
}
|
|
66498
|
+
getInnerOffset() {
|
|
66499
|
+
return this._innerOffset;
|
|
66500
|
+
}
|
|
66359
66501
|
constructor(spec, options) {
|
|
66360
66502
|
super(spec, options);
|
|
66361
66503
|
this.type = ComponentTypeEnum.cartesianAxis;
|
|
@@ -75109,7 +75251,8 @@ const labelRuleMap = {
|
|
|
75109
75251
|
rect3d: barLabel,
|
|
75110
75252
|
arc3d: pieLabel,
|
|
75111
75253
|
treemap: treemapLabel,
|
|
75112
|
-
venn: vennLabel
|
|
75254
|
+
venn: vennLabel,
|
|
75255
|
+
boxPlot: boxPlotLabel
|
|
75113
75256
|
};
|
|
75114
75257
|
function defaultLabelConfig(rule, labelInfo) {
|
|
75115
75258
|
var _a;
|
|
@@ -75476,6 +75619,44 @@ function sankeyLabelOverlapStrategy(series) {
|
|
|
75476
75619
|
];
|
|
75477
75620
|
return strategy;
|
|
75478
75621
|
}
|
|
75622
|
+
function boxPlotLabel(labelInfo) {
|
|
75623
|
+
return {
|
|
75624
|
+
customLayoutFunc: (labels, texts, getRelatedGraphic) => {
|
|
75625
|
+
for (let i = 0; i < texts.length; i++) {
|
|
75626
|
+
const text = texts[i];
|
|
75627
|
+
const textData = labels[i];
|
|
75628
|
+
if (!text || !textData) {
|
|
75629
|
+
continue;
|
|
75630
|
+
}
|
|
75631
|
+
const baseBoxPlot = getRelatedGraphic(textData);
|
|
75632
|
+
const meadianLineIndex = baseBoxPlot.getSubGraphic().findIndex(sub => sub.name === 'median');
|
|
75633
|
+
if (meadianLineIndex !== -1) {
|
|
75634
|
+
const bbox = baseBoxPlot.getSubGraphic()[meadianLineIndex].AABBBounds;
|
|
75635
|
+
if (labelInfo.series.direction === 'horizontal') {
|
|
75636
|
+
text.setAttributes({
|
|
75637
|
+
x: bbox.x2 + text.AABBBounds.width() / 2,
|
|
75638
|
+
y: (bbox.y1 + bbox.y2) / 2
|
|
75639
|
+
});
|
|
75640
|
+
}
|
|
75641
|
+
else {
|
|
75642
|
+
text.setAttributes({
|
|
75643
|
+
x: (bbox.x1 + bbox.x2) / 2,
|
|
75644
|
+
y: bbox.y2 + text.AABBBounds.height() / 2
|
|
75645
|
+
});
|
|
75646
|
+
}
|
|
75647
|
+
}
|
|
75648
|
+
else {
|
|
75649
|
+
const bbox = baseBoxPlot.AABBBounds;
|
|
75650
|
+
text.setAttributes({
|
|
75651
|
+
x: (bbox.x1 + bbox.x2) / 2,
|
|
75652
|
+
y: (bbox.y1 + bbox.y2) / 2
|
|
75653
|
+
});
|
|
75654
|
+
}
|
|
75655
|
+
}
|
|
75656
|
+
return texts;
|
|
75657
|
+
}
|
|
75658
|
+
};
|
|
75659
|
+
}
|
|
75479
75660
|
|
|
75480
75661
|
const waterfall = {
|
|
75481
75662
|
seriesFieldName: {
|
|
@@ -75782,7 +75963,7 @@ var BOX_PLOT_TOOLTIP_KEYS;
|
|
|
75782
75963
|
|
|
75783
75964
|
const foldOutlierData = (data, op) => {
|
|
75784
75965
|
const result = [];
|
|
75785
|
-
const { outliersField, dimensionField } = op;
|
|
75966
|
+
const { outliersField, dimensionField, seriesField } = op;
|
|
75786
75967
|
const latestData = data[0].latestData || [];
|
|
75787
75968
|
latestData.forEach((d) => {
|
|
75788
75969
|
let outlierValues = d[outliersField];
|
|
@@ -75796,6 +75977,9 @@ const foldOutlierData = (data, op) => {
|
|
|
75796
75977
|
dimensionField.forEach(field => {
|
|
75797
75978
|
resData[field] = d[field];
|
|
75798
75979
|
});
|
|
75980
|
+
if (isValid$1(seriesField)) {
|
|
75981
|
+
resData[seriesField] = d[seriesField];
|
|
75982
|
+
}
|
|
75799
75983
|
return resData;
|
|
75800
75984
|
}));
|
|
75801
75985
|
});
|
|
@@ -76166,7 +76350,11 @@ class BoxPlotMark extends GlyphMark {
|
|
|
76166
76350
|
median: { type: 'line', defaultAttributes: { x: 0, y: 0 } }
|
|
76167
76351
|
};
|
|
76168
76352
|
this._positionChannels = BOX_PLOT_CHANNELS;
|
|
76169
|
-
this._channelEncoder =
|
|
76353
|
+
this._channelEncoder = {
|
|
76354
|
+
boxStroke: (val) => ({ box: { stroke: val } }),
|
|
76355
|
+
medianStroke: (val) => ({ median: { stroke: val } }),
|
|
76356
|
+
boxCornerRadius: (val) => ({ box: { cornerRadius: val } })
|
|
76357
|
+
};
|
|
76170
76358
|
this._positionEncoder = (glyphAttrs, datum, g) => {
|
|
76171
76359
|
var _a;
|
|
76172
76360
|
const { x = g.attribute.x, y = g.attribute.y, boxWidth = g.attribute.boxWidth, boxHeight = g.attribute.boxHeight, ruleWidth = g.attribute.ruleWidth, ruleHeight = g.attribute.ruleHeight, q1 = g.attribute.q1, q3 = g.attribute.q3, min = g.attribute.min, max = g.attribute.max, median = g.attribute.median, angle } = glyphAttrs;
|
|
@@ -76295,6 +76483,9 @@ class BoxPlotMark extends GlyphMark {
|
|
|
76295
76483
|
};
|
|
76296
76484
|
}
|
|
76297
76485
|
}
|
|
76486
|
+
setDataLabelType() {
|
|
76487
|
+
return 'symbol';
|
|
76488
|
+
}
|
|
76298
76489
|
_getDefaultStyle() {
|
|
76299
76490
|
const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { lineWidth: 2, boxWidth: 30, shaftWidth: 20, shaftShape: 'line' });
|
|
76300
76491
|
return defaultStyle;
|
|
@@ -76562,6 +76753,12 @@ const boxPlot = {
|
|
|
76562
76753
|
}
|
|
76563
76754
|
};
|
|
76564
76755
|
|
|
76756
|
+
class BoxPlotSeriesSpecTransformer extends BaseSeriesSpecTransformer {
|
|
76757
|
+
_transformLabelSpec(spec) {
|
|
76758
|
+
this._addMarkLabelSpec(spec, "boxPlot");
|
|
76759
|
+
}
|
|
76760
|
+
}
|
|
76761
|
+
|
|
76565
76762
|
const DEFAULT_STROKE_WIDTH = 2;
|
|
76566
76763
|
const DEFAULT_SHAFT_FILL_OPACITY = 0.5;
|
|
76567
76764
|
const DEFAULT_SHAFT_SHAPE = 'line';
|
|
@@ -76572,6 +76769,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76572
76769
|
constructor() {
|
|
76573
76770
|
super(...arguments);
|
|
76574
76771
|
this.type = SeriesTypeEnum.boxPlot;
|
|
76772
|
+
this.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76575
76773
|
this._bandPosition = 0;
|
|
76576
76774
|
}
|
|
76577
76775
|
getMinField() {
|
|
@@ -76632,14 +76830,13 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76632
76830
|
if (this._outliersField) {
|
|
76633
76831
|
this._outlierMark = this._createMark(BoxPlotSeries.mark.outlier, {
|
|
76634
76832
|
key: DEFAULT_DATA_INDEX,
|
|
76635
|
-
groupKey: this._seriesField
|
|
76636
|
-
dataView: this._outlierDataView.getDataView(),
|
|
76637
|
-
dataProductId: this._outlierDataView.getProductId()
|
|
76833
|
+
groupKey: this._seriesField
|
|
76638
76834
|
});
|
|
76835
|
+
this._outlierMark.setData(this._outlierData);
|
|
76639
76836
|
}
|
|
76640
76837
|
}
|
|
76641
76838
|
initMarkStyle() {
|
|
76642
|
-
var _a, _b, _c, _d, _e;
|
|
76839
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76643
76840
|
const boxPlotMark = this._boxPlotMark;
|
|
76644
76841
|
if (boxPlotMark) {
|
|
76645
76842
|
const commonBoxplotStyles = {
|
|
@@ -76673,8 +76870,9 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76673
76870
|
const outlierMark = this._outlierMark;
|
|
76674
76871
|
if (outlierMark) {
|
|
76675
76872
|
this.setMarkStyle(outlierMark, {
|
|
76676
|
-
fill: (_d = (_c = this._outliersStyle) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.getColorAttribute(),
|
|
76677
|
-
|
|
76873
|
+
fill: (_e = (_d = (_c = this._outliersStyle) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this._boxFillColor) !== null && _e !== void 0 ? _e : this.getColorAttribute(),
|
|
76874
|
+
stroke: this.getColorAttribute(),
|
|
76875
|
+
size: isNumber$1((_f = this._outliersStyle) === null || _f === void 0 ? void 0 : _f.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76678
76876
|
}, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
|
|
76679
76877
|
}
|
|
76680
76878
|
}
|
|
@@ -76723,6 +76921,18 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76723
76921
|
this.setMarkStyle(outlierMark, outlierMarkPositionChannel, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
|
|
76724
76922
|
}
|
|
76725
76923
|
}
|
|
76924
|
+
initLabelMarkStyle(textMark) {
|
|
76925
|
+
if (!textMark) {
|
|
76926
|
+
return;
|
|
76927
|
+
}
|
|
76928
|
+
this.setMarkStyle(textMark, {
|
|
76929
|
+
fill: this.getColorAttribute(),
|
|
76930
|
+
text: (datum) => {
|
|
76931
|
+
return datum[this.getMedianField()];
|
|
76932
|
+
},
|
|
76933
|
+
z: this._fieldZ ? this.dataToPositionZ.bind(this) : null
|
|
76934
|
+
});
|
|
76935
|
+
}
|
|
76726
76936
|
initData() {
|
|
76727
76937
|
super.initData();
|
|
76728
76938
|
if (!this._data) {
|
|
@@ -76739,7 +76949,8 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76739
76949
|
type: 'foldOutlierData',
|
|
76740
76950
|
options: {
|
|
76741
76951
|
dimensionField: this._direction === "horizontal" ? this._fieldY : this._fieldX,
|
|
76742
|
-
outliersField: this._outliersField
|
|
76952
|
+
outliersField: this._outliersField,
|
|
76953
|
+
seriesField: this._seriesField
|
|
76743
76954
|
}
|
|
76744
76955
|
});
|
|
76745
76956
|
outlierDataView.transform({
|
|
@@ -76749,12 +76960,17 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76749
76960
|
call: addDataKey
|
|
76750
76961
|
}
|
|
76751
76962
|
}, false);
|
|
76752
|
-
this.
|
|
76963
|
+
this._outlierData = new CompilableData(this._option, outlierDataView);
|
|
76753
76964
|
}
|
|
76754
76965
|
compileData() {
|
|
76755
76966
|
var _a;
|
|
76756
76967
|
super.compileData();
|
|
76757
|
-
(_a = this.
|
|
76968
|
+
(_a = this._outlierData) === null || _a === void 0 ? void 0 : _a.compile();
|
|
76969
|
+
}
|
|
76970
|
+
viewDataUpdate(d) {
|
|
76971
|
+
var _a;
|
|
76972
|
+
super.viewDataUpdate(d);
|
|
76973
|
+
(_a = this._outlierData) === null || _a === void 0 ? void 0 : _a.updateData();
|
|
76758
76974
|
}
|
|
76759
76975
|
init(option) {
|
|
76760
76976
|
super.init(option);
|
|
@@ -76876,10 +77092,6 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76876
77092
|
}
|
|
76877
77093
|
return fields;
|
|
76878
77094
|
}
|
|
76879
|
-
onEvaluateEnd(ctx) {
|
|
76880
|
-
super.onEvaluateEnd(ctx);
|
|
76881
|
-
this._outlierDataView.updateData();
|
|
76882
|
-
}
|
|
76883
77095
|
getDefaultShapeType() {
|
|
76884
77096
|
return 'square';
|
|
76885
77097
|
}
|
|
@@ -76890,6 +77102,7 @@ class BoxPlotSeries extends CartesianSeries {
|
|
|
76890
77102
|
BoxPlotSeries.type = SeriesTypeEnum.boxPlot;
|
|
76891
77103
|
BoxPlotSeries.builtInTheme = { boxPlot };
|
|
76892
77104
|
BoxPlotSeries.mark = boxPlotSeriesMark;
|
|
77105
|
+
BoxPlotSeries.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76893
77106
|
const registerBoxplotSeries = () => {
|
|
76894
77107
|
registerBoxPlotMark();
|
|
76895
77108
|
registerSymbolMark();
|
|
@@ -95816,6 +96029,14 @@ class Tooltip extends BaseComponent {
|
|
|
95816
96029
|
}
|
|
95817
96030
|
};
|
|
95818
96031
|
this._handleChartMouseOut = (params) => {
|
|
96032
|
+
var _a;
|
|
96033
|
+
if (this._cacheActiveType &&
|
|
96034
|
+
((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) &&
|
|
96035
|
+
(this._option.componentShowContent.tooltip === false ||
|
|
96036
|
+
(isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96037
|
+
this._option.componentShowContent.tooltip[this._cacheActiveType] === false))) {
|
|
96038
|
+
return;
|
|
96039
|
+
}
|
|
95819
96040
|
if (this._alwaysShow || this._isReleased || this._isEnterTooltip) {
|
|
95820
96041
|
return;
|
|
95821
96042
|
}
|
|
@@ -95882,7 +96103,10 @@ class Tooltip extends BaseComponent {
|
|
|
95882
96103
|
for (let i = 0, len = supportedTooltip.length; i < len; i++) {
|
|
95883
96104
|
const type = supportedTooltip[i];
|
|
95884
96105
|
const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false;
|
|
95885
|
-
if (res) {
|
|
96106
|
+
if (res === 'unShowByOption') {
|
|
96107
|
+
success[type] = 'unShowByOption';
|
|
96108
|
+
}
|
|
96109
|
+
else if (res) {
|
|
95886
96110
|
success[type] = true;
|
|
95887
96111
|
break;
|
|
95888
96112
|
}
|
|
@@ -95895,23 +96119,19 @@ class Tooltip extends BaseComponent {
|
|
|
95895
96119
|
success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
|
|
95896
96120
|
}
|
|
95897
96121
|
}
|
|
95898
|
-
if (
|
|
95899
|
-
this.
|
|
96122
|
+
if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil$1(dimensionInfo))) {
|
|
96123
|
+
if (!this._cacheActiveType || success[this._cacheActiveType] !== 'unShowByOption') {
|
|
96124
|
+
this._handleChartMouseOut(params);
|
|
96125
|
+
}
|
|
95900
96126
|
}
|
|
95901
96127
|
else {
|
|
95902
96128
|
this._initEventOfTooltipContent();
|
|
95903
96129
|
}
|
|
95904
96130
|
};
|
|
95905
96131
|
this._showTooltipByMouseEvent = (activeType, mouseEventData, params, isClick, useCache) => {
|
|
95906
|
-
var _a
|
|
95907
|
-
if (
|
|
95908
|
-
|
|
95909
|
-
return false;
|
|
95910
|
-
}
|
|
95911
|
-
if (isObject$2(this._option.componentShowContent.tooltip) &&
|
|
95912
|
-
this._option.componentShowContent.tooltip[activeType] === false) {
|
|
95913
|
-
return false;
|
|
95914
|
-
}
|
|
96132
|
+
var _a;
|
|
96133
|
+
if (!this._showContentByEvent(activeType)) {
|
|
96134
|
+
return 'unShowByOption';
|
|
95915
96135
|
}
|
|
95916
96136
|
const processor = this.processor[activeType];
|
|
95917
96137
|
if (!processor.shouldHandleTooltip(params, mouseEventData.tooltipInfo[activeType])) {
|
|
@@ -95945,7 +96165,7 @@ class Tooltip extends BaseComponent {
|
|
|
95945
96165
|
}, this._spec.hideTimer);
|
|
95946
96166
|
}
|
|
95947
96167
|
}
|
|
95948
|
-
const vchart = (
|
|
96168
|
+
const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
|
|
95949
96169
|
if (success && VChart.globalConfig.uniqueTooltip && vchart) {
|
|
95950
96170
|
VChart.hideTooltip(vchart.id);
|
|
95951
96171
|
}
|
|
@@ -96170,6 +96390,19 @@ class Tooltip extends BaseComponent {
|
|
|
96170
96390
|
}
|
|
96171
96391
|
return throttle(callback, wait);
|
|
96172
96392
|
}
|
|
96393
|
+
_showContentByEvent(activeType) {
|
|
96394
|
+
var _a;
|
|
96395
|
+
if ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) {
|
|
96396
|
+
if (this._option.componentShowContent.tooltip === false) {
|
|
96397
|
+
return false;
|
|
96398
|
+
}
|
|
96399
|
+
if (isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96400
|
+
this._option.componentShowContent.tooltip[activeType] === false) {
|
|
96401
|
+
return false;
|
|
96402
|
+
}
|
|
96403
|
+
}
|
|
96404
|
+
return true;
|
|
96405
|
+
}
|
|
96173
96406
|
reInit(spec) {
|
|
96174
96407
|
var _a, _b, _c;
|
|
96175
96408
|
super.reInit(spec);
|
|
@@ -96200,6 +96433,7 @@ class Tooltip extends BaseComponent {
|
|
|
96200
96433
|
const result = showTooltip(datum, options, this);
|
|
96201
96434
|
if (result !== 'none') {
|
|
96202
96435
|
this._alwaysShow = !!(options === null || options === void 0 ? void 0 : options.alwaysShow);
|
|
96436
|
+
this._cacheActiveType = result;
|
|
96203
96437
|
}
|
|
96204
96438
|
return result;
|
|
96205
96439
|
}
|
|
@@ -96526,7 +96760,7 @@ class BaseCrossHair extends BaseComponent {
|
|
|
96526
96760
|
}
|
|
96527
96761
|
_registerEvent(eventName, isOut, click) {
|
|
96528
96762
|
var _a;
|
|
96529
|
-
if (
|
|
96763
|
+
if (((_a = this._option.componentShowContent) === null || _a === void 0 ? void 0 : _a.crosshair) === false) {
|
|
96530
96764
|
return;
|
|
96531
96765
|
}
|
|
96532
96766
|
const handler = isOut ? this._handleOutEvent : click ? this._handleClickInEvent : this._handleHoverInEvent;
|
|
@@ -96625,18 +96859,20 @@ class BaseCrossHair extends BaseComponent {
|
|
|
96625
96859
|
let y2 = -Infinity;
|
|
96626
96860
|
const { x: sx, y: sy } = this.getLayoutStartPoint();
|
|
96627
96861
|
bindingAxesIndex.forEach(idx => {
|
|
96862
|
+
var _a, _b;
|
|
96628
96863
|
(x1 = Infinity), (y1 = Infinity), (x2 = -Infinity), (y2 = -Infinity);
|
|
96629
96864
|
const axis = axesComponents.find(axis => axis.getSpecIndex() === idx);
|
|
96630
96865
|
if (!axis) {
|
|
96631
96866
|
return;
|
|
96632
96867
|
}
|
|
96868
|
+
const innerOffset = ((_b = (_a = axis).getInnerOffset) === null || _b === void 0 ? void 0 : _b.call(_a)) || { left: 0, right: 0, top: 0, bottom: 0 };
|
|
96633
96869
|
const regions = axis.getRegions();
|
|
96634
96870
|
regions.forEach(r => {
|
|
96635
96871
|
const { x: regionStartX, y: regionStartY } = r.getLayoutStartPoint();
|
|
96636
|
-
x1 = Math.min(x1, regionStartX - sx);
|
|
96637
|
-
y1 = Math.min(y1, regionStartY - sy);
|
|
96638
|
-
x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx);
|
|
96639
|
-
y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy);
|
|
96872
|
+
x1 = Math.min(x1, regionStartX - sx + innerOffset.left);
|
|
96873
|
+
y1 = Math.min(y1, regionStartY - sy + innerOffset.top);
|
|
96874
|
+
x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx - innerOffset.right);
|
|
96875
|
+
y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy - innerOffset.bottom);
|
|
96640
96876
|
});
|
|
96641
96877
|
map.set(idx, { x1, y1, x2, y2, axis: axis });
|
|
96642
96878
|
});
|