MCPcopy Create free account
hub / github.com/ChartGPU/ChartGPU / recomputeRuntimeBaseSeries

Function recomputeRuntimeBaseSeries

src/core/createRenderCoordinator.ts:2703–2731  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2701 };
2702
2703 const recomputeRuntimeBaseSeries = (): void => {
2704 const next: ResolvedChartGPUOptions['series'][number][] = new Array(currentOptions.series.length);
2705 for (let i = 0; i < currentOptions.series.length; i++) {
2706 const s = currentOptions.series[i]!;
2707 if (s.type === 'pie') {
2708 next[i] = s;
2709 continue;
2710 }
2711
2712 if (s.type === 'candlestick') {
2713 const rawOHLC =
2714 (runtimeRawDataByIndex[i] as ReadonlyArray<OHLCDataPoint> | null) ??
2715 ((s.rawData ?? s.data) as ReadonlyArray<OHLCDataPoint>);
2716 const bounds = runtimeRawBoundsByIndex[i] ?? s.rawBounds ?? undefined;
2717 const baselineSampled = s.sampling === 'ohlc' && rawOHLC.length > s.samplingThreshold
2718 ? ohlcSample(rawOHLC, s.samplingThreshold)
2719 : rawOHLC;
2720 next[i] = { ...s, rawData: rawOHLC, rawBounds: bounds, data: baselineSampled };
2721 continue;
2722 }
2723
2724 const raw =
2725 (runtimeRawDataByIndex[i] as DataPoint[] | null) ?? ((s.rawData ?? s.data) as ReadonlyArray<DataPoint>);
2726 const bounds = runtimeRawBoundsByIndex[i] ?? s.rawBounds ?? undefined;
2727 const baselineSampled = sampleSeriesDataPoints(raw, s.sampling, s.samplingThreshold);
2728 next[i] = { ...s, rawData: raw, rawBounds: bounds, data: baselineSampled };
2729 }
2730 runtimeBaseSeries = next;
2731 };
2732
2733 function sliceRenderSeriesToVisibleRange(): void {
2734 const zoomRange = zoomState?.getRange() ?? null;

Callers 3

flushPendingAppendsFunction · 0.85
createRenderCoordinatorFunction · 0.85
setOptionsFunction · 0.85

Calls 2

ohlcSampleFunction · 0.90
sampleSeriesDataPointsFunction · 0.90

Tested by

no test coverage detected