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

Method init

src/scales/scale.time.js:266–288  ·  view source on GitHub ↗
(scaleOpts, opts = {})

Source from the content-addressed store, hash-verified

264 }
265
266 init(scaleOpts, opts = {}) {
267 const time = scaleOpts.time || (scaleOpts.time = {});
268 /** @type {DateAdapter} */
269 const adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);
270
271 adapter.init(opts);
272
273 // Backward compatibility: before introducing adapter, `displayFormats` was
274 // supposed to contain *all* unit/string pairs but this can't be resolved
275 // when loading the scale (adapters are loaded afterward), so let's populate
276 // missing formats on update
277 mergeIf(time.displayFormats, adapter.formats());
278
279 this._parseOpts = {
280 parser: time.parser,
281 round: time.round,
282 isoWeekday: time.isoWeekday
283 };
284
285 super.init(scaleOpts);
286
287 this._normalized = opts.normalized;
288 }
289
290 /**
291 * @param {*} raw

Callers

nothing calls this directly

Calls 3

mergeIfFunction · 0.85
initMethod · 0.65
formatsMethod · 0.65

Tested by

no test coverage detected