/**
  * User  charts
  *
  * @return Response
  */
 private function userChart()
 {
     $chart = Lava::DataTable('activeusers');
     $chart->addColumn('string', 'Active', 'active');
     $chart->addColumn('string', 'Inactive', 'inactive');
     $chart->addRow(array('Active', DB::table('users')->where('confirmed', '=', '1')->count()));
     $chart->addRow(array('In-active', DB::table('users')->where('confirmed', '!=', '1')->count()));
     Lava::PieChart('activeusers')->addOption(array('chartArea' => array('width' => '98%', 'height' => '98%')))->addOption(array('backgroundColor' => 'none'))->addOption(array('is3D' => 'true'))->addOption(array('legend' => 'none'));
 }
 public function index()
 {
     //Line graph for market cap
     $totalMarketCapGraphData = SectorHistoricals::getIndividualSectorGraphData('All', 'last_month', 'Market Cap');
     $marketCaps = \Lava::DataTable();
     $marketCaps->addStringColumn('Date')->addNumberColumn('Market Cap')->addRows($totalMarketCapGraphData);
     $marketCapsLava = \Lava::AreaChart('MarketCaps')->dataTable($marketCaps)->setOptions(['width' => 725, 'height' => 360, 'title' => 'ASX Market Cap (Billions)']);
     //PieChart for Sectors' Market Caps
     $individualSectorCapsGraphData = SectorHistoricals::getAllSectorGraphData('top_5');
     $sectorCaps = \Lava::DataTable();
     $sectorCaps->addStringColumn('Sector Name')->addNumberColumn('Percent')->addRows($individualSectorCapsGraphData);
     $sectorCapsLava = \Lava::PieChart('Sectors')->dataTable($sectorCaps)->customize(['tooltip' => ['text' => 'percentage']])->setOptions(['width' => 725, 'height' => 360, 'title' => 'Sector Caps (Billions)', 'pieSliceText' => 'label']);
     return view('pages.home')->with(['marketCapsLava' => $marketCapsLava, 'sectorDayGains' => SectorHistoricals::getSectorDayChanges('sectorDayGain'), 'sectorDayLosses' => SectorHistoricals::getSectorDayChanges('sectorDayLoss'), 'sectorDayGainTitle' => SectorHistoricals::getSectorDayChangeTitle('sectorDayGain'), 'sectorDayLossTitle' => SectorHistoricals::getSectorDayChangeTitle('sectorDayLoss')]);
 }
Ejemplo n.º 3
0
 /**
  * @return mixed
  */
 public function reportIniciativaDimensao(Request $request = null)
 {
     if ($request != null) {
         switch ($request['type']) {
             case 'geral':
                 return $this->reportIniciativaDimensaoGeral()->toJson();
                 break;
             case 'regiao':
                 switch ($request['regiao']) {
                     case 1:
                         return $this->reportIniciativaDimensaoByUf([50, 51, 52, 53])->toJson();
                         break;
                     case 2:
                         return $this->reportIniciativaDimensaoByUf([11, 12, 13, 14, 15, 16, 17])->toJson();
                         break;
                     case 3:
                         return $this->reportIniciativaDimensaoByUf([21, 22, 23, 24, 25, 26, 27, 28, 29])->toJson();
                         break;
                     case 4:
                         return $this->reportIniciativaDimensaoByUf([41, 42, 43])->toJson();
                         break;
                     case 5:
                         return $this->reportIniciativaDimensaoByUf([31, 32, 33, 35])->toJson();
                         break;
                 }
                 break;
             case 'estado':
                 if ($request['cidade'] != '') {
                     return $this->reportIniciativaDimensaoByCidade($request['cidade'])->toJson();
                 } else {
                     return $this->reportIniciativaDimensaoByUf([$request['uf']])->toJson();
                 }
                 break;
         }
     } else {
         $dados = $this->reportIniciativaDimensaoGeral();
         $graph = \Lava::PieChart('IniciativaDimensao')->setOptions(['datatable' => $dados, 'is3D' => true]);
         return $graph;
     }
 }
Ejemplo n.º 4
0
<div class="well well-lg col-md-6">
<h4>Planes Por Empresas</h4>
<?php 
use Carbon\Carbon;
$stocksTable = Lava::DataTable();
$empresas = Empresas::all()->toArray();
$stocksTable->addStringColumn('Empresa')->addNumberColumn('Cantidad');
foreach ($empresas as $key => $empresa) {
    $rowData = array($empresa["nombre"], App\Planes::where("empresa_id", "=", $empresa["id"])->count());
    $stocksTable->addRow($rowData);
}
$lineChart = Lava::PieChart('Stocks')->setOptions(array('datatable' => $stocksTable));
echo Lava::render('PieChart', 'Stocks', 'stocks-div', true);
?>
	
