@visactor/vchart 1.2.1-alpha.2 → 1.2.1-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 (51) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +62 -5
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base-chart.js +1 -1
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/component/axis/cartesian/axis.d.ts +8 -0
  8. package/cjs/component/axis/cartesian/axis.js +33 -3
  9. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  10. package/cjs/constant/event.d.ts +1 -0
  11. package/cjs/constant/event.js +3 -2
  12. package/cjs/constant/event.js.map +1 -1
  13. package/cjs/core/index.d.ts +1 -1
  14. package/cjs/core/index.js +1 -1
  15. package/cjs/core/index.js.map +1 -1
  16. package/cjs/core/vchart.d.ts +5 -0
  17. package/cjs/core/vchart.js +13 -0
  18. package/cjs/core/vchart.js.map +1 -1
  19. package/cjs/data/initialize.js +2 -1
  20. package/cjs/data/initialize.js.map +1 -1
  21. package/cjs/layout/base-layout.js +2 -2
  22. package/cjs/layout/base-layout.js.map +1 -1
  23. package/cjs/model/interface.d.ts +1 -0
  24. package/cjs/model/interface.js.map +1 -1
  25. package/cjs/model/layout-item.d.ts +1 -0
  26. package/cjs/model/layout-item.js +4 -0
  27. package/cjs/model/layout-item.js.map +1 -1
  28. package/esm/chart/base-chart.js +1 -1
  29. package/esm/chart/base-chart.js.map +1 -1
  30. package/esm/component/axis/cartesian/axis.d.ts +8 -0
  31. package/esm/component/axis/cartesian/axis.js +33 -3
  32. package/esm/component/axis/cartesian/axis.js.map +1 -1
  33. package/esm/constant/event.d.ts +1 -0
  34. package/esm/constant/event.js +3 -2
  35. package/esm/constant/event.js.map +1 -1
  36. package/esm/core/index.d.ts +1 -1
  37. package/esm/core/index.js +1 -1
  38. package/esm/core/index.js.map +1 -1
  39. package/esm/core/vchart.d.ts +5 -0
  40. package/esm/core/vchart.js +13 -0
  41. package/esm/core/vchart.js.map +1 -1
  42. package/esm/data/initialize.js +2 -2
  43. package/esm/data/initialize.js.map +1 -1
  44. package/esm/layout/base-layout.js +2 -2
  45. package/esm/layout/base-layout.js.map +1 -1
  46. package/esm/model/interface.d.ts +1 -0
  47. package/esm/model/interface.js.map +1 -1
  48. package/esm/model/layout-item.d.ts +1 -0
  49. package/esm/model/layout-item.js +4 -0
  50. package/esm/model/layout-item.js.map +1 -1
  51. package/package.json +2 -2
package/build/index.js CHANGED
@@ -51704,6 +51704,7 @@
51704
51704
  ChartEvent["drill"] = "drill";
51705
51705
  ChartEvent["layoutStart"] = "layoutStart";
51706
51706
  ChartEvent["layoutEnd"] = "layoutEnd";
51707
+ ChartEvent["layoutRectUpdate"] = "layoutRectUpdate";
51707
51708
  ChartEvent["playerPlay"] = "playerPlay";
51708
51709
  ChartEvent["playerPause"] = "playerPause";
51709
51710
  ChartEvent["playerEnd"] = "playerEnd";
@@ -54385,7 +54386,7 @@
54385
54386
  });
54386
54387
  }
54387
54388
  else if (Array.isArray(values)) {
54388
- dataView.parse(values);
54389
+ dataView.parse(cloneDeep(values));
54389
54390
  }
54390
54391
  else if (isString(values) &&
54391
54392
  (!parser || parser.type === 'csv' || parser.type === 'dsv' || parser.type === 'tsv')) {
@@ -55228,6 +55229,28 @@
55228
55229
  }
55229
55230
  return this;
55230
55231
  }
