MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _resolveBase

Method _resolveBase

src/controllers/controller.bar.ts:691–703  ·  view source on GitHub ↗

* Resolves `base` for one bar. An array or a function gives each bar its own base, * resolved with the bar's context. Any other value is shared by all bars and kept * until the next `configure()`. * @internal

(index: number)

Source from the content-addressed store, hash-verified

689 * @internal
690 */
691 _resolveBase(index: number): number | undefined {
692 const cache = this._cachedDataOpts as {$base?: {base: number | undefined}};
693 if (cache.$base) {
694 return cache.$base.base;
695 }
696 const config = this.chart.config;
697 const scopes = config.getOptionScopes(this.getDataset(), config.datasetScopeKeys(this._type));
698 const values = config.resolveNamedOptions(scopes, ['base'], () => this.getContext(index));
699 if (values.$shared) {
700 cache.$base = values;
701 }
702 return values.base;
703 }
704
705 /**
706 * Note: pixel values are not clamped to the scale area.

Callers 1

Calls 5

getOptionScopesMethod · 0.80
getDatasetMethod · 0.80
datasetScopeKeysMethod · 0.80
resolveNamedOptionsMethod · 0.80
getContextMethod · 0.45

Tested by

no test coverage detected