@visactor/vchart 1.1.3-beta.1 → 1.1.4-beta.1

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/index.js CHANGED
@@ -870,7 +870,7 @@
870
870
  const max$3 = Math.max;
871
871
  const min$3 = Math.min;
872
872
  const sin$1 = Math.sin;
873
- const sqrt$2 = Math.sqrt;
873
+ const sqrt$3 = Math.sqrt;
874
874
  const pow$1 = Math.pow;
875
875
  function acos$1(x) {
876
876
  return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x);
@@ -924,13 +924,13 @@
924
924
  }
925
925
  class PointService {
926
926
  static distancePP(p1, p2) {
927
- return sqrt$2(pow$1(p1.x - p2.x, 2) + pow$1(p1.y - p2.y, 2));
927
+ return sqrt$3(pow$1(p1.x - p2.x, 2) + pow$1(p1.y - p2.y, 2));
928
928
  }
929
929
  static distanceNN(x, y, x1, y1) {
930
- return sqrt$2(pow$1(x - x1, 2) + pow$1(y - y1, 2));
930
+ return sqrt$3(pow$1(x - x1, 2) + pow$1(y - y1, 2));
931
931
  }
932
932
  static distancePN(point, x, y) {
933
- return sqrt$2(pow$1(x - point.x, 2) + pow$1(y - point.y, 2));
933
+ return sqrt$3(pow$1(x - point.x, 2) + pow$1(y - point.y, 2));
934
934
  }
935
935
  static pointAtPP(p1, p2, t) {
936
936
  return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
@@ -2681,7 +2681,7 @@
2681
2681
  var sign$1 = Math.sign || function (x) {
2682
2682
  return x > 0 ? 1 : x < 0 ? -1 : 0;
2683
2683
  };
2684
- var sqrt$1 = Math.sqrt;
2684
+ var sqrt$2 = Math.sqrt;
2685
2685
  var tan = Math.tan;
2686
2686
  function acos(x) {
2687
2687
  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
@@ -2796,7 +2796,7 @@
2796
2796
 
2797
2797
  // TODO return d
2798
2798
  function cartesianNormalizeInPlace(d) {
2799
- var l = sqrt$1(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
2799
+ var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
2800
2800
  d[0] /= l, d[1] /= l, d[2] /= l;
2801
2801
  }
2802
2802
 
@@ -3451,7 +3451,7 @@
3451
3451
  uu = cartesianDot(u, u),
3452
3452
  t2 = w * w - uu * (cartesianDot(A, A) - 1);
3453
3453
  if (t2 < 0) return;
3454
- var t = sqrt$1(t2),
3454
+ var t = sqrt$2(t2),
3455
3455
  q = cartesianScale(u, (-w - t) / uu);
3456
3456
  cartesianAddInPlace(q, A);
3457
3457
  q = spherical(q);
@@ -3813,7 +3813,7 @@
3813
3813
  function centroidPointLine(x, y) {
3814
3814
  var dx = x - x0$1,
3815
3815
  dy = y - y0$1,
3816
- z = sqrt$1(dx * dx + dy * dy);
3816
+ z = sqrt$2(dx * dx + dy * dy);
3817
3817
  X1 += z * (x0$1 + x) / 2;
3818
3818
  Y1 += z * (y0$1 + y) / 2;
3819
3819
  Z1 += z;
@@ -3835,7 +3835,7 @@
3835
3835
  function centroidPointRing(x, y) {
3836
3836
  var dx = x - x0$1,
3837
3837
  dy = y - y0$1,
3838
- z = sqrt$1(dx * dx + dy * dy);
3838
+ z = sqrt$2(dx * dx + dy * dy);
3839
3839
  X1 += z * (x0$1 + x) / 2;
3840
3840
  Y1 += z * (y0$1 + y) / 2;
3841
3841
  Z1 += z;
@@ -3925,7 +3925,7 @@
3925
3925
  }
3926
3926
  function lengthPoint(x, y) {
3927
3927
  x0 -= x, y0 -= y;
3928
- lengthSum.add(sqrt$1(x0 * x0 + y0 * y0));
3928
+ lengthSum.add(sqrt$2(x0 * x0 + y0 * y0));
3929
3929
  x0 = x, y0 = y;
3930
3930
  }
3931
3931
  var pathMeasure = lengthStream;
@@ -4128,7 +4128,7 @@
4128
4128
  var a = a0 + a1,
4129
4129
  b = b0 + b1,
4130
4130
  c = c0 + c1,
4131
- m = sqrt$1(a * a + b * b + c * c),
4131
+ m = sqrt$2(a * a + b * b + c * c),
4132
4132
  phi2 = asin(c /= m),
4133
4133
  lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),
4134
4134
  p = project(lambda2, phi2),
@@ -4331,7 +4331,7 @@
4331
4331
  return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
4332
4332
  };
4333
4333
  projection.precision = function (_) {
4334
- return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$1(delta2);
4334
+ return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$2(delta2);
4335
4335
  };
4336
4336
  projection.fitExtent = function (extent, object) {
4337
4337
  return fitExtent(projection, extent, object);
@@ -4394,9 +4394,9 @@
4394
4394
  // Are the parallels symmetrical around the Equator?
4395
4395
  if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);
4396
4396
  var c = 1 + sy0 * (2 * n - sy0),
4397
- r0 = sqrt$1(c) / n;
4397
+ r0 = sqrt$2(c) / n;
4398
4398
  function project(x, y) {
4399
- var r = sqrt$1(c - 2 * n * sin(y)) / n;
4399
+ var r = sqrt$2(c - 2 * n * sin(y)) / n;
4400
4400
  return [r * sin(x *= n), r0 - r * cos(x)];
4401
4401
  }
4402
4402
  project.invert = function (x, y) {
@@ -4533,7 +4533,7 @@
4533
4533
  }
4534
4534
  function azimuthalInvert(angle) {
4535
4535
  return function (x, y) {
4536
- var z = sqrt$1(x * x + y * y),
4536
+ var z = sqrt$2(x * x + y * y),
4537
4537
  c = angle(z),
4538
4538
  sc = sin(c),
4539
4539
  cc = cos(c);
@@ -4542,7 +4542,7 @@
4542
4542
  }
4543
4543
 
4544
4544
  var azimuthalEqualAreaRaw = azimuthalRaw(function (cxcy) {
4545
- return sqrt$1(2 / (1 + cxcy));
4545
+ return sqrt$2(2 / (1 + cxcy));
4546
4546
  });
4547
4547
  azimuthalEqualAreaRaw.invert = azimuthalInvert(function (z) {
4548
4548
  return 2 * asin(z / 2);
@@ -4620,7 +4620,7 @@
4620
4620
  }
4621
4621
  project.invert = function (x, y) {
4622
4622
  var fy = f - y,
4623
- r = sign$1(n) * sqrt$1(x * x + fy * fy),
4623
+ r = sign$1(n) * sqrt$2(x * x + fy * fy),
4624
4624
  l = atan2(x, abs(fy)) * sign$1(fy);
4625
4625
  if (fy * n < 0) l -= pi * sign$1(x) * sign$1(fy);
4626
4626
  return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi$1];
@@ -4653,7 +4653,7 @@
4653
4653
  var gy = g - y,
4654
4654
  l = atan2(x, abs(gy)) * sign$1(gy);
4655
4655
  if (gy * n < 0) l -= pi * sign$1(x) * sign$1(gy);
4656
- return [l / n, g - sign$1(n) * sqrt$1(x * x + gy * gy)];
4656
+ return [l / n, g - sign$1(n) * sqrt$2(x * x + gy * gy)];
4657
4657
  };
4658
4658
  return project;
4659
4659
  }
@@ -4665,7 +4665,7 @@
4665
4665
  A2 = -0.081106,
4666
4666
  A3 = 0.000893,
4667
4667
  A4 = 0.003796,
4668
- M = sqrt$1(3) / 2,
4668
+ M = sqrt$2(3) / 2,
4669
4669
  iterations = 12;
4670
4670
  function equalEarthRaw(lambda, phi) {
4671
4671
  var l = asin(M * sin(phi)),
@@ -8652,7 +8652,7 @@
8652
8652
  return x;
8653
8653
  }
8654
8654
  const generatePow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
8655
- const sqrt = x => x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
8655
+ const sqrt$1 = x => x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
8656
8656
  const square$3 = x => x < 0 ? -x * x : x * x;
8657
8657
  const logNegative = x => -Math.log(-x);
8658
8658
  const expNegative = x => -Math.exp(-x);
@@ -9121,7 +9121,7 @@
9121
9121
  return new PowScale().domain(this._domain, !0).range(this._range, !0).unknown(this._unknown).clamp(this.clamp(), null, !0).interpolate(this._interpolate, !0).exponent(this._exponent);
9122
9122
  }
9123
9123
  rescale(slience) {
9124
- return slience || (1 === this._exponent ? (this.transformer = identity$1, this.untransformer = identity$1) : .5 === this._exponent ? (this.transformer = sqrt, this.untransformer = square$3) : (this.transformer = generatePow(this._exponent), this.untransformer = generatePow(1 / this._exponent)), super.rescale()), this;
9124
+ return slience || (1 === this._exponent ? (this.transformer = identity$1, this.untransformer = identity$1) : .5 === this._exponent ? (this.transformer = sqrt$1, this.untransformer = square$3) : (this.transformer = generatePow(this._exponent), this.untransformer = generatePow(1 / this._exponent)), super.rescale()), this;
9125
9125
  }
9126
9126
  exponent(_, slience) {
9127
9127
  return arguments.length ? (this._exponent = _, this.rescale(slience)) : this._exponent;
@@ -9243,7 +9243,7 @@
9243
9243
 
9244
9244
  class SqrtScale extends LinearScale {
9245
9245
  constructor() {
9246
- super(sqrt, square$3), this.type = ScaleEnum.Sqrt;
9246
+ super(sqrt$1, square$3), this.type = ScaleEnum.Sqrt;
9247
9247
  }
9248
9248
  clone() {
9249
9249
  return new SqrtScale().domain(this._domain, !0).range(this._range, !0).unknown(this._unknown).clamp(this.clamp(), null, !0).interpolate(this._interpolate);
@@ -17808,11 +17808,13 @@
17808
17808
  return console.error("暂不支持该函数"), nodes;
17809
17809
  }
17810
17810
  insertBefore(newNode, referenceNode) {
17811
+ if (!referenceNode) return this.appendChild(newNode);
17811
17812
  if (this._uid === newNode._uid) return null;
17812
17813
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
17813
17814
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, newNode._prev = referenceNode._prev, referenceNode._prev ? referenceNode._prev._next = newNode : this._firstChild = newNode, referenceNode._prev = newNode, newNode._next = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
17814
17815
  }
17815
17816
  insertAfter(newNode, referenceNode) {
17817
+ if (!referenceNode) return this.appendChild(newNode);
17816
17818
  if (this._uid === newNode._uid) return null;
17817
17819
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");
17818
17820
  return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
@@ -22425,8 +22427,8 @@
22425
22427
  ay = yors - oc[1],
22426
22428
  bx = xore - oc[0],
22427
22429
  by = yore - oc[1],
22428
- kc = 1 / sin$1(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2),
22429
- lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]);
22430
+ kc = 1 / sin$1(acos$1((ax * bx + ay * by) / (sqrt$3(ax * ax + ay * ay) * sqrt$3(bx * bx + by * by))) / 2),
22431
+ lc = sqrt$3(oc[0] * oc[0] + oc[1] * oc[1]);
22430
22432
  limitedIcr = min$3(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1)), limitedOcr = min$3(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
22431
22433
  }
22432
22434
  }
@@ -22644,8 +22646,8 @@
22644
22646
  ay = yors - oc[1],
22645
22647
  bx = xore - oc[0],
22646
22648
  by = yore - oc[1],
22647
- kc = 1 / sin$1(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2),
22648
- lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]);
22649
+ kc = 1 / sin$1(acos$1((ax * bx + ay * by) / (sqrt$3(ax * ax + ay * ay) * sqrt$3(bx * bx + by * by))) / 2),
22650
+ lc = sqrt$3(oc[0] * oc[0] + oc[1] * oc[1]);
22649
22651
  limitedIcr = min$3(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1)), limitedOcr = min$3(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
22650
22652
  }
22651
22653
  }
@@ -23345,7 +23347,7 @@
23345
23347
  }
23346
23348
  var star$2 = new StarSymbol();
23347
23349
 
23348
- const sqrt3$1 = sqrt$2(3);
23350
+ const sqrt3$1 = sqrt$3(3);
23349
23351
  function arrow(ctx, r, transX, transY) {
23350
23352
  const triangleH = r,
23351
23353
  trangleBottomSide = triangleH / sqrt3$1,
@@ -23412,8 +23414,8 @@
23412
23414
  var stroke$1 = new StrokeSymbol();
23413
23415
 
23414
23416
  const c$1 = -.5,
23415
- s = sqrt$2(3) / 2,
23416
- k = 1 / sqrt$2(12);
23417
+ s = sqrt$3(3) / 2,
23418
+ k = 1 / sqrt$3(12);
23417
23419
  function wye(ctx, r, transX, transY) {
23418
23420
  const x0 = r / 2,
23419
23421
  y0 = r * k,
@@ -23509,7 +23511,7 @@
23509
23511
  }
23510
23512
  var triangleDown = new TriangleDownSymbol();
23511
23513
 
23512
- const sqrt3 = sqrt$2(3);
23514
+ const sqrt3 = sqrt$3(3);
23513
23515
  function thinTriangle(ctx, r, x, y) {
23514
23516
  const h = r * sqrt3;
23515
23517
  return ctx.moveTo(x, y + -h / 3 * 2), ctx.lineTo(r + x, y + h), ctx.lineTo(x - r, y + h), ctx.closePath(), !0;
@@ -24933,7 +24935,7 @@
24933
24935
  padAngle = arcTheme.padAngle
24934
24936
  } = this.attribute,
24935
24937
  {
24936
- padRadius = sqrt$2(outerRadius * outerRadius + innerRadius * innerRadius)
24938
+ padRadius = sqrt$3(outerRadius * outerRadius + innerRadius * innerRadius)
24937
24939
  } = this.attribute,
24938
24940
  deltaAngle = abs$1(endAngle - startAngle);
24939
24941
  let outerStartAngle = startAngle,
@@ -34585,7 +34587,7 @@
34585
34587
  constructor(dir, color) {
34586
34588
  let ambient = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .8;
34587
34589
  this.dir = dir, this.color = color, this.colorRgb = colorString.get(color).value, this.colorRgb[0] /= 255, this.colorRgb[1] /= 255, this.colorRgb[2] /= 255, this.ambient = ambient;
34588
- const length = sqrt$2(dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]);
34590
+ const length = sqrt$3(dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]);
34589
34591
  this.formatedDir = [dir[0] / length, dir[1] / length, dir[2] / length];
