(data: ReadonlyArray<OHLCDataPoint>, xTarget: number)
| 137 | }; |
| 138 | |
| 139 | const lowerBoundByTimestamp = (data: ReadonlyArray<OHLCDataPoint>, xTarget: number): number => { |
| 140 | let lo = 0; |
| 141 | let hi = data.length; |
| 142 | while (lo < hi) { |
| 143 | const mid = (lo + hi) >>> 1; |
| 144 | const t = getTimestamp(data[mid]); |
| 145 | if (t < xTarget) lo = mid + 1; |
| 146 | else hi = mid; |
| 147 | } |
| 148 | return lo; |
| 149 | }; |
| 150 | |
| 151 | /** |
| 152 | * Finds the candlestick body under the given cursor position. |
no test coverage detected