@visactor/vchart 2.0.23-alpha.2 → 2.0.23-alpha.3

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 (46) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +71 -57
  3. package/build/index.js +71 -57
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/component/index.js +1 -1
  7. package/cjs/component/legend/base-legend.js +1 -1
  8. package/cjs/component/legend/base-legend.js.map +1 -1
  9. package/cjs/component/util.js +1 -2
  10. package/cjs/constant/attribute.js +2 -1
  11. package/cjs/constant/scroll-bar.js +1 -2
  12. package/cjs/constant/waterfall.js +2 -1
  13. package/cjs/core/index.js +1 -1
  14. package/cjs/core/instance-manager.js +1 -1
  15. package/cjs/core/interface.js +1 -1
  16. package/cjs/core/util.js +1 -1
  17. package/cjs/core/vchart.js +3 -2
  18. package/cjs/core/vchart.js.map +1 -1
  19. package/cjs/data/initialize.js +1 -1
  20. package/cjs/data/register.js +1 -1
  21. package/cjs/series/map/map.js +18 -6
  22. package/cjs/series/map/map.js.map +1 -1
  23. package/cjs/series/scatter/scatter.d.ts +0 -2
  24. package/cjs/series/scatter/scatter.js +18 -28
  25. package/cjs/series/scatter/scatter.js.map +1 -1
  26. package/esm/component/index.js +1 -1
  27. package/esm/component/legend/base-legend.js +1 -1
  28. package/esm/component/legend/base-legend.js.map +1 -1
  29. package/esm/component/util.js +1 -2
  30. package/esm/constant/attribute.js +2 -1
  31. package/esm/constant/scroll-bar.js +1 -2
  32. package/esm/constant/waterfall.js +2 -1
  33. package/esm/core/index.js +1 -1
  34. package/esm/core/instance-manager.js +1 -1
  35. package/esm/core/interface.js +1 -1
  36. package/esm/core/util.js +1 -1
  37. package/esm/core/vchart.js +3 -2
  38. package/esm/core/vchart.js.map +1 -1
  39. package/esm/data/initialize.js +1 -1
  40. package/esm/data/register.js +1 -1
  41. package/esm/series/map/map.js +18 -6
  42. package/esm/series/map/map.js.map +1 -1
  43. package/esm/series/scatter/scatter.d.ts +0 -2
  44. package/esm/series/scatter/scatter.js +18 -28
  45. package/esm/series/scatter/scatter.js.map +1 -1
  46. package/package.json +5 -5
package/build/index.es.js CHANGED
@@ -61784,13 +61784,10 @@ class VChart {
61784
61784
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setLayout(layout);
61785
61785
  }
61786
61786
  reLayout() {
61787
- if (!this._chart || !this._compiler || this._isReleased) {
61788
- return;
61789
- }
61790
- this._chart.resetLayoutItemTag();
61791
- this._chart.setLayoutTag(true, null, false);
61792
- this._compiler.render();
61793
- this._chart.onEvaluateEnd();
61787
+ var _a, _b, _c;
61788
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.resetLayoutItemTag();
61789
+ (_b = this._chart) === null || _b === void 0 ? void 0 : _b.setLayoutTag(true, null, false);
61790
+ (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.render();
61794
61791
  }
61795
61792
  getCompiler() {
61796
61793
  return this._compiler;
@@ -74026,55 +74023,45 @@ class ScatterSeries extends CartesianSeries {
74026
74023
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
74027
74024
  }
74028
74025
  }
74029
- _updateSymbolGraphicPosition() {
74030
- var _a;
74031
- const graphics = (_a = this._symbolMark) === null || _a === void 0 ? void 0 : _a.getGraphics();
74032
- if (!graphics || !graphics.length) {
74033
- return;
74034
- }
74035
- graphics.forEach((graphicItem) => {
74036
- var _a, _b;
74037
- const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74038
- const newPosition = this.dataToPosition(datum);
74039
- if (newPosition && graphicItem) {
74040
- graphicItem.setAttributes({
74041
- x: newPosition.x,
74042
- y: newPosition.y
74043
- });
74026
+ handleZoom(e) {
74027
+ var _a, _b, _c, _d;
74028
+ this.getMarksWithoutRoot().forEach(mark => {
74029
+ if (!mark) {
74030
+ return;
74044
74031
  }
74045
- });
74046
- }
74047
- _ensureLabelGraphicPostMatrix() {
74048
- var _a, _b;
74049
- const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74050
- if (labelGraphic && !labelGraphic.attribute.postMatrix) {
74051
- labelGraphic.setAttributes({
74052
- postMatrix: new Matrix()
74032
+ const graphics = mark.getGraphics();
74033
+ if (!graphics || !graphics.length) {
74034
+ return;
74035
+ }
74036
+ graphics.forEach((graphicItem, i) => {
74037
+ var _a, _b;
74038
+ const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74039
+ const newPosition = this.dataToPosition(datum);
74040
+ if (newPosition && graphicItem) {
74041
+ graphicItem.translateTo(newPosition.x, newPosition.y);
74042
+ }
74053
74043
  });
74044
+ });
74045
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
74046
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
74047
+ labelComponent.renderInner();
74054
74048
  }
74055
- return labelGraphic;
74056
- }
74057
- handleZoom(e) {
74058
- const { scale, scaleCenter } = e;
74059
- if (scale === 1) {
74060
- return;
74049
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
74050
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
74051
+ vgrammarLabel.evaluate(null, null);
74061
74052
  }
74062
- this._updateSymbolGraphicPosition();
74063
- const labelGraphic = this._ensureLabelGraphicPostMatrix();
74064
- if (labelGraphic) {
74065
- labelGraphic.scale(scale, scale, scaleCenter);
74053
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
74054
+ if (labelGroup && (e === null || e === void 0 ? void 0 : e.scale) && (e === null || e === void 0 ? void 0 : e.scaleCenter)) {
74055
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
74056
+ labelGroup.setAttributes({
74057
+ postMatrix: new Matrix()
74058
+ });
74059
+ }
74060
+ labelGroup.scale(e.scale, e.scale, e.scaleCenter);
74066
74061
  }
74067
74062
  }
74068
74063
  handlePan(e) {
74069
- const { delta } = e;
74070
- if ((delta === null || delta === void 0 ? void 0 : delta[0]) === 0 && (delta === null || delta === void 0 ? void 0 : delta[1]) === 0) {
74071
- return;
74072
- }
74073
- this._updateSymbolGraphicPosition();
74074
- const labelGraphic = this._ensureLabelGraphicPostMatrix();
74075
- if (labelGraphic) {
74076
- labelGraphic.translate(delta[0], delta[1]);
74077
- }
74064
+ this.handleZoom(e);
74078
74065
  }
74079
74066
  getDefaultShapeType() {
74080
74067
  return 'circle';
@@ -75333,7 +75320,7 @@ class MapSeries extends GeoSeries {
75333
75320
  this._mapViewData = null;
75334
75321
  }
75335
75322
  handleZoom(e) {
75336
- var _a;
75323
+ var _a, _b, _c, _d;
75337
75324
  const { scale, scaleCenter } = e;
75338
75325
  if (scale === 1) {
75339
75326
  return;
@@ -75347,13 +75334,26 @@ class MapSeries extends GeoSeries {
75347
75334
  }
75348
75335
  pathGroup.scale(scale, scale, scaleCenter);
75349
75336
  }
75350
- const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75351
- if (vgrammarLabel) {
75352
- vgrammarLabel.renderInner();
75337
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75338
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75339
+ labelComponent.renderInner();
75340
+ }
75341
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75342
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75343
+ vgrammarLabel.evaluate(null, null);
75344
+ }
75345
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75346
+ if (labelGroup && scale && scaleCenter) {
75347
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75348
+ labelGroup.setAttributes({
75349
+ postMatrix: new Matrix()
75350
+ });
75351
+ }
75352
+ labelGroup.scale(scale, scale, scaleCenter);
75353
75353
  }
75354
75354
  }
75355
75355
  handlePan(e) {
75356
- var _a;
75356
+ var _a, _b, _c, _d;
75357
75357
  const { delta } = e;
75358
75358
  if (delta[0] === 0 && delta[1] === 0) {
75359
75359
  return;
@@ -75367,9 +75367,22 @@ class MapSeries extends GeoSeries {
75367
75367
  }
75368
75368
  pathGroup.translate(delta[0], delta[1]);
75369
75369
  }
75370
- const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75371
- if (vgrammarLabel) {
75372
- vgrammarLabel.renderInner();
75370
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75371
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75372
+ labelComponent.renderInner();
75373
+ }
75374
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75375
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75376
+ vgrammarLabel.evaluate(null, null);
75377
+ }
75378
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75379
+ if (labelGroup && delta) {
75380
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75381
+ labelGroup.setAttributes({
75382
+ postMatrix: new Matrix()
75383
+ });
75384
+ }
75385
+ labelGroup.translate(delta[0], delta[1]);
75373
75386
  }
75374
75387
  }
75375
75388
  getDatumCenter(datum) {
@@ -95590,6 +95603,7 @@ class BaseLegend extends BaseComponent {
95590
95603
  }
95591
95604
  clear() {
95592
95605
  super.clear();
95606
+ this._legendComponent = null;
95593
95607
  this._cacheAttrs = null;
95594
95608
  this._preSelectedData = null;
95595
95609
  }
package/build/index.js CHANGED
@@ -61790,13 +61790,10 @@
61790
61790
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setLayout(layout);
61791
61791
  }
61792
61792
  reLayout() {
61793
- if (!this._chart || !this._compiler || this._isReleased) {
61794
- return;
61795
- }
61796
- this._chart.resetLayoutItemTag();
61797
- this._chart.setLayoutTag(true, null, false);
61798
- this._compiler.render();
61799
- this._chart.onEvaluateEnd();
61793
+ var _a, _b, _c;
61794
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.resetLayoutItemTag();
61795
+ (_b = this._chart) === null || _b === void 0 ? void 0 : _b.setLayoutTag(true, null, false);
61796
+ (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.render();
61800
61797
  }
61801
61798
  getCompiler() {
61802
61799
  return this._compiler;
@@ -74032,55 +74029,45 @@
74032
74029
  }, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
74033
74030
  }
74034
74031
  }
74035
- _updateSymbolGraphicPosition() {
74036
- var _a;
74037
- const graphics = (_a = this._symbolMark) === null || _a === void 0 ? void 0 : _a.getGraphics();
74038
- if (!graphics || !graphics.length) {
74039
- return;
74040
- }
74041
- graphics.forEach((graphicItem) => {
74042
- var _a, _b;
74043
- const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74044
- const newPosition = this.dataToPosition(datum);
74045
- if (newPosition && graphicItem) {
74046
- graphicItem.setAttributes({
74047
- x: newPosition.x,
74048
- y: newPosition.y
74049
- });
74032
+ handleZoom(e) {
74033
+ var _a, _b, _c, _d;
74034
+ this.getMarksWithoutRoot().forEach(mark => {
74035
+ if (!mark) {
74036
+ return;
74050
74037
  }
74051
- });
74052
- }
74053
- _ensureLabelGraphicPostMatrix() {
74054
- var _a, _b;
74055
- const labelGraphic = (_b = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent()) === null || _b === void 0 ? void 0 : _b.getComponent();
74056
- if (labelGraphic && !labelGraphic.attribute.postMatrix) {
74057
- labelGraphic.setAttributes({
74058
- postMatrix: new Matrix()
74038
+ const graphics = mark.getGraphics();
74039
+ if (!graphics || !graphics.length) {
74040
+ return;
74041
+ }
74042
+ graphics.forEach((graphicItem, i) => {
74043
+ var _a, _b;
74044
+ const datum = (_b = (_a = graphicItem === null || graphicItem === void 0 ? void 0 : graphicItem.context) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[0];
74045
+ const newPosition = this.dataToPosition(datum);
74046
+ if (newPosition && graphicItem) {
74047
+ graphicItem.translateTo(newPosition.x, newPosition.y);
74048
+ }
74059
74049
  });
74050
+ });
74051
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
74052
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
74053
+ labelComponent.renderInner();
74060
74054
  }
74061
- return labelGraphic;
74062
- }
74063
- handleZoom(e) {
74064
- const { scale, scaleCenter } = e;
74065
- if (scale === 1) {
74066
- return;
74055
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
74056
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
74057
+ vgrammarLabel.evaluate(null, null);
74067
74058
  }
74068
- this._updateSymbolGraphicPosition();
74069
- const labelGraphic = this._ensureLabelGraphicPostMatrix();
74070
- if (labelGraphic) {
74071
- labelGraphic.scale(scale, scale, scaleCenter);
74059
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
74060
+ if (labelGroup && (e === null || e === void 0 ? void 0 : e.scale) && (e === null || e === void 0 ? void 0 : e.scaleCenter)) {
74061
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
74062
+ labelGroup.setAttributes({
74063
+ postMatrix: new Matrix()
74064
+ });
74065
+ }
74066
+ labelGroup.scale(e.scale, e.scale, e.scaleCenter);
74072
74067
  }
74073
74068
  }
74074
74069
  handlePan(e) {
74075
- const { delta } = e;
74076
- if ((delta === null || delta === void 0 ? void 0 : delta[0]) === 0 && (delta === null || delta === void 0 ? void 0 : delta[1]) === 0) {
74077
- return;
74078
- }
74079
- this._updateSymbolGraphicPosition();
74080
- const labelGraphic = this._ensureLabelGraphicPostMatrix();
74081
- if (labelGraphic) {
74082
- labelGraphic.translate(delta[0], delta[1]);
74083
- }
74070
+ this.handleZoom(e);
74084
74071
  }
74085
74072
  getDefaultShapeType() {
74086
74073
  return 'circle';
@@ -75339,7 +75326,7 @@
75339
75326
  this._mapViewData = null;
75340
75327
  }
75341
75328
  handleZoom(e) {
75342
- var _a;
75329
+ var _a, _b, _c, _d;
75343
75330
  const { scale, scaleCenter } = e;
75344
75331
  if (scale === 1) {
75345
75332
  return;
@@ -75353,13 +75340,26 @@
75353
75340
  }
75354
75341
  pathGroup.scale(scale, scale, scaleCenter);
75355
75342
  }
75356
- const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75357
- if (vgrammarLabel) {
75358
- vgrammarLabel.renderInner();
75343
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75344
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75345
+ labelComponent.renderInner();
75346
+ }
75347
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75348
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75349
+ vgrammarLabel.evaluate(null, null);
75350
+ }
75351
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75352
+ if (labelGroup && scale && scaleCenter) {
75353
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75354
+ labelGroup.setAttributes({
75355
+ postMatrix: new Matrix()
75356
+ });
75357
+ }
75358
+ labelGroup.scale(scale, scale, scaleCenter);
75359
75359
  }
75360
75360
  }
75361
75361
  handlePan(e) {
75362
- var _a;
75362
+ var _a, _b, _c, _d;
75363
75363
  const { delta } = e;
75364
75364
  if (delta[0] === 0 && delta[1] === 0) {
75365
75365
  return;
@@ -75373,9 +75373,22 @@
75373
75373
  }
75374
75374
  pathGroup.translate(delta[0], delta[1]);
75375
75375
  }
75376
- const vgrammarLabel = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75377
- if (vgrammarLabel) {
75378
- vgrammarLabel.renderInner();
75376
+ const labelComponent = (_a = this._labelMark) === null || _a === void 0 ? void 0 : _a.getComponent();
75377
+ if (labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.renderInner) {
75378
+ labelComponent.renderInner();
75379
+ }
75380
+ const vgrammarLabel = (_b = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getComponent) === null || _b === void 0 ? void 0 : _b.call(labelComponent);
75381
+ if (vgrammarLabel === null || vgrammarLabel === void 0 ? void 0 : vgrammarLabel.evaluate) {
75382
+ vgrammarLabel.evaluate(null, null);
75383
+ }
75384
+ const labelGroup = (_c = labelComponent === null || labelComponent === void 0 ? void 0 : labelComponent.getProduct) === null || _c === void 0 ? void 0 : _c.call(labelComponent);
75385
+ if (labelGroup && delta) {
75386
+ if (!((_d = labelGroup.attribute) === null || _d === void 0 ? void 0 : _d.postMatrix)) {
75387
+ labelGroup.setAttributes({
75388
+ postMatrix: new Matrix()
75389
+ });
75390
+ }
75391
+ labelGroup.translate(delta[0], delta[1]);
75379
75392
  }
75380
75393
  }
75381
75394
  getDatumCenter(datum) {
@@ -95596,6 +95609,7 @@
95596
95609
  }
95597
95610
  clear() {
95598
95611
  super.clear();
95612
+ this._legendComponent = null;
95599
95613
  this._cacheAttrs = null;
95600
95614
  this._preSelectedData = null;
95601
95615
  }