55232
+ updateDataInBatchesSync(list) {
55233
+ if (this._chart) {
55234
+ list.forEach(({ id, data, options }) => {
55235
+ this._chart.updateData(id, data, false, options);
55236
+ });
55237
+ this._chart.updateGlobalScaleDomain();
55238
+ this._compiler.renderSync();
55239
+ return this;
55240
+ }
55241
+ list.forEach(({ id, data, options }) => {
55242
+ const preDV = this._spec.data.find(dv => dv.name === id);
55243
+ if (preDV) {
55244
+ preDV.parse(data, options);
55245
+ }
55246
+ else {
55247
+ const dataView = new DataView(this._dataSet, { name: id });
55248
+ dataView.parse(data, options);
55249
+ this._spec.data.push(dataView);
55250
+ }
55251
+ });
55252
+ return this;
55253
+ }
55231
55254
  async updateSpec(spec, forceMerge = false, morphConfig) {
55232
55255
  if (!spec) {
55233
55256
  return this;
@@ -55886,6 +55909,9 @@
55886
55909
  layoutLevel = LayoutLevel.Region;
55887
55910
  layoutZIndex = 0;
55888
55911
  chartLayoutRect;
55912
+ getVisible() {
55913
+ return this._spec?.visible !== false;
55914
+ }
55889
55915
  _setLayoutAttributeFromSpec(spec, chartViewRect) {
55890
55916
  if (this._spec.visible !== false) {
55891
55917
  const padding = normalizeLayoutPaddingSpec(spec.padding);
@@ -57271,9 +57297,8 @@
57271
57297
  };
57272
57298
  const rightCurrent = this._chartViewBox.x2 - this._chartViewBox.x1 - this._rightCurrent;
57273
57299
  const bottomCurrent = this._chartViewBox.y2 - this._chartViewBox.y1 - this._bottomCurrent;
57274
- items.filter;
57275
57300
  items.forEach(i => {
57276
- if (!i.getAutoIndent()) {
57301
+ if (!i.getVisible() || !i.getAutoIndent()) {
57277
57302
  return;
57278
57303
  }
57279
57304
  const vOrH = i.layoutOrient === 'left' || i.layoutOrient === 'right';
@@ -58345,7 +58370,7 @@
58345
58370
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58346
58371
  Factory.registerRegion('region', Region);
58347
58372
  Factory.registerLayout('base', Layout);
58348
- const version = "1.2.1-alpha.2";
58373
+ const version = "1.2.1-alpha.3";
58349
58374
  Logger.getInstance(LoggerLevel.Error);
58350
58375
 
58351
58376
  var SeriesMarkNameEnum;
@@ -59580,6 +59605,7 @@
59580
59605
  this._layoutRect.height = viewRect.height - this.padding.top - this.padding.bottom;
59581
59606
  this._layoutRect.x = this.padding.left;
59582
59607
  this._layoutRect.y = this.padding.top;
59608
+ this._event.emit(ChartEvent.layoutRectUpdate, {});
59583
59609
  }
59584
59610
  getCurrentTheme() {
59585
59611
  return this._theme;
@@ -81080,6 +81106,7 @@
81080
81106
  _axisStyle;
81081
81107
  _latestBounds;
81082
81108
  _verticalLimitSize;
81109
+ _layoutCache = { width: 0, height: 0, _lastComputeOutBounds: { x1: 0, x2: 0, y1: 0, y2: 0 } };
81083
81110
  constructor(spec, options) {
81084
81111
  super(spec, {
81085
81112
  ...options
@@ -81434,7 +81461,7 @@
81434
81461
  }
81435
81462
  result.width = Math.ceil(result.width);
81436
81463
  result.height = Math.ceil(result.height);
81437
- return this._setRectInSpec(result);
81464
+ return this._setRectInSpec(this._layoutCacheProcessing(result));
81438
81465
  }
81439
81466
  boundsInRect(rect) {
81440
81467
  let result = { x1: 0, y1: 0, x2: 0, y2: 0 };
@@ -81586,6 +81613,9 @@
81586
81613
  super.initEvent();
81587
81614
  if (this.visible) {
81588
81615
  this.event.on(ChartEvent.layoutEnd, this._fixAxisOnZero);
81616
+ this.event.on(ChartEvent.layoutRectUpdate, () => {
81617
+ this._clearLayoutCache();
81618
+ });
81589
81619
  }
81590
81620
  }
81591
81621
  _fixAxisOnZero = () => {
@@ -81637,6 +81667,33 @@
81637
81667
  }
81638
81668
  }
81639
81669
  };
81670
+ _layoutCacheProcessing(rect) {
81671
+ ['width', 'height'].forEach(key => {
81672
+ if (rect[key] < this._layoutCache[key]) {
81673
+ rect[key] = this._layoutCache[key];
81674
+ }
81675
+ else {
81676
+ this._layoutCache[key] = rect[key];
81677
+ }
81678
+ });
81679
+ ['x1', 'x2', 'y1', 'y2'].forEach(key => {
81680
+ if (this._lastComputeOutBounds[key] < this._layoutCache._lastComputeOutBounds[key]) {
81681
+ this._lastComputeOutBounds[key] = this._layoutCache._lastComputeOutBounds[key];
81682
+ }
81683
+ else {
81684
+ this._layoutCache._lastComputeOutBounds[key] = this._lastComputeOutBounds[key];
81685
+ }
81686
+ });
81687
+ return rect;
81688
+ }
81689
+ _clearLayoutCache() {
81690
+ this._layoutCache.width = 0;
81691
+ this._layoutCache.height = 0;
81692
+ this._layoutCache._lastComputeOutBounds = { x1: 0, x2: 0, y1: 0, y2: 0 };
81693
+ }
81694
+ onDataUpdate() {
81695
+ this._clearLayoutCache();
81696
+ }
81640
81697
  }
81641
81698
 
81642
81699
  const e10 = Math.sqrt(50);