(
lineView: LineView,
coordSys: Cartesian2D | Polar,
hasAnimation: boolean,
seriesModel: LineSeriesModel
)
| 508 | } |
| 509 | |
| 510 | function createLineClipPath( |
| 511 | lineView: LineView, |
| 512 | coordSys: Cartesian2D | Polar, |
| 513 | hasAnimation: boolean, |
| 514 | seriesModel: LineSeriesModel |
| 515 | ) { |
| 516 | if (isCoordinateSystemType<Cartesian2D>(coordSys, 'cartesian2d')) { |
| 517 | const endLabelModel = seriesModel.getModel('endLabel'); |
| 518 | const valueAnimation = endLabelModel.get('valueAnimation'); |
| 519 | const data = seriesModel.getData(); |
| 520 | |
| 521 | const labelAnimationRecord: EndLabelAnimationRecord = { lastFrameIndex: 0 }; |
| 522 | |
| 523 | const during = anyStateShowEndLabel(seriesModel) |
| 524 | ? (percent: number, clipRect: graphic.Rect) => { |
| 525 | lineView._endLabelOnDuring( |
| 526 | percent, |
| 527 | clipRect, |
| 528 | data, |
| 529 | labelAnimationRecord, |
| 530 | valueAnimation, |
| 531 | endLabelModel, |
| 532 | coordSys |
| 533 | ); |
| 534 | } |
| 535 | : null; |
| 536 | |
| 537 | const isHorizontal = coordSys.getBaseAxis().isHorizontal(); |
| 538 | const clipPath = createGridClipPath(coordSys, hasAnimation, seriesModel, () => { |
| 539 | const endLabel = lineView._endLabel; |
| 540 | if (endLabel && hasAnimation) { |
| 541 | if (labelAnimationRecord.originalX != null) { |
| 542 | endLabel.attr({ |
| 543 | x: labelAnimationRecord.originalX, |
| 544 | y: labelAnimationRecord.originalY |
| 545 | }); |
| 546 | } |
| 547 | } |
| 548 | }, during); |
| 549 | // Expand clip shape to avoid clipping when line value exceeds axis |
| 550 | if (!seriesModel.get('clip', true)) { |
| 551 | const rectShape = clipPath.shape; |
| 552 | const expandSize = Math.max(rectShape.width, rectShape.height); |
| 553 | if (isHorizontal) { |
| 554 | rectShape.y -= expandSize; |
| 555 | rectShape.height += expandSize * 2; |
| 556 | } |
| 557 | else { |
| 558 | rectShape.x -= expandSize; |
| 559 | rectShape.width += expandSize * 2; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | // Set to the final frame. To make sure label layout is right. |
| 564 | if (during) { |
| 565 | during(1, clipPath); |
| 566 | } |
| 567 | return clipPath; |
no test coverage detected
searching dependent graphs…