@visactor/vchart 2.0.10-alpha.1 → 2.0.10

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
@@ -61218,6 +61218,10 @@ class VChart {
61218
61218
  var _a;
61219
61219
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
61220
61220
  }
61221
+ showCrosshair(cb) {
61222
+ var _a;
61223
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
61224
+ }
61221
61225
  stopAnimation() {
61222
61226
  var _a;
61223
61227
  (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
@@ -61527,7 +61531,7 @@ const lookup = (data, opt) => {
61527
61531
  });
61528
61532
  };
61529
61533
 
61530
- const version = "2.0.10-alpha.1";
61534
+ const version = "2.0.10";
61531
61535
 
61532
61536
  const addVChartProperty = (data, op) => {
61533
61537
  const context = op.beforeCall();
@@ -70276,10 +70280,12 @@ class BaseChart extends CompilableBase {
70276
70280
  }
70277
70281
  });
70278
70282
  const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
70283
+ const isUnableTooltip = isUnableValue ||
70284
+ dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
70279
70285
  if (opt.tooltip !== false) {
70280
70286
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70281
70287
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70282
- if (isUnableValue) {
70288
+ if (isUnableValue || isUnableTooltip) {
70283
70289
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70284
70290
  }
70285
70291
  else {
@@ -70309,6 +70315,25 @@ class BaseChart extends CompilableBase {
70309
70315
  }
70310
70316
  }
70311
70317
  }
70318
+ showCrosshair(cb) {
70319
+ var _a;
70320
+ const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
70321
+ if (!crosshair) {
70322
+ return;
70323
+ }
70324
+ const axes = this.getComponentsByKey('axes');
70325
+ const dimInfo = [];
70326
+ axes.forEach(axis => {
70327
+ const value = cb(axis);
70328
+ if (value !== false) {
70329
+ dimInfo.push({
70330
+ axis,
70331
+ value
70332
+ });
70333
+ }
70334
+ });
70335
+ crosshair.showCrosshair(dimInfo);
70336
+ }
70312
70337
  getColorScheme() {
70313
70338
  var _a, _b;
70314
70339
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');
package/build/index.js CHANGED
@@ -61224,6 +61224,10 @@
61224
61224
  var _a;
61225
61225
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
61226
61226
  }
61227
+ showCrosshair(cb) {
61228
+ var _a;
61229
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
61230
+ }
61227
61231
  stopAnimation() {
61228
61232
  var _a;
61229
61233
  (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.stopAnimation(true);
@@ -61533,7 +61537,7 @@
61533
61537
  });
61534
61538
  };
61535
61539
 
61536
- const version = "2.0.10-alpha.1";
61540
+ const version = "2.0.10";
61537
61541
 
61538
61542
  const addVChartProperty = (data, op) => {
61539
61543
  const context = op.beforeCall();
@@ -70282,10 +70286,12 @@
70282
70286
  }
70283
70287
  });
70284
70288
  const isUnableValue = isNil$1(value) || !dimensionInfo || dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && isNil$1(d.index));
70289
+ const isUnableTooltip = isUnableValue ||
70290
+ dimensionInfo.every(d => isDiscrete(d.axis.getScale().type) && d.data.every(_data => _data.datum.length === 0));
70285
70291
  if (opt.tooltip !== false) {
70286
70292
  const tooltip = this.getComponentsByType(ComponentTypeEnum.tooltip)[0];
70287
70293
  if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.getVisible()) {
70288
- if (isUnableValue) {
70294
+ if (isUnableValue || isUnableTooltip) {
70289
70295
  (_b = (_a = tooltip).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a);
70290
70296
  }
70291
70297
  else {
@@ -70315,6 +70321,25 @@
70315
70321
  }
70316
70322
  }
70317
70323
  }
70324
+ showCrosshair(cb) {
70325
+ var _a;
70326
+ const crosshair = (_a = this.getComponentsByType(ComponentTypeEnum.cartesianCrosshair)[0]) !== null && _a !== void 0 ? _a : this.getComponentsByType(ComponentTypeEnum.polarCrosshair)[0];
70327
+ if (!crosshair) {
70328
+ return;
70329
+ }
70330
+ const axes = this.getComponentsByKey('axes');
70331
+ const dimInfo = [];
70332
+ axes.forEach(axis => {
70333
+ const value = cb(axis);
70334
+ if (value !== false) {
70335
+ dimInfo.push({
70336
+ axis,
70337
+ value
70338
+ });
70339
+ }
70340
+ });
70341
+ crosshair.showCrosshair(dimInfo);
70342
+ }
70318
70343
  getColorScheme() {
70319
70344
  var _a, _b;
70320
70345
  return (_b = (_a = this._option).getTheme) === null || _b === void 0 ? void 0 : _b.call(_a, 'colorScheme');