Function
lowerBoundObject
(data: ReadonlyArray<ObjectPoint>, xTarget: number)
Source from the content-addressed store, hash-verified
| 105 | }; |
| 106 | |
| 107 | const lowerBoundObject = (data: ReadonlyArray<ObjectPoint>, xTarget: number): number => { |
| 108 | let lo = 0; |
| 109 | let hi = data.length; |
| 110 | while (lo < hi) { |
| 111 | const mid = (lo + hi) >>> 1; |
| 112 | const x = data[mid].x; |
| 113 | if (x < xTarget) lo = mid + 1; |
| 114 | else hi = mid; |
| 115 | } |
| 116 | return lo; |
| 117 | }; |
| 118 | |
| 119 | /** |
| 120 | * Finds (at most) one nearest point per series at a given x position. |
Tested by
no test coverage detected