@visactor/vchart 1.2.1-alpha.0 → 1.2.1-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.
Files changed (57) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +41 -29
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/animation/animate-manager.js +2 -2
  6. package/cjs/animation/animate-manager.js.map +1 -1
  7. package/cjs/chart/base-chart.d.ts +2 -2
  8. package/cjs/chart/base-chart.js +4 -4
  9. package/cjs/chart/base-chart.js.map +1 -1
  10. package/cjs/chart/interface/chart.d.ts +1 -1
  11. package/cjs/chart/interface/chart.js.map +1 -1
  12. package/cjs/component/axis/cartesian/axis.js +1 -1
  13. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  14. package/cjs/component/axis/cartesian/interface/theme.d.ts +3 -3
  15. package/cjs/component/axis/cartesian/interface/theme.js.map +1 -1
  16. package/cjs/core/index.d.ts +1 -1
  17. package/cjs/core/index.js +1 -1
  18. package/cjs/core/index.js.map +1 -1
  19. package/cjs/core/vchart.d.ts +1 -1
  20. package/cjs/core/vchart.js +3 -3
  21. package/cjs/core/vchart.js.map +1 -1
  22. package/cjs/model/layout-item.d.ts +4 -1
  23. package/cjs/model/layout-item.js.map +1 -1
  24. package/cjs/series/progress/linear/linear.js +3 -2
  25. package/cjs/series/progress/linear/linear.js.map +1 -1
  26. package/cjs/series/radar/interface.js.map +1 -1
  27. package/cjs/series/word-cloud/base.js +4 -2
  28. package/cjs/series/word-cloud/base.js.map +1 -1
  29. package/cjs/theme/buildin-theme/light/component/axis/cartesian-axis.js +2 -1
  30. package/cjs/theme/buildin-theme/light/component/axis/cartesian-axis.js.map +1 -1
  31. package/esm/animation/animate-manager.js +2 -2
  32. package/esm/animation/animate-manager.js.map +1 -1
  33. package/esm/chart/base-chart.d.ts +2 -2
  34. package/esm/chart/base-chart.js +4 -4
  35. package/esm/chart/base-chart.js.map +1 -1
  36. package/esm/chart/interface/chart.d.ts +1 -1
  37. package/esm/chart/interface/chart.js.map +1 -1
  38. package/esm/component/axis/cartesian/axis.js +1 -1
  39. package/esm/component/axis/cartesian/axis.js.map +1 -1
  40. package/esm/component/axis/cartesian/interface/theme.d.ts +3 -3
  41. package/esm/component/axis/cartesian/interface/theme.js.map +1 -1
  42. package/esm/core/index.d.ts +1 -1
  43. package/esm/core/index.js +1 -1
  44. package/esm/core/index.js.map +1 -1
  45. package/esm/core/vchart.d.ts +1 -1
  46. package/esm/core/vchart.js +3 -3
  47. package/esm/core/vchart.js.map +1 -1
  48. package/esm/model/layout-item.d.ts +4 -1
  49. package/esm/model/layout-item.js.map +1 -1
  50. package/esm/series/progress/linear/linear.js +3 -2
  51. package/esm/series/progress/linear/linear.js.map +1 -1
  52. package/esm/series/radar/interface.js.map +1 -1
  53. package/esm/series/word-cloud/base.js +5 -3
  54. package/esm/series/word-cloud/base.js.map +1 -1
  55. package/esm/theme/buildin-theme/light/component/axis/cartesian-axis.js +2 -1
  56. package/esm/theme/buildin-theme/light/component/axis/cartesian-axis.js.map +1 -1
  57. package/package.json +12 -12
package/build/index.js CHANGED
@@ -52072,7 +52072,8 @@
52072
52072
  };
52073
52073
  const axisY = {
52074
52074
  label: {
52075
- space: 20
52075
+ space: 20,
52076
+ autoLimit: true
52076
52077
  },
52077
52078
  title: {
52078
52079
  space: 20,
@@ -55279,14 +55280,16 @@
55279
55280
  await this._compiler.resize?.(width, height);
55280
55281
  return this;
55281
55282
  }
55282
- updateViewBox(viewBox, reRender = true) {
55283
+ updateViewBox(viewBox, reRender = true, reLayout = true) {
55283
55284
  if (!this._chart || !this._compiler) {
55284
55285
  return this;
55285
55286
  }
55286
55287
  this._viewBox = viewBox;
55287
- this._chart.updateViewBox(viewBox);
55288
- this._compiler.renderSync();
55289
- this._chart?.onEvaluateEnd();
55288
+ this._chart.updateViewBox(viewBox, reLayout);
55289
+ if (reLayout) {
55290
+ this._compiler.renderSync();
55291
+ this._chart?.onEvaluateEnd();
55292
+ }
55290
55293
  this._compiler.updateViewBox(viewBox, reRender);
55291
55294
  return this;
55292
55295
  }
@@ -56724,9 +56727,7 @@
56724
56727
  this.updateState({
56725
56728
  animationState: {
56726
56729
  callback: (datum, element) => {
56727
- return element.diffState === AnimationStateEnum.enter
56728
- ? AnimationStateEnum.appear
56729
- : AnimationStateEnum.none;
56730
+ return element.diffState === 'exit' ? AnimationStateEnum.none : AnimationStateEnum.appear;
56730
56731
  }
56731
56732
  }
56732
56733
  }, noRender);
@@ -56743,7 +56744,7 @@
56743
56744
  return {
56744
56745
  animationState: {
56745
56746
  callback: (datum, element) => {
56746
- return element.diffState === AnimationStateEnum.enter ? AnimationStateEnum.appear : AnimationStateEnum.none;
56747
+ return element.diffState === 'exit' ? AnimationStateEnum.none : AnimationStateEnum.appear;
56747
56748
  }
56748
56749
  }
56749
56750
  };
@@ -58344,7 +58345,7 @@
58344
58345
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58345
58346
  Factory.registerRegion('region', Region);
58346
58347
  Factory.registerLayout('base', Layout);
58347
- const version = "1.2.1-alpha.0";
58348
+ const version = "1.2.1-alpha.2";
58348
58349
  Logger.getInstance(LoggerLevel.Error);
58349
58350
 
58350
58351
  var SeriesMarkNameEnum;
@@ -58875,11 +58876,11 @@
58875
58876
  getLayoutTag() {
58876
58877
  return this._layoutTag;
58877
58878
  }
58878
- setLayoutTag(tag, morphConfig) {
58879
+ setLayoutTag(tag, morphConfig, reLayout = true) {
58879
58880
  this._layoutTag = tag;
58880
58881
  if (this.getCompiler()?.getVGrammarView()) {
58881
58882
  this.getCompiler().getVGrammarView().updateLayoutTag();
58882
- tag && this.getCompiler().reRenderAsync(morphConfig);
58883
+ tag && reLayout && this.getCompiler().reRenderAsync(morphConfig);
58883
58884
  }
58884
58885
  return this._layoutTag;
58885
58886
  }
@@ -58946,9 +58947,9 @@
58946
58947
  this._updateLayoutRect(this._option.viewBox);
58947
58948
  this.setLayoutTag(true);
58948
58949
  }
58949
- updateViewBox(viewBox) {
58950
+ updateViewBox(viewBox, reLayout) {
58950
58951
  this._updateLayoutRect(viewBox);
58951
- this.setLayoutTag(true);
58952
+ this.setLayoutTag(true, null, reLayout);
58952
58953
  }
58953
58954
  createBackground(bg) {
58954
58955
  if (!bg) {
@@ -68874,7 +68875,9 @@
68874
68875
  }
68875
68876
  }
68876
68877
  initProgressGroupMark() {
68877
- this._progressGroupMark = this._createMark(LinearProgressSeries.mark.group);
68878
+ this._progressGroupMark = this._createMark(LinearProgressSeries.mark.group, {
68879
+ skipBeforeLayouted: false
68880
+ });
68878
68881
  return this._progressGroupMark;
68879
68882
  }
68880
68883
  initProgressGroupMarkStyle() {
@@ -69161,7 +69164,7 @@
69161
69164
  class CloudLayout extends BaseLayout {
69162
69165
  constructor(options) {
69163
69166
  var _a;
69164
- super(Object.assign({}, CloudLayout.defaultOptions, options)), this.cw = 64, this.ch = 2048, this._size = [256, 256], this._isBoardExpandCompleted = !1, this._placeStatus = 0, this._tTemp = null, this._dtTemp = null, this._dy = 0, this.cacheMap = new Map(), this.spiral = isString(this.options.spiral) ? null !== (_a = spirals[this.options.spiral]) && void 0 !== _a ? _a : spirals.archimedean : this.options.spiral, this.random = this.options.random ? Math.random : () => 1, this.getTextPadding = functor$1(this.options.padding);
69167
+ super(Object.assign({}, CloudLayout.defaultOptions, options)), this.cw = 64, this.ch = 2048, this._size = [256, 256], this._isBoardExpandCompleted = !1, this._placeStatus = 0, this._tTemp = null, this._dtTemp = null, this._dy = 0, this.cacheMap = new Map(), this.options.minFontSize <= CloudLayout.defaultOptions.minFontSize && (this.options.minFontSize = CloudLayout.defaultOptions.minFontSize), this.spiral = isString(this.options.spiral) ? null !== (_a = spirals[this.options.spiral]) && void 0 !== _a ? _a : spirals.archimedean : this.options.spiral, this.random = this.options.random ? Math.random : () => 1, this.getTextPadding = functor$1(this.options.padding);
69165
69168
  }
69166
69169
  zoomRatio() {
69167
69170
  return this._originSize[0] / this._size[0];
@@ -69183,7 +69186,7 @@
69183
69186
  x: d.x + d.x1,
69184
69187
  y: d.y + d.y1
69185
69188
  }], d.x -= this._size[0] >> 1, d.y -= this._size[1] >> 1, this._tTemp = null, this._dtTemp = null, !0;
69186
- if (this.updateBoardExpandStatus(d.fontSize * (this._originSize[0] / this._size[0]) < this.options.minFontSize), d.hasText && this.shouldShrinkContinue()) {
69189
+ if (this.updateBoardExpandStatus(d.fontSize), d.hasText && this.shouldShrinkContinue()) {
69187
69190
  if (1 === this._placeStatus) {
69188
69191
  const maxSize0 = d.fontSize * this._originSize[0] / this.options.minFontSize,
69189
69192
  distSize0 = Math.max(d.width, d.height);
@@ -69192,7 +69195,7 @@
69192
69195
  this.expandBoard(this._board, maxSize0 / this._size[0]);
69193
69196
  }
69194
69197
  } else this._placeStatus, this.expandBoard(this._board);
69195
- return this.updateBoardExpandStatus(d.fontSize * (this._originSize[0] / this._size[0]) < this.options.minFontSize), !1;
69198
+ return this.updateBoardExpandStatus(d.fontSize), !1;
69196
69199
  }
69197
69200
  return this._tTemp = null, this._dtTemp = null, !0;
69198
69201
  }
@@ -69230,8 +69233,10 @@
69230
69233
  })).sort(function (a, b) {
69231
69234
  return b.fontSize - a.fontSize;
69232
69235
  });
69233
- for (this.data = data; i < n;) {
69234
- if (this.layoutWord(i) && i++, this.progressiveIndex = i, this.exceedTime()) break;
69236
+ this.data = data;
69237
+ let curWordTryCount = 0;
69238
+ for (; i < n;) {
69239
+ if (this.layoutWord(i) || curWordTryCount >= 2 ? (i++, curWordTryCount = 0) : curWordTryCount++, this.progressiveIndex = i, this.exceedTime()) break;
69235
69240
  }
69236
69241
  if (!this.options.clip && this.options.enlarge && this._bounds && this.shrinkBoard(this._bounds), this._bounds && ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
69237
69242
  const currentCenterY = (this._bounds[0].y + this._bounds[1].y) / 2;
@@ -69257,8 +69262,8 @@
69257
69262
  progressiveOutput() {
69258
69263
  return this.outputCallback ? this.outputCallback(this.formatTagItem(this.progressiveResult)) : this.formatTagItem(this.progressiveResult);
69259
69264
  }
69260
- updateBoardExpandStatus(status) {
69261
- this._isBoardExpandCompleted = status;
69265
+ updateBoardExpandStatus(fontSize) {
69266
+ this._isBoardExpandCompleted = fontSize * (this._originSize[0] / this._size[0]) < this.options.minFontSize;
69262
69267
  }
69263
69268
  shouldShrinkContinue() {
69264
69269
  return !this.options.clip && this.options.shrink && !this._isBoardExpandCompleted;
@@ -69465,7 +69470,8 @@
69465
69470
  return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
69466
69471
  }
69467
69472
  CloudLayout.defaultOptions = {
69468
- enlarge: !1
69473
+ enlarge: !1,
69474
+ minFontSize: 2
69469
69475
  };
69470
69476
  const isFullOutside = (tag, size) => tag.x + tag.x0 > size[0] || tag.y + tag.y0 > size[0] || tag.x + tag.x1 < 0 || tag.y + tag.y1 < 0,
69471
69477
  isPartOutside = (tag, size) => tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1];
@@ -69755,8 +69761,10 @@
69755
69761
  angle: "angle"
69756
69762
  };
69757
69763
  const transform$2 = (options, upstreamData) => {
69758
- var _a, _b, _c, _d, _e, _f, _g;
69759
- if (options.size && (!options.size[0] || !options.size[1])) return upstreamData;
69764
+ var _a, _b, _c, _d, _e, _f;
69765
+ if (options.size && (options.size[0] <= 0 || options.size[1] <= 0)) {
69766
+ return Logger.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
69767
+ }
69760
69768
  const data = upstreamData,
69761
69769
  canvasSize = (null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500]).slice();
69762
69770
  canvasSize[0] = Math.floor(canvasSize[0]), canvasSize[1] = Math.floor(canvasSize[1]);
@@ -69771,7 +69779,7 @@
69771
69779
  shrink = null !== (_d = options.shrink) && void 0 !== _d && _d,
69772
69780
  enlarge = null !== (_e = options.enlarge) && void 0 !== _e && _e,
69773
69781
  clip = null !== (_f = options.clip) && void 0 !== _f && _f,
69774
- minFontSize = null !== (_g = options.minFontSize) && void 0 !== _g ? _g : 0,
69782
+ minFontSize = options.minFontSize,
69775
69783
  randomVisible = options.randomVisible,
69776
69784
  as = options.as || OUTPUT$1,
69777
69785
  depth_3d = options.depth_3d,
@@ -71072,6 +71080,10 @@
71072
71080
  }
