@visactor/vchart 1.11.7-alpha.2 → 1.11.7

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 (63) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +64 -15
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/compile/grammar-item.js +2 -1
  6. package/cjs/component/crosshair/cartesian.js +8 -3
  7. package/cjs/component/crosshair/cartesian.js.map +1 -1
  8. package/cjs/component/indicator/indicator.d.ts +1 -1
  9. package/cjs/component/indicator/indicator.js +4 -2
  10. package/cjs/component/indicator/indicator.js.map +1 -1
  11. package/cjs/component/indicator/interface.d.ts +3 -1
  12. package/cjs/component/indicator/interface.js.map +1 -1
  13. package/cjs/component/marker/mark-point/interface/spec.d.ts +1 -1
  14. package/cjs/component/marker/mark-point/interface/spec.js.map +1 -1
  15. package/cjs/component/tooltip/interface/spec.d.ts +1 -0
  16. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  17. package/cjs/component/tooltip/tooltip.d.ts +2 -1
  18. package/cjs/component/tooltip/tooltip.js +5 -2
  19. package/cjs/component/tooltip/tooltip.js.map +1 -1
  20. package/cjs/component/util.js +1 -2
  21. package/cjs/core/index.d.ts +1 -1
  22. package/cjs/core/index.js +1 -1
  23. package/cjs/core/index.js.map +1 -1
  24. package/cjs/core/vchart.d.ts +3 -1
  25. package/cjs/core/vchart.js +13 -2
  26. package/cjs/core/vchart.js.map +1 -1
  27. package/cjs/series/bar/bar.js +7 -7
  28. package/cjs/series/bar/bar.js.map +1 -1
  29. package/cjs/series/word-cloud/interface.d.ts +1 -1
  30. package/cjs/series/word-cloud/interface.js.map +1 -1
  31. package/cjs/util/style.d.ts +1 -0
  32. package/cjs/util/style.js +11 -2
  33. package/cjs/util/style.js.map +1 -1
  34. package/esm/compile/grammar-item.js +2 -1
  35. package/esm/component/crosshair/cartesian.js +8 -3
  36. package/esm/component/crosshair/cartesian.js.map +1 -1
  37. package/esm/component/indicator/indicator.d.ts +1 -1
  38. package/esm/component/indicator/indicator.js +4 -4
  39. package/esm/component/indicator/indicator.js.map +1 -1
  40. package/esm/component/indicator/interface.d.ts +3 -1
  41. package/esm/component/indicator/interface.js.map +1 -1
  42. package/esm/component/marker/mark-point/interface/spec.d.ts +1 -1
  43. package/esm/component/marker/mark-point/interface/spec.js.map +1 -1
  44. package/esm/component/tooltip/interface/spec.d.ts +1 -0
  45. package/esm/component/tooltip/interface/spec.js.map +1 -1
  46. package/esm/component/tooltip/tooltip.d.ts +2 -1
  47. package/esm/component/tooltip/tooltip.js +5 -2
  48. package/esm/component/tooltip/tooltip.js.map +1 -1
  49. package/esm/component/util.js +1 -2
  50. package/esm/core/index.d.ts +1 -1
  51. package/esm/core/index.js +1 -1
  52. package/esm/core/index.js.map +1 -1
  53. package/esm/core/vchart.d.ts +3 -1
  54. package/esm/core/vchart.js +13 -2
  55. package/esm/core/vchart.js.map +1 -1
  56. package/esm/series/bar/bar.js +8 -8
  57. package/esm/series/bar/bar.js.map +1 -1
  58. package/esm/series/word-cloud/interface.d.ts +1 -1
  59. package/esm/series/word-cloud/interface.js.map +1 -1
  60. package/esm/util/style.d.ts +1 -0
  61. package/esm/util/style.js +8 -0
  62. package/esm/util/style.js.map +1 -1
  63. package/package.json +4 -4
package/build/index.js CHANGED
@@ -55290,6 +55290,21 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
55290
55290
  });
55291
55291
  return newStateStyle;
55292
55292
  }
