(
seriesModel: SeriesModel<TOption>,
api: ExtensionAPI
)
| 187 | }>; |
| 188 | |
| 189 | function getViewRectAndCenterForCircleLayout<TOption extends CircleLayoutSeriesOption>( |
| 190 | seriesModel: SeriesModel<TOption>, |
| 191 | api: ExtensionAPI |
| 192 | ) { |
| 193 | const layoutRef = createBoxLayoutReference(seriesModel, api, { |
| 194 | enableLayoutOnlyByCenter: true, |
| 195 | }); |
| 196 | const boxLayoutParams = seriesModel.getBoxLayoutParams(); |
| 197 | |
| 198 | let viewRect: LayoutRect; |
| 199 | let center: number[]; |
| 200 | if (layoutRef.type === BoxLayoutReferenceType.point) { |
| 201 | center = layoutRef.refPoint; |
| 202 | // `viewRect` is required in `pie/labelLayout.ts`. |
| 203 | viewRect = getLayoutRect( |
| 204 | boxLayoutParams, {width: api.getWidth(), height: api.getHeight()} |
| 205 | ); |
| 206 | } |
| 207 | else { // layoutRef.type === layout.BoxLayoutReferenceType.rect |
| 208 | const centerOption = seriesModel.get('center'); |
| 209 | const centerOptionArr = zrUtil.isArray(centerOption) |
| 210 | ? centerOption : [centerOption, centerOption]; |
| 211 | viewRect = getLayoutRect( |
| 212 | boxLayoutParams, layoutRef.refContainer |
| 213 | ); |
| 214 | center = layoutRef.boxCoordFrom === BOX_COORD_SYS_COORD_FROM_PROP_COORD2 |
| 215 | ? layoutRef.refPoint // option `series.center` has been used as coord. |
| 216 | : [ |
| 217 | parsePercent(centerOptionArr[0], viewRect.width) + viewRect.x, |
| 218 | parsePercent(centerOptionArr[1], viewRect.height) + viewRect.y, |
| 219 | ]; |
| 220 | } |
| 221 | |
| 222 | return {viewRect, center}; |
| 223 | } |
| 224 | |
| 225 | export function getCircleLayout<TOption extends CircleLayoutSeriesOption>( |
| 226 | seriesModel: SeriesModel<TOption>, |
no test coverage detected
searching dependent graphs…