Chartjs-How do I implement Laravel Analytics with Chart.js

0👍

if you already have a json object/file you can get the data with json.parse(json var) , it will return you the data

0👍

You take 7 from your controller but the output is 8, check that also. And In your JS

var myData = [
   @foreach($analytics as $analis)
      {{ $analis->visitors }}, //remeber to put comma (,) at end for array
   @endforeach
]

data: {
    datasets: [{
        data: myData,
    }]
},

Leave a comment