Use 10s intervals for 5m/30m charts

This commit is contained in:
root
2026-01-30 01:46:40 +02:00
parent ad90871315
commit 6147777c02
2 changed files with 7 additions and 7 deletions

View File

@@ -187,8 +187,8 @@ class ServerChartsWidget extends Widget
private function rangeConfig(string $range): array
{
return match ($range) {
'5m' => ['minutes' => 5, 'points' => 5, 'resolution' => '1m', 'label_format' => 'H:i', 'interval_seconds' => 60],
'30m' => ['minutes' => 30, 'points' => 30, 'resolution' => '1m', 'label_format' => 'H:i', 'interval_seconds' => 60],
'5m' => ['minutes' => 5, 'points' => 30, 'resolution' => '10s', 'label_format' => 'H:i:s', 'interval_seconds' => 10],
'30m' => ['minutes' => 30, 'points' => 180, 'resolution' => '10s', 'label_format' => 'H:i', 'interval_seconds' => 10],
'day' => ['minutes' => 1440, 'points' => 24, 'resolution' => '1h', 'label_format' => 'H:00', 'interval_seconds' => 3600],
'week' => ['minutes' => 10080, 'points' => 28, 'resolution' => '6h', 'label_format' => 'M d H:00', 'interval_seconds' => 21600],
'month' => ['minutes' => 43200, 'points' => 30, 'resolution' => '1d', 'label_format' => 'M d', 'interval_seconds' => 86400],

View File

@@ -28,23 +28,23 @@
$uptime = $data['uptime'] ?? 'N/A';
$range = $this->range;
$historyPoints = match ($range) {
'5m' => 5,
'30m' => 30,
'5m' => 30,
'30m' => 180,
'day' => 24,
'week' => 28,
'month' => 30,
default => 30,
};
$historyIntervalSeconds = match ($range) {
'5m' => 60,
'30m' => 60,
'5m' => 10,
'30m' => 10,
'day' => 3600,
'week' => 21600,
'month' => 86400,
default => 60,
};
$historyLabelFormat = match ($range) {
'5m' => 'H:i',
'5m' => 'H:i:s',
'30m' => 'H:i',
'day' => 'H:00',
'week' => 'M d H:00',