-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart.js
33 lines (28 loc) · 1.09 KB
/
chart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const getThemeConfig = () => {
const root = getComputedStyle(document.documentElement)
const isDarkTheme = localStorage.getItem('theme') === 'light-theme' ? false : true
const backgroundColor = root.getPropertyValue(isDarkTheme ? '--chart-dark-bg' : '--chart-light-bg').trim()
const gridColor = root.getPropertyValue(isDarkTheme ? '--chart-dark-border' : '--chart-light-border').trim()
return {
autosize: true,
symbol: "BINANCE:BTCUSDT",
interval: "4H",
timezone: "Etc/UTC",
theme: isDarkTheme ? 'dark' : 'light',
style: "1",
locale: "en",
backgroundColor: backgroundColor,
gridColor: gridColor,
hide_side_toolbar: false,
allow_symbol_change: true,
save_image: true,
details: true,
calendar: false,
support_host: "https://www.tradingview.com"
}
}
const initializeWidget = () => {
const widgetConfig = getThemeConfig()
createWidget('chart-widget', widgetConfig, 'https://s3.tradingview.com/external-embedding/embed-widget-advanced-chart.js')
}
initializeWidget()