Dashboard Auto-Refresh for absolute time ranges

Hi,

We need to define dashboards with absolute time range and want to enable Auto-Refresh.
For quick ranges, the graphs move forward with auto-refresh. Like wise we need the same functionality for absolute time ranges where the time has to move forward for each auto refresh, based on the refresh interval selected.

Is there a way to implement this functionality?

Thanks in advance…

Change refresh rate:

import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
getTimeSrv().setAutoRefresh('5s');

I don’t understand how the graph will move forward if it’s an absolute time range - even if you refresh over-and-over: it will stand still…

but anyway: maybe this will help you:
getTimeSrv().refreshDashboard();

Hi @davidm1 , thanks for the response

But what we are expecting is when we select absolute time range like
From: 2022-02-01 00:00:00
To: 2022-02-01 00:15:00 with 15s auto refresh

After refresh the time stamps should be like this.
1st refresh : 2022-02-01 00:00:15 to 2022-02-01 00:15:15
2 nd refresh: 2022-02-01 00:00:30 to 2022-02-01 00:15:30

Is there a way to do it.

Here is for example how to set the time range (see below)
Try to use setInterval to run the below code every 15s. you’ll have to replace the ‘****’ with new numbers each time (calculate it somehow)

const timeSrv = getTimeSrv();
const raw = { from: '******', to: '****', };
const timezone = timeSrv.dashboard ? timeSrv.dashboard.getTimezone() : undefined;
const calcTimeRange = {
  from: dateMath.parse(raw.from, false, timezone, timeSrv.dashboard?.fiscalYearStartMonth)!,
  to: dateMath.parse(raw.to, true, timezone, timeSrv.dashboard?.fiscalYearStartMonth)!,
  raw: raw,
};
setLocalTimeRange(calcTimeRange);