@visactor/vchart 2.0.13-alpha.5 → 2.0.13-alpha.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 (86) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +694 -760
  3. package/build/index.js +694 -760
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/index.js +1 -1
  7. package/cjs/chart/stack.js +1 -1
  8. package/cjs/chart/util.js +1 -1
  9. package/cjs/compile/compiler.d.ts +0 -1
  10. package/cjs/compile/compiler.js +0 -3
  11. package/cjs/compile/compiler.js.map +1 -1
  12. package/cjs/compile/interface/compilable-item.d.ts +1 -2
  13. package/cjs/compile/interface/compilable-item.js.map +1 -1
  14. package/cjs/component/brush/brush.d.ts +1 -4
  15. package/cjs/component/brush/brush.js +14 -31
  16. package/cjs/component/brush/brush.js.map +1 -1
  17. package/cjs/component/brush/interface.d.ts +1 -3
  18. package/cjs/component/brush/interface.js.map +1 -1
  19. package/cjs/component/crosshair/interface/spec.d.ts +0 -1
  20. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  21. package/cjs/component/tooltip/interface/common.d.ts +0 -1
  22. package/cjs/component/tooltip/interface/common.js.map +1 -1
  23. package/cjs/component/tooltip/processor/base.js +1 -1
  24. package/cjs/component/tooltip/processor/base.js.map +1 -1
  25. package/cjs/component/tooltip/tooltip.d.ts +0 -1
  26. package/cjs/component/tooltip/tooltip.js +2 -3
  27. package/cjs/component/tooltip/tooltip.js.map +1 -1
  28. package/cjs/component/tooltip/utils/show-tooltip.js +2 -10
  29. package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
  30. package/cjs/component/util.js +2 -1
  31. package/cjs/constant/base.js +1 -2
  32. package/cjs/constant/scroll-bar.js +2 -1
  33. package/cjs/constant/word-cloud.js +1 -2
  34. package/cjs/core/interface.d.ts +1 -9
  35. package/cjs/core/interface.js +1 -1
  36. package/cjs/core/interface.js.map +1 -1
  37. package/cjs/core/util.js +1 -1
  38. package/cjs/core/vchart.d.ts +0 -3
  39. package/cjs/core/vchart.js +2 -11
  40. package/cjs/core/vchart.js.map +1 -1
  41. package/cjs/event/event.js +1 -1
  42. package/cjs/event/event.js.map +1 -1
  43. package/cjs/event/events/dimension/dimension-hover.d.ts +0 -2
  44. package/cjs/event/events/dimension/dimension-hover.js +3 -6
  45. package/cjs/event/events/dimension/dimension-hover.js.map +1 -1
  46. package/esm/chart/index.js +1 -1
  47. package/esm/chart/stack.js +1 -1
  48. package/esm/chart/util.js +1 -1
  49. package/esm/compile/compiler.d.ts +0 -1
  50. package/esm/compile/compiler.js +0 -3
  51. package/esm/compile/compiler.js.map +1 -1
  52. package/esm/compile/interface/compilable-item.d.ts +1 -2
  53. package/esm/compile/interface/compilable-item.js.map +1 -1
  54. package/esm/component/brush/brush.d.ts +1 -4
  55. package/esm/component/brush/brush.js +14 -31
  56. package/esm/component/brush/brush.js.map +1 -1
  57. package/esm/component/brush/interface.d.ts +1 -3
  58. package/esm/component/brush/interface.js.map +1 -1
  59. package/esm/component/crosshair/interface/spec.d.ts +0 -1
  60. package/esm/component/crosshair/interface/spec.js.map +1 -1
  61. package/esm/component/tooltip/interface/common.d.ts +0 -1
  62. package/esm/component/tooltip/interface/common.js.map +1 -1
  63. package/esm/component/tooltip/processor/base.js +1 -1
  64. package/esm/component/tooltip/processor/base.js.map +1 -1
  65. package/esm/component/tooltip/tooltip.d.ts +0 -1
  66. package/esm/component/tooltip/tooltip.js +2 -3
  67. package/esm/component/tooltip/tooltip.js.map +1 -1
  68. package/esm/component/tooltip/utils/show-tooltip.js +2 -10
  69. package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
  70. package/esm/component/util.js +2 -1
  71. package/esm/constant/base.js +1 -2
  72. package/esm/constant/scroll-bar.js +2 -1
  73. package/esm/constant/word-cloud.js +1 -2
  74. package/esm/core/interface.d.ts +1 -9
  75. package/esm/core/interface.js +1 -1
  76. package/esm/core/interface.js.map +1 -1
  77. package/esm/core/util.js +1 -1
  78. package/esm/core/vchart.d.ts +0 -3
  79. package/esm/core/vchart.js +1 -12
  80. package/esm/core/vchart.js.map +1 -1
  81. package/esm/event/event.js +1 -1
  82. package/esm/event/event.js.map +1 -1
  83. package/esm/event/events/dimension/dimension-hover.d.ts +0 -2
  84. package/esm/event/events/dimension/dimension-hover.js +2 -7
  85. package/esm/event/events/dimension/dimension-hover.js.map +1 -1
  86. package/package.json +8 -8
package/build/index.js CHANGED
@@ -51102,8 +51102,6 @@
51102
51102
  let Brush$1 = class Brush extends AbstractComponent {
51103
51103
  constructor(attributes, options) {
51104
51104
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeBrushState = !1, this._activeDrawState = !1, this._cacheDrawPoints = [], this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._firstUpdate = !0, this._onBrushStart = e => {
51105
- if (!1 === this.attribute.interactive) return;
51106
- if (!1 === this._beforeBrushEvent(e)) return;
51107
51105
  const {
51108
51106
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51109
51107
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51111,11 +51109,11 @@
51111
51109
  } = this.attribute;
51112
51110
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), e.stopPropagation(), this._firstUpdate = !0, this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._startPos = this.eventPosToStagePos(e), this._cacheDrawPoints = [this._startPos];
51113
51111
  }, this._onBrushing = e => {
51114
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e))));
51112
+ this._outOfInteractiveRange(e) || (e.stopPropagation(), this._firstUpdate ? (this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e), this._firstUpdate = !1) : (this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e)));
51115
51113
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51116
- !1 !== this.attribute.interactive && (this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1);
51114
+ this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51117
51115
  }, this._onBrushClear = e => {
51118
- !1 !== this.attribute.interactive && !1 !== this._beforeBrushEvent(e) && (e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1);
51116
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51119
51117
  };
51120
51118
  }
51121
51119
  _bindBrushEvents() {
@@ -51127,7 +51125,6 @@
51127
51125
  array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
51128
51126
  }
51129
51127
  _initDraw(e) {
51130
- if (!1 === this.attribute.interactive) return;
51131
51128
  const {
51132
51129
  brushMode: brushMode
51133
51130
  } = this.attribute,
@@ -51136,7 +51133,6 @@
51136
51133
  }
51137
51134
  _initMove(e) {
51138
51135
  var _a, _b;
51139
- if (!1 === this.attribute.interactive) return;
51140
51136
  this._cacheMovePoint = this.eventPosToStagePos(e), this._operatingMaskMoveDx = null !== (_a = this._operatingMask.attribute.dx) && void 0 !== _a ? _a : 0, this._operatingMaskMoveDy = null !== (_b = this._operatingMask.attribute.dy) && void 0 !== _b ? _b : 0;
51141
51137
  const {
51142
51138
  interactiveRange: interactiveRange
@@ -51161,7 +51157,6 @@
51161
51157
  }
51162
51158
  _drawing(e) {
51163
51159
  var _a;
51164
- if (!1 === this.attribute.interactive) return;
51165
51160
  const pos = this.eventPosToStagePos(e),
51166
51161
  {
51167
51162
  brushType: brushType,
@@ -51186,7 +51181,6 @@
51186
51181
  (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) && (1 !== Object.keys(this._brushMaskAABBBoundsDict).length || this._activeBrushState ? this._dispatchBrushEvent(IOperateType.drawing, e) : (this._activeBrushState = !0, this._dispatchBrushEvent(IOperateType.brushActive, e)));
51187
51182
  }
51188
51183
  _moving(e) {
51189
- if (!1 === this.attribute.interactive) return;
51190
51184
  const startPos = this._cacheMovePoint,
51191
51185
  pos = this.eventPosToStagePos(e);
51192
51186
  if (pos.x === (null == startPos ? void 0 : startPos.x) && pos.y === (null == startPos ? void 0 : startPos.y)) return;
@@ -51200,7 +51194,6 @@
51200
51194
  }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
51201
51195
  }
51202
51196
  _drawEnd(e) {
51203
- if (!1 === this.attribute.interactive) return;
51204
51197
  const {
51205
51198
  removeOnClick = !0,
51206
51199
  sizeThreshold = DEFAULT_SIZE_THRESHOLD
@@ -51218,7 +51211,7 @@
51218
51211
  }
51219
51212
  }
51220
51213
  _moveEnd(e) {
51221
- !1 !== this.attribute.interactive && (this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e));
51214
+ this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e);
51222
51215
  }
