1

I want to integrate TradingView's charting library in my Laravel project.

I have copied the charting_library folder to the Public folder of Laravel.

After that, I have referenced the charting_library.min.js file from Blade files in view and the other resources related to it.

<script type="text/javascript" src="{{ asset('tradingview/charting_library/charting_library.min.js') }}">

All js files loads successfully, but the problem is that this charting_library.min.js calls an HTML file from a subdirectory where it returns a 404 Not Found error.

http://localhost:8000/charting_library/static/fa-tv-chart.37***ee.html 404 (Not Found)

Here is the file/folder structure:

enter image description here

I have checked loaded resources from chrome's dev tools.

Laravel loads these referenced JS files, but it doesn't load any other files which these files have requested and just returns 404.

enter image description here

The charting_library folder exists in the directory, it's just something related to Laravel. I think it can't see the directory's contents.

I have tried to modify the .htaccess file but still no luck.

I even tried to mix charting_library.min.js via Webpack, changing autoload, but still, nothing happens.

2
  • Have you tried running your site over a local virtual host like apache? Commented Dec 6, 2020 at 17:37
  • So what is the URL of the JS library file? Can you access http://localhost:8000/charting_library/static/fa-tv-chart.37***ee.html in your browser? Why is a JavaScript file trying to access files with a non-relative URL? Commented Dec 6, 2020 at 18:21

1 Answer 1

2

I solved this issue by:

  1. Moving the project to wamp's www folder.

  2. Moving charting_library and datafeeds folder to the root of laravel's public. It seems tradingview's widget constructor uses relative path's for building whole chart. So when you place the charting_library inside a folder, it doesn't resolve other assets. These folders should be exactly in the root.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks to @babak-ashrafi 's comment. It turned me to the right path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.