Widget Options
sdk.chart.mount(options) creates either a single chart or a multi-chart workspace. Both variants return ChartSdkMount, whose api is the same ChartWidgetApi used by all widget-level services.
Pick a starting configuration below; every option used in the presets exists on ChartWidgetOptions.
Minimum preset
Four required fields produce a working chart. Start here, verify the chart renders, then add options deliberately. See Quickstart and Datafeeds for the data contract.
import { createTradeScriptSdk } from '@tradescript/pro/sdk/core';
const sdk = await createTradeScriptSdk({ lease: deploymentLease });
const mounted = sdk.chart.mount({
mount: '#chart',
symbol: 'AAPL',
interval: '1D',
datafeed,
});
await mounted.ready();
Common preset
Presentation, feature gates, persistence, and error reporting — the options most production embeds add first. See Customize the terminal, Themes, and Storage.
const mounted = sdk.chart.mount({
mount: '#chart',
symbol: 'AAPL',
interval: '1D',
datafeed,
theme: 'dark',
locale: 'en',
timezone: 'America/New_York',
features: {
drawings: true,
builtInIndicators: true,
symbolSearch: true,
},
storage, // ChartStorageAdapter for layouts, templates, settings
autoSave: true, // debounced autosave-needed events
onError: (error) => console.error(error.code, error.message),
});
await mounted.ready();
Advanced preset
Broker-connected trading, alert persistence, worker-backed computation, and restored sessions. See Broker integration, Alerts, and Build a multi-chart workspace.
const mounted = sdk.chart.mount({
mount: '#terminal',
symbol: 'AAPL',
interval: '1m',
datafeed,
broker, // TradingBrokerAdapter for orders and positions
alerts, // AlertProvider for server-side alert evaluation
storage,
workers: true, // SDK-packaged compute workers
widgetBar: true, // native right-rail pages
loadLastChart: true, // restore the newest saved layout before ready
onEvent: (event) => routeToAnalytics(event),
});
await mounted.ready();
For multiple synchronized charts in one workspace, replace the single-chart fields with multiChart — see Multi-chart configuration.
Required configuration
Single-chart widgets require these fields:
| Option | Type | Purpose |
|---|---|---|
mount | string | HTMLElement | Container that receives the widget |
symbol | string | SymbolInfo | Initial instrument |
interval | ChartInterval | Initial resolution, such as 1m or 1D |
datafeed | MarketDataFeed | Historical and realtime market data |
Common optional configuration
| Option | Purpose |
|---|---|
theme, locale, timezone | Initial presentation and regional settings |
features | Enables or configures supported product surfaces |
storage | Connects layout, drawing, template, and settings persistence |
broker | Connects account state and trading intents |
alerts | Connects alert persistence and evaluation |
defaultIndicators | Adds indicators when the chart initializes |
favorites | Sets favorite intervals, chart types, tools, and indicators |
accessibility | Configures labels, announcements, and keyboard behavior |
workers | Configures supported worker-backed computation |
onReady, onEvent, onError | Receives lifecycle, typed event, and structured error notifications |
Browse every option and related type in the Widget API.
Multi-chart configuration
Pass multiChart.charts instead of top-level symbol, interval, and datafeed fields:
const mounted = sdk.chart.mount({
mount: '#workspace',
multiChart: {
charts: [
{ chartId: 'left', symbol: 'AAPL', interval: '1D', datafeed },
{ chartId: 'right', symbol: 'MSFT', interval: '1D', datafeed },
],
activeChartId: 'left',
sync: { crosshair: true, interval: true },
},
});
await mounted.ready();
mounted.api.chart('right');
Top-level single-chart fields cannot be combined with multiChart. Invalid combinations throw an SdkError with code validation.
Return value
sdk.chart.mount() returns a stable ChartSdkMount immediately. Await mounted.ready() before using chart data or controller methods, call mounted.update(...) for mutable host props, and access the mounted ChartWidgetApi through mounted.api. Use:
mounted.api.chart(chartId?)for chart operationsmounted.api.data(chartId?)for market-data operationsmounted.api.trading(chartId?)for broker-connected operationsmounted.api.customization(chartId?)for themes and overridesmounted.api.chartLayouts()for saved chart layoutsmounted.api.workspace()for chart membership and active-chart state
Errors
Construction validates the mount target, chart configuration, identifiers, and mutually exclusive single/multi-chart fields. Runtime failures are delivered through onError as structured ChartError values and are also available through rejected promises where applicable.
Direct single-chart shortcut
Use createChart(mount, options) when a plain JavaScript application needs a
direct ChartApi for one chart. Use createTradeScriptSdk({ lease }) and
sdk.chart.mount() when the application needs shared services, multiple
charts, or explicit lifecycle control.
Related pages
- Build a REST and WebSocket Chart — the
datafeedoption wired to a real history endpoint and bar stream. - Build a Multi-Chart Workspace — the
multiChartoption with stable chart ids and selective sync. - Customize the Terminal — the
theme,features, and customization options in one worked configuration. - Storage quickstart — connect the
storageoption to browser-local, REST, or custom persistence.