Skip to Content
API ReferenceConfiguration

Configuration API

Pass a ChartConfig object to createChart() (or as props on <GoCharting />). Nested objects map to typed shapes such as TradingConfig and ExcludeOptions.

Quick example

import { createChart } from "@gocharting/chart-sdk"; const chart = createChart("#chart-container", { symbol: "BYBIT:FUTURE:BTCUSDT", interval: "1m", datafeed: myDatafeed, licenseKey: "YOUR_LICENSE_KEY", theme: "dark", disableSearch: false, disableCompare: false, trading: { enableTrading: true, showOpenOrders: true, showPositions: true, supportStopOrders: true, supportStopLimitOrders: true, }, appCallback: (event) => { console.log(event.eventType, event.message); }, onReady: (chartInstance) => { console.log("ready", chartInstance); }, onError: (error) => { console.error(error); }, });

ChartConfig at a glance

Canonical field list: Types → ChartConfig. Summary of applied options:

GroupFieldsTypes
Requireddatafeed, symbol, interval, licenseKeyDatafeed
Displaytheme, themeColor, locale, autosize, width, height
Chrome flagsdisableSearch, disableCompare, hideDrawingToolBar, excludeExcludeOptions
TradingtradingTradingConfig
Construct features (P4)disabled_features, enabled_features, overrides, studies_overrides, settings_overrides, custom_css_url, custom_themes, timezone, toolbar_bg, time_frames, timeframe, favorites / favourite
Construct chromeloading_screen, custom_font_family, compare_symbols, symbol_search_symbols_types, custom_timezones, custom_translate_function, header_widget_buttons_mode, additional_symbol_info_fields
Construct hookssymbol_search_complete, save_chart_to_server_callback, suggested_chart_change_adapter, context_menu.items_processor, context_menu.renderer_factory
PersistenceautoSave, auto_save_delay, save_load_adapter, load_last_chart, saved_data, snapshot_url, image_storage_adapter
MobileisNativeApp, touchMode
OverridesdefaultInitialChartConfig, contextMenu, popups, favouriteDefaultInitialChartConfig, ContextMenuOptions, PopupsConfig, FavouriteConfig
CallbacksappCallback, onReady, onErrorEvents
Note

Options that are accepted but not applied yet are omitted here (same policy as other API pages). Prefer the types file for the full TypeScript surface.


Required options

OptionTypeDescription
datafeedDatafeedBars, resolve, optional search / ticks / marks
symbolstringInitial symbol (e.g. "BYBIT:FUTURE:BTCUSDT")
intervalstringInitial interval (e.g. "1m", "1D")
licenseKeystringSDK license key (unless skipLicenseValidation: true)

Display

theme / themeColor

  • theme: "light" | "dark" (default "light"). Maps to #ffffff / #22292f when themeColor is omitted.
  • themeColor: any hex background (e.g. "#570f0f"). You may pass hex alone — do not also force theme: "light" unless you want the named mode.
theme: "dark", // or themeColor: "#1a1a1a",

See Themes. Interactive lab: examples/themes-lab.html.

autosize / width / height / locale

OptionDefaultNotes
autosizetrueAutoFit responsive sizing
width / height"100%"Number (px) or CSS length
locale"en-US"UI translation locale

Chrome flags

disableSearch / disableCompare / hideDrawingToolBar

OptionDefaultEffect
disableSearchfalseHide top-bar symbol search
disableComparefalseHide Compare control
hideDrawingToolBarfalseHide left drawing toolbar
disableSearch: true, disableCompare: true, hideDrawingToolBar: true,

exclude

Type: ExcludeOptions

Hide chrome regions or indicators at construct time:

exclude: { leftPanel: true, rightPanel: true, drawingToolbar: true, indicators: ["SMA", "EMA"], },

Runtime toggles also exist via chart.features() — see Chart API.


Trading — trading

Type: TradingConfig

trading: { enableTrading: true, showOpenOrders: true, showPositions: true, showExecutions: true, showNotifications: true, showReverseButton: true, beep: true, quickTradeMode: false, supportStopOrders: true, supportStopLimitOrders: true, enableTakeProfitDefaults: true, defaultTakeProfitSpread: 10, defaultTakeProfitSpreadType: "tick", enableStopLossDefaults: true, defaultStopLossSpread: 5, defaultStopLossSpreadType: "tick", boxAlignment: "right", lineCategory: "extended", },

Notes:

  • Gate is trading.enableTrading (default false).
  • Orders/positions need broker data via setBrokerAccounts() — see Trading.
  • Handle UI actions with appCallback (PLACE_ORDER, MODIFY_ORDER, …).
  • supportStopOrders / supportStopLimitOrders also require broker orderConfig support for stop types.

Minimal enable:

trading: { enableTrading: true },

Construct-time features (Phase 4)

Apply once at createChart. Prefer these for initial chrome; use runtime features() / applyOverrides() for later changes.

disabled_features / enabled_features

TV-style featuresets mapped onto GC chrome (exclude, disableSearch, disableCompare, hideDrawingToolBar, …). enabled_features runs after disabled_features.

disabled_features: ["header_symbol_search", "left_toolbar", "header_compare"], enabled_features: ["header_compare"], // re-enable after disable

Lab: examples/phase4-constructor-lab.html.

overrides / studies_overrides / settings_overrides

OptionMerges into
overridesChart appearance (same nested GC shape as applyOverrides)
studies_overridesStudy styles keyed by indicator type
settings_overridesdefaultInitialChartConfig.settings
overrides: { appearance: { backgroundColor: "#0f1419" }, }, studies_overrides: { EMA: { appearance: { strokeStyle: "#3d8bfd" } }, }, settings_overrides: { zone: "America/New_York", },

custom_css_url / custom_themes / toolbar_bg / timezone

OptionEffect
custom_css_urlInject stylesheet once (addCustomCSSFile)
custom_themesCSS theme tokens via customThemes()
toolbar_bgSets toolbar CSS vars on the chart container
timezoneIANA zone → settings.zone

Construct chrome

OptionEffect
loading_screenOverlay while hydrating — { backgroundColor?, foregroundColor?, text? }
custom_font_familyCSS font family on the chart container
compare_symbolsSeed Compare overlays (string or { symbol, exchange?, … } entries)
symbol_search_symbols_typesType filter chips in symbol search (string or { name, value } entries)
custom_timezonesExtra zones merged into the timezone picker
custom_translate_function(key, options, defaultMessage?) => string wrap after intl init
header_widget_buttons_mode"fullsize" | "compact" | "adaptive" top-bar density
additional_symbol_info_fieldsExtra fields shown with symbol status / bottom bar

[!NOTE] Chart Y-axis tick labels use symbol tick_size / max_tick_precision from resolveSymbol — not a host-controlled TV pricescale. Construct numeric_formatting / custom_formatters (if present on the type surface) only affect optional host helpers and do not restyle the live price axis.

loading_screen: { backgroundColor: "#0f1419", foregroundColor: "#fff", text: "Loading…" }, custom_font_family: "IBM Plex Sans, sans-serif", compare_symbols: ["NASDAQ:AAPL", { symbol: "MSFT", exchange: "NASDAQ" }], symbol_search_symbols_types: ["stock", { name: "Crypto", value: "crypto" }], header_widget_buttons_mode: "compact",

Construct hooks

OptionEffect
symbol_search_completeCalled after a successful symbol pick from search
save_chart_to_server_callbackCalled when a named layout save completes
suggested_chart_change_adapter{ canAcceptSuggestedChange, onSuggestedChange? } — gate setSymbol / setInterval
context_menu.items_processorPost-process context-menu items before show
context_menu.renderer_factoryReplace the item list (not full custom React trees)
symbol_search_complete: (symbol) => console.log("picked", symbol), save_chart_to_server_callback: (meta) => console.log("saved", meta), suggested_chart_change_adapter: { canAcceptSuggestedChange: ({ type }) => type !== "symbol" || confirm("Change symbol?"), }, context_menu: { items_processor: (items) => items.filter((i) => i.label !== "Hide"), },

time_frames / timeframe / favorites

OptionEffect
time_framesFilter intervals exposed by getIntervals / picker
timeframeAfter init, activeChart().setTimeFrame(...)
favoritesTV-shaped favorites mapped onto GC FavouriteConfig

Persistence

Two different mechanisms:

OptionWhat it does
autoSavePersist chart UI state to sessionStorage (tab-scoped; default true)
auto_save_delayDebounce (seconds, default 5) before widget event onAutoSaveNeeded — host should call saveChartToServer / your adapter
autoSave: false, // you own layout state auto_save_delay: 2, save_load_adapter: mySaveLoadAdapter, load_last_chart: true, // or saved_data: layoutBlob, // wins over load_last_chart snapshot_url: "https://example.com/upload-screenshot",
OptionNotes
save_load_adapterNamed chart / study-template persistence (Phase 5)
load_last_chartAfter init, load newest chart from adapter
saved_dataLayout blob (or JSON string) applied after hydrate
snapshot_urlPOST target for takeScreenshot() (multipart preparedImage)
image_storage_adapterPreferred over snapshot_url when both are set
client_id / user_idOptional storage scoping

Subscribe: chart.subscribe("onAutoSaveNeeded", …) — see Events. Lab: examples/phase5-persistence-lab.html.


Mobile / WebView

OptionDefaultBehavior
isNativeAppfalseMobile canvas; hide JS top/bottom bars; suppress JS context menu → OPEN_CONTEXT_MENU; bridge via sendToNative
touchModefalseFull JS mobile Chart-tab chrome (bars + menus), not the full TerminalMobile app
isNativeApp: true, appCallback: (event) => { // Single event object — also posted to the native bridge console.log(event.eventType, event.message); },

Guides: Mobile WebView, Mobile Integration (includes a Desktop/Mobile touchMode true vs false compare lab).


Nested overrides

defaultInitialChartConfig

Type: DefaultInitialChartConfig

Deep-merge into initial chart settings / appearance:

defaultInitialChartConfig: { settings: { showCrosshairPlusIcon: false, zone: "America/New_York", }, },

showCrosshairPlusIcon at the top level of ChartConfig is equivalent to defaultInitialChartConfig.settings.showCrosshairPlusIcon.

contextMenu

Type: ContextMenuOptions
Alias: context_menu.

contextMenu: { showTradingOptions: true },

popups

Type: PopupsConfig

Panel state overrides keyed by panel id (TradingPanel, Settings, Layers, …) — not welcome/tutorial flags.

popups: { TradingPanel: { title: "Order Ticket" }, Settings: { visible: false }, },

favourite

Type: FavouriteConfig

favourite: { INTERVALS: ["1m", "5m", "1D"], DRAWINGS: ["trendline", "rectangle"], INDICATOR: ["RSI", "MACD"], },

Callbacks & misc flags

OptionDefaultNotes
appCallbackSingle AppCallbackEvent object — see Events
onReadyChart instance ready for API calls
onErrorConstruct / fatal errors
debugLogfalseVerbose SDK console logs
skipLicenseValidationfalseDemo only — skip licenseKey requirement
alwaysDrawModefalseKeep drawing tool armed after place

Labs: phase4-constructor-lab.html, tv-parity-construct-lab.html, phase5-persistence-lab.html, themes-lab.html.

Last updated on