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

Function initRuntimeHitTestStoreFromResolvedOptions

src/ChartGPU.ts:499–519  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

497 let runtimeHitTestSeriesVersion = 0;
498
499 const initRuntimeHitTestStoreFromResolvedOptions = (): void => {
500 runtimeRawDataByIndex = new Array(resolvedOptions.series.length).fill(null).map(() => []);
501 runtimeRawBoundsByIndex = new Array(resolvedOptions.series.length).fill(null);
502 runtimeHitTestSeriesCache = null;
503 runtimeHitTestSeriesVersion++;
504
505 for (let i = 0; i < resolvedOptions.series.length; i++) {
506 const s = resolvedOptions.series[i]!;
507 if (s.type === 'pie') continue;
508
509 if (s.type === 'candlestick') {
510 const raw = ((s as unknown as { rawData?: ReadonlyArray<OHLCDataPoint> }).rawData ?? s.data) as ReadonlyArray<OHLCDataPoint>;
511 runtimeRawDataByIndex[i] = raw.length === 0 ? [] : raw.slice();
512 runtimeRawBoundsByIndex[i] = ((s as unknown as { rawBounds?: Bounds | null }).rawBounds ?? null);
513 } else {
514 const raw = ((s as unknown as { rawData?: ReadonlyArray<DataPoint> }).rawData ?? s.data) as ReadonlyArray<DataPoint>;
515 runtimeRawDataByIndex[i] = raw.length === 0 ? [] : raw.slice();
516 runtimeRawBoundsByIndex[i] = ((s as unknown as { rawBounds?: Bounds | null }).rawBounds ?? null) ?? computeRawBoundsFromData(raw);
517 }
518 }
519 };
520
521 const getRuntimeHitTestSeries = (): ResolvedChartGPUOptions['series'] => {
522 if (runtimeHitTestSeriesCache) return runtimeHitTestSeriesCache;

Callers 2

createChartGPUFunction · 0.85
setOptionFunction · 0.85

Calls 1

computeRawBoundsFromDataFunction · 0.70

Tested by

no test coverage detected