Prediction Charts
This commit is contained in:
1 parent
18a672a5de
commit
cd66207bc7
5 files changed
+272
-34
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Api;
|
||||
use App\Chart;
|
||||
|
||||
Route::get('/', function () {
|
||||
|
||||
@@ -20,9 +21,19 @@ Route::get('/', function () {
|
||||
$propsPerRegionCounts[] = $el['count_properties'];
|
||||
}
|
||||
|
||||
$chartOptions = [
|
||||
'colors' => Chart::colors()
|
||||
];
|
||||
|
||||
$propertiesGeo = Api::propertiesGeo();
|
||||
|
||||
return view('overview', ["regions" => $regionBase, "regionPropertiesCapacities" => $regionPropertyCapacities, "geo" => $propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionId), json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]);
|
||||
return view('overview', [
|
||||
"regions" => $regionBase,
|
||||
"regionPropertiesCapacities" => $regionPropertyCapacities,
|
||||
"geo" => $propertiesGeo,
|
||||
"growth" => $propertiesGrowth,
|
||||
"chartOptions" => $chartOptions,
|
||||
"propsPerRegion" => [json_encode($propsPerRegionId), json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]);
|
||||
});
|
||||
|
||||
Route::get('/property/{id}', function (int $id) {
|
||||
@@ -92,14 +103,38 @@ Route::get('/region/{id}', function (int $id) {
|
||||
$regionBaseAll = Api::regionBase(-1);
|
||||
$regionBaseAll[] = ['region_name' => 'Alle Regionen', 'region_id' => -1];
|
||||
$regionBaseRegion = $id >= 0 ? Api::regionBase($id) : [['region_name' => 'Alle Regionen']];
|
||||
$regionMovingAverage = Api::regionMovingAverage($id, '2024-04-25');
|
||||
|
||||
$regionPropertiesCapacities = Api::regionPropertiesCapacities($id);
|
||||
$regionCapacitiesRegion = Api::regionCapacities($id);
|
||||
$regionCapacitiesAll = Api::regionCapacities(-1);
|
||||
$regionCapacities = [$regionCapacitiesAll, $regionCapacitiesRegion];
|
||||
|
||||
return view('region', ['regions' => $regionBaseAll, 'region' => $regionBaseRegion, 'region_id' => $id, 'regionCapacities' => $regionCapacities, 'regionPropertiesCapacities' => $regionPropertiesCapacities, 'prediction' => $regionMovingAverage]);
|
||||
$regionCapacitiesMonthly = [];
|
||||
$regionCapacitiesDaily = [];
|
||||
$regionPredictions = [];
|
||||
|
||||
foreach ($regionCapacitiesRegion['dates'] as $date) {
|
||||
$regionCapacitiesMonthly[] = Api::regionCapacitiesMonthly($id, $date);
|
||||
$regionCapacitiesDaily[] = Api::regionCapacitiesDaily($id, $date);
|
||||
$regionPredictions[] = Api::regionMovingAverage($id, $date);
|
||||
}
|
||||
|
||||
$regionCapacities = [
|
||||
'all' => $regionCapacitiesAll,
|
||||
'region' => $regionCapacitiesRegion,
|
||||
'region_monthly' => $regionCapacitiesMonthly,
|
||||
'region_daily' => $regionCapacitiesDaily
|
||||
|
||||
];
|
||||
|
||||
dump($regionPredictions);
|
||||
|
||||
return view('region', [
|
||||
'regions' => $regionBaseAll,
|
||||
'region' => $regionBaseRegion,
|
||||
'region_id' => $id,
|
||||
'regionCapacities' => $regionCapacities,
|
||||
'regionPropertiesCapacities' => $regionPropertiesCapacities,
|
||||
'predictions' => $regionPredictions]);
|
||||
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user