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) } }