@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.js
CHANGED
|
@@ -1322,7 +1322,9 @@
|
|
|
1322
1322
|
}
|
|
1323
1323
|
return 0 === sst ? 0 : 1 - ssr / sst;
|
|
1324
1324
|
}
|
|
1325
|
-
function regressionLinear(data, x = d => d.x, y = d => d.y) {
|
|
1325
|
+
function regressionLinear(data, x = d => d.x, y = d => d.y, options) {
|
|
1326
|
+
var _a;
|
|
1327
|
+
const alpha = null !== (_a = null == options ? void 0 : options.alpha) && void 0 !== _a ? _a : .05;
|
|
1326
1328
|
let n = 0,
|
|
1327
1329
|
meanX = 0,
|
|
1328
1330
|
meanY = 0,
|
|
@@ -1364,7 +1366,7 @@
|
|
|
1364
1366
|
}
|
|
1365
1367
|
return out;
|
|
1366
1368
|
},
|
|
1367
|
-
confidenceInterval: function (N = 50
|
|
1369
|
+
confidenceInterval: function (N = 50) {
|
|
1368
1370
|
const out = [];
|
|
1369
1371
|
if (0 === comps.n || N <= 0) return out;
|
|
1370
1372
|
const z = invNorm(1 - alpha / 2);
|
|
@@ -1401,9 +1403,10 @@
|
|
|
1401
1403
|
}
|
|
1402
1404
|
|
|
1403
1405
|
function regressionLogistic(data, x = d => d.x, y = d => d.y, options) {
|
|
1404
|
-
var _a, _b;
|
|
1406
|
+
var _a, _b, _c;
|
|
1405
1407
|
const maxIter = null !== (_a = null == options ? void 0 : options.maxIteration) && void 0 !== _a ? _a : 25,
|
|
1406
1408
|
tol = null !== (_b = null == options ? void 0 : options.tol) && void 0 !== _b ? _b : 1e-6,
|
|
1409
|
+
alpha = null !== (_c = null == options ? void 0 : options.alpha) && void 0 !== _c ? _c : .05,
|
|
1407
1410
|
xs = [],
|
|
1408
1411
|
ys = [];
|
|
1409
1412
|
visitPoints(data, x, y, (dx, dy) => {
|
|
@@ -1475,7 +1478,7 @@
|
|
|
1475
1478
|
}
|
|
1476
1479
|
return out;
|
|
1477
1480
|
},
|
|
1478
|
-
confidenceInterval: function (N = 50
|
|
1481
|
+
confidenceInterval: function (N = 50) {
|
|
1479
1482
|
const out = [];
|
|
1480
1483
|
if (N <= 0) return out;
|
|
1481
1484
|
const comps = computeLinearCIComponents(data, x, y, predict);
|
|
@@ -1519,37 +1522,67 @@
|
|
|
1519
1522
|
const t = 1 - uu * uu * uu;
|
|
1520
1523
|
return t * t * t;
|
|
1521
1524
|
}
|
|
1525
|
+
function stratifiedSample(sortedData, maxSamples) {
|
|
1526
|
+
const n = sortedData.length;
|
|
1527
|
+
if (n <= maxSamples) return sortedData;
|
|
1528
|
+
const sampled = [],
|
|
1529
|
+
step = n / maxSamples;
|
|
1530
|
+
for (let i = 0; i < maxSamples; i++) {
|
|
1531
|
+
const idx = Math.min(Math.floor(i * step), n - 1);
|
|
1532
|
+
sampled.push(sortedData[idx]);
|
|
1533
|
+
}
|
|
1534
|
+
return sampled;
|
|
1535
|
+
}
|
|
1522
1536
|
function regressionLowess(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
1537
|
+
var _a;
|
|
1523
1538
|
const span = options.span || .3,
|
|
1524
1539
|
degree = 0 === options.degree ? 0 : 1,
|
|
1540
|
+
alpha = null !== (_a = options.alpha) && void 0 !== _a ? _a : .05,
|
|
1525
1541
|
iterations = null == options.iterations ? 2 : options.iterations,
|
|
1526
|
-
|
|
1527
|
-
|
|
1542
|
+
maxSamples = options.maxSamples || 1e3,
|
|
1543
|
+
rawPoints = [];
|
|
1528
1544
|
visitPoints(data, x, y, (dx, dy) => {
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1545
|
+
rawPoints.push({
|
|
1546
|
+
x: dx,
|
|
1547
|
+
y: dy
|
|
1548
|
+
});
|
|
1549
|
+
}), rawPoints.sort((a, b) => a.x - b.x);
|
|
1550
|
+
const sampledPoints = stratifiedSample(rawPoints, maxSamples),
|
|
1551
|
+
n = sampledPoints.length,
|
|
1552
|
+
ptsX = new Array(n),
|
|
1553
|
+
ptsY = new Array(n);
|
|
1554
|
+
for (let i = 0; i < n; i++) ptsX[i] = sampledPoints[i].x, ptsY[i] = sampledPoints[i].y;
|
|
1532
1555
|
function predictSingle(x0, robustWeights) {
|
|
1533
1556
|
if (0 === n) return 0;
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1557
|
+
let left = 0,
|
|
1558
|
+
right = n;
|
|
1559
|
+
for (; left < right;) {
|
|
1560
|
+
const mid = left + right >> 1;
|
|
1561
|
+
ptsX[mid] < x0 ? left = mid + 1 : right = mid;
|
|
1562
|
+
}
|
|
1540
1563
|
const m = Math.max(2, Math.min(n, Math.floor(span * n))),
|
|
1541
|
-
|
|
1542
|
-
|
|
1564
|
+
start = Math.max(0, left - Math.floor(m / 2)),
|
|
1565
|
+
end = Math.min(n, start + m),
|
|
1566
|
+
actualStart = Math.max(0, end - m);
|
|
1567
|
+
let maxDist = 0;
|
|
1568
|
+
const windowSize = end - actualStart,
|
|
1569
|
+
distances = new Array(windowSize);
|
|
1570
|
+
for (let i = actualStart; i < end; i++) {
|
|
1571
|
+
const dist = Math.abs(ptsX[i] - x0);
|
|
1572
|
+
distances[i - actualStart] = dist, dist > maxDist && (maxDist = dist);
|
|
1573
|
+
}
|
|
1543
1574
|
let sumw = 0;
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
let wi = tricube(0 === maxDist ? 0 :
|
|
1547
|
-
robustWeights && null != robustWeights[
|
|
1575
|
+
const w = new Array(windowSize);
|
|
1576
|
+
for (let i = 0; i < windowSize; i++) {
|
|
1577
|
+
let wi = tricube(0 === maxDist ? 0 : distances[i] / maxDist);
|
|
1578
|
+
robustWeights && null != robustWeights[actualStart + i] && (wi *= robustWeights[actualStart + i]), w[i] = wi, sumw += wi;
|
|
1579
|
+
}
|
|
1580
|
+
if (0 === sumw) {
|
|
1581
|
+
return ptsY[left < n ? left : n - 1];
|
|
1548
1582
|
}
|
|
1549
|
-
if (0 === sumw) return ptsY[dists[0].idx];
|
|
1550
1583
|
if (0 === degree) {
|
|
1551
1584
|
let s = 0;
|
|
1552
|
-
for (let i = 0; i <
|
|
1585
|
+
for (let i = 0; i < w.length; i++) s += w[i] * ptsY[actualStart + i];
|
|
1553
1586
|
return s / sumw;
|
|
1554
1587
|
}
|
|
1555
1588
|
let sw = 0,
|
|
@@ -1557,11 +1590,11 @@
|
|
|
1557
1590
|
sy = 0,
|
|
1558
1591
|
sxx = 0,
|
|
1559
1592
|
sxy = 0;
|
|
1560
|
-
for (let i =
|
|
1561
|
-
const idx =
|
|
1562
|
-
xi = ptsX[
|
|
1563
|
-
yi = ptsY[
|
|
1564
|
-
wi = w[
|
|
1593
|
+
for (let i = actualStart; i < end; i++) {
|
|
1594
|
+
const idx = i - actualStart,
|
|
1595
|
+
xi = ptsX[i],
|
|
1596
|
+
yi = ptsY[i],
|
|
1597
|
+
wi = w[idx];
|
|
1565
1598
|
sw += wi, sx += wi * xi, sy += wi * yi, sxx += wi * xi * xi, sxy += wi * xi * yi;
|
|
1566
1599
|
}
|
|
1567
1600
|
const meanX = sx / sw,
|
|
@@ -1572,8 +1605,9 @@
|
|
|
1572
1605
|
}
|
|
1573
1606
|
function predict(x0) {
|
|
1574
1607
|
if (Array.isArray(x0)) {
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1608
|
+
const len = x0.length,
|
|
1609
|
+
out = new Array(len);
|
|
1610
|
+
for (let i = 0; i < len; i++) out[i] = predictSingle(x0[i]);
|
|
1577
1611
|
return out;
|
|
1578
1612
|
}
|
|
1579
1613
|
return predictSingle(x0);
|
|
@@ -1582,27 +1616,26 @@
|
|
|
1582
1616
|
predict: predict,
|
|
1583
1617
|
evaluate: predict,
|
|
1584
1618
|
evaluateGrid: function (N) {
|
|
1585
|
-
|
|
1586
|
-
if (
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
max = -1
|
|
1590
|
-
for (let i = 0; i < n; i++) ptsX[i] < min && (min = ptsX[i]), ptsX[i] > max && (max = ptsX[i]);
|
|
1619
|
+
if (N <= 0) return [];
|
|
1620
|
+
if (0 === n) return [];
|
|
1621
|
+
const out = new Array(N),
|
|
1622
|
+
min = ptsX[0],
|
|
1623
|
+
max = ptsX[n - 1];
|
|
1591
1624
|
if (min === max) {
|
|
1592
1625
|
const v = predictSingle(min);
|
|
1593
|
-
for (let i = 0; i < N; i++) out
|
|
1626
|
+
for (let i = 0; i < N; i++) out[i] = {
|
|
1594
1627
|
x: min,
|
|
1595
1628
|
y: v
|
|
1596
|
-
}
|
|
1629
|
+
};
|
|
1597
1630
|
return out;
|
|
1598
1631
|
}
|
|
1599
1632
|
const step = (max - min) / (N - 1);
|
|
1600
1633
|
let robustWeights;
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
for (let i = 0; i < n; i++) res
|
|
1634
|
+
const effectiveIterations = null != options.iterations ? iterations : n > 500 ? 0 : iterations;
|
|
1635
|
+
if (effectiveIterations > 0) for (let iter = 0; iter < effectiveIterations; iter++) {
|
|
1636
|
+
const fits = new Array(n),
|
|
1637
|
+
res = new Array(n);
|
|
1638
|
+
for (let i = 0; i < n; i++) fits[i] = predictSingle(ptsX[i], robustWeights), res[i] = Math.abs(ptsY[i] - fits[i]);
|
|
1606
1639
|
const med = res.slice().sort((a, b) => a - b)[Math.floor(n / 2)] || 0;
|
|
1607
1640
|
robustWeights = new Array(n);
|
|
1608
1641
|
for (let i = 0; i < n; i++) {
|
|
@@ -1613,21 +1646,20 @@
|
|
|
1613
1646
|
}
|
|
1614
1647
|
for (let i = 0; i < N; i++) {
|
|
1615
1648
|
const px = i === N - 1 ? max : min + step * i;
|
|
1616
|
-
out
|
|
1649
|
+
out[i] = {
|
|
1617
1650
|
x: px,
|
|
1618
1651
|
y: predictSingle(px, robustWeights)
|
|
1619
|
-
}
|
|
1652
|
+
};
|
|
1620
1653
|
}
|
|
1621
1654
|
return out;
|
|
1622
1655
|
},
|
|
1623
|
-
confidenceInterval: function (N = 50
|
|
1656
|
+
confidenceInterval: function (N = 50) {
|
|
1624
1657
|
const out = [];
|
|
1625
1658
|
if (N <= 0) return out;
|
|
1626
1659
|
if (0 === n) return out;
|
|
1627
|
-
|
|
1628
|
-
max = -1
|
|
1629
|
-
|
|
1630
|
-
if (min === 1 / 0 || max === -1 / 0) return out;
|
|
1660
|
+
const min = ptsX[0],
|
|
1661
|
+
max = ptsX[n - 1];
|
|
1662
|
+
if (void 0 === min || void 0 === max || min === 1 / 0 || max === -1 / 0) return out;
|
|
1631
1663
|
const comps = computeLinearCIComponents(data, x, y, xx => predictSingle(xx));
|
|
1632
1664
|
if (0 === comps.n) return out;
|
|
1633
1665
|
const z = Math.abs(invNorm(1 - alpha / 2));
|
|
@@ -1697,10 +1729,11 @@
|
|
|
1697
1729
|
return x;
|
|
1698
1730
|
}
|
|
1699
1731
|
function regressionPolynomial(data, x = d => d.x, y = d => d.y, options = {}) {
|
|
1700
|
-
var _a;
|
|
1732
|
+
var _a, _b;
|
|
1701
1733
|
let degree = null !== (_a = options.degree) && void 0 !== _a ? _a : 0;
|
|
1702
1734
|
degree < 0 && (degree = 0);
|
|
1703
|
-
const
|
|
1735
|
+
const alpha = null !== (_b = options.alpha) && void 0 !== _b ? _b : .05,
|
|
1736
|
+
m = degree + 1,
|
|
1704
1737
|
sums = new Array(2 * degree + 1).fill(0);
|
|
1705
1738
|
visitPoints(data, x, y, (dx, dy) => {
|
|
1706
1739
|
let xp = 1;
|
|
@@ -1760,7 +1793,7 @@
|
|
|
1760
1793
|
}
|
|
1761
1794
|
return out;
|
|
1762
1795
|
},
|
|
1763
|
-
confidenceInterval(N = 50
|
|
1796
|
+
confidenceInterval(N = 50) {
|
|
1764
1797
|
const out = [];
|
|
1765
1798
|
if (N <= 0) return out;
|
|
1766
1799
|
const comps = computeLinearCIComponents(data, x, y, predict);
|
|
@@ -7584,30 +7617,122 @@
|
|
|
7584
7617
|
return 0;
|
|
7585
7618
|
}
|
|
7586
7619
|
|
|
7620
|
+
const subBin = (data, options) => {
|
|
7621
|
+
var _a, _b, _c, _d;
|
|
7622
|
+
const {
|
|
7623
|
+
numBins: numBins,
|
|
7624
|
+
thresholds: thresholds,
|
|
7625
|
+
countName: countName,
|
|
7626
|
+
percentageName: percentageName,
|
|
7627
|
+
valuesName: valuesName,
|
|
7628
|
+
countField: countField,
|
|
7629
|
+
field: field,
|
|
7630
|
+
n: n,
|
|
7631
|
+
x0Name: x0Name,
|
|
7632
|
+
x1Name: x1Name
|
|
7633
|
+
} = options,
|
|
7634
|
+
groupField = options.groupField,
|
|
7635
|
+
usingGroup = Array.isArray(groupField) ? groupField.length > 0 : !!groupField,
|
|
7636
|
+
out = [];
|
|
7637
|
+
if (!usingGroup) for (let i = 0; i < numBins; i++) {
|
|
7638
|
+
const rec = {
|
|
7639
|
+
[x0Name]: thresholds[i],
|
|
7640
|
+
[x1Name]: thresholds[i + 1],
|
|
7641
|
+
[countName]: 0
|
|
7642
|
+
};
|
|
7643
|
+
options.includeValues && (rec[valuesName] = []), out.push(rec);
|
|
7644
|
+
}
|
|
7645
|
+
const binGroupCounts = usingGroup ? new Array(numBins).fill(0).map(() => new Map()) : [],
|
|
7646
|
+
binGroupValues = usingGroup ? new Array(numBins).fill(0).map(() => new Map()) : [],
|
|
7647
|
+
groupKeyOrder = [],
|
|
7648
|
+
groupKeySet = new Set(),
|
|
7649
|
+
groupRepr = new Map();
|
|
7650
|
+
for (let i = 0; i < n; i++) {
|
|
7651
|
+
const v = data[i][field];
|
|
7652
|
+
if (null == v) continue;
|
|
7653
|
+
const num = +v;
|
|
7654
|
+
if (Number.isFinite(num)) for (let j = 0; j < numBins; j++) {
|
|
7655
|
+
const left = thresholds[j],
|
|
7656
|
+
right = thresholds[j + 1];
|
|
7657
|
+
if (num >= left && num < right || j === numBins - 1 && num <= right) {
|
|
7658
|
+
const datumCount = null !== (_a = data[i][countField]) && void 0 !== _a ? _a : 1;
|
|
7659
|
+
if (usingGroup) {
|
|
7660
|
+
let gk;
|
|
7661
|
+
gk = isArray$1(groupField) ? groupField.map(f => String(data[i][f])).join("||") : String(data[i][groupField]);
|
|
7662
|
+
const m = binGroupCounts[j],
|
|
7663
|
+
prev = null !== (_b = m.get(gk)) && void 0 !== _b ? _b : 0;
|
|
7664
|
+
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) {
|
|
7665
|
+
const vv = binGroupValues[j];
|
|
7666
|
+
vv.has(gk) || vv.set(gk, []);
|
|
7667
|
+
const arr = vv.get(gk);
|
|
7668
|
+
arr && arr.push(data[i]);
|
|
7669
|
+
}
|
|
7670
|
+
} else out[j][countName] += datumCount;
|
|
7671
|
+
options && options.includeValues && !usingGroup && out[j][valuesName].push(data[i]);
|
|
7672
|
+
break;
|
|
7673
|
+
}
|
|
7674
|
+
}
|
|
7675
|
+
}
|
|
7676
|
+
let totalCount = 0;
|
|
7677
|
+
const finalOut = [];
|
|
7678
|
+
if (usingGroup) {
|
|
7679
|
+
for (let j = 0; j < numBins; j++) for (const gk of groupKeyOrder) {
|
|
7680
|
+
const sum = null !== (_c = binGroupCounts[j].get(gk)) && void 0 !== _c ? _c : 0,
|
|
7681
|
+
rec = {
|
|
7682
|
+
[x0Name]: thresholds[j],
|
|
7683
|
+
[x1Name]: thresholds[j + 1],
|
|
7684
|
+
[countName]: sum
|
|
7685
|
+
},
|
|
7686
|
+
repr = null !== (_d = groupRepr.get(gk)) && void 0 !== _d ? _d : {};
|
|
7687
|
+
if (isArray$1(groupField)) for (const f of groupField) rec[f] = repr[f];else groupField && (rec[groupField] = repr);
|
|
7688
|
+
options && options.includeValues && (rec[valuesName] = binGroupValues[j].get(gk) || []), finalOut.push(rec), totalCount += sum;
|
|
7689
|
+
}
|
|
7690
|
+
const denominator = totalCount;
|
|
7691
|
+
for (const r of finalOut) r[percentageName] = denominator > 0 ? r[countName] / denominator : 0;
|
|
7692
|
+
} else {
|
|
7693
|
+
for (let i = 0, len = out.length; i < len; i++) totalCount += out[i][countName];
|
|
7694
|
+
for (let i = 0, len = out.length; i < len; i++) out[i][percentageName] = totalCount > 0 ? out[i][countName] / totalCount : 0, finalOut.push(out[i]);
|
|
7695
|
+
}
|
|
7696
|
+
return finalOut;
|
|
7697
|
+
};
|
|
7587
7698
|
const bin = (data, options) => {
|
|
7588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7699
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7589
7700
|
const field = null == options ? void 0 : options.field;
|
|
7590
7701
|
if (!field) return [];
|
|
7591
|
-
const
|
|
7702
|
+
const countField = options.countField,
|
|
7703
|
+
n = data.length;
|
|
7592
7704
|
let thresholds,
|
|
7593
7705
|
min = 1 / 0,
|
|
7594
7706
|
max = -1 / 0;
|
|
7595
|
-
if (
|
|
7707
|
+
if (options.extent) min = options.extent[0], max = options.extent[1];else for (let i = 0; i < n; i++) {
|
|
7596
7708
|
const v = data[i][field];
|
|
7597
7709
|
if (isNil$1(v)) continue;
|
|
7598
7710
|
const num = +v;
|
|
7599
7711
|
Number.isFinite(num) && (num < min && (min = num), num > max && (max = num));
|
|
7600
7712
|
}
|
|
7601
7713
|
if (!Number.isFinite(min) || !Number.isFinite(max) || 0 === n) return [];
|
|
7602
|
-
if (options
|
|
7714
|
+
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) {
|
|
7603
7715
|
const stepSize = options.step;
|
|
7604
7716
|
let startMin = min;
|
|
7605
|
-
for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin
|
|
7717
|
+
for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin <= max;) startMin += stepSize, thresholds.push(startMin);
|
|
7606
7718
|
} else {
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7719
|
+
let bins = options.bins && options.bins > 0 ? Math.floor(options.bins) : 10;
|
|
7720
|
+
if (max - min > 1) {
|
|
7721
|
+
const start = Math.floor(min),
|
|
7722
|
+
stepSizeInt = Math.ceil((max - start) / bins);
|
|
7723
|
+
thresholds = new Array(bins + 1);
|
|
7724
|
+
for (let i = 0; i <= bins; i++) if (thresholds[i] = start + stepSizeInt * i, thresholds[i] > max) {
|
|
7725
|
+
bins = i, thresholds.length = bins + 1;
|
|
7726
|
+
break;
|
|
7727
|
+
}
|
|
7728
|
+
} else {
|
|
7729
|
+
const stepSize = (max - min) / bins;
|
|
7730
|
+
thresholds = new Array(bins + 1);
|
|
7731
|
+
for (let i = 0; i <= bins; i++) if (thresholds[i] = min + stepSize * i, thresholds[i] > max) {
|
|
7732
|
+
bins = i, thresholds.length = bins + 1;
|
|
7733
|
+
break;
|
|
7734
|
+
}
|
|
7735
|
+
}
|
|
7611
7736
|
}
|
|
7612
7737
|
const numBins = Math.max(0, thresholds.length - 1);
|
|
7613
7738
|
if (0 === numBins) return [];
|
|
@@ -7615,26 +7740,35 @@
|
|
|
7615
7740
|
x1Name = null !== (_d = null === (_c = options.outputNames) || void 0 === _c ? void 0 : _c.x1) && void 0 !== _d ? _d : "x1",
|
|
7616
7741
|
countName = null !== (_f = null === (_e = options.outputNames) || void 0 === _e ? void 0 : _e.count) && void 0 !== _f ? _f : "count",
|
|
7617
7742
|
valuesName = null !== (_h = null === (_g = options.outputNames) || void 0 === _g ? void 0 : _g.values) && void 0 !== _h ? _h : "values",
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
[
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
}
|
|
7637
|
-
return
|
|
7743
|
+
percentageName = null !== (_k = null === (_j = options.outputNames) || void 0 === _j ? void 0 : _j.percentage) && void 0 !== _k ? _k : "percentage",
|
|
7744
|
+
facetField = isArray$1(null == options ? void 0 : options.facetField) ? null == options ? void 0 : options.facetField : (null == options ? void 0 : options.facetField) ? [options.facetField] : [],
|
|
7745
|
+
groupField = isArray$1(null == options ? void 0 : options.groupField) ? null == options ? void 0 : options.groupField : (null == options ? void 0 : options.groupField) ? [options.groupField] : [],
|
|
7746
|
+
normalizedGroupField = groupField.length ? groupField : void 0,
|
|
7747
|
+
subViewOptions = Object.assign(Object.assign({}, options), {
|
|
7748
|
+
numBins: numBins,
|
|
7749
|
+
thresholds: thresholds,
|
|
7750
|
+
countName: countName,
|
|
7751
|
+
percentageName: percentageName,
|
|
7752
|
+
valuesName: valuesName,
|
|
7753
|
+
countField: countField,
|
|
7754
|
+
field: field,
|
|
7755
|
+
n: n,
|
|
7756
|
+
x0Name: x0Name,
|
|
7757
|
+
x1Name: x1Name,
|
|
7758
|
+
groupField: normalizedGroupField
|
|
7759
|
+
});
|
|
7760
|
+
if (!facetField.length) return subBin(data, subViewOptions);
|
|
7761
|
+
const subViewMap = {};
|
|
7762
|
+
return data.forEach(dataItem => {
|
|
7763
|
+
const subViewKey = facetField.map(field => null == dataItem ? void 0 : dataItem[field]).join("-&&-");
|
|
7764
|
+
subViewMap[subViewKey] ? subViewMap[subViewKey].push(dataItem) : subViewMap[subViewKey] = [dataItem];
|
|
7765
|
+
}), Object.values(subViewMap).map(subDataset => {
|
|
7766
|
+
const combinedGroupField = [...groupField, ...facetField];
|
|
7767
|
+
return subBin(subDataset, Object.assign(Object.assign({}, subViewOptions), {
|
|
7768
|
+
groupField: combinedGroupField.length ? combinedGroupField : void 0,
|
|
7769
|
+
n: subDataset.length
|
|
7770
|
+
}));
|
|
7771
|
+
}).flat();
|
|
7638
7772
|
};
|
|
7639
7773
|
|
|
7640
7774
|
const boxplot = (data, options) => {
|
|
@@ -7694,26 +7828,16 @@
|
|
|
7694
7828
|
q3 = quantileSorted(sorted, .75),
|
|
7695
7829
|
iqr = q3 - q1,
|
|
7696
7830
|
lowerBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[0]) : q1 - whiskers * iqr,
|
|
7697
|
-
upperBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[1]) : q3 + whiskers * iqr
|
|
7698
|
-
|
|
7699
|
-
for (let i = 0; i < sorted.length; i++)
|
|
7700
|
-
lowerWhisker = sorted[i];
|
|
7701
|
-
break;
|
|
7702
|
-
}
|
|
7703
|
-
let upperWhisker = dataMax;
|
|
7704
|
-
for (let i = sorted.length - 1; i >= 0; i--) if (sorted[i] <= upperBound) {
|
|
7705
|
-
upperWhisker = sorted[i];
|
|
7706
|
-
break;
|
|
7707
|
-
}
|
|
7708
|
-
const outliers = [];
|
|
7709
|
-
for (let i = 0; i < sorted.length; i++) (sorted[i] < lowerWhisker || sorted[i] > upperWhisker) && outliers.push(sorted[i]);
|
|
7831
|
+
upperBound = isArray$1(whiskers) ? quantileSorted(sorted, whiskers[1]) : q3 + whiskers * iqr,
|
|
7832
|
+
outliers = [];
|
|
7833
|
+
for (let i = 0; i < sorted.length; i++) (sorted[i] < lowerBound || sorted[i] > upperBound) && outliers.push(sorted[i]);
|
|
7710
7834
|
const obj = {},
|
|
7711
7835
|
representative = keyToGroup.get(key);
|
|
7712
7836
|
if (null !== keyName) obj[keyName] = representative;else if (isArray$1(groupField)) {
|
|
7713
7837
|
const groupObj = representative || {};
|
|
7714
7838
|
for (const f of groupField) obj[f] = groupObj[f];
|
|
7715
7839
|
}
|
|
7716
|
-
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] =
|
|
7840
|
+
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);
|
|
7717
7841
|
}
|
|
7718
7842
|
return out;
|
|
7719
7843
|
};
|
|
@@ -33887,9 +34011,10 @@
|
|
|
33887
34011
|
} = rotateConfig;
|
|
33888
34012
|
if (0 === labelRotateAngle.length || items.some(item => !!item.attribute.angle)) return;
|
|
33889
34013
|
let i = 0,
|
|
33890
|
-
n = 0
|
|
33891
|
-
|
|
33892
|
-
|
|
34014
|
+
n = 0,
|
|
34015
|
+
testAngle = labelRotateAngle;
|
|
34016
|
+
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;) {
|
|
34017
|
+
const angle = testAngle[i++];
|
|
33893
34018
|
if (items.forEach(item => {
|
|
33894
34019
|
item.attribute.angle = degreeToRadian(angle);
|
|
33895
34020
|
}), tryRotate(orient, items), !hasIntersect(items)) break;
|
|
@@ -42735,12 +42860,26 @@
|
|
|
42735
42860
|
return (!checkBound || !outOfBounds) && (outOfBounds && (range = clampRangeByBitmap($, range)), !bitmap.getRange(range));
|
|
42736
42861
|
}
|
|
42737
42862
|
function placeToCandidates($, bitmap, text, candidates = [], clampForce = !0, pad = 0, changePosition = !1) {
|
|
42738
|
-
|
|
42863
|
+
var _a, _b, _c, _d;
|
|
42864
|
+
const validCandidates = candidates.filter(candidate => isValid$1(candidate)),
|
|
42865
|
+
curX = null !== (_a = text.attribute.x) && void 0 !== _a ? _a : 0,
|
|
42866
|
+
curY = null !== (_b = text.attribute.y) && void 0 !== _b ? _b : 0,
|
|
42867
|
+
base = text.AABBBounds,
|
|
42868
|
+
candidateBounds = {
|
|
42869
|
+
x1: base.x1,
|
|
42870
|
+
x2: base.x2,
|
|
42871
|
+
y1: base.y1,
|
|
42872
|
+
y2: base.y2
|
|
42873
|
+
};
|
|
42874
|
+
let lastCandidate;
|
|
42739
42875
|
for (let i = 0; i < validCandidates.length; i++) {
|
|
42740
|
-
|
|
42741
|
-
|
|
42876
|
+
const c = validCandidates[i];
|
|
42877
|
+
lastCandidate = c;
|
|
42878
|
+
const dx = (null !== (_c = c.x) && void 0 !== _c ? _c : curX) - curX,
|
|
42879
|
+
dy = (null !== (_d = c.y) && void 0 !== _d ? _d : curY) - curY;
|
|
42880
|
+
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;
|
|
42742
42881
|
}
|
|
42743
|
-
return !1;
|
|
42882
|
+
return changePosition && lastCandidate && text.setAttributes(lastCandidate), !1;
|
|
42744
42883
|
}
|
|
42745
42884
|
function place$2($, bitmap, s, attrs, text, bounds, labeling) {
|
|
42746
42885
|
var _a, _b;
|
|
@@ -43340,7 +43479,7 @@
|
|
|
43340
43479
|
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
|
|
43341
43480
|
const filteredLabels = [],
|
|
43342
43481
|
overlapLabels = labels;
|
|
43343
|
-
if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
|
|
43482
|
+
if (!isBoolean$1(overlap) && isFunction$1(null == overlap ? void 0 : overlap.filterBeforeOverlap)) {
|
|
43344
43483
|
const getRelatedGraphic = this.getRelatedGraphic.bind(this);
|
|
43345
43484
|
labels.forEach(label => {
|
|
43346
43485
|
overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
|
|
@@ -43434,7 +43573,7 @@
|
|
|
43434
43573
|
} = this.attribute;
|
|
43435
43574
|
for (let i = 0; i < texts.length; i++) {
|
|
43436
43575
|
const text = texts[i];
|
|
43437
|
-
if (!text) return;
|
|
43576
|
+
if (!text) return [];
|
|
43438
43577
|
const textData = text.attribute,
|
|
43439
43578
|
baseMark = this.getRelatedGraphic(textData);
|
|
43440
43579
|
if (!baseMark) continue;
|
|
@@ -44091,7 +44230,7 @@
|
|
|
44091
44230
|
}
|
|
44092
44231
|
_layout(texts) {
|
|
44093
44232
|
var _a, _b, _c;
|
|
44094
|
-
if (!texts || !texts.length) return;
|
|
44233
|
+
if (!texts || !texts.length) return [];
|
|
44095
44234
|
const labels = super._layout(texts),
|
|
44096
44235
|
textBoundsArray = labels.map(label => this.getGraphicBounds(label)),
|
|
44097
44236
|
ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), {
|
|
@@ -61539,7 +61678,7 @@
|
|
|
61539
61678
|
});
|
|
61540
61679
|
};
|
|
61541
61680
|
|
|
61542
|
-
const version = "2.0.11
|
|
61681
|
+
const version = "2.0.11";
|
|
61543
61682
|
|
|
61544
61683
|
const addVChartProperty = (data, op) => {
|
|
61545
61684
|
const context = op.beforeCall();
|
|
@@ -66362,6 +66501,9 @@
|
|
|
66362
66501
|
getScales() {
|
|
66363
66502
|
return this._scales;
|
|
66364
66503
|
}
|
|
66504
|
+
getInnerOffset() {
|
|
66505
|
+
return this._innerOffset;
|
|
66506
|
+
}
|
|
66365
66507
|
constructor(spec, options) {
|
|
66366
66508
|
super(spec, options);
|
|
66367
66509
|
this.type = ComponentTypeEnum.cartesianAxis;
|
|
@@ -75115,7 +75257,8 @@
|
|
|
75115
75257
|
rect3d: barLabel,
|
|
75116
75258
|
arc3d: pieLabel,
|
|
75117
75259
|
treemap: treemapLabel,
|
|
75118
|
-
venn: vennLabel
|
|
75260
|
+
venn: vennLabel,
|
|
75261
|
+
boxPlot: boxPlotLabel
|
|
75119
75262
|
};
|
|
75120
75263
|
function defaultLabelConfig(rule, labelInfo) {
|
|
75121
75264
|
var _a;
|
|
@@ -75482,6 +75625,44 @@
|
|
|
75482
75625
|
];
|
|
75483
75626
|
return strategy;
|
|
75484
75627
|
}
|
|
75628
|
+
function boxPlotLabel(labelInfo) {
|
|
75629
|
+
return {
|
|
75630
|
+
customLayoutFunc: (labels, texts, getRelatedGraphic) => {
|
|
75631
|
+
for (let i = 0; i < texts.length; i++) {
|
|
75632
|
+
const text = texts[i];
|
|
75633
|
+
const textData = labels[i];
|
|
75634
|
+
if (!text || !textData) {
|
|
75635
|
+
continue;
|
|
75636
|
+
}
|
|
75637
|
+
const baseBoxPlot = getRelatedGraphic(textData);
|
|
75638
|
+
const meadianLineIndex = baseBoxPlot.getSubGraphic().findIndex(sub => sub.name === 'median');
|
|
75639
|
+
if (meadianLineIndex !== -1) {
|
|
75640
|
+
const bbox = baseBoxPlot.getSubGraphic()[meadianLineIndex].AABBBounds;
|
|
75641
|
+
if (labelInfo.series.direction === 'horizontal') {
|
|
75642
|
+
text.setAttributes({
|
|
75643
|
+
x: bbox.x2 + text.AABBBounds.width() / 2,
|
|
75644
|
+
y: (bbox.y1 + bbox.y2) / 2
|
|
75645
|
+
});
|
|
75646
|
+
}
|
|
75647
|
+
else {
|
|
75648
|
+
text.setAttributes({
|
|
75649
|
+
x: (bbox.x1 + bbox.x2) / 2,
|
|
75650
|
+
y: bbox.y2 + text.AABBBounds.height() / 2
|
|
75651
|
+
});
|
|
75652
|
+
}
|
|
75653
|
+
}
|
|
75654
|
+
else {
|
|
75655
|
+
const bbox = baseBoxPlot.AABBBounds;
|
|
75656
|
+
text.setAttributes({
|
|
75657
|
+
x: (bbox.x1 + bbox.x2) / 2,
|
|
75658
|
+
y: (bbox.y1 + bbox.y2) / 2
|
|
75659
|
+
});
|
|
75660
|
+
}
|
|
75661
|
+
}
|
|
75662
|
+
return texts;
|
|
75663
|
+
}
|
|
75664
|
+
};
|
|
75665
|
+
}
|
|
75485
75666
|
|
|
75486
75667
|
const waterfall = {
|
|
75487
75668
|
seriesFieldName: {
|
|
@@ -75788,7 +75969,7 @@
|
|
|
75788
75969
|
|
|
75789
75970
|
const foldOutlierData = (data, op) => {
|
|
75790
75971
|
const result = [];
|
|
75791
|
-
const { outliersField, dimensionField } = op;
|
|
75972
|
+
const { outliersField, dimensionField, seriesField } = op;
|
|
75792
75973
|
const latestData = data[0].latestData || [];
|
|
75793
75974
|
latestData.forEach((d) => {
|
|
75794
75975
|
let outlierValues = d[outliersField];
|
|
@@ -75802,6 +75983,9 @@
|
|
|
75802
75983
|
dimensionField.forEach(field => {
|
|
75803
75984
|
resData[field] = d[field];
|
|
75804
75985
|
});
|
|
75986
|
+
if (isValid$1(seriesField)) {
|
|
75987
|
+
resData[seriesField] = d[seriesField];
|
|
75988
|
+
}
|
|
75805
75989
|
return resData;
|
|
75806
75990
|
}));
|
|
75807
75991
|
});
|
|
@@ -76172,7 +76356,11 @@
|
|
|
76172
76356
|
median: { type: 'line', defaultAttributes: { x: 0, y: 0 } }
|
|
76173
76357
|
};
|
|
76174
76358
|
this._positionChannels = BOX_PLOT_CHANNELS;
|
|
76175
|
-
this._channelEncoder =
|
|
76359
|
+
this._channelEncoder = {
|
|
76360
|
+
boxStroke: (val) => ({ box: { stroke: val } }),
|
|
76361
|
+
medianStroke: (val) => ({ median: { stroke: val } }),
|
|
76362
|
+
boxCornerRadius: (val) => ({ box: { cornerRadius: val } })
|
|
76363
|
+
};
|
|
76176
76364
|
this._positionEncoder = (glyphAttrs, datum, g) => {
|
|
76177
76365
|
var _a;
|
|
76178
76366
|
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;
|
|
@@ -76301,6 +76489,9 @@
|
|
|
76301
76489
|
};
|
|
76302
76490
|
}
|
|
76303
76491
|
}
|
|
76492
|
+
setDataLabelType() {
|
|
76493
|
+
return 'symbol';
|
|
76494
|
+
}
|
|
76304
76495
|
_getDefaultStyle() {
|
|
76305
76496
|
const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { lineWidth: 2, boxWidth: 30, shaftWidth: 20, shaftShape: 'line' });
|
|
76306
76497
|
return defaultStyle;
|
|
@@ -76568,6 +76759,12 @@
|
|
|
76568
76759
|
}
|
|
76569
76760
|
};
|
|
76570
76761
|
|
|
76762
|
+
class BoxPlotSeriesSpecTransformer extends BaseSeriesSpecTransformer {
|
|
76763
|
+
_transformLabelSpec(spec) {
|
|
76764
|
+
this._addMarkLabelSpec(spec, "boxPlot");
|
|
76765
|
+
}
|
|
76766
|
+
}
|
|
76767
|
+
|
|
76571
76768
|
const DEFAULT_STROKE_WIDTH = 2;
|
|
76572
76769
|
const DEFAULT_SHAFT_FILL_OPACITY = 0.5;
|
|
76573
76770
|
const DEFAULT_SHAFT_SHAPE = 'line';
|
|
@@ -76578,6 +76775,7 @@
|
|
|
76578
76775
|
constructor() {
|
|
76579
76776
|
super(...arguments);
|
|
76580
76777
|
this.type = exports.SeriesTypeEnum.boxPlot;
|
|
76778
|
+
this.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76581
76779
|
this._bandPosition = 0;
|
|
76582
76780
|
}
|
|
76583
76781
|
getMinField() {
|
|
@@ -76638,14 +76836,13 @@
|
|
|
76638
76836
|
if (this._outliersField) {
|
|
76639
76837
|
this._outlierMark = this._createMark(BoxPlotSeries.mark.outlier, {
|
|
76640
76838
|
key: DEFAULT_DATA_INDEX,
|
|
76641
|
-
groupKey: this._seriesField
|
|
76642
|
-
dataView: this._outlierDataView.getDataView(),
|
|
76643
|
-
dataProductId: this._outlierDataView.getProductId()
|
|
76839
|
+
groupKey: this._seriesField
|
|
76644
76840
|
});
|
|
76841
|
+
this._outlierMark.setData(this._outlierData);
|
|
76645
76842
|
}
|
|
76646
76843
|
}
|
|
76647
76844
|
initMarkStyle() {
|
|
76648
|
-
var _a, _b, _c, _d, _e;
|
|
76845
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76649
76846
|
const boxPlotMark = this._boxPlotMark;
|
|
76650
76847
|
if (boxPlotMark) {
|
|
76651
76848
|
const commonBoxplotStyles = {
|
|
@@ -76679,8 +76876,9 @@
|
|
|
76679
76876
|
const outlierMark = this._outlierMark;
|
|
76680
76877
|
if (outlierMark) {
|
|
76681
76878
|
this.setMarkStyle(outlierMark, {
|
|
76682
|
-
fill: (_d = (_c = this._outliersStyle) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.getColorAttribute(),
|
|
76683
|
-
|
|
76879
|
+
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(),
|
|
76880
|
+
stroke: this.getColorAttribute(),
|
|
76881
|
+
size: isNumber$1((_f = this._outliersStyle) === null || _f === void 0 ? void 0 : _f.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
|
|
76684
76882
|
}, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
|
|
76685
76883
|
}
|
|
76686
76884
|
}
|
|
@@ -76729,6 +76927,18 @@
|
|
|
76729
76927
|
this.setMarkStyle(outlierMark, outlierMarkPositionChannel, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
|
|
76730
76928
|
}
|
|
76731
76929
|
}
|
|
76930
|
+
initLabelMarkStyle(textMark) {
|
|
76931
|
+
if (!textMark) {
|
|
76932
|
+
return;
|
|
76933
|
+
}
|
|
76934
|
+
this.setMarkStyle(textMark, {
|
|
76935
|
+
fill: this.getColorAttribute(),
|
|
76936
|
+
text: (datum) => {
|
|
76937
|
+
return datum[this.getMedianField()];
|
|
76938
|
+
},
|
|
76939
|
+
z: this._fieldZ ? this.dataToPositionZ.bind(this) : null
|
|
76940
|
+
});
|
|
76941
|
+
}
|
|
76732
76942
|
initData() {
|
|
76733
76943
|
super.initData();
|
|
76734
76944
|
if (!this._data) {
|
|
@@ -76745,7 +76955,8 @@
|
|
|
76745
76955
|
type: 'foldOutlierData',
|
|
76746
76956
|
options: {
|
|
76747
76957
|
dimensionField: this._direction === "horizontal" ? this._fieldY : this._fieldX,
|
|
76748
|
-
outliersField: this._outliersField
|
|
76958
|
+
outliersField: this._outliersField,
|
|
76959
|
+
seriesField: this._seriesField
|
|
76749
76960
|
}
|
|
76750
76961
|
});
|
|
76751
76962
|
outlierDataView.transform({
|
|
@@ -76755,12 +76966,17 @@
|
|
|
76755
76966
|
call: addDataKey
|
|
76756
76967
|
}
|
|
76757
76968
|
}, false);
|
|
76758
|
-
this.
|
|
76969
|
+
this._outlierData = new CompilableData(this._option, outlierDataView);
|
|
76759
76970
|
}
|
|
76760
76971
|
compileData() {
|
|
76761
76972
|
var _a;
|
|
76762
76973
|
super.compileData();
|
|
76763
|
-
(_a = this.
|
|
76974
|
+
(_a = this._outlierData) === null || _a === void 0 ? void 0 : _a.compile();
|
|
76975
|
+
}
|
|
76976
|
+
viewDataUpdate(d) {
|
|
76977
|
+
var _a;
|
|
76978
|
+
super.viewDataUpdate(d);
|
|
76979
|
+
(_a = this._outlierData) === null || _a === void 0 ? void 0 : _a.updateData();
|
|
76764
76980
|
}
|
|
76765
76981
|
init(option) {
|
|
76766
76982
|
super.init(option);
|
|
@@ -76882,10 +77098,6 @@
|
|
|
76882
77098
|
}
|
|
76883
77099
|
return fields;
|
|
76884
77100
|
}
|
|
76885
|
-
onEvaluateEnd(ctx) {
|
|
76886
|
-
super.onEvaluateEnd(ctx);
|
|
76887
|
-
this._outlierDataView.updateData();
|
|
76888
|
-
}
|
|
76889
77101
|
getDefaultShapeType() {
|
|
76890
77102
|
return 'square';
|
|
76891
77103
|
}
|
|
@@ -76896,6 +77108,7 @@
|
|
|
76896
77108
|
BoxPlotSeries.type = exports.SeriesTypeEnum.boxPlot;
|
|
76897
77109
|
BoxPlotSeries.builtInTheme = { boxPlot };
|
|
76898
77110
|
BoxPlotSeries.mark = boxPlotSeriesMark;
|
|
77111
|
+
BoxPlotSeries.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76899
77112
|
const registerBoxplotSeries = () => {
|
|
76900
77113
|
registerBoxPlotMark();
|
|
76901
77114
|
registerSymbolMark();
|
|
@@ -95822,6 +96035,14 @@
|
|
|
95822
96035
|
}
|
|
95823
96036
|
};
|
|
95824
96037
|
this._handleChartMouseOut = (params) => {
|
|
96038
|
+
var _a;
|
|
96039
|
+
if (this._cacheActiveType &&
|
|
96040
|
+
((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) &&
|
|
96041
|
+
(this._option.componentShowContent.tooltip === false ||
|
|
96042
|
+
(isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96043
|
+
this._option.componentShowContent.tooltip[this._cacheActiveType] === false))) {
|
|
96044
|
+
return;
|
|
96045
|
+
}
|
|
95825
96046
|
if (this._alwaysShow || this._isReleased || this._isEnterTooltip) {
|
|
95826
96047
|
return;
|
|
95827
96048
|
}
|
|
@@ -95888,7 +96109,10 @@
|
|
|
95888
96109
|
for (let i = 0, len = supportedTooltip.length; i < len; i++) {
|
|
95889
96110
|
const type = supportedTooltip[i];
|
|
95890
96111
|
const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false;
|
|
95891
|
-
if (res) {
|
|
96112
|
+
if (res === 'unShowByOption') {
|
|
96113
|
+
success[type] = 'unShowByOption';
|
|
96114
|
+
}
|
|
96115
|
+
else if (res) {
|
|
95892
96116
|
success[type] = true;
|
|
95893
96117
|
break;
|
|
95894
96118
|
}
|
|
@@ -95901,23 +96125,19 @@
|
|
|
95901
96125
|
success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
|
|
95902
96126
|
}
|
|
95903
96127
|
}
|
|
95904
|
-
if (
|
|
95905
|
-
this.
|
|
96128
|
+
if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil$1(dimensionInfo))) {
|
|
96129
|
+
if (!this._cacheActiveType || success[this._cacheActiveType] !== 'unShowByOption') {
|
|
96130
|
+
this._handleChartMouseOut(params);
|
|
96131
|
+
}
|
|
95906
96132
|
}
|
|
95907
96133
|
else {
|
|
95908
96134
|
this._initEventOfTooltipContent();
|
|
95909
96135
|
}
|
|
95910
96136
|
};
|
|
95911
96137
|
this._showTooltipByMouseEvent = (activeType, mouseEventData, params, isClick, useCache) => {
|
|
95912
|
-
var _a
|
|
95913
|
-
if (
|
|
95914
|
-
|
|
95915
|
-
return false;
|
|
95916
|
-
}
|
|
95917
|
-
if (isObject$2(this._option.componentShowContent.tooltip) &&
|
|
95918
|
-
this._option.componentShowContent.tooltip[activeType] === false) {
|
|
95919
|
-
return false;
|
|
95920
|
-
}
|
|
96138
|
+
var _a;
|
|
96139
|
+
if (!this._showContentByEvent(activeType)) {
|
|
96140
|
+
return 'unShowByOption';
|
|
95921
96141
|
}
|
|
95922
96142
|
const processor = this.processor[activeType];
|
|
95923
96143
|
if (!processor.shouldHandleTooltip(params, mouseEventData.tooltipInfo[activeType])) {
|
|
@@ -95951,7 +96171,7 @@
|
|
|
95951
96171
|
}, this._spec.hideTimer);
|
|
95952
96172
|
}
|
|
95953
96173
|
}
|
|
95954
|
-
const vchart = (
|
|
96174
|
+
const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
|
|
95955
96175
|
if (success && VChart.globalConfig.uniqueTooltip && vchart) {
|
|
95956
96176
|
VChart.hideTooltip(vchart.id);
|
|
95957
96177
|
}
|
|
@@ -96176,6 +96396,19 @@
|
|
|
96176
96396
|
}
|
|
96177
96397
|
return throttle(callback, wait);
|
|
96178
96398
|
}
|
|
96399
|
+
_showContentByEvent(activeType) {
|
|
96400
|
+
var _a;
|
|
96401
|
+
if ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) {
|
|
96402
|
+
if (this._option.componentShowContent.tooltip === false) {
|
|
96403
|
+
return false;
|
|
96404
|
+
}
|
|
96405
|
+
if (isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96406
|
+
this._option.componentShowContent.tooltip[activeType] === false) {
|
|
96407
|
+
return false;
|
|
96408
|
+
}
|
|
96409
|
+
}
|
|
96410
|
+
return true;
|
|
96411
|
+
}
|
|
96179
96412
|
reInit(spec) {
|
|
96180
96413
|
var _a, _b, _c;
|
|
96181
96414
|
super.reInit(spec);
|
|
@@ -96206,6 +96439,7 @@
|
|
|
96206
96439
|
const result = showTooltip(datum, options, this);
|
|
96207
96440
|
if (result !== 'none') {
|
|
96208
96441
|
this._alwaysShow = !!(options === null || options === void 0 ? void 0 : options.alwaysShow);
|
|
96442
|
+
this._cacheActiveType = result;
|
|
96209
96443
|
}
|
|
96210
96444
|
return result;
|
|
96211
96445
|
}
|
|
@@ -96532,7 +96766,7 @@
|
|
|
96532
96766
|
}
|
|
96533
96767
|
_registerEvent(eventName, isOut, click) {
|
|
96534
96768
|
var _a;
|
|
96535
|
-
if (
|
|
96769
|
+
if (((_a = this._option.componentShowContent) === null || _a === void 0 ? void 0 : _a.crosshair) === false) {
|
|
96536
96770
|
return;
|
|
96537
96771
|
}
|
|
96538
96772
|
const handler = isOut ? this._handleOutEvent : click ? this._handleClickInEvent : this._handleHoverInEvent;
|
|
@@ -96631,18 +96865,20 @@
|
|
|
96631
96865
|
let y2 = -Infinity;
|
|
96632
96866
|
const { x: sx, y: sy } = this.getLayoutStartPoint();
|
|
96633
96867
|
bindingAxesIndex.forEach(idx => {
|
|
96868
|
+
var _a, _b;
|
|
96634
96869
|
(x1 = Infinity), (y1 = Infinity), (x2 = -Infinity), (y2 = -Infinity);
|
|
96635
96870
|
const axis = axesComponents.find(axis => axis.getSpecIndex() === idx);
|
|
96636
96871
|
if (!axis) {
|
|
96637
96872
|
return;
|
|
96638
96873
|
}
|
|
96874
|
+
const innerOffset = ((_b = (_a = axis).getInnerOffset) === null || _b === void 0 ? void 0 : _b.call(_a)) || { left: 0, right: 0, top: 0, bottom: 0 };
|
|
96639
96875
|
const regions = axis.getRegions();
|
|
96640
96876
|
regions.forEach(r => {
|
|
96641
96877
|
const { x: regionStartX, y: regionStartY } = r.getLayoutStartPoint();
|
|
96642
|
-
x1 = Math.min(x1, regionStartX - sx);
|
|
96643
|
-
y1 = Math.min(y1, regionStartY - sy);
|
|
96644
|
-
x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx);
|
|
96645
|
-
y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy);
|
|
96878
|
+
x1 = Math.min(x1, regionStartX - sx + innerOffset.left);
|
|
96879
|
+
y1 = Math.min(y1, regionStartY - sy + innerOffset.top);
|
|
96880
|
+
x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx - innerOffset.right);
|
|
96881
|
+
y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy - innerOffset.bottom);
|
|
96646
96882
|
});
|
|
96647
96883
|
map.set(idx, { x1, y1, x2, y2, axis: axis });
|
|
96648
96884
|
});
|