(g)
| 558 | } |
| 559 | |
| 560 | _renderVerticalGridLines (g) { |
| 561 | let gridLineG = g.select(`g.${VERTICAL_CLASS}`); |
| 562 | |
| 563 | if (this._renderVerticalGridLine) { |
| 564 | if (gridLineG.empty()) { |
| 565 | gridLineG = g.insert('g', ':first-child') |
| 566 | .attr('class', `${GRID_LINE_CLASS} ${VERTICAL_CLASS}`) |
| 567 | .attr('transform', `translate(${this.margins().left},${this.margins().top})`); |
| 568 | } |
| 569 | |
| 570 | const ticks = this._xAxis.tickValues() ? this._xAxis.tickValues() : |
| 571 | (typeof this._x.ticks === 'function' ? this._x.ticks.apply(this._x, this._xAxis.tickArguments()) : this._x.domain()); |
| 572 | |
| 573 | const lines = gridLineG.selectAll('line') |
| 574 | .data(ticks); |
| 575 | |
| 576 | // enter |
| 577 | const linesGEnter = lines.enter() |
| 578 | .append('line') |
| 579 | .attr('x1', d => this._x(d)) |
| 580 | .attr('y1', this._xAxisY() - this.margins().top) |
| 581 | .attr('x2', d => this._x(d)) |
| 582 | .attr('y2', 0) |
| 583 | .attr('opacity', 0); |
| 584 | transition(linesGEnter, this.transitionDuration(), this.transitionDelay()) |
| 585 | .attr('opacity', 0.5); |
| 586 | |
| 587 | // update |
| 588 | transition(lines, this.transitionDuration(), this.transitionDelay()) |
| 589 | .attr('x1', d => this._x(d)) |
| 590 | .attr('y1', this._xAxisY() - this.margins().top) |
| 591 | .attr('x2', d => this._x(d)) |
| 592 | .attr('y2', 0); |
| 593 | |
| 594 | // exit |
| 595 | lines.exit().remove(); |
| 596 | } else { |
| 597 | gridLineG.selectAll('line').remove(); |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | _xAxisY () { |
| 602 | return this._useTopXAxis ? this.margins().top : this.height() - this.margins().bottom; |
no test coverage detected