@visactor/vchart 1.5.1-alpha.5 → 1.5.1-alpha.6

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
@@ -26136,7 +26136,11 @@
26136
26136
  return result;
26137
26137
  }
26138
26138
  containsPoint(graphic, point, params) {
26139
- return !!this.pickItem(graphic, point, null, params);
26139
+ var _a;
26140
+ return !!(null === (_a = this.pickItem(graphic, point, null, null != params ? params : {
26141
+ pickContext: this.pickContext,
26142
+ pickerService: this
26143
+ })) || void 0 === _a ? void 0 : _a.graphic);
26140
26144
  }
26141
26145
  pickGroup(group, point, parentMatrix, params) {
26142
26146
  let result = {
@@ -30015,6 +30019,178 @@
30015
30019
  easing: "linear"
30016
30020
  };
30017
30021
 
30022
+ function polarToCartesian(point) {
30023
+ return point.radius ? {
30024
+ x: Math.cos(point.angle) * point.radius,
30025
+ y: Math.sin(point.angle) * point.radius
30026
+ } : {
30027
+ x: 0,
30028
+ y: 0
30029
+ };
30030
+ }
30031
+ function circlePoint(x0, y0, radius, radian) {
30032
+ const offset = polarToCartesian({
30033
+ radius: radius,
30034
+ angle: radian
30035
+ });
30036
+ return {
30037
+ x: x0 + offset.x,
30038
+ y: y0 + offset.y
30039
+ };
30040
+ }
30041
+ function computeQuadrant(angle) {
30042
+ return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
30043
+ }
30044
+ function normalizeAngle(angle) {
30045
+ for (; angle < 0;) angle += 2 * Math.PI;
30046
+ for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
30047
+ return angle;
30048
+ }
30049
+ function isQuadrantLeft(quadrant) {
30050
+ return 3 === quadrant || 4 === quadrant;
30051
+ }
30052
+ function isQuadrantRight(quadrant) {
30053
+ return 1 === quadrant || 2 === quadrant;
30054
+ }
30055
+ function lineCirclePoints(a, b, c, x0, y0, r) {
30056
+ if (0 === a && 0 === b || r <= 0) return [];
30057
+ if (0 === a) {
30058
+ const y1 = -c / b,
30059
+ fd = r ** 2 - (y1 - y0) ** 2;
30060
+ if (fd < 0) return [];
30061
+ if (0 === fd) return [{
30062
+ x: x0,
30063
+ y: y1
30064
+ }];
30065
+ return [{
30066
+ x: Math.sqrt(fd) + x0,
30067
+ y: y1
30068
+ }, {
30069
+ x: -Math.sqrt(fd) + x0,
30070
+ y: y1
30071
+ }];
30072
+ }
30073
+ if (0 === b) {
30074
+ const x1 = -c / a,
30075
+ fd = r ** 2 - (x1 - x0) ** 2;
30076
+ if (fd < 0) return [];
30077
+ if (0 === fd) return [{
30078
+ x: x1,
30079
+ y: y0
30080
+ }];
30081
+ return [{
30082
+ x: x1,
30083
+ y: Math.sqrt(fd) + y0
30084
+ }, {
30085
+ x: x1,
30086
+ y: -Math.sqrt(fd) + y0
30087
+ }];
30088
+ }
30089
+ const fa = (b / a) ** 2 + 1,
30090
+ fb = 2 * ((c / a + x0) * (b / a) - y0),
30091
+ fd = fb ** 2 - 4 * fa * ((c / a + x0) ** 2 + y0 ** 2 - r ** 2);
30092
+ if (fd < 0) return [];
30093
+ const y1 = (-fb + Math.sqrt(fd)) / (2 * fa),
30094
+ y2 = (-fb - Math.sqrt(fd)) / (2 * fa),
30095
+ x1 = -(b * y1 + c) / a;
30096
+ return 0 === fd ? [{
30097
+ x: x1,
30098
+ y: y1
30099
+ }] : [{
30100
+ x: x1,
30101
+ y: y1
30102
+ }, {
30103
+ x: -(b * y2 + c) / a,
30104
+ y: y2
30105
+ }];
30106
+ }
30107
+ function connectLineRadian(radius, length) {
30108
+ return length > 2 * radius ? NaN : 2 * Math.asin(length / 2 / radius);
30109
+ }
30110
+ function checkBoundsOverlap(boundsA, boundsB) {
30111
+ const {
30112
+ x1: ax1,
30113
+ y1: ay1,
30114
+ x2: ax2,
30115
+ y2: ay2
30116
+ } = boundsA,
30117
+ {
30118
+ x1: bx1,
30119
+ y1: by1,
30120
+ x2: bx2,
30121
+ y2: by2
30122
+ } = boundsB;
30123
+ return !(ax1 <= bx1 && ax2 <= bx1 || ax1 >= bx2 && ax2 >= bx2 || ay1 <= by1 && ay2 <= by1 || ay1 >= by2 && ay2 >= by2);
30124
+ }
30125
+ const labelingPoint = function (textBounds, graphicBounds) {
30126
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "top";
30127
+ let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30128
+ if (!textBounds) return;
30129
+ const {
30130
+ x1: x1,
30131
+ y1: y1,
30132
+ x2: x2,
30133
+ y2: y2
30134
+ } = textBounds,
30135
+ width = Math.abs(x2 - x1),
30136
+ height = Math.abs(y2 - y1),
30137
+ anchorX = (graphicBounds.x1 + graphicBounds.x2) / 2,
30138
+ anchorY = (graphicBounds.y1 + graphicBounds.y2) / 2;
30139
+ let sx = 0,
30140
+ sy = 0,
30141
+ offsetX = 0,
30142
+ offsetY = 0;
30143
+ graphicBounds && (offsetX = Math.abs(graphicBounds.x1 - graphicBounds.x2) / 2, offsetY = Math.abs(graphicBounds.y1 - graphicBounds.y2) / 2);
30144
+ const angle = {
30145
+ "top-right": -235,
30146
+ "top-left": 235,
30147
+ "bottom-right": 45,
30148
+ "bottom-left": -45
30149
+ };
30150
+ switch (position) {
30151
+ case "top":
30152
+ sy = -1;
30153
+ break;
30154
+ case "bottom":
30155
+ sy = 1;
30156
+ break;
30157
+ case "left":
30158
+ sx = -1;
30159
+ break;
30160
+ case "right":
30161
+ sx = 1;
30162
+ break;
30163
+ case "bottom-left":
30164
+ case "bottom-right":
30165
+ case "top-left":
30166
+ case "top-right":
30167
+ sx = Math.sin(angle[position] * (Math.PI / 180)), sy = Math.cos(angle[position] * (Math.PI / 180));
30168
+ break;
30169
+ case "center":
30170
+ sx = 0, sy = 0;
30171
+ }
30172
+ return {
30173
+ x: anchorX + sx * (offset + offsetX) + Math.sign(sx) * (width / 2),
30174
+ y: anchorY + sy * (offset + offsetY) + Math.sign(sy) * (height / 2)
30175
+ };
30176
+ };
30177
+ const getPointsOfLineArea = graphic => {
30178
+ if (!graphic || !graphic.attribute) return [];
30179
+ const {
30180
+ points: points,
30181
+ segments: segments
30182
+ } = graphic.attribute;
30183
+ if (segments && segments.length) {
30184
+ const res = [];
30185
+ return segments.forEach(seg => {
30186
+ seg.points.forEach(point => {
30187
+ res.push(point);
30188
+ });
30189
+ }), res;
30190
+ }
30191
+ return points;
30192
+ };
30193
+
30018
30194
  class LabelBase extends AbstractComponent {
30019
30195
  setBitmap(bitmap) {
30020
30196
  this._bitmap = bitmap;
@@ -30043,16 +30219,17 @@
30043
30219
  }, this._handleRelatedGraphicSetState = e => {
30044
30220
  var _a, _b, _c;
30045
30221
  if ((null === (_a = e.detail) || void 0 === _a ? void 0 : _a.type) === AttributeUpdateType.STATE) {
30046
- const currentStates = null !== (_c = null === (_b = e.target) || void 0 === _b ? void 0 : _b.currentStates) && void 0 !== _c ? _c : [],
30047
- label = this._graphicToText.get(e.target);
30048
- label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
30222
+ const currentStates = null !== (_c = null === (_b = e.target) || void 0 === _b ? void 0 : _b.currentStates) && void 0 !== _c ? _c : [];
30223
+ (this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)]).forEach(label => {
30224
+ label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
30225
+ });
30049
30226
  }
30050
30227
  };
