mercredi 27 juillet 2016

How to create dynamic charts using lavacharts and laravel?

Actually i want add dynamic charts in my laravel web-application that reacts to changes in database..I am using lavacharts..I am able to create charts that work on data that i input through my code.

here is my controller

   <?php
   namespace App\Http\Controllers;
   use Illuminate\Http\Request;
   use App\Http\Requests;
   use DB;
   use App\Http\Controllers\Controller;
   use Khill\Lavacharts\Laravel\LavachartsFacade as Lava;

   class ratingscontroller extends Controller{

   public function index(){


      $stocktable = \Lava::DataTable();

      $stocktable->addDateColumn('Day of Month')
           ->addNumberColumn('projected')
           ->addNumberColumn('official');


           for($a = 1; $a < 30; $a++){
            $stocktable->addRow([
                '2015-10-' . $a, rand(800,1000), rand(800,1000)


                ]);


           }

              $chart = \Lava::AreaChart('MyStocks', $stocktable);
                           return view('welcome');

          }}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire