cpu metrics: fix typo in null check
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user