From b54d34127e25df4bd58a133423b0fba6ad16ede1 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 21 May 2025 18:31:46 +0200 Subject: [PATCH] cpu metrics: fix typo in null check --- dashboard/src/components/CpuUsage.vue | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dashboard/src/components/CpuUsage.vue b/dashboard/src/components/CpuUsage.vue index 41389cf77..aa6c32306 100644 --- a/dashboard/src/components/CpuUsage.vue +++ b/dashboard/src/components/CpuUsage.vue @@ -45,16 +45,9 @@ async function liveRefresh() { gMetricStream.onerror = (error) => console.log('event stream error:', error); gMetricStream.onmessage = (message) => { const data = JSON.parse(message.data); - if (data.cpu[0]) return; // value can be null if no previous value + if (!data.cpu[0]) return; // value can be null if no previous value gGraph.data.labels.push(moment(data.cpu[1]*1000).format('hh:mm')); gGraph.data.datasets[0].data.push(data.cpu[0]); - - // Limit the number of data points to keep the chart readable - if (gGraph.data.datasets[0].data.length > 40) { - gGraph.data.labels.shift(); - gGraph.data.datasets[0].data.shift(); - } - gGraph.update(); }; } @@ -100,7 +93,8 @@ async function refresh() { ticks: { autoSkip: true, // skip tick labels as needed autoSkipPadding: 20, // padding between ticks - maxRotation: 0 // don't rotate the labels + maxRotation: 0, // don't rotate the labels + maxTicksLimit: 15 // max tick labels to show } }, y: {