51223
51216
  render() {
51224
51217
  this._bindBrushEvents();
@@ -51325,10 +51318,6 @@
51325
51318
  pos = this.eventPosToStagePos(e);
51326
51319
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51327
51320
  }
51328
- _beforeBrushEvent(e) {
51329
- var _a, _b;
51330
- return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51331
- }
51332
51321
  _dispatchBrushEvent(operateType, e) {
51333
51322
  this._dispatchEvent(operateType, {
51334
51323
  operateMask: this._operatingMask,
@@ -53874,7 +53863,7 @@
53874
53863
  if (ComposedEventCtor) {
53875
53864
  const composedEvent = new ComposedEventCtor(this._eventDispatcher, this._mode);
53876
53865
  composedEvent.register(eType, handler);
53877
- this._composedEventMap.set(handler.callback, {
53866
+ this._composedEventMap.set(callback, {
53878
53867
  eventType: eType,
53879
53868
  event: composedEvent
53880
53869
  });
@@ -54911,9 +54900,6 @@
54911
54900
  getRootGroup() {
54912
54901
  return this._rootGroup;
54913
54902
  }
54914
- getOption() {
54915
- return this._option;
54916
- }
54917
54903
  constructor(container, option) {
54918
54904
  this._count = 0;
54919
54905
  this._rootMarks = [];
@@ -60286,609 +60272,6 @@
60286
60272
  }
60287
60273
  }
60288
60274
 
60289
- function getComponentThemeFromOption(type, getTheme) {
60290
- return getTheme('component', type);
60291
- }
60292
- function getFormatFunction(formatMethod, formatter, text, datum) {
60293
- if (formatMethod) {
60294
- return { formatFunc: formatMethod, args: [text, datum] };
60295
- }
60296
- const formatterImpl = Factory.getFormatter();
60297
- if (formatter && formatterImpl) {
60298
- return { formatFunc: formatterImpl, args: [text, datum, formatter] };
60299
- }
60300
- return {};
60301
- }
60302
- const getSpecInfo = (chartSpec, specKey, compType, filter) => {
60303
- if (isNil$1(chartSpec[specKey])) {
60304
- return undefined;
60305
- }
60306
- const isArraySpec = isArray$1(chartSpec[specKey]);
60307
- const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
60308
- const specInfos = [];
60309
- spec.forEach((s, i) => {
60310
- if (s && (!filter || filter(s))) {
60311
- specInfos.push({
60312
- spec: s,
60313
- specPath: isArraySpec ? [specKey, i] : [specKey],
60314
- specInfoPath: ['component', specKey, i],
60315
- type: compType
60316
- });
60317
- }
60318
- });
60319
- return specInfos;
60320
- };
60321
-
60322
- function isXAxis(orient) {
60323
- return orient === 'bottom' || orient === 'top';
60324
- }
60325
- function isYAxis(orient) {
60326
- return orient === 'left' || orient === 'right';
60327
- }
60328
- function isZAxis(orient) {
60329
- return orient === 'z';
60330
- }
60331
- function autoAxisType(orient, isHorizontal) {
60332
- if (isHorizontal) {
60333
- return isXAxis(orient) ? 'linear' : 'band';
60334
- }
60335
- return isXAxis(orient) ? 'band' : 'linear';
60336
- }
60337
- function getOrient(spec, whiteList) {
60338
- return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
60339
- }
60340
- function getDirectionByOrient(orient) {
60341
- return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
60342
- }
60343
- function transformInverse(spec, isHorizontal) {
60344
- let inverse = spec.inverse;
60345
- if (isHorizontal && !isXAxis(spec.orient)) {
60346
- inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
60347
- }
60348
- return inverse;
60349
- }
60350
- function getCartesianAxisInfo(spec, isHorizontal) {
60351
- var _a;
60352
- const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
60353
- const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
60354
- return { axisType, componentName };
60355
- }
60356
- const getCartesianAxisTheme = (orient, type, getTheme) => {
60357
- var _a;
60358
- const axisTypeTheme = (_a = (type === 'band'
60359
- ? getComponentThemeFromOption('axisBand', getTheme)
60360
- : ['linear', 'log', 'symlog'].includes(type)
60361
- ? getComponentThemeFromOption('axisLinear', getTheme)
60362
- : {})) !== null && _a !== void 0 ? _a : {};
60363
- const axisTheme = isXAxis(orient)
60364
- ? getComponentThemeFromOption('axisX', getTheme)
60365
- : isYAxis(orient)
60366
- ? getComponentThemeFromOption('axisY', getTheme)
60367
- : getComponentThemeFromOption('axisZ', getTheme);
60368
- return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
60369
- };
60370
-
60371
- class DimensionEvent {
60372
- constructor(eventDispatcher, mode) {
60373
- this._eventDispatcher = eventDispatcher;
60374
- this._mode = mode;
60375
- }
60376
- get chart() {
60377
- var _a, _b;
60378
- if (!this._chart) {
60379
- this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
60380
- }
60381
- return this._chart;
60382
- }
60383
- register(eType, handler) {
60384
- var _a, _b;
60385
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
60386
- }
60387
- unregister() {
60388
- var _a, _b;
60389
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
60390
- }
60391
- getTargetDimensionInfo(x, y) {
60392
- var _a, _b, _c;
60393
- const dimensionInfo = (_c = (_b = (_a = this.chart.getModelOption()).getDimensionInfo) === null || _b === void 0 ? void 0 : _b.call(_a, this.chart, { x, y })) !== null && _c !== void 0 ? _c : [];
60394
- if (dimensionInfo.length === 0) {
60395
- return null;
60396
- }
60397
- return dimensionInfo;
60398
- }
60399
- dispatch(v, opt) {
60400
- var _a, _b;
60401
- const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
60402
- if (c.specKey !== 'axes') {
60403
- return false;
60404
- }
60405
- if (opt === null || opt === void 0 ? void 0 : opt.filter) {
60406
- return opt.filter(c);
60407
- }
60408
- return true;
60409
- });
60410
- const discreteAxes = axes.filter(axis => {
60411
- const scale = axis.getScale();
60412
- return isDiscrete(scale.type);
60413
- });
60414
- const dimAxes = discreteAxes.length
60415
- ? discreteAxes
60416
- : axes.filter(axis => {
60417
- const orient = axis.getOrient();
60418
- return isXAxis(orient) || orient === 'angle';
60419
- });
60420
- const dimensionInfo = [];
60421
- const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
60422
- if (getDimensionInfoByValue) {
60423
- dimAxes.forEach(a => {
60424
- const info = getDimensionInfoByValue(a, v);
60425
- if (info) {
60426
- dimensionInfo.push(info);
60427
- }
60428
- });
60429
- }
60430
- this._callback.call(null, {
60431
- action: 'enter',
60432
- dimensionInfo
60433
- });
60434
- return dimensionInfo;
60435
- }
60436
- }
60437
-
60438
- class DimensionClickEvent extends DimensionEvent {
60439
- constructor() {
60440
- super(...arguments);
60441
- this.onClick = (params) => {
60442
- if (!params) {
60443
- return;
60444
- }
60445
- const x = params.event.viewX;
60446
- const y = params.event.viewY;
60447
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
60448
- if (!targetDimensionInfo) {
60449
- return;
60450
- }
60451
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
60452
- };
60453
- }
60454
- register(eType, handler) {
60455
- this._callback = handler.callback;
60456
- this._eventDispatcher.register('pointertap', {
60457
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60458
- callback: this.onClick
60459
- });
60460
- }
60461
- unregister() {
60462
- this._eventDispatcher.unregister('pointertap', {
60463
- query: null,
60464
- callback: this.onClick
60465
- });
60466
- }
60467
- }
60468
-
60469
- const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
60470
- const isInRegionBound = (chart, axis, pos) => {
60471
- const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
60472
- return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
60473
- const rect = region.getLayoutRect();
60474
- const startPoint = region.getLayoutStartPoint();
60475
- return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
60476
- });
60477
- };
60478
- const isSameDimensionInfo = (a, b) => {
60479
- var _a, _b;
60480
- if (a === b) {
60481
- return true;
60482
- }
60483
- if (isNil$1(a) || isNil$1(b)) {
60484
- return false;
60485
- }
60486
- if (a.value !== b.value) {
60487
- return false;
60488
- }
60489
- if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
60490
- return false;
60491
- }
60492
- return true;
60493
- };
60494
- const resolveTooltipFilterRange = (spec, scale) => {
60495
- const range = spec.tooltipFilterRange;
60496
- const rangeValue = typeof range === 'function' ? range({ scale }) : range;
60497
- const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
60498
- return rangeArr;
60499
- };
60500
- const getDimensionData = (value, axis, coordinate, getDimensionField) => {
60501
- var _a;
60502
- const scale = axis.getScale();
60503
- const isDiscreteAxis = isDiscrete(scale.type);
60504
- const data = [];
60505
- const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
60506
- for (const series of seriesList) {
60507
- if (series.coordinate === coordinate) {
60508
- const dimensionField = array(getDimensionField(series));
60509
- const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
60510
- if (dimensionField && viewData) {
60511
- if (isDiscreteAxis) {
60512
- const datums = [];
60513
- const datumIdList = [];
60514
- viewData.forEach((datum, i) => {
60515
- var _a;
60516
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
60517
- datums.push(datum);
60518
- datumIdList.push(i);
60519
- }
60520
- });
60521
- data.push({
60522
- series,
60523
- datum: datums,
60524
- key: getDimensionDataKey(series, datumIdList)
60525
- });
60526
- }
60527
- else {
60528
- if (isValid$1(dimensionField[1])) {
60529
- const datums = [];
60530
- const datumIdList = [];
60531
- viewData.forEach((datum, i) => {
60532
- var _a;
60533
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
60534
- (isValid$1(datum[dimensionField[0]]) &&
60535
- isValid$1(datum[dimensionField[1]]) &&
60536
- value >= datum[dimensionField[0]] &&
60537
- value < datum[dimensionField[1]])) {
60538
- datums.push(datum);
60539
- datumIdList.push(i);
60540
- }
60541
- });
60542
- data.push({
60543
- series,
60544
- datum: datums,
60545
- key: getDimensionDataKey(series, datumIdList)
60546
- });
60547
- }
60548
- else {
60549
- const spec = axis.getSpec();
60550
- const rangeArr = resolveTooltipFilterRange(spec, scale);
60551
- let datums = [];
60552
- let datumIdList = [];
60553
- if (rangeArr) {
60554
- viewData.forEach((datum, i) => {
60555
- if (isValid$1(datum[dimensionField[0]])) {
60556
- const delta = datum[dimensionField[0]] - value;
60557
- if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
60558
- datums.push(datum);
60559
- datumIdList.push(i);
60560
- }
60561
- }
60562
- });
60563
- }
60564
- else {
60565
- let minDelta = Infinity;
60566
- let deltaSign = 0;
60567
- viewData.forEach((datum, i) => {
60568
- if (isValid$1(datum[dimensionField[0]])) {
60569
- const delta = Math.abs(datum[dimensionField[0]] - value);
60570
- const sign = Math.sign(datum[dimensionField[0]] - value);
60571
- if (delta < minDelta) {
60572
- minDelta = delta;
60573
- datums = [datum];
60574
- datumIdList = [i];
60575
- deltaSign = sign;
60576
- }
60577
- else if (delta === minDelta && sign === deltaSign) {
60578
- datums.push(datum);
60579
- datumIdList.push(i);
60580
- }
60581
- }
60582
- });
60583
- }
60584
- data.push({
60585
- series,
60586
- datum: datums,
60587
- key: getDimensionDataKey(series, datumIdList)
60588
- });
60589
- }
60590
- }
60591
- }
60592
- }
60593
- }
60594
- return data;
60595
- };
60596
- const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
60597
- const getAxis = (chart, filter, pos) => {
60598
- const axesComponents = chart
60599
- .getAllComponents()
60600
- .filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
60601
- if (!axesComponents.length) {
60602
- return null;
60603
- }
60604
- return axesComponents;
60605
- };
60606
-
60607
- class DimensionHoverEvent extends DimensionEvent {
60608
- constructor() {
60609
- super(...arguments);
60610
- this._cacheDimensionInfo = null;
60611
- this.onMouseMove = (params) => {
60612
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
60613
- return;
60614
- }
60615
- const x = params.event.viewX;
60616
- const y = params.event.viewY;
60617
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
60618
- if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
60619
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
60620
- this._cacheDimensionInfo = targetDimensionInfo;
60621
- }
60622
- else if (targetDimensionInfo !== null &&
60623
- (this._cacheDimensionInfo === null ||
60624
- targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
60625
- targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
60626
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
60627
- this._cacheDimensionInfo = targetDimensionInfo;
60628
- }
60629
- else if (targetDimensionInfo !== null) {
60630
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
60631
- }
60632
- };
60633
- this.onMouseOut = (params) => {
60634
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
60635
- return;
60636
- }
60637
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
60638
- this._cacheDimensionInfo = null;
60639
- };
60640
- }
60641
- static disableDimensionEvent(value) {
60642
- this._disableDimensionEvent = value;
60643
- }
60644
- register(eType, handler) {
60645
- this._callback = handler.callback;
60646
- this._eventDispatcher.register('pointermove', {
60647
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60648
- callback: this.onMouseMove
60649
- });
60650
- this._eventDispatcher.register('pointerout', {
60651
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
60652
- callback: this.onMouseOut
60653
- });
60654
- if (isMobileLikeMode(this._mode)) {
60655
- this._eventDispatcher.register('pointerdown', {
60656
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60657
- callback: this.onMouseMove
60658
- });
60659
- }
60660
- }
60661
- unregister() {
60662
- this._eventDispatcher.unregister('pointermove', {
60663
- query: null,
60664
- callback: this.onMouseMove
60665
- });
60666
- if (isMobileLikeMode(this._mode)) {
60667
- this._eventDispatcher.unregister('pointerdown', {
60668
- query: null,
60669
- callback: this.onMouseMove
60670
- });
60671
- }
60672
- }
60673
- }
60674
- DimensionHoverEvent._disableDimensionEvent = false;
60675
-
60676
- exports.DimensionEventEnum = void 0;
60677
- (function (DimensionEventEnum) {
60678
- DimensionEventEnum["dimensionHover"] = "dimensionHover";
60679
- DimensionEventEnum["dimensionClick"] = "dimensionClick";
60680
- })(exports.DimensionEventEnum || (exports.DimensionEventEnum = {}));
60681
-
60682
- const registerDimensionEvents = () => {
60683
- Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionHover, DimensionHoverEvent);
60684
- Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionClick, DimensionClickEvent);
60685
- };
60686
-
60687
- const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
60688
- const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
60689
- const continuousXAxisGetDimensionField = (series) => {
60690
- var _a;
60691
- return [
60692
- series.fieldX[0],
60693
- (_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
60694
- ];
60695
- };
60696
- const continuousYAxisGetDimensionField = (series) => {
60697
- var _a;
60698
- return [
60699
- series.fieldY[0],
60700
- (_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
60701
- ];
60702
- };
60703
- const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
60704
- ? isDiscreteAxis
60705
- ? discreteXAxisGetDimensionField
60706
- : continuousXAxisGetDimensionField
60707
- : isDiscreteAxis
60708
- ? discreteYAxisGetDimensionField
60709
- : continuousYAxisGetDimensionField;
60710
- const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
60711
- var _a, _b;
60712
- if (!chart) {
60713
- return null;
60714
- }
60715
- const { x, y } = pos;
60716
- const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
60717
- const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
60718
- if (!xAxisList.length && !yAxisList.length) {
60719
- return null;
60720
- }
60721
- const bandAxisSet = new Set();
60722
- const linearAxisSet = new Set();
60723
- const forceAxisSet = new Set();
60724
- [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
60725
- const isDiscreteAxis = isDiscrete(axis.getScale().type);
60726
- if (isDiscreteAxis) {
60727
- bandAxisSet.add(axis);
60728
- }
60729
- else {
60730
- linearAxisSet.add(axis);
60731
- }
60732
- if (isTooltip && axis.getSpec().hasDimensionTooltip) {
60733
- forceAxisSet.add(axis);
60734
- }
60735
- }));
60736
- const targetAxisInfo = [];
60737
- const addAxisDimensionInfo = (orient) => {
60738
- const isXAxis = orient === 'x';
60739
- const posValue = isXAxis ? x : y;
60740
- const axisList = isXAxis ? xAxisList : yAxisList;
60741
- axisList.forEach(axis => {
60742
- if (forceAxisSet.size > 0) {
60743
- if (forceAxisSet.has(axis)) {
60744
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
60745
- info && targetAxisInfo.push(info);
60746
- }
60747
- }
60748
- else {
60749
- const hasDiscreteAxis = bandAxisSet.size > 0;
60750
- if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
60751
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
60752
- info && targetAxisInfo.push(info);
60753
- }
60754
- }
60755
- });
60756
- };
60757
- if (chart.getSpec().direction === "horizontal") {
60758
- addAxisDimensionInfo('y');
60759
- if (targetAxisInfo.length === 0) {
60760
- addAxisDimensionInfo('x');
60761
- }
60762
- }
60763
- else {
60764
- addAxisDimensionInfo('x');
60765
- if (targetAxisInfo.length === 0) {
60766
- addAxisDimensionInfo('y');
60767
- }
60768
- }
60769
- if (!targetAxisInfo.length) {
60770
- return null;
60771
- }
60772
- return targetAxisInfo;
60773
- };
60774
- const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
60775
- const value = axis.positionToData(posValue, true);
60776
- return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
60777
- };
60778
- const getDimensionInfoByValue = (axis, value, getDimensionField) => {
60779
- const scale = axis.getScale();
60780
- if (isNil$1(value)) {
60781
- return null;
60782
- }
60783
- const domain = scale.domain();
60784
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60785
- if (index < 0) {
60786
- index = undefined;
60787
- }
60788
- const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
60789
- return { index, value, position: scale.scale(value), axis, data };
60790
- };
60791
-
60792
- const angleStandardize = (angle, range) => {
60793
- const unit = Math.PI * 2;
60794
- const min = minInArray(range);
60795
- const max = maxInArray(range);
60796
- if (angle < min) {
60797
- angle += Math.ceil((min - angle) / unit) * unit;
60798
- }
60799
- else if (angle > max) {
60800
- angle -= Math.ceil((angle - max) / unit) * unit;
60801
- }
60802
- return angle;
60803
- };
60804
- const getPolarDimensionInfo = (chart, pos) => {
60805
- if (!chart) {
60806
- return null;
60807
- }
60808
- const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
60809
- const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
60810
- if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
60811
- return null;
60812
- }
60813
- const targetAxisInfo = [];
60814
- const getDimensionField = (series) => series.getDimensionField()[0];
60815
- const { x, y } = pos;
60816
- if (angleAxisList) {
60817
- angleAxisList.forEach(axis => {
60818
- var _a;
60819
- const angleScale = axis.getScale();
60820
- if (angleScale && isDiscrete(angleScale.type)) {
60821
- const angleDomain = angleScale.domain();
60822
- const angleRange = angleScale.range();
60823
- const center = axis.getCenter();
60824
- const vector = {
60825
- x: x - axis.getLayoutStartPoint().x - center.x,
60826
- y: y - axis.getLayoutStartPoint().y - center.y
60827
- };
60828
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
60829
- angle = angleStandardize(angle, angleRange);
60830
- const radius = distance(vector);
60831
- const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
60832
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
60833
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
60834
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
60835
- return;
60836
- }
60837
- const value = axis.invert(angle);
60838
- if (isNil$1(value)) {
60839
- return;
60840
- }
60841
- let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60842
- if (index < 0) {
60843
- index = undefined;
60844
- }
60845
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
60846
- targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
60847
- }
60848
- });
60849
- }
60850
- if (radiusAxisList) {
60851
- radiusAxisList.forEach(axis => {
60852
- var _a;
60853
- const radiusScale = axis.getScale();
60854
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
60855
- if (radiusScale && isDiscrete(radiusScale.type)) {
60856
- const center = axis.getCenter();
60857
- const vector = {
60858
- x: x - axis.getLayoutStartPoint().x - center.x,
60859
- y: y - axis.getLayoutStartPoint().y - center.y
60860
- };
60861
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
60862
- if (angle < -Math.PI / 2) {
60863
- angle = Math.PI * 2 + angle;
60864
- }
60865
- const radius = distance(vector);
60866
- const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
60867
- const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
60868
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
60869
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
60870
- return;
60871
- }
60872
- const value = radiusScale.invert(radius);
60873
- if (isNil$1(value)) {
60874
- return;
60875
- }
60876
- const domain = radiusScale.domain();
60877
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60878
- if (index < 0) {
60879
- index = undefined;
60880
- }
60881
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
60882
- targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
60883
- }
60884
- });
60885
- }
60886
- if (!targetAxisInfo.length) {
60887
- return null;
60888
- }
60889
- return targetAxisInfo;
60890
- };
60891
-
60892
60275
  class VChart {
60893
60276
  static useRegisters(comps) {
60894
60277
  comps.forEach((fn) => {
@@ -61137,7 +60520,7 @@
61137
60520
  this._compiler.updateLayoutTag();
61138
60521
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
61139
60522
  this._initDataSet(this._option.dataSet);
61140
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
60523
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
61141
60524
  this._bindResizeEvent();
61142
60525
  this._bindViewEvent();
61143
60526
  this._initChartPlugin();
@@ -61790,7 +61173,7 @@
61790
61173
  resize = true;
61791
61174
  }
61792
61175
  const lasAutoSize = this._autoSize;
61793
- this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
61176
+ this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
61794
61177
  if (this._autoSize !== lasAutoSize) {
61795
61178
  resize = true;
61796
61179
  }
@@ -62031,19 +61414,6 @@
62031
61414
  var _a;
62032
61415
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
62033
61416
  }
62034
- disableDimensionHoverEvent(value = true) {
62035
- DimensionHoverEvent.disableDimensionEvent(value);
62036
- }
62037
- disableCrossHair(value = true) {
62038
- this.getChart()
62039
- .getComponentsByKey('crosshair')
62040
- .forEach(crosshair => (crosshair.enable = !value));
62041
- }
62042
- disableTooltip(value = true) {
62043
- this.getChart()
62044
- .getComponentsByKey('tooltip')
62045
- .forEach(tooltip => (tooltip.enable = !value));
62046
- }
62047
61417
  showCrosshair(cb) {
62048
61418
  var _a;
62049
61419
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
@@ -62286,6 +61656,39 @@
62286
61656
  Direction["horizontal"] = "horizontal";
62287
61657
  })(exports.Direction || (exports.Direction = {}));
62288
61658
 
61659
+ function getComponentThemeFromOption(type, getTheme) {
61660
+ return getTheme('component', type);
61661
+ }
61662
+ function getFormatFunction(formatMethod, formatter, text, datum) {
61663
+ if (formatMethod) {
61664
+ return { formatFunc: formatMethod, args: [text, datum] };
61665
+ }
61666
+ const formatterImpl = Factory.getFormatter();
61667
+ if (formatter && formatterImpl) {
61668
+ return { formatFunc: formatterImpl, args: [text, datum, formatter] };
61669
+ }
61670
+ return {};
61671
+ }
61672
+ const getSpecInfo = (chartSpec, specKey, compType, filter) => {
61673
+ if (isNil$1(chartSpec[specKey])) {
61674
+ return undefined;
61675
+ }
61676
+ const isArraySpec = isArray$1(chartSpec[specKey]);
61677
+ const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
61678
+ const specInfos = [];
61679
+ spec.forEach((s, i) => {
61680
+ if (s && (!filter || filter(s))) {
61681
+ specInfos.push({
61682
+ spec: s,
61683
+ specPath: isArraySpec ? [specKey, i] : [specKey],
61684
+ specInfoPath: ['component', specKey, i],
61685
+ type: compType
61686
+ });
61687
+ }
61688
+ });
61689
+ return specInfos;
61690
+ };
61691
+
62289
61692
  const lookup = (data, opt) => {
62290
61693
  if (!opt.from || !opt.from()) {
62291
61694
  return data;
@@ -64651,96 +64054,452 @@
64651
64054
  }
64652
64055
  return this._scaleY.invert(yPos);
64653
64056
  }
64654
- getRegionRectLeft() {
64655
- if (!this._xAxisHelper) {
64656
- return Number.NaN;
64657
- }
64658
- const { getScale } = this._xAxisHelper;
64659
- return getScale(0).range()[0];
64057
+ getRegionRectLeft() {
64058
+ if (!this._xAxisHelper) {
64059
+ return Number.NaN;
64060
+ }
64061
+ const { getScale } = this._xAxisHelper;
64062
+ return getScale(0).range()[0];
64063
+ }
64064
+ getRegionRectRight() {
64065
+ if (!this._xAxisHelper) {
64066
+ return Number.NaN;
64067
+ }
64068
+ const { getScale } = this._xAxisHelper;
64069
+ return getScale(0).range()[1];
64070
+ }
64071
+ afterInitMark() {
64072
+ super.afterInitMark();
64073
+ this.setFieldX(this._fieldX);
64074
+ this.setFieldY(this._fieldY);
64075
+ this._buildScaleConfig();
64076
+ }
64077
+ getDimensionField() {
64078
+ if (this._direction === "horizontal") {
64079
+ return this._specYField;
64080
+ }
64081
+ return this._specXField;
64082
+ }
64083
+ getDimensionContinuousField() {
64084
+ if (this._direction === "horizontal") {
64085
+ return [this.fieldY[0], this.fieldY2];
64086
+ }
64087
+ return [this.fieldX[0], this.fieldX2];
64088
+ }
64089
+ getMeasureField() {
64090
+ if (this._direction === "horizontal") {
64091
+ return this._specXField;
64092
+ }
64093
+ return this._specYField;
64094
+ }
64095
+ initEvent() {
64096
+ super.initEvent();
64097
+ if (this.sortDataByAxis) {
64098
+ this.event.on(exports.ChartEvent.scaleDomainUpdate, {
64099
+ filter: param => {
64100
+ var _a;
64101
+ return param.model.id ===
64102
+ ((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
64103
+ }
64104
+ }, () => {
64105
+ this._sortDataInAxisDomain();
64106
+ });
64107
+ }
64108
+ }
64109
+ _sortDataInAxisDomain() {
64110
+ var _a, _b, _c;
64111
+ if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
64112
+ sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
64113
+ (_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
64114
+ }
64115
+ }
64116
+ getInvalidCheckFields() {
64117
+ const fields = [];
64118
+ if (this._xAxisHelper &&
64119
+ this._xAxisHelper.isContinuous &&
64120
+ this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64121
+ const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
64122
+ xFields.forEach(f => {
64123
+ fields.push(f);
64124
+ });
64125
+ }
64126
+ if (this._yAxisHelper &&
64127
+ this._yAxisHelper.isContinuous &&
64128
+ this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64129
+ const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
64130
+ yFields.forEach(f => {
64131
+ fields.push(f);
64132
+ });
64133
+ }
64134
+ return fields;
64135
+ }
64136
+ reInit(spec) {
64137
+ if (this._positionXEncoder) {
64138
+ this._positionXEncoder = null;
64139
+ }
64140
+ if (this._positionYEncoder) {
64141
+ this._positionYEncoder = null;
64142
+ }
64143
+ super.reInit(spec);
64144
+ }
64145
+ }
64146
+
64147
+ function isXAxis(orient) {
64148
+ return orient === 'bottom' || orient === 'top';
64149
+ }
64150
+ function isYAxis(orient) {
64151
+ return orient === 'left' || orient === 'right';
64152
+ }
64153
+ function isZAxis(orient) {
64154
+ return orient === 'z';
64155
+ }
64156
+ function autoAxisType(orient, isHorizontal) {
64157
+ if (isHorizontal) {
64158
+ return isXAxis(orient) ? 'linear' : 'band';
64159
+ }
64160
+ return isXAxis(orient) ? 'band' : 'linear';
64161
+ }
64162
+ function getOrient(spec, whiteList) {
64163
+ return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
64164
+ }
64165
+ function getDirectionByOrient(orient) {
64166
+ return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
64167
+ }
64168
+ function transformInverse(spec, isHorizontal) {
64169
+ let inverse = spec.inverse;
64170
+ if (isHorizontal && !isXAxis(spec.orient)) {
64171
+ inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
64172
+ }
64173
+ return inverse;
64174
+ }
64175
+ function getCartesianAxisInfo(spec, isHorizontal) {
64176
+ var _a;
64177
+ const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
64178
+ const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
64179
+ return { axisType, componentName };
64180
+ }
64181
+ const getCartesianAxisTheme = (orient, type, getTheme) => {
64182
+ var _a;
64183
+ const axisTypeTheme = (_a = (type === 'band'
64184
+ ? getComponentThemeFromOption('axisBand', getTheme)
64185
+ : ['linear', 'log', 'symlog'].includes(type)
64186
+ ? getComponentThemeFromOption('axisLinear', getTheme)
64187
+ : {})) !== null && _a !== void 0 ? _a : {};
64188
+ const axisTheme = isXAxis(orient)
64189
+ ? getComponentThemeFromOption('axisX', getTheme)
64190
+ : isYAxis(orient)
64191
+ ? getComponentThemeFromOption('axisY', getTheme)
64192
+ : getComponentThemeFromOption('axisZ', getTheme);
64193
+ return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
64194
+ };
64195
+
64196
+ class DimensionEvent {
64197
+ constructor(eventDispatcher, mode) {
64198
+ this._eventDispatcher = eventDispatcher;
64199
+ this._mode = mode;
64200
+ }
64201
+ get chart() {
64202
+ var _a, _b;
64203
+ if (!this._chart) {
64204
+ this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
64205
+ }
64206
+ return this._chart;
64207
+ }
64208
+ register(eType, handler) {
64209
+ var _a, _b;
64210
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64211
+ }
64212
+ unregister() {
64213
+ var _a, _b;
64214
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64215
+ }
64216
+ getTargetDimensionInfo(x, y) {
64217
+ var _a, _b, _c;
64218
+ const dimensionInfo = (_c = (_b = (_a = this.chart.getModelOption()).getDimensionInfo) === null || _b === void 0 ? void 0 : _b.call(_a, this.chart, { x, y })) !== null && _c !== void 0 ? _c : [];
64219
+ if (dimensionInfo.length === 0) {
64220
+ return null;
64221
+ }
64222
+ return dimensionInfo;
64223
+ }
64224
+ dispatch(v, opt) {
64225
+ var _a, _b;
64226
+ const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
64227
+ if (c.specKey !== 'axes') {
64228
+ return false;
64229
+ }
64230
+ if (opt === null || opt === void 0 ? void 0 : opt.filter) {
64231
+ return opt.filter(c);
64232
+ }
64233
+ return true;
64234
+ });
64235
+ const discreteAxes = axes.filter(axis => {
64236
+ const scale = axis.getScale();
64237
+ return isDiscrete(scale.type);
64238
+ });
64239
+ const dimAxes = discreteAxes.length
64240
+ ? discreteAxes
64241
+ : axes.filter(axis => {
64242
+ const orient = axis.getOrient();
64243
+ return isXAxis(orient) || orient === 'angle';
64244
+ });
64245
+ const dimensionInfo = [];
64246
+ const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
64247
+ if (getDimensionInfoByValue) {
64248
+ dimAxes.forEach(a => {
64249
+ const info = getDimensionInfoByValue(a, v);
64250
+ if (info) {
64251
+ dimensionInfo.push(info);
64252
+ }
64253
+ });
64254
+ }
64255
+ this._callback.call(null, {
64256
+ action: 'enter',
64257
+ dimensionInfo
64258
+ });
64259
+ return dimensionInfo;
64260
+ }
64261
+ }
64262
+
64263
+ class DimensionClickEvent extends DimensionEvent {
64264
+ constructor() {
64265
+ super(...arguments);
64266
+ this.onClick = (params) => {
64267
+ if (!params) {
64268
+ return;
64269
+ }
64270
+ const x = params.event.viewX;
64271
+ const y = params.event.viewY;
64272
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64273
+ if (!targetDimensionInfo) {
64274
+ return;
64275
+ }
64276
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
64277
+ };
64278
+ }
64279
+ register(eType, handler) {
64280
+ this._callback = handler.callback;
64281
+ this._eventDispatcher.register('pointertap', {
64282
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64283
+ callback: this.onClick
64284
+ });
64660
64285
  }
64661
- getRegionRectRight() {
64662
- if (!this._xAxisHelper) {
64663
- return Number.NaN;
64664
- }
64665
- const { getScale } = this._xAxisHelper;
64666
- return getScale(0).range()[1];
64286
+ unregister() {
64287
+ this._eventDispatcher.unregister('pointertap', {
64288
+ query: null,
64289
+ callback: this.onClick
64290
+ });
64667
64291
  }
64668
- afterInitMark() {
64669
- super.afterInitMark();
64670
- this.setFieldX(this._fieldX);
64671
- this.setFieldY(this._fieldY);
64672
- this._buildScaleConfig();
64292
+ }
64293
+
64294
+ const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
64295
+ const isInRegionBound = (chart, axis, pos) => {
64296
+ const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
64297
+ return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
64298
+ const rect = region.getLayoutRect();
64299
+ const startPoint = region.getLayoutStartPoint();
64300
+ return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
64301
+ });
64302
+ };
64303
+ const isSameDimensionInfo = (a, b) => {
64304
+ var _a, _b;
64305
+ if (a === b) {
64306
+ return true;
64673
64307
  }
64674
- getDimensionField() {
64675
- if (this._direction === "horizontal") {
64676
- return this._specYField;
64677
- }
64678
- return this._specXField;
64308
+ if (isNil$1(a) || isNil$1(b)) {
64309
+ return false;
64679
64310
  }
64680
- getDimensionContinuousField() {
64681
- if (this._direction === "horizontal") {
64682
- return [this.fieldY[0], this.fieldY2];
64683
- }
64684
- return [this.fieldX[0], this.fieldX2];
64311
+ if (a.value !== b.value) {
64312
+ return false;
64685
64313
  }
64686
- getMeasureField() {
64687
- if (this._direction === "horizontal") {
64688
- return this._specXField;
64689
- }
64690
- return this._specYField;
64314
+ if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
64315
+ return false;
64691
64316
  }
64692
- initEvent() {
64693
- super.initEvent();
64694
- if (this.sortDataByAxis) {
64695
- this.event.on(exports.ChartEvent.scaleDomainUpdate, {
64696
- filter: param => {
64697
- var _a;
64698
- return param.model.id ===
64699
- ((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
64317
+ return true;
64318
+ };
64319
+ const resolveTooltipFilterRange = (spec, scale) => {
64320
+ const range = spec.tooltipFilterRange;
64321
+ const rangeValue = typeof range === 'function' ? range({ scale }) : range;
64322
+ const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
64323
+ return rangeArr;
64324
+ };
64325
+ const getDimensionData = (value, axis, coordinate, getDimensionField) => {
64326
+ var _a;
64327
+ const scale = axis.getScale();
64328
+ const isDiscreteAxis = isDiscrete(scale.type);
64329
+ const data = [];
64330
+ const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
64331
+ for (const series of seriesList) {
64332
+ if (series.coordinate === coordinate) {
64333
+ const dimensionField = array(getDimensionField(series));
64334
+ const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
64335
+ if (dimensionField && viewData) {
64336
+ if (isDiscreteAxis) {
64337
+ const datums = [];
64338
+ const datumIdList = [];
64339
+ viewData.forEach((datum, i) => {
64340
+ var _a;
64341
+ if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
64342
+ datums.push(datum);
64343
+ datumIdList.push(i);
64344
+ }
64345
+ });
64346
+ data.push({
64347
+ series,
64348
+ datum: datums,
64349
+ key: getDimensionDataKey(series, datumIdList)
64350
+ });
64700
64351
  }
64701
- }, () => {
64702
- this._sortDataInAxisDomain();
64703
- });
64352
+ else {
64353
+ if (isValid$1(dimensionField[1])) {
64354
+ const datums = [];
64355
+ const datumIdList = [];
64356
+ viewData.forEach((datum, i) => {
64357
+ var _a;
64358
+ if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
64359
+ (isValid$1(datum[dimensionField[0]]) &&
64360
+ isValid$1(datum[dimensionField[1]]) &&
64361
+ value >= datum[dimensionField[0]] &&
64362
+ value < datum[dimensionField[1]])) {
64363
+ datums.push(datum);
64364
+ datumIdList.push(i);
64365
+ }
64366
+ });
64367
+ data.push({
64368
+ series,
64369
+ datum: datums,
64370
+ key: getDimensionDataKey(series, datumIdList)
64371
+ });
64372
+ }
64373
+ else {
64374
+ const spec = axis.getSpec();
64375
+ const rangeArr = resolveTooltipFilterRange(spec, scale);
64376
+ let datums = [];
64377
+ let datumIdList = [];
64378
+ if (rangeArr) {
64379
+ viewData.forEach((datum, i) => {
64380
+ if (isValid$1(datum[dimensionField[0]])) {
64381
+ const delta = datum[dimensionField[0]] - value;
64382
+ if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
64383
+ datums.push(datum);
64384
+ datumIdList.push(i);
64385
+ }
64386
+ }
64387
+ });
64388
+ }
64389
+ else {
64390
+ let minDelta = Infinity;
64391
+ let deltaSign = 0;
64392
+ viewData.forEach((datum, i) => {
64393
+ if (isValid$1(datum[dimensionField[0]])) {
64394
+ const delta = Math.abs(datum[dimensionField[0]] - value);
64395
+ const sign = Math.sign(datum[dimensionField[0]] - value);
64396
+ if (delta < minDelta) {
64397
+ minDelta = delta;
64398
+ datums = [datum];
64399
+ datumIdList = [i];
64400
+ deltaSign = sign;
64401
+ }
64402
+ else if (delta === minDelta && sign === deltaSign) {
64403
+ datums.push(datum);
64404
+ datumIdList.push(i);
64405
+ }
64406
+ }
64407
+ });
64408
+ }
64409
+ data.push({
64410
+ series,
64411
+ datum: datums,
64412
+ key: getDimensionDataKey(series, datumIdList)
64413
+ });
64414
+ }
64415
+ }
64416
+ }
64704
64417
  }
64705
64418
  }
64706
- _sortDataInAxisDomain() {
64707
- var _a, _b, _c;
64708
- if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
64709
- sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
64710
- (_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
64711
- }
64419
+ return data;
64420
+ };
64421
+ const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
64422
+ const getAxis = (chart, filter, pos) => {
64423
+ const axesComponents = chart
64424
+ .getAllComponents()
64425
+ .filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
64426
+ if (!axesComponents.length) {
64427
+ return null;
64712
64428
  }
64713
- getInvalidCheckFields() {
64714
- const fields = [];
64715
- if (this._xAxisHelper &&
64716
- this._xAxisHelper.isContinuous &&
64717
- this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64718
- const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
64719
- xFields.forEach(f => {
64720
- fields.push(f);
64721
- });
64722
- }
64723
- if (this._yAxisHelper &&
64724
- this._yAxisHelper.isContinuous &&
64725
- this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64726
- const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
64727
- yFields.forEach(f => {
64728
- fields.push(f);
64429
+ return axesComponents;
64430
+ };
64431
+
64432
+ class DimensionHoverEvent extends DimensionEvent {
64433
+ constructor() {
64434
+ super(...arguments);
64435
+ this._cacheDimensionInfo = null;
64436
+ this.onMouseMove = (params) => {
64437
+ if (!params) {
64438
+ return;
64439
+ }
64440
+ const x = params.event.viewX;
64441
+ const y = params.event.viewY;
64442
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64443
+ if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
64444
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
64445
+ this._cacheDimensionInfo = targetDimensionInfo;
64446
+ }
64447
+ else if (targetDimensionInfo !== null &&
64448
+ (this._cacheDimensionInfo === null ||
64449
+ targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
64450
+ targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
64451
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
64452
+ this._cacheDimensionInfo = targetDimensionInfo;
64453
+ }
64454
+ else if (targetDimensionInfo !== null) {
64455
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
64456
+ }
64457
+ };
64458
+ this.onMouseOut = (params) => {
64459
+ if (!params) {
64460
+ return;
64461
+ }
64462
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
64463
+ this._cacheDimensionInfo = null;
64464
+ };
64465
+ }
64466
+ register(eType, handler) {
64467
+ this._callback = handler.callback;
64468
+ this._eventDispatcher.register('pointermove', {
64469
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64470
+ callback: this.onMouseMove
64471
+ });
64472
+ this._eventDispatcher.register('pointerout', {
64473
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
64474
+ callback: this.onMouseOut
64475
+ });
64476
+ if (isMobileLikeMode(this._mode)) {
64477
+ this._eventDispatcher.register('pointerdown', {
64478
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64479
+ callback: this.onMouseMove
64729
64480
  });
64730
64481
  }
64731
- return fields;
64732
64482
  }
64733
- reInit(spec) {
64734
- if (this._positionXEncoder) {
64735
- this._positionXEncoder = null;
64736
- }
64737
- if (this._positionYEncoder) {
64738
- this._positionYEncoder = null;
64483
+ unregister() {
64484
+ this._eventDispatcher.unregister('pointermove', {
64485
+ query: null,
64486
+ callback: this.onMouseMove
64487
+ });
64488
+ if (isMobileLikeMode(this._mode)) {
64489
+ this._eventDispatcher.unregister('pointerdown', {
64490
+ query: null,
64491
+ callback: this.onMouseMove
64492
+ });
64739
64493
  }
64740
- super.reInit(spec);
64741
64494
  }
64742
64495
  }
64743
64496
 
64497
+ exports.DimensionEventEnum = void 0;
64498
+ (function (DimensionEventEnum) {
64499
+ DimensionEventEnum["dimensionHover"] = "dimensionHover";
64500
+ DimensionEventEnum["dimensionClick"] = "dimensionClick";
64501
+ })(exports.DimensionEventEnum || (exports.DimensionEventEnum = {}));
64502
+
64744
64503
  const lineLikeSeriesMark = {
64745
64504
  ["point"]: { name: "point", type: "symbol" },
64746
64505
  ["line"]: { name: "line", type: "line" }
@@ -71440,6 +71199,116 @@
71440
71199
  Factory.registerInteractionTrigger(DimensionHover.type, DimensionHover);
71441
71200
  };
71442
71201
 
71202
+ const registerDimensionEvents = () => {
71203
+ Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionHover, DimensionHoverEvent);
71204
+ Factory.registerComposedEvent(exports.DimensionEventEnum.dimensionClick, DimensionClickEvent);
71205
+ };
71206
+
71207
+ const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
71208
+ const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
71209
+ const continuousXAxisGetDimensionField = (series) => {
71210
+ var _a;
71211
+ return [
71212
+ series.fieldX[0],
71213
+ (_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
71214
+ ];
71215
+ };
71216
+ const continuousYAxisGetDimensionField = (series) => {
71217
+ var _a;
71218
+ return [
71219
+ series.fieldY[0],
71220
+ (_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
71221
+ ];
71222
+ };
71223
+ const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
71224
+ ? isDiscreteAxis
71225
+ ? discreteXAxisGetDimensionField
71226
+ : continuousXAxisGetDimensionField
71227
+ : isDiscreteAxis
71228
+ ? discreteYAxisGetDimensionField
71229
+ : continuousYAxisGetDimensionField;
71230
+ const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
71231
+ var _a, _b;
71232
+ if (!chart) {
71233
+ return null;
71234
+ }
71235
+ const { x, y } = pos;
71236
+ const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
71237
+ const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
71238
+ if (!xAxisList.length && !yAxisList.length) {
71239
+ return null;
71240
+ }
71241
+ const bandAxisSet = new Set();
71242
+ const linearAxisSet = new Set();
71243
+ const forceAxisSet = new Set();
71244
+ [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
71245
+ const isDiscreteAxis = isDiscrete(axis.getScale().type);
71246
+ if (isDiscreteAxis) {
71247
+ bandAxisSet.add(axis);
71248
+ }
71249
+ else {
71250
+ linearAxisSet.add(axis);
71251
+ }
71252
+ if (isTooltip && axis.getSpec().hasDimensionTooltip) {
71253
+ forceAxisSet.add(axis);
71254
+ }
71255
+ }));
71256
+ const targetAxisInfo = [];
71257
+ const addAxisDimensionInfo = (orient) => {
71258
+ const isXAxis = orient === 'x';
71259
+ const posValue = isXAxis ? x : y;
71260
+ const axisList = isXAxis ? xAxisList : yAxisList;
71261
+ axisList.forEach(axis => {
71262
+ if (forceAxisSet.size > 0) {
71263
+ if (forceAxisSet.has(axis)) {
71264
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
71265
+ info && targetAxisInfo.push(info);
71266
+ }
71267
+ }
71268
+ else {
71269
+ const hasDiscreteAxis = bandAxisSet.size > 0;
71270
+ if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
71271
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
71272
+ info && targetAxisInfo.push(info);
71273
+ }
71274
+ }
71275
+ });
71276
+ };
71277
+ if (chart.getSpec().direction === "horizontal") {
71278
+ addAxisDimensionInfo('y');
71279
+ if (targetAxisInfo.length === 0) {
71280
+ addAxisDimensionInfo('x');
71281
+ }
71282
+ }
71283
+ else {
71284
+ addAxisDimensionInfo('x');
71285
+ if (targetAxisInfo.length === 0) {
71286
+ addAxisDimensionInfo('y');
71287
+ }
71288
+ }
71289
+ if (!targetAxisInfo.length) {
71290
+ return null;
71291
+ }
71292
+ return targetAxisInfo;
71293
+ };
71294
+ const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
71295
+ const value = axis.positionToData(posValue, true);
71296
+ return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
71297
+ };
71298
+ const getDimensionInfoByValue = (axis, value, getDimensionField) => {
71299
+ const scale = axis.getScale();
71300
+ if (isNil$1(value)) {
71301
+ return null;
71302
+ }
71303
+ const domain = scale.domain();
71304
+ let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
71305
+ if (index < 0) {
71306
+ index = undefined;
71307
+ }
71308
+ const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
71309
+ return { index, value, position: scale.scale(value), axis, data };
71310
+ };
71311
+
71443
71312
  const layoutByValue$1 = (stateByField, series, layoutStartPoint, enableRemain = false) => {
71444
71313
  if (!layoutStartPoint) {
71445
71314
  layoutStartPoint = { x: 0, y: 0 };
@@ -71885,9 +71754,6 @@
71885
71754
  }
71886
71755
  shouldHandleTooltip(params, info) {
71887
71756
  var _a, _b;
71888
- if (!this.component.enable) {
71889
- return false;
71890
- }
71891
71757
  if (isNil$1(info)) {
71892
71758
  return false;
71893
71759
  }
@@ -93198,6 +93064,106 @@
93198
93064
  }
93199
93065
  }
93200
93066
 
93067
+ const angleStandardize = (angle, range) => {
93068
+ const unit = Math.PI * 2;
93069
+ const min = minInArray(range);
93070
+ const max = maxInArray(range);
93071
+ if (angle < min) {
93072
+ angle += Math.ceil((min - angle) / unit) * unit;
93073
+ }
93074
+ else if (angle > max) {
93075
+ angle -= Math.ceil((angle - max) / unit) * unit;
93076
+ }
93077
+ return angle;
93078
+ };
93079
+ const getPolarDimensionInfo = (chart, pos) => {
93080
+ if (!chart) {
93081
+ return null;
93082
+ }
93083
+ const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
93084
+ const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
93085
+ if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
93086
+ return null;
93087
+ }
93088
+ const targetAxisInfo = [];
93089
+ const getDimensionField = (series) => series.getDimensionField()[0];
93090
+ const { x, y } = pos;
93091
+ if (angleAxisList) {
93092
+ angleAxisList.forEach(axis => {
93093
+ var _a;
93094
+ const angleScale = axis.getScale();
93095
+ if (angleScale && isDiscrete(angleScale.type)) {
93096
+ const angleDomain = angleScale.domain();
93097
+ const angleRange = angleScale.range();
93098
+ const center = axis.getCenter();
93099
+ const vector = {
93100
+ x: x - axis.getLayoutStartPoint().x - center.x,
93101
+ y: y - axis.getLayoutStartPoint().y - center.y
93102
+ };
93103
+ let angle = vectorAngle({ x: 1, y: 0 }, vector);
93104
+ angle = angleStandardize(angle, angleRange);
93105
+ const radius = distance(vector);
93106
+ const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93107
+ const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93108
+ if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93109
+ (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93110
+ return;
93111
+ }
93112
+ const value = axis.invert(angle);
93113
+ if (isNil$1(value)) {
93114
+ return;
93115
+ }
93116
+ let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93117
+ if (index < 0) {
93118
+ index = undefined;
93119
+ }
93120
+ const data = getDimensionData(value, axis, 'polar', getDimensionField);
93121
+ targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
93122
+ }
93123
+ });
93124
+ }
93125
+ if (radiusAxisList) {
93126
+ radiusAxisList.forEach(axis => {
93127
+ var _a;
93128
+ const radiusScale = axis.getScale();
93129
+ const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93130
+ if (radiusScale && isDiscrete(radiusScale.type)) {
93131
+ const center = axis.getCenter();
93132
+ const vector = {
93133
+ x: x - axis.getLayoutStartPoint().x - center.x,
93134
+ y: y - axis.getLayoutStartPoint().y - center.y
93135
+ };
93136
+ let angle = vectorAngle({ x: 1, y: 0 }, vector);
93137
+ if (angle < -Math.PI / 2) {
93138
+ angle = Math.PI * 2 + angle;
93139
+ }
93140
+ const radius = distance(vector);
93141
+ const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93142
+ const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
93143
+ if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93144
+ (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93145
+ return;
93146
+ }
93147
+ const value = radiusScale.invert(radius);
93148
+ if (isNil$1(value)) {
93149
+ return;
93150
+ }
93151
+ const domain = radiusScale.domain();
93152
+ let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93153
+ if (index < 0) {
93154
+ index = undefined;
93155
+ }
93156
+ const data = getDimensionData(value, axis, 'polar', getDimensionField);
93157
+ targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
93158
+ }
93159
+ });
93160
+ }
93161
+ if (!targetAxisInfo.length) {
93162
+ return null;
93163
+ }
93164
+ return targetAxisInfo;
93165
+ };
93166
+
93201
93167
  class RoseChart extends BaseChart {
93202
93168
  constructor() {
93203
93169
  super(...arguments);
@@ -95699,15 +95665,11 @@
95699
95665
  });
95700
95666
  return originDatum;
95701
95667
  };
95702
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95703
95668
  const getMockEvent = (originPos) => {
95704
95669
  var _a, _b;
95705
95670
  const pos = bound(originPos);
95706
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95707
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95708
- const canvasPoint = { x: 0, y: 0 };
95709
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95710
- const { x: canvasX, y: canvasY } = canvasPoint;
95671
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95672
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95711
95673
  return {
95712
95674
  canvasX,
95713
95675
  canvasY,
@@ -96085,7 +96047,6 @@
96085
96047
  this.specKey = 'tooltip';
96086
96048
  this.layoutType = 'none';
96087
96049
  this._isReleased = false;
96088
- this.enable = true;
96089
96050
  this._alwaysShow = false;
96090
96051
  this._eventList = [];
96091
96052
  this._isTooltipShown = false;
@@ -103241,9 +103202,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103241
103202
  this._initMarkBrushState(componentIndex, '');
103242
103203
  brushComponent.children[0].removeAllChild();
103243
103204
  }
103244
- _shouldEnableInteractive() {
103245
- return this.getOption().getCompiler().getOption().interactive !== false;
103246
- }
103247
103205
  _createBrushComponent(region, componentIndex) {
103248
103206
  var _a, _b;
103249
103207
  const interactiveAttr = this._getBrushInteractiveAttr(region);
@@ -103254,45 +103212,33 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103254
103212
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103255
103213
  brush.addEventListener(IOperateType.brushActive, (e) => {
103256
103214
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103257
- this._emitEvent(exports.ChartEvent.brushActive, region, e);
103215
+ this._emitEvent(exports.ChartEvent.brushActive, region);
103258
103216
  });
103259
103217
  brush.addEventListener(IOperateType.drawStart, (e) => {
103260
- if (this._spec.disableDimensionHoverWhenBrushing) {
103261
- this._option.globalInstance.disableDimensionHoverEvent(true);
103262
- }
103263
103218
  this._setRegionMarkPickable(region, true);
103264
- this._emitEvent(exports.ChartEvent.brushStart, region, e);
103219
+ this._emitEvent(exports.ChartEvent.brushStart, region);
103265
103220
  });
103266
103221
  brush.addEventListener(IOperateType.moveStart, (e) => {
103267
- if (this._spec.disableDimensionHoverWhenBrushing) {
103268
- this._option.globalInstance.disableDimensionHoverEvent(true);
103269
- }
103270
103222
  this._setRegionMarkPickable(region, true);
103271
- this._emitEvent(exports.ChartEvent.brushStart, region, e);
103223
+ this._emitEvent(exports.ChartEvent.brushStart, region);
103272
103224
  });
103273
103225
  brush.addEventListener(IOperateType.drawing, (e) => {
103274
103226
  this._setRegionMarkPickable(region, false);
103275
103227
  this._handleBrushChange(region, e);
103276
- this._emitEvent(exports.ChartEvent.brushChange, region, e);
103228
+ this._emitEvent(exports.ChartEvent.brushChange, region);
103277
103229
  });
103278
103230
  brush.addEventListener(IOperateType.moving, (e) => {
103279
103231
  this._setRegionMarkPickable(region, false);
103280
103232
  this._handleBrushChange(region, e);
103281
- this._emitEvent(exports.ChartEvent.brushChange, region, e);
103233
+ this._emitEvent(exports.ChartEvent.brushChange, region);
103282
103234
  });
103283
103235
  brush.addEventListener(IOperateType.brushClear, (e) => {
103284
- if (this._spec.disableDimensionHoverWhenBrushing) {
103285
- this._option.globalInstance.disableDimensionHoverEvent(false);
103286
- }
103287
103236
  this._setRegionMarkPickable(region, true);
103288
103237
  this._initMarkBrushState(componentIndex, '');
103289
- this._emitEvent(exports.ChartEvent.brushClear, region, e);
103238
+ this._emitEvent(exports.ChartEvent.brushClear, region);
103290
103239
  });
103291
103240
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103292
103241
  var _a;
103293
- if (this._spec.disableDimensionHoverWhenBrushing) {
103294
- this._option.globalInstance.disableDimensionHoverEvent(false);
103295
- }
103296
103242
  this._setRegionMarkPickable(region, true);
103297
103243
  const { operateMask } = e.detail;
103298
103244
  const { updateElementsState = true } = this._spec;
@@ -103300,11 +103246,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103300
103246
  if (this._spec.onBrushEnd(e) === true) {
103301
103247
  this.clearGraphic();
103302
103248
  this._initMarkBrushState(componentIndex, '');
103303
- this._emitEvent(exports.ChartEvent.brushClear, region, e);
103249
+ this._emitEvent(exports.ChartEvent.brushClear, region);
103304
103250
  }
103305
103251
  else {
103306
103252
  this._spec.onBrushEnd(e);
103307
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103253
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103308
103254
  }
103309
103255
  }
103310
103256
  else {
@@ -103312,13 +103258,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103312
103258
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103313
103259
  this._setAxisAndDataZoom(operateMask, region);
103314
103260
  }
103315
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103261
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103316
103262
  }
103317
103263
  });
103318
103264
  brush.addEventListener(IOperateType.moveEnd, (e) => {
103319
- if (this._spec.disableDimensionHoverWhenBrushing) {
103320
- this._option.globalInstance.disableDimensionHoverEvent(false);
103321
- }
103322
103265
  this._setRegionMarkPickable(region, true);
103323
103266
  const { operateMask } = e.detail;
103324
103267
  const { updateElementsState = true } = this._spec;
@@ -103326,7 +103269,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103326
103269
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103327
103270
  this._setAxisAndDataZoom(operateMask, region);
103328
103271
  }
103329
- this._emitEvent(exports.ChartEvent.brushEnd, region, e);
103272
+ this._emitEvent(exports.ChartEvent.brushEnd, region);
103330
103273
  });
103331
103274
  }
103332
103275
  _getBrushInteractiveAttr(region) {
@@ -103344,8 +103287,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103344
103287
  maxX: seriesRegionEndX
103345
103288
  },
103346
103289
  xRange: [seriesRegionStartX, seriesRegionEndX],
103347
- yRange: [seriesRegionStartY, seriesRegionEndY],
103348
- interactive: this._shouldEnableInteractive()
103290
+ yRange: [seriesRegionStartY, seriesRegionEndY]
103349
103291
  };
103350
103292
  }
