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

Function createPolarClipPath

src/chart/helper/createClipPathFromCoordSys.ts:109–149  ·  view source on GitHub ↗
(
    polar: Polar,
    hasAnimation: boolean,
    seriesModel: SeriesModelWithLineWidth
)

Source from the content-addressed store, hash-verified

107}
108
109export function createPolarClipPath(
110 polar: Polar,
111 hasAnimation: boolean,
112 seriesModel: SeriesModelWithLineWidth
113) {
114 const sectorArea = polar.getArea();
115 // Avoid float number rounding error for symbol on the edge of axis extent.
116
117 const r0 = round(sectorArea.r0, 1);
118 const r = round(sectorArea.r, 1);
119 const clipPath = new graphic.Sector({
120 shape: {
121 cx: round(polar.cx, 1),
122 cy: round(polar.cy, 1),
123 r0: r0,
124 r: r,
125 startAngle: sectorArea.startAngle,
126 endAngle: sectorArea.endAngle,
127 clockwise: sectorArea.clockwise
128 }
129 });
130
131 if (hasAnimation) {
132 const isRadial = polar.getBaseAxis().dim === 'angle';
133
134 if (isRadial) {
135 clipPath.shape.endAngle = sectorArea.startAngle;
136 }
137 else {
138 clipPath.shape.r = r0;
139 }
140
141 graphic.initProps(clipPath, {
142 shape: {
143 endAngle: sectorArea.endAngle,
144 r: r
145 }
146 }, seriesModel);
147 }
148 return clipPath;
149}
150
151export function createClipPath(
152 coordSys: CoordinateSystem,

Callers 2

createLineClipPathFunction · 0.90
createClipPathFunction · 0.85

Calls 3

roundFunction · 0.90
getBaseAxisMethod · 0.65
getAreaMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…