(
e: TryShowParams,
dispatchAction: ExtensionAPI['dispatchAction']
)
| 451 | } |
| 452 | |
| 453 | private _tryShow( |
| 454 | e: TryShowParams, |
| 455 | dispatchAction: ExtensionAPI['dispatchAction'] |
| 456 | ) { |
| 457 | const el = e.target; |
| 458 | const tooltipModel = this._tooltipModel; |
| 459 | if (!tooltipModel) { |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | // Save mouse x, mouse y. So we can try to keep showing the tip if chart is refreshed |
| 464 | this._lastX = e.offsetX; |
| 465 | this._lastY = e.offsetY; |
| 466 | |
| 467 | const dataByCoordSys = e.dataByCoordSys; |
| 468 | if (dataByCoordSys && dataByCoordSys.length) { |
| 469 | this._showAxisTooltip(dataByCoordSys, e); |
| 470 | } |
| 471 | else if (el) { |
| 472 | const ecData = getECData(el); |
| 473 | if (ecData.ssrType === 'legend') { |
| 474 | // Don't trigger tooltip for legend tooltip item |
| 475 | return; |
| 476 | } |
| 477 | this._lastDataByCoordSys = null; |
| 478 | this._cbParamsList = null; |
| 479 | |
| 480 | let seriesDispatcher: Element; |
| 481 | let cmptDispatcher: Element; |
| 482 | findEventDispatcher(el, function (target) { |
| 483 | if ((target as ECElement).tooltipDisabled) { |
| 484 | seriesDispatcher = cmptDispatcher = null; |
| 485 | return true; |
| 486 | } |
| 487 | if (seriesDispatcher || cmptDispatcher) { |
| 488 | return; |
| 489 | } |
| 490 | // Always show item tooltip if mouse is on the element with dataIndex |
| 491 | if (getECData(target).dataIndex != null) { |
| 492 | seriesDispatcher = target; |
| 493 | } |
| 494 | // Tooltip provided directly. Like legend. |
| 495 | else if (getECData(target).tooltipConfig != null) { |
| 496 | cmptDispatcher = target; |
| 497 | } |
| 498 | }, true); |
| 499 | |
| 500 | if (seriesDispatcher) { |
| 501 | this._showSeriesItemTooltip(e, seriesDispatcher, dispatchAction); |
| 502 | } |
| 503 | else if (cmptDispatcher) { |
| 504 | this._showComponentItemTooltip(e, cmptDispatcher, dispatchAction); |
| 505 | } |
| 506 | else { |
| 507 | this._hide(dispatchAction); |
| 508 | } |
| 509 | } |
| 510 | else { |
no test coverage detected