</div>
 public function postPerfReports()
 {
     $filter = "go";
     $deptL = Input::get('deptid');
     $sem = Input::get('semester');
     $year = Input::get('year');
     /*if($dept == "*"){
     
     			$users = Performance::all();
     			$deptid = "*";
     
     		}else{
     
     			$users = User::where('department_id', $dept)->get();
     			$deptid = Department::where('id', $dept)->get();
     
     		}*/
     $sampleArray = ['dept_id' => '1', 'semester' => '2015'];
     $sample = Performance::where($sampleArray)->get();
     $users = 'Performance';
     $matchThese = array();
     //If user chooses from dropdown
     if ($deptL != "*") {
         //If true insert this to variable
         $matchThese = array_add($matchThese, 'dept_id', $deptL);
         /***********Add Array*****************/
         //If user chooses from dropdown
         if ($sem != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'semester', $sem);
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
         } else {
             //===========Else of Semester
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 //===========Else of Year
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
             $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
         }
         /***********End Add Array*****************/
     } else {
         //===========Else of Department
         /*************Add Array***************/
         if ($sem != "*") {
             //If true insert this to variable
             $matchThese = array_add($matchThese, 'semester', $sem);
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             }
         } else {
             //===========Else of Semester
             if ($year != "All") {
                 $matchThese = array_add($matchThese, 'year', $year);
                 $query = $users::where($matchThese)->orderBy('overall', 'desc')->get();
             } else {
                 //===========Else of Year
                 $query = $users::all();
             }
         }
         /************End Add Array****************/
     }
     $count = $query->count();
     if (empty($count)) {
         return Redirect::route('perf-reports');
     }
     $out = 0;
     $exemP = 0;
     $exem = 0;
     $noteP = 0;
     $note = 0;
     $satP = 0;
     $sat = 0;
     $fair = 0;
     $un = 0;
     foreach ($query as $perf) {
         $u = $perf->utilities;
         $qow = $perf->workQuality;
         $pffp = $perf->potential;
         $overall = number_format(($u + $qow + $pffp) / 3, 2);
         $rating = ParRatingsRef::where('upper_limit', '>=', $overall)->where('lower_limit', '<=', $overall)->first();
         //============================Conditions=================//
         if ($rating->adjectival == 'O') {
             $out++;
         } elseif ($rating->adjectival == 'E+') {
             $exemP++;
         } elseif ($rating->adjectival == 'E') {
             $exem++;
         } elseif ($rating->adjectival == 'N+') {
             $noteP++;
         } elseif ($rating->adjectival == 'N') {
             $note++;
         } elseif ($rating->adjectival == 'S+') {
             $satP++;
         } elseif ($rating->adjectival == 'S') {
             $sat++;
         } elseif ($rating->adjectival == 'F') {
             $fair++;
         } elseif ($rating->adjectival == 'U') {
             $un++;
         }
     }
     //========================Percentage================//
     $percent_out = $out / $count * 100;
     $percent_exemP = $exemP / $count * 100;
     $percent_exem = $exem / $count * 100;
     $percent_satP = $satP / $count * 100;
     $percent_sat = $sat / $count * 100;
     $percent_noteP = $noteP / $count * 100;
     $percent_note = $note / $count * 100;
     $percent_fair = $fair / $count * 100;
     $percent_un = $un / $count * 100;
     //====================================LavaChart==================================//
     $lava = new Lavacharts();
     // See note below for Laravel
     $overall = Lava::DataTable();
     $overall->addStringColumn('Reasons')->addNumberColumn('Percent')->addRow(array('Outstanding (' . $out . ')', $percent_out))->addRow(array('Exemplary Plus (' . $exemP . ')', $percent_exemP))->addRow(array('Exemplary (' . $exem . ')', $percent_exem))->addRow(array('Noteworthy Plus(' . $noteP . ')', $percent_noteP))->addRow(array('Noteworthy (' . $note . ')', $percent_note))->addRow(array('Satisfactory Plus (' . $satP . ')', $percent_satP))->addRow(array('Satisfactory (' . $sat . ')', $percent_sat))->addRow(array('Fair (' . $fair . ')', $percent_fair))->addRow(array('Unutilized (' . $un . ')', $percent_un));
     $piechart = Lava::PieChart('IMDB')->setOptions(array('datatable' => $overall, 'title' => 'Performance Overall Rating (Total: ' . $count . ')', 'is3D' => true, 'slices' => array(Lava::Slice(array('offset' => 0.2)), Lava::Slice(array('offset' => 0.25)), Lava::Slice(array('offset' => 0.3)))));
     /*
     		$userquery = User::query();
     		$deptidquery = Department::query();
     
     		if($dept == "*"){
     
     			$deptidquery = "*";
     			$users = User::all();
     		}else{
     
     			$userquery = $userquery->where('department_id', $dept);
     			$deptidquery = $deptidquery->where('id', $dept);
     		}
     
     
     		$users = $userquery->get();
     		$deptid = $deptidquery->get();*/
     Session::put('deptpdf', $deptL);
     if ($deptL == '*') {
         $deptL = 'All';
     } else {
         $deptL = Department::where('id', $deptL)->pluck('name');
     }
     //------------------------------
     if ($sem == '*') {
         $sem = 'All';
     }
     if ($year == '*') {
         $year = 'All';
     }
     Session::put('sempdf', $sem);
     Session::put('yearpdf', $year);
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Performance System Admin', 'action' => 'filtered the performance reports.']);
     return View::make('perf.perf-reports')->with('query', $query)->with('filter', $filter)->with('deptL', $deptL)->with('sem', $sem)->with('year', $year);
     /*
     		if($dept == "*"){
     
     			$users = User::all();
     			$deptid = "*";
     
     		}else{
     
     			$users = User::where('department_id', $dept)->get();
     			$deptid = Department::where('id', $dept)->get();
     
     		}
     
     
     
     		return View::make('emp.ems-reports')
     		->with('users', $users)
     		->with('deptid', $deptid);*/
 }
