(animate?: boolean)
| 603 | } |
| 604 | |
| 605 | update_grid_lines(animate?: boolean) { |
| 606 | const grid_type = this.model.get('grid_lines'); |
| 607 | const side = this.model.get('side'); |
| 608 | const is_vertical = ['left', 'right'].includes(side); |
| 609 | const animation_duration = |
| 610 | animate === true ? this.parent.model.get('animation_duration') : 0; |
| 611 | |
| 612 | let tickSize = is_vertical ? -this.width : -this.height; |
| 613 | let tickOffset = 0; |
| 614 | |
| 615 | //apply offsets if applicable |
| 616 | if (this.offset_scale) { |
| 617 | const offset = this.offset_scale.scale(this.offset_value); |
| 618 | |
| 619 | if (side === 'bottom' || side == 'right') { |
| 620 | tickSize = -offset; |
| 621 | tickOffset = !is_vertical ? this.height - offset : this.width - offset; |
| 622 | } else { |
| 623 | tickSize += offset; |
| 624 | tickOffset = -offset; |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | if (grid_type !== 'none') { |
| 629 | this.axis.tickSizeInner(tickSize).tickSizeOuter(6); |
| 630 | } else { |
| 631 | this.axis.tickSize(6); |
| 632 | } |
| 633 | |
| 634 | this.g_axisline.selectAll('.tick').classed('short', grid_type === 'none'); |
| 635 | |
| 636 | this.g_axisline |
| 637 | .transition('update_grid_lines') |
| 638 | .duration(animation_duration) |
| 639 | .call(this.axis) |
| 640 | .selectAll('.tick line') |
| 641 | .attr( |
| 642 | !is_vertical ? 'y1' : 'x1', |
| 643 | this.offset_scale && grid_type !== 'none' ? tickOffset : null |
| 644 | ) |
| 645 | .style('stroke-dasharray', grid_type === 'dashed' ? '5, 5' : null); |
| 646 | |
| 647 | this.apply_tick_styling(); |
| 648 | |
| 649 | if (this.model.get('grid_color')) { |
| 650 | this.g_axisline |
| 651 | .selectAll('.tick line') |
| 652 | .style('stroke', this.model.get('grid_color')); |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | update_color() { |
| 657 | if (this.model.get('color')) { |
no test coverage detected