@visactor/vchart 2.0.8-alpha.1 → 2.0.8-alpha.5

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 (38) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +28 -9
  3. package/build/index.js +28 -9
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.d.ts +2 -0
  7. package/cjs/chart/base/base-chart.js +16 -2
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/chart/interface/chart.d.ts +2 -0
  10. package/cjs/chart/interface/chart.js.map +1 -1
  11. package/cjs/component/marker/utils.js +1 -1
  12. package/cjs/component/marker/utils.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 +2 -0
  17. package/cjs/core/vchart.js +4 -0
  18. package/cjs/core/vchart.js.map +1 -1
  19. package/cjs/plugin/chart/resize-zoom/zoom.d.ts +0 -1
  20. package/cjs/plugin/chart/resize-zoom/zoom.js +1 -3
  21. package/cjs/plugin/chart/resize-zoom/zoom.js.map +1 -1
  22. package/esm/chart/base/base-chart.d.ts +2 -0
  23. package/esm/chart/base/base-chart.js +15 -2
  24. package/esm/chart/base/base-chart.js.map +1 -1
  25. package/esm/chart/interface/chart.d.ts +2 -0
  26. package/esm/chart/interface/chart.js.map +1 -1
  27. package/esm/component/marker/utils.js +1 -1
  28. package/esm/component/marker/utils.js.map +1 -1
  29. package/esm/core/index.d.ts +1 -1
  30. package/esm/core/index.js +1 -1
  31. package/esm/core/index.js.map +1 -1
  32. package/esm/core/vchart.d.ts +2 -0
  33. package/esm/core/vchart.js +4 -0
  34. package/esm/core/vchart.js.map +1 -1
  35. package/esm/plugin/chart/resize-zoom/zoom.d.ts +0 -1
  36. package/esm/plugin/chart/resize-zoom/zoom.js +1 -2
  37. package/esm/plugin/chart/resize-zoom/zoom.js.map +1 -1
  38. package/package.json +5 -5
package/build/index.es.js CHANGED
@@ -60981,6 +60981,10 @@ class VChart {
60981
60981
  var _a;
60982
60982
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
60983
60983
  }
60984
+ showCrosshair(cb) {
60985
+ var _a;
60986
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
60987
+ }
60984
60988
  stopAnimation() {
60985
60989
  var _a;
60986
60990
  (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
@@ -61290,7 +61294,7 @@ const lookup = (data, opt) => {
61290
61294
  });
61291
61295
  };
61292
61296
 
61293
- const version = "2.0.8-alpha.1";
61297
+ const version = "2.0.8-alpha.5";
61294
61298
 
61295
61299
  const addVChartProperty = (data, op) => {
61296
61300
  const context = op.beforeCall();
@@ -70006,10 +70010,12 @@ class BaseChart extends CompilableBase {
70006
70010
  }
70007
70011
  });
70008
70012
  const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
