visualizer: treat -1e38 as NaN

I considered updating jsonlogger.c to represent NaN as "null" in the
JSON. However, this makes the hand-written JSON generator much more
complicated.
This commit is contained in:
Simon Ruderich 2024-05-11 12:00:16 +02:00
parent 09cccd3ced
commit 0df63a998d
1 changed files with 5 additions and 4 deletions

View File

@ -146,9 +146,6 @@ function addHistory(packet) {
|| x === 'data_symbols') {
continue;
}
if (x === 'header_evm' || x === 'data_evm') {
continue;
};
keys.push(x);
}
keys.sort();
@ -164,7 +161,11 @@ function addHistory(packet) {
let i = 0;
for (const x of keys) {
chartHistory.data.datasets[i].data.push(packet[x]);
let data = packet[x];
if (data == -1e38 /* "NaN" */) {
data = undefined;
}
chartHistory.data.datasets[i].data.push(data);
i++;
}
chartHistory.data.labels.push((new Date() - state.start)/1000);