From f9d019ffda82bed25f72ccedb5d29865419fa3dc Mon Sep 17 00:00:00 2001 From: goodmice Date: Fri, 12 Nov 2021 16:22:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D0=B7=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=B8=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B0=D1=80=D1=85=D0=B8=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Archive/ArchiveColumn.jsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/pages/Archive/ArchiveColumn.jsx b/src/pages/Archive/ArchiveColumn.jsx index b3e7909..0118086 100644 --- a/src/pages/Archive/ArchiveColumn.jsx +++ b/src/pages/Archive/ArchiveColumn.jsx @@ -1,14 +1,20 @@ +import { useEffect, useState } from 'react' import { Grid, GridItem } from '../../components/Grid' import { Column } from '../../components/charts/Column' export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight, yStart }) => { - const dataLast = data?.[data.length - 1] - const pv = lineGroup.filter(line => line.showLabels).map(line => ({ - color: line.color, - label: line.label, - unit: line.units, - value: dataLast?.[line.xAccessorName] - })) + const [lineGroupWithoutShapes, setLineGroupWithoutShapes] = useState([]) + const [pv, setPV] = useState([]) + + useEffect(() => { + const lgws = lineGroup.filter(cfg => !cfg.isShape) + setLineGroupWithoutShapes(lgws) + setPV(lgws.filter(line => line.showLabels).map(line => ({ + color: line.color, + label: line.label + }))) + }, [lineGroup]) + return (
@@ -19,7 +25,7 @@ export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight,