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: {