(start, stop, count)
| 597 | e2 = Math.sqrt(2); |
| 598 | |
| 599 | function tickSpec(start, stop, count) { |
| 600 | const step = (stop - start) / Math.max(0, count), |
| 601 | power = Math.floor(Math.log10(step)), |
| 602 | error = step / Math.pow(10, power), |
| 603 | factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; |
| 604 | let i1, i2, inc; |
| 605 | if (power < 0) { |
| 606 | inc = Math.pow(10, -power) / factor; |
| 607 | i1 = Math.round(start * inc); |
| 608 | i2 = Math.round(stop * inc); |
| 609 | if (i1 / inc < start) ++i1; |
| 610 | if (i2 / inc > stop) --i2; |
| 611 | inc = -inc; |
| 612 | } else { |
| 613 | inc = Math.pow(10, power) * factor; |
| 614 | i1 = Math.round(start / inc); |
| 615 | i2 = Math.round(stop / inc); |
| 616 | if (i1 * inc < start) ++i1; |
| 617 | if (i2 * inc > stop) --i2; |
| 618 | } |
| 619 | if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); |
| 620 | return [i1, i2, inc]; |
| 621 | } |
| 622 | |
| 623 | function ticks(start, stop, count) { |
| 624 | stop = +stop, start = +start, count = +count; |
no test coverage detected