add graph info

This commit is contained in:
Simon Vieille 2020-03-22 19:16:21 +01:00
parent ba8ad57a3c
commit 035af4e72b
Signed by: deblan
GPG Key ID: 03383D15A1D31745
1 changed files with 14 additions and 9 deletions

View File

@ -29,10 +29,18 @@ class MonitoringApiController extends AbstractController
];
$line2 = [
'label' => 'Valeur idéale',
'label' => 'Maxium',
'data' => [],
'borderColor' => 'rgb(200, 200, 200)',
'backgroundColor' => 'rgb(200, 200, 200)',
'borderColor' => 'rgb(220, 220, 220)',
'backgroundColor' => 'rgb(220, 220, 220)',
'fill' => false,
];
$line3 = [
'label' => 'Minimum',
'data' => [],
'borderColor' => 'rgb(220, 220, 220)',
'backgroundColor' => 'rgb(220, 220, 220)',
'fill' => false,
];
@ -40,16 +48,13 @@ class MonitoringApiController extends AbstractController
$hour = (int) $entity->getDate()->format('H');
$labels[] = $entity->getDate()->format('H:i');
$line['data'][] = $entity->getValue();
if ($hour >= 20 || $hour <= 10) {
$line2['data'][] = 23;
} else {
$line2['data'][] = 27;
}
$line2['data'][] = 27;
$line3['data'][] = 23;
}
$datasets[] = $line;
$datasets[] = $line2;
$datasets[] = $line3;
return $this->createGraphResponse($labels, $datasets);
}