(id, ...scaleOptions)
| 38 | } |
| 39 | |
| 40 | export 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 | |
| 55 | function getAxisFromDataset(id, axis, dataset) { |
| 56 | if (dataset[axis + 'AxisID'] === id) { |
no test coverage detected