forked from ddrilling/asb_cloud_front
Сколл архива блокируется, если данных нет
This commit is contained in:
parent
9a4f048ad2
commit
8efb1bbb4d
@ -215,15 +215,12 @@ export const ChartTimeBase: React.FC<ChartTimeBaseProps> = ({options, dataParams
|
|||||||
if (!chart) return;
|
if (!chart) return;
|
||||||
chart.data = dataParams.data
|
chart.data = dataParams.data
|
||||||
if(dataParams.yStart){
|
if(dataParams.yStart){
|
||||||
const start = new Date(dataParams.yStart)
|
const interval = Number(dataParams.yInterval ?? 600_000)
|
||||||
const end = new Date(dataParams.yStart)
|
const { unit, stepSize } = timeParamsByInterval(Number(interval / 1000))
|
||||||
const interval = Number(dataParams.yInterval ?? 600)
|
|
||||||
end.setSeconds(end.getSeconds() + interval)
|
|
||||||
const { unit, stepSize } = timeParamsByInterval(interval)
|
|
||||||
|
|
||||||
if(chart.options.scales?.y){
|
if(chart.options.scales?.y){
|
||||||
chart.options.scales.y.max = end.getTime()
|
chart.options.scales.y.max = +dataParams.yStart + interval
|
||||||
chart.options.scales.y.min = start.getTime()
|
chart.options.scales.y.min = +dataParams.yStart
|
||||||
chart.options.scales.y.ticks.display = dataParams.displayLabels ?? true
|
chart.options.scales.y.ticks.display = dataParams.displayLabels ?? true
|
||||||
chart.options.scales.y.time.unit = unit
|
chart.options.scales.y.time.unit = unit
|
||||||
chart.options.scales.y.time.stepSize = stepSize
|
chart.options.scales.y.time.stepSize = stepSize
|
||||||
|
@ -69,7 +69,7 @@ export default function Archive({idWell}) {
|
|||||||
const [loaded, setLoaded] = useState(null)
|
const [loaded, setLoaded] = useState(null)
|
||||||
|
|
||||||
const onGraphWheel = (e) => {
|
const onGraphWheel = (e) => {
|
||||||
if (loaded) {
|
if (loaded && dateLimit.from && dateLimit.to) {
|
||||||
setStartDate((prevStartDate) => {
|
setStartDate((prevStartDate) => {
|
||||||
const offset = e.deltaY * chartInterval * WHEEL_SENSITIVITY
|
const offset = e.deltaY * chartInterval * WHEEL_SENSITIVITY
|
||||||
const nextStartDate = +prevStartDate + offset
|
const nextStartDate = +prevStartDate + offset
|
||||||
@ -105,13 +105,10 @@ export default function Archive({idWell}) {
|
|||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
let dates = await TelemetryDataSaubService.getDataDatesRange(idWell)
|
const dates = await TelemetryDataSaubService.getDataDatesRange(idWell)
|
||||||
if (!dates) dates = {}
|
const startDate = dates && Math.max(dates.from, +dates.to - chartInterval)
|
||||||
dates.from = new Date(dates.from ?? (Date.now() - chartInterval))
|
setDateLimit(dates ?? { from: 0, to: 0 })
|
||||||
dates.to = new Date(dates.to ?? Date.now())
|
setStartDate(new Date(startDate || (Date.now() - chartInterval)))
|
||||||
const startDate = new Date(Math.max(dates.from, +dates.to - chartInterval))
|
|
||||||
setStartDate(new Date(startDate))
|
|
||||||
setDateLimit(dates)
|
|
||||||
},
|
},
|
||||||
setShowLoader,
|
setShowLoader,
|
||||||
`Не удалось загрузить диапозон телеметрии для скважины "${idWell}"`
|
`Не удалось загрузить диапозон телеметрии для скважины "${idWell}"`
|
||||||
|
Loading…
Reference in New Issue
Block a user