(seriesModel, graph, nodeData, r, cx, cy, count)
| 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 | |
| 193 | export function rotateNodeLabel( |
no test coverage detected
searching dependent graphs…