Types

Interfaces and type aliases exported by @reincharts/widget.

import type { ChartType, ChartTypeInfo, IndicatorConfig, ... } from "@reincharts/widget";

ChartType

Main series styles offered by the chart type menu.

type ChartType = (typeof CHART_TYPE_IDS)[number];

ChartTypeInfo

Describes one chart type of the chart type menu.

Prop

Type

IndicatorConfig

An indicator to start with: a registry id ("rsi") or an object with inputs / styles.

type IndicatorConfig =
    | string
    | {
          /** Registry id (`indicators` key or an `extraIndicators` id). */
          readonly definitionId: string;
          /** Stable id (default `<definitionId>-<n>`). */
          readonly id?: string;
          /** Inputs merged over the defaults. */
          readonly inputs?: Record<string, unknown>;
          /** Output style overrides. */
          readonly styles?: IndicatorState["styles"];
          /** Pane: `"price"` to overlay, any id to share a pane. Default: overlays on the price pane, others in a new pane. */
          readonly paneId?: string;
          /** Start hidden. */
          readonly hidden?: boolean;
      };

IndicatorState

One indicator on the chart (serializable).

Prop

Type

LayoutKind

Multi-chart grid: one chart, two side by side ("2h"), two stacked ("2v"), one big + two ("3") or 2×2 ("4").

type LayoutKind = (typeof LAYOUTS)[number];

RangePreset

Bottom bar range buttons.

type RangePreset = "1D" | "5D" | "1M" | "3M" | "6M" | "YTD" | "1Y" | "5Y" | "All";

ScaleMode

Price scale mode of the main pane.

type ScaleMode = (typeof SCALE_MODES)[number];

StateAction

An action of reduceState: one user change (pick a symbol, add an indicator, load a state...).

type StateAction =
    | { type: "symbol"; symbol: string; cell?: number }
    | { type: "resolution"; resolution: string }
    | { type: "chartType"; chartType: ChartType }
    | { type: "scaleMode"; mode: ScaleMode }
    | {
          type: "addIndicator";
          definition: IndicatorDefinition;
          id?: string;
          inputs?: Record<string, unknown>;
          styles?: Record<string, IndicatorOutputStyle>;
          paneId?: string;
      }
    | { type: "updateIndicator"; id: string; patch: Partial<Pick<IndicatorState, "inputs" | "styles" | "hidden">> }
    | { type: "removeIndicator"; id: string }
    | { type: "removeAllIndicators" }
    | { type: "drawings"; drawings: unknown[] }
    | { type: "addCompare"; symbol: string }
    | { type: "removeCompare"; symbol: string }
    | { type: "paneSizes"; sizes: Record<string, number> | undefined }
    | { type: "visibleRange"; range: { from: number; to: number } | undefined }
    | { type: "theme"; theme: "light" | "dark" }
    | { type: "layout"; layout: LayoutKind }
    | { type: "toggleFavorite"; resolution: string }
    | { type: "settings"; settings: TradingChartSettings }
    | { type: "load"; state: TradingChartState };

TradingChartBar

An OHLCV bar for data mode: a date (Date) or time (ms epoch) plus prices.

Prop

Type

TradingChartHandle

Imperative API of <TradingChart ref>.

Prop

Type

TradingChartSettings

User preferences edited in the settings dialog (missing fields fall back to the TradingChart props).

Prop

Type

TradingChartState

Whole-layout state of a TradingChart. Plain JSON: store it anywhere and pass it back to load / defaultState.

Prop

Type

WidgetIconName

Name of a built-in widget icon.

type IconName = keyof typeof paths;

On this page