Aditional changes
This commit is contained in:
parent
e3b7e866f0
commit
b5d7904a61
@ -59,15 +59,18 @@ class WidgetApi extends ApiController{
|
|||||||
$labels = [];
|
$labels = [];
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach ($events as $key => $event) {
|
foreach ($events as $key => $event) {
|
||||||
$labels[] = $event['value'];
|
$labels[] = (new DateTime($event['time']))->format('H:i');
|
||||||
$values[] = $event['time'];
|
$values[] = [
|
||||||
|
$event['time'],
|
||||||
|
$event['value'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'records'=> $events,
|
'records'=> $events,
|
||||||
'graph'=> [
|
'graph'=> [
|
||||||
'labels' => $values,
|
'labels' => $labels,
|
||||||
'values' => $labels,
|
'values' => $values,
|
||||||
'min' => RANGES[$subDeviceData['type']]['min'],
|
'min' => RANGES[$subDeviceData['type']]['min'],
|
||||||
'max' => RANGES[$subDeviceData['type']]['max'],
|
'max' => RANGES[$subDeviceData['type']]['max'],
|
||||||
'scale' => RANGES[$subDeviceData['type']]['scale'],
|
'scale' => RANGES[$subDeviceData['type']]['scale'],
|
||||||
|
Loading…
Reference in New Issue
Block a user