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