* @protected
()
| 1520 | * @protected |
| 1521 | */ |
| 1522 | drawBorder() { |
| 1523 | const {chart, ctx, options: {border, grid}} = this; |
| 1524 | const borderOpts = border.setContext(this.getContext()); |
| 1525 | const axisWidth = border.display ? borderOpts.width : 0; |
| 1526 | if (!axisWidth) { |
| 1527 | return; |
| 1528 | } |
| 1529 | const lastLineWidth = grid.setContext(this.getContext(0)).lineWidth; |
| 1530 | const borderValue = this._borderValue; |
| 1531 | let x1, x2, y1, y2; |
| 1532 | |
| 1533 | if (this.isHorizontal()) { |
| 1534 | x1 = _alignPixel(chart, this.left, axisWidth) - axisWidth / 2; |
| 1535 | x2 = _alignPixel(chart, this.right, lastLineWidth) + lastLineWidth / 2; |
| 1536 | y1 = y2 = borderValue; |
| 1537 | } else { |
| 1538 | y1 = _alignPixel(chart, this.top, axisWidth) - axisWidth / 2; |
| 1539 | y2 = _alignPixel(chart, this.bottom, lastLineWidth) + lastLineWidth / 2; |
| 1540 | x1 = x2 = borderValue; |
| 1541 | } |
| 1542 | ctx.save(); |
| 1543 | ctx.lineWidth = borderOpts.width; |
| 1544 | ctx.strokeStyle = borderOpts.color; |
| 1545 | |
| 1546 | ctx.beginPath(); |
| 1547 | ctx.moveTo(x1, y1); |
| 1548 | ctx.lineTo(x2, y2); |
| 1549 | ctx.stroke(); |
| 1550 | |
| 1551 | ctx.restore(); |
| 1552 | } |
| 1553 | |
| 1554 | /** |
| 1555 | * @protected |
no test coverage detected