I would like to ask how install and integrate chartjs@2.9.4 with my laravel application.
I use cdn links right now but later it wont be an option for me later.
Used cdn links:
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-treemap@0.2.3"></script>
Method I tried:
- Installing chartjs
npm i chart.js@2.9.4
- Add this line in webpack.mix.js:
mix.copy('node_modules/chart.js/dist/chart.js', 'public/chart.js/chart.js');
- Then run this from command line:
npm run dev
- In the blade you want the chart on:
<script src="{{ asset('chart.js/chart.js') }}"></script>