| 45 | }; |
| 46 | |
| 47 | const attachCoalescedResizeObserver = ( |
| 48 | containers: ReadonlyArray<HTMLElement>, |
| 49 | charts: ReadonlyArray<ChartGPUInstance> |
| 50 | ): ResizeObserver => { |
| 51 | let rafId: number | null = null; |
| 52 | const schedule = (): void => { |
| 53 | if (rafId !== null) return; |
| 54 | rafId = requestAnimationFrame(() => { |
| 55 | rafId = null; |
| 56 | for (const chart of charts) chart.resize(); |
| 57 | }); |
| 58 | }; |
| 59 | |
| 60 | const ro = new ResizeObserver(() => schedule()); |
| 61 | for (const el of containers) ro.observe(el); |
| 62 | return ro; |
| 63 | }; |
| 64 | |
| 65 | const normalizeSamplingMode = (value: string | null): SeriesSampling => { |
| 66 | switch (value) { |