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

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 child of <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 the 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 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 to show.

  • 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.