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

Function tryUpdate

src/interaction/findCandlestick.ts:192–211  ·  view source on GitHub ↗
(
    seriesIndex: number,
    dataIndex: number,
    point: OHLCDataPoint,
    dx: number,
  )

Source from the content-addressed store, hash-verified

190 let bestDx = Number.POSITIVE_INFINITY;
191
192 const tryUpdate = (
193 seriesIndex: number,
194 dataIndex: number,
195 point: OHLCDataPoint,
196 dx: number,
197 ): void => {
198 if (!Number.isFinite(dx)) return;
199 if (dx < bestDx) {
200 bestDx = dx;
201 best = { seriesIndex, dataIndex, point };
202 return;
203 }
204 if (dx === bestDx && best) {
205 if (dataIndex < best.dataIndex) {
206 best = { seriesIndex, dataIndex, point };
207 } else if (dataIndex === best.dataIndex && seriesIndex < best.seriesIndex) {
208 best = { seriesIndex, dataIndex, point };
209 }
210 }
211 };
212
213 const isBodyHitAt = (p: OHLCDataPoint): boolean => {
214 const open = getOpen(p);

Callers 1

findCandlestickFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected