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

Method _initSymbolLabelAnimation

src/chart/line/LineView.ts:1078–1177  ·  view source on GitHub ↗
(
        data: SeriesData,
        coordSys: Polar | Cartesian2D,
        clipShape: PolarArea | Cartesian2DArea
    )

Source from the content-addressed store, hash-verified

1076 }
1077
1078 _initSymbolLabelAnimation(
1079 data: SeriesData,
1080 coordSys: Polar | Cartesian2D,
1081 clipShape: PolarArea | Cartesian2DArea
1082 ) {
1083 let isHorizontalOrRadial: boolean;
1084 let isCoordSysPolar: boolean;
1085 const baseAxis = coordSys.getBaseAxis();
1086 const isAxisInverse = baseAxis.inverse;
1087 if (coordSys.type === 'cartesian2d') {
1088 isHorizontalOrRadial = (baseAxis as Axis2D).isHorizontal();
1089 isCoordSysPolar = false;
1090 }
1091 else if (coordSys.type === 'polar') {
1092 isHorizontalOrRadial = baseAxis.dim === 'angle';
1093 isCoordSysPolar = true;
1094 }
1095
1096 const seriesModel = data.hostModel;
1097 let seriesDuration = seriesModel.get('animationDuration');
1098 if (zrUtil.isFunction(seriesDuration)) {
1099 seriesDuration = seriesDuration(null);
1100 }
1101 const seriesDelay = seriesModel.get('animationDelay') || 0;
1102 const seriesDelayValue = zrUtil.isFunction(seriesDelay)
1103 ? seriesDelay(null)
1104 : seriesDelay;
1105
1106 data.eachItemGraphicEl(function (symbol: SymbolExtended, idx) {
1107 const el = symbol;
1108 if (el) {
1109 const point = [symbol.x, symbol.y];
1110 let start;
1111 let end;
1112 let current;
1113 if (clipShape) {
1114 if (isCoordSysPolar) {
1115 const polarClip = clipShape as PolarArea;
1116 const coord = (coordSys as Polar).pointToCoord(point);
1117 if (isHorizontalOrRadial) {
1118 start = polarClip.startAngle;
1119 end = polarClip.endAngle;
1120 current = -coord[1] / 180 * Math.PI;
1121 }
1122 else {
1123 start = polarClip.r0;
1124 end = polarClip.r;
1125 current = coord[0];
1126 }
1127 }
1128 else {
1129 const gridClip = clipShape as Cartesian2DArea;
1130 if (isHorizontalOrRadial) {
1131 start = gridClip.x;
1132 end = gridClip.x + gridClip.width;
1133 current = symbol.x;
1134 }
1135 else {

Callers 1

renderMethod · 0.95

Calls 6

eachItemGraphicElMethod · 0.80
pointToCoordMethod · 0.80
getSymbolPathMethod · 0.80
getBaseAxisMethod · 0.65
isHorizontalMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected