(start, stop, count)
| 1 | import {tickIncrement} from "./ticks.js"; |
| 2 | |
| 3 | export default function nice(start, stop, count) { |
| 4 | let prestep; |
| 5 | while (true) { |
| 6 | const step = tickIncrement(start, stop, count); |
| 7 | if (step === prestep || step === 0 || !isFinite(step)) { |
| 8 | return [start, stop]; |
| 9 | } else if (step > 0) { |
| 10 | start = Math.floor(start / step) * step; |
| 11 | stop = Math.ceil(stop / step) * step; |
| 12 | } else if (step < 0) { |
| 13 | start = Math.ceil(start * step) / step; |
| 14 | stop = Math.floor(stop * step) / step; |
| 15 | } |
| 16 | prestep = step; |
| 17 | } |
| 18 | } |
no test coverage detected
searching dependent graphs…