Skip to content

Function: fetchChart()

fetchChart(chartId, options): Promise<{ chartId: string; error?: string; result?: { chartType: "custom" | "bar" | "horizontalBar" | "line" | "area" | "combo" | "waterfall" | "scatter" | "heatmap" | "radar" | "pie" | "funnel" | "treemap"; option: Record<string, unknown>; }; } | undefined>

Long-poll the chart cache until the entry settles (result or error set), the entry is missing, or the server-side timeout elapses.

Returns:

  • the resolved Chart when it settled, errored, or stayed in processing past timeoutMs (so the client can re-poll);
  • undefined when the entry is missing, expired, or owned by another identity (the consumer should treat as 404).

signal lets the caller cancel ahead of timeout (e.g. the HTTP request closed). Cancellation propagates to the inter-poll sleep so the helper returns immediately.

string

FetchChartOptions

Promise<{ chartId: string; error?: string; result?: { chartType: "custom" | "bar" | "horizontalBar" | "line" | "area" | "combo" | "waterfall" | "scatter" | "heatmap" | "radar" | "pie" | "funnel" | "treemap"; option: Record<string, unknown>; }; } | undefined>