@visactor/vchart 2.0.13-alpha.3 → 2.0.13-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +735 -693
  3. package/build/index.js +735 -693
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/component/brush/brush.d.ts +1 -0
  7. package/cjs/component/brush/brush.js +10 -0
  8. package/cjs/component/brush/brush.js.map +1 -1
  9. package/cjs/component/brush/interface.d.ts +1 -0
  10. package/cjs/component/brush/interface.js.map +1 -1
  11. package/cjs/component/crosshair/interface/spec.d.ts +1 -0
  12. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  13. package/cjs/component/tooltip/interface/common.d.ts +1 -0
  14. package/cjs/component/tooltip/interface/common.js.map +1 -1
  15. package/cjs/component/tooltip/processor/base.js +1 -1
  16. package/cjs/component/tooltip/processor/base.js.map +1 -1
  17. package/cjs/component/tooltip/tooltip.d.ts +1 -0
  18. package/cjs/component/tooltip/tooltip.js +3 -2
  19. package/cjs/component/tooltip/tooltip.js.map +1 -1
  20. package/cjs/core/interface.d.ts +9 -1
  21. package/cjs/core/interface.js.map +1 -1
  22. package/cjs/core/vchart.d.ts +3 -0
  23. package/cjs/core/vchart.js +10 -1
  24. package/cjs/core/vchart.js.map +1 -1
  25. package/cjs/event/event.js +1 -1
  26. package/cjs/event/event.js.map +1 -1
  27. package/cjs/event/events/dimension/dimension-hover.d.ts +2 -0
  28. package/cjs/event/events/dimension/dimension-hover.js +6 -3
  29. package/cjs/event/events/dimension/dimension-hover.js.map +1 -1
  30. package/esm/component/brush/brush.d.ts +1 -0
  31. package/esm/component/brush/brush.js +10 -0
  32. package/esm/component/brush/brush.js.map +1 -1
  33. package/esm/component/brush/interface.d.ts +1 -0
  34. package/esm/component/brush/interface.js.map +1 -1
  35. package/esm/component/crosshair/interface/spec.d.ts +1 -0
  36. package/esm/component/crosshair/interface/spec.js.map +1 -1
  37. package/esm/component/tooltip/interface/common.d.ts +1 -0
  38. package/esm/component/tooltip/interface/common.js.map +1 -1
  39. package/esm/component/tooltip/processor/base.js +1 -1
  40. package/esm/component/tooltip/processor/base.js.map +1 -1
  41. package/esm/component/tooltip/tooltip.d.ts +1 -0
  42. package/esm/component/tooltip/tooltip.js +3 -2
  43. package/esm/component/tooltip/tooltip.js.map +1 -1
  44. package/esm/core/interface.d.ts +9 -1
  45. package/esm/core/interface.js.map +1 -1
  46. package/esm/core/vchart.d.ts +3 -0
  47. package/esm/core/vchart.js +11 -0
  48. package/esm/core/vchart.js.map +1 -1
  49. package/esm/event/event.js +1 -1
  50. package/esm/event/event.js.map +1 -1
  51. package/esm/event/events/dimension/dimension-hover.d.ts +2 -0
  52. package/esm/event/events/dimension/dimension-hover.js +7 -2
  53. package/esm/event/events/dimension/dimension-hover.js.map +1 -1
  54. package/package.json +4 -4
package/build/index.es.js CHANGED
@@ -53868,7 +53868,7 @@ let Event$1 = class Event {
53868
53868
  if (ComposedEventCtor) {
53869
53869
  const composedEvent = new ComposedEventCtor(this._eventDispatcher, this._mode);
53870
53870
  composedEvent.register(eType, handler);
53871
- this._composedEventMap.set(callback, {
53871
+ this._composedEventMap.set(handler.callback, {
53872
53872
  eventType: eType,
53873
53873
  event: composedEvent
53874
53874
  });
@@ -60280,6 +60280,609 @@ class VChartPluginService extends BasePluginService {
60280
60280
  }
60281
60281
  }
60282
60282
 
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
+
60283
60886
  class VChart {
60284
60887
  static useRegisters(comps) {
60285
60888
  comps.forEach((fn) => {
@@ -60528,7 +61131,7 @@ class VChart {
60528
61131
  this._compiler.updateLayoutTag();
60529
61132
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
60530
61133
  this._initDataSet(this._option.dataSet);
60531
- this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
61134
+ this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
60532
61135
  this._bindResizeEvent();
60533
61136
  this._bindViewEvent();
60534
61137
  this._initChartPlugin();
@@ -61181,7 +61784,7 @@ class VChart {
61181
61784
  resize = true;
61182
61785
  }
61183
61786
  const lasAutoSize = this._autoSize;
61184
- 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;
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;
61185
61788
  if (this._autoSize !== lasAutoSize) {
61186
61789
  resize = true;
61187
61790
  }
@@ -61422,6 +62025,19 @@ class VChart {
61422
62025
  var _a;
61423
62026
  return (_a = this._chart) === null || _a === void 0 ? void 0 : _a.setDimensionIndex(value, opt);
61424
62027
  }
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
+ }
61425
62041
  showCrosshair(cb) {
61426
62042
  var _a;
61427
62043
  (_a = this._chart) === null || _a === void 0 ? void 0 : _a.showCrosshair(cb);
@@ -61664,39 +62280,6 @@ var Direction;
61664
62280
  Direction["horizontal"] = "horizontal";
61665
62281
  })(Direction || (Direction = {}));
61666
62282
 
61667
- function getComponentThemeFromOption(type, getTheme) {
61668
- return getTheme('component', type);
61669
- }
61670
- function getFormatFunction(formatMethod, formatter, text, datum) {
61671
- if (formatMethod) {
61672
- return { formatFunc: formatMethod, args: [text, datum] };
61673
- }
61674
- const formatterImpl = Factory.getFormatter();
61675
- if (formatter && formatterImpl) {
61676
- return { formatFunc: formatterImpl, args: [text, datum, formatter] };
61677
- }
61678
- return {};
61679
- }
61680
- const getSpecInfo = (chartSpec, specKey, compType, filter) => {
61681
- if (isNil$1(chartSpec[specKey])) {
61682
- return undefined;
61683
- }
61684
- const isArraySpec = isArray$1(chartSpec[specKey]);
61685
- const spec = isArraySpec ? chartSpec[specKey] : [chartSpec[specKey]];
61686
- const specInfos = [];
61687
- spec.forEach((s, i) => {
61688
- if (s && (!filter || filter(s))) {
61689
- specInfos.push({
61690
- spec: s,
61691
- specPath: isArraySpec ? [specKey, i] : [specKey],
61692
- specInfoPath: ['component', specKey, i],
61693
- type: compType
61694
- });
61695
- }
61696
- });
61697
- return specInfos;
61698
- };
61699
-
61700
62283
  const lookup = (data, opt) => {
61701
62284
  if (!opt.from || !opt.from()) {
61702
62285
  return data;
@@ -64043,471 +64626,115 @@ class CartesianSeries extends BaseSeries {
64043
64626
  }
64044
64627
  positionToData(p) {
64045
64628
  if (!p) {
64046
- return null;
64047
- }
64048
- return {
64049
- x: this.positionToDataX(p.x),
64050
- y: this.positionToDataY(p.y)
64051
- };
64052
- }
64053
- positionToDataX(xPos) {
64054
- if (!this._scaleX) {
64055
- return null;
64056
- }
64057
- return this._scaleX.invert(xPos);
64058
- }
64059
- positionToDataY(yPos) {
64060
- if (!this._scaleY) {
64061
- return null;
64062
- }
64063
- return this._scaleY.invert(yPos);
64064
- }
64065
- getRegionRectLeft() {
64066
- if (!this._xAxisHelper) {
64067
- return Number.NaN;
64068
- }
64069
- const { getScale } = this._xAxisHelper;
64070
- return getScale(0).range()[0];
64071
- }
64072
- getRegionRectRight() {
64073
- if (!this._xAxisHelper) {
64074
- return Number.NaN;
64075
- }
64076
- const { getScale } = this._xAxisHelper;
64077
- return getScale(0).range()[1];
64078
- }
64079
- afterInitMark() {
64080
- super.afterInitMark();
64081
- this.setFieldX(this._fieldX);
64082
- this.setFieldY(this._fieldY);
64083
- this._buildScaleConfig();
64084
- }
64085
- getDimensionField() {
64086
- if (this._direction === "horizontal") {
64087
- return this._specYField;
64088
- }
64089
- return this._specXField;
64090
- }
64091
- getDimensionContinuousField() {
64092
- if (this._direction === "horizontal") {
64093
- return [this.fieldY[0], this.fieldY2];
64094
- }
64095
- return [this.fieldX[0], this.fieldX2];
64096
- }
64097
- getMeasureField() {
64098
- if (this._direction === "horizontal") {
64099
- return this._specXField;
64100
- }
64101
- return this._specYField;
64102
- }
64103
- initEvent() {
64104
- super.initEvent();
64105
- if (this.sortDataByAxis) {
64106
- this.event.on(ChartEvent.scaleDomainUpdate, {
64107
- filter: param => {
64108
- var _a;
64109
- return param.model.id ===
64110
- ((_a = (this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper)) === null || _a === void 0 ? void 0 : _a.getAxisId());
64111
- }
64112
- }, () => {
64113
- this._sortDataInAxisDomain();
64114
- });
64115
- }
64116
- }
64117
- _sortDataInAxisDomain() {
64118
- var _a, _b, _c;
64119
- if ((_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b.length) {
64120
- sortDataInAxisHelper(this._direction === "horizontal" ? this._yAxisHelper : this._xAxisHelper, this._direction === "horizontal" ? this._fieldY[0] : this._fieldX[0], this.getViewData().latestData);
64121
- (_c = this._data) === null || _c === void 0 ? void 0 : _c.updateData(true);
64122
- }
64123
- }
64124
- getInvalidCheckFields() {
64125
- const fields = [];
64126
- if (this._xAxisHelper &&
64127
- this._xAxisHelper.isContinuous &&
64128
- this._xAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64129
- const xFields = this._xAxisHelper.getFields ? this._xAxisHelper.getFields() : this._specXField;
64130
- xFields.forEach(f => {
64131
- fields.push(f);
64132
- });
64133
- }
64134
- if (this._yAxisHelper &&
64135
- this._yAxisHelper.isContinuous &&
64136
- this._yAxisHelper.getAxisType() !== ComponentTypeEnum.geoCoordinate) {
64137
- const yFields = this._yAxisHelper.getFields ? this._yAxisHelper.getFields() : this._specYField;
64138
- yFields.forEach(f => {
64139
- fields.push(f);
64140
- });
64141
- }
64142
- return fields;
64143
- }
64144
- reInit(spec) {
64145
- if (this._positionXEncoder) {
64146
- this._positionXEncoder = null;
64147
- }
64148
- if (this._positionYEncoder) {
64149
- this._positionYEncoder = null;
64150
- }
64151
- super.reInit(spec);
64152
- }
64153
- }
64154
-
64155
- function isXAxis(orient) {
64156
- return orient === 'bottom' || orient === 'top';
64157
- }
64158
- function isYAxis(orient) {
64159
- return orient === 'left' || orient === 'right';
64160
- }
64161
- function isZAxis(orient) {
64162
- return orient === 'z';
64163
- }
64164
- function autoAxisType(orient, isHorizontal) {
64165
- if (isHorizontal) {
64166
- return isXAxis(orient) ? 'linear' : 'band';
64167
- }
64168
- return isXAxis(orient) ? 'band' : 'linear';
64169
- }
64170
- function getOrient(spec, whiteList) {
64171
- return isValidOrient(spec.orient) || (whiteList && whiteList.includes(spec.orient)) ? spec.orient : 'left';
64172
- }
64173
- function getDirectionByOrient(orient) {
64174
- return orient === 'top' || orient === 'bottom' ? "horizontal" : "vertical";
64175
- }
64176
- function transformInverse(spec, isHorizontal) {
64177
- let inverse = spec.inverse;
64178
- if (isHorizontal && !isXAxis(spec.orient)) {
64179
- inverse = isValid$1(spec.inverse) ? !spec.inverse : true;
64180
- }
64181
- return inverse;
64182
- }
64183
- function getCartesianAxisInfo(spec, isHorizontal) {
64184
- var _a;
64185
- const axisType = (_a = spec.type) !== null && _a !== void 0 ? _a : autoAxisType(spec.orient, isHorizontal);
64186
- const componentName = `${ComponentTypeEnum.cartesianAxis}-${axisType}`;
64187
- return { axisType, componentName };
64188
- }
64189
- const getCartesianAxisTheme = (orient, type, getTheme) => {
64190
- var _a;
64191
- const axisTypeTheme = (_a = (type === 'band'
64192
- ? getComponentThemeFromOption('axisBand', getTheme)
64193
- : ['linear', 'log', 'symlog'].includes(type)
64194
- ? getComponentThemeFromOption('axisLinear', getTheme)
64195
- : {})) !== null && _a !== void 0 ? _a : {};
64196
- const axisTheme = isXAxis(orient)
64197
- ? getComponentThemeFromOption('axisX', getTheme)
64198
- : isYAxis(orient)
64199
- ? getComponentThemeFromOption('axisY', getTheme)
64200
- : getComponentThemeFromOption('axisZ', getTheme);
64201
- return mergeSpec({}, getComponentThemeFromOption('axis', getTheme), axisTypeTheme, axisTheme);
64202
- };
64203
-
64204
- class DimensionEvent {
64205
- constructor(eventDispatcher, mode) {
64206
- this._eventDispatcher = eventDispatcher;
64207
- this._mode = mode;
64208
- }
64209
- get chart() {
64210
- var _a, _b;
64211
- if (!this._chart) {
64212
- this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
64213
- }
64214
- return this._chart;
64215
- }
64216
- register(eType, handler) {
64217
- var _a, _b;
64218
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64219
- }
64220
- unregister() {
64221
- var _a, _b;
64222
- ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error)('Method not implemented.');
64223
- }
64224
- getTargetDimensionInfo(x, y) {
64225
- var _a, _b, _c;
64226
- 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 : [];
64227
- if (dimensionInfo.length === 0) {
64228
- return null;
64229
- }
64230
- return dimensionInfo;
64231
- }
64232
- dispatch(v, opt) {
64233
- var _a, _b;
64234
- const axes = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
64235
- if (c.specKey !== 'axes') {
64236
- return false;
64237
- }
64238
- if (opt === null || opt === void 0 ? void 0 : opt.filter) {
64239
- return opt.filter(c);
64240
- }
64241
- return true;
64242
- });
64243
- const discreteAxes = axes.filter(axis => {
64244
- const scale = axis.getScale();
64245
- return isDiscrete(scale.type);
64246
- });
64247
- const dimAxes = discreteAxes.length
64248
- ? discreteAxes
64249
- : axes.filter(axis => {
64250
- const orient = axis.getOrient();
64251
- return isXAxis(orient) || orient === 'angle';
64252
- });
64253
- const dimensionInfo = [];
64254
- const getDimensionInfoByValue = (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getModelOption().getDimensionInfoByValue;
64255
- if (getDimensionInfoByValue) {
64256
- dimAxes.forEach(a => {
64257
- const info = getDimensionInfoByValue(a, v);
64258
- if (info) {
64259
- dimensionInfo.push(info);
64260
- }
64261
- });
64262
- }
64263
- this._callback.call(null, {
64264
- action: 'enter',
64265
- dimensionInfo
64266
- });
64267
- return dimensionInfo;
64268
- }
64269
- }
64270
-
64271
- class DimensionClickEvent extends DimensionEvent {
64272
- constructor() {
64273
- super(...arguments);
64274
- this.onClick = (params) => {
64275
- if (!params) {
64276
- return;
64277
- }
64278
- const x = params.event.viewX;
64279
- const y = params.event.viewY;
64280
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64281
- if (!targetDimensionInfo) {
64282
- return;
64283
- }
64284
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'click', dimensionInfo: targetDimensionInfo.slice() }));
64285
- };
64286
- }
64287
- register(eType, handler) {
64288
- this._callback = handler.callback;
64289
- this._eventDispatcher.register('pointertap', {
64290
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64291
- callback: this.onClick
64292
- });
64629
+ return null;
64630
+ }
64631
+ return {
64632
+ x: this.positionToDataX(p.x),
64633
+ y: this.positionToDataY(p.y)
64634
+ };
64293
64635
  }
64294
- unregister() {
64295
- this._eventDispatcher.unregister('pointertap', {
64296
- query: null,
64297
- callback: this.onClick
64298
- });
64636
+ positionToDataX(xPos) {
64637
+ if (!this._scaleX) {
64638
+ return null;
64639
+ }
64640
+ return this._scaleX.invert(xPos);
64299
64641
  }
64300
- }
64301
-
64302
- const isInBound = (pos, min, max) => pos.x >= min.x && pos.x <= max.x && pos.y >= min.y && pos.y <= max.y;
64303
- const isInRegionBound = (chart, axis, pos) => {
64304
- const regionList = chart.getRegionsInIds(array(axis.layout.layoutBindRegionID));
64305
- return regionList === null || regionList === void 0 ? void 0 : regionList.some(region => {
64306
- const rect = region.getLayoutRect();
64307
- const startPoint = region.getLayoutStartPoint();
64308
- return isInBound(pos, { x: startPoint.x, y: startPoint.y }, { x: rect.width + startPoint.x, y: rect.height + startPoint.y });
64309
- });
64310
- };
64311
- const isSameDimensionInfo = (a, b) => {
64312
- var _a, _b;
64313
- if (a === b) {
64314
- return true;
64642
+ positionToDataY(yPos) {
64643
+ if (!this._scaleY) {
64644
+ return null;
64645
+ }
64646
+ return this._scaleY.invert(yPos);
64315
64647
  }
64316
- if (isNil$1(a) || isNil$1(b)) {
64317
- return false;
64648
+ getRegionRectLeft() {
64649
+ if (!this._xAxisHelper) {
64650
+ return Number.NaN;
64651
+ }
64652
+ const { getScale } = this._xAxisHelper;
64653
+ return getScale(0).range()[0];
64318
64654
  }
64319
- if (a.value !== b.value) {
64320
- return false;
64655
+ getRegionRectRight() {
64656
+ if (!this._xAxisHelper) {
64657
+ return Number.NaN;
64658
+ }
64659
+ const { getScale } = this._xAxisHelper;
64660
+ return getScale(0).range()[1];
64321
64661
  }
64322
- if (((_a = a.axis) === null || _a === void 0 ? void 0 : _a.id) !== ((_b = b.axis) === null || _b === void 0 ? void 0 : _b.id)) {
64323
- return false;
64662
+ afterInitMark() {
64663
+ super.afterInitMark();
64664
+ this.setFieldX(this._fieldX);
64665
+ this.setFieldY(this._fieldY);
64666
+ this._buildScaleConfig();
64324
64667
  }
64325
- return true;
64326
- };
64327
- const resolveTooltipFilterRange = (spec, scale) => {
64328
- const range = spec.tooltipFilterRange;
64329
- const rangeValue = typeof range === 'function' ? range({ scale }) : range;
64330
- const rangeArr = (isValidNumber$1(rangeValue) ? [-rangeValue, rangeValue] : rangeValue);
64331
- return rangeArr;
64332
- };
64333
- const getDimensionData = (value, axis, coordinate, getDimensionField) => {
64334
- var _a;
64335
- const scale = axis.getScale();
64336
- const isDiscreteAxis = isDiscrete(scale.type);
64337
- const data = [];
64338
- const seriesList = axis.getOption().getChart().getSeriesInIndex(axis.getSpecInfo().seriesIndexes);
64339
- for (const series of seriesList) {
64340
- if (series.coordinate === coordinate) {
64341
- const dimensionField = array(getDimensionField(series));
64342
- const viewData = (_a = series.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData;
64343
- if (dimensionField && viewData) {
64344
- if (isDiscreteAxis) {
64345
- const datums = [];
64346
- const datumIdList = [];
64347
- viewData.forEach((datum, i) => {
64348
- var _a;
64349
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString())) {
64350
- datums.push(datum);
64351
- datumIdList.push(i);
64352
- }
64353
- });
64354
- data.push({
64355
- series,
64356
- datum: datums,
64357
- key: getDimensionDataKey(series, datumIdList)
64358
- });
64359
- }
64360
- else {
64361
- if (isValid$1(dimensionField[1])) {
64362
- const datums = [];
64363
- const datumIdList = [];
64364
- viewData.forEach((datum, i) => {
64365
- var _a;
64366
- if (((_a = datum[dimensionField[0]]) === null || _a === void 0 ? void 0 : _a.toString()) === (value === null || value === void 0 ? void 0 : value.toString()) ||
64367
- (isValid$1(datum[dimensionField[0]]) &&
64368
- isValid$1(datum[dimensionField[1]]) &&
64369
- value >= datum[dimensionField[0]] &&
64370
- value < datum[dimensionField[1]])) {
64371
- datums.push(datum);
64372
- datumIdList.push(i);
64373
- }
64374
- });
64375
- data.push({
64376
- series,
64377
- datum: datums,
64378
- key: getDimensionDataKey(series, datumIdList)
64379
- });
64380
- }
64381
- else {
64382
- const spec = axis.getSpec();
64383
- const rangeArr = resolveTooltipFilterRange(spec, scale);
64384
- let datums = [];
64385
- let datumIdList = [];
64386
- if (rangeArr) {
64387
- viewData.forEach((datum, i) => {
64388
- if (isValid$1(datum[dimensionField[0]])) {
64389
- const delta = datum[dimensionField[0]] - value;
64390
- if (delta >= rangeArr[0] && delta <= rangeArr[1]) {
64391
- datums.push(datum);
64392
- datumIdList.push(i);
64393
- }
64394
- }
64395
- });
64396
- }
64397
- else {
64398
- let minDelta = Infinity;
64399
- let deltaSign = 0;
64400
- viewData.forEach((datum, i) => {
64401
- if (isValid$1(datum[dimensionField[0]])) {
64402
- const delta = Math.abs(datum[dimensionField[0]] - value);
64403
- const sign = Math.sign(datum[dimensionField[0]] - value);
64404
- if (delta < minDelta) {
64405
- minDelta = delta;
64406
- datums = [datum];
64407
- datumIdList = [i];
64408
- deltaSign = sign;
64409
- }
64410
- else if (delta === minDelta && sign === deltaSign) {
64411
- datums.push(datum);
64412
- datumIdList.push(i);
64413
- }
64414
- }
64415
- });
64416
- }
64417
- data.push({
64418
- series,
64419
- datum: datums,
64420
- key: getDimensionDataKey(series, datumIdList)
64421
- });
64422
- }
64423
- }
64424
- }
64668
+ getDimensionField() {
64669
+ if (this._direction === "horizontal") {
64670
+ return this._specYField;
64425
64671
  }
64672
+ return this._specXField;
64426
64673
  }
64427
- return data;
64428
- };
64429
- const getDimensionDataKey = (series, datumIdList) => `${series.id}_${datumIdList.join('_')}`;
64430
- const getAxis = (chart, filter, pos) => {
64431
- const axesComponents = chart
64432
- .getAllComponents()
64433
- .filter(c => c.specKey === 'axes' && filter(c) && isInRegionBound(chart, c, pos));
64434
- if (!axesComponents.length) {
64435
- return null;
64674
+ getDimensionContinuousField() {
64675
+ if (this._direction === "horizontal") {
64676
+ return [this.fieldY[0], this.fieldY2];
64677
+ }
64678
+ return [this.fieldX[0], this.fieldX2];
64436
64679
  }
64437
- return axesComponents;
64438
- };
64439
-
64440
- class DimensionHoverEvent extends DimensionEvent {
64441
- constructor() {
64442
- super(...arguments);
64443
- this._cacheDimensionInfo = null;
64444
- this.onMouseMove = (params) => {
64445
- if (!params) {
64446
- return;
64447
- }
64448
- const x = params.event.viewX;
64449
- const y = params.event.viewY;
64450
- const targetDimensionInfo = this.getTargetDimensionInfo(x, y);
64451
- if (targetDimensionInfo === null && this._cacheDimensionInfo !== null) {
64452
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo.slice() }));
64453
- this._cacheDimensionInfo = targetDimensionInfo;
64454
- }
64455
- else if (targetDimensionInfo !== null &&
64456
- (this._cacheDimensionInfo === null ||
64457
- targetDimensionInfo.length !== this._cacheDimensionInfo.length ||
64458
- targetDimensionInfo.some((info, i) => !isSameDimensionInfo(info, this._cacheDimensionInfo[i])))) {
64459
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'enter', dimensionInfo: targetDimensionInfo.slice() }));
64460
- this._cacheDimensionInfo = targetDimensionInfo;
64461
- }
64462
- else if (targetDimensionInfo !== null) {
64463
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'move', dimensionInfo: targetDimensionInfo.slice() }));
64464
- }
64465
- };
64466
- this.onMouseOut = (params) => {
64467
- if (!params) {
64468
- return;
64469
- }
64470
- this._callback.call(null, Object.assign(Object.assign({}, params), { action: 'leave', dimensionInfo: this._cacheDimensionInfo ? this._cacheDimensionInfo.slice() : [] }));
64471
- this._cacheDimensionInfo = null;
64472
- };
64680
+ getMeasureField() {
64681
+ if (this._direction === "horizontal") {
64682
+ return this._specXField;
64683
+ }
64684
+ return this._specYField;
64473
64685
  }
64474
- register(eType, handler) {
64475
- this._callback = handler.callback;
64476
- this._eventDispatcher.register('pointermove', {
64477
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64478
- callback: this.onMouseMove
64479
- });
64480
- this._eventDispatcher.register('pointerout', {
64481
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.canvas }),
64482
- callback: this.onMouseOut
64483
- });
64484
- if (isMobileLikeMode(this._mode)) {
64485
- this._eventDispatcher.register('pointerdown', {
64486
- query: Object.assign(Object.assign({}, handler.query), { source: Event_Source_Type.chart }),
64487
- callback: this.onMouseMove
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());
64694
+ }
64695
+ }, () => {
64696
+ this._sortDataInAxisDomain();
64488
64697
  });
64489
64698
  }
64490
64699
  }
64491
- unregister() {
64492
- this._eventDispatcher.unregister('pointermove', {
64493
- query: null,
64494
- callback: this.onMouseMove
64495
- });
64496
- if (isMobileLikeMode(this._mode)) {
64497
- this._eventDispatcher.unregister('pointerdown', {
64498
- query: null,
64499
- callback: this.onMouseMove
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
+ }
64706
+ }
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);
64500
64723
  });
64501
64724
  }
64725
+ return fields;
64726
+ }
64727
+ reInit(spec) {
64728
+ if (this._positionXEncoder) {
64729
+ this._positionXEncoder = null;
64730
+ }
64731
+ if (this._positionYEncoder) {
64732
+ this._positionYEncoder = null;
64733
+ }
64734
+ super.reInit(spec);
64502
64735
  }
64503
64736
  }
64504
64737
 
64505
- var DimensionEventEnum;
64506
- (function (DimensionEventEnum) {
64507
- DimensionEventEnum["dimensionHover"] = "dimensionHover";
64508
- DimensionEventEnum["dimensionClick"] = "dimensionClick";
64509
- })(DimensionEventEnum || (DimensionEventEnum = {}));
64510
-
64511
64738
  const lineLikeSeriesMark = {
64512
64739
  ["point"]: { name: "point", type: "symbol" },
64513
64740
  ["line"]: { name: "line", type: "line" }
@@ -71207,116 +71434,6 @@ const registerDimensionHover = () => {
71207
71434
  Factory.registerInteractionTrigger(DimensionHover.type, DimensionHover);
71208
71435
  };
71209
71436
 
71210
- const registerDimensionEvents = () => {
71211
- Factory.registerComposedEvent(DimensionEventEnum.dimensionHover, DimensionHoverEvent);
71212
- Factory.registerComposedEvent(DimensionEventEnum.dimensionClick, DimensionClickEvent);
71213
- };
71214
-
71215
- const discreteXAxisGetDimensionField = (series) => series.fieldX[0];
71216
- const discreteYAxisGetDimensionField = (series) => series.fieldY[0];
71217
- const continuousXAxisGetDimensionField = (series) => {
71218
- var _a;
71219
- return [
71220
- series.fieldX[0],
71221
- (_a = series.fieldX2) !== null && _a !== void 0 ? _a : series.fieldX[1]
71222
- ];
71223
- };
71224
- const continuousYAxisGetDimensionField = (series) => {
71225
- var _a;
71226
- return [
71227
- series.fieldY[0],
71228
- (_a = series.fieldY2) !== null && _a !== void 0 ? _a : series.fieldY[1]
71229
- ];
71230
- };
71231
- const getDimensionFieldFunc = (isXAxis, isDiscreteAxis) => isXAxis
71232
- ? isDiscreteAxis
71233
- ? discreteXAxisGetDimensionField
71234
- : continuousXAxisGetDimensionField
71235
- : isDiscreteAxis
71236
- ? discreteYAxisGetDimensionField
71237
- : continuousYAxisGetDimensionField;
71238
- const getCartesianDimensionInfo = (chart, pos, isTooltip) => {
71239
- var _a, _b;
71240
- if (!chart) {
71241
- return null;
71242
- }
71243
- const { x, y } = pos;
71244
- const xAxisList = (_a = getAxis(chart, (cmp) => isXAxis(cmp.getOrient()), pos)) !== null && _a !== void 0 ? _a : [];
71245
- const yAxisList = (_b = getAxis(chart, (cmp) => isYAxis(cmp.getOrient()), pos)) !== null && _b !== void 0 ? _b : [];
71246
- if (!xAxisList.length && !yAxisList.length) {
71247
- return null;
71248
- }
71249
- const bandAxisSet = new Set();
71250
- const linearAxisSet = new Set();
71251
- const forceAxisSet = new Set();
71252
- [xAxisList, yAxisList].forEach(axisList => axisList.forEach(axis => {
71253
- const isDiscreteAxis = isDiscrete(axis.getScale().type);
71254
- if (isDiscreteAxis) {
71255
- bandAxisSet.add(axis);
71256
- }
71257
- else {
71258
- linearAxisSet.add(axis);
71259
- }
71260
- if (isTooltip && axis.getSpec().hasDimensionTooltip) {
71261
- forceAxisSet.add(axis);
71262
- }
71263
- }));
71264
- const targetAxisInfo = [];
71265
- const addAxisDimensionInfo = (orient) => {
71266
- const isXAxis = orient === 'x';
71267
- const posValue = isXAxis ? x : y;
71268
- const axisList = isXAxis ? xAxisList : yAxisList;
71269
- axisList.forEach(axis => {
71270
- if (forceAxisSet.size > 0) {
71271
- if (forceAxisSet.has(axis)) {
71272
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, isDiscrete(axis.getScale().type)));
71273
- info && targetAxisInfo.push(info);
71274
- }
71275
- }
71276
- else {
71277
- const hasDiscreteAxis = bandAxisSet.size > 0;
71278
- if ((hasDiscreteAxis ? bandAxisSet : linearAxisSet).has(axis)) {
71279
- const info = getDimensionInfoByPosition(axis, posValue, getDimensionFieldFunc(isXAxis, hasDiscreteAxis));
71280
- info && targetAxisInfo.push(info);
71281
- }
71282
- }
71283
- });
71284
- };
71285
- if (chart.getSpec().direction === "horizontal") {
71286
- addAxisDimensionInfo('y');
71287
- if (targetAxisInfo.length === 0) {
71288
- addAxisDimensionInfo('x');
71289
- }
71290
- }
71291
- else {
71292
- addAxisDimensionInfo('x');
71293
- if (targetAxisInfo.length === 0) {
71294
- addAxisDimensionInfo('y');
71295
- }
71296
- }
71297
- if (!targetAxisInfo.length) {
71298
- return null;
71299
- }
71300
- return targetAxisInfo;
71301
- };
71302
- const getDimensionInfoByPosition = (axis, posValue, getDimensionField) => {
71303
- const value = axis.positionToData(posValue, true);
71304
- return isNil$1(value) ? null : getDimensionInfoByValue(axis, value, getDimensionField);
71305
- };
71306
- const getDimensionInfoByValue = (axis, value, getDimensionField) => {
71307
- const scale = axis.getScale();
71308
- if (isNil$1(value)) {
71309
- return null;
71310
- }
71311
- const domain = scale.domain();
71312
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
71313
- if (index < 0) {
71314
- index = undefined;
71315
- }
71316
- const data = getDimensionData(value, axis, 'cartesian', getDimensionField !== null && getDimensionField !== void 0 ? getDimensionField : (isXAxis(axis.getOrient()) ? discreteXAxisGetDimensionField : discreteYAxisGetDimensionField));
71317
- return { index, value, position: scale.scale(value), axis, data };
71318
- };
71319
-
71320
71437
  const layoutByValue$1 = (stateByField, series, layoutStartPoint, enableRemain = false) => {
71321
71438
  if (!layoutStartPoint) {
71322
71439
  layoutStartPoint = { x: 0, y: 0 };
@@ -71762,6 +71879,9 @@ class BaseTooltipProcessor {
71762
71879
  }
71763
71880
  shouldHandleTooltip(params, info) {
71764
71881
  var _a, _b;
71882
+ if (!this.component.enable) {
71883
+ return false;
71884
+ }
71765
71885
  if (isNil$1(info)) {
71766
71886
  return false;
71767
71887
  }
@@ -93072,106 +93192,6 @@ class RoseChartSpecTransformer extends RoseLikeChartSpecTransformer {
93072
93192
  }
93073
93193
  }
93074
93194
 
93075
- const angleStandardize = (angle, range) => {
93076
- const unit = Math.PI * 2;
93077
- const min = minInArray(range);
93078
- const max = maxInArray(range);
93079
- if (angle < min) {
93080
- angle += Math.ceil((min - angle) / unit) * unit;
93081
- }
93082
- else if (angle > max) {
93083
- angle -= Math.ceil((angle - max) / unit) * unit;
93084
- }
93085
- return angle;
93086
- };
93087
- const getPolarDimensionInfo = (chart, pos) => {
93088
- if (!chart) {
93089
- return null;
93090
- }
93091
- const angleAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'angle', pos);
93092
- const radiusAxisList = getAxis(chart, (cmp) => cmp.getOrient() === 'radius', pos);
93093
- if ((!angleAxisList || !angleAxisList.length) && (!radiusAxisList || !radiusAxisList.length)) {
93094
- return null;
93095
- }
93096
- const targetAxisInfo = [];
93097
- const getDimensionField = (series) => series.getDimensionField()[0];
93098
- const { x, y } = pos;
93099
- if (angleAxisList) {
93100
- angleAxisList.forEach(axis => {
93101
- var _a;
93102
- const angleScale = axis.getScale();
93103
- if (angleScale && isDiscrete(angleScale.type)) {
93104
- const angleDomain = angleScale.domain();
93105
- const angleRange = angleScale.range();
93106
- const center = axis.getCenter();
93107
- const vector = {
93108
- x: x - axis.getLayoutStartPoint().x - center.x,
93109
- y: y - axis.getLayoutStartPoint().y - center.y
93110
- };
93111
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
93112
- angle = angleStandardize(angle, angleRange);
93113
- const radius = distance(vector);
93114
- const radiusScale = (_a = radiusAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93115
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93116
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93117
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93118
- return;
93119
- }
93120
- const value = axis.invert(angle);
93121
- if (isNil$1(value)) {
93122
- return;
93123
- }
93124
- let index = angleDomain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93125
- if (index < 0) {
93126
- index = undefined;
93127
- }
93128
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
93129
- targetAxisInfo.push({ index, value, position: angleScale.scale(value), axis, data });
93130
- }
93131
- });
93132
- }
93133
- if (radiusAxisList) {
93134
- radiusAxisList.forEach(axis => {
93135
- var _a;
93136
- const radiusScale = axis.getScale();
93137
- const radiusRange = radiusScale === null || radiusScale === void 0 ? void 0 : radiusScale.range();
93138
- if (radiusScale && isDiscrete(radiusScale.type)) {
93139
- const center = axis.getCenter();
93140
- const vector = {
93141
- x: x - axis.getLayoutStartPoint().x - center.x,
93142
- y: y - axis.getLayoutStartPoint().y - center.y
93143
- };
93144
- let angle = vectorAngle({ x: 1, y: 0 }, vector);
93145
- if (angle < -Math.PI / 2) {
93146
- angle = Math.PI * 2 + angle;
93147
- }
93148
- const radius = distance(vector);
93149
- const angleScale = (_a = angleAxisList[0]) === null || _a === void 0 ? void 0 : _a.getScale();
93150
- const angleRange = angleScale === null || angleScale === void 0 ? void 0 : angleScale.range();
93151
- if ((angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[0])) * (angle - (angleRange === null || angleRange === void 0 ? void 0 : angleRange[1])) > 0 ||
93152
- (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[0])) * (radius - (radiusRange === null || radiusRange === void 0 ? void 0 : radiusRange[1])) > 0) {
93153
- return;
93154
- }
93155
- const value = radiusScale.invert(radius);
93156
- if (isNil$1(value)) {
93157
- return;
93158
- }
93159
- const domain = radiusScale.domain();
93160
- let index = domain.findIndex((v) => (v === null || v === void 0 ? void 0 : v.toString()) === value.toString());
93161
- if (index < 0) {
93162
- index = undefined;
93163
- }
93164
- const data = getDimensionData(value, axis, 'polar', getDimensionField);
93165
- targetAxisInfo.push({ index, value, position: radiusScale.scale(value), axis, data });
93166
- }
93167
- });
93168
- }
93169
- if (!targetAxisInfo.length) {
93170
- return null;
93171
- }
93172
- return targetAxisInfo;
93173
- };
93174
-
93175
93195
  class RoseChart extends BaseChart {
93176
93196
  constructor() {
93177
93197
  super(...arguments);
@@ -96059,6 +96079,7 @@ class Tooltip extends BaseComponent {
96059
96079
  this.specKey = 'tooltip';
96060
96080
  this.layoutType = 'none';
96061
96081
  this._isReleased = false;
96082
+ this.enable = true;
96062
96083
  this._alwaysShow = false;
96063
96084
  this._eventList = [];
96064
96085
  this._isTooltipShown = false;
@@ -103230,10 +103251,16 @@ class Brush extends BaseComponent {
103230
103251
  this._emitEvent(ChartEvent.brushActive, region, e);
103231
103252
  });
103232
103253
  brush.addEventListener(IOperateType.drawStart, (e) => {
103254
+ if (this._spec.disableDimensionHoverWhenBrushing) {
103255
+ this._option.globalInstance.disableDimensionHoverEvent(true);
103256
+ }
103233
103257
  this._setRegionMarkPickable(region, true);
103234
103258
  this._emitEvent(ChartEvent.brushStart, region, e);
103235
103259
  });
103236
103260
  brush.addEventListener(IOperateType.moveStart, (e) => {
103261
+ if (this._spec.disableDimensionHoverWhenBrushing) {
103262
+ this._option.globalInstance.disableDimensionHoverEvent(true);
103263
+ }
103237
103264
  this._setRegionMarkPickable(region, true);
103238
103265
  this._emitEvent(ChartEvent.brushStart, region, e);
103239
103266
  });
@@ -103248,12 +103275,18 @@ class Brush extends BaseComponent {
103248
103275
  this._emitEvent(ChartEvent.brushChange, region, e);
103249
103276
  });
103250
103277
  brush.addEventListener(IOperateType.brushClear, (e) => {
103278
+ if (this._spec.disableDimensionHoverWhenBrushing) {
103279
+ this._option.globalInstance.disableDimensionHoverEvent(false);
103280
+ }
103251
103281
  this._setRegionMarkPickable(region, true);
103252
103282
  this._initMarkBrushState(componentIndex, '');
103253
103283
  this._emitEvent(ChartEvent.brushClear, region, e);
103254
103284
  });
103255
103285
  brush.addEventListener(IOperateType.drawEnd, (e) => {
103256
103286
  var _a;
103287
+ if (this._spec.disableDimensionHoverWhenBrushing) {
103288
+ this._option.globalInstance.disableDimensionHoverEvent(false);
103289
+ }
103257
103290
  this._setRegionMarkPickable(region, true);
103258
103291
  const { operateMask } = e.detail;
103259
103292
  const { updateElementsState = true } = this._spec;
@@ -103277,6 +103310,9 @@ class Brush extends BaseComponent {
103277
103310
  }
103278
103311
  });
103279
103312
  brush.addEventListener(IOperateType.moveEnd, (e) => {
103313
+ if (this._spec.disableDimensionHoverWhenBrushing) {
103314
+ this._option.globalInstance.disableDimensionHoverEvent(false);
103315
+ }
103280
103316
  this._setRegionMarkPickable(region, true);
103281
103317
  const { operateMask } = e.detail;
103282
103318
  const { updateElementsState = true } = this._spec;
@@ -103622,6 +103658,12 @@ class Brush extends BaseComponent {
103622
103658
  this._brushComponents = null;
103623
103659
  }
103624
103660
  }
103661
+ clearBrushStateAndMask() {
103662
+ this._relativeRegions.forEach((region, componentIndex) => {
103663
+ this._initMarkBrushState(componentIndex, '');
103664
+ this._brushComponents[componentIndex].children[0].removeAllChild();
103665
+ });
103666
+ }
103625
103667
  }
103626
103668
  Brush.type = ComponentTypeEnum.brush;
103627
103669
  Brush.builtInTheme = {