MCPcopy Index your code
hub / github.com/apache/echarts / _tryShow

Method _tryShow

src/component/tooltip/TooltipView.ts:453–515  ·  view source on GitHub ↗
(
        e: TryShowParams,
        dispatchAction: ExtensionAPI['dispatchAction']
    )

Source from the content-addressed store, hash-verified

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 {

Callers 2

_initGlobalListenerMethod · 0.95
manuallyShowTipMethod · 0.95

Calls 5

_showAxisTooltipMethod · 0.95
_hideMethod · 0.95
findEventDispatcherFunction · 0.90

Tested by

no test coverage detected