(animate)
| 542 | } |
| 543 | |
| 544 | update_line_xy(animate): void { |
| 545 | const xScale = this.scales.x, |
| 546 | yScale = this.scales.y; |
| 547 | const animationDuration = |
| 548 | animate === true ? this.parent.model.get('animation_duration') : 0; |
| 549 | |
| 550 | this.line |
| 551 | .x((d: any) => { |
| 552 | return xScale.scale(d.x) + xScale.offset; |
| 553 | }) |
| 554 | .y((d: any) => { |
| 555 | return yScale.scale(d.y) + yScale.offset; |
| 556 | }); |
| 557 | |
| 558 | const fill = this.model.get('fill'); |
| 559 | this.area |
| 560 | .x((d: any) => { |
| 561 | return xScale.scale(d.x) + xScale.offset; |
| 562 | }) |
| 563 | .y1((d: any) => { |
| 564 | return yScale.scale(d.y) + yScale.offset; |
| 565 | }); |
| 566 | |
| 567 | if (fill == 'bottom') { |
| 568 | this.area.y0(this.parent.plotareaHeight); |
| 569 | } else if (fill == 'top') { |
| 570 | this.area.y0(0); |
| 571 | } else if (fill == 'between') { |
| 572 | this.area.y0((d: any) => { |
| 573 | return yScale.scale(d.y0) + yScale.offset; |
| 574 | }); |
| 575 | } |
| 576 | |
| 577 | const curvesSel = this.d3el.selectAll('.curve'); |
| 578 | |
| 579 | curvesSel |
| 580 | .select('.line') |
| 581 | .transition('update_line_xy') |
| 582 | .attr('d', (d: any) => { |
| 583 | return this.line(d.values) + this.path_closure(); |
| 584 | }) |
| 585 | .duration(animationDuration); |
| 586 | |
| 587 | curvesSel |
| 588 | .select('.area') |
| 589 | .transition('update_line_xy') |
| 590 | .attr('d', (d: any, i) => { |
| 591 | return this.area(d.values); |
| 592 | }) |
| 593 | .duration(animationDuration); |
| 594 | |
| 595 | curvesSel |
| 596 | .select('.curve_label') |
| 597 | .transition('update_line_xy') |
| 598 | .attr('transform', (d: any) => { |
| 599 | const lastXy = d.values[d.values.length - 1]; |
| 600 | return ( |
| 601 | 'translate(' + |
no test coverage detected