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

Method _createIndicator

src/component/visualMap/ContinuousView.ts:328–386  ·  view source on GitHub ↗
(
        visualMapModel: ContinuousModel,
        mainGroup: graphic.Group,
        itemSize: number[],
        textSize: number,
        orient: Orient
    )

Source from the content-addressed store, hash-verified

326 }
327
328 private _createIndicator(
329 visualMapModel: ContinuousModel,
330 mainGroup: graphic.Group,
331 itemSize: number[],
332 textSize: number,
333 orient: Orient
334 ) {
335 const scale = parsePercent(visualMapModel.get('indicatorSize'), itemSize[0]);
336 const indicator = createSymbol(
337 visualMapModel.get('indicatorIcon'),
338 -scale / 2, -scale / 2, scale, scale,
339 null, true
340 );
341 indicator.attr({
342 cursor: 'move',
343 invisible: true,
344 silent: true,
345 x: itemSize[0] / 2
346 });
347 const indicatorStyle = visualMapModel.getModel('indicatorStyle').getItemStyle();
348 if (indicator instanceof ZRImage) {
349 const pathStyle = indicator.style;
350 indicator.useStyle(zrUtil.extend({
351 // TODO other properties like x, y ?
352 image: pathStyle.image,
353 x: pathStyle.x, y: pathStyle.y,
354 width: pathStyle.width, height: pathStyle.height
355 }, indicatorStyle));
356 }
357 else {
358 indicator.useStyle(indicatorStyle);
359 }
360
361 mainGroup.add(indicator);
362
363 const textStyleModel = this.visualMapModel.textStyleModel;
364 const indicatorLabel = new graphic.Text({
365 silent: true,
366 invisible: true,
367 style: createTextStyle(textStyleModel, {
368 x: 0,
369 y: 0,
370 text: ''
371 })
372 });
373 this.group.add(indicatorLabel);
374
375 const indicatorLabelPoint = [
376 (orient === 'horizontal' ? textSize / 2 : HOVER_LINK_OUT) + itemSize[0] / 2,
377 0
378 ];
379
380 const shapes = this._shapes;
381 shapes.indicator = indicator;
382 shapes.indicatorLabel = indicatorLabel;
383 shapes.indicatorLabelPoint = indicatorLabelPoint;
384
385 this._firstShowIndicator = true;

Callers 1

_renderBarMethod · 0.95

Calls 6

createSymbolFunction · 0.90
createTextStyleFunction · 0.90
getItemStyleMethod · 0.80
getMethod · 0.45
getModelMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected