2021-11-12 16:22:53 +05:00
|
|
|
import { useEffect, useState } from 'react'
|
2021-11-11 19:28:07 +05:00
|
|
|
import { Grid, GridItem } from '../../components/Grid'
|
|
|
|
import { Column } from '../../components/charts/Column'
|
|
|
|
|
|
|
|
export const ArchiveColumn = ({ lineGroup, data, interval, style, headerHeight, yStart }) => {
|
2021-11-12 16:22:53 +05:00
|
|
|
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])
|
|
|
|
|
2021-11-11 19:28:07 +05:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div style={style}>
|
|
|
|
<Grid style={{ height: headerHeight, margin: 0 }}>
|
|
|
|
{pv?.map((v, idx) => (
|
|
|
|
<GridItem className={'display_chart_label'} key={idx} row={idx} col={1} style={{ color: v.color, padding: '0 8px' }}>{v.label}</GridItem>
|
|
|
|
))}
|
|
|
|
</Grid>
|
|
|
|
<Column
|
|
|
|
data={data}
|
2021-11-12 16:22:53 +05:00
|
|
|
lineGroup={lineGroupWithoutShapes}
|
2021-11-11 19:28:07 +05:00
|
|
|
interval={interval}
|
|
|
|
yDisplay={false}
|
|
|
|
yStart={yStart}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|