How to use Timeframe
Tiles can either use the overall page timeframe or they can have a specific tile timeframe specified in each tile configuration or query.
Tiles need to be configured, as described below, in order to use the page timeframe.
The page timeframe is the timeframe which users viewing the page can change on the fly. The default timeframe is 12 hours, as shown by the 12 hours button at the top of the page. Users can then change the timeframe by clicking on the 12 hours button. All tiles on the page which are set to use page timeframe will change to show data for the newly selected timeframe. Any tiles set to use specific timeframe will remain set to the timeframe specified in the query.
Use the setting use page timeframe if you are happy for a tile to default to 12 hours and for users to change the overall page timeframe as they need.
By default tiles use the timeframe specified in the query.
Use a specified timeframe in the query if you wish to fix the time period displayed. For example, if you are creating a page to display several tiles for a 30 day time period, or if you wish to have several tiles showing different time periods for comparison, such as 7 days, 30 days and 3 months.
Take care to set useful tile titles, especially if mixing tiles different timeframes. If users change the page timeframe then tiles set to use page timeframe will change, but any tiles using a specific timeframe will not change.
How to allow a tile to use the page timeframe
You can add dynamic mustache values to make use of the current page timeframe in any Web API, Elasticsearch or Splunk tile.
The 'to' date and time defaults to now, so you often only need to specify the 'from'.
For GET requests, your API may accept a timeframe passed as a header or query parameter.
For POST requests, your API may also accept a timeframe passed in the request body.
The 'timeframe' object uses several formats to suit your API:
For APIs that want a time window:
For a page timeframe start expressed in milliseconds:
For a page timeframe start expressed as an ISO 8601 string:
An example using timeframe for a Line Graph for the Pingdom API
Pingdom uses GET requests and accepts query parameters in the request URL.
Pingdom uses seconds to denote a time range, so the 'unixStart' option should be used. However, as 'unixStart' is provided as milliseconds, you need to divide the number by 1000 to convert it to seconds. As mustache paramaters can be manipulated dynamically, this can be accomplished by adding /1000 to the string.
You would add a 'from' query parameter containing:
This would use a time period from the time selected using the page timeframe button until now.
Some page timeframes may give an error. If your API is returning hourly data then 'last 1 hour' and 'last 30 days' may not deal well with hourly data and show an error.
The API returned HTTP 400 status code - 400 errors suggest a problem on the dashboard.
"Range is too small for the used resolution" - a page timeframe of 'last 1 hour' may show this if the API is returning hourly data.
"Interval is too big for this resolution" - a page timeframe of 'last 30 days' or over may show this for hourly data.