Added dynamic height to offline bar

This commit is contained in:
TimZ99 2020-05-18 18:52:41 +02:00
parent aa8ec69efa
commit c314511e2e
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 14 additions and 0 deletions

View File

@ -252,6 +252,20 @@ class HistoryGraph
$prev_downtime = 0;
$downtime = 0;
// get highest latency record for offline height
$n = count($records);
$highest_latency = 0.0000;
for ($i = 0; $i < $n; $i++) {
if (!array_key_exists('latency', $records[$i])) {
continue;
}
// Update if latency is higher
$highest_latency = $highest_latency < floatval($records[$i]['latency']) ?
floatval($records[$i]['latency']) : $highest_latency;
}
// to ms
$highest_latency = round($highest_latency * 1000);
// Create the list of points and server down zones
foreach ($records as $record) {
$time = strtotime($record['date']);