@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.
Files changed (72) hide show
  1. package/build/es5/index.js +2 -2
  2. package/build/index.es.js +353 -126
  3. package/build/index.js +353 -126
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/index.js +1 -1
  7. package/cjs/chart/stack.js +1 -1
  8. package/cjs/chart/util.js +1 -1
  9. package/cjs/component/axis/cartesian/axis.d.ts +6 -0
  10. package/cjs/component/axis/cartesian/axis.js +3 -0
  11. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  12. package/cjs/component/crosshair/base.js +11 -3
  13. package/cjs/component/crosshair/base.js.map +1 -1
  14. package/cjs/component/label/util.d.ts +6 -1
  15. package/cjs/component/label/util.js +34 -3
  16. package/cjs/component/label/util.js.map +1 -1
  17. package/cjs/component/tooltip/tooltip.d.ts +2 -1
  18. package/cjs/component/tooltip/tooltip.js +20 -12
  19. package/cjs/component/tooltip/tooltip.js.map +1 -1
  20. package/cjs/constant/attribute.js +2 -1
  21. package/cjs/constant/correlation.js +1 -2
  22. package/cjs/constant/waterfall.js +2 -1
  23. package/cjs/core/factory.js +1 -2
  24. package/cjs/core/index.d.ts +1 -1
  25. package/cjs/core/index.js +1 -1
  26. package/cjs/core/index.js.map +1 -1
  27. package/cjs/core/vchart.js +1 -1
  28. package/cjs/data/initialize.js +1 -1
  29. package/cjs/data/register.js +1 -1
  30. package/cjs/mark/box-plot.d.ts +1 -0
  31. package/cjs/mark/box-plot.js +3 -0
  32. package/cjs/mark/box-plot.js.map +1 -1
  33. package/cjs/series/box-plot/box-plot-transformer.d.ts +5 -0
  34. package/cjs/series/box-plot/box-plot-transformer.js +16 -0
  35. package/cjs/series/box-plot/box-plot-transformer.js.map +1 -0
  36. package/cjs/series/box-plot/box-plot.d.ts +5 -1
  37. package/cjs/series/box-plot/box-plot.js +11 -3
  38. package/cjs/series/box-plot/box-plot.js.map +1 -1
  39. package/esm/chart/index.js +1 -1
  40. package/esm/chart/stack.js +1 -1
  41. package/esm/chart/util.js +1 -1
  42. package/esm/component/axis/cartesian/axis.d.ts +6 -0
  43. package/esm/component/axis/cartesian/axis.js +3 -0
  44. package/esm/component/axis/cartesian/axis.js.map +1 -1
  45. package/esm/component/crosshair/base.js +11 -3
  46. package/esm/component/crosshair/base.js.map +1 -1
  47. package/esm/component/label/util.d.ts +6 -1
  48. package/esm/component/label/util.js +31 -1
  49. package/esm/component/label/util.js.map +1 -1
  50. package/esm/component/tooltip/tooltip.d.ts +2 -1
  51. package/esm/component/tooltip/tooltip.js +18 -12
  52. package/esm/component/tooltip/tooltip.js.map +1 -1
  53. package/esm/constant/attribute.js +2 -1
  54. package/esm/constant/correlation.js +1 -2
  55. package/esm/constant/waterfall.js +2 -1
  56. package/esm/core/factory.js +1 -2
  57. package/esm/core/index.d.ts +1 -1
  58. package/esm/core/index.js +1 -1
  59. package/esm/core/index.js.map +1 -1
  60. package/esm/core/vchart.js +1 -1
  61. package/esm/data/initialize.js +1 -1
  62. package/esm/data/register.js +1 -1
  63. package/esm/mark/box-plot.d.ts +1 -0
  64. package/esm/mark/box-plot.js +3 -0
  65. package/esm/mark/box-plot.js.map +1 -1
  66. package/esm/series/box-plot/box-plot-transformer.d.ts +5 -0
  67. package/esm/series/box-plot/box-plot-transformer.js +8 -0
  68. package/esm/series/box-plot/box-plot-transformer.js.map +1 -0
  69. package/esm/series/box-plot/box-plot.d.ts +5 -1
  70. package/esm/series/box-plot/box-plot.js +12 -2
  71. package/esm/series/box-plot/box-plot.js.map +1 -1
  72. package/package.json +9 -9
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, alpha = .05) {
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, alpha = .05) {
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
- ptsX = [],
1521
- ptsY = [];
1536
+ maxSamples = options.maxSamples || 1e3,
1537
+ rawPoints = [];
1522
1538
  visitPoints(data, x, y, (dx, dy) => {
1523
- ptsX.push(dx), ptsY.push(dy);
1524
- });
1525
- const n = ptsX.length;
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
- const dists = [];
1529
- for (let i = 0; i < n; i++) dists.push({
1530
- idx: i,
1531
- dist: Math.abs(ptsX[i] - x0)
1532
- });
1533
- dists.sort((a, b) => a.dist - b.dist);
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
- maxDist = dists[m - 1].dist || 0,
1536
- w = new Array(m);
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
- for (let i = 0; i < m; i++) {
1539
- const idx = dists[i].idx;
1540
- let wi = tricube(0 === maxDist ? 0 : dists[i].dist / maxDist);
1541
- robustWeights && null != robustWeights[idx] && (wi *= robustWeights[idx]), w[i] = wi, sumw += wi;
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 < m; i++) s += w[i] * ptsY[dists[i].idx];
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 = 0; i < m; i++) {
1555
- const idx = dists[i].idx,
1556
- xi = ptsX[idx],
1557
- yi = ptsY[idx],
1558
- wi = w[i];
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 out = [];
1570
- for (let i = 0; i < x0.length; i++) out.push(predictSingle(x0[i]));
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
- const out = [];
1580
- if (N <= 0) return out;
1581
- if (0 === n) return out;
1582
- let min = 1 / 0,
1583
- max = -1 / 0;
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.push({
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
- for (let iter = 0; iter < iterations; iter++) {
1596
- const fits = [];
1597
- for (let i = 0; i < n; i++) fits.push(predictSingle(ptsX[i], robustWeights));
1598
- const res = [];
1599
- for (let i = 0; i < n; i++) res.push(Math.abs(ptsY[i] - fits[i]));
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.push({
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, alpha = .05) {
1650
+ confidenceInterval: function (N = 50) {
1618
1651
  const out = [];
1619
1652
  if (N <= 0) return out;
1620
1653
  if (0 === n) return out;
1621
- let min = 1 / 0,
1622
- max = -1 / 0;
1623
- for (let i = 0; i < n; i++) ptsX[i] < min && (min = ptsX[i]), ptsX[i] > max && (max = ptsX[i]);
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 m = degree + 1,
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, alpha = .05) {
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 n = data.length;
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 (null == options ? void 0 : options.extent) min = options.extent[0], max = options.extent[1];else for (let i = 0; i < n; i++) {
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 && options.thresholds && options.thresholds.length) thresholds = options.thresholds.slice(), thresholds.sort((a, b) => a - b);else if (options && "number" == typeof options.step && options.step > 0) {
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 < max;) startMin += stepSize, thresholds.push(startMin);
7711
+ for (options.extent || (startMin = Math.floor(min / stepSize) * stepSize), thresholds = [startMin]; startMin <= max;) startMin += stepSize, thresholds.push(startMin);
7600
7712
  } else {
7601
- const bins = (null == options ? void 0 : options.bins) && options.bins > 0 ? Math.floor(options.bins) : 10,
7602
- stepSize = (max - min) / bins;
7603
- thresholds = new Array(bins + 1);
7604
- for (let i = 0; i <= bins; i++) thresholds[i] = i === bins ? max : min + stepSize * i;
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
- out = new Array(numBins);
7613
- for (let i = 0; i < numBins; i++) out[i] = {
7614
- [x0Name]: thresholds[i],
7615
- [x1Name]: thresholds[i + 1],
7616
- [countName]: 0
7617
- }, (null == options ? void 0 : options.includeValues) && (out[i][valuesName] = []);
7618
- for (let i = 0; i < n; i++) {
7619
- const v = data[i][field];
7620
- if (null == v) continue;
7621
- const num = +v;
7622
- if (Number.isFinite(num)) for (let j = 0; j < numBins; j++) {
7623
- const left = out[j][x0Name],
7624
- right = out[j][x1Name];
7625
- if (num >= left && num < right || j === numBins - 1 && num <= right) {
7626
- out[j][countName]++, options && options.includeValues && out[j][valuesName].push(data[i]);
7627
- break;
7628
- }
7629
- }
7630
- }
7631
- return out;
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
- let lowerWhisker = dataMin;
7693
- for (let i = 0; i < sorted.length; i++) if (sorted[i] >= lowerBound) {
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] = lowerWhisker, obj[upperWhiskerName] = upperWhisker, obj[outliersName] = outliers, includeValues && (obj[valuesName] = rawValues.get(key) || []), out.push(obj);
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
- for (labelRotateAngle && labelRotateAngle.length > 0 && (n = labelRotateAngle.length); i < n;) {
33886
- const angle = labelRotateAngle[i++];
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
- const validCandidates = candidates.filter(candidate => isValid$1(candidate));
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
- let measureText;
42735
- if (measureText = changePosition ? text : text.clone(), measureText.setAttributes(validCandidates[i]), canPlace($, bitmap, measureText.AABBBounds, clampForce, pad)) return bitmap.setRange(boundToRange($, measureText.AABBBounds, !0)), validCandidates[i];
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-alpha.6";
61675
+ const version = "2.0.10";
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: {
@@ -76295,6 +76476,9 @@ class BoxPlotMark extends GlyphMark {
76295
76476
  };
76296
76477
  }
76297
76478
  }
76479
+ setDataLabelType() {
76480
+ return 'symbol';
76481
+ }
76298
76482
  _getDefaultStyle() {
76299
76483
  const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { lineWidth: 2, boxWidth: 30, shaftWidth: 20, shaftShape: 'line' });
76300
76484
  return defaultStyle;
@@ -76562,6 +76746,12 @@ const boxPlot = {
76562
76746
  }
76563
76747
  };
76564
76748
 
76749
+ class BoxPlotSeriesSpecTransformer extends BaseSeriesSpecTransformer {
76750
+ _transformLabelSpec(spec) {
76751
+ this._addMarkLabelSpec(spec, "boxPlot");
76752
+ }
76753
+ }
76754
+
76565
76755
  const DEFAULT_STROKE_WIDTH = 2;
76566
76756
  const DEFAULT_SHAFT_FILL_OPACITY = 0.5;
76567
76757
  const DEFAULT_SHAFT_SHAPE = 'line';
@@ -76572,6 +76762,7 @@ class BoxPlotSeries extends CartesianSeries {
76572
76762
  constructor() {
76573
76763
  super(...arguments);
76574
76764
  this.type = SeriesTypeEnum.boxPlot;
76765
+ this.transformerConstructor = BoxPlotSeriesSpecTransformer;
76575
76766
  this._bandPosition = 0;
76576
76767
  }
76577
76768
  getMinField() {
@@ -76723,6 +76914,18 @@ class BoxPlotSeries extends CartesianSeries {
76723
76914
  this.setMarkStyle(outlierMark, outlierMarkPositionChannel, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
76724
76915
  }
76725
76916
  }
76917
+ initLabelMarkStyle(textMark) {
76918
+ if (!textMark) {
76919
+ return;
76920
+ }
76921
+ this.setMarkStyle(textMark, {
76922
+ fill: this.getColorAttribute(),
76923
+ text: (datum) => {
76924
+ return datum[this.getMedianField()];
76925
+ },
76926
+ z: this._fieldZ ? this.dataToPositionZ.bind(this) : null
76927
+ });
76928
+ }
76726
76929
  initData() {
76727
76930
  super.initData();
76728
76931
  if (!this._data) {
@@ -76890,6 +77093,7 @@ class BoxPlotSeries extends CartesianSeries {
76890
77093
  BoxPlotSeries.type = SeriesTypeEnum.boxPlot;
76891
77094
  BoxPlotSeries.builtInTheme = { boxPlot };
76892
77095
  BoxPlotSeries.mark = boxPlotSeriesMark;
77096
+ BoxPlotSeries.transformerConstructor = BoxPlotSeriesSpecTransformer;
76893
77097
  const registerBoxplotSeries = () => {
76894
77098
  registerBoxPlotMark();
76895
77099
  registerSymbolMark();
@@ -95816,6 +96020,14 @@ class Tooltip extends BaseComponent {
95816
96020
  }
95817
96021
  };
95818
96022
  this._handleChartMouseOut = (params) => {
96023
+ var _a;
96024
+ if (this._cacheActiveType &&
96025
+ ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) &&
96026
+ (this._option.componentShowContent.tooltip === false ||
96027
+ (isObject$2(this._option.componentShowContent.tooltip) &&
96028
+ this._option.componentShowContent.tooltip[this._cacheActiveType] === false))) {
96029
+ return;
96030
+ }
95819
96031
  if (this._alwaysShow || this._isReleased || this._isEnterTooltip) {
95820
96032
  return;
95821
96033
  }
@@ -95882,7 +96094,10 @@ class Tooltip extends BaseComponent {
95882
96094
  for (let i = 0, len = supportedTooltip.length; i < len; i++) {
95883
96095
  const type = supportedTooltip[i];
95884
96096
  const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false;
95885
- if (res) {
96097
+ if (res === 'unShowByOption') {
96098
+ success[type] = 'unShowByOption';
96099
+ }
96100
+ else if (res) {
95886
96101
  success[type] = true;
95887
96102
  break;
95888
96103
  }
@@ -95895,23 +96110,19 @@ class Tooltip extends BaseComponent {
95895
96110
  success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
95896
96111
  }
95897
96112
  }
95898
- if (!success.mark && !success.group && (!success.dimension || isNil$1(dimensionInfo))) {
95899
- this._handleChartMouseOut(params);
96113
+ if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil$1(dimensionInfo))) {
96114
+ if (!this._cacheActiveType || success[this._cacheActiveType] !== 'unShowByOption') {
96115
+ this._handleChartMouseOut(params);
96116
+ }
95900
96117
  }
95901
96118
  else {
95902
96119
  this._initEventOfTooltipContent();
95903
96120
  }
95904
96121
  };
95905
96122
  this._showTooltipByMouseEvent = (activeType, mouseEventData, params, isClick, useCache) => {
95906
- var _a, _b;
95907
- if ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) {
95908
- if (this._option.componentShowContent.tooltip === false) {
95909
- return false;
95910
- }
95911
- if (isObject$2(this._option.componentShowContent.tooltip) &&
95912
- this._option.componentShowContent.tooltip[activeType] === false) {
95913
- return false;
95914
- }
96123
+ var _a;
96124
+ if (!this._showContentByEvent(activeType)) {
96125
+ return 'unShowByOption';
95915
96126
  }
95916
96127
  const processor = this.processor[activeType];
95917
96128
  if (!processor.shouldHandleTooltip(params, mouseEventData.tooltipInfo[activeType])) {
@@ -95945,7 +96156,7 @@ class Tooltip extends BaseComponent {
95945
96156
  }, this._spec.hideTimer);
95946
96157
  }
95947
96158
  }
95948
- const vchart = (_b = this._option) === null || _b === void 0 ? void 0 : _b.globalInstance;
96159
+ const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
95949
96160
  if (success && VChart.globalConfig.uniqueTooltip && vchart) {
95950
96161
  VChart.hideTooltip(vchart.id);
95951
96162
  }
@@ -96170,6 +96381,19 @@ class Tooltip extends BaseComponent {
96170
96381
  }
96171
96382
  return throttle(callback, wait);
96172
96383
  }
96384
+ _showContentByEvent(activeType) {
96385
+ var _a;
96386
+ if ((_a = this._option) === null || _a === void 0 ? void 0 : _a.componentShowContent) {
96387
+ if (this._option.componentShowContent.tooltip === false) {
96388
+ return false;
96389
+ }
96390
+ if (isObject$2(this._option.componentShowContent.tooltip) &&
96391
+ this._option.componentShowContent.tooltip[activeType] === false) {
96392
+ return false;
96393
+ }
96394
+ }
96395
+ return true;
96396
+ }
96173
96397
  reInit(spec) {
96174
96398
  var _a, _b, _c;
96175
96399
  super.reInit(spec);
@@ -96200,6 +96424,7 @@ class Tooltip extends BaseComponent {
96200
96424
  const result = showTooltip(datum, options, this);
96201
96425
  if (result !== 'none') {
96202
96426
  this._alwaysShow = !!(options === null || options === void 0 ? void 0 : options.alwaysShow);
96427
+ this._cacheActiveType = result;
96203
96428
  }
96204
96429
  return result;
96205
96430
  }
@@ -96526,7 +96751,7 @@ class BaseCrossHair extends BaseComponent {
96526
96751
  }
96527
96752
  _registerEvent(eventName, isOut, click) {
96528
96753
  var _a;
96529
- if (!isOut && ((_a = this._option.componentShowContent) === null || _a === void 0 ? void 0 : _a.crosshair) === false) {
96754
+ if (((_a = this._option.componentShowContent) === null || _a === void 0 ? void 0 : _a.crosshair) === false) {
96530
96755
  return;
96531
96756
  }
96532
96757
  const handler = isOut ? this._handleOutEvent : click ? this._handleClickInEvent : this._handleHoverInEvent;
@@ -96625,18 +96850,20 @@ class BaseCrossHair extends BaseComponent {
96625
96850
  let y2 = -Infinity;
96626
96851
  const { x: sx, y: sy } = this.getLayoutStartPoint();
96627
96852
  bindingAxesIndex.forEach(idx => {
96853
+ var _a, _b;
96628
96854
  (x1 = Infinity), (y1 = Infinity), (x2 = -Infinity), (y2 = -Infinity);
96629
96855
  const axis = axesComponents.find(axis => axis.getSpecIndex() === idx);
96630
96856
  if (!axis) {
96631
96857
  return;
96632
96858
  }
96859
+ const innerOffset = ((_b = (_a = axis).getInnerOffset) === null || _b === void 0 ? void 0 : _b.call(_a)) || { left: 0, right: 0, top: 0, bottom: 0 };
96633
96860
  const regions = axis.getRegions();
96634
96861
  regions.forEach(r => {
96635
96862
  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);
96863
+ x1 = Math.min(x1, regionStartX - sx + innerOffset.left);
96864
+ y1 = Math.min(y1, regionStartY - sy + innerOffset.top);
96865
+ x2 = Math.max(x2, regionStartX + r.getLayoutRect().width - sx - innerOffset.right);
96866
+ y2 = Math.max(y2, regionStartY + r.getLayoutRect().height - sy - innerOffset.bottom);
96640
96867
  });
96641
96868
  map.set(idx, { x1, y1, x2, y2, axis: axis });
96642
96869
  });