You are viewing documentation for an older version. For current documentation - click here.

Alert Manager helps you define your own thresholds for data values and then perform specific actions for each defined threshold. For example, if you’re plotting a real-time temperature chart and you wish to play a sound when the temperature reaches between say 90 and 100 Fahrenheit, you can easily do so using Alert Manager.

Alert Manager allows you to define any number of alert threshold ranges for the chart. The threshold range just shouldn't overlap. For each threshold range, you can specify one of the following actions:

  • Call a JavaScript function and pass parameters to it
  • Show a pre-defined annotation on the chart
  • Play a MP3 sound, which is dynamically loaded

To aid your understanding of this section, we recommend you to go through the Alert Manager section.

Setting up alert manager

For any real-time chart, you can set up the alert manager as under:

<chart>
   …
   …
   <alerts>
      <alert minValue='240' maxValue='300' action='callJS' param="alert('Value between 240 and 300');" />
      <alert minValue='300' maxValue='360' action='showAnnotation' param='statusRed' occurOnce='0'/>
      <alert minValue='360' maxValue='400' action='playsound' param='YourSound.mp3'/>
   </alerts>
</chart>
{
  "chart": {},
  ...
  "alerts": {
    "alert": [
      {
        "minvalue": "240",
        "maxvalue": "300",
        "action": "callJS",
        "param": "alert('Value between 240 and 300');"
      },
      {
        "minvalue": "300",
        "maxvalue": "360",
        "action": "showAnnotation",
        "param": "statusRed",
        "occuronce": "0"
      },
      {
        "minvalue": "360",
        "maxvalue": "400",
        "action": "playsound",
        "param": "YourSound.mp3"
      }
    ]
  }
}

The container element for alerts is <alerts>, which is a child of the <chart> element. This element cannot have any attribute.

Now, for each alert range, you need to define an <alert> element as a child of the <alerts> element. The <alert> element can have the following attributes:

  • minValue – The minimum value for the alert range. For example, if you want to define an alert for the range 100-120, 100 will be minValue. When real-time values are matched against minValue, it’s taken as inclusive. For example, if you define 100 as minValue and the value which is being checked is 100, it’ll fall in this defined alert range.

  • maxValue - The maximum value for the alert range. For example, if you want to define an alert for the range 100-120, 120 will be maxValue. Like minValue, even maxValue is inclusive during value checks against alert ranges.

  • action – This attribute defines the action to be taken, when the value on the chart matches an alert range. Possible values for this attribute are:

    • CALLJS – Calls a JavaScript function (specified in param attribute – explained next) when a value is matched against an alert range. If you need to pass parameters to JavaScript function, specify the exact function name and parameters in param attribute – e.g., param="alert('Value between 240 and 300');"

    • PLAYSOUND – Plays a MP3 sound (located relative to the chart), when an alert range is matched. The relative URL of MP3 sound should be declared in param attribute.

    • SHOWANNOTATION – FusionWidgets XT allows you to create your custom annotations and annotation groups (with named IDs). This action lets you show a pre-defined annotation group in the chart. For example, you may define 3 status indicators as 3 circles having green, yellow and red color and assign an annotation group ID for each one of them. By default, you may hide all status indicators. Later, based on the chart’s value, you may show an annotation. The group Id of the annotation to be shown is defined in param attribute. When the value again falls out of alert range, FusionWidgets XT hides that annotation automatically.

  • param – This attribute accepts the parameter for the action, depending on the type of the action. For CALLJS action, it takes the name of JavaScript function. For PLAYSOUND action, it takes the relative path of MP3 file and for SHOWANNOTATION action, it takes the ID of the annotation group in order to show the annotation.

  • occurOnce – Often, you might need an alert threshold range to act only once, irrespective of how many times the value goes into the range. For example, if you want to be notified only the first time when the temperature goes into an alert range, set this attribute to 1. That will make sure that alert action for that range takes place only once, irrespective of how many times the value goes into the range later.
 
Setting alert manager control for individual datasets

In data streaming charts, you can additionally control the datasets that are checked by alert manager to raise any events.

For example, if you're comparing the stock price of Google and Dell on a single real-time line chart but want alerts to be defined and raised only for Google, you can disable the alert for Dell's dataset using:

<dataset seriesName='Dell' showValues='0' checkForAlerts='0'>
</dataset>
"dataset": [
    {
      "seriesname": "Dell",
      "showvalues": "0",
      "checkforalerts": "0"
    }
  ]

The checkForAlerts attribute when set to 0 eliminates a dataset's value from being checked for alerts.

By default, if alerts are defined, all datasets are checked for alerts.