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

Method aspectRatio

src/core/core.controller.js:202–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 }
201
202 get aspectRatio() {
203 const {options: {aspectRatio, maintainAspectRatio}, width, height, _aspectRatio} = this;
204 if (!isNullOrUndef(aspectRatio)) {
205 // If aspectRatio is defined in options, use that.
206 return aspectRatio;
207 }
208
209 if (maintainAspectRatio && _aspectRatio) {
210 // If maintainAspectRatio is truthly and we had previously determined _aspectRatio, use that
211 return _aspectRatio;
212 }
213
214 // Calculate
215 return height ? width / height : null;
216 }
217
218 get data() {
219 return this.config.data;

Callers

nothing calls this directly

Calls 1

isNullOrUndefFunction · 0.85

Tested by

no test coverage detected