MCPcopy
hub / github.com/apache/echarts / doRender

Method doRender

src/component/visualMap/PiecewiseView.ts:39–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 visualMapModel: PiecewiseModel;
38
39 protected doRender() {
40 const thisGroup = this.group;
41
42 thisGroup.removeAll();
43
44 const visualMapModel = this.visualMapModel;
45 const textGap = visualMapModel.get('textGap');
46 const textStyleModel = visualMapModel.textStyleModel;
47 const itemAlign = this._getItemAlign();
48 const itemSize = visualMapModel.itemSize;
49 const viewData = this._getViewData();
50 const endsText = viewData.endsText;
51 const showLabel = zrUtil.retrieve(visualMapModel.get('showLabel', true), !endsText);
52 const silent = !visualMapModel.get('selectedMode');
53
54 endsText && this._renderEndsText(
55 thisGroup, endsText[0], itemSize, showLabel, itemAlign
56 );
57
58 zrUtil.each(viewData.viewPieceList, function (item: typeof viewData.viewPieceList[number]) {
59 const piece = item.piece;
60
61 const itemGroup = new graphic.Group();
62 itemGroup.onclick = zrUtil.bind(this._onItemClick, this, piece);
63
64 this._enableHoverLink(itemGroup, item.indexInModelPieceList);
65
66 // TODO Category
67 const representValue = visualMapModel.getRepresentValue(piece) as number;
68
69 this._createItemSymbol(
70 itemGroup, representValue, [0, 0, itemSize[0], itemSize[1]], silent
71 );
72
73 if (showLabel) {
74 const visualState = this.visualMapModel.getValueState(representValue);
75 const align = textStyleModel.get('align') || itemAlign as TextAlign;
76 itemGroup.add(new graphic.Text({
77 style: createTextStyle(textStyleModel, {
78 x: align === 'right' ? -textGap : itemSize[0] + textGap,
79 y: itemSize[1] / 2,
80 text: piece.text,
81 verticalAlign: textStyleModel.get('verticalAlign') || 'middle',
82 align,
83 opacity: zrUtil.retrieve2(
84 textStyleModel.get('opacity'),
85 visualState === 'outOfRange' ? 0.5 : 1
86 ),
87 }),
88 silent
89 }));
90 }
91
92 thisGroup.add(itemGroup);
93 }, this);
94
95 endsText && this._renderEndsText(
96 thisGroup, endsText[1], itemSize, showLabel, itemAlign

Callers

nothing calls this directly

Calls 13

_getItemAlignMethod · 0.95
_getViewDataMethod · 0.95
_renderEndsTextMethod · 0.95
_enableHoverLinkMethod · 0.95
_createItemSymbolMethod · 0.95
createTextStyleFunction · 0.90
getRepresentValueMethod · 0.80
renderBackgroundMethod · 0.80
positionGroupMethod · 0.80
getMethod · 0.45
eachMethod · 0.45
getValueStateMethod · 0.45

Tested by

no test coverage detected