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

Method _renderBar

src/component/visualMap/ContinuousView.ts:203–251  ·  view source on GitHub ↗
(targetGroup: graphic.Group)

Source from the content-addressed store, hash-verified

201 }
202
203 private _renderBar(targetGroup: graphic.Group) {
204 const visualMapModel = this.visualMapModel;
205 const shapes = this._shapes;
206 const itemSize = visualMapModel.itemSize;
207 const orient = this._orient;
208 const useHandle = this._useHandle;
209 const itemAlign = helper.getItemAlign(visualMapModel, this.api, itemSize);
210 const mainGroup = shapes.mainGroup = this._createBarGroup(itemAlign);
211
212 const gradientBarGroup = new graphic.Group();
213 mainGroup.add(gradientBarGroup);
214
215 // Bar
216 gradientBarGroup.add(shapes.outOfRange = createPolygon());
217 gradientBarGroup.add(shapes.inRange = createPolygon(
218 null,
219 useHandle ? getCursor(this._orient) : null,
220 zrUtil.bind(this._dragHandle, this, 'all', false),
221 zrUtil.bind(this._dragHandle, this, 'all', true)
222 ));
223
224 // A border radius clip.
225 gradientBarGroup.setClipPath(new graphic.Rect({
226 shape: {
227 x: 0,
228 y: 0,
229 width: itemSize[0],
230 height: itemSize[1],
231 r: 3
232 }
233 }));
234
235 const textRect = visualMapModel.textStyleModel.getTextRect('国');
236 const textSize = mathMax(textRect.width, textRect.height);
237
238 // Handle
239 if (useHandle) {
240 shapes.handleThumbs = [];
241 shapes.handleLabels = [];
242 shapes.handleLabelPoints = [];
243
244 this._createHandle(visualMapModel, mainGroup, 0, itemSize, textSize, orient);
245 this._createHandle(visualMapModel, mainGroup, 1, itemSize, textSize, orient);
246 }
247
248 this._createIndicator(visualMapModel, mainGroup, itemSize, textSize, orient);
249
250 targetGroup.add(mainGroup);
251 }
252
253 private _createHandle(
254 visualMapModel: ContinuousModel,

Callers 1

_buildViewMethod · 0.95

Calls 7

_createBarGroupMethod · 0.95
_createHandleMethod · 0.95
_createIndicatorMethod · 0.95
createPolygonFunction · 0.85
getTextRectMethod · 0.80
getCursorFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected