forked from ddrilling/asb_cloud_front
Дополненительные данные в точках вынесены в проп
This commit is contained in:
parent
0a27ccdfef
commit
5ce80f0446
@ -45,7 +45,7 @@ export const GetOrCreateDatasetByLineConfig = (data, lineConfig) => {
|
||||
return dataset
|
||||
}
|
||||
|
||||
export const Column = React.memo(({ lineGroup, data, postParsing, interval, yDisplay, yStart, pointCount, savePreviousData }) => {
|
||||
export const Column = ({ lineGroup, data, postParsing, additionalPointData, interval, yDisplay, yStart, savePreviousData }) => {
|
||||
const [dataParams, setDataParams] = useState({data: {datasets:[]}, yStart, })
|
||||
|
||||
useEffect(()=>{
|
||||
@ -58,7 +58,8 @@ export const Column = React.memo(({ lineGroup, data, postParsing, interval, yDis
|
||||
x: lineCfg.xConstValue ?? dataItem[lineCfg.xAccessorName],
|
||||
label: dataItem[lineCfg.xAccessorName],
|
||||
y: new Date(dataItem[lineCfg.yAccessorName]),
|
||||
depth: dataItem.wellDepth
|
||||
depth: dataItem.wellDepth,
|
||||
...additionalPointData?.(dataItem, lineCfg)
|
||||
})).filter(point => (point.x ?? null) !== null && (point.y ?? null) !== null)
|
||||
|
||||
if (savePreviousData)
|
||||
@ -66,8 +67,6 @@ export const Column = React.memo(({ lineGroup, data, postParsing, interval, yDis
|
||||
|
||||
if(points?.length > 2)
|
||||
points.sort((a,b) => a.y > b.y ? 1 : -1)
|
||||
if(points.length > pointCount)
|
||||
points.splice(0, points.length - pointCount)
|
||||
|
||||
dataset.data = points
|
||||
})
|
||||
@ -80,7 +79,7 @@ export const Column = React.memo(({ lineGroup, data, postParsing, interval, yDis
|
||||
return {...preDataParams}
|
||||
})
|
||||
|
||||
}, [data, lineGroup, interval, yDisplay, yStart, postParsing, pointCount, savePreviousData])
|
||||
}, [data, lineGroup, interval, yDisplay, yStart, postParsing, savePreviousData, additionalPointData])
|
||||
|
||||
return <ChartTimeBase dataParams = { dataParams } options = { chartPluginsOptions } />
|
||||
})
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho
|
||||
value: dataLast?.[line.xAccessorName]
|
||||
}))
|
||||
|
||||
const addPointData = (point) => ({ depth: point.wellDepth })
|
||||
|
||||
const postParsing = (data) => {
|
||||
lineGroupWithoutShapes.forEach(lineCfg => {
|
||||
const lineDataSet = GetOrCreateDatasetByLineConfig(data.data, lineCfg)
|
||||
@ -76,6 +78,7 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho
|
||||
data={data}
|
||||
lineGroup={lineGroupWithoutShapes}
|
||||
postParsing={postParsing}
|
||||
additionalPointData={addPointData}
|
||||
interval={interval}
|
||||
yDisplay={false}
|
||||
yStart={yStart}
|
||||
|
Loading…
Reference in New Issue
Block a user