interface ChartState {
    alerts?: AlertsDocument;
    barSpacing?: number;
    crosshairMode?: "normal" | "magnet";
    crosshairSnapToBar?: boolean;
    drawings?: unknown;
    grid?: { horzLines: boolean; vertLines: boolean };
    indicatorLegendCollapsed?: boolean;
    indicators?: IndicatorState[];
    panes?: PaneState[];
    priceOnlyAutoScale?: boolean;
    primaryPane?: number;
    series?: SeriesState[];
    sourceAbove?: string;
    version: number;
    viewport?: { from: number; to: number };
}

Properties

barSpacing?: number
crosshairMode?: "normal" | "magnet"
crosshairSnapToBar?: boolean
drawings?: unknown

Opaque slot the drawing tier fills. The base engine round-trips it untouched, so an app that persists state keeps drawings for free once the tier is loaded.

grid?: { horzLines: boolean; vertLines: boolean }
indicatorLegendCollapsed?: boolean

Collapse only study legend rows. Omission preserves the current preference.

indicators?: IndicatorState[]
panes?: PaneState[]
priceOnlyAutoScale?: boolean

Only the primary series contributes to its scale's auto-fit. Omission preserves the current preference.

primaryPane?: number

Slot in panes of the primary price pane, present only when it is not the first (version 2). Every paneIndex in the state, of a pane, a series, a study or a drawing, is a visual slot counted from the top, so this says which of them is the price pane. Omitted with panes present means slot 0, the only place a price pane could be before it could move. Needs panes, and must name one of them.

series?: SeriesState[]

Informational: restoreState does not recreate these (it has no data).

sourceAbove?: string

Instance id of the study the price source paints directly above, present only when the source was moved over a study on its pane. Omission, as in every layout from before the source could move, paints the source behind the studies. Read with indicators: a restore without them leaves it be.

version: number
viewport?: { from: number; to: number }

Visible logical range at save time.