@visactor/vchart 2.0.11-alpha.6 → 2.0.11-alpha.8
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 +353 -126
- package/build/index.js +353 -126
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/index.js +1 -1
- package/cjs/chart/stack.js +1 -1
- package/cjs/chart/util.js +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/constant/attribute.js +2 -1
- package/cjs/constant/correlation.js +1 -2
- package/cjs/constant/waterfall.js +2 -1
- package/cjs/core/factory.js +1 -2
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/mark/box-plot.d.ts +1 -0
- package/cjs/mark/box-plot.js +3 -0
- 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 +5 -1
- package/cjs/series/box-plot/box-plot.js +11 -3
- package/cjs/series/box-plot/box-plot.js.map +1 -1
- package/esm/chart/index.js +1 -1
- package/esm/chart/stack.js +1 -1
- package/esm/chart/util.js +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/constant/attribute.js +2 -1
- package/esm/constant/correlation.js +1 -2
- package/esm/constant/waterfall.js +2 -1
- package/esm/core/factory.js +1 -2
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/mark/box-plot.d.ts +1 -0
- package/esm/mark/box-plot.js +3 -0
- 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 +5 -1
- package/esm/series/box-plot/box-plot.js +12 -2
- package/esm/series/box-plot/box-plot.js.map +1 -1
- package/package.json +9 -9
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.
|
|
61681
|
+
const version = "2.0.10";
|
|
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: {
|
|
@@ -76301,6 +76482,9 @@
|
|
|
76301
76482
|
};
|
|
76302
76483
|
}
|
|
76303
76484
|
}
|
|
76485
|
+
setDataLabelType() {
|
|
76486
|
+
return 'symbol';
|
|
76487
|
+
}
|
|
76304
76488
|
_getDefaultStyle() {
|
|
76305
76489
|
const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { lineWidth: 2, boxWidth: 30, shaftWidth: 20, shaftShape: 'line' });
|
|
76306
76490
|
return defaultStyle;
|
|
@@ -76568,6 +76752,12 @@
|
|
|
76568
76752
|
}
|
|
76569
76753
|
};
|
|
76570
76754
|
|
|
76755
|
+
class BoxPlotSeriesSpecTransformer extends BaseSeriesSpecTransformer {
|
|
76756
|
+
_transformLabelSpec(spec) {
|
|
76757
|
+
this._addMarkLabelSpec(spec, "boxPlot");
|
|
76758
|
+
}
|
|
76759
|
+
}
|
|
76760
|
+
|
|
76571
76761
|
const DEFAULT_STROKE_WIDTH = 2;
|
|
76572
76762
|
const DEFAULT_SHAFT_FILL_OPACITY = 0.5;
|
|
76573
76763
|
const DEFAULT_SHAFT_SHAPE = 'line';
|
|
@@ -76578,6 +76768,7 @@
|
|
|
76578
76768
|
constructor() {
|
|
76579
76769
|
super(...arguments);
|
|
76580
76770
|
this.type = exports.SeriesTypeEnum.boxPlot;
|
|
76771
|
+
this.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76581
76772
|
this._bandPosition = 0;
|
|
76582
76773
|
}
|
|
76583
76774
|
getMinField() {
|
|
@@ -76729,6 +76920,18 @@
|
|
|
76729
76920
|
this.setMarkStyle(outlierMark, outlierMarkPositionChannel, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
|
|
76730
76921
|
}
|
|
76731
76922
|
}
|
|
76923
|
+
initLabelMarkStyle(textMark) {
|
|
76924
|
+
if (!textMark) {
|
|
76925
|
+
return;
|
|
76926
|
+
}
|
|
76927
|
+
this.setMarkStyle(textMark, {
|
|
76928
|
+
fill: this.getColorAttribute(),
|
|
76929
|
+
text: (datum) => {
|
|
76930
|
+
return datum[this.getMedianField()];
|
|
76931
|
+
},
|
|
76932
|
+
z: this._fieldZ ? this.dataToPositionZ.bind(this) : null
|
|
76933
|
+
});
|
|
76934
|
+
}
|
|
76732
76935
|
initData() {
|
|
76733
76936
|
super.initData();
|
|
76734
76937
|
if (!this._data) {
|
|
@@ -76896,6 +77099,7 @@
|
|
|
76896
77099
|
BoxPlotSeries.type = exports.SeriesTypeEnum.boxPlot;
|
|
76897
77100
|
BoxPlotSeries.builtInTheme = { boxPlot };
|
|
76898
77101
|
BoxPlotSeries.mark = boxPlotSeriesMark;
|
|
77102
|
+
BoxPlotSeries.transformerConstructor = BoxPlotSeriesSpecTransformer;
|
|
76899
77103
|
const registerBoxplotSeries = () => {
|
|
76900
77104
|
registerBoxPlotMark();
|
|
76901
77105
|
registerSymbolMark();
|
|
@@ -95822,6 +96026,14 @@
|
|
|
95822
96026
|
}
|
|
95823
96027
|
};
|
|
95824
96028
|
this._handleChartMouseOut = (params) => {
|
|
96029
|
+
var _a;
|
|
96030
|
+
if (this._cacheActiveType &&
|
|
96031
|
+
((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) &&
|
|
96032
|
+
(this._option.componentShowContent.tooltip === false ||
|
|
96033
|
+
(isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96034
|
+
this._option.componentShowContent.tooltip[this._cacheActiveType] === false))) {
|
|
96035
|
+
return;
|
|
96036
|
+
}
|
|
95825
96037
|
if (this._alwaysShow || this._isReleased || this._isEnterTooltip) {
|
|
95826
96038
|
return;
|
|
95827
96039
|
}
|
|
@@ -95888,7 +96100,10 @@
|
|
|
95888
96100
|
for (let i = 0, len = supportedTooltip.length; i < len; i++) {
|
|
95889
96101
|
const type = supportedTooltip[i];
|
|
95890
96102
|
const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false;
|
|
95891
|
-
if (res) {
|
|
96103
|
+
if (res === 'unShowByOption') {
|
|
96104
|
+
success[type] = 'unShowByOption';
|
|
96105
|
+
}
|
|
96106
|
+
else if (res) {
|
|
95892
96107
|
success[type] = true;
|
|
95893
96108
|
break;
|
|
95894
96109
|
}
|
|
@@ -95901,23 +96116,19 @@
|
|
|
95901
96116
|
success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
|
|
95902
96117
|
}
|
|
95903
96118
|
}
|
|
95904
|
-
if (
|
|
95905
|
-
this.
|
|
96119
|
+
if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil$1(dimensionInfo))) {
|
|
96120
|
+
if (!this._cacheActiveType || success[this._cacheActiveType] !== 'unShowByOption') {
|
|
96121
|
+
this._handleChartMouseOut(params);
|
|
96122
|
+
}
|
|
95906
96123
|
}
|
|
95907
96124
|
else {
|
|
95908
96125
|
this._initEventOfTooltipContent();
|
|
95909
96126
|
}
|
|
95910
96127
|
};
|
|
95911
96128
|
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
|
-
}
|
|
96129
|
+
var _a;
|
|
96130
|
+
if (!this._showContentByEvent(activeType)) {
|
|
96131
|
+
return 'unShowByOption';
|
|
95921
96132
|
}
|
|
95922
96133
|
const processor = this.processor[activeType];
|
|
95923
96134
|
if (!processor.shouldHandleTooltip(params, mouseEventData.tooltipInfo[activeType])) {
|
|
@@ -95951,7 +96162,7 @@
|
|
|
95951
96162
|
}, this._spec.hideTimer);
|
|
95952
96163
|
}
|
|
95953
96164
|
}
|
|
95954
|
-
const vchart = (
|
|
96165
|
+
const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
|
|
95955
96166
|
if (success && VChart.globalConfig.uniqueTooltip && vchart) {
|
|
95956
96167
|
VChart.hideTooltip(vchart.id);
|
|
95957
96168
|
}
|
|
@@ -96176,6 +96387,19 @@
|
|
|
96176
96387
|
}
|
|
96177
96388
|
return throttle(callback, wait);
|
|
96178
96389
|
}
|
|
96390
|
+
_showContentByEvent(activeType) {
|
|
96391
|
+
var _a;
|
|
96392
|
+
if ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) {
|
|
96393
|
+
if (this._option.componentShowContent.tooltip === false) {
|
|
96394
|
+
return false;
|
|
96395
|
+
}
|
|
96396
|
+
if (isObject$2(this._option.componentShowContent.tooltip) &&
|
|
96397
|
+
this._option.componentShowContent.tooltip[activeType] === false) {
|
|
96398
|
+
return false;
|
|
96399
|
+
}
|
|
96400
|
+
}
|
|
96401
|
+
return true;
|
|
96402
|
+
}
|
|
96179
96403
|
reInit(spec) {
|
|
96180
96404
|
var _a, _b, _c;
|
|
96181
96405
|
super.reInit(spec);
|
|
@@ -96206,6 +96430,7 @@
|
|
|
96206
96430
|
const result = showTooltip(datum, options, this);
|
|
96207
96431
|
if (result !== 'none') {
|
|
96208
96432
|
this._alwaysShow = !!(options === null || options === void 0 ? void 0 : options.alwaysShow);
|
|
96433
|
+
this._cacheActiveType = result;
|
|
96209
96434
|
}
|
|
96210
96435
|
return result;
|
|
96211
96436
|
}
|
|
@@ -96532,7 +96757,7 @@
|
|
|
96532
96757
|
}
|
|
96533
96758
|
_registerEvent(eventName, isOut, click) {
|
|
96534
96759
|
var _a;
|
|
96535
|
-
if (
|
|
96760
|
+
if (((_a = this._option.componentShowContent) === null || _a === void 0 ? void 0 : _a.crosshair) === false) {
|
|
96536
96761
|
return;
|
|
96537
96762
|
}
|
|
96538
96763
|
const handler = isOut ? this._handleOutEvent : click ? this._handleClickInEvent : this._handleHoverInEvent;
|
|
@@ -96631,18 +96856,20 @@
|
|
|
96631
96856
|
let y2 = -Infinity;
|
|
96632
96857
|
const { x: sx, y: sy } = this.getLayoutStartPoint();
|
|
96633
96858
|
bindingAxesIndex.forEach(idx => {
|
|
96859
|
+
var _a, _b;
|
|
96634
96860
|
(x1 = Infinity), (y1 = Infinity), (x2 = -Infinity), (y2 = -Infinity);
|
|
96635
96861
|
const axis = axesComponents.find(axis => axis.getSpecIndex() === idx);
|
|
96636
96862
|
if (!axis) {
|
|
96637
96863
|
return;
|
|
96638
96864
|
}
|
|
96865
|
+
const innerOffset = ((_b = (_a = axis).getInnerOffset) === null || _b === void 0 ? void 0 : _b.call(_a)) || { left: 0, right: 0, top: 0, bottom: 0 };
|
|
96639
96866
|
const regions = axis.getRegions();
|
|
96640
96867
|
regions.forEach(r => {
|
|
96641
96868
|
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);
|
|
96869
|
+
x1 = Math.min(x1, regionStartX - sx + innerOffset.left);
|
|
96870
|
+
y1 = Math.min(y1, regionStartY - sy + innerOffset.top);
|
|
96871
|
+
x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx - innerOffset.right);
|
|
96872
|
+
y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy - innerOffset.bottom);
|
|
96646
96873
|
});
|
|
96647
96874
|
map.set(idx, { x1, y1, x2, y2, axis: axis });
|
|
96648
96875
|
});
|