chart fix for 1 datapoint

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2020-03-14 09:04:57 +01:00
parent e606c785a2
commit 679e71ff4f

View File

@ -53,6 +53,20 @@ class ModelStatChart extends Model {
array_push($dates, date($date_format, $q['ts']));
}
// If there's a single data point, then we can't draw a line
// so we add an artificial value of 0
if(count($ydata) <= 1) {
if($timespan == "daily") {
$ts = NOW - (NOW % 3600) - 3600;
} else {
$ts = NOW - (NOW % 86400) - 86400;
}
array_push($ydata, 0);
array_push($dates, date($date_format, $ts));
}
if($query->num_rows >= 15) {
$i = 0;
while(list($k, $v) = each($dates)) {