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 53190cd17c
commit c63f7e8b57

View file

@ -146,9 +146,6 @@ function addHistory(packet) {
|| x === 'data_symbols') { || x === 'data_symbols') {
continue; continue;
} }
if (x === 'header_evm' || x === 'data_evm') {
continue;
};
keys.push(x); keys.push(x);
} }
keys.sort(); keys.sort();
@ -164,7 +161,11 @@ function addHistory(packet) {
let i = 0; let i = 0;
for (const x of keys) { 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++; i++;
} }
chartHistory.data.labels.push((new Date() - state.start)/1000); chartHistory.data.labels.push((new Date() - state.start)/1000);