Skip to content

LayerConfig

Layers are added to panels. Layers with the same scale key share coordinates; layers with different scale keys are measured and drawn independently.

For indicator-specific period naming, prefer each layer's dedicated API (fastPeriod for MACD, kPeriod for Stochastic). See each layer config page for details and legacy aliases.

Examples

Minimal candlesticks layer - as component

tsx
<Candlesticks/> // used in <Panel>

Minimal candlesticks layer - as configuration object

ts
{
  type: 'price:candlesticks'
}

Simple moving average indicator - as component

tsx
<SMA // used in <Panel>
  id='my-moving-average-layer'
  period={50}
  series={{
    value: { color: 'orange' }
  }}
/>

Simple moving average indicator - as configuration object

ts
{
  id: 'my-moving-average-layer',
  type: 'sma',
  period: 50,
  series: {
    value: { color: 'orange' }
  }
}

Specific Layers

TypeScript

LayerConfig

ts
type LayerConfig =
  BuiltInLayerConfig
  | CustomLayerConfig;

BuiltInLayerConfig

ts
type BuiltInLayerConfig =
  LayerDefinitionConfig<BuiltInLayerDefinition>;

The built-in union is derived from the registered built-in layer definitions, so it includes candlesticks, OHLC bars, price line, area, volume bars, and every built-in indicator without maintaining a second hard-coded union.

CustomLayerConfig keeps type open for chart-scoped definitions created with defineLayer.

React Candlesticks is available on npm and GitHub under the MIT License.