103351
103293
  _transformBrushedMarkAttr(brushedStyle) {
@@ -103366,7 +103308,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103366
103308
  }
103367
103309
  _handleBrushChange(region, e) {
103368
103310
  const { operateMask } = e.detail;
103369
- this._operateMask = operateMask;
103370
103311
  const { updateElementsState = true } = this._spec;
103371
103312
  if (updateElementsState) {
103372
103313
  this._reconfigItem(operateMask, region);
@@ -103391,7 +103332,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103391
103332
  }
103392
103333
  return data;
103393
103334
  }
103394
- _emitEvent(eventType, region, e) {
103335
+ _emitEvent(eventType, region) {
103395
103336
  var _a;
103396
103337
  this.event.emit(eventType, {
103397
103338
  model: this,
@@ -103408,8 +103349,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103408
103349
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103409
103350
  zoomRecord: this._zoomRecord
103410
103351
  },
103411
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103412
- event: e
103352
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103413
103353
  });
103414
103354
  }
103415
103355
  _reconfigItem(operateMask, region) {
@@ -103664,12 +103604,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
103664
103604
  this._brushComponents = null;
103665
103605
  }
103666
103606
  }
103667
- clearBrushStateAndMask() {
103668
- this._relativeRegions.forEach((region, componentIndex) => {
103669
- this._initMarkBrushState(componentIndex, '');
103670
- this._brushComponents[componentIndex].children[0].removeAllChild();
103671
- });
103672
- }
103673
103607
  }
103674
103608
  Brush.type = ComponentTypeEnum.brush;
103675
103609
  Brush.builtInTheme = {