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

Method _showIndicator

src/component/visualMap/ContinuousView.ts:648–733  ·  view source on GitHub ↗
(
        cursorValue: number,
        textValue: number,
        rangeSymbol?: string,
        halfHoverLinkSize?: number
    )

Source from the content-addressed store, hash-verified

646 }
647
648 private _showIndicator(
649 cursorValue: number,
650 textValue: number,
651 rangeSymbol?: string,
652 halfHoverLinkSize?: number
653 ) {
654 const visualMapModel = this.visualMapModel;
655 const dataExtent = visualMapModel.getExtent();
656 const itemSize = visualMapModel.itemSize;
657 const sizeExtent = [0, itemSize[1]];
658
659 const shapes = this._shapes;
660 const indicator = shapes.indicator;
661 if (!indicator) {
662 return;
663 }
664
665 indicator.attr('invisible', false);
666
667 const opts = {convertOpacityToAlpha: true};
668 const color = this.getControllerVisual(cursorValue, 'color', opts) as ColorString;
669 const symbolSize = this.getControllerVisual(cursorValue, 'symbolSize') as number;
670 const y = linearMap(cursorValue, dataExtent, sizeExtent, true);
671 const x = itemSize[0] - symbolSize / 2;
672
673 const oldIndicatorPos = { x: indicator.x, y: indicator.y };
674 // Update handle label position.
675 indicator.y = y;
676 indicator.x = x;
677 const textPoint = graphic.applyTransform(
678 shapes.indicatorLabelPoint,
679 graphic.getTransform(indicator, this.group)
680 );
681
682 const indicatorLabel = shapes.indicatorLabel;
683 indicatorLabel.attr('invisible', false);
684 const align = this._applyTransform('left', shapes.mainGroup);
685 const orient = this._orient;
686 const isHorizontal = orient === 'horizontal';
687 indicatorLabel.setStyle({
688 text: (rangeSymbol ? rangeSymbol : '') + visualMapModel.formatValueText(textValue),
689 verticalAlign: isHorizontal ? align as TextVerticalAlign : 'middle',
690 align: isHorizontal ? 'center' : align as TextAlign
691 });
692
693 const indicatorNewProps = {
694 x: x,
695 y: y,
696 style: {
697 fill: color
698 }
699 };
700 const labelNewProps = {
701 style: {
702 x: textPoint[0],
703 y: textPoint[1]
704 }
705 };

Callers 2

_doHoverLinkToSeriesMethod · 0.95

Calls 9

_applyTransformMethod · 0.95
getControllerVisualMethod · 0.80
getTransformMethod · 0.80
setStyleMethod · 0.80
formatValueTextMethod · 0.80
enterBlurMethod · 0.80
getExtentMethod · 0.65
linearMapFunction · 0.50
isAnimationEnabledMethod · 0.45

Tested by

no test coverage detected