Open Automation Software
Moving Data From Anywhere to Anywhere
1-303-679-0898

Trend Control description and options

After defining the Trend Control bindings, or Trend Bindings, the OAS Web HMI library will continually poll the server for realtime data, or Historical Data, depending on the context.

After each polling cycle, a callback function will be executed, allowing you to examine the data, use it in your client side code, or simply apply it to a charting library like Flot. It is your responsibility to implement the callback function and reference it in the Trend Bindings.

The Javascript OPC_config variable contains several options for determining the behavior of the Script Library. This variable is a standard JSON construct. The full definition with defaults desplayed is:

To add Trend Bindings to this configuration, you will add the following node to your OPC_config construct. The trend_bindings node is an array of Trend Binding objects, each representing data to be displayed in a single chart or to be used together.

  • chartid: string
    This string is available within the callback
  • samplerate: integer
    The server-side sample rate for extracting trend data
  • timeframe: int
    The server-side timeframe
  • tags: array

An array of Tag Definitions. Each tag definition represents a feed of data values corresponding to an OPC Server Tag. You can either provide an array of strings containing Tag names (e.g. ‘Ramp.Value’) or you can provide an array of Tag Definition objects with the tag name and other options.

Historystatprocessing and historytag are optional. Historytag is used to specify the data logging group and field to return history data from. Commonly used when the same tag is defined in multiple logging groups.

An array of Tag Definitions. Each tag definition represents a feed of data values corresponding to an OPC Server Tag. You can either provide an array of strings containing Tag names (e.g. ‘Ramp.Value’) or you can provide an array of Tag Definition objects with the tag name and other options.

  • retain: integer
    The number of values to retain between callbacks. For example, if you are displaying real-time data, you will want to set this to the maximum number of points on the x-axis so that any chart using the data will effectively scroll. If you do not set a retain value, all values will be retained, gradually using up more memory over time, and forcing you to manually extract portions for display.
  • callback: function
    A function pointer with that receives a single argument. This function must be globally accessible and will be called on each server refresh of data. The single argument will represent the raw data from the server with metadata about the data set. More information below.
  • returnalldatawithtimes: bool
    An optional flag that determines whether the server will return timestamps for each individual data point. If this setting is not included or is set to false, only the start and end timestamps are included in along with the data points as each is assumed to be averaged between the start and end. Setting this to true will inlude an additional array of timestamps on the server response labeled timesforreturnalldata.