How to generate graphs with Laravel 5.6 and Mysql? [closed]

-1

Good afternoon, I'm doing a project that I would like to add some graphics to, but the libraries I found were not very effective ... I would like some indication of some library to use along with Laravel and MySql ... If possible with documentation on how to use it.

Thank you!

    
asked by anonymous 20.06.2018 / 21:43

1 answer

0

Hello, use lavacharts, very simple documentation and graphics handling - > link

A practical example:

Controller -

use Illuminate\Support\Facades\DB;
use Khill\Lavacharts\Lavacharts;

public function laudo(Request $request)
{
        $id = $request->input('id');
//resultado de consulta no banco usando DB
$data = DB::table('tb_votes')
                ->join('tb_pessoa', 'tb_votes.fk_vote', '=', 'tb_pessoa.id')
                ->where('tb_votes.id', '=', $id)
                ->select('tb_votes.*', 'tb_pessoa.*')
                ->get();

//se inicia a contrução do grafico
$lava = new Lavacharts; 

$votes  = $lava->DataTable();

$votes->addStringColumn('Food Poll')
      ->addNumberColumn('Votes');
foreach ($data as $datas)
        {
        $lava->addRow([$datas->numero,   $datas->voto]);
        }

$lava->BarChart('Votes', $votes);

return view('monitoria.laudoOperador')->with(['lava' => $lava,'data' => $data]);
    }
    
08.01.2019 / 13:54