34590
34592
  }
34591
34593
  computeColor(normal, color) {
@@ -35622,10 +35624,12 @@
35622
35624
  };
35623
35625
 
35624
35626
  const transform$9 = (options, upstreamData) => {
35627
+ var _a;
35625
35628
  const positiveValues = new Map(),
35626
35629
  negativeValues = new Map(),
35627
35630
  needSum = options.asPercentStack || options.asPrevPercentStack || options.asPercent || options.asSum,
35628
- data = "negative" === options.orient ? upstreamData.slice().reverse() : upstreamData,
35631
+ orient = null !== (_a = options.orient) && void 0 !== _a ? _a : "positive",
35632
+ data = "negative" === orient ? upstreamData.slice().reverse() : upstreamData,
35629
35633
  defaultDimValue = Symbol("dim");
35630
35634
  let stackedValues = data.map(datum => {
35631
35635
  var _a, _b, _c;
@@ -35656,7 +35660,7 @@
35656
35660
  newDatum = Object.assign({}, datum),
35657
35661
  sum = null !== (_a = (value >= 0 ? positiveValues : negativeValues).get(dimension)) && void 0 !== _a ? _a : 0;
35658
35662
  return options.asSum && (newDatum[options.asSum] = sum), options.asPercent && (newDatum[options.asPercent] = 0 === sum ? 0 : value / sum), options.asPercentStack && (newDatum[options.asPercentStack] = 0 === sum ? 0 : stack / sum), options.asPrevPercentStack && (newDatum[options.asPrevPercentStack] = 0 === sum ? 0 : prevStack / sum), options.asPrevStack && (newDatum[options.asPrevStack] = prevStack), newDatum[null !== (_b = options.asStack) && void 0 !== _b ? _b : options.stackField] = stack, newDatum;
35659
- })), "negative" === options.orient ? stackedValues.reverse() : stackedValues;
35663
+ })), "negative" === orient ? stackedValues.reverse() : stackedValues;
35660
35664
  };
35661
35665
 
35662
35666
  const transform$8 = (options, upstreamData) => {
@@ -36127,9 +36131,9 @@
36127
36131
  }
36128
36132
  }],
36129
36133
  [GrammarMarkType.area]: [{
36130
- channels: ["x", "y", "x1", "y1", "width", "height"],
36134
+ channels: ["x", "y", "x1", "y1"],
36131
36135
  transform: (graphicAttributes, nextAttrs, storedAttrs) => {
36132
- graphicAttributes.x = 0, graphicAttributes.y = 0;
36136
+ graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
36133
36137
  }
36134
36138
  }],
36135
36139
  [GrammarMarkType.line]: [{
@@ -37959,7 +37963,7 @@
37959
37963
  y: y
37960
37964
  }
37961
37965
  };
37962
- return isValidNumber(min) && (animateAttributes.to.min = center, animateAttributes.from.min = min), isValidNumber(max) && (animateAttributes.to.max = center, animateAttributes.from.max = max), isValidNumber(q1) && (animateAttributes.to.q1 = center, animateAttributes.from.q1 = q1), isValidNumber(q3) && (animateAttributes.to.q3 = center, animateAttributes.from.q3 = q3), isValidNumber(median) && (animateAttributes.to.median = center, animateAttributes.from.median = q3), animateAttributes;
37966
+ return isValidNumber(min) && (animateAttributes.to.min = center, animateAttributes.from.min = min), isValidNumber(max) && (animateAttributes.to.max = center, animateAttributes.from.max = max), isValidNumber(q1) && (animateAttributes.to.q1 = center, animateAttributes.from.q1 = q1), isValidNumber(q3) && (animateAttributes.to.q3 = center, animateAttributes.from.q3 = q3), isValidNumber(median) && (animateAttributes.to.median = center, animateAttributes.from.median = median), animateAttributes;
37963
37967
  },
37964
37968
  computeBoxplotCenter = (glyphElement, direction, options) => {
37965
37969
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
@@ -38045,6 +38049,8 @@
38045
38049
  x1: x + width / 2
38046
38050
  }))), attributes;
38047
38051
  };
38052
+ const boxplotScaleIn = scaleIn(computeBoxplotCenter);
38053
+ const boxplotScaleOut = scaleOut(computeBoxplotCenter);
38048
38054
  function registerBoxplotGlyph() {
38049
38055
  registerGlyph("boxplot", {
38050
38056
  shaft: "rule",
@@ -38162,7 +38168,7 @@
38162
38168
  median: {
38163
38169
  visible: !1
38164
38170
  }
38165
- })), registerAnimationType("boxplotScaleIn", scaleIn(computeBoxplotCenter)), registerAnimationType("boxplotScaleOut", scaleOut(computeBoxplotCenter));
38171
+ })), registerAnimationType("boxplotScaleIn", boxplotScaleIn), registerAnimationType("boxplotScaleOut", boxplotScaleOut);
38166
38172
  }
38167
38173
  const computeBarBoxplotCenter = (glyphElement, direction, options) => {
38168
38174
  var _a, _b, _c, _d;
@@ -38240,6 +38246,8 @@
38240
38246
  x1: x + width / 2
38241
38247
  }))), attributes;
38242
38248
  };
38249
+ const barBoxplotScaleIn = scaleIn(computeBarBoxplotCenter);
38250
+ const barBoxplotScaleOut = scaleOut(computeBarBoxplotCenter);
38243
38251
  function registerBarBoxplotGlyph() {
38244
38252
  registerGlyph("barBoxplot", {
38245
38253
  minMaxBox: "rect",
@@ -38334,7 +38342,7 @@
38334
38342
  median: {
38335
38343
  visible: !1
38336
38344
  }
38337
- })), registerAnimationType("barBoxplotScaleIn", scaleIn(computeBarBoxplotCenter)), registerAnimationType("barBoxplotScaleOut", scaleOut(computeBarBoxplotCenter));
38345
+ })), registerAnimationType("barBoxplotScaleIn", barBoxplotScaleIn), registerAnimationType("barBoxplotScaleOut", barBoxplotScaleOut);
38338
38346
  }
38339
38347
 
