Loading
Setting Alert Manager
The alert manager helps you define thresholds for data values and perform specific actions for the defined thresholds. For example, if you are plotting a real-time temperature chart and wish to play a sound when the temperature reaches between 90 and 100 Fahrenheit, you can do this using the alert manager.
As long as they don’t overlap, you can define any number of threshold ranges. For each threshold range, you can specify one of the following actions:
-
Call a JavaScript function and pass parameters to it
-
Show a predefined annotation on the chart
-
Play a MP3 sound, which is dynamically loaded
In this section, you will be shown how you can:
-
Configure the alert manager for all datasets on the chart
-
Configure the alert manager for individual datasets
Configuring the Alert Manager for all Datasets
A real-time chart, in which the alert manager is configured to call a JavaScript function, looks like this:
The data structure needed to configure the alert manager to call the JavaScript function is given below:
{
"chart": {
"caption": "Harry's Supermart - Bakersfield Central",
"subCaption": "Footfalls",
"showrealtimevalue": "1",
"borderAlpha": "0",
"yaxismaxvalue": "40",
"numdisplaysets": "10",
"usePlotGradientColor": "0",
"canvasBorderAlpha": "20",
"labeldisplay": "rotate",
"slantLabels": "1",
"showLegend": "0",
"plotBorderAlpha": "0",
"bgAlpha": "0",
"showValues": "0",
"numbersuffix": " Customers",
"showlabels": "1",
"animation": "0",
"showRealTimeValue": "0"
},
"categories": [
{
"category": [
{
"label": "8 mins ago"
},
{
"label": "7 mins ago"
},
{
"label": "6 mins ago"
},
{
"label": "5 mins ago"
},
{
"label": "4 mins ago"
},
{
"label": "3 mins ago"
},
{
"label": "2 mins ago"
},
{
"label": "1 min ago"
}
]
}
],
"dataset": [
{
"seriesname": "Footfall",
"alpha": "100",
"data": [
{
"value": "5"
},
{
"value": "17"
},
{
"value": "10"
},
{
"value": "15"
},
{
"value": "5"
},
{
"value": "12"
},
{
"value": "8"
},
{
"value": "10"
}
]
}
],
"alerts": {
"alert": [
{
"minvalue": "10",
"maxvalue": "20",
"action": "callJS",
"param": "showAlert('Footfall exceeded average');"
}
]
}
}
The container object for alerts is alerts
property, which is a child of the datasource
object.
Now, for each alert range object , you need to define an alert
array element as a child of the alerts
object. The alert
array elements can have the following attributes:
Attribute Name | Description |
---|---|
|
It is used to specify the minimum value for a threshold range. For example, to define an alert for the range 5-8, 5 is the minimum value. When real-time values are matched against the value for |
|
It is used to specify the maximum value for a threshold range. For example, to define an alert for the range 5-8, 8 is the maximum value. Like the minimum value, the maximum value is also inclusive during value checks. |
|
This attribute defines the action to be taken, when the chart value matches an alert range. Possible values for this attribute are: |
|
It accepts the parameter for an action, depending on the type of action specified using the |
|
It specifies whether an alert threshold range will be executed only once. Often, you might need an alert threshold range to act only once, irrespective of how many times the value goes into the range. Setting this attribute to |
Configuring the Alert Manager for Individual Datasets
In real-time charts, you can control the datasets that are checked by the alert manager to raise any events.
For example, if you are comparing the transactions of a Retail Store and an Online Store using a single real-time column chart, you may want alerts to be defined and raised only for the Online Store. In this case, you can disable the alerts for the Retail Store’s dataset.
Given below is a brief description of the attribute used to configure the alert manager for individual datasets:
Attribute Name | Description |
---|---|
|
It is used to specify whether the values of a dataset will be checked for alerts. Setting this attribute to |
{
"dataset": [{
"seriesname": "Retail Store",
"checkForAlerts": "0",
"alpha": "100",
"data": [{
"value": "15"
}]
}, {
"seriesname": "Online",
"alpha": "100",
"data": [{
"value": "2"
}]
}]
}
There! You have now seen how you can configure alerts for real-time charts.