@visactor/vchart 1.5.1 → 1.5.2-alpha.0

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
@@ -1226,12 +1226,12 @@
1226
1226
  function radianToDegree(radian) {
1227
1227
  return 180 * radian / Math.PI;
1228
1228
  }
1229
- const clampRadian = function () {
1229
+ const clampRadian$1 = function () {
1230
1230
  let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1231
1231
  if (angle < 0) for (; angle < -tau$1;) angle += tau$1;else if (angle > 0) for (; angle > tau$1;) angle -= tau$1;
1232
1232
  return angle;
1233
1233
  };
1234
- const clampAngleByRadian = clampRadian;
1234
+ const clampAngleByRadian = clampRadian$1;
1235
1235
  function polarToCartesian$2(center, radius, angleInRadian) {
1236
1236
  return {
1237
1237
  x: center.x + radius * Math.cos(angleInRadian),
@@ -31906,11 +31906,14 @@
31906
31906
  value: tickDatum.rawValue,
31907
31907
  index: tickDatum.index,
31908
31908
  layer: layer
31909
- })), Object.assign(Object.assign(Object.assign({}, point), {
31909
+ })), Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, text, textStyle)), {
31910
31910
  text: text,
31911
31911
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize
31912
31912
  }), textStyle);
31913
31913
  }
31914
+ getLabelPosition(point, vector, text, style) {
31915
+ return point;
31916
+ }
31914
31917
  _transformItems(items) {
31915
31918
  const data = [];
31916
31919
  return items.forEach(item => {
@@ -32523,6 +32526,37 @@
32523
32526
  }
32524
32527
  }
32525
32528
 
32529
+ const clampRadian = function () {
32530
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
32531
+ if (angle < 0) for (; angle < 0;) angle += tau$1;else if (angle > 0) for (; angle > tau$1;) angle -= tau$1;
32532
+ return angle;
32533
+ };
32534
+ function isInRange(a, min, max) {
32535
+ return !isLess(a, min, 0, 1e-6) && !isGreater(a, max, 0, 1e-6);
32536
+ }
32537
+ function getLabelPosition(tickPosition, tickVector, text, style) {
32538
+ const labelBounds = getTextBounds(Object.assign({
32539
+ text: text
32540
+ }, style)),
32541
+ width = labelBounds.width(),
32542
+ height = labelBounds.height(),
32543
+ angle = clampRadian(Math.atan2(tickVector[1], tickVector[0])) - Math.PI,
32544
+ PI_3_4 = 3 * Math.PI / 4,
32545
+ PI_1_4 = Math.PI / 4,
32546
+ PI_1_2 = Math.PI / 2,
32547
+ baseX = tickPosition.x;
32548
+ let dx = 0;
32549
+ dx = isInRange(angle, -PI_3_4, -PI_1_4) ? ((angle + PI_3_4) / PI_1_2 - .5) * width : isInRange(angle, PI_1_4, PI_3_4) ? (.5 - (angle - PI_1_4) / PI_1_2) * width : Math.cos(angle) >= 0 ? .5 * width : .5 * -width;
32550
+ const x = baseX - dx,
32551
+ baseY = tickPosition.y;
32552
+ let dy = 0;
32553
+ dy = isInRange(angle, -PI_3_4, -PI_1_4) ? .5 * -height : isInRange(angle, PI_1_4, PI_3_4) ? .5 * height : Math.cos(angle) >= 0 ? (.5 - (PI_1_4 - angle) / PI_1_2) * height : (.5 - clampRadian(angle - PI_3_4) / PI_1_2) * height;
32554
+ return {
32555
+ x: x,
32556
+ y: baseY - dy
32557
+ };
32558
+ }
32559
+
32526
32560
  var __rest$3 = undefined && undefined.__rest || function (s, e) {
32527
32561
  var t = {};
32528
32562
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
@@ -32654,10 +32688,13 @@
32654
32688
  afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {}
32655
32689
  getLabelAlign(vector, inside, angle) {
32656
32690
  return {
32657
- textAlign: this.getTextAlign(vector),
32658
- textBaseline: this.getTextBaseline(vector)
32691
+ textAlign: "center",
32692
+ textBaseline: "middle"
32659
32693
  };
32660
32694
  }
32695
+ getLabelPosition(point, vector, text, style) {
32696
+ return getLabelPosition(point, vector, text, style);
32697
+ }
32661
32698
  }
32662
32699
  CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(CircleAxis, CircleAxisMixin);
32663
32700
 
@@ -44813,7 +44850,7 @@
44813
44850
  return !1 === untransformedPoint.defined && (invertedPoint.defined = !1), invertedPoint;
44814
44851
  }