<?php

$stocksTable = Lava::DataTable();
$stocksTable->addStringColumn('Cantidad de Usuarios')->addNumberColumn('Cantidad');
$rowData = array('Al Día', Residencias::where('solvencia', "=", 1)->count());
$stocksTable->addRow($rowData);
$rowData = array('Morosos', Residencias::where('solvencia', "=", 0)->count());
$stocksTable->addRow($rowData);
$chart = Lava::PieChart('morosoChart')->title("Usuarios Morosos Vs Al Día")->colors(array('green', 'red'));
$chart->datatable($stocksTable);
?>
	
<h3 class="text-success text-center">Grafico de Usuarios Por Morosidad</h3>
{{Lava::  render('PieChart', 'morosoChart', 'morosoChart', array('width'=> 500, 'height' => 300));}}
Ejemplo n.º 7
-1
 public function getChart($title, $chartType, $height, $width, $arrayColors, $datatTable)
 {
     if ($chartType = 'PieChart') {
         \Lava::PieChart($title)->setOptions(array('datatable' => $datatTable, 'legend' => \Lava::Legend(array('position' => 'none')), 'chartArea' => \Lava::ChartArea(['width' => $width, 'height' => $height]), 'colors' => $arrayColors, 'is3D' => true));
     } elseif ($chartType = 'DonutChart') {
     }
 }
Ejemplo n.º 8
-1
 public function getChart(Request $request)
 {
     $reasons = \Lava::DataTable();
     $reasons->addStringColumn('Reasons')->addNumberColumn('Percent')->addRow(array('Passed', 50))->addRow(array('Failed', 30))->addRow(array('Skipped', 20));
     $piechart = \Lava::PieChart('myPieChart')->setOptions(array('datatable' => $reasons, 'legend' => \Lava::Legend(array('position' => 'none')), 'chartArea' => \Lava::ChartArea(['width' => 250, 'height' => 250]), 'colors' => array('078B3E', 'CD1E35', 'FCDC27')));
     $threedpiechart = \Lava::PieChart('myThreeDPieChart')->setOptions(array('datatable' => $reasons, 'legend' => \Lava::Legend(array('position' => 'none')), 'chartArea' => \Lava::ChartArea(['width' => 250, 'height' => 250]), 'colors' => array('368DB9', 'A41034', 'FCDC27'), 'is3D' => true));
     $donutchart = \Lava::DonutChart('myDonut')->setOptions(array('datatable' => $reasons, 'legend' => \Lava::Legend(array('position' => 'none')), 'chartArea' => \Lava::ChartArea(['width' => 250, 'height' => 250]), 'colors' => array('368DB9', 'A41034', 'FCDC27')));
 }