@rekurt/openkline - v0.2.0
    Preparing search index...

    Interface ChartConfig

    Construction-time configuration for an OHLCVChart. All fields except container, symbol, and resolution are optional and have sensible defaults.

    Later lifecycle changes should go through the imperative methods (setTheme, setChartType, setIndicatorConfigs, etc.) rather than rebuilding the config — the chart manages its own state internally.

    interface ChartConfig {
        chartType?: ChartType;
        container: HTMLElement;
        crosshairMode?: CrosshairMode;
        horzScale?: HorzScaleBehavior<number>;
        locale?: string;
        maxCandles?: number;
        messages?: Partial<Messages>;
        onAlert?: (alert: Alert) => void;
        onCandleClick?: (candle: Candle, index: number) => void;
        onDblClick?: (info: HoverInfo | null) => void;
        onError?: (err: ChartError) => void;
        onHover?: (info: HoverInfo | null) => void;
        onLoadMoreHistory?: (buffer: CandleBuffer) => void | Promise<void>;
        onReplayChange?: (index: number, playing: boolean) => void;
        onVisibleRangeChange?: (from: number, to: number) => void;
        priceFormat?: (price: number) => string;
        priceScaleMode?: PriceScaleMode;
        resolution: string;
        symbol: string;
        theme?: ThemeMode | ThemeColors;
        transport?: DataTransport;
        volumeFormat?: (volume: number) => string;
    }
    Index

    Properties

    chartType?: ChartType

    Style of the main price series. Default: 'candles'.

    container: HTMLElement

    DOM element to mount the three canvas layers into.

    crosshairMode?: CrosshairMode

    Crosshair mode ('normal' / 'magnet'). Default: 'normal'.

    horzScale?: HorzScaleBehavior<number>

    Horizontal-domain behavior controlling X-axis labels (time / price / custom). Default: time. Use PriceScaleBehavior for options-style numeric (strike) axes.

    locale?: string

    BCP-47 locale (e.g. 'de-DE', 'ja-JP') for i18n (C6). When set, axis numbers/dates, the legend, the crosshair pills, and screen-reader announcements are formatted via Intl for this locale. Omit for the locale-agnostic defaults (byte-for-byte identical to pre-C6). A host-supplied priceFormat / volumeFormat still takes priority over the locale-aware number formatting.

    maxCandles?: number

    Cap on the number of candles retained in the buffer. When live updates push the length past this, the oldest candles are evicted (O(1)) and the viewport + drawings shift to stay anchored to the same candles. Bounds memory for long-running live charts. Omit for unlimited. History prepended via prependHistory is never auto-evicted.

    Eviction is suspended while a replay session is active (the replay cap is an absolute index that head-eviction would desync), so the buffer may temporarily exceed maxCandles during a long replay and is trimmed back on the first live append after stopReplay().

    messages?: Partial<Messages>

    Translatable UI string overrides (C6). Patches any subset of Messagesaria-label, the OHLC announcement words, the O/H/L/C/V legend letters, the "Go to live" pill — falling back to the English DEFAULT_MESSAGES for the rest. Independent of locale: you can translate strings without switching number/date formatting, or vice-versa.

    onAlert?: (alert: Alert) => void

    Called once for each price alert (C3) that fires on a realtime close-price tick. The alert is one-shot — it is already active: false when this callback runs, so it won't fire again until re-armed. Use it to surface a toast/sound/notification. Add alerts via chart.addAlert(...).

    onCandleClick?: (candle: Candle, index: number) => void
    onDblClick?: (info: HoverInfo | null) => void

    Called on a double-click over the plot area with the HoverInfo for the cursor position (or null if the cursor is outside the plot). This is purely additive — the chart's built-in double-click behavior (fit-visible in the chart area, reset price scale over the axis) still runs independently.

    onError?: (err: ChartError) => void

    Called whenever the chart encounters a non-fatal or fatal error in its data/render pipeline. If omitted, errors fall back to console.warn via the default ErrorReporter.

    onHover?: (info: HoverInfo | null) => void

    Called on every crosshair move with the currently-snapped candle.

    onLoadMoreHistory?: (buffer: CandleBuffer) => void | Promise<void>

    Called when the user pans into the left edge of the buffer. Lets hosts implement virtual scroll by fetching older candles and calling chart.prependHistory(olderCandles). The chart serializes calls — only one load-more request is in flight at a time.

    onReplayChange?: (index: number, playing: boolean) => void

    Called on every replay-mode (C1) index change with the last-revealed bar index and whether playback is running. Fires on startReplay, stepReplay, seekReplay, each play tick, and stopReplay. Use it to drive a scrubber / play-pause UI. Omit if you don't use replay mode.

    onVisibleRangeChange?: (from: number, to: number) => void
    priceFormat?: (price: number) => string

    Custom price formatter. Default: 2 decimal places.

    priceScaleMode?: PriceScaleMode

    Initial price-axis scale mode. Default: 'linear'.

    resolution: string

    Initial resolution (e.g. '1m', '15m', '1H', '1D').

    symbol: string

    Initial symbol identifier passed to the transport.

    Theme mode ('dark' / 'light' / 'auto') or explicit colors.

    transport?: DataTransport

    Optional live data source. When omitted, feed candles via setData.

    volumeFormat?: (volume: number) => string

    Custom volume formatter. Default: short K/M/B suffixes.