From de72f13baccb93b50569e27660b1c4d284eec259 Mon Sep 17 00:00:00 2001 From: goodmice Date: Thu, 21 Oct 2021 11:37:30 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=BC=D0=BE=D0=BD=D0=B8=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D0=BD=D0=B3=D0=B0=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/TelemetryView/Column.jsx | 20 ++++++++------------ src/pages/TelemetryView/index.jsx | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) 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} ))}