@visactor/vchart 2.0.8-alpha.3 → 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.
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.3";
61297
+ const version = "2.0.8-alpha.5";
61294
61298
 
61295
61299
  const addVChartProperty = (data, op) => {
61296
61300
  const context = op.beforeCall();
@@ -70005,13 +70009,13 @@ class BaseChart extends CompilableBase {
70005
70009
  }
70006
70010
  }
70007
70011
  });
70008
- const isUnableValue = isNil$1(value) ||
70009
- !dimensionInfo ||
70010
- dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && (isNil$1(d.index) || d.data.every(_data => _data.datum.length === 0)));
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));
70011
70015
  if (opt.tooltip !== false) {
70012
70016
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70013
70017
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70014
- if (isUnableValue) {
70018
+ if (isUnableValue || isUnableTooltip) {
70015
70019
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70016
70020
  }
70017
70021
  else {
@@ -70041,6 +70045,25 @@ class BaseChart extends CompilableBase {
70041
70045
  }
70042
70046
  }
70043
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
+ }
70044
70067
  getColorScheme() {
70045
70068
  var _a, _b;
70046
70069
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
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.3";
61303
+ const version = "2.0.8-alpha.5";
61300
61304
 
61301
61305
  const addVChartProperty = (data, op) => {
61302
61306
  const context = op.beforeCall();
@@ -70011,13 +70015,13 @@
70011
70015
  }
70012
70016
  }
70013
70017
  });
70014
- const isUnableValue = isNil$1(value) ||
70015
- !dimensionInfo ||
70016
- dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && (isNil$1(d.index) || d.data.every(_data => _data.datum.length === 0)));
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));
70017
70021
  if (opt.tooltip !== false) {
70018
70022
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70019
70023
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70020
- if (isUnableValue) {
70024
+ if (isUnableValue || isUnableTooltip) {
70021
70025
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70022
70026
  }
70023
70027
  else {
@@ -70047,6 +70051,25 @@
70047
70051
  }
70048
70052
  }
70049
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
+ }
70050
70073
  getColorScheme() {
70051
70074
  var _a, _b;
70052
70075
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');