(pt, ctx, options)
| 812 | } |
| 813 | |
| 814 | drawTitle(pt, ctx, options) { |
| 815 | const title = this.title; |
| 816 | const length = title.length; |
| 817 | let titleFont, titleSpacing, i; |
| 818 | |
| 819 | if (length) { |
| 820 | const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width); |
| 821 | |
| 822 | pt.x = getAlignedX(this, options.titleAlign, options); |
| 823 | |
| 824 | ctx.textAlign = rtlHelper.textAlign(options.titleAlign); |
| 825 | ctx.textBaseline = 'middle'; |
| 826 | |
| 827 | titleFont = toFont(options.titleFont); |
| 828 | titleSpacing = options.titleSpacing; |
| 829 | |
| 830 | ctx.fillStyle = options.titleColor; |
| 831 | ctx.font = titleFont.string; |
| 832 | |
| 833 | for (i = 0; i < length; ++i) { |
| 834 | ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2); |
| 835 | pt.y += titleFont.lineHeight + titleSpacing; // Line Height and spacing |
| 836 | |
| 837 | if (i + 1 === length) { |
| 838 | pt.y += options.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing |
| 839 | } |
| 840 | } |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | /** |
| 845 | * @private |
no test coverage detected