70013
+ const isUnableTooltip = isUnableValue ||
70014
+ dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
70009
70015
  if (opt.tooltip !== false) {
70010
70016
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70011
70017
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70012
- if (isUnableValue) {
70018
+ if (isUnableValue || isUnableTooltip) {
70013
70019
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70014
70020
  }
70015
70021
  else {
@@ -70039,6 +70045,25 @@ class BaseChart extends CompilableBase {
70039
70045
  }
70040
70046
  }
70041
70047
  }
70048
+ showCrosshair(cb) {
70049
+ var _a;
70050
+ const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
70051
+ if (!crosshair) {
70052
+ return;
70053
+ }
70054
+ const axes = this.getComponentsByKey('axes');
70055
+ const dimInfo = [];
70056
+ axes.forEach(axis => {
70057
+ const value = cb(axis);
70058
+ if (value !== false) {
70059
+ dimInfo.push({
70060
+ axis,
70061
+ value
70062
+ });
70063
+ }
70064
+ });
70065
+ crosshair.showCrosshair(dimInfo);
70066
+ }
70042
70067
  getColorScheme() {
70043
70068
  var _a, _b;
70044
70069
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
@@ -98844,7 +98869,7 @@ function xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries,
98844
98869
  const lines = [];
98845
98870
  const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
98846
98871
  const xAxisHelper = relativeSeries.getXAxisHelper();
98847
- const yAxisHelper = relativeSeries.getXAxisHelper();
98872
+ const yAxisHelper = relativeSeries.getYAxisHelper();
98848
98873
  const xDomain = xAxisHelper.getScale(0).domain();
98849
98874
  const yDomain = yAxisHelper.getScale(0).domain();
98850
98875
  const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
@@ -105639,11 +105664,6 @@ class ChartResizeZoomPlugin extends BasePlugin {
105639
105664
  this.type = 'ChartResizeZoomPlugin';
105640
105665
  this._zoom = 1;
105641
105666
  this._onWheel = (e) => {
105642
- if (this._beforeWheel) {
105643
- if (!this._beforeWheel(e) === false) {
105644
- return;
105645
- }
105646
- }
105647
105667
  e.preventDefault();
105648
105668
  e.stopImmediatePropagation();
105649
105669
  const zoom = Math.pow(1.005, -e.deltaY * Math.pow(16, e.deltaMode) * 0.2 * this._rate);
@@ -105661,7 +105681,6 @@ class ChartResizeZoomPlugin extends BasePlugin {
105661
105681
  this._minZoom = (_c = spec.min) !== null && _c !== void 0 ? _c : MIN_ZOOM;
105662
105682
  this._maxZoom = (_d = spec.max) !== null && _d !== void 0 ? _d : MAX_ZOOM;
105663
105683
  this._rate = (_e = spec.rate) !== null && _e !== void 0 ? _e : 0.1;
105664
- this._beforeWheel = spec.beforeWheel;
105665
105684
  this._container = chart.getContainer();
105666
105685
  this._triggerEvent = getDefaultTriggerEventByMode(service.globalInstance.getChart().getOption().mode).zoom;
105667
105686
  if (this._container && this._triggerEvent) {
package/build/index.js CHANGED
@@ -60987,6 +60987,10 @@
60987
60987
  var _a;
60988
60988
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
60989
60989
  }
60990
+ showCrosshair(cb) {
60991
+ var _a;
60992
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
60993
+ }
60990
60994
  stopAnimation() {
60991
60995
  var _a;
60992
60996
  (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
@@ -61296,7 +61300,7 @@
61296
61300
  });
61297
61301
  };
61298
61302
 
61299
- const version = "2.0.8-alpha.1";
61303
+ const version = "2.0.8-alpha.5";
61300
61304
 
61301
61305
  const addVChartProperty = (data, op) => {
61302
61306
  const context = op.beforeCall();
@@ -70012,10 +70016,12 @@
70012
70016
  }
70013
70017
  });
70014
70018
  const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
70019
+ const isUnableTooltip = isUnableValue ||
70020
+ dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
70015
70021
  if (opt.tooltip !== false) {
70016
70022
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70017
70023
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70018
- if (isUnableValue) {
70024
+ if (isUnableValue || isUnableTooltip) {
70019
70025
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70020
70026
  }
70021
70027
  else {
@@ -70045,6 +70051,25 @@
70045
70051
  }
70046
70052
  }
70047
70053
  }
70054
+ showCrosshair(cb) {
70055
+ var _a;
70056
+ const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
70057
+ if (!crosshair) {
70058
+ return;
70059
+ }
70060
+ const axes = this.getComponentsByKey('axes');
70061
+ const dimInfo = [];
70062
+ axes.forEach(axis => {
70063
+ const value = cb(axis);
70064
+ if (value !== false) {
70065
+ dimInfo.push({
70066
+ axis,
70067
+ value
70068
+ });
70069
+ }
70070
+ });
70071
+ crosshair.showCrosshair(dimInfo);
70072
+ }
70048
70073
  getColorScheme() {
70049
70074
  var _a, _b;
70050
70075
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
@@ -98850,7 +98875,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98850
98875
  const lines = [];
98851
98876
  const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
98852
98877
  const xAxisHelper = relativeSeries.getXAxisHelper();
98853
- const yAxisHelper = relativeSeries.getXAxisHelper();
98878
+ const yAxisHelper = relativeSeries.getYAxisHelper();
98854
98879
  const xDomain = xAxisHelper.getScale(0).domain();
98855
98880
  const yDomain = yAxisHelper.getScale(0).domain();
98856
98881
  const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
@@ -105645,11 +105670,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105645
105670
  this.type = 'ChartResizeZoomPlugin';
105646
105671
  this._zoom = 1;
105647
105672
  this._onWheel = (e) => {
105648
- if (this._beforeWheel) {
105649
- if (!this._beforeWheel(e) === false) {
105650
- return;
105651
- }
105652
- }
105653
105673
  e.preventDefault();
105654
105674
  e.stopImmediatePropagation();
105655
105675
  const zoom = Math.pow(1.005, -e.deltaY * Math.pow(16, e.deltaMode) * 0.2 * this._rate);
@@ -105667,7 +105687,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105667
105687
  this._minZoom = (_c = spec.min) !== null && _c !== void 0 ? _c : MIN_ZOOM;
105668
105688
  this._maxZoom = (_d = spec.max) !== null && _d !== void 0 ? _d : MAX_ZOOM;
105669
105689
  this._rate = (_e = spec.rate) !== null && _e !== void 0 ? _e : 0.1;
105670
- this._beforeWheel = spec.beforeWheel;
105671
105690
  this._container = chart.getContainer();
105672
105691
  this._triggerEvent = getDefaultTriggerEventByMode(service.globalInstance.getChart().getOption().mode).zoom;
105673
105692
  if (this._container && this._triggerEvent) {