Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincentsanity's avatar

Laravel 5.5 Consoletv's Charts not working when rendering

I got an error of "Undefined variable: chart" when i want to render my charts. I dont know how this error occured but when i dd the data it shows me but when i render it in table it gets me an error. I already imported and installed consoleTV's chart package and still it gets me an error.

graph.blade.php

@extends('coin.app')


@section('graph')

  {!! $chart->render() !!}

@endsection

GraphController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\DB;


use Charts;
use App\Graph;

{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        
        $chart = Charts::database(Graph::get()->find(1),'line','highcharts')
                 ->title('Coins')
                 ->Width(0)
                 ->Responsive(true);

        //  dd($chart);


          return view('coin.app', ['chart' => $chart]);
    }
}


web.php

//home 
Route::get('/coindeoro', function()
{
    // return view('coin.app');
    return View::make('coin.news');
});

app.blade.php

stylesheets....
   
    {!! Charts::assets() !!}


content....

@yield('graph')


scripts....

0 likes
1 reply
jlrdw's avatar

I really am not familiar with that chart program, but just wondering is that width correct.

1 like

Please or to participate in this conversation.