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

Method configure

src/core/core.animations.js:13–37  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

11 }
12
13 configure(config) {
14 if (!isObject(config)) {
15 return;
16 }
17
18 const animationOptions = Object.keys(defaults.animation);
19 const animatedProps = this._properties;
20
21 Object.getOwnPropertyNames(config).forEach(key => {
22 const cfg = config[key];
23 if (!isObject(cfg)) {
24 return;
25 }
26 const resolved = {};
27 for (const option of animationOptions) {
28 resolved[option] = cfg[option];
29 }
30
31 (isArray(cfg.properties) && cfg.properties || [key]).forEach((prop) => {
32 if (prop === key || !animatedProps.has(prop)) {
33 animatedProps.set(prop, resolved);
34 }
35 });
36 });
37 }
38
39 /**
40 * Utility to handle animation of `options`.

Callers 1

constructorMethod · 0.95

Calls 4

isObjectFunction · 0.85
isArrayFunction · 0.85
hasMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected