charting-library-examples
charting-library-examples copied to clipboard
Unable to set custome time frame/range
Checlist Note: As the charting library is not public, or hasbeen remove, and has we cant contact TV by email, I post my issue here.
Describe the bug
Hello, I try to set a custom chart timeframe. According to the documentation available at https://www.tradingview.com/charting-library-docs/latest/ui_elements/Time-Scale/ , I wrote the following code :
const widget = new window.TradingView.widget({
//...
}
widget.onChartReady(() => { const chart = widget.chart(); chart.setTimeFrame({val: {type: 'period-back', value: selectedFilter}, res: selectedFilter})})
The error I got is : TypeError: widget.onChartReady is not a function
Please note that the code is inside a reatc project.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
(picure from the documentation itself)