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

Method _resolveAnimations

src/core/core.datasetController.js:841–861  ·  view source on GitHub ↗

* @private

(index, transition, active)

Source from the content-addressed store, hash-verified

839 * @private
840 */
841 _resolveAnimations(index, transition, active) {
842 const chart = this.chart;
843 const cache = this._cachedDataOpts;
844 const cacheKey = `animation-${transition}`;
845 const cached = cache[cacheKey];
846 if (cached) {
847 return cached;
848 }
849 let options;
850 if (chart.options.animation !== false) {
851 const config = this.chart.config;
852 const scopeKeys = config.datasetAnimationScopeKeys(this._type, transition);
853 const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);
854 options = config.createResolver(scopes, this.getContext(index, active, transition));
855 }
856 const animations = new Animations(chart, options && options.animations);
857 if (options && options._cacheable) {
858 cache[cacheKey] = Object.freeze(animations);
859 }
860 return animations;
861 }
862
863 /**
864 * Utility for getting the options object shared between elements

Callers 4

updateElementMethod · 0.95
updateSharedOptionsMethod · 0.95
_setStyleMethod · 0.95
_updateVisibilityMethod · 0.45

Calls 5

getDatasetMethod · 0.95
getContextMethod · 0.95
getOptionScopesMethod · 0.80
createResolverMethod · 0.80

Tested by

no test coverage detected