Chart Configuration
Create a chart with new Chart(options) and pass the options below.
containeranddatafeedare required.
| Parameter | Description | Mandatory |
|---|---|---|
container | The HTML element that hosts the chart. | Yes |
datafeed | The market data source used by the chart. | Yes |
symbol | The initial symbol to display. | No |
interval | The initial timeframe or interval. | No |
theme | The initial theme name or theme object. | No |
chartType | The initial chart style such as candlestick or line. | No |
locale | The language and formatting locale. | No |
timezone | The timezone used for the chart display. | No |
autosize | Makes the chart follow the size of its container. | No |
width | Sets an explicit chart width. | No |
height | Sets an explicit chart height. | No |
disabled_features | Turns off selected chart features. | No |
enabled_features | Turns on selected chart features. | No |
enabled_resolution | Limits the available resolutions shown to the user. | No |
debug | Enables extra debug behavior. | No |
layout | Selects the initial layout type. | No |
hideSidebars | Hides the sidebars in the chart shell. | No |
externalSaveLoadAdapter | Connects the chart to an external layout persistence system. | No |
persistExternalAdapterToLocalStorage | Controls whether external adapter state is cached locally. | No |
load_last_chart | Restores the last saved chart when available. | No |
save_to_local_storage | Saves chart state locally for automatic restore. | No |
visible_plots_set | Controls whether the chart shows OHLC, OHLCV, or close-only data. | No |
Example
const chart = new Chart({
container: document.getElementById("chart")!,
datafeed,
symbol: "AAPL",
interval: "1D",
theme: "dark",
autosize: true,
});