Skip to main content

prewarmChartRenderCaches

FitFileViewer - API Documentation v29.8.0


FitFileViewer - API Documentation / utils/charts/core/renderChartJS / prewarmChartRenderCaches

Function: prewarmChartRenderCaches()

prewarmChartRenderCaches(params: { recordMesgs: Record<string, unknown>[]; startTime: unknown; reason?: string; yieldEvery?: number; }): Promise<{ processedFields: number; skipped: boolean; }>

Defined in: utils/charts/core/renderChartJS.js:825

Pre-warm the most expensive chart caches (labels + per-field converted values + chart points).

Why this helps:

  • The slow part of chart rendering is frequently the O(N) scan across recordMesgs for each field, plus unit conversion and point creation.
  • renderChartsWithData() already caches this work in WeakMaps/Maps.
  • By pre-warming those caches during idle time after file load, the Charts tab render becomes dramatically faster without attempting to render charts while the tab is hidden (display:none).

This function intentionally does not touch the DOM and is safe to run while the map tab is active.

Parameters​

params​

recordMesgs​

Record<string, unknown>[]

startTime​

unknown

reason?​

string = "prewarm"

yieldEvery?​

number = 2

Returns​

Promise<{ processedFields: number; skipped: boolean; }>

Summary info for debugging.