From c5c134071f62d3f55c8ccbeaa3177a6375fa5e12 Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 15 Nov 2021 16:13:12 +0500 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D0=B4=D0=B0=D1=82=D0=B5=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B8=D1=81=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D0=B8=D0=B7?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B1=D1=80=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Archive/ArchiveDisplay.jsx | 2 +- src/pages/Archive/index.jsx | 5 +++-- src/pages/TelemetryView/index.jsx | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/Archive/ArchiveDisplay.jsx b/src/pages/Archive/ArchiveDisplay.jsx index 7035c82..a370bf1 100644 --- a/src/pages/Archive/ArchiveDisplay.jsx +++ b/src/pages/Archive/ArchiveDisplay.jsx @@ -55,7 +55,7 @@ export const ArchiveDisplay = ({data, startDate, interval, onWheel}) => { style={{ width: '15vw' }} data={chartData} lineGroup={group} - interval={interval / 1000} + interval={Math.round(interval / 1000)} headerHeight={'50px'} yStart={startDate} /> diff --git a/src/pages/Archive/index.jsx b/src/pages/Archive/index.jsx index f22a53b..6b19035 100644 --- a/src/pages/Archive/index.jsx +++ b/src/pages/Archive/index.jsx @@ -7,7 +7,8 @@ import LoaderPortal from '../../components/LoaderPortal' import { Flex } from '../../components/Grid' import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker' import { ArchiveDisplay, cutData } from './ArchiveDisplay' -import { normalizeData, sortByDate } from '../TelemetryView' +import { normalizeData } from '../TelemetryView' +import { makeDateSorter } from '../../components/Table' const DATA_COUNT = 2048 // Колличество точек на подгрузку графика const ADDITIVE_PAGES = 2 // Дополнительные данные для графиков @@ -105,7 +106,7 @@ export default function Archive({idWell}) { data.forEach(elm => elm.date = new Date(elm.date)) setDataSaub((prevDataSaub) => { const newData = [...prevDataSaub, ...normalizeData(data)] - newData.sort(sortByDate) + newData.sort(makeDateSorter('date')) return cutData(newData, loadedStartDate, loadedEndDate) }) } diff --git a/src/pages/TelemetryView/index.jsx b/src/pages/TelemetryView/index.jsx index a4bc8f1..2f23ec2 100644 --- a/src/pages/TelemetryView/index.jsx +++ b/src/pages/TelemetryView/index.jsx @@ -25,6 +25,7 @@ import SpinPicDisabled from '../../images/SpinDisabled.png' import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker' import '../../styles/message.css' +import { makeDateSorter } from '../../components/Table' const { Option } = Select @@ -290,7 +291,6 @@ const getIndexOfDrillingBy = (dataSaub) => { return order[idFeedRegulator] ?? -1 } -export const sortByDate = (a, b) => a.date > b.date ? 1 : -1 export const normalizeData = (data) => data?.map(item => ({ ...item, rotorSpeed: item.rotorSpeed < 1 ? 0 : item.rotorSpeed, @@ -309,7 +309,7 @@ export default function TelemetryView({ idWell }) { const handleDataSaub = (data) => { if (data) { const dataSaub = normalizeData(data) - dataSaub.sort(sortByDate) + dataSaub.sort(makeDateSorter('date')) setDataSaub(dataSaub) } }