71073
71081
  compile() {
71074
71082
  super.compile();
71083
+ const { width, height } = this._region.getLayoutRect();
71084
+ if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {
71085
+ return;
71086
+ }
71075
71087
  const wordCloudTransforms = [];
71076
71088
  const valueField = this._valueField;
71077
71089
  const valueScale = new LinearScale();
@@ -71119,7 +71131,7 @@
71119
71131
  wordCloudTransforms.push({
71120
71132
  type: 'wordcloud',
71121
71133
  layoutType: !isTrueBrowser(this._option.mode) ? 'fast' : this._wordCloudConfig.layoutMode,
71122
- size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
71134
+ size: [width, height],
71123
71135
  shape: this._maskShape,
71124
71136
  dataIndexKey: DEFAULT_DATA_KEY,
71125
71137
  text: { field: textField },
@@ -71144,7 +71156,7 @@
71144
71156
  wordCloudTransforms.push({
71145
71157
  type: 'wordcloudShape',
71146
71158
  dataIndexKey: DEFAULT_DATA_KEY,
71147
- size: [this._region.getLayoutRect().width, this._region.getLayoutRect().height],
71159
+ size: [width, height],
71148
71160
  shape: this._maskShape,
71149
71161
  text: { field: this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField },
71150
71162
  fontSize: valueField ? { field: valueField } : this._fontSizeRange[0],
@@ -81422,7 +81434,7 @@
81422
81434
  }
81423
81435
  result.width = Math.ceil(result.width);
81424
81436
  result.height = Math.ceil(result.height);
81425
- return result;
81437
+ return this._setRectInSpec(result);
81426
81438
  }
81427
81439
  boundsInRect(rect) {
81428
81440
  let result = { x1: 0, y1: 0, x2: 0, y2: 0 };