tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.33k stars 744 forks source link

Unhandled Rejection (TypeError): t._innerWindow(...).widgetReady is not a function #189

Closed raghibislam closed 3 years ago

raghibislam commented 3 years ago

I used this library in react js application with finnhub.io api and getting this error .

× Unhandled Rejection (TypeError): t._innerWindow(...).widgetReady is not a function (anonymous function) src/charting_library/charting_library.min.js:314 311 | n.addEventListener("load", e, !1); 312 | })), 313 | this._innerWindowLoaded.then(function () {

314 | t._innerWindow().widgetReady(function () { | ^ 315 | t._ready = !0; 316 | for (var e = 0, o = t._readyHandlers; e < o.length; e++) { 317 | var n = o[e]; View compiled This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error. Click the 'X' or hit ESC to dismiss this message.

timocov commented 3 years ago

Did you look in similar issues https://github.com/tradingview/charting-library-examples/issues?q=is%3Aissue+sort%3Aupdated-desc+widgetReady+is%3Aclosed ?

raghibislam commented 3 years ago

Similar but i have issue on line number 314 . And from the above link I can't solve the issue at all.

timocov commented 3 years ago

Can you check what's loading inside iframe? Probably you get 404 or different page there.

raghibislam commented 3 years ago

Please check this image , i hope this will help you

https://user-images.githubusercontent.com/46419375/96755464-7a4fde00-13f2-11eb-9325-c6d2a29c4ad1.png

Best regards.

timocov commented 3 years ago

@raghibislam it doesn't answer on my question. I got your point and seen this error many times, that's why I asked about checking what exactly is loaded inside iframe.

green-john commented 3 years ago

Hi @timocov, I hope you are well! I'm also having this same issue

I am using react and plain js. When I run the example, things work properly and I see the iframe has src="/charting_library/.....", however, when running in my react app, the src is missing /charting_library/. If I add it manually (as in changing the HTML from inspector) the graph loads. Here's my config

const config = {
    libraryPath: '/charting_library/',
    // ...
}

Thank you in advance for the help

Edit: I'm an idiot! I had to use library_path instead of libraryPath

Viktor19931 commented 2 years ago

@timocov got same issue on prod build

Screenshot 2021-12-24 at 13 01 29

Followe by https://github.com/tradingview/charting-library-tutorial/blob/master/documentation/integration.md