38340
38348
  const getHorizontalPath = (options, ratio) => {
@@ -38585,7 +38593,7 @@
38585
38593
  Object.keys(from).forEach(channel => {
38586
38594
  isNil(from[channel]) && delete from[channel];
38587
38595
  });
38588
- const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType);
38596
+ const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType) && !isValid(from.segments);
38589
38597
  if (computePoints) {
38590
38598
  const items = element.items.map(item => Object.assign({}, item, {
38591
38599
  nextAttrs: from
@@ -38598,7 +38606,7 @@
38598
38606
  Object.keys(to).forEach(channel => {
38599
38607
  isNil(to[channel]) && delete to[channel];
38600
38608
  });
38601
- const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType);
38609
+ const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType) && !isValid(to.segments);
38602
38610
  if (computePoints) {
38603
38611
  const items = element.items.map(item => Object.assign({}, item, {
38604
38612
  nextAttrs: to
@@ -39408,10 +39416,11 @@
39408
39416
  });
39409
39417
  }
39410
39418
  encodeCustom(nextAttrs) {
39419
+ var _a;
39411
39420
  let customEncodeValues = {};
39412
39421
  const channelEncoder = this.glyphMeta.getChannelEncoder(),
39413
39422
  functionEncoder = this.glyphMeta.getFunctionEncoder();
39414
- if (functionEncoder && (customEncodeValues = functionEncoder.call(null, nextAttrs, this.getDatum(), this, this.mark.getGlyphConfig())), channelEncoder) {
39423
+ if (functionEncoder && (customEncodeValues = functionEncoder.call(null, Object.assign({}, null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.attribute, nextAttrs), this.getDatum(), this, this.mark.getGlyphConfig())), channelEncoder) {
39415
39424
  let allAttrs;
39416
39425
  Object.keys(channelEncoder).forEach(channel => {
39417
39426
  var _a;
@@ -39797,7 +39806,7 @@
39797
39806
  }
39798
39807
  getScalesByChannel() {
39799
39808
  const encoders = this.spec.encode;
39800
- if (!encoders) return;
39809
+ if (!encoders) return {};
39801
39810
  const res = {},
39802
39811
  params = this.parameters();
39803
39812
  return Object.keys(encoders).forEach(state => {
@@ -40538,8 +40547,7 @@
40538
40547
  maxWidth: maxWidth,
40539
40548
  padding = 4,
40540
40549
  visible: visible,
40541
- state: state,
40542
- formatMethod: formatMethod
40550
+ state: state
40543
40551
  } = this.attribute,
40544
40552
  parsedPadding = normalizePadding$1(padding),
40545
40553
  group = this.createOrUpdateChild("tag-content", {
@@ -40571,7 +40579,7 @@
40571
40579
  }
40572
40580
  tagWidth += symbolPlaceWidth, textX += symbolPlaceWidth;
40573
40581
  const textAttrs = Object.assign(Object.assign({
40574
- text: formatMethod ? formatMethod(text) : text,
40582
+ text: text,
40575
40583
  visible: isValid(text) && !1 !== visible,
40576
40584
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize
40577
40585
  }, textStyle), {
@@ -41378,6 +41386,24 @@
41378
41386
  function defaultLabelPosition(type) {
41379
41387
  return "rect" === type ? DefaultRectPositions : DefaultPositions;
41380
41388
  }
41389
+ function clampText(text, width, height) {
41390
+ const {
41391
+ x1: x1,
41392
+ x2: x2,
41393
+ y1: y1,
41394
+ y2: y2
41395
+ } = text.AABBBounds,
41396
+ minX = Math.min(x1, x2),
41397
+ maxX = Math.max(x1, x2),
41398
+ minY = Math.min(y1, y2),
41399
+ maxY = Math.max(y1, y2);
41400
+ let dx = 0,
41401
+ dy = 0;
41402
+ return minX < 0 && maxX - minX <= width ? dx = -minX : maxX > width && minX - (maxX - width) >= 0 && (dx = width - maxX), minY < 0 && maxY - minY <= height ? dy = -minY : maxY > height && minY - (maxY - height) >= 0 && (dy = height - maxY), {
41403
+ dx: dx,
41404
+ dy: dy
41405
+ };
41406
+ }
41381
41407
 
41382
41408
  const fadeIn = function () {
41383
41409
  let textAttribute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -41456,9 +41482,17 @@
41456
41482
  this._bmpTool = bmpTool;
41457
41483
  }
41458
41484
  render() {
41459
- const currentBaseMarks = this._checkMarks(),
41460
- labels = this.layout(currentBaseMarks);
41461
- this._smartInvert(labels), this._renderLabels(labels);
41485
+ this._prepare();
41486
+ const {
41487
+ overlap: overlap,
41488
+ smartInvert: smartInvert,
41489
+ dataFilter: dataFilter,
41490
+ customLayoutFunc: customLayoutFunc,
41491
+ customOverlapFunc: customOverlapFunc
41492
+ } = this.attribute;
41493
+ let labels,
41494
+ data = this.attribute.data;
41495
+ isFunction(dataFilter) && (data = dataFilter(data)), isFunction(customLayoutFunc) ? labels = customLayoutFunc(data, d => this._idToGraphic.get(d.id)) : (labels = this.layout(data), isFunction(customOverlapFunc) ? labels = customOverlapFunc(labels, d => this._idToGraphic.get(d.id)) : !1 !== overlap && (labels = this._overlapping(labels))), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
41462
41496
  }
41463
41497
  _bindEvent(target) {
41464
41498
  if (!target) return;
@@ -41477,52 +41511,53 @@
41477
41511
  const text = createText(attributes);
41478
41512
  return this._bindEvent(text), this._setStates(text), text;
41479
41513
  }
41480
- _checkMarks() {
41514
+ _prepare() {
41481
41515
  var _a;
41482
41516
  const baseMarks = this.getBaseMarks(),
41483
41517
  currentBaseMarks = [];
41484
- return baseMarks.forEach(mark => {
41518
+ if (baseMarks.forEach(mark => {
41485
41519
  "willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
41486
- }), this._prevRelationMap = new Map(this._relationMap), null === (_a = this._relationMap) || void 0 === _a || _a.clear(), currentBaseMarks;
41487
- }
41488
- layout(currentMarks) {
41520
+ }), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), this._baseMarks = currentBaseMarks, !currentBaseMarks || 0 === currentBaseMarks.length) return;
41489
41521
  const {
41490
- textStyle: textStyle,
41491
- position: position,
41492
- offset: offset
41493
- } = this.attribute;
41494
- let {
41495
41522
  data: data
41496
41523
  } = this.attribute;
41497
- if (isFunction(data) && (data = data({})), !data || 0 === data.length) return [];
41498
- let labels = [];
41499
- isFunction(this.attribute.sort) && currentMarks && currentMarks.length && (currentMarks = currentMarks.sort(this.attribute.sort)), this._relationMap || (this._relationMap = new Map());
41524
+ if (data && 0 !== data.length) {
41525
+ this._idToGraphic || (this._idToGraphic = new Map());
41526
+ for (let i = 0; i < currentBaseMarks.length; i++) {
41527
+ const textData = data[i],
41528
+ baseMark = currentBaseMarks[i];
41529
+ textData && baseMark && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`), this._idToGraphic.set(textData.id, baseMark));
41530
+ }
41531
+ }
41532
+ }
41533
+ layout() {
41534
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
41535
+ const {
41536
+ textStyle = {},
41537
+ position: position,
41538
+ offset: offset
41539
+ } = this.attribute,
41540
+ labels = [];
41500
41541
  for (let i = 0; i < data.length; i++) {
41501
41542
  const textData = data[i],
41502
- baseMark = null == currentMarks ? void 0 : currentMarks[i],
41503
- labelAttribute = Object.assign(Object.assign(Object.assign({}, textStyle), textData), {
41504
- _relatedIndex: i
41505
- });
41506
- if (this._relationMap.set(i, baseMark), textData) {
41507
- const text = createText(labelAttribute);
41508
- text.update();
41509
- const textBounds = this.getGraphicBounds(text),
41510
- graphicBounds = this.getGraphicBounds(baseMark, {
41511
- x: textData.x,
41512
- y: textData.y
41513
- }),
41514
- textAttributes = this.labeling(textBounds, graphicBounds, isFunction(position) ? position(textData) : position, offset);
41515
- if (!textAttributes) continue;
41516
- labelAttribute.x = textAttributes.x, labelAttribute.y = textAttributes.y, labels.push(labelAttribute);
41517
- }
41543
+ baseMark = this._idToGraphic.get(textData.id),
41544
+ labelAttribute = Object.assign(Object.assign({}, textStyle), textData),
41545
+ text = this._createLabelText(labelAttribute),
41546
+ textBounds = this.getGraphicBounds(text),
41547
+ graphicBounds = this.getGraphicBounds(baseMark, {
41548
+ x: textData.x,
41549
+ y: textData.y
41550
+ }),
41551
+ textLocation = this.labeling(textBounds, graphicBounds, isFunction(position) ? position(textData) : position, offset);
41552
+ textLocation && (labelAttribute.x = textLocation.x, labelAttribute.y = textLocation.y, text.setAttributes(textLocation), labels.push(text));
41518
41553
  }
41519
- return this._baseMarks = currentMarks, !1 !== this.attribute.overlap && (labels = this.overlapping(labels, this.attribute.overlap)), labels;
41554
+ return labels;
41520
41555
  }
41521
- overlapping(labels) {
41522
- let option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
41523
- var _a, _b, _c, _d, _e;
41556
+ _overlapping(labels) {
41557
+ var _a, _b, _c, _d;
41524
41558
  if (0 === labels.length) return [];
41525
- const result = [],
41559
+ const option = this.attribute.overlap,
41560
+ result = [],
41526
41561
  baseMarkGroup = this.getBaseMarkGroup(),
41527
41562
  size = null !== (_a = option.size) && void 0 !== _a ? _a : {
41528
41563
  width: null !== (_b = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.width()) && void 0 !== _b ? _b : 0,
@@ -41543,27 +41578,45 @@
41543
41578
  }));
41544
41579
  for (let i = 0; i < labels.length; i++) {
41545
41580
  if (!1 === labels[i].visible) continue;
41546
- const text = createText(labels[i]),
41547
- baseMark = null === (_e = this._baseMarks) || void 0 === _e ? void 0 : _e[i];
41581
+ const text = labels[i],
41582
+ baseMark = this._idToGraphic.get(text.attribute.id);
41548
41583
  if (text.update(), canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {
41549
41584
  if (!checkBounds) {
41550
- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(Object.assign({}, text.attribute));
41585
+ bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
41551
41586
  continue;
41552
41587
  }
41553
41588
  if (checkBounds && (null == baseMark ? void 0 : baseMark.AABBBounds) && canPlaceInside(text.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds)) {
41554
- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(Object.assign({}, text.attribute));
41589
+ bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
41555
41590
  continue;
41556
41591
  }
41557
41592
  }
41558
41593
  let hasPlace = !1;
41559
41594
  for (let j = 0; j < strategy.length; j++) if (hasPlace = place$2(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling), !1 !== hasPlace) {
41560
- result.push(Object.assign(Object.assign({}, text.attribute), {
41595
+ text.setAttributes({
41561
41596
  x: hasPlace.x,
41562
41597
  y: hasPlace.y
41563
- }));
41598
+ }), result.push(text);
41564
41599
  break;
41565
41600
  }
41566
- !hasPlace && !hideOnHit && result.push(Object.assign({}, text.attribute));
41601
+ if (clampForce) {
41602
+ const {
41603
+ dx = 0,
41604
+ dy = 0
41605
+ } = clampText(text, bmpTool.width, bmpTool.height);
41606
+ if ((0 !== dx || 0 !== dy) && canPlace(bmpTool, bitmap, {
41607
+ x1: text.AABBBounds.x1 + dx,
41608
+ x2: text.AABBBounds.x2 + dx,
41609
+ y1: text.AABBBounds.y1 + dy,
41610
+ y2: text.AABBBounds.y2 + dy
41611
+ })) {
41612
+ text.setAttributes({
41613
+ x: text.attribute.x + dx,
41614
+ y: text.attribute.y + dy
41615
+ }), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
41616
+ continue;
41617
+ }
41618
+ }
41619
+ !hasPlace && !hideOnHit && result.push(text);
41567
41620
  }
41568
41621
  return isFunction(this.onAfterLabelOverlap) && this.onAfterLabelOverlap(bitmap), result;
41569
41622
  }
@@ -41595,17 +41648,16 @@
41595
41648
  easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : DefaultLabelAnimation.easing,
41596
41649
  delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0,
41597
41650
  currentTextMap = new Map(),
41598
- prevTextMap = this._textMap || new Map(),
41651
+ prevTextMap = this._graphicToText || new Map(),
41599
41652
  texts = [];
41600
- labels.forEach((label, index) => {
41601
- const text = this._createLabelText(label),
41602
- relatedGraphic = this._relationMap.get(label._relatedIndex),
41653
+ labels.forEach((text, index) => {
41654
+ const relatedGraphic = this._idToGraphic.get(text.attribute.id),
41603
41655
  state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
41604
41656
  if ("enter" === state) if (texts.push(text), currentTextMap.set(relatedGraphic, text), !disableAnimation && relatedGraphic) {
41605
41657
  const {
41606
41658
  from: from,
41607
41659
  to: to
41608
- } = getAnimationAttributes(label, "fadeIn");
41660
+ } = getAnimationAttributes(text.attribute, "fadeIn");
41609
41661
  this.add(text), relatedGraphic.onAnimateBind = () => {
41610
41662
  text.setAttributes(from);
41611
41663
  const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
@@ -41630,7 +41682,7 @@
41630
41682
  disableAnimation ? this.removeChild(label) : null == label || label.animate().to(getAnimationAttributes(label.attribute, "fadeOut").to, duration, easing).onEnd(() => {
41631
41683
  this.removeChild(label);
41632
41684
  });
41633
- }), this._textMap = currentTextMap;
41685
+ }), this._graphicToText = currentTextMap;
41634
41686
  }
41635
41687
  _afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, _ref) {
41636
41688
  let {
@@ -41673,21 +41725,32 @@
41673
41725
  return listener;
41674
41726
  }
41675
41727
  _smartInvert(labels) {
41676
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
41677
- if (!1 !== this.attribute.smartInvert) for (let i = 0; i < labels.length; i++) {
41678
- const label = null == labels ? void 0 : labels[i];
41728
+ const option = this.attribute.smartInvert || {},
41729
+ {
41730
+ textType: textType,
41731
+ contrastRatiosThreshold: contrastRatiosThreshold,
41732
+ alternativeColors: alternativeColors
41733
+ } = option;
41734
+ for (let i = 0; i < labels.length; i++) {
41735
+ const label = labels[i];
41679
41736
  if (!label) continue;
41680
- const isInside = canPlaceInside(createText(label).AABBBounds, null === (_a = this._relationMap.get(label._relatedIndex)) || void 0 === _a ? void 0 : _a.AABBBounds);
41681
- if (label.stroke && label.lineWidth > 0) label.fill = labelSmartInvert(label.fill, label.stroke, null === (_b = this.attribute.smartInvert) || void 0 === _b ? void 0 : _b.textType, null === (_c = this.attribute.smartInvert) || void 0 === _c ? void 0 : _c.contrastRatiosThreshold, null === (_d = this.attribute.smartInvert) || void 0 === _d ? void 0 : _d.alternativeColors);else if (isInside) {
41682
- const backgroundColor = this._relationMap.get(label._relatedIndex).attribute.fill,
41683
- foregroundColor = label.fill;
41684
- label.fill = labelSmartInvert(foregroundColor, backgroundColor, null === (_e = this.attribute.smartInvert) || void 0 === _e ? void 0 : _e.textType, null === (_f = this.attribute.smartInvert) || void 0 === _f ? void 0 : _f.contrastRatiosThreshold, null === (_g = this.attribute.smartInvert) || void 0 === _g ? void 0 : _g.alternativeColors);
41685
- } else if (label.lineWidth > 0) {
41686
- const baseMark = this._relationMap.get(label._relatedIndex);
41687
- label.stroke = baseMark.attribute.fill;
41688
- const backgroundColor = label.stroke,
41689
- foregroundColor = label.fill;
41690
- label.fill = labelSmartInvert(foregroundColor, backgroundColor, null === (_h = this.attribute.smartInvert) || void 0 === _h ? void 0 : _h.textType, null === (_j = this.attribute.smartInvert) || void 0 === _j ? void 0 : _j.contrastRatiosThreshold, null === (_k = this.attribute.smartInvert) || void 0 === _k ? void 0 : _k.alternativeColors);
41737
+ const baseMark = this._idToGraphic.get(label.attribute.id),
41738
+ isInside = canPlaceInside(label.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds);
41739
+ if (label.attribute.stroke && label.attribute.lineWidth > 0) label.setAttributes({
41740
+ fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
41741
+ });else if (isInside) {
41742
+ const backgroundColor = baseMark.attribute.fill,
41743
+ foregroundColor = label.attribute.fill;
41744
+ label.setAttributes({
41745
+ fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
41746
+ });
41747
+ } else if (label.attribute.lineWidth > 0) {
41748
+ const backgroundColor = label.attribute.stroke,
41749
+ foregroundColor = label.attribute.fill;
41750
+ label.setAttributes({
41751
+ stroke: baseMark.attribute.fill,
41752
+ fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
41753
+ });
41691
41754
  }
41692
41755
  }
41693
41756
  }
@@ -42070,6 +42133,9 @@
42070
42133
  line.name = "line", line.id = this._getNodeId("line"), isEmpty(null == state ? void 0 : state.line) || (line.states = state.line), this.line = line, this.add(line);
42071
42134
  }
42072
42135
  renderSymbol(attribute, dim) {
42136
+ const {
42137
+ autoRotate = !0
42138
+ } = attribute;
42073
42139
  let symbol;
42074
42140
  if (null == attribute ? void 0 : attribute.visible) {
42075
42141
  const startAngle = this._startAngle,
@@ -42098,7 +42164,7 @@
42098
42164
  }, rotate = endAngle + Math.PI / 2), symbol = createSymbol(Object.assign(Object.assign(Object.assign({}, position), {
42099
42165
  symbolType: symbolType,
42100
42166
  size: size,
42101
- angle: rotate + refAngle,
42167
+ angle: autoRotate ? rotate + refAngle : 0,
42102
42168
  strokeBoundsBuffer: 0
42103
42169
  }), style)), symbol.name = `${dim}-symbol`, symbol.id = this._getNodeId(`${dim}-symbol`), isEmpty(null == state ? void 0 : state.symbol) || (symbol.states = state.symbol), this.add(symbol);
42104
42170
  }
@@ -42119,6 +42185,7 @@
42119
42185
  },
42120
42186
  startSymbol: {
42121
42187
  visible: !1,
42188
+ autoRotate: !0,
42122
42189
  symbolType: "triangle",
42123
42190
  size: 12,
42124
42191
  refX: 0,
@@ -42131,6 +42198,7 @@
42131
42198
  },
42132
42199
  endSymbol: {
42133
42200
  visible: !1,
42201
+ autoRotate: !0,
42134
42202
  symbolType: "triangle",
42135
42203
  size: 12,
42136
42204
  refX: 0,
@@ -47803,7 +47871,7 @@
47803
47871
  super(view, ComponentEnum.axis, group), this.spec.componentType = ComponentEnum.axis, this.spec.axisType = "line", this.mode = mode;
47804
47872
  }
47805
47873
  parseAddition(spec) {
47806
- return super.parseAddition(spec), this.tickCount(spec.tickCount), this.inside(spec.inside), this.baseValue(spec.baseValue), this;
47874
+ return super.parseAddition(spec), this.axisType(spec.axisType), this.tickCount(spec.tickCount), this.inside(spec.inside), this.baseValue(spec.baseValue), this;
47807
47875
  }
47808
47876
  axisType(axisType) {
47809
47877
  return this.spec.axisType = axisType, this._axisComponentType = null, this._prepareRejoin(), this.commit(), this;
@@ -49580,7 +49648,7 @@
49580
49648
  isSub = rangeSpec.isSubshaft,
49581
49649
  reversed = rangeSpec.reversed,
49582
49650
  coordinate = this.parameters()[coord];
49583
- return null == coordinate ? void 0 : coordinate.getVisiualPositionByDimension(dim, isSub, reversed);
49651
+ return null == coordinate ? void 0 : coordinate.getVisualPositionByDimension(dim, isSub, reversed);
49584
49652
  }
49585
49653
  return null;
49586
49654
  }
@@ -50015,7 +50083,7 @@
50015
50083
  res = this.isMainDimension(dim) ? [start.x, end.x] : [end.y, start.y];
50016
50084
  return reversed ? [res[1], res[0]] : res;
50017
50085
  }
50018
- getVisiualPositionByDimension(dim, isSubshaft, reversed) {
50086
+ getVisualPositionByDimension(dim, isSubshaft, reversed) {
50019
50087
  return this.isMainDimension(dim) ? isSubshaft ? "top" : "bottom" : isSubshaft ? "right" : "left";
50020
50088
  }
50021
50089
  getAxisPointsByDimension(dim, isSubshaft, reversed, baseValue) {
@@ -50162,7 +50230,7 @@
50162
50230
  const res = this.isMainDimension(dim) ? [this.startAngle, this.endAngle] : [this.innerRadius, this.outerRadius];
50163
50231
  return reversed ? [res[1], res[0]] : res;
50164
50232
  }
50165
- getVisiualPositionByDimension(dim, isSubshaft, reversed) {
50233
+ getVisualPositionByDimension(dim, isSubshaft, reversed) {
50166
50234
  return this.isMainDimension(dim) ? isSubshaft ? "inside" : "outside" : isSubshaft ? "end" : "start";
50167
50235
  }
50168
50236
  getAxisPointsByDimension(dim, isSubshaft, reversed, baseValue) {
@@ -58042,7 +58110,7 @@
58042
58110
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58043
58111
  Factory.registerRegion('region', Region);
58044
58112
  Factory.registerLayout('base', Layout);
58045
- const version = "1.1.3-beta.1";
58113
+ const version = "1.1.4-beta.1";
58046
58114
  Logger.getInstance(LoggerLevel.Error);
58047
58115
 
58048
58116
  var SeriesMarkNameEnum;
@@ -65283,7 +65351,9 @@
65283
65351
  spec?.nameMap !== nameMap ||
65284
65352
  spec?.valueField !== valueField ||
65285
65353
  spec?.nameProperty !== nameProperty) {
65354
+ result.change = true;
65286
65355
  result.reRender = true;
65356
+ result.reMake = true;
65287
65357
  }
65288
65358
  return result;
65289
65359
  }
@@ -67296,13 +67366,13 @@
67296
67366
  if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {
67297
67367
  return Number.NaN;
67298
67368
  }
67299
- return this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0).x;
67369
+ return this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]).x;
67300
67370
  },
67301
67371
  y1: (datum) => {
67302
67372
  if (!datum || !this.angleAxisHelper || !this.radiusAxisHelper) {
67303
67373
  return Number.NaN;
67304
67374
  }
67305
- const value = this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : 0).y;
67375
+ const value = this.valueToPosition(this.getDatumPositionValues(datum, this._angleField), this._stack ? this.getDatumPositionValues(datum, this._innerRadiusField) : this.radiusScale.domain()[0]).y;
67306
67376
  return value;
67307
67377
  },
67308
67378
  fill: this.getColorAttribute(),
@@ -68812,7 +68882,7 @@
68812
68882
  for (this.data = data; i < n;) {
68813
68883
  if (this.layoutWord(i) && i++, this.progressiveIndex = i, this.exceedTime()) break;
68814
68884
  }
68815
- if (!this.options.clip && this.options.enlarge && this.shrinkBoard(this._bounds), ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
68885
+ if (!this.options.clip && this.options.enlarge && this._bounds && this.shrinkBoard(this._bounds), this._bounds && ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
68816
68886
  const currentCenterY = (this._bounds[0].y + this._bounds[1].y) / 2;
68817
68887
  this._dy = -(currentCenterY - this._size[1] / 2);
68818
68888
  }
@@ -69337,8 +69407,9 @@
69337
69407
  var _a, _b, _c, _d, _e, _f, _g;
69338
69408
  if (options.size && (!options.size[0] || !options.size[1])) return upstreamData;
69339
69409
  const data = upstreamData,
69340
- canvasSize = null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500],
69341
- fontFamily = options.fontFamily ? field$1(options.fontFamily) : "sans-serif",
69410
+ canvasSize = (null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500]).slice();
69411
+ canvasSize[0] = Math.floor(canvasSize[0]), canvasSize[1] = Math.floor(canvasSize[1]);
69412
+ const fontFamily = options.fontFamily ? field$1(options.fontFamily) : "sans-serif",
69342
69413
  fontStyle = options.fontStyle ? field$1(options.fontStyle) : "normal",
69343
69414
  fontWeight = options.fontWeight ? field$1(options.fontWeight) : "normal",
69344
69415
  rotate = options.rotate ? field$1(options.rotate) : 0,
@@ -69357,8 +69428,9 @@
69357
69428
  let fontSize = options.fontSize ? field$1(options.fontSize) : 14;
69358
69429
  const fontSizeRange = options.fontSizeRange;
69359
69430
  if (fontSizeRange && !isNumber(fontSize)) {
69360
- const fsize = fontSize;
69361
- fontSize = datum => sqrtScale(fsize(datum), extent$1(fsize, data), fontSizeRange);
69431
+ const fsize = fontSize,
69432
+ fontSizeSqrtScale = generateSqrtScale(extent$1(fsize, data), fontSizeRange);
69433
+ fontSize = datum => fontSizeSqrtScale(fsize(datum));
69362
69434
  }
69363
69435
  let Layout = CloudLayout;
69364
69436
  "fast" === options.layoutType ? Layout = FastLayout : "grid" === options.layoutType && (Layout = GridLayout$1);
@@ -69394,7 +69466,15 @@
69394
69466
  } : layout.output();
69395
69467
  };
69396
69468
  const field$1 = option => isString(option) || isNumber(option) || isFunction(option) ? option : datum => datum[option.field],
69397
- sqrtScale = (datum, domain, range) => (Math.sqrt(datum) - Math.sqrt(domain[0])) / (Math.sqrt(domain[1]) - Math.sqrt(domain[0])) * (range[1] - range[0]) + range[0],
69469
+ sqrt = x => x < 0 ? -Math.sqrt(-x) : Math.sqrt(x),
69470
+ generateSqrtScale = (domain, range) => {
69471
+ if (domain[0] === domain[1]) return datum => range[0];
69472
+ const s0 = sqrt(domain[0]),
69473
+ s1 = sqrt(domain[1]),
69474
+ min = Math.min(s0, s1),
69475
+ max = Math.max(s0, s1);
69476
+ return datum => (sqrt(datum) - min) / (max - min) * (range[1] - range[0]) + range[0];
69477
+ },
69398
69478
  extent$1 = (field, data) => {
69399
69479
  let min = 1 / 0,
69400
69480
  max = -1 / 0;
@@ -70684,15 +70764,11 @@
70684
70764
  });
70685
70765
  }
70686
70766
  const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;
70687
- const srView = this.getCompiler().getVGrammarView();
70688
70767
  if (!this._isWordCloudShape) {
70689
70768
  wordCloudTransforms.push({
70690
70769
  type: 'wordcloud',
70691
70770
  layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,
70692
- size: [
70693
- srView.width() - this._padding?.left || 0 - this._padding?.right || 0,
70694
- srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0
70695
- ],
70771
+ size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
70696
70772
  shape: this._maskShape,
70697
70773
  dataIndexKey: DEFAULT_DATA_KEY,
70698
70774
  text: { field: textField },
@@ -70717,7 +70793,7 @@
70717
70793
  wordCloudTransforms.push({
70718
70794
  type: 'wordcloudShape',
70719
70795
  dataIndexKey: DEFAULT_DATA_KEY,
70720
- size: [srView.width(), srView.height()],
70796
+ size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
70721
70797
  shape: this._maskShape,
70722
70798
  text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },
70723
70799
  fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],
@@ -70792,6 +70868,10 @@
70792
70868
  }
70793
70869
  setValueFieldToPercent() {
70794
70870
  }
70871
+ onLayoutEnd(ctx) {
70872
+ super.onLayoutEnd(ctx);
70873
+ this.compile();
70874
+ }
70795
70875
  updateSpec(spec) {
70796
70876
  const originalSpec = this._originalSpec;
70797
70877
  const result = super.updateSpec(spec);
@@ -70857,15 +70937,11 @@
70857
70937
  });
70858
70938
  }
70859
70939
  const textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;
70860
- const srView = this.getCompiler().getVGrammarView();
70861
70940
  if (!this._isWordCloudShape) {
70862
70941
  wordCloudTransforms.push({
70863
70942
  type: 'wordcloud',
70864
70943
  layoutType: this._wordCloudConfig.layoutMode,
70865
- size: [
70866
- srView.width() - this._padding?.left || 0 - this._padding?.right || 0,
70867
- srView.height() - this._padding?.top || 0 - this._padding?.bottom || 0
70868
- ],
70944
+ size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
70869
70945
  shape: this._maskShape,
70870
70946
  postProjection: this._spec.postProjection ?? 'StereographicProjection',
70871
70947
  dataIndexKey: DEFAULT_DATA_KEY,
@@ -70891,7 +70967,7 @@
70891
70967
  else {
70892
70968
  wordCloudTransforms.push({
70893
70969
  type: 'wordcloudShape',
70894
- size: [srView.width(), srView.height()],
70970
+ size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
70895
70971
  shape: this._maskShape,
70896
70972
  postProjection: this._spec.postProjection ?? 'StereographicProjection',
70897
70973
  dataIndexKey: DEFAULT_DATA_KEY,