@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.es.js CHANGED
@@ -51096,8 +51096,6 @@ loadBrushComponent();
51096
51096
  let Brush$1 = class Brush extends AbstractComponent {
51097
51097
  constructor(attributes, options) {
51098
51098
  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 => {
51099
- if (!1 === this.attribute.interactive) return;
51100
- if (!1 === this._beforeBrushEvent(e)) return;
51101
51099
  const {
51102
51100
  updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
51103
51101
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
@@ -51105,11 +51103,11 @@ let Brush$1 = class Brush extends AbstractComponent {
51105
51103
  } = this.attribute;
51106
51104
  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];
51107
51105
  }, this._onBrushing = e => {
51108
- !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))));
51106
+ 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)));
51109
51107
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
51110
- !1 !== this.attribute.interactive && (this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1);
51108
+ this._releaseBrushUpdateEvents(), e.preventDefault(), this._activeDrawState && this._drawEnd(e), this._activeMoveState && this._moveEnd(e), this._activeDrawState = !1, this._activeMoveState = !1;
51111
51109
  }, this._onBrushClear = e => {
51112
- !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);
51110
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1;
51113
51111
  };
51114
51112
  }
51115
51113
  _bindBrushEvents() {
@@ -51121,7 +51119,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51121
51119
  array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
51122
51120
  }
51123
51121
  _initDraw(e) {
51124
- if (!1 === this.attribute.interactive) return;
51125
51122
  const {
51126
51123
  brushMode: brushMode
51127
51124
  } = this.attribute,
@@ -51130,7 +51127,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51130
51127
  }
51131
51128
  _initMove(e) {
51132
51129
  var _a, _b;
51133
- if (!1 === this.attribute.interactive) return;
51134
51130
  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;
51135
51131
  const {
51136
51132
  interactiveRange: interactiveRange
@@ -51155,7 +51151,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51155
51151
  }
51156
51152
  _drawing(e) {
51157
51153
  var _a;
51158
- if (!1 === this.attribute.interactive) return;
51159
51154
  const pos = this.eventPosToStagePos(e),
51160
51155
  {
51161
51156
  brushType: brushType,
@@ -51180,7 +51175,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51180
51175
  (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)));
51181
51176
  }
51182
51177
  _moving(e) {
51183
- if (!1 === this.attribute.interactive) return;
51184
51178
  const startPos = this._cacheMovePoint,
51185
51179
  pos = this.eventPosToStagePos(e);
51186
51180
  if (pos.x === (null == startPos ? void 0 : startPos.x) && pos.y === (null == startPos ? void 0 : startPos.y)) return;
@@ -51194,7 +51188,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51194
51188
  }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
51195
51189
  }
51196
51190
  _drawEnd(e) {
51197
- if (!1 === this.attribute.interactive) return;
51198
51191
  const {
51199
51192
  removeOnClick = !0,
51200
51193
  sizeThreshold = DEFAULT_SIZE_THRESHOLD
@@ -51212,7 +51205,7 @@ let Brush$1 = class Brush extends AbstractComponent {
51212
51205
  }
51213
51206
  }
51214
51207
  _moveEnd(e) {
51215
- !1 !== this.attribute.interactive && (this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e));
51208
+ this._operatingMask && this._operatingMask.setAttribute("pickable", !1), this._dispatchBrushEvent(IOperateType.moveEnd, e);
51216
51209
  }
51217
51210
  render() {
51218
51211
  this._bindBrushEvents();
@@ -51319,10 +51312,6 @@ let Brush$1 = class Brush extends AbstractComponent {
51319
51312
  pos = this.eventPosToStagePos(e);
51320
51313
  return pos.x > maxX || pos.x < minX || pos.y > maxY || pos.y < minY;
51321
51314
  }
51322
- _beforeBrushEvent(e) {
51323
- var _a, _b;
51324
- return null === (_b = (_a = this.attribute).beforeBrushChange) || void 0 === _b ? void 0 : _b.call(_a, e);
51325
- }
51326
51315
  _dispatchBrushEvent(operateType, e) {
51327
51316
  this._dispatchEvent(operateType, {
51328
51317
  operateMask: this._operatingMask,
@@ -53868,7 +53857,7 @@ let Event$1 = class Event {
53868
53857
  if (ComposedEventCtor) {
53869
53858
  const composedEvent = new ComposedEventCtor(this._eventDispatcher, this._mode);
53870
53859
  composedEvent.register(eType, handler);
53871
- this._composedEventMap.set(handler.callback, {
53860
+ this._composedEventMap.set(callback, {
53872
53861
  eventType: eType,
53873
53862
  event: composedEvent
53874
53863
  });
@@ -54905,9 +54894,6 @@ class Compiler {
54905
54894
  getRootGroup() {
54906
54895
  return this._rootGroup;
54907
54896
  }
54908
- getOption() {
54909
- return this._option;
54910
- }
54911
54897
  constructor(container, option) {
54912
54898
  this._count = 0;
54913
54899
  this._rootMarks = [];
@@ -60280,609 +60266,6 @@ class VChartPluginService extends BasePluginService {
60280
60266
  }
60281
60267
  }
60282
60268
 
60283
- function getComponentThemeFromOption(type, getTheme) {
60284
- return getTheme('component', type);
60285
- }
60286
- function getFormatFunction(formatMethod, formatter, text, datum) {
60287
- if (formatMethod) {
60288
- return { formatFunc: formatMethod, args: [text, datum] };
60289
- }
60290
- const formatterImpl = Factory.getFormatter();
60291
- if (formatter && formatterImpl) {
60292
- return { formatFunc: formatterImpl, args: [text, datum, formatter] };
60293
- }
60294
- return {};
60295
- }
60296
- const getSpecInfo = (chartSpec, specKey, compType, filter) => {
60297
- if (isNil$1(chartSpec[specKey])) {
60298
- return undefined;
60299
- }
60300
- const isArraySpec = isArray$1(chartSpec[specKey]);
60301
- const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
60302
- const specInfos = [];
60303
- spec.forEach((s, i) => {
60304
- if (s && (!filter || filter(s))) {
60305
- specInfos.push({
60306
- spec: s,
60307
- specPath: isArraySpec ? [specKey, i] : [specKey],
60308
- specInfoPath: ['component', specKey, i],
60309
- type: compType
60310
- });
60311
- }
60312
- });
60313
- return specInfos;
60314
- };
60315
-
60316
- function isXAxis(orient) {
60317
- return orient === 'bottom' || orient === 'top';
60318
- }
60319
- function isYAxis(orient) {
60320
- return orient === 'left' || orient === 'right';
60321
- }
60322
- function isZAxis(orient) {
60323
- return orient === 'z';
60324
- }
60325
- function autoAxisType(orient, isHorizontal) {
60326
- if (isHorizontal) {
60327
- return isXAxis(orient) ? 'linear' : 'band';
60328
- }
60329
- return isXAxis(orient) ? 'band' : 'linear';
60330
- }
60331
- function getOrient(spec, whiteList) {
60332
- return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
60333
- }
60334
- function getDirectionByOrient(orient) {
60335
- return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
60336
- }
60337
- function transformInverse(spec, isHorizontal) {
60338
- let inverse = spec.inverse;
60339
- if (isHorizontal && !isXAxis(spec.orient)) {
60340
- inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
60341
- }
60342
- return inverse;
60343
- }
60344
- function getCartesianAxisInfo(spec, isHorizontal) {
60345
- var _a;
60346
- const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
60347
- const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
60348
- return { axisType, componentName };
60349
- }
60350
- const getCartesianAxisTheme = (orient, type, getTheme) => {
60351
- var _a;
60352
- const axisTypeTheme = (_a = (type === 'band'
60353
- ? getComponentThemeFromOption('axisBand', getTheme)
60354
- : ['linear', 'log', 'symlog'].includes(type)
60355
- ? getComponentThemeFromOption('axisLinear', getTheme)
60356
- : {})) !== null && _a !== void 0 ? _a : {};
60357
- const axisTheme = isXAxis(orient)
60358
- ? getComponentThemeFromOption('axisX', getTheme)
60359
- : isYAxis(orient)
60360
- ? getComponentThemeFromOption('axisY', getTheme)
60361
- : getComponentThemeFromOption('axisZ', getTheme);
60362
- return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
60363
- };
60364
-
60365
- class DimensionEvent {
60366
- constructor(eventDispatcher, mode) {
60367
- this._eventDispatcher = eventDispatcher;
60368
- this._mode = mode;
60369
- }
60370
- get chart() {
60371
- var _a, _b;
60372
- if (!this._chart) {
60373
- this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
60374
- }
60375
- return this._chart;
60376
- }
60377
- register(eType, handler) {
60378
- var _a, _b;
60379
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
60380
- }
60381
- unregister() {
60382
- var _a, _b;
60383
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
60384
- }
60385
- getTargetDimensionInfo(x, y) {
60386
- var _a, _b, _c;
60387
- 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 : [];
60388
- if (dimensionInfo.length === 0) {
60389
- return null;
60390
- }
60391
- return dimensionInfo;
60392
- }
60393
- dispatch(v, opt) {
60394
- var _a, _b;
60395
- const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
60396
- if (c.specKey !== 'axes') {
60397
- return false;
60398
- }
60399
- if (opt === null || opt === void 0 ? void 0 : opt.filter) {
60400
- return opt.filter(c);
60401
- }
60402
- return true;
60403
- });
60404
- const discreteAxes = axes.filter(axis => {
60405
- const scale = axis.getScale();
60406
- return isDiscrete(scale.type);
60407
- });
60408
- const dimAxes = discreteAxes.length
60409
- ? discreteAxes
60410
- : axes.filter(axis => {
60411
- const orient = axis.getOrient();
60412
- return isXAxis(orient) || orient === 'angle';
60413
- });
60414
- const dimensionInfo = [];
60415
- const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
60416
- if (getDimensionInfoByValue) {
60417
- dimAxes.forEach(a => {
60418
- const info = getDimensionInfoByValue(a, v);
60419
- if (info) {
60420
- dimensionInfo.push(info);
60421
- }
60422
- });
60423
- }
60424
- this._callback.call(null, {
60425
- action: 'enter',
60426
- dimensionInfo
60427
- });
60428
- return dimensionInfo;
60429
- }
60430
- }
60431
-
60432
- class DimensionClickEvent extends DimensionEvent {
60433
- constructor() {
60434
- super(...arguments);
60435
- this.onClick = (params) => {
60436
- if (!params) {
60437
- return;
60438
- }
60439
- const x = params.event.viewX;
60440
- const y = params.event.viewY;
60441
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
60442
- if (!targetDimensionInfo) {
60443
- return;
60444
- }
60445
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
60446
- };
60447
- }
60448
- register(eType, handler) {
60449
- this._callback = handler.callback;
60450
- this._eventDispatcher.register('pointertap', {
60451
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60452
- callback: this.onClick
60453
- });
60454
- }
60455
- unregister() {
60456
- this._eventDispatcher.unregister('pointertap', {
60457
- query: null,
60458
- callback: this.onClick
60459
- });
60460
- }
60461
- }
60462
-
60463
- const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
60464
- const isInRegionBound = (chart, axis, pos) => {
60465
- const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
60466
- return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
60467
- const rect = region.getLayoutRect();
60468
- const startPoint = region.getLayoutStartPoint();
60469
- return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
60470
- });
60471
- };
60472
- const isSameDimensionInfo = (a, b) => {
60473
- var _a, _b;
60474
- if (a === b) {
60475
- return true;
60476
- }
60477
- if (isNil$1(a) || isNil$1(b)) {
60478
- return false;
60479
- }
60480
- if (a.value !== b.value) {
60481
- return false;
60482
- }
60483
- if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
60484
- return false;
60485
- }
60486
- return true;
60487
- };
60488
- const resolveTooltipFilterRange = (spec, scale) => {
60489
- const range = spec.tooltipFilterRange;
60490
- const rangeValue = typeof range === 'function' ? range({ scale }) : range;
60491
- const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
60492
- return rangeArr;
60493
- };
60494
- const getDimensionData = (value, axis, coordinate, getDimensionField) => {
60495
- var _a;
60496
- const scale = axis.getScale();
60497
- const isDiscreteAxis = isDiscrete(scale.type);
60498
- const data = [];
60499
- const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
60500
- for (const series of seriesList) {
60501
- if (series.coordinate === coordinate) {
60502
- const dimensionField = array(getDimensionField(series));
60503
- const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
60504
- if (dimensionField && viewData) {
60505
- if (isDiscreteAxis) {
60506
- const datums = [];
60507
- const datumIdList = [];
60508
- viewData.forEach((datum, i) => {
60509
- var _a;
60510
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
60511
- datums.push(datum);
60512
- datumIdList.push(i);
60513
- }
60514
- });
60515
- data.push({
60516
- series,
60517
- datum: datums,
60518
- key: getDimensionDataKey(series, datumIdList)
60519
- });
60520
- }
60521
- else {
60522
- if (isValid$1(dimensionField[1])) {
60523
- const datums = [];
60524
- const datumIdList = [];
60525
- viewData.forEach((datum, i) => {
60526
- var _a;
60527
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
60528
- (isValid$1(datum[dimensionField[0]]) &&
60529
- isValid$1(datum[dimensionField[1]]) &&
60530
- value >= datum[dimensionField[0]] &&
60531
- value < datum[dimensionField[1]])) {
60532
- datums.push(datum);
60533
- datumIdList.push(i);
60534
- }
60535
- });
60536
- data.push({
60537
- series,
60538
- datum: datums,
60539
- key: getDimensionDataKey(series, datumIdList)
60540
- });
60541
- }
60542
- else {
60543
- const spec = axis.getSpec();
60544
- const rangeArr = resolveTooltipFilterRange(spec, scale);
60545
- let datums = [];
60546
- let datumIdList = [];
60547
- if (rangeArr) {
60548
- viewData.forEach((datum, i) => {
60549
- if (isValid$1(datum[dimensionField[0]])) {
60550
- const delta = datum[dimensionField[0]] - value;
60551
- if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
60552
- datums.push(datum);
60553
- datumIdList.push(i);
60554
- }
60555
- }
60556
- });
60557
- }
60558
- else {
60559
- let minDelta = Infinity;
60560
- let deltaSign = 0;
60561
- viewData.forEach((datum, i) => {
60562
- if (isValid$1(datum[dimensionField[0]])) {
60563
- const delta = Math.abs(datum[dimensionField[0]] - value);
60564
- const sign = Math.sign(datum[dimensionField[0]] - value);
60565
- if (delta < minDelta) {
60566
- minDelta = delta;
60567
- datums = [datum];
60568
- datumIdList = [i];
60569
- deltaSign = sign;
60570
- }
60571
- else if (delta === minDelta && sign === deltaSign) {
60572
- datums.push(datum);
60573
- datumIdList.push(i);
60574
- }
60575
- }
60576
- });
60577
- }
60578
- data.push({
60579
- series,
60580
- datum: datums,
60581
- key: getDimensionDataKey(series, datumIdList)
60582
- });
60583
- }
60584
- }
60585
- }
60586
- }
60587
- }
60588
- return data;
60589
- };
60590
- const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
60591
- const getAxis = (chart, filter, pos) => {
60592
- const axesComponents = chart
60593
- .getAllComponents()
60594
- .filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
60595
- if (!axesComponents.length) {
60596
- return null;
60597
- }
60598
- return axesComponents;
60599
- };
60600
-
60601
- class DimensionHoverEvent extends DimensionEvent {
60602
- constructor() {
60603
- super(...arguments);
60604
- this._cacheDimensionInfo = null;
60605
- this.onMouseMove = (params) => {
60606
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
60607
- return;
60608
- }
60609
- const x = params.event.viewX;
60610
- const y = params.event.viewY;
60611
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
60612
- if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
60613
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
60614
- this._cacheDimensionInfo = targetDimensionInfo;
60615
- }
60616
- else if (targetDimensionInfo !== null &&
60617
- (this._cacheDimensionInfo === null ||
60618
- targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
60619
- targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
60620
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
60621
- this._cacheDimensionInfo = targetDimensionInfo;
60622
- }
60623
- else if (targetDimensionInfo !== null) {
60624
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
60625
- }
60626
- };
60627
- this.onMouseOut = (params) => {
60628
- if (!params || DimensionHoverEvent._disableDimensionEvent) {
60629
- return;
60630
- }
60631
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
60632
- this._cacheDimensionInfo = null;
60633
- };
60634
- }
60635
- static disableDimensionEvent(value) {
60636
- this._disableDimensionEvent = value;
60637
- }
60638
- register(eType, handler) {
60639
- this._callback = handler.callback;
60640
- this._eventDispatcher.register('pointermove', {
60641
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60642
- callback: this.onMouseMove
60643
- });
60644
- this._eventDispatcher.register('pointerout', {
60645
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
60646
- callback: this.onMouseOut
60647
- });
60648
- if (isMobileLikeMode(this._mode)) {
60649
- this._eventDispatcher.register('pointerdown', {
60650
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
60651
- callback: this.onMouseMove
60652
- });
60653
- }
60654
- }
60655
- unregister() {
60656
- this._eventDispatcher.unregister('pointermove', {
60657
- query: null,
60658
- callback: this.onMouseMove
60659
- });
60660
- if (isMobileLikeMode(this._mode)) {
60661
- this._eventDispatcher.unregister('pointerdown', {
60662
- query: null,
60663
- callback: this.onMouseMove
60664
- });
60665
- }
60666
- }
60667
- }
60668
- DimensionHoverEvent._disableDimensionEvent = false;
60669
-
60670
- var DimensionEventEnum;
60671
- (function (DimensionEventEnum) {
60672
- DimensionEventEnum["dimensionHover"] = "dimensionHover";
60673
- DimensionEventEnum["dimensionClick"] = "dimensionClick";
60674
- })(DimensionEventEnum || (DimensionEventEnum = {}));
60675
-
60676
- const registerDimensionEvents = () => {
60677
- Factory.registerComposedEvent(DimensionEventEnum.dimensionHover, DimensionHoverEvent);
60678
- Factory.registerComposedEvent(DimensionEventEnum.dimensionClick, DimensionClickEvent);
60679
- };
60680
-
60681
- const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
60682
- const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
60683
- const continuousXAxisGetDimensionField = (series) => {
60684
- var _a;
60685
- return [
60686
- series.fieldX[0],
60687
- (_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
60688
- ];
60689
- };
60690
- const continuousYAxisGetDimensionField = (series) => {
60691
- var _a;
60692
- return [
60693
- series.fieldY[0],
60694
- (_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
60695
- ];
60696
- };
60697
- const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
60698
- ? isDiscreteAxis
60699
- ? discreteXAxisGetDimensionField
60700
- : continuousXAxisGetDimensionField
60701
- : isDiscreteAxis
60702
- ? discreteYAxisGetDimensionField
60703
- : continuousYAxisGetDimensionField;
60704
- const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
60705
- var _a, _b;
60706
- if (!chart) {
60707
- return null;
60708
- }
60709
- const { x, y } = pos;
60710
- const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
60711
- const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
60712
- if (!xAxisList.length && !yAxisList.length) {
60713
- return null;
60714
- }
60715
- const bandAxisSet = new Set();
60716
- const linearAxisSet = new Set();
60717
- const forceAxisSet = new Set();
60718
- [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
60719
- const isDiscreteAxis = isDiscrete(axis.getScale().type);
60720
- if (isDiscreteAxis) {
60721
- bandAxisSet.add(axis);
60722
- }
60723
- else {
60724
- linearAxisSet.add(axis);
60725
- }
60726
- if (isTooltip && axis.getSpec().hasDimensionTooltip) {
60727
- forceAxisSet.add(axis);
60728
- }
60729
- }));
60730
- const targetAxisInfo = [];
60731
- const addAxisDimensionInfo = (orient) => {
60732
- const isXAxis = orient === 'x';
60733
- const posValue = isXAxis ? x : y;
60734
- const axisList = isXAxis ? xAxisList : yAxisList;
60735
- axisList.forEach(axis => {
60736
- if (forceAxisSet.size > 0) {
60737
- if (forceAxisSet.has(axis)) {
60738
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
60739
- info && targetAxisInfo.push(info);
60740
- }
60741
- }
60742
- else {
60743
- const hasDiscreteAxis = bandAxisSet.size > 0;
60744
- if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
60745
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
60746
- info && targetAxisInfo.push(info);
60747
- }
60748
- }
60749
- });
60750
- };
60751
- if (chart.getSpec().direction === "horizontal") {
60752
- addAxisDimensionInfo('y');
60753
- if (targetAxisInfo.length === 0) {
60754
- addAxisDimensionInfo('x');
60755
- }
60756
- }
60757
- else {
60758
- addAxisDimensionInfo('x');
60759
- if (targetAxisInfo.length === 0) {
60760
- addAxisDimensionInfo('y');
60761
- }
60762
- }
60763
- if (!targetAxisInfo.length) {
60764
- return null;
60765
- }
60766
- return targetAxisInfo;
60767
- };
60768
- const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
60769
- const value = axis.positionToData(posValue, true);
60770
- return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
60771
- };
60772
- const getDimensionInfoByValue = (axis, value, getDimensionField) => {
60773
- const scale = axis.getScale();
60774
- if (isNil$1(value)) {
60775
- return null;
60776
- }
60777
- const domain = scale.domain();
60778
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60779
- if (index < 0) {
60780
- index = undefined;
60781
- }
60782
- const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
60783
- return { index, value, position: scale.scale(value), axis, data };
60784
- };
60785
-
60786
- const angleStandardize = (angle, range) => {
60787
- const unit = Math.PI * 2;
60788
- const min = minInArray(range);
60789
- const max = maxInArray(range);
60790
- if (angle < min) {
60791
- angle += Math.ceil((min - angle) / unit) * unit;
60792
- }
60793
- else if (angle > max) {
60794
- angle -= Math.ceil((angle - max) / unit) * unit;
60795
- }
60796
- return angle;
60797
- };
60798
- const getPolarDimensionInfo = (chart, pos) => {
60799
- if (!chart) {
60800
- return null;
60801
- }
60802
- const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
60803
- const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
60804
- if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
60805
- return null;
60806
- }
60807
- const targetAxisInfo = [];
60808
- const getDimensionField = (series) => series.getDimensionField()[0];
60809
- const { x, y } = pos;
60810
- if (angleAxisList) {
60811
- angleAxisList.forEach(axis => {
60812
- var _a;
60813
- const angleScale = axis.getScale();
60814
- if (angleScale && isDiscrete(angleScale.type)) {
60815
- const angleDomain = angleScale.domain();
60816
- const angleRange = angleScale.range();
60817
- const center = axis.getCenter();
60818
- const vector = {
60819
- x: x - axis.getLayoutStartPoint().x - center.x,
60820
- y: y - axis.getLayoutStartPoint().y - center.y
60821
- };
60822
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
60823
- angle = angleStandardize(angle, angleRange);
60824
- const radius = distance(vector);
60825
- const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
60826
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
60827
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
60828
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
60829
- return;
60830
- }
60831
- const value = axis.invert(angle);
60832
- if (isNil$1(value)) {
60833
- return;
60834
- }
60835
- let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60836
- if (index < 0) {
60837
- index = undefined;
60838
- }
60839
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
60840
- targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
60841
- }
60842
- });
60843
- }
60844
- if (radiusAxisList) {
60845
- radiusAxisList.forEach(axis => {
60846
- var _a;
60847
- const radiusScale = axis.getScale();
60848
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
60849
- if (radiusScale && isDiscrete(radiusScale.type)) {
60850
- const center = axis.getCenter();
60851
- const vector = {
60852
- x: x - axis.getLayoutStartPoint().x - center.x,
60853
- y: y - axis.getLayoutStartPoint().y - center.y
60854
- };
60855
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
60856
- if (angle < -Math.PI / 2) {
60857
- angle = Math.PI * 2 + angle;
60858
- }
60859
- const radius = distance(vector);
60860
- const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
60861
- const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
60862
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
60863
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
60864
- return;
60865
- }
60866
- const value = radiusScale.invert(radius);
60867
- if (isNil$1(value)) {
60868
- return;
60869
- }
60870
- const domain = radiusScale.domain();
60871
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
60872
- if (index < 0) {
60873
- index = undefined;
60874
- }
60875
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
60876
- targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
60877
- }
60878
- });
60879
- }
60880
- if (!targetAxisInfo.length) {
60881
- return null;
60882
- }
60883
- return targetAxisInfo;
60884
- };
60885
-
60886
60269
  class VChart {
60887
60270
  static useRegisters(comps) {
60888
60271
  comps.forEach((fn) => {
@@ -61131,7 +60514,7 @@ class VChart {
61131
60514
  this._compiler.updateLayoutTag();
61132
60515
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
61133
60516
  this._initDataSet(this._option.dataSet);
61134
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
60517
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
61135
60518
  this._bindResizeEvent();
61136
60519
  this._bindViewEvent();
61137
60520
  this._initChartPlugin();
@@ -61784,7 +61167,7 @@ class VChart {
61784
61167
  resize = true;
61785
61168
  }
61786
61169
  const lasAutoSize = this._autoSize;
61787
- 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;
61170
+ 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;
61788
61171
  if (this._autoSize !== lasAutoSize) {
61789
61172
  resize = true;
61790
61173
  }
@@ -62025,19 +61408,6 @@ class VChart {
62025
61408
  var _a;
62026
61409
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
62027
61410
  }
62028
- disableDimensionHoverEvent(value = true) {
62029
- DimensionHoverEvent.disableDimensionEvent(value);
62030
- }
62031
- disableCrossHair(value = true) {
62032
- this.getChart()
62033
- .getComponentsByKey('crosshair')
62034
- .forEach(crosshair => (crosshair.enable = !value));
62035
- }
62036
- disableTooltip(value = true) {
62037
- this.getChart()
62038
- .getComponentsByKey('tooltip')
62039
- .forEach(tooltip => (tooltip.enable = !value));
62040
- }
62041
61411
  showCrosshair(cb) {
62042
61412
  var _a;
62043
61413
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
@@ -62280,6 +61650,39 @@ var Direction;
62280
61650
  Direction["horizontal"] = "horizontal";
62281
61651
  })(Direction || (Direction = {}));
62282
61652
 
61653
+ function getComponentThemeFromOption(type, getTheme) {
61654
+ return getTheme('component', type);
61655
+ }
61656
+ function getFormatFunction(formatMethod, formatter, text, datum) {
61657
+ if (formatMethod) {
61658
+ return { formatFunc: formatMethod, args: [text, datum] };
61659
+ }
61660
+ const formatterImpl = Factory.getFormatter();
61661
+ if (formatter && formatterImpl) {
61662
+ return { formatFunc: formatterImpl, args: [text, datum, formatter] };
61663
+ }
61664
+ return {};
61665
+ }
61666
+ const getSpecInfo = (chartSpec, specKey, compType, filter) => {
61667
+ if (isNil$1(chartSpec[specKey])) {
61668
+ return undefined;
61669
+ }
61670
+ const isArraySpec = isArray$1(chartSpec[specKey]);
61671
+ const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
61672
+ const specInfos = [];
61673
+ spec.forEach((s, i) => {
61674
+ if (s && (!filter || filter(s))) {
61675
+ specInfos.push({
61676
+ spec: s,
61677
+ specPath: isArraySpec ? [specKey, i] : [specKey],
61678
+ specInfoPath: ['component', specKey, i],
61679
+ type: compType
61680
+ });
61681
+ }
61682
+ });
61683
+ return specInfos;
61684
+ };
61685
+
62283
61686
  const lookup = (data, opt) => {
62284
61687
  if (!opt.from || !opt.from()) {
62285
61688
  return data;
@@ -64645,96 +64048,452 @@ class CartesianSeries extends BaseSeries {
64645
64048
  }
64646
64049
  return this._scaleY.invert(yPos);
64647
64050
  }
64648
- getRegionRectLeft() {
64649
- if (!this._xAxisHelper) {
64650
- return Number.NaN;
64651
- }
64652
- const { getScale } = this._xAxisHelper;
64653
- return getScale(0).range()[0];
64051
+ getRegionRectLeft() {
64052
+ if (!this._xAxisHelper) {
64053
+ return Number.NaN;
64054
+ }
64055
+ const { getScale } = this._xAxisHelper;
64056
+ return getScale(0).range()[0];
64057
+ }
64058
+ getRegionRectRight() {
64059
+ if (!this._xAxisHelper) {
64060
+ return Number.NaN;
64061
+ }
64062
+ const { getScale } = this._xAxisHelper;
64063
+ return getScale(0).range()[1];
64064
+ }
64065
+ afterInitMark() {
64066
+ super.afterInitMark();
64067
+ this.setFieldX(this._fieldX);
64068
+ this.setFieldY(this._fieldY);
64069
+ this._buildScaleConfig();
64070
+ }
64071
+ getDimensionField() {
64072
+ if (this._direction === "horizontal") {
64073
+ return this._specYField;
64074
+ }
64075
+ return this._specXField;
64076
+ }
64077
+ getDimensionContinuousField() {
64078
+ if (this._direction === "horizontal") {
64079
+ return [this.fieldY[0], this.fieldY2];
64080
+ }
64081
+ return [this.fieldX[0], this.fieldX2];
64082
+ }
64083
+ getMeasureField() {
64084
+ if (this._direction === "horizontal") {
64085
+ return this._specXField;
64086
+ }
64087
+ return this._specYField;
64088
+ }
64089
+ initEvent() {
64090
+ super.initEvent();
64091
+ if (this.sortDataByAxis) {
64092
+ this.event.on(ChartEvent.scaleDomainUpdate, {
64093
+ filter: param => {
64094
+ var _a;
64095
+ return param.model.id ===
64096
+ ((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
64097
+ }
64098
+ }, () => {
64099
+ this._sortDataInAxisDomain();
64100
+ });
64101
+ }
64102
+ }
64103
+ _sortDataInAxisDomain() {
64104
+ var _a, _b, _c;
64105
+ if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
64106
+ sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
64107
+ (_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
64108
+ }
64109
+ }
64110
+ getInvalidCheckFields() {
64111
+ const fields = [];
64112
+ if (this._xAxisHelper &&
64113
+ this._xAxisHelper.isContinuous &&
64114
+ this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64115
+ const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
64116
+ xFields.forEach(f => {
64117
+ fields.push(f);
64118
+ });
64119
+ }
64120
+ if (this._yAxisHelper &&
64121
+ this._yAxisHelper.isContinuous &&
64122
+ this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64123
+ const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
64124
+ yFields.forEach(f => {
64125
+ fields.push(f);
64126
+ });
64127
+ }
64128
+ return fields;
64129
+ }
64130
+ reInit(spec) {
64131
+ if (this._positionXEncoder) {
64132
+ this._positionXEncoder = null;
64133
+ }
64134
+ if (this._positionYEncoder) {
64135
+ this._positionYEncoder = null;
64136
+ }
64137
+ super.reInit(spec);
64138
+ }
64139
+ }
64140
+
64141
+ function isXAxis(orient) {
64142
+ return orient === 'bottom' || orient === 'top';
64143
+ }
64144
+ function isYAxis(orient) {
64145
+ return orient === 'left' || orient === 'right';
64146
+ }
64147
+ function isZAxis(orient) {
64148
+ return orient === 'z';
64149
+ }
64150
+ function autoAxisType(orient, isHorizontal) {
64151
+ if (isHorizontal) {
64152
+ return isXAxis(orient) ? 'linear' : 'band';
64153
+ }
64154
+ return isXAxis(orient) ? 'band' : 'linear';
64155
+ }
64156
+ function getOrient(spec, whiteList) {
64157
+ return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
64158
+ }
64159
+ function getDirectionByOrient(orient) {
64160
+ return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
64161
+ }
64162
+ function transformInverse(spec, isHorizontal) {
64163
+ let inverse = spec.inverse;
64164
+ if (isHorizontal && !isXAxis(spec.orient)) {
64165
+ inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
64166
+ }
64167
+ return inverse;
64168
+ }
64169
+ function getCartesianAxisInfo(spec, isHorizontal) {
64170
+ var _a;
64171
+ const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
64172
+ const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
64173
+ return { axisType, componentName };
64174
+ }
64175
+ const getCartesianAxisTheme = (orient, type, getTheme) => {
64176
+ var _a;
64177
+ const axisTypeTheme = (_a = (type === 'band'
64178
+ ? getComponentThemeFromOption('axisBand', getTheme)
64179
+ : ['linear', 'log', 'symlog'].includes(type)
64180
+ ? getComponentThemeFromOption('axisLinear', getTheme)
64181
+ : {})) !== null && _a !== void 0 ? _a : {};
64182
+ const axisTheme = isXAxis(orient)
64183
+ ? getComponentThemeFromOption('axisX', getTheme)
64184
+ : isYAxis(orient)
64185
+ ? getComponentThemeFromOption('axisY', getTheme)
64186
+ : getComponentThemeFromOption('axisZ', getTheme);
64187
+ return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
64188
+ };
64189
+
64190
+ class DimensionEvent {
64191
+ constructor(eventDispatcher, mode) {
64192
+ this._eventDispatcher = eventDispatcher;
64193
+ this._mode = mode;
64194
+ }
64195
+ get chart() {
64196
+ var _a, _b;
64197
+ if (!this._chart) {
64198
+ this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
64199
+ }
64200
+ return this._chart;
64201
+ }
64202
+ register(eType, handler) {
64203
+ var _a, _b;
64204
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64205
+ }
64206
+ unregister() {
64207
+ var _a, _b;
64208
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64209
+ }
64210
+ getTargetDimensionInfo(x, y) {
64211
+ var _a, _b, _c;
64212
+ 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 : [];
64213
+ if (dimensionInfo.length === 0) {
64214
+ return null;
64215
+ }
64216
+ return dimensionInfo;
64217
+ }
64218
+ dispatch(v, opt) {
64219
+ var _a, _b;
64220
+ const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
64221
+ if (c.specKey !== 'axes') {
64222
+ return false;
64223
+ }
64224
+ if (opt === null || opt === void 0 ? void 0 : opt.filter) {
64225
+ return opt.filter(c);
64226
+ }
64227
+ return true;
64228
+ });
64229
+ const discreteAxes = axes.filter(axis => {
64230
+ const scale = axis.getScale();
64231
+ return isDiscrete(scale.type);
64232
+ });
64233
+ const dimAxes = discreteAxes.length
64234
+ ? discreteAxes
64235
+ : axes.filter(axis => {
64236
+ const orient = axis.getOrient();
64237
+ return isXAxis(orient) || orient === 'angle';
64238
+ });
64239
+ const dimensionInfo = [];
64240
+ const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
64241
+ if (getDimensionInfoByValue) {
64242
+ dimAxes.forEach(a => {
64243
+ const info = getDimensionInfoByValue(a, v);
64244
+ if (info) {
64245
+ dimensionInfo.push(info);
64246
+ }
64247
+ });
64248
+ }
64249
+ this._callback.call(null, {
64250
+ action: 'enter',
64251
+ dimensionInfo
64252
+ });
64253
+ return dimensionInfo;
64254
+ }
64255
+ }
64256
+
64257
+ class DimensionClickEvent extends DimensionEvent {
64258
+ constructor() {
64259
+ super(...arguments);
64260
+ this.onClick = (params) => {
64261
+ if (!params) {
64262
+ return;
64263
+ }
64264
+ const x = params.event.viewX;
64265
+ const y = params.event.viewY;
64266
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64267
+ if (!targetDimensionInfo) {
64268
+ return;
64269
+ }
64270
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
64271
+ };
64272
+ }
64273
+ register(eType, handler) {
64274
+ this._callback = handler.callback;
64275
+ this._eventDispatcher.register('pointertap', {
64276
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64277
+ callback: this.onClick
64278
+ });
64654
64279
  }
64655
- getRegionRectRight() {
64656
- if (!this._xAxisHelper) {
64657
- return Number.NaN;
64658
- }
64659
- const { getScale } = this._xAxisHelper;
64660
- return getScale(0).range()[1];
64280
+ unregister() {
64281
+ this._eventDispatcher.unregister('pointertap', {
64282
+ query: null,
64283
+ callback: this.onClick
64284
+ });
64661
64285
  }
64662
- afterInitMark() {
64663
- super.afterInitMark();
64664
- this.setFieldX(this._fieldX);
64665
- this.setFieldY(this._fieldY);
64666
- this._buildScaleConfig();
64286
+ }
64287
+
64288
+ const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
64289
+ const isInRegionBound = (chart, axis, pos) => {
64290
+ const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
64291
+ return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
64292
+ const rect = region.getLayoutRect();
64293
+ const startPoint = region.getLayoutStartPoint();
64294
+ return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
64295
+ });
64296
+ };
64297
+ const isSameDimensionInfo = (a, b) => {
64298
+ var _a, _b;
64299
+ if (a === b) {
64300
+ return true;
64667
64301
  }
64668
- getDimensionField() {
64669
- if (this._direction === "horizontal") {
64670
- return this._specYField;
64671
- }
64672
- return this._specXField;
64302
+ if (isNil$1(a) || isNil$1(b)) {
64303
+ return false;
64673
64304
  }
64674
- getDimensionContinuousField() {
64675
- if (this._direction === "horizontal") {
64676
- return [this.fieldY[0], this.fieldY2];
64677
- }
64678
- return [this.fieldX[0], this.fieldX2];
64305
+ if (a.value !== b.value) {
64306
+ return false;
64679
64307
  }
64680
- getMeasureField() {
64681
- if (this._direction === "horizontal") {
64682
- return this._specXField;
64683
- }
64684
- return this._specYField;
64308
+ if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
64309
+ return false;
64685
64310
  }
64686
- initEvent() {
64687
- super.initEvent();
64688
- if (this.sortDataByAxis) {
64689
- this.event.on(ChartEvent.scaleDomainUpdate, {
64690
- filter: param => {
64691
- var _a;
64692
- return param.model.id ===
64693
- ((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
64311
+ return true;
64312
+ };
64313
+ const resolveTooltipFilterRange = (spec, scale) => {
64314
+ const range = spec.tooltipFilterRange;
64315
+ const rangeValue = typeof range === 'function' ? range({ scale }) : range;
64316
+ const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
64317
+ return rangeArr;
64318
+ };
64319
+ const getDimensionData = (value, axis, coordinate, getDimensionField) => {
64320
+ var _a;
64321
+ const scale = axis.getScale();
64322
+ const isDiscreteAxis = isDiscrete(scale.type);
64323
+ const data = [];
64324
+ const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
64325
+ for (const series of seriesList) {
64326
+ if (series.coordinate === coordinate) {
64327
+ const dimensionField = array(getDimensionField(series));
64328
+ const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
64329
+ if (dimensionField && viewData) {
64330
+ if (isDiscreteAxis) {
64331
+ const datums = [];
64332
+ const datumIdList = [];
64333
+ viewData.forEach((datum, i) => {
64334
+ var _a;
64335
+ if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
64336
+ datums.push(datum);
64337
+ datumIdList.push(i);
64338
+ }
64339
+ });
64340
+ data.push({
64341
+ series,
64342
+ datum: datums,
64343
+ key: getDimensionDataKey(series, datumIdList)
64344
+ });
64694
64345
  }
64695
- }, () => {
64696
- this._sortDataInAxisDomain();
64697
- });
64346
+ else {
64347
+ if (isValid$1(dimensionField[1])) {
64348
+ const datums = [];
64349
+ const datumIdList = [];
64350
+ viewData.forEach((datum, i) => {
64351
+ var _a;
64352
+ if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
64353
+ (isValid$1(datum[dimensionField[0]]) &&
64354
+ isValid$1(datum[dimensionField[1]]) &&
64355
+ value >= datum[dimensionField[0]] &&
64356
+ value < datum[dimensionField[1]])) {
64357
+ datums.push(datum);
64358
+ datumIdList.push(i);
64359
+ }
64360
+ });
64361
+ data.push({
64362
+ series,
64363
+ datum: datums,
64364
+ key: getDimensionDataKey(series, datumIdList)
64365
+ });
64366
+ }
64367
+ else {
64368
+ const spec = axis.getSpec();
64369
+ const rangeArr = resolveTooltipFilterRange(spec, scale);
64370
+ let datums = [];
64371
+ let datumIdList = [];
64372
+ if (rangeArr) {
64373
+ viewData.forEach((datum, i) => {
64374
+ if (isValid$1(datum[dimensionField[0]])) {
64375
+ const delta = datum[dimensionField[0]] - value;
64376
+ if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
64377
+ datums.push(datum);
64378
+ datumIdList.push(i);
64379
+ }
64380
+ }
64381
+ });
64382
+ }
64383
+ else {
64384
+ let minDelta = Infinity;
64385
+ let deltaSign = 0;
64386
+ viewData.forEach((datum, i) => {
64387
+ if (isValid$1(datum[dimensionField[0]])) {
64388
+ const delta = Math.abs(datum[dimensionField[0]] - value);
64389
+ const sign = Math.sign(datum[dimensionField[0]] - value);
64390
+ if (delta < minDelta) {
64391
+ minDelta = delta;
64392
+ datums = [datum];
64393
+ datumIdList = [i];
64394
+ deltaSign = sign;
64395
+ }
64396
+ else if (delta === minDelta && sign === deltaSign) {
64397
+ datums.push(datum);
64398
+ datumIdList.push(i);
64399
+ }
64400
+ }
64401
+ });
64402
+ }
64403
+ data.push({
64404
+ series,
64405
+ datum: datums,
64406
+ key: getDimensionDataKey(series, datumIdList)
64407
+ });
64408
+ }
64409
+ }
64410
+ }
64698
64411
  }
64699
64412
  }
64700
- _sortDataInAxisDomain() {
64701
- var _a, _b, _c;
64702
- if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
64703
- sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
64704
- (_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
64705
- }
64413
+ return data;
64414
+ };
64415
+ const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
64416
+ const getAxis = (chart, filter, pos) => {
64417
+ const axesComponents = chart
64418
+ .getAllComponents()
64419
+ .filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
64420
+ if (!axesComponents.length) {
64421
+ return null;
64706
64422
  }
64707
- getInvalidCheckFields() {
64708
- const fields = [];
64709
- if (this._xAxisHelper &&
64710
- this._xAxisHelper.isContinuous &&
64711
- this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64712
- const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
64713
- xFields.forEach(f => {
64714
- fields.push(f);
64715
- });
64716
- }
64717
- if (this._yAxisHelper &&
64718
- this._yAxisHelper.isContinuous &&
64719
- this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64720
- const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
64721
- yFields.forEach(f => {
64722
- fields.push(f);
64423
+ return axesComponents;
64424
+ };
64425
+
64426
+ class DimensionHoverEvent extends DimensionEvent {
64427
+ constructor() {
64428
+ super(...arguments);
64429
+ this._cacheDimensionInfo = null;
64430
+ this.onMouseMove = (params) => {
64431
+ if (!params) {
64432
+ return;
64433
+ }
64434
+ const x = params.event.viewX;
64435
+ const y = params.event.viewY;
64436
+ const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64437
+ if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
64438
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
64439
+ this._cacheDimensionInfo = targetDimensionInfo;
64440
+ }
64441
+ else if (targetDimensionInfo !== null &&
64442
+ (this._cacheDimensionInfo === null ||
64443
+ targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
64444
+ targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
64445
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
64446
+ this._cacheDimensionInfo = targetDimensionInfo;
64447
+ }
64448
+ else if (targetDimensionInfo !== null) {
64449
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
64450
+ }
64451
+ };
64452
+ this.onMouseOut = (params) => {
64453
+ if (!params) {
64454
+ return;
64455
+ }
64456
+ this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
64457
+ this._cacheDimensionInfo = null;
64458
+ };
64459
+ }
64460
+ register(eType, handler) {
64461
+ this._callback = handler.callback;
64462
+ this._eventDispatcher.register('pointermove', {
64463
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64464
+ callback: this.onMouseMove
64465
+ });
64466
+ this._eventDispatcher.register('pointerout', {
64467
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
64468
+ callback: this.onMouseOut
64469
+ });
64470
+ if (isMobileLikeMode(this._mode)) {
64471
+ this._eventDispatcher.register('pointerdown', {
64472
+ query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64473
+ callback: this.onMouseMove
64723
64474
  });
64724
64475
  }
64725
- return fields;
64726
64476
  }
64727
- reInit(spec) {
64728
- if (this._positionXEncoder) {
64729
- this._positionXEncoder = null;
64730
- }
64731
- if (this._positionYEncoder) {
64732
- this._positionYEncoder = null;
64477
+ unregister() {
64478
+ this._eventDispatcher.unregister('pointermove', {
64479
+ query: null,
64480
+ callback: this.onMouseMove
64481
+ });
64482
+ if (isMobileLikeMode(this._mode)) {
64483
+ this._eventDispatcher.unregister('pointerdown', {
64484
+ query: null,
64485
+ callback: this.onMouseMove
64486
+ });
64733
64487
  }
64734
- super.reInit(spec);
64735
64488
  }
64736
64489
  }
64737
64490
 
64491
+ var DimensionEventEnum;
64492
+ (function (DimensionEventEnum) {
64493
+ DimensionEventEnum["dimensionHover"] = "dimensionHover";
64494
+ DimensionEventEnum["dimensionClick"] = "dimensionClick";
64495
+ })(DimensionEventEnum || (DimensionEventEnum = {}));
64496
+
64738
64497
  const lineLikeSeriesMark = {
64739
64498
  ["point"]: { name: "point", type: "symbol" },
64740
64499
  ["line"]: { name: "line", type: "line" }
@@ -71434,6 +71193,116 @@ const registerDimensionHover = () => {
71434
71193
  Factory.registerInteractionTrigger(DimensionHover.type, DimensionHover);
71435
71194
  };
71436
71195
 
71196
+ const registerDimensionEvents = () => {
71197
+ Factory.registerComposedEvent(DimensionEventEnum.dimensionHover, DimensionHoverEvent);
71198
+ Factory.registerComposedEvent(DimensionEventEnum.dimensionClick, DimensionClickEvent);
71199
+ };
71200
+
71201
+ const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
71202
+ const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
71203
+ const continuousXAxisGetDimensionField = (series) => {
71204
+ var _a;
71205
+ return [
71206
+ series.fieldX[0],
71207
+ (_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
71208
+ ];
71209
+ };
71210
+ const continuousYAxisGetDimensionField = (series) => {
71211
+ var _a;
71212
+ return [
71213
+ series.fieldY[0],
71214
+ (_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
71215
+ ];
71216
+ };
71217
+ const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
71218
+ ? isDiscreteAxis
71219
+ ? discreteXAxisGetDimensionField
71220
+ : continuousXAxisGetDimensionField
71221
+ : isDiscreteAxis
71222
+ ? discreteYAxisGetDimensionField
71223
+ : continuousYAxisGetDimensionField;
71224
+ const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
71225
+ var _a, _b;
71226
+ if (!chart) {
71227
+ return null;
71228
+ }
71229
+ const { x, y } = pos;
71230
+ const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
71231
+ const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
71232
+ if (!xAxisList.length && !yAxisList.length) {
71233
+ return null;
71234
+ }
71235
+ const bandAxisSet = new Set();
71236
+ const linearAxisSet = new Set();
71237
+ const forceAxisSet = new Set();
71238
+ [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
71239
+ const isDiscreteAxis = isDiscrete(axis.getScale().type);
71240
+ if (isDiscreteAxis) {
71241
+ bandAxisSet.add(axis);
71242
+ }
71243
+ else {
71244
+ linearAxisSet.add(axis);
71245
+ }
71246
+ if (isTooltip && axis.getSpec().hasDimensionTooltip) {
71247
+ forceAxisSet.add(axis);
71248
+ }
71249
+ }));
71250
+ const targetAxisInfo = [];
71251
+ const addAxisDimensionInfo = (orient) => {
71252
+ const isXAxis = orient === 'x';
71253
+ const posValue = isXAxis ? x : y;
71254
+ const axisList = isXAxis ? xAxisList : yAxisList;
71255
+ axisList.forEach(axis => {
71256
+ if (forceAxisSet.size > 0) {
71257
+ if (forceAxisSet.has(axis)) {
71258
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
71259
+ info && targetAxisInfo.push(info);
71260
+ }
71261
+ }
71262
+ else {
71263
+ const hasDiscreteAxis = bandAxisSet.size > 0;
71264
+ if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
71265
+ const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
71266
+ info && targetAxisInfo.push(info);
71267
+ }
71268
+ }
71269
+ });
71270
+ };
71271
+ if (chart.getSpec().direction === "horizontal") {
71272
+ addAxisDimensionInfo('y');
71273
+ if (targetAxisInfo.length === 0) {
71274
+ addAxisDimensionInfo('x');
71275
+ }
71276
+ }
71277
+ else {
71278
+ addAxisDimensionInfo('x');
71279
+ if (targetAxisInfo.length === 0) {
71280
+ addAxisDimensionInfo('y');
71281
+ }
71282
+ }
71283
+ if (!targetAxisInfo.length) {
71284
+ return null;
71285
+ }
71286
+ return targetAxisInfo;
71287
+ };
71288
+ const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
71289
+ const value = axis.positionToData(posValue, true);
71290
+ return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
71291
+ };
71292
+ const getDimensionInfoByValue = (axis, value, getDimensionField) => {
71293
+ const scale = axis.getScale();
71294
+ if (isNil$1(value)) {
71295
+ return null;
71296
+ }
71297
+ const domain = scale.domain();
71298
+ let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
71299
+ if (index < 0) {
71300
+ index = undefined;
71301
+ }
71302
+ const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
71303
+ return { index, value, position: scale.scale(value), axis, data };
71304
+ };
71305
+
71437
71306
  const layoutByValue$1 = (stateByField, series, layoutStartPoint, enableRemain = false) => {
71438
71307
  if (!layoutStartPoint) {
71439
71308
  layoutStartPoint = { x: 0, y: 0 };
@@ -71879,9 +71748,6 @@ class BaseTooltipProcessor {
71879
71748
  }
71880
71749
  shouldHandleTooltip(params, info) {
71881
71750
  var _a, _b;
71882
- if (!this.component.enable) {
71883
- return false;
71884
- }
71885
71751
  if (isNil$1(info)) {
71886
71752
  return false;
71887
71753
  }
@@ -93192,6 +93058,106 @@ class RoseChartSpecTransformer extends RoseLikeChartSpecTransformer {
93192
93058
  }
93193
93059
  }
93194
93060
 
93061
+ const angleStandardize = (angle, range) => {
93062
+ const unit = Math.PI * 2;
93063
+ const min = minInArray(range);
93064
+ const max = maxInArray(range);
93065
+ if (angle < min) {
93066
+ angle += Math.ceil((min - angle) / unit) * unit;
93067
+ }
93068
+ else if (angle > max) {
93069
+ angle -= Math.ceil((angle - max) / unit) * unit;
93070
+ }
93071
+ return angle;
93072
+ };
93073
+ const getPolarDimensionInfo = (chart, pos) => {
93074
+ if (!chart) {
93075
+ return null;
93076
+ }
93077
+ const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
93078
+ const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
93079
+ if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
93080
+ return null;
93081
+ }
93082
+ const targetAxisInfo = [];
93083
+ const getDimensionField = (series) => series.getDimensionField()[0];
93084
+ const { x, y } = pos;
93085
+ if (angleAxisList) {
93086
+ angleAxisList.forEach(axis => {
93087
+ var _a;
93088
+ const angleScale = axis.getScale();
93089
+ if (angleScale && isDiscrete(angleScale.type)) {
93090
+ const angleDomain = angleScale.domain();
93091
+ const angleRange = angleScale.range();
93092
+ const center = axis.getCenter();
93093
+ const vector = {
93094
+ x: x - axis.getLayoutStartPoint().x - center.x,
93095
+ y: y - axis.getLayoutStartPoint().y - center.y
93096
+ };
93097
+ let angle = vectorAngle({ x: 1, y: 0 }, vector);
93098
+ angle = angleStandardize(angle, angleRange);
93099
+ const radius = distance(vector);
93100
+ const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93101
+ const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93102
+ if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93103
+ (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93104
+ return;
93105
+ }
93106
+ const value = axis.invert(angle);
93107
+ if (isNil$1(value)) {
93108
+ return;
93109
+ }
93110
+ let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93111
+ if (index < 0) {
93112
+ index = undefined;
93113
+ }
93114
+ const data = getDimensionData(value, axis, 'polar', getDimensionField);
93115
+ targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
93116
+ }
93117
+ });
93118
+ }
93119
+ if (radiusAxisList) {
93120
+ radiusAxisList.forEach(axis => {
93121
+ var _a;
93122
+ const radiusScale = axis.getScale();
93123
+ const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93124
+ if (radiusScale && isDiscrete(radiusScale.type)) {
93125
+ const center = axis.getCenter();
93126
+ const vector = {
93127
+ x: x - axis.getLayoutStartPoint().x - center.x,
93128
+ y: y - axis.getLayoutStartPoint().y - center.y
93129
+ };
93130
+ let angle = vectorAngle({ x: 1, y: 0 }, vector);
93131
+ if (angle < -Math.PI / 2) {
93132
+ angle = Math.PI * 2 + angle;
93133
+ }
93134
+ const radius = distance(vector);
93135
+ const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93136
+ const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
93137
+ if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93138
+ (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93139
+ return;
93140
+ }
93141
+ const value = radiusScale.invert(radius);
93142
+ if (isNil$1(value)) {
93143
+ return;
93144
+ }
93145
+ const domain = radiusScale.domain();
93146
+ let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93147
+ if (index < 0) {
93148
+ index = undefined;
93149
+ }
93150
+ const data = getDimensionData(value, axis, 'polar', getDimensionField);
93151
+ targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
93152
+ }
93153
+ });
93154
+ }
93155
+ if (!targetAxisInfo.length) {
93156
+ return null;
93157
+ }
93158
+ return targetAxisInfo;
93159
+ };
93160
+
93195
93161
  class RoseChart extends BaseChart {
93196
93162
  constructor() {
93197
93163
  super(...arguments);
@@ -95693,15 +95659,11 @@ function showTooltip(datum, options, component) {
95693
95659
  });
95694
95660
  return originDatum;
95695
95661
  };
95696
- const transform = region.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse();
95697
95662
  const getMockEvent = (originPos) => {
95698
95663
  var _a, _b;
95699
95664
  const pos = bound(originPos);
95700
- const tempX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95701
- const tempY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95702
- const canvasPoint = { x: 0, y: 0 };
95703
- transform.transformPoint({ x: tempX, y: tempY }, canvasPoint);
95704
- const { x: canvasX, y: canvasY } = canvasPoint;
95665
+ const canvasX = (_a = opt.x) !== null && _a !== void 0 ? _a : regionPos.x + pos.x;
95666
+ const canvasY = (_b = opt.y) !== null && _b !== void 0 ? _b : regionPos.y + pos.y;
95705
95667
  return {
95706
95668
  canvasX,
95707
95669
  canvasY,
@@ -96079,7 +96041,6 @@ class Tooltip extends BaseComponent {
96079
96041
  this.specKey = 'tooltip';
96080
96042
  this.layoutType = 'none';
96081
96043
  this._isReleased = false;
96082
- this.enable = true;
96083
96044
  this._alwaysShow = false;
96084
96045
  this._eventList = [];
96085
96046
  this._isTooltipShown = false;
@@ -103235,9 +103196,6 @@ class Brush extends BaseComponent {
103235
103196
  this._initMarkBrushState(componentIndex, '');
103236
103197
  brushComponent.children[0].removeAllChild();
103237
103198
  }
103238
- _shouldEnableInteractive() {
103239
- return this.getOption().getCompiler().getOption().interactive !== false;
103240
- }
103241
103199
  _createBrushComponent(region, componentIndex) {
103242
103200
  var _a, _b;
103243
103201
  const interactiveAttr = this._getBrushInteractiveAttr(region);
@@ -103248,45 +103206,33 @@ class Brush extends BaseComponent {
103248
103206
  this._cacheInteractiveRangeAttrs.push(interactiveAttr);
103249
103207
  brush.addEventListener(IOperateType.brushActive, (e) => {
103250
103208
  this._initMarkBrushState(componentIndex, OUT_BRUSH_STATE);
103251
- this._emitEvent(ChartEvent.brushActive, region, e);
103209
+ this._emitEvent(ChartEvent.brushActive, region);
103252
103210
  });
103253
103211
  brush.addEventListener(IOperateType.drawStart, (e) => {
103254
- if (this._spec.disableDimensionHoverWhenBrushing) {
103255
- this._option.globalInstance.disableDimensionHoverEvent(true);
103256
- }
103257
103212
  this._setRegionMarkPickable(region, true);
103258
- this._emitEvent(ChartEvent.brushStart, region, e);
103213
+ this._emitEvent(ChartEvent.brushStart, region);
103259
103214
  });
103260
103215
  brush.addEventListener(IOperateType.moveStart, (e) => {
103261
- if (this._spec.disableDimensionHoverWhenBrushing) {
103262
- this._option.globalInstance.disableDimensionHoverEvent(true);
103263
- }
103264
103216
  this._setRegionMarkPickable(region, true);
103265
- this._emitEvent(ChartEvent.brushStart, region, e);
103217
+ this._emitEvent(ChartEvent.brushStart, region);
103266
103218
  });
103267
103219
  brush.addEventListener(IOperateType.drawing, (e) => {
103268
103220
  this._setRegionMarkPickable(region, false);
103269
103221
  this._handleBrushChange(region, e);
103270
- this._emitEvent(ChartEvent.brushChange, region, e);
103222
+ this._emitEvent(ChartEvent.brushChange, region);
103271
103223
  });
103272
103224
  brush.addEventListener(IOperateType.moving, (e) => {
103273
103225
  this._setRegionMarkPickable(region, false);
103274
103226
  this._handleBrushChange(region, e);
103275
- this._emitEvent(ChartEvent.brushChange, region, e);
103227
+ this._emitEvent(ChartEvent.brushChange, region);
103276
103228
  });
103277
103229
  brush.addEventListener(IOperateType.brushClear, (e) => {
103278
- if (this._spec.disableDimensionHoverWhenBrushing) {
103279
- this._option.globalInstance.disableDimensionHoverEvent(false);
103280
- }
103281
103230
  this._setRegionMarkPickable(region, true);
103282
103231
  this._initMarkBrushState(componentIndex, '');
103283
- this._emitEvent(ChartEvent.brushClear, region, e);
103232
+ this._emitEvent(ChartEvent.brushClear, region);
103284
103233
  });
103285
103234
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103286
103235
  var _a;
103287
- if (this._spec.disableDimensionHoverWhenBrushing) {
103288
- this._option.globalInstance.disableDimensionHoverEvent(false);
103289
- }
103290
103236
  this._setRegionMarkPickable(region, true);
103291
103237
  const { operateMask } = e.detail;
103292
103238
  const { updateElementsState = true } = this._spec;
@@ -103294,11 +103240,11 @@ class Brush extends BaseComponent {
103294
103240
  if (this._spec.onBrushEnd(e) === true) {
103295
103241
  this.clearGraphic();
103296
103242
  this._initMarkBrushState(componentIndex, '');
103297
- this._emitEvent(ChartEvent.brushClear, region, e);
103243
+ this._emitEvent(ChartEvent.brushClear, region);
103298
103244
  }
103299
103245
  else {
103300
103246
  this._spec.onBrushEnd(e);
103301
- this._emitEvent(ChartEvent.brushEnd, region, e);
103247
+ this._emitEvent(ChartEvent.brushEnd, region);
103302
103248
  }
103303
103249
  }
103304
103250
  else {
@@ -103306,13 +103252,10 @@ class Brush extends BaseComponent {
103306
103252
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
103307
103253
  this._setAxisAndDataZoom(operateMask, region);
103308
103254
  }
103309
- this._emitEvent(ChartEvent.brushEnd, region, e);
103255
+ this._emitEvent(ChartEvent.brushEnd, region);
103310
103256
  }
103311
103257
  });
103312
103258
  brush.addEventListener(IOperateType.moveEnd, (e) => {
103313
- if (this._spec.disableDimensionHoverWhenBrushing) {
103314
- this._option.globalInstance.disableDimensionHoverEvent(false);
103315
- }
103316
103259
  this._setRegionMarkPickable(region, true);
103317
103260
  const { operateMask } = e.detail;
103318
103261
  const { updateElementsState = true } = this._spec;
@@ -103320,7 +103263,7 @@ class Brush extends BaseComponent {
103320
103263
  if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
103321
103264
  this._setAxisAndDataZoom(operateMask, region);
103322
103265
  }
103323
- this._emitEvent(ChartEvent.brushEnd, region, e);
103266
+ this._emitEvent(ChartEvent.brushEnd, region);
103324
103267
  });
103325
103268
  }
103326
103269
  _getBrushInteractiveAttr(region) {
@@ -103338,8 +103281,7 @@ class Brush extends BaseComponent {
103338
103281
  maxX: seriesRegionEndX
103339
103282
  },
103340
103283
  xRange: [seriesRegionStartX, seriesRegionEndX],
103341
- yRange: [seriesRegionStartY, seriesRegionEndY],
103342
- interactive: this._shouldEnableInteractive()
103284
+ yRange: [seriesRegionStartY, seriesRegionEndY]
103343
103285
  };
103344
103286
  }
103345
103287
  _transformBrushedMarkAttr(brushedStyle) {
@@ -103360,7 +103302,6 @@ class Brush extends BaseComponent {
103360
103302
  }
103361
103303
  _handleBrushChange(region, e) {
103362
103304
  const { operateMask } = e.detail;
103363
- this._operateMask = operateMask;
103364
103305
  const { updateElementsState = true } = this._spec;
103365
103306
  if (updateElementsState) {
103366
103307
  this._reconfigItem(operateMask, region);
@@ -103385,7 +103326,7 @@ class Brush extends BaseComponent {
103385
103326
  }
103386
103327
  return data;
103387
103328
  }
103388
- _emitEvent(eventType, region, e) {
103329
+ _emitEvent(eventType, region) {
103389
103330
  var _a;
103390
103331
  this.event.emit(eventType, {
103391
103332
  model: this,
@@ -103402,8 +103343,7 @@ class Brush extends BaseComponent {
103402
103343
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
103403
103344
  zoomRecord: this._zoomRecord
103404
103345
  },
103405
- vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance,
103406
- event: e
103346
+ vchart: (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance
103407
103347
  });
103408
103348
  }
103409
103349
  _reconfigItem(operateMask, region) {
@@ -103658,12 +103598,6 @@ class Brush extends BaseComponent {
103658
103598
  this._brushComponents = null;
103659
103599
  }
103660
103600
  }
103661
- clearBrushStateAndMask() {
103662
- this._relativeRegions.forEach((region, componentIndex) => {
103663
- this._initMarkBrushState(componentIndex, '');
103664
- this._brushComponents[componentIndex].children[0].removeAllChild();
103665
- });
103666
- }
103667
103601
  }
103668
103602
  Brush.type = ComponentTypeEnum.brush;
103669
103603
  Brush.builtInTheme = {