charting-library-examples icon indicating copy to clipboard operation
charting-library-examples copied to clipboard

Unable to set custome time frame/range

Open romain-neil opened this issue 10 months ago • 0 comments

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

Image (picure from the documentation itself)

romain-neil avatar Apr 09 '25 11:04 romain-neil