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

Method _resize

src/core/core.controller.js:277–302  ·  view source on GitHub ↗
(width, height)

Source from the content-addressed store, hash-verified

275 }
276
277 _resize(width, height) {
278 const options = this.options;
279 const canvas = this.canvas;
280 const aspectRatio = options.maintainAspectRatio && this.aspectRatio;
281 const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio);
282 const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio();
283 const mode = this.width ? 'resize' : 'attach';
284
285 this.width = newSize.width;
286 this.height = newSize.height;
287 this._aspectRatio = this.aspectRatio;
288 if (!retinaScale(this, newRatio, true)) {
289 return;
290 }
291
292 this.notifyPlugins('resize', {size: newSize});
293
294 callCallback(options.onResize, [this, newSize], this);
295
296 if (this.attached) {
297 if (this._doResize(mode)) {
298 // The resize update is delayed, only draw without updating.
299 this.render();
300 }
301 }
302 }
303
304 ensureScalesHaveIDs() {
305 const options = this.options;

Callers 3

resizeMethod · 0.95
drawMethod · 0.95
bindResponsiveEventsMethod · 0.95

Calls 5

notifyPluginsMethod · 0.95
renderMethod · 0.95
retinaScaleFunction · 0.85
getMaximumSizeMethod · 0.45
getDevicePixelRatioMethod · 0.45

Tested by

no test coverage detected