dan3460
240
3
Laravel

Charts not rendering

Posted 3 months ago by dan3460

I need to put some charts on a web site. So i was testing on a new install to see how to use consoletvs/charts, which seems pretty powerful. I follow the instructions but only get a wait icon on the page. Here is what i have: my controller:


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Charts\TestChart;

class ChartController extends Controller
{
    public function index()
    {
        $chart = new TestChart;

        $chart->labels('One','two','three');
        $chart->dataset('First','line',[20,18,15,45]);

        return view('welcome',compact('chart'));
    }
}

The top of the welcome page:

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.js" charset="utf-8"></script>

and where the chart supposed to render:


            <div class="content">
                <div class="title m-b-md">
                    Laravel
                </div>
                {!!$chart->container()!!}


            </div>

I'm missing something else? Thanks for the help.

Please sign in or create an account to participate in this conversation.