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 { Grid, GridItem } from '../../components/Grid'
|
||||||
import { Column } from '../../components/charts/Column'
|
import { Column } from '../../components/charts/Column'
|
||||||
|
|
||||||
export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight, yStart }) => {
|
export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight, yStart }) => {
|
||||||
const dataLast = data?.[data.length - 1]
|
const [lineGroupWithoutShapes, setLineGroupWithoutShapes] = useState([])
|
||||||
const pv = lineGroup.filter(line => line.showLabels).map(line => ({
|
const [pv, setPV] = useState([])
|
||||||
color: line.color,
|
|
||||||
label: line.label,
|
useEffect(() => {
|
||||||
unit: line.units,
|
const lgws = lineGroup.filter(cfg => !cfg.isShape)
|
||||||
value: dataLast?.[line.xAccessorName]
|
setLineGroupWithoutShapes(lgws)
|
||||||
}))
|
setPV(lgws.filter(line => line.showLabels).map(line => ({
|
||||||
|
color: line.color,
|
||||||
|
label: line.label
|
||||||
|
})))
|
||||||
|
}, [lineGroup])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={style}>
|
<div style={style}>
|
||||||
@ -19,7 +25,7 @@ export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight,
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Column
|
<Column
|
||||||
data={data}
|
data={data}
|
||||||
lineGroup={lineGroup}
|
lineGroup={lineGroupWithoutShapes}
|
||||||
interval={interval}
|
interval={interval}
|
||||||
yDisplay={false}
|
yDisplay={false}
|
||||||
yStart={yStart}
|
yStart={yStart}
|
||||||
|
Loading…
Reference in New Issue
Block a user