* @protected
(scale, canStack)
| 620 | * @protected |
| 621 | */ |
| 622 | getMinMax(scale, canStack) { |
| 623 | const meta = this._cachedMeta; |
| 624 | const _parsed = meta._parsed; |
| 625 | const sorted = meta._sorted && scale === meta.iScale; |
| 626 | const ilen = _parsed.length; |
| 627 | const otherScale = this._getOtherScale(scale); |
| 628 | const stack = createStack(canStack, meta, this.chart); |
| 629 | const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY}; |
| 630 | const {min: otherMin, max: otherMax} = getUserBounds(otherScale); |
| 631 | let i, parsed; |
| 632 | |
| 633 | function _skip() { |
| 634 | parsed = _parsed[i]; |
| 635 | const otherValue = parsed[otherScale.axis]; |
| 636 | return !isFinite(parsed[scale.axis]) || otherMin > otherValue || otherMax < otherValue; |
| 637 | } |
| 638 | |
| 639 | for (i = 0; i < ilen; ++i) { |
| 640 | if (_skip()) { |
| 641 | continue; |
| 642 | } |
| 643 | this.updateRangeFromParsed(range, scale, parsed, stack); |
| 644 | if (sorted) { |
| 645 | // if the data is sorted, we don't need to check further from this end of array |
| 646 | break; |
| 647 | } |
| 648 | } |
| 649 | if (sorted) { |
| 650 | // in the sorted case, find first non-skipped value from other end of array |
| 651 | for (i = ilen - 1; i >= 0; --i) { |
| 652 | if (_skip()) { |
| 653 | continue; |
| 654 | } |
| 655 | this.updateRangeFromParsed(range, scale, parsed, stack); |
| 656 | break; |
| 657 | } |
| 658 | } |
| 659 | return range; |
| 660 | } |
| 661 | |
| 662 | getAllParsedValues(scale) { |
| 663 | const parsed = this._cachedMeta._parsed; |
nothing calls this directly
no test coverage detected