charts stuff
This commit is contained in:
@@ -111,50 +111,10 @@ class SRPAdminController extends Controller
|
|||||||
|
|
||||||
public function displayStatistics() {
|
public function displayStatistics() {
|
||||||
$months = 3;
|
$months = 3;
|
||||||
$fcLosses = array();
|
|
||||||
$lava = new Lavacharts;
|
|
||||||
$ad = new Lavacharts;
|
|
||||||
|
|
||||||
//We need a function from this library rather than recreating a new library
|
//We need a function from this library rather than recreating a new library
|
||||||
$srpHelper = new SRPHelper();
|
$srpHelper = new SRPHelper();
|
||||||
|
|
||||||
//Get the dates for the tab panes
|
return view('srp.admin.statistics');
|
||||||
$dates = $srpHelper->GetTimeFrame($months);
|
|
||||||
|
|
||||||
$approved = $srpHelper->GetApprovedValue($dates['start']->toFormattedDateString(), $dates['end']->toFormattedDateString());
|
|
||||||
$denied = $srpHelper->GetDeniedValue($dates['start']->toFormattedDateString(), $dates['end']->toFormattedDateString());
|
|
||||||
dd($denied);
|
|
||||||
//Get the approved requests total by month of the last 3 months
|
|
||||||
$adLava = new Lavacharts;
|
|
||||||
|
|
||||||
$ad = $adLava->DataTable();
|
|
||||||
$ad->addStringColumn('Value');
|
|
||||||
$ad->addNumberColumn('ISK');
|
|
||||||
$ad->addRow(['Approved', $approved])
|
|
||||||
->addRow(['Denied', $denied]);
|
|
||||||
$adLava->PieChart('Approved / Denied', $ad, [
|
|
||||||
'title' => 'Approved vs. Denied SRP Values',
|
|
||||||
'is3D' => true,
|
|
||||||
'slices' => [
|
|
||||||
['offset' => 0.25],
|
|
||||||
['offset' => 0.30],
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Create chart for fc losses
|
|
||||||
$losses = $lava->DataTable();
|
|
||||||
$losses->addStringColumn('FC Losses');
|
|
||||||
$losses->addNumberColumn('ISK');
|
|
||||||
$date = $srpHelper->GetTimeFrameInMonths(1);
|
|
||||||
$fcLosses = $srpHelper->GetLossesByFC($date['start'], $date['end']);
|
|
||||||
//Create the rows for the table
|
|
||||||
foreach($fcLosses as $key => $value) {
|
|
||||||
$losses->addRow([$key, $value]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$lava->BarChart('ISK', $losses);
|
|
||||||
|
|
||||||
return view('srp.admin.statistics')->with('lava', $lava)
|
|
||||||
->with('adLava', $adLava);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ return [
|
|||||||
Laravel\Socialite\SocialiteServiceProvider::class,
|
Laravel\Socialite\SocialiteServiceProvider::class,
|
||||||
Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class,
|
Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class,
|
||||||
ConsoleTVs\Charts\ChartsServiceProvider::class,
|
ConsoleTVs\Charts\ChartsServiceProvider::class,
|
||||||
//Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,
|
Khill\Lavacharts\Laravel\LavachartsServiceProvider::class,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
@extends('layouts.b4')
|
@extends('layouts.b4')
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div id="approved_denied"></div>
|
|
||||||
{!! $adLava->render('PieChart', 'Approved / Denied', 'approved_denied') !!}
|
|
||||||
|
|
||||||
<div id="FC_Losses"></div>
|
|
||||||
{!! $lava->render('BarChart', 'ISK', 'FC_Losses') !!}
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
Reference in New Issue
Block a user