MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / lowerBoundObject

Function lowerBoundObject

src/interaction/findNearestPoint.ts:442–455  ·  view source on GitHub ↗
(
  data: ReadonlyArray<ObjectPoint>,
  xTarget: number,
)

Source from the content-addressed store, hash-verified

440};
441
442const lowerBoundObject = (
443 data: ReadonlyArray<ObjectPoint>,
444 xTarget: number,
445): number => {
446 let lo = 0;
447 let hi = data.length;
448 while (lo < hi) {
449 const mid = (lo + hi) >>> 1;
450 const x = data[mid].x;
451 if (x < xTarget) lo = mid + 1;
452 else hi = mid;
453 }
454 return lo;
455};
456
457/**
458 * Finds the nearest data point to the given cursor position across all series.

Callers 1

findNearestPointFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected