LightweightCharts is not defined

Hello! First time posting any sort of tutorial so please excuse the formatting.

Earlier I was running into an issue where a TradingView widget I embedded on my site was not loading on the page. After some messing around I was able to work around the issue and was told to share the solution here just in case anybody else ran into this.


I was able to get my code to work on JSbin so I figured the issue had something to do with my server. I eventually noticed this error in the console. So chances are if you’re having the same issue and are seeing this same error the problem has to do with the lightweight charts library not being loaded.

I still am not 100% sure why this was happening but I was able to fix it by downloading the lightweight charts library, adding it to my server, and then replacing:

<script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script>

with:

<script src="/assets/js/lightweight-charts.js"></script>

Hope this helps somebody!

1 Like

Implement the Lightweight charting widget with Bitquery GraphQL API