(pt, ctx, options)
| 754 | } |
| 755 | |
| 756 | drawTitle(pt, ctx, options) { |
| 757 | const title = this.title; |
| 758 | const length = title.length; |
| 759 | let titleFont, titleSpacing, i; |
| 760 | |
| 761 | if (length) { |
| 762 | const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width); |
| 763 | |
| 764 | pt.x = getAlignedX(this, options.titleAlign, options); |
| 765 | |
| 766 | ctx.textAlign = rtlHelper.textAlign(options.titleAlign); |
| 767 | ctx.textBaseline = class="st">'middle'; |
| 768 | |
| 769 | titleFont = toFont(options.titleFont); |
| 770 | titleSpacing = options.titleSpacing; |
| 771 | |
| 772 | ctx.fillStyle = options.titleColor; |
| 773 | ctx.font = titleFont.string; |
| 774 | |
| 775 | for (i = 0; i < length; ++i) { |
| 776 | ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2); |
| 777 | pt.y += titleFont.lineHeight + titleSpacing; class="cm">// Line Height and spacing |
| 778 | |
| 779 | if (i + 1 === length) { |
| 780 | pt.y += options.titleMarginBottom - titleSpacing; class="cm">// If Last, add margin, remove spacing |
| 781 | } |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | /** |
| 787 | * @private |
no test coverage detected