Laravel 5.6 using laracharts. Chart wont render

Posted 7 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.