30051
30228
  }
30052
30229
  labeling(textBounds, graphicBounds, position, offset) {}
30053
30230
  _labelLine(text) {}
30054
30231
  render() {
30055
- if (this._prepare(), isNil$1(this._idToGraphic)) return;
30232
+ if (this._prepare(), this._isCollectionBase && isNil$1(this._idToPoint) || !this._isCollectionBase && isNil$1(this._idToGraphic)) return;
30056
30233
  const {
30057
30234
  overlap: overlap,
30058
30235
  smartInvert: smartInvert,
@@ -30062,7 +30239,7 @@
30062
30239
  } = this.attribute;
30063
30240
  let labels,
30064
30241
  data = this.attribute.data;
30065
- isFunction$1(dataFilter) && (data = dataFilter(data)), labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, d => this._idToGraphic.get(d.id)) : this._layout(data), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, d => this._idToGraphic.get(d.id)) : !1 !== overlap && (labels = this._overlapping(labels)), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
30242
+ isFunction$1(dataFilter) && (data = dataFilter(data)), labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, this.getRelatedGrphic, this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(data), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGrphic, this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : !1 !== overlap && (labels = this._overlapping(labels)), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
30066
30243
  }
30067
30244
  _bindEvent(target) {
30068
30245
  if (this.attribute.disableTriggerEvent) return;
@@ -30088,16 +30265,24 @@
30088
30265
  return this._bindEvent(text), this._setStatesOfText(text), text;
30089
30266
  }
