Historical Data

To display historical data in a chart, you configure your Trend Binding exactly as if you were displaying trend data, then make a single JavaScript call:

OAS.Trend.getHistoryData(trend_binding, startDate, endDate);
  • trend_binding: string|trend_binding object
    This can be either a string, or a reference to a Trend Binding object. If you pass a string, it must match the chartid of an existing Trend Binding. This is the trend binding that will be placed into “History Mode”. Executing this more than once will have no effect.
  • startDate: string|date
    A Javascript Date object or string that can be converted into a Javascript Date (e.g. “01/31/2013 07:22 am”). This date and time is the start of the timespan for History data points requested from the server.
  • endDate: datetime
    A Javascript Date object or string that can be converted into a Javascript Date (e.g. “01/31/2013 07:22 am”). This date and time is the end of the timespan for History data points requested from the server.

Executing OAS.Trend.getHistoryData will place the chart in “History Mode”, displaying a static set of data for the configured Tags, between the start and end dates provided. There may be a brief delay between the execution and the display of the History Data. This is the result of the server generating the data set and sending it back to the client.

To revert back to “Real Time Mode” and to see live data, execute:

OAS.Trend.resumeTrendData(trend_binding);
  • trend_binding: string|trend_binding object
    This can be either a string, or a reference to a Trend Binding object. If you pass a string, it must match the chartid of an existing Trend Binding. This is the trend binding that will be placed back into “Real Time Mode”. Executing this more than once will have no effect.

Explicit Data Logging Group Reference

The getHistoryData call requests data for Tags within Data Logging Groups on the OAS Server. In cases where the Tag is being logged to multiple Logging Groups, you can choose which group will be used to extract data from the external database. To do this you specify the historytag field in the tag definition of your trend_binding. More information on trend_binding configurations can be found here.