@visactor/react-vchart 2.0.23-alpha.1 → 2.0.23-alpha.2

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
@@ -51954,8 +51954,7 @@
51954
51954
  this._option.layout = layout, null === (_a = this._chart) || void 0 === _a || _a.setLayout(layout);
51955
51955
  }
51956
51956
  reLayout() {
51957
- var _a, _b, _c;
51958
- null === (_a = this._chart) || void 0 === _a || _a.resetLayoutItemTag(), null === (_b = this._chart) || void 0 === _b || _b.setLayoutTag(!0, null, !1), null === (_c = this._compiler) || void 0 === _c || _c.render();
51957
+ this._chart && this._compiler && !this._isReleased && (this._chart.resetLayoutItemTag(), this._chart.setLayoutTag(!0, null, !1), this._compiler.render(), this._chart.onEvaluateEnd());
51959
51958
  }
51960
51959
  getCompiler() {
51961
51960
  return this._compiler;
@@ -54927,10 +54926,8 @@
54927
54926
  const record = data[i];
54928
54927
  if (record) {
54929
54928
  const startValue = record[startField],
54930
- endValue = record[endField || startField],
54931
- min = Math.min(startValue, endValue),
54932
- max = Math.max(startValue, endValue);
54933
- if (min <= value && max >= value) return record;
54929
+ endValue = record[endField || startField];
54930
+ if (startValue <= value && endValue >= value) return record;
54934
54931
  }
54935
54932
  }
54936
54933
  return null;
@@ -59002,11 +58999,8 @@
59002
58999
  field2 = "xField" === field ? series.fieldX2 : series.fieldY2,
59003
59000
  datum = getDatumByValue(series.getViewData().latestData, +value, field1, field2);
59004
59001
  if (datum) {
59005
- const posStart = "xField" === field ? series.dataToPositionX(datum) : series.dataToPositionY(datum);
59006
- if (field2) {
59007
- const posEnd = "xField" === field ? series.dataToPositionX1(datum) : series.dataToPositionY1(datum);
59008
- bandSize = Math.abs(posStart - posEnd), coord = Math.min(posStart, posEnd), value = `${datum[field1]} ~ ${datum[field2]}`;
59009
- } else bandSize = 1, coord = posStart;
59002
+ const startX = "xField" === field ? series.dataToPositionX(datum) : series.dataToPositionY(datum);
59003
+ field2 ? (bandSize = Math.abs(startX - ("xField" === field ? series.dataToPositionX1(datum) : series.dataToPositionY1(datum))), value = `${datum[field1]} ~ ${datum[field2]}`) : bandSize = 1, coord = startX;
59010
59004
  }
59011
59005
  niceLabelFormatter = axis.niceLabelFormatter;
59012
59006
  }
@@ -60584,29 +60578,44 @@
60584
60578
  visible: this._getInvalidDefined.bind(this)
60585
60579
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series));
60586
60580
  }
60587
- handleZoom(e) {
60588
- var _a, _b, _c, _d;
60589
- this.getMarksWithoutRoot().forEach(mark => {
60590
- if (!mark) return;
60591
- const graphics = mark.getGraphics();
60592
- graphics && graphics.length && graphics.forEach((graphicItem, i) => {
60593
- var _a, _b;
60594
- const datum = null === (_b = null === (_a = null == graphicItem ? void 0 : graphicItem.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
60595
- newPosition = this.dataToPosition(datum);
60596
- newPosition && graphicItem && graphicItem.translateTo(newPosition.x, newPosition.y);
60581
+ _updateSymbolGraphicPosition() {
60582
+ var _a;
60583
+ const graphics = null === (_a = this._symbolMark) || void 0 === _a ? void 0 : _a.getGraphics();
60584
+ graphics && graphics.length && graphics.forEach(graphicItem => {
60585
+ var _a, _b;
60586
+ const datum = null === (_b = null === (_a = null == graphicItem ? void 0 : graphicItem.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
60587
+ newPosition = this.dataToPosition(datum);
60588
+ newPosition && graphicItem && graphicItem.setAttributes({
60589
+ x: newPosition.x,
60590
+ y: newPosition.y
60597
60591
  });
60598
60592
  });
60599
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
60600
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
60601
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
60602
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
60603
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
60604
- labelGroup && (null == e ? void 0 : e.scale) && (null == e ? void 0 : e.scaleCenter) && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
60593
+ }
60594
+ _ensureLabelGraphicPostMatrix() {
60595
+ var _a, _b;
60596
+ const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
60597
+ return labelGraphic && !labelGraphic.attribute.postMatrix && labelGraphic.setAttributes({
60605
60598
  postMatrix: new Matrix()
60606
- }), labelGroup.scale(e.scale, e.scale, e.scaleCenter));
60599
+ }), labelGraphic;
60600
+ }
60601
+ handleZoom(e) {
60602
+ const {
60603
+ scale: scale,
60604
+ scaleCenter: scaleCenter
60605
+ } = e;
60606
+ if (1 === scale) return;
60607
+ this._updateSymbolGraphicPosition();
60608
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
60609
+ labelGraphic && labelGraphic.scale(scale, scale, scaleCenter);
60607
60610
  }
60608
60611
  handlePan(e) {
60609
- this.handleZoom(e);
60612
+ const {
60613
+ delta: delta
60614
+ } = e;
60615
+ if (0 === (null == delta ? void 0 : delta[0]) && 0 === (null == delta ? void 0 : delta[1])) return;
60616
+ this._updateSymbolGraphicPosition();
60617
+ const labelGraphic = this._ensureLabelGraphicPostMatrix();
60618
+ labelGraphic && labelGraphic.translate(delta[0], delta[1]);
60610
60619
  }
60611
60620
  getDefaultShapeType() {
60612
60621
  return "circle";
@@ -61630,7 +61639,7 @@
61630
61639
  super.release(), this._areaCache.clear(), this._nameMap = {}, this._mapViewData = null;
61631
61640
  }
61632
61641
  handleZoom(e) {
61633
- var _a, _b, _c, _d;
61642
+ var _a;
61634
61643
  const {
61635
61644
  scale: scale,
61636
61645
  scaleCenter: scaleCenter
@@ -61640,17 +61649,11 @@
61640
61649
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61641
61650
  postMatrix: new Matrix()
61642
61651
  }), pathGroup.scale(scale, scale, scaleCenter));
61643
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61644
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61645
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61646
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61647
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61648
- labelGroup && scale && scaleCenter && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61649
- postMatrix: new Matrix()
61650
- }), labelGroup.scale(scale, scale, scaleCenter));
61652
+ const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61653
+ vgrammarLabel && vgrammarLabel.renderInner();
61651
61654
  }
61652
61655
  handlePan(e) {
61653
- var _a, _b, _c, _d;
61656
+ var _a;
61654
61657
  const {
61655
61658
  delta: delta
61656
61659
  } = e;
@@ -61659,14 +61662,8 @@
61659
61662
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61660
61663
  postMatrix: new Matrix()
61661
61664
  }), pathGroup.translate(delta[0], delta[1]));
61662
- const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61663
- (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61664
- const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61665
- (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61666
- const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61667
- labelGroup && delta && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61668
- postMatrix: new Matrix()
61669
- }), labelGroup.translate(delta[0], delta[1]));
61665
+ const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61666
+ vgrammarLabel && vgrammarLabel.renderInner();
61670
61667
  }
61671
61668
  getDatumCenter(datum) {
61672
61669
  var _a, _b, _c, _d;