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

Function generateCartesianChunk

examples/worker-rendering/main.ts:308–336  ·  view source on GitHub ↗
(
  startIndex: number,
  count: number,
  dataType: DataType
)

Source from the content-addressed store, hash-verified

306}
307
308function generateCartesianChunk(
309 startIndex: number,
310 count: number,
311 dataType: DataType
312): DataPoint[] {
313 const data: DataPoint[] = new Array(count);
314
315 for (let i = 0; i < count; i++) {
316 const x = startIndex + i;
317
318 // Complex waveform: multiple frequencies + noise
319 const y =
320 Math.sin(x * 0.01) * 50 +
321 Math.sin(x * 0.03) * 30 +
322 Math.sin(x * 0.07) * 15 +
323 Math.sin(x * 0.13) * 8 +
324 (Math.random() - 0.5) * 5;
325
326 if (dataType === 'scatter') {
327 // Variable point sizes for scatter
328 const size = 2 + Math.random() * 6;
329 data[i] = [x, y, size];
330 } else {
331 data[i] = [x, y];
332 }
333 }
334
335 return data;
336}
337
338function generateCandlestickChunk(
339 startIndex: number,

Callers 1

generateChunkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected