From 9740869781ef0b6bc4246a8059cf4fd6b3cd2d55 Mon Sep 17 00:00:00 2001 From: makotocc0107 <1424018999@qq.com> Date: Wed, 4 Sep 2024 15:41:38 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=A2=9E=E6=B7=BB]=E5=A2=9E=E6=B7=BB=E4=BA=86?= =?UTF-8?q?Metric=E7=9A=84inline=20chart=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- management-panel/app/Livewire/MetricWidgetChart.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/management-panel/app/Livewire/MetricWidgetChart.php b/management-panel/app/Livewire/MetricWidgetChart.php index 6302b9f..86b9d39 100644 --- a/management-panel/app/Livewire/MetricWidgetChart.php +++ b/management-panel/app/Livewire/MetricWidgetChart.php @@ -14,10 +14,11 @@ class MetricWidgetChart extends InlineChartWidget protected static ?string $maxHeight = '65px'; // public int $maxWidth = 1000; + + protected function getData(): array { $prometheus = new PrometheusService(); - date_default_timezone_set('Asia/Shanghai'); $query1 = $this->record->name . '{data="real"}'; @@ -52,6 +53,10 @@ class MetricWidgetChart extends InlineChartWidget } } + // 将数据格式化为 InlineChartWidget 所需的格式 +// $formattedRealData = $this->formatData($realdata, 'Real Data'); + + return [ 'labels' => $labels, 'datasets' => [