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

Function createTimeSeries

examples/interactive/main.ts:66–84  ·  view source on GitHub ↗
(
  count: number,
  opts: Readonly<{
    startMs: number;
    stepMs: number;
    fn: (t: number) => number;
  }>
)

Source from the content-addressed store, hash-verified

64};
65
66const createTimeSeries = (
67 count: number,
68 opts: Readonly<{
69 startMs: number;
70 stepMs: number;
71 fn: (t: number) => number;
72 }>
73): ReadonlyArray<DataPoint> => {
74 const n = Math.max(2, Math.floor(count));
75 const out: DataPoint[] = new Array(n);
76
77 for (let i = 0; i < n; i++) {
78 const x = opts.startMs + i * opts.stepMs;
79 const y = opts.fn(i);
80 out[i] = [x, y] as const;
81 }
82
83 return out;
84};
85
86const attachCoalescedResizeObserver = (
87 containers: ReadonlyArray<HTMLElement>,

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected