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

Function appendData

src/core/createRenderCoordinator.ts:3208–3236  ·  view source on GitHub ↗
(seriesIndex, newPoints)

Source from the content-addressed store, hash-verified

3206 };
3207
3208 const appendData: RenderCoordinator['appendData'] = (seriesIndex, newPoints) => {
3209 assertNotDisposed();
3210 if (!Number.isFinite(seriesIndex)) return;
3211 if (seriesIndex < 0 || seriesIndex >= currentOptions.series.length) return;
3212 if (!newPoints || newPoints.length === 0) return;
3213
3214 const s = currentOptions.series[seriesIndex]!;
3215 if (s.type === 'pie') {
3216 // Pie series are non-cartesian and currently not supported by streaming append.
3217 if (!warnedPieAppendSeries.has(seriesIndex)) {
3218 warnedPieAppendSeries.add(seriesIndex);
3219 console.warn(
3220 `RenderCoordinator.appendData(${seriesIndex}, ...): pie series are not supported by streaming append.`
3221 );
3222 }
3223 return;
3224 }
3225
3226 const existing = pendingAppendByIndex.get(seriesIndex);
3227 if (existing) {
3228 existing.push(...(newPoints as Array<DataPoint | OHLCDataPoint>));
3229 } else {
3230 // Copy into a mutable staging array so repeated appends coalesce without extra allocations.
3231 pendingAppendByIndex.set(seriesIndex, Array.from(newPoints as Array<DataPoint | OHLCDataPoint>));
3232 }
3233
3234 // Coalesce appends + any required resampling + GPU streaming updates into a single flush.
3235 scheduleFlush();
3236 };
3237
3238 const shouldRenderArea = (series: ResolvedChartGPUOptions['series'][number]): boolean => {
3239 switch (series.type) {

Callers

nothing calls this directly

Calls 2

assertNotDisposedFunction · 0.70
scheduleFlushFunction · 0.70

Tested by

no test coverage detected