(
dataByCoordSys: DataByCoordSys[],
e: TryShowParams
)
| 531 | } |
| 532 | |
| 533 | private _showAxisTooltip( |
| 534 | dataByCoordSys: DataByCoordSys[], |
| 535 | e: TryShowParams |
| 536 | ) { |
| 537 | const ecModel = this._ecModel; |
| 538 | const globalTooltipModel = this._tooltipModel; |
| 539 | const point = [e.offsetX, e.offsetY]; |
| 540 | const singleTooltipModel = buildTooltipModel( |
| 541 | [e.tooltipOption], |
| 542 | globalTooltipModel |
| 543 | ); |
| 544 | const renderMode = this._renderMode; |
| 545 | const cbParamsList: TooltipCallbackDataParams[] = []; |
| 546 | const articleMarkup = createTooltipMarkup('section', { |
| 547 | blocks: [], |
| 548 | noHeader: true |
| 549 | }); |
| 550 | // Only for legacy: `Serise['formatTooltip']` returns a string. |
| 551 | const markupTextArrLegacy: string[] = []; |
| 552 | const markupStyleCreator = new TooltipMarkupStyleCreator(); |
| 553 | |
| 554 | each(dataByCoordSys, function (itemCoordSys) { |
| 555 | each(itemCoordSys.dataByAxis, function (axisItem) { |
| 556 | const axisModel = ecModel.getComponent(axisItem.axisDim + 'Axis', axisItem.axisIndex) as AxisBaseModel; |
| 557 | const axisValue = axisItem.value; |
| 558 | const axis = axisModel.axis; |
| 559 | const axisValueParsed = axis.scale.parse(axisValue); |
| 560 | if (!axisModel || axisValue == null) { |
| 561 | return; |
| 562 | } |
| 563 | // FIXME: when using `tooltip.trigger: 'axis'`, the precision of the axis value displayed in tooltip |
| 564 | // should match the original series values rather than using the default strategy in Interval.ts |
| 565 | // (getPrecision(interval) + 2); otherwise it may cause confusion. |
| 566 | const axisValueLabel = axisPointerViewHelper.getValueLabel( |
| 567 | axisValue, axis, ecModel, |
| 568 | axisItem.seriesDataIndices, |
| 569 | axisItem.valueLabelOpt |
| 570 | ); |
| 571 | const axisSectionMarkup = createTooltipMarkup('section', { |
| 572 | header: axisValueLabel, |
| 573 | noHeader: !trim(axisValueLabel), |
| 574 | sortBlocks: true, |
| 575 | blocks: [] |
| 576 | }); |
| 577 | articleMarkup.blocks.push(axisSectionMarkup); |
| 578 | |
| 579 | each(axisItem.seriesDataIndices, function (idxItem) { |
| 580 | const series = ecModel.getSeriesByIndex(idxItem.seriesIndex); |
| 581 | const dataIndex = idxItem.dataIndexInside; |
| 582 | const cbParams = series.getDataParams(dataIndex) as TooltipCallbackDataParams; |
| 583 | // Can't find data. |
| 584 | if (cbParams.dataIndex < 0) { |
| 585 | return; |
| 586 | } |
| 587 | |
| 588 | cbParams.axisDim = axisItem.axisDim; |
| 589 | cbParams.axisIndex = axisItem.axisIndex; |
| 590 | cbParams.axisType = axisItem.axisType; |
no test coverage detected