44815
44852
  let theta = Math.atan(sin / cos);
44816
- theta += cos >= 0 ? 2 * Math.PI : Math.PI, theta >= 2 * Math.PI && (theta -= 2 * Math.PI), theta = clampRadian(theta);
44853
+ theta += cos >= 0 ? 2 * Math.PI : Math.PI, theta >= 2 * Math.PI && (theta -= 2 * Math.PI), theta = clampRadian$1(theta);
44817
44854
  const radius = isNumberClose(sin, 0) ? cos / Math.cos(theta) : sin / Math.sin(theta),
44818
44855
  invertedPoint = this.isTransposed() ? {
44819
44856
  r: theta,
@@ -49432,7 +49469,7 @@
49432
49469
  }
49433
49470
  },
49434
49471
  label: {
49435
- space: 8
49472
+ space: 5
49436
49473
  }
49437
49474
  };
49438
49475
 
@@ -58183,7 +58220,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58183
58220
  };
58184
58221
  registerVChartCore();
58185
58222
 
58186
- const version = "1.5.1";
58223
+ const version = "1.5.2-alpha.0";
58187
58224
 
58188
58225
  class ChartData {
58189
58226
  get dataList() {
@@ -67897,7 +67934,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
67897
67934
  const series = Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { seriesField: spec.seriesField, categoryField: spec.categoryField || spec.radiusField, valueField: spec.valueField || spec.angleField, startAngle: spec.startAngle, endAngle: spec.endAngle, radius: spec.radius, innerRadius: spec.innerRadius, centerX: spec.centerX, centerY: spec.centerY });
67898
67935
  return series;
67899
67936
  }
67900
- _transformProgressAxisSpec(spec, angleAxisDefaultSpec, radiusAxisDefaultSpec) {
67937
+ _transformProgressAxisSpec(spec, angleAxisDefaultSpec, radiusAxisDefaultSpec, angleAxisAppendSpec, radiusAxisAppendSpec) {
67901
67938
  var _a;
67902
67939
  if (!spec.axes) {
67903
67940
  spec.axes = [];
@@ -67933,6 +67970,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
67933
67970
  if (isNil$1(axesPtr.angle.max)) {
67934
67971
  axesPtr.angle.max = domain.max;
67935
67972
  }
67973
+ if (angleAxisAppendSpec) {
67974
+ const newSpec = mergeSpec({}, angleAxisAppendSpec, axesPtr.angle);
67975
+ Object.assign(axesPtr.angle, newSpec);
67976
+ }
67977
+ if (radiusAxisAppendSpec) {
67978
+ const newSpec = mergeSpec({}, radiusAxisAppendSpec, axesPtr.radius);
67979
+ Object.assign(axesPtr.radius, newSpec);
67980
+ }
67936
67981
  }
67937
67982
  }
67938
67983
 
@@ -68696,6 +68741,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
68696
68741
  }, {
68697
68742
  orient: 'radius',
68698
68743
  visible: false
68744
+ }, {
68745
+ zIndex: LayoutZIndex.Region + 50
68699
68746
  });
68700
68747
  }
68701
68748
  else {
@@ -68737,6 +68784,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
68737
68784
  if (isNil$1(axesPtr.radius.type)) {
68738
68785
  axesPtr.radius.type = 'linear';
68739
68786
  }
68787
+ if (isNil$1(axesPtr.angle.zIndex)) {
68788
+ axesPtr.angle.zIndex = LayoutZIndex.Region + 50;
68789
+ }
68740
68790
  }
68741
68791
  }
68742
68792
  GaugeChart.type = ChartTypeEnum.gauge;