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

Function symbolSize

src/chart/graph/circularLayoutHelper.ts:150–190  ·  view source on GitHub ↗
(seriesModel, graph, nodeData, r, cx, cy, count)

Source from the content-addressed store, hash-verified

148 },
149
150 symbolSize(seriesModel, graph, nodeData, r, cx, cy, count) {
151 let sumRadian = 0;
152 _symbolRadiansHalf.length = count;
153
154 const nodeScale = getNodeGlobalScale(seriesModel);
155
156 graph.eachNode(function (node) {
157 let symbolSize = getSymbolSize(node);
158
159 // Normally this case will not happen, but we still add
160 // some the defensive code (2px is an arbitrary value).
161 isNaN(symbolSize) && (symbolSize = 2);
162 symbolSize < 0 && (symbolSize = 0);
163
164 symbolSize *= nodeScale;
165
166 let symbolRadianHalf = Math.asin(symbolSize / 2 / r);
167 // when `symbolSize / 2` is bigger than `r`.
168 isNaN(symbolRadianHalf) && (symbolRadianHalf = PI / 2);
169 _symbolRadiansHalf[node.dataIndex] = symbolRadianHalf;
170 sumRadian += symbolRadianHalf * 2;
171 });
172
173 const halfRemainRadian = (2 * PI - sumRadian) / count / 2;
174
175 let angle = 0;
176 graph.eachNode(function (node) {
177 const radianHalf = halfRemainRadian + _symbolRadiansHalf[node.dataIndex];
178
179 angle += radianHalf;
180 // init circular layout for
181 // 1. layout undefined node
182 // 2. not fixed node
183 (!node.getLayout() || !node.getLayout().fixed)
184 && node.setLayout([
185 r * Math.cos(angle) + cx,
186 r * Math.sin(angle) + cy
187 ]);
188 angle += radianHalf;
189 });
190 }
191};
192
193export function rotateNodeLabel(

Callers 1

renderSeriesMethod · 0.85

Calls 5

getNodeGlobalScaleFunction · 0.90
getSymbolSizeFunction · 0.90
getLayoutMethod · 0.65
setLayoutMethod · 0.65
eachNodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…