Fixing graphs of scale

This commit is contained in:
2025-07-17 12:41:39 +05:30
parent 0791fa976f
commit ba097b2c5e
4 changed files with 8 additions and 6 deletions

View File

@@ -42,10 +42,12 @@ class DeviceController extends Controller
return jsonResponseWithErrorMessage('Name already exists', 400);
}
$deviceProfileName = DeviceProfileMaster::where('id',$request->deviceProfileId)->first();
dd($deviceProfileName['name']);
$deviceData = [
'id' => $request->id ?? null,
'name' => $request->name ?? null,
'type' => $request->type ?? null,
'type' => $deviceProfileName['name'] ?? null,
'label' => $request->label ?? null,
'version' => $request->version ?? 1,
'customerId' => $request->customerId ?? 1,

View File

@@ -1456,11 +1456,11 @@ class TelemetryController extends Controller
$getLimit = Device::where('id', $deviceId)->select('speed_limit','torque_limit','power_limit')->first();
$graph1['y1'] = count($key1) === 3 ? ['name' => [$x1[0]['display_name'], $x1[1]['display_name']], 'min' => $min1, 'max' => $getLimit['torque_limit'] ?? 50000] : ['name' => [$x1['display_name']], 'min' => $min1, 'max' => $getLimit['torque_limit'] ?? 50000];
$graph1['y1'] = count($key1) === 3 ? ['name' => [$x1[0]['display_name'], $x1[1]['display_name']], 'min' => $min1, 'max' => $getLimit['torque_limit'] ?? 50000] : ['name' => [$x1['display_name']], 'min' => $min1, 'max' => $max1 ];
$graph1['y2'] = $x2 ? ['name' => [$x2['display_name']], 'min' => 0, 'max' => $getLimit['speed_limit'] ?? 50000] : null;
$graph1[$date] = $value1;
$graph2['y1'] = count($key2) === 3 ? ['name' => [$y1[0]['display_name'], $y1[1]['display_name']], 'min' => $min2, 'max' => $getLimit['power_limit'] ?? 500000] : ['name' => [$y1['display_name']], 'min' => $min2, 'max' => $getLimit['power_limit'] ?? 500000];
$graph2['y1'] = count($key2) === 3 ? ['name' => [$y1[0]['display_name'], $y1[1]['display_name']], 'min' => $min2, 'max' => $getLimit['power_limit'] ?? 500000] : ['name' => [$y1['display_name']], 'min' => $min2, 'max' => $max2 ];
$graph2['y2'] = $y2 ? ['name' => [$y2['display_name']], 'min' => 0, 'max' => $getLimit['speed_limit'] ?? 50000] : null;
$graph2[$date] = $value2;
}

View File

@@ -50,7 +50,7 @@ class DeviceService
public function createOrUpdateDevice(array $data)
{
dd($data);
$token = $this->getToken();
$payload = [

View File

@@ -243,8 +243,8 @@ class TelemetryService
'value' => $this->getTypeWiseValue($key, $value),
'health_status' => !$isActive
? 'Offline'
: (in_array($displayNameMap[$key], ['Speed', 'RPM']) ? 'Offline' : $status),
// 'health_status' => $status,
: (in_array($displayNameMap[$key], ['Speed', 'RPM']) ? '' : $status),
// 'health_status' => in_array($displayNameMap[$key], ['Speed', 'RPM']) ? '' : $status,
'status_color' => !$isActive ? 'gray' : $statusColor,
'thresholds' => $thresholds,
'limit' => $thresholdLimits