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

Method update

src/plugins/plugin.title.js:29–52  ·  view source on GitHub ↗
(maxWidth, maxHeight)

Source from the content-addressed store, hash-verified

27 }
28
29 update(maxWidth, maxHeight) {
30 const opts = this.options;
31
32 this.left = 0;
33 this.top = 0;
34
35 if (!opts.display) {
36 this.width = this.height = this.right = this.bottom = 0;
37 return;
38 }
39
40 this.width = this.right = maxWidth;
41 this.height = this.bottom = maxHeight;
42
43 const lineCount = isArray(opts.text) ? opts.text.length : 1;
44 this._padding = toPadding(opts.padding);
45 const textSize = lineCount * toFont(opts.font).lineHeight + this._padding.height;
46
47 if (this.isHorizontal()) {
48 this.height = textSize;
49 } else {
50 this.width = textSize;
51 }
52 }
53
54 isHorizontal() {
55 const pos = this.options.position;

Callers

nothing calls this directly

Calls 4

isHorizontalMethod · 0.95
isArrayFunction · 0.85
toPaddingFunction · 0.85
toFontFunction · 0.85

Tested by

no test coverage detected