diff --git a/src/pages/TelemetryView/Column.jsx b/src/pages/TelemetryView/Column.jsx index b15042f..8b2ccf1 100644 --- a/src/pages/TelemetryView/Column.jsx +++ b/src/pages/TelemetryView/Column.jsx @@ -5,17 +5,13 @@ import {ChartTimeOnlineFooter} from './ChartTimeOnlineFooter'; const stroke = (sz='1px', c='white') => ({ textShadow: `-${sz} -${sz} 0 ${c}, ${sz} -${sz} 0 ${c}, -${sz} ${sz} 0 ${c}, ${sz} ${sz} 0 ${c}` }) export const Column = ({lineGroup, data, interval, showBorder, style, headerHeight}) => { - let dataLast = null - let pv = null - if (data?.length > 0) { - dataLast = data[data.length - 1]; - pv = lineGroup.filter(line => line.showGraph).map(line => ({ - color: line.color, - label: line.label, - unit: line.units, - value: dataLast[line.xAccessorName] - })) - } + let dataLast = data?.length > 0 ? data[data.length - 1] : null + let pv = lineGroup.filter(line => line.showGraph).map(line => ({ + color: line.color, + label: line.label, + unit: line.units, + value: dataLast?.[line.xAccessorName] + })) return (
@@ -27,7 +23,7 @@ export const Column = ({lineGroup, data, interval, showBorder, style, headerHeig
{pv?.map((v, idx) => ( - {v.value.toFixed(2)} {v.unit} + {v.value?.toFixed(2) ?? '--'} {v.unit} ))}