(seriesModel: PieSeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload: Payload)
| 238 | private _emptyCircleSector: graphic.Sector; |
| 239 | |
| 240 | render(seriesModel: PieSeriesModel, ecModel: GlobalModel, api: ExtensionAPI, payload: Payload): void { |
| 241 | const data = seriesModel.getData(); |
| 242 | |
| 243 | const oldData = this._data; |
| 244 | const group = this.group; |
| 245 | |
| 246 | let startAngle: number; |
| 247 | // First render |
| 248 | if (!oldData && data.count() > 0) { |
| 249 | let shape = data.getItemLayout(0) as graphic.Sector['shape']; |
| 250 | for (let s = 1; isNaN(shape && shape.startAngle) && s < data.count(); ++s) { |
| 251 | shape = data.getItemLayout(s); |
| 252 | } |
| 253 | if (shape) { |
| 254 | startAngle = shape.startAngle; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | // remove empty-circle if it exists |
| 259 | if (this._emptyCircleSector) { |
| 260 | group.remove(this._emptyCircleSector); |
| 261 | } |
| 262 | // when all data are filtered, show lightgray empty circle |
| 263 | if (data.count() === 0 && seriesModel.get('showEmptyCircle')) { |
| 264 | const layoutData = getSeriesLayoutData(seriesModel); |
| 265 | const sector = new graphic.Sector({ |
| 266 | shape: clone(layoutData) |
| 267 | }); |
| 268 | sector.useStyle(seriesModel.getModel('emptyCircleStyle').getItemStyle()); |
| 269 | this._emptyCircleSector = sector; |
| 270 | group.add(sector); |
| 271 | } |
| 272 | |
| 273 | data.diff(oldData) |
| 274 | .add(function (idx) { |
| 275 | const piePiece = new PiePiece(data, idx, startAngle); |
| 276 | |
| 277 | data.setItemGraphicEl(idx, piePiece); |
| 278 | |
| 279 | group.add(piePiece); |
| 280 | }) |
| 281 | .update(function (newIdx, oldIdx) { |
| 282 | const piePiece = oldData.getItemGraphicEl(oldIdx) as PiePiece; |
| 283 | |
| 284 | piePiece.updateData(data, newIdx, startAngle); |
| 285 | |
| 286 | piePiece.off('click'); |
| 287 | |
| 288 | group.add(piePiece); |
| 289 | data.setItemGraphicEl(newIdx, piePiece); |
| 290 | }) |
| 291 | .remove(function (idx) { |
| 292 | const piePiece = oldData.getItemGraphicEl(idx); |
| 293 | graphic.removeElementWithFadeOut(piePiece, seriesModel, idx); |
| 294 | }) |
| 295 | .execute(); |
| 296 | |
| 297 | labelLayout(seriesModel); |
nothing calls this directly
no test coverage detected