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

Method _renderEndsText

src/component/visualMap/ContinuousView.ts:162–201  ·  view source on GitHub ↗
(group: graphic.Group, dataRangeText: string[], endsIndex?: 0 | 1)

Source from the content-addressed store, hash-verified

160 }
161
162 private _renderEndsText(group: graphic.Group, dataRangeText: string[], endsIndex?: 0 | 1) {
163 if (!dataRangeText) {
164 return;
165 }
166
167 // Compatible with ec2, text[0] map to high value, text[1] map low value.
168 let text = dataRangeText[1 - endsIndex];
169 text = text != null ? text + '' : '';
170
171 const visualMapModel = this.visualMapModel;
172 const textGap = visualMapModel.get('textGap');
173 const itemSize = visualMapModel.itemSize;
174
175 const barGroup = this._shapes.mainGroup;
176 const position = this._applyTransform(
177 [
178 itemSize[0] / 2,
179 endsIndex === 0 ? -textGap : itemSize[1] + textGap
180 ],
181 barGroup
182 ) as number[];
183 const align = this._applyTransform(
184 endsIndex === 0 ? 'bottom' : 'top',
185 barGroup
186 );
187 const orient = this._orient;
188 const textStyleModel = this.visualMapModel.textStyleModel;
189
190 this.group.add(new graphic.Text({
191 style: createTextStyle(textStyleModel, {
192 x: position[0],
193 y: position[1],
194 verticalAlign: textStyleModel.get('verticalAlign')
195 || (orient === 'horizontal' ? 'middle' : align as TextVerticalAlign),
196 align: textStyleModel.get('align')
197 || (orient === 'horizontal' ? align as TextAlign : 'center'),
198 text
199 })
200 }));
201 }
202
203 private _renderBar(targetGroup: graphic.Group) {
204 const visualMapModel = this.visualMapModel;

Callers 1

_buildViewMethod · 0.95

Calls 4

_applyTransformMethod · 0.95
createTextStyleFunction · 0.90
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected