forked from ddrilling/asb_cloud_front
Оптимизировано задание линий архива
This commit is contained in:
parent
809dbb42fb
commit
f9d019ffda
@ -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 => ({
|
||||
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,
|
||||
unit: line.units,
|
||||
value: dataLast?.[line.xAccessorName]
|
||||
}))
|
||||
label: line.label
|
||||
})))
|
||||
}, [lineGroup])
|
||||
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
@ -19,7 +25,7 @@ export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight,
|
||||
</Grid>
|
||||
<Column
|
||||
data={data}
|
||||
lineGroup={lineGroup}
|
||||
lineGroup={lineGroupWithoutShapes}
|
||||
interval={interval}
|
||||
yDisplay={false}
|
||||
yStart={yStart}
|
||||
|
Loading…
Reference in New Issue
Block a user