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

Function determineAxis

src/core/core.config.js:40–53  ·  view source on GitHub ↗
(id, ...scaleOptions)

Source from the content-addressed store, hash-verified

38}
39
40export function determineAxis(id, ...scaleOptions) {
41 if (idMatchesAxis(id)) {
42 return id;
43 }
44 for (const opts of scaleOptions) {
45 const axis = opts.axis
46 || axisFromPosition(opts.position)
47 || id.length > 1 && idMatchesAxis(id[0].toLowerCase());
48 if (axis) {
49 return axis;
50 }
51 }
52 throw new Error(`Cannot determine type of '${id}' axis. Please provide 'axis' or 'position' option.`);
53}
54
55function getAxisFromDataset(id, axis, dataset) {
56 if (dataset[axis + 'AxisID'] === id) {

Callers 2

buildOrUpdateScalesMethod · 0.90
mergeScaleConfigFunction · 0.85

Calls 2

idMatchesAxisFunction · 0.85
axisFromPositionFunction · 0.85

Tested by

no test coverage detected