Laravel 5.6 using laracharts. Chart wont render

Posted 9 months ago by andremac96

Hi

I'm trying to test out laracharts using laravel 5.6. The chart doesn't print out in the view, only the code in text form.

Controller.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Khill\Lavacharts\Lavacharts;

class HomeController extends Controller
{

    public function index()
    {

        $votes  = Lava::DataTable();

        $votes->addStringColumn('Food Poll')
              ->addNumberColumn('Votes')
              ->addRow(['Tacos',  rand(1000,5000)])
              ->addRow(['Salad',  rand(1000,5000)])
              ->addRow(['Pizza',  rand(1000,5000)])
              ->addRow(['Apples', rand(1000,5000)])
              ->addRow(['Fish',   rand(1000,5000)]);
        
        Lava::BarChart('Votes', $votes);
        
        $data['votes'] = Lava::BarChart('Votes', $votes);

        
        return view('pages/home', $data);
    }
}

view

@section('content')

@barchart('Votes', 'poll_div')


@endsection

This is the output in my view. No chart only code.

enter image description here

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

Reply to

Use Markdown with GitHub-flavored code blocks.