* Figures out what unit results in an appropriate number of auto-generated ticks * @param {Unit} minUnit * @param {number} min * @param {number} max * @param {number} capacity * @return {object}
(minUnit, min, max, capacity)
| 85 | * @return {object} |
| 86 | */ |
| 87 | function determineUnitForAutoTicks(minUnit, min, max, capacity) { |
| 88 | const ilen = UNITS.length; |
| 89 | |
| 90 | for (let i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) { |
| 91 | const interval = INTERVALS[UNITS[i]]; |
| 92 | const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER; |
| 93 | |
| 94 | if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) { |
| 95 | return UNITS[i]; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return UNITS[ilen - 1]; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Figures out what unit to format a set of ticks with |
no outgoing calls
no test coverage detected