55293
+ function transformIndicatorStyle(style, datum) {
55294
+ if (isEmpty(style)) {
55295
+ return null;
55296
+ }
55297
+ const newStateStyle = {};
55298
+ Object.keys(style).forEach(key => {
55299
+ if (isFunction$1(style[key])) {
55300
+ newStateStyle[key] = style[key](datum);
55301
+ }
55302
+ else {
55303
+ newStateStyle[key] = style[key];
55304
+ }
55305
+ });
55306
+ return transformToGraphic(newStateStyle);
55307
+ }
55293
55308
  function transformToGraphic(style) {
55294
55309
  if (style === null || style === void 0 ? void 0 : style.angle) {
55295
55310
  style.angle = degreeToRadian(style.angle);
@@ -61477,8 +61492,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61477
61492
  this._updateDataById(id, data, parserOptions);
61478
61493
  return this;
61479
61494
  }
61480
- updateFullDataSync(data, reRender = true) {
61495
+ updateFullDataSync(data, reRender = true, userUpdateOptions) {
61481
61496
  if (this._chart) {
61497
+ if (userUpdateOptions === null || userUpdateOptions === void 0 ? void 0 : userUpdateOptions.reAnimate) {
61498
+ this.stopAnimation();
61499
+ this._updateAnimateState(true);
61500
+ }
61482
61501
  this._chart.updateFullData(data);
61483
61502
  if (reRender) {
61484
61503
  this._compiler.render();
@@ -62137,6 +62156,20 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62137
62156
  this._spec = spec;
62138
62157
  this._updateSpecInfo();
62139
62158
  }
62159
+ updateIndicatorDataById(id, datum) {
62160
+ var _a;
62161
+ const indicator = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getComponentByUserId(id);
62162
+ if (indicator) {
62163
+ indicator.updateDatum(datum);
62164
+ }
62165
+ }
62166
+ updateIndicatorDataByIndex(index = 0, datum) {
62167
+ var _a;
62168
+ const indicators = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getComponentsByType(ComponentTypeEnum.indicator);
62169
+ if (indicators && indicators[index]) {
62170
+ indicators[index].updateDatum(datum);
62171
+ }
62172
+ }
62140
62173
  _initChartPlugin() {
62141
62174
  const pluginList = Factory.getChartPlugins();
62142
62175
  if (pluginList.length > 0) {
@@ -66446,7 +66479,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66446
66479
  registerComponentPlugin(CanvasTooltipHandler);
66447
66480
  };
66448
66481
 
66449
- const version = "1.11.7-alpha.2";
66482
+ const version = "1.11.7";
66450
66483
 
66451
66484
  const addVChartProperty = (data, op) => {
66452
66485
  const context = op.beforeCall();
@@ -73557,7 +73590,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73557
73590
  registerDataSetInstanceTransform(this._option.dataSet, 'addVChartProperty', addVChartProperty);
73558
73591
  if (hasBandAxis) {
73559
73592
  const dimensionItems = ([data], { scaleDepth }) => {
73560
- var _a;
73593
+ var _a, _b;
73561
73594
  let dataCollect = [{}];
73562
73595
  const fields = this.getDimensionField();
73563
73596
  const depth = isNil$1(scaleDepth) ? fields.length : Math.min(fields.length, scaleDepth);
@@ -73568,9 +73601,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73568
73601
  continue;
73569
73602
  }
73570
73603
  const newDataCollect = [];
73604
+ const dataKey = (_b = this._spec.dataKey) !== null && _b !== void 0 ? _b : DEFAULT_DATA_KEY;
73571
73605
  for (let j = 0; j < values.length; j++) {
73572
73606
  for (let k = 0; k < dataCollect.length; k++) {
73573
- newDataCollect.push(Object.assign(Object.assign({}, dataCollect[k]), { [field]: values[j] }));
73607
+ newDataCollect.push(Object.assign(Object.assign({}, dataCollect[k]), { [field]: values[j], [dataKey]: values[j] }));
73574
73608
  }
73575
73609
  }
73576
73610
  dataCollect = newDataCollect;
@@ -73894,12 +73928,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73894
73928
  const depth = isNil$1(scaleDepth) ? depthFromSpec : Math.min(depthFromSpec, scaleDepth);
73895
73929
  const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, depth - 1)) !== null && _b !== void 0 ? _b : DefaultBandWidth$2;
73896
73930
  const hasBarWidth = this._spec.barWidth !== undefined && depth === depthFromSpec;
73897
- if (hasBarWidth) {
73898
- return getActualNumValue(this._spec.barWidth, bandWidth);
73899
- }
73900
73931
  const hasBarMinWidth = this._spec.barMinWidth !== undefined;
73901
73932
  const hasBarMaxWidth = this._spec.barMaxWidth !== undefined;
73902
73933
  let width = bandWidth;
73934
+ if (hasBarWidth) {
73935
+ width = getActualNumValue(this._spec.barWidth, bandWidth);
73936
+ }
73903
73937
  if (hasBarMinWidth) {
73904
73938
  width = Math.max(width, getActualNumValue(this._spec.barMinWidth, bandWidth));
73905
73939
  }
@@ -93681,6 +93715,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93681
93715
  if (isClick && this._spec.lockAfterClick && !this._clickLock) {
93682
93716
  this._clickLock = true;
93683
93717
  }
93718
+ else if (Number.isFinite(this._spec.hideTimer)) {
93719
+ if (this._timer) {
93720
+ clearTimeout(this._timer);
93721
+ }
93722
+ this._timer = setTimeout(() => {
93723
+ this._handleChartMouseOut();
93724
+ }, this._spec.hideTimer);
93725
+ }
93684
93726
  }
93685
93727
  const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
93686
93728
  if (success && VChart.globalConfig.uniqueTooltip && vchart) {
@@ -93785,6 +93827,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93785
93827
  release() {
93786
93828
  var _a, _b;
93787
93829
  super.release();
93830
+ if (this._timer) {
93831
+ clearTimeout(this._timer);
93832
+ }
93788
93833
  this._eventList.forEach(({ eventType, handler }) => {
93789
93834
  this.event.off(eventType, handler);
93790
93835
  });
@@ -94518,23 +94563,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94518
94563
  if (tooltipData && tooltipData.length) {
94519
94564
  if (activeType === 'dimension') {
94520
94565
  const dimensionInfo = tooltipData[0];
94521
- const dimensionData = dimensionInfo.data[0];
94522
- const pos = dimensionData.series.dataToPosition(dimensionData.datum[0]);
94566
+ const datumIndex = dimensionInfo.data.findIndex(dimData => dimData.datum.length > 0);
94567
+ let pos;
94568
+ if (datumIndex > -1) {
94569
+ const dimensionData = dimensionInfo.data[datumIndex];
94570
+ pos = dimensionData.series.dataToPosition(dimensionData.datum[0]);
94571
+ }
94523
94572
  const isY = isValid$1(dimensionInfo.dimType)
94524
94573
  ? dimensionInfo.dimType === 'y'
94525
94574
  : isYAxis((_a = dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.axis) === null || _a === void 0 ? void 0 : _a.getOrient());
94526
94575
  if (isY) {
94527
- y = pos.y;
94576
+ y = pos === null || pos === void 0 ? void 0 : pos.y;
94528
94577
  }
94529
94578
  else {
94530
- x = pos.x;
94579
+ x = pos === null || pos === void 0 ? void 0 : pos.x;
94531
94580
  }
94532
94581
  }
94533
94582
  else if (activeType === 'mark') {
94534
94583
  const dimensionData = tooltipData[0];
94535
94584
  const pos = dimensionData.series.dataToPosition(dimensionData.datum[0]);
94536
- x = pos.x;
94537
- y = pos.y;
94585
+ x = pos === null || pos === void 0 ? void 0 : pos.x;
94586
+ y = pos === null || pos === void 0 ? void 0 : pos.y;
94538
94587
  }
94539
94588
  }
94540
94589
  const { xAxisMap, yAxisMap } = this._findAllAxisContains(x, y);
@@ -96714,7 +96763,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96714
96763
  autoFit: contentSpec.autoFit,
96715
96764
  fitPercent: contentSpec.fitPercent,
96716
96765
  fitStrategy: contentSpec.fitStrategy,
96717
- style: Object.assign(Object.assign({}, transformToGraphic(contentSpec.style)), { text: this._createText(contentSpec.field, contentSpec.style.text) })
96766
+ style: Object.assign(Object.assign({}, transformIndicatorStyle(pickWithout(contentSpec.style, ['text']), this._activeDatum)), { text: this._createText(contentSpec.field, contentSpec.style.text) })
96718
96767
  });
96719
96768
  });
96720
96769
  return {
@@ -96736,7 +96785,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96736
96785
  autoFit: this._spec.title.autoFit,
96737
96786
  fitPercent: this._spec.title.fitPercent,
96738
96787
  fitStrategy: this._spec.title.fitStrategy,
96739
- style: Object.assign(Object.assign({}, transformToGraphic(this._spec.title.style)), { text: this._createText(this._spec.title.field, this._spec.title.style.text) })
96788
+ style: Object.assign(Object.assign({}, transformIndicatorStyle(pickWithout(this._spec.title.style, ['text']), this._activeDatum)), { text: this._createText(this._spec.title.field, this._spec.title.style.text) })
96740
96789
  },
96741
96790
  content: contentComponentSpec
96742
96791
  };