@visactor/vchart 1.11.7-alpha.3 → 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 +59 -14
  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 +2 -0
  25. package/cjs/core/vchart.js +10 -0
  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 +2 -0
  54. package/esm/core/vchart.js +10 -0
  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);
@@ -62141,6 +62156,20 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62141
62156
  this._spec = spec;
62142
62157
  this._updateSpecInfo();
62143
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
+ }
62144
62173
  _initChartPlugin() {
62145
62174
  const pluginList = Factory.getChartPlugins();
62146
62175
  if (pluginList.length > 0) {
@@ -66450,7 +66479,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66450
66479
  registerComponentPlugin(CanvasTooltipHandler);
66451
66480
  };
66452
66481
 
66453
- const version = "1.11.7-alpha.3";
66482
+ const version = "1.11.7";
66454
66483
 
66455
66484
  const addVChartProperty = (data, op) => {
66456
66485
  const context = op.beforeCall();
@@ -73561,7 +73590,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73561
73590
  registerDataSetInstanceTransform(this._option.dataSet, 'addVChartProperty', addVChartProperty);
73562
73591
  if (hasBandAxis) {
73563
73592
  const dimensionItems = ([data], { scaleDepth }) => {
73564
- var _a;
73593
+ var _a, _b;
73565
73594
  let dataCollect = [{}];
73566
73595
  const fields = this.getDimensionField();
73567
73596
  const depth = isNil$1(scaleDepth) ? fields.length : Math.min(fields.length, scaleDepth);
@@ -73572,9 +73601,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73572
73601
  continue;
73573
73602
  }
73574
73603
  const newDataCollect = [];
73604
+ const dataKey = (_b = this._spec.dataKey) !== null && _b !== void 0 ? _b : DEFAULT_DATA_KEY;
73575
73605
  for (let j = 0; j < values.length; j++) {
73576
73606
  for (let k = 0; k < dataCollect.length; k++) {
73577
- 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] }));
73578
73608
  }
73579
73609
  }
73580
73610
  dataCollect = newDataCollect;
@@ -73898,12 +73928,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73898
73928
  const depth = isNil$1(scaleDepth) ? depthFromSpec : Math.min(depthFromSpec, scaleDepth);
73899
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;
73900
73930
  const hasBarWidth = this._spec.barWidth !== undefined && depth === depthFromSpec;
73901
- if (hasBarWidth) {
73902
- return getActualNumValue(this._spec.barWidth, bandWidth);
73903
- }
73904
73931
  const hasBarMinWidth = this._spec.barMinWidth !== undefined;
73905
73932
  const hasBarMaxWidth = this._spec.barMaxWidth !== undefined;
73906
73933
  let width = bandWidth;
73934
+ if (hasBarWidth) {
73935
+ width = getActualNumValue(this._spec.barWidth, bandWidth);
73936
+ }
73907
73937
  if (hasBarMinWidth) {
73908
73938
  width = Math.max(width, getActualNumValue(this._spec.barMinWidth, bandWidth));
73909
73939
  }
@@ -93685,6 +93715,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93685
93715
  if (isClick && this._spec.lockAfterClick && !this._clickLock) {
93686
93716
  this._clickLock = true;
93687
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
+ }
93688
93726
  }
93689
93727
  const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
93690
93728
  if (success && VChart.globalConfig.uniqueTooltip && vchart) {
@@ -93789,6 +93827,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93789
93827
  release() {
93790
93828
  var _a, _b;
93791
93829
  super.release();
93830
+ if (this._timer) {
93831
+ clearTimeout(this._timer);
93832
+ }
93792
93833
  this._eventList.forEach(({ eventType, handler }) => {
93793
93834
  this.event.off(eventType, handler);
93794
93835
  });
@@ -94522,23 +94563,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94522
94563
  if (tooltipData && tooltipData.length) {
94523
94564
  if (activeType === 'dimension') {
94524
94565
  const dimensionInfo = tooltipData[0];
94525
- const dimensionData = dimensionInfo.data[0];
94526
- 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
+ }
94527
94572
  const isY = isValid$1(dimensionInfo.dimType)
94528
94573
  ? dimensionInfo.dimType === 'y'
94529
94574
  : isYAxis((_a = dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.axis) === null || _a === void 0 ? void 0 : _a.getOrient());
94530
94575
  if (isY) {
94531
- y = pos.y;
94576
+ y = pos === null || pos === void 0 ? void 0 : pos.y;
94532
94577
  }
94533
94578
  else {
94534
- x = pos.x;
94579
+ x = pos === null || pos === void 0 ? void 0 : pos.x;
94535
94580
  }
94536
94581
  }
94537
94582
  else if (activeType === 'mark') {
94538
94583
  const dimensionData = tooltipData[0];
94539
94584
  const pos = dimensionData.series.dataToPosition(dimensionData.datum[0]);
94540
- x = pos.x;
94541
- 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;
94542
94587
  }
94543
94588
  }
94544
94589
  const { xAxisMap, yAxisMap } = this._findAllAxisContains(x, y);
@@ -96718,7 +96763,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96718
96763
  autoFit: contentSpec.autoFit,
96719
96764
  fitPercent: contentSpec.fitPercent,
96720
96765
  fitStrategy: contentSpec.fitStrategy,
96721
- 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) })
96722
96767
  });
96723
96768
  });
96724
96769
  return {
@@ -96740,7 +96785,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96740
96785
  autoFit: this._spec.title.autoFit,
96741
96786
  fitPercent: this._spec.title.fitPercent,
96742
96787
  fitStrategy: this._spec.title.fitStrategy,
96743
- 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) })
96744
96789
  },
96745
96790
  content: contentComponentSpec
96746
96791
  };