30090
30267
  _prepare() {
30091
- var _a;
30268
+ var _a, _b, _c, _d;
30092
30269
  const currentBaseMarks = [];
30093
30270
  let baseMarks;
30094
30271
  if (baseMarks = isFunction$1(this.attribute.getBaseMarks) ? this.attribute.getBaseMarks() : getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName), baseMarks.forEach(mark => {
30095
30272
  "willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
30096
- }), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), this._baseMarks = currentBaseMarks, !currentBaseMarks || 0 === currentBaseMarks.length) return;
30273
+ }), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), null === (_b = this._idToPoint) || void 0 === _b || _b.clear(), this._baseMarks = currentBaseMarks, this._isCollectionBase = "line" === (null === (_c = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _c ? void 0 : _c.type) || "area" === (null === (_d = null == currentBaseMarks ? void 0 : currentBaseMarks[0]) || void 0 === _d ? void 0 : _d.type), !currentBaseMarks || 0 === currentBaseMarks.length) return;
30097
30274
  const {
30098
30275
  data: data
30099
30276
  } = this.attribute;
30100
- if (data && 0 !== data.length) {
30277
+ if (data && 0 !== data.length) if (this._isCollectionBase) {
30278
+ this._idToPoint || (this._idToPoint = new Map());
30279
+ const baseMark = currentBaseMarks[0],
30280
+ points = getPointsOfLineArea(baseMark);
30281
+ if (null == points ? void 0 : points.length) for (let i = 0; i < points.length; i++) {
30282
+ const textData = data[i];
30283
+ textData && points[i] && (isValid$1(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`), this._idToPoint.set(textData.id, points[i]));
30284
+ }
30285
+ } else {
30101
30286
  this._idToGraphic || (this._idToGraphic = new Map());
30102
30287
  for (let i = 0; i < currentBaseMarks.length; i++) {
30103
30288
  const textData = data[i],
@@ -30106,6 +30291,9 @@
30106
30291
  }
30107
30292
  }
30108
30293
  }
30294
+ getRelatedGrphic(item) {
30295
+ return this._isCollectionBase ? this._baseMarks[0] : this._idToGraphic.get(item.id);
30296
+ }
30109
30297
  _layout() {
30110
30298
  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
30111
30299
  const {
@@ -30116,13 +30304,13 @@
30116
30304
  labels = [];
30117
30305
  for (let i = 0; i < data.length; i++) {
30118
30306
  const textData = data[i],
30119
- baseMark = this._idToGraphic.get(textData.id),
30307
+ baseMark = this.getRelatedGrphic(textData),
30120
30308
  labelAttribute = Object.assign(Object.assign({
30121
- fill: baseMark.attribute.fill
30309
+ fill: this._isCollectionBase ? isArray$1(baseMark.attribute.stroke) ? baseMark.attribute.stroke.find(entry => !!entry && !0 !== entry) : baseMark.attribute.stroke : baseMark.attribute.fill
30122
30310
  }, textStyle), textData),
30123
30311
  text = this._createLabelText(labelAttribute),
30124
30312
  textBounds = this.getGraphicBounds(text),
30125
- graphicBounds = this.getGraphicBounds(baseMark, {
30313
+ graphicBounds = this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(textData.id)) : this.getGraphicBounds(baseMark, {
30126
30314
  x: textData.x,
30127
30315
  y: textData.y
30128
30316
  }),
@@ -30163,7 +30351,7 @@
30163
30351
  for (let i = 0; i < labels.length; i++) {
30164
30352
  if (!1 === labels[i].visible) continue;
30165
30353
  const text = labels[i],
30166
- baseMark = this._idToGraphic.get(text.attribute.id);
30354
+ baseMark = this.getRelatedGrphic(text.attribute);
30167
30355
  if (text.update(), !isRectIntersect(baseMark.AABBBounds, {
30168
30356
  x1: 0,
30169
30357
  x2: bmpTool.width,
@@ -30181,7 +30369,7 @@
30181
30369
  }
30182
30370
  }
30183
30371
  let hasPlace = !1;
30184
- 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) {
30372
+ for (let j = 0; j < strategy.length; j++) if (hasPlace = place$2(bmpTool, bitmap, strategy[j], this.attribute, text, this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(labels[i].attribute.id)) : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling), !1 !== hasPlace) {
30185
30373
  text.setAttributes({
30186
30374
  x: hasPlace.x,
30187
30375
  y: hasPlace.y
@@ -30241,10 +30429,12 @@
30241
30429
  labels.forEach((text, index) => {
30242
30430
  var _a, _b, _c, _d, _e, _f, _g;
30243
30431
  const labelLine = this._labelLine(text),
30244
- relatedGraphic = this._idToGraphic.get(text.attribute.id),
30245
- state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
30432
+ relatedGraphic = this.getRelatedGrphic(text.attribute),
30433
+ textId = text.attribute.id,
30434
+ textKey = this._isCollectionBase ? textId : relatedGraphic,
30435
+ state = (null == prevTextMap ? void 0 : prevTextMap.get(textKey)) ? "update" : "enter";
30246
30436
  if ("enter" === state) {
30247
- if (texts.push(text), currentTextMap.set(relatedGraphic, labelLine ? {
30437
+ if (texts.push(text), currentTextMap.set(textKey, labelLine ? {
30248
30438
  text: text,
30249
30439
  labelLine: labelLine
30250
30440
  } : {
@@ -30254,7 +30444,7 @@
30254
30444
  from: from,
30255
30445
  to: to
30256
30446
  } = getAnimationAttributes(text.attribute, "fadeIn");
30257
- this.add(text), labelLine && (this._setStatesOfLabelLine(labelLine), this.add(labelLine)), this._syncStateWithRelatedGraphic(relatedGraphic), relatedGraphic.once("animate-bind", () => {
30447
+ this.add(text), labelLine && (this._setStatesOfLabelLine(labelLine), this.add(labelLine)), this._syncStateWithRelatedGraphic(relatedGraphic), relatedGraphic.once("animate-bind", a => {
30258
30448
  text.setAttributes(from);
30259
30449
  const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
30260
30450
  mode: mode,
@@ -30267,8 +30457,8 @@
30267
30457
  });
30268
30458
  }
30269
30459
  } else if ("update" === state) {
30270
- const prevLabel = prevTextMap.get(relatedGraphic);
30271
- prevTextMap.delete(relatedGraphic), currentTextMap.set(relatedGraphic, prevLabel);
30460
+ const prevLabel = prevTextMap.get(textKey);
30461
+ prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel);
30272
30462
  const prevText = prevLabel.text;
30273
30463
  prevText.animate().to(text.attribute, duration, easing), prevLabel.labelLine && prevLabel.labelLine.animate().to(merge$1({}, prevLabel.labelLine.attribute, {
30274
30464
  visible: null === (_f = null !== (_d = (null === (_b = null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.line) || void 0 === _b ? void 0 : _b.visible) && (null === (_c = text.attribute) || void 0 === _c ? void 0 : _c.visible)) && void 0 !== _d ? _d : null === (_e = text.attribute) || void 0 === _e ? void 0 : _e.visible) || void 0 === _f || _f,
@@ -30292,16 +30482,17 @@
30292
30482
  labels.forEach(text => {
30293
30483
  var _a;
30294
30484
  const labelLine = this._labelLine(text),
30295
- relatedGraphic = this._idToGraphic.get(text.attribute.id),
30296
- state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
30297
- if ("enter" === state) currentTextMap.set(relatedGraphic, labelLine ? {
30485
+ relatedGraphic = this.getRelatedGrphic(text.attribute),
30486
+ state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter",
30487
+ textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
30488
+ if ("enter" === state) currentTextMap.set(textKey, labelLine ? {
30298
30489
  text: text,
30299
30490
  labelLine: labelLine
30300
30491
  } : {
30301
30492
  text: text
30302
30493
  }), this.add(text), labelLine && this.add(labelLine), this._syncStateWithRelatedGraphic(relatedGraphic);else if ("update" === state) {
30303
- const prevLabel = prevTextMap.get(relatedGraphic);
30304
- prevTextMap.delete(relatedGraphic), currentTextMap.set(relatedGraphic, prevLabel), prevLabel.text.setAttributes(text.attribute), (null == prevLabel ? void 0 : prevLabel.labelLine) && prevLabel.labelLine.setAttributes({
30494
+ const prevLabel = prevTextMap.get(textKey);
30495
+ prevTextMap.delete(textKey), currentTextMap.set(textKey, prevLabel), prevLabel.text.setAttributes(text.attribute), (null == prevLabel ? void 0 : prevLabel.labelLine) && prevLabel.labelLine.setAttributes({
30305
30496
  points: null === (_a = text.attribute) || void 0 === _a ? void 0 : _a.points
30306
30497
  });
30307
30498
  }
@@ -30321,7 +30512,7 @@
30321
30512
  delay: delay
30322
30513
  } = _ref;
30323
30514
  const listener = event => {
30324
- var _a;
30515
+ var _a, _b;
30325
30516
  const {
30326
30517
  detail: detail
30327
30518
  } = event;
@@ -30345,7 +30536,12 @@
30345
30536
  });
30346
30537
  break;
30347
30538
  default:
30348
- detail.animationState.isFirstFrameOfStep && text.animate({
30539
+ if (this._isCollectionBase) {
30540
+ const point = this._idToPoint.get(text.attribute.id);
30541
+ !point || text.animates && text.animates.has("label-animate") || !this._baseMarks[0].containsPoint(point.x, point.y, IContainPointMode.LOCAL, null === (_b = this.stage) || void 0 === _b ? void 0 : _b.pickerService) || text.animate({
30542
+ onEnd: onEnd
30543
+ }).wait(delay).to(to, duration, easing);
30544
+ } else detail.animationState.isFirstFrameOfStep && text.animate({
30349
30545
  onEnd: onEnd
30350
30546
  }).wait(delay).to(to, duration, easing);
30351
30547
  }
@@ -30368,7 +30564,7 @@
30368
30564
  if ("null" !== fillStrategy || "null" !== strokeStrategy) for (let i = 0; i < labels.length; i++) {
30369
30565
  const label = labels[i];
30370
30566
  if (!label) continue;
30371
- const baseMark = this._idToGraphic.get(label.attribute.id),
30567
+ const baseMark = this.getRelatedGrphic(label.attribute),
30372
30568
  backgroundColor = baseMark.attribute.fill,
30373
30569
  foregroundColor = label.attribute.fill,
30374
30570
  baseColor = backgroundColor,
@@ -30444,54 +30640,7 @@
30444
30640
  labeling(textBounds, graphicBounds) {
30445
30641
  let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "top";
30446
30642
  let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30447
- if (!textBounds) return;
30448
- const {
30449
- x1: x1,
30450
- y1: y1,
30451
- x2: x2,
30452
- y2: y2
30453
- } = textBounds,
30454
- width = Math.abs(x2 - x1),
30455
- height = Math.abs(y2 - y1),
30456
- anchorX = (graphicBounds.x1 + graphicBounds.x2) / 2,
30457
- anchorY = (graphicBounds.y1 + graphicBounds.y2) / 2;
30458
- let sx = 0,
30459
- sy = 0,
30460
- offsetX = 0,
30461
- offsetY = 0;
30462
- graphicBounds && (offsetX = Math.abs(graphicBounds.x1 - graphicBounds.x2) / 2, offsetY = Math.abs(graphicBounds.y1 - graphicBounds.y2) / 2);
30463
- const angle = {
30464
- "top-right": -235,
30465
- "top-left": 235,
30466
- "bottom-right": 45,
30467
- "bottom-left": -45
30468
- };
30469
- switch (position) {
30470
- case "top":
30471
- sy = -1;
30472
- break;
30473
- case "bottom":
30474
- sy = 1;
30475
- break;
30476
- case "left":
30477
- sx = -1;
30478
- break;
30479
- case "right":
30480
- sx = 1;
30481
- break;
30482
- case "bottom-left":
30483
- case "bottom-right":
30484
- case "top-left":
30485
- case "top-right":
30486
- sx = Math.sin(angle[position] * (Math.PI / 180)), sy = Math.cos(angle[position] * (Math.PI / 180));
30487
- break;
30488
- case "center":
30489
- sx = 0, sy = 0;
30490
- }
30491
- return {
30492
- x: anchorX + sx * (offset + offsetX) + Math.sign(sx) * (width / 2),
30493
- y: anchorY + sy * (offset + offsetY) + Math.sign(sy) * (height / 2)
30494
- };
30643
+ return labelingPoint(textBounds, graphicBounds, position, offset);
30495
30644
  }
30496
30645
  }
30497
30646
  SymbolLabel.defaultAttributes = {
@@ -30570,110 +30719,6 @@
30570
30719
  pickable: !1
30571
30720
  };
30572
30721
 
30573
- function polarToCartesian(point) {
30574
- return point.radius ? {
30575
- x: Math.cos(point.angle) * point.radius,
30576
- y: Math.sin(point.angle) * point.radius
30577
- } : {
30578
- x: 0,
30579
- y: 0
30580
- };
30581
- }
30582
- function circlePoint(x0, y0, radius, radian) {
30583
- const offset = polarToCartesian({
30584
- radius: radius,
30585
- angle: radian
30586
- });
30587
- return {
30588
- x: x0 + offset.x,
30589
- y: y0 + offset.y
30590
- };
30591
- }
30592
- function computeQuadrant(angle) {
30593
- return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
30594
- }
30595
- function normalizeAngle(angle) {
30596
- for (; angle < 0;) angle += 2 * Math.PI;
30597
- for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
30598
- return angle;
30599
- }
30600
- function isQuadrantLeft(quadrant) {
30601
- return 3 === quadrant || 4 === quadrant;
30602
- }
30603
- function isQuadrantRight(quadrant) {
30604
- return 1 === quadrant || 2 === quadrant;
30605
- }
30606
- function lineCirclePoints(a, b, c, x0, y0, r) {
30607
- if (0 === a && 0 === b || r <= 0) return [];
30608
- if (0 === a) {
30609
- const y1 = -c / b,
30610
- fd = r ** 2 - (y1 - y0) ** 2;
30611
- if (fd < 0) return [];
30612
- if (0 === fd) return [{
30613
- x: x0,
30614
- y: y1
30615
- }];
30616
- return [{
30617
- x: Math.sqrt(fd) + x0,
30618
- y: y1
30619
- }, {
30620
- x: -Math.sqrt(fd) + x0,
30621
- y: y1
30622
- }];
30623
- }
30624
- if (0 === b) {
30625
- const x1 = -c / a,
30626
- fd = r ** 2 - (x1 - x0) ** 2;
30627
- if (fd < 0) return [];
30628
- if (0 === fd) return [{
30629
- x: x1,
30630
- y: y0
30631
- }];
30632
- return [{
30633
- x: x1,
30634
- y: Math.sqrt(fd) + y0
30635
- }, {
30636
- x: x1,
30637
- y: -Math.sqrt(fd) + y0
30638
- }];
30639
- }
30640
- const fa = (b / a) ** 2 + 1,
30641
- fb = 2 * ((c / a + x0) * (b / a) - y0),
30642
- fd = fb ** 2 - 4 * fa * ((c / a + x0) ** 2 + y0 ** 2 - r ** 2);
30643
- if (fd < 0) return [];
30644
- const y1 = (-fb + Math.sqrt(fd)) / (2 * fa),
30645
- y2 = (-fb - Math.sqrt(fd)) / (2 * fa),
30646
- x1 = -(b * y1 + c) / a;
30647
- return 0 === fd ? [{
30648
- x: x1,
30649
- y: y1
30650
- }] : [{
30651
- x: x1,
30652
- y: y1
30653
- }, {
30654
- x: -(b * y2 + c) / a,
30655
- y: y2
30656
- }];
30657
- }
30658
- function connectLineRadian(radius, length) {
30659
- return length > 2 * radius ? NaN : 2 * Math.asin(length / 2 / radius);
30660
- }
30661
- function checkBoundsOverlap(boundsA, boundsB) {
30662
- const {
30663
- x1: ax1,
30664
- y1: ay1,
30665
- x2: ax2,
30666
- y2: ay2
30667
- } = boundsA,
30668
- {
30669
- x1: bx1,
30670
- y1: by1,
30671
- x2: bx2,
30672
- y2: by2
30673
- } = boundsB;
30674
- return !(ax1 <= bx1 && ax2 <= bx1 || ax1 >= bx2 && ax2 >= bx2 || ay1 <= by1 && ay2 <= by1 || ay1 >= by2 && ay2 >= by2);
30675
- }
30676
-
30677
30722
  class ArcInfo {
30678
30723
  constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle, innerRadius, outerRadius, circleCenter) {
30679
30724
  this.refDatum = refDatum, this.center = center, this.outerCenter = outerCenter, this.quadrant = quadrant, this.radian = radian, this.middleAngle = middleAngle, this.innerRadius = innerRadius, this.outerRadius = outerRadius, this.circleCenter = circleCenter, this.labelVisible = !0, this.labelLimit = 0;
@@ -31205,10 +31250,34 @@
31205
31250
  pickable: !1
31206
31251
  };
31207
31252
 
31253
+ class LineDataLabel extends LabelBase {
31254
+ constructor(attributes) {
31255
+ super(merge$1({}, LineDataLabel.defaultAttributes, attributes)), this.name = "line-data-label";
31256
+ }
31257
+ labeling(textBounds, graphicBounds) {
31258
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "top";
31259
+ let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31260
+ return labelingPoint(textBounds, graphicBounds, position, offset);
31261
+ }
31262
+ }
31263
+ LineDataLabel.defaultAttributes = {
31264
+ textStyle: {
31265
+ fontSize: 12,
31266
+ fill: "#000",
31267
+ textAlign: "center",
31268
+ textBaseline: "middle",
31269
+ boundsPadding: [-1, 0, -1, 0]
31270
+ },
31271
+ position: "top",
31272
+ offset: 5,
31273
+ pickable: !1
31274
+ };
31275
+
31208
31276
  const labelComponentMap = {
31209
31277
  rect: RectLabel,
31210
31278
  symbol: SymbolLabel,
31211
- arc: ArcLabel
31279
+ arc: ArcLabel,
31280
+ "line-data": LineDataLabel
31212
31281
  };
31213
31282
  class DataLabel extends AbstractComponent {
31214
31283
  constructor(attributes) {
@@ -38657,7 +38726,8 @@
38657
38726
  getBoundingClientRect: () => ({
38658
38727
  height: domref.height,
38659
38728
  width: domref.width
38660
- })
38729
+ }),
38730
+ nativeCanvas: _canvas
38661
38731
  };
38662
38732
  canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
38663
38733
  });
@@ -41355,6 +41425,10 @@
41355
41425
  init() {
41356
41426
  this._context = new LynxContext2d(this, this._dpr);
41357
41427
  }
41428
+ resize(width, height) {
41429
+ this._pixelWidth = width * this._dpr, this._pixelHeight = height * this._dpr, this._displayWidth = width, this._displayHeight = height, this._nativeCanvas.width = this._pixelWidth, this._nativeCanvas.height = this._pixelHeight, this._nativeCanvas.nativeCanvas && (this._nativeCanvas.nativeCanvas.width = this._pixelWidth, this._nativeCanvas.nativeCanvas.height = this._pixelHeight);
41430
+ this._context.dpr = this._dpr;
41431
+ }
41358
41432
  release() {}
41359
41433
  };
41360
41434
  LynxCanvas.env = "lynx", LynxCanvas = __decorate$a([injectable(), __metadata$8("design:paramtypes", [Object])], LynxCanvas);
@@ -41454,7 +41528,9 @@
41454
41528
  });
41455
41529
  }
41456
41530
  releaseWindow() {}
41457
- resizeWindow(width, height) {}
41531
+ resizeWindow(width, height) {
41532
+ this.canvas.resize(width, height);
41533
+ }
41458
41534
  setDpr(dpr) {
41459
41535
  this.canvas.dpr = dpr;
41460
41536
  }
@@ -57916,7 +57992,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57916
57992
  };
57917
57993
  registerVChartCore();
57918
57994
 
57919
- const version = "1.5.1-alpha.5";
57995
+ const version = "1.5.1-alpha.6";
57920
57996
 
57921
57997
  class ChartData {
57922
57998
  get dataList() {