MCPcopy
hub / github.com/chartjs/Chart.js / draw

Method draw

src/plugins/plugin.title.js:84–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82 }
83
84 draw() {
85 const ctx = this.ctx;
86 const opts = this.options;
87
88 if (!opts.display) {
89 return;
90 }
91
92 const fontOpts = toFont(opts.font);
93 const lineHeight = fontOpts.lineHeight;
94 const offset = lineHeight / 2 + this._padding.top;
95 const {titleX, titleY, maxWidth, rotation} = this._drawArgs(offset);
96
97 renderText(ctx, opts.text, 0, 0, fontOpts, {
98 color: opts.color,
99 maxWidth,
100 rotation,
101 textAlign: _toLeftRightCenter(opts.align),
102 textBaseline: 'middle',
103 translation: [titleX, titleY],
104 });
105 }
106}
107
108function createTitle(chart, titleOpts) {

Callers

nothing calls this directly

Calls 4

_drawArgsMethod · 0.95
toFontFunction · 0.85
renderTextFunction · 0.85
_toLeftRightCenterFunction · 0.85

Tested by

no test coverage detected