From 5ce80f0446b16693299ed497f05b86714e26b02e Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 15 Nov 2021 11:42:09 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B2=20=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BA=D0=B0=D1=85=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B2=20=D0=BF=D1=80=D0=BE=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/charts/Column.jsx | 11 +++++------ src/pages/TelemetryView/MonitoringColumn.jsx | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/charts/Column.jsx b/src/components/charts/Column.jsx index 5ede01c..cc48d04 100644 --- a/src/components/charts/Column.jsx +++ b/src/components/charts/Column.jsx @@ -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 -}) \ No newline at end of file +} diff --git a/src/pages/TelemetryView/MonitoringColumn.jsx b/src/pages/TelemetryView/MonitoringColumn.jsx index fab0fc3..97e4be0 100644 --- a/src/pages/TelemetryView/MonitoringColumn.jsx +++ b/src/pages/TelemetryView/MonitoringColumn.jsx @@ -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}