Visualizer #3

Merged
thomas merged 12 commits from rudi_s into main 2024-05-28 11:21:00 +02:00
1 changed files with 10 additions and 0 deletions
Showing only changes of commit a2e23fceff - Show all commits

View File

@ -3,6 +3,7 @@ const traceEvent = Symbol('trace-event');
const tracePacket = Symbol('trace-packet');
const traceMaxEvents = 200;
const historyMaxPackets = 300;
const state = {
@ -171,12 +172,21 @@ function addHistory(packet) {
}
}
// Limit to historyMaxPackets items
const shift = chartHistoryHz.data.labels.length == historyMaxPackets;
if (shift) {
chartHistory.data.labels.shift();
}
let i = 0;
for (const x of keys) {
let data = packet[x];
if (data == -1e38 /* "NaN" */) {
data = undefined;
}
if (shift) {
chartHistory.data.datasets[i].data.shift();
}
chartHistory.data.datasets[i].data.push(data);
i++;
}