This sub-element is used to reference a statistic and display its value.
Statistics are implicitly bound on the underlying context, for instance, a thing-based statistic, if placed within the thing dashboard, will return only the thing-specific data, else it will work on all things available under the navigated elements (e.g. Customer or Location).
Depending on the selected statistic you can specify different attributes used to compute the statistic value.
Here below you can find all the available statistics and related attributes.
Configuration
Code View
Template Syntax
Below you can find some examples of how to use the component within a template.
<statistic name="alertCountByAlertDefinition"></statistic> <statistic name="alertCount" label="Advice/Info Alerts" [category]="['ADVICE', 'INFORMATION']"></statistic> <statistic name="alertCount" label="Anomaly Alerts" category="ANOMALY"></statistic> <statistic name="activeAlertCount" label="Active Alerts"></statistic>
Component Reference
Here is a comprehensive list of all the elements and properties that can be used to configure the component.
Statistic <statistic> | |
---|---|
PROPERTIES | |
Aggregated Property | The property aggregate when using the Property Aggregation statistic.
Type: PROPERTY | Optional property="serialNumber" |
Aggregation | The aggregation used to retrieve metric data.
Type: ENUM | Optional | Values: SUM MIN MAX AVG DELTA aggregation="MAX" |
Alert Category | The alert category used to filter the statistic results.
Type: ENUM_ARRAY | Optional | Values: INFORMATION ADVICE ANOMALY FAILURE SAFETY [category]="['ANOMALY', 'FAILURE']" [DEPRECATED] Use the severity condition into the query. |
Alert Severity | The alert severity used to filter the statistic results.
Type: ENUM_ARRAY | Optional | Values: INFORMATIONAL WARNING CRITICAL EMERGENCY [severity]="['WARNING', 'CRITICAL']" [DEPRECATED] Use the severity condition into the query. |
End Date Variable | The <period-field>'s End Variable filtering data by end date.
Type: STRING | Optional endDateFieldRef="toDate" [DEPRECATED] Use the Period Variable property instead. |
Filter | The name of the filter used to transform and display values.
Type: FILTER | Optional filter="fooBarFilter" |
Group By | The properties names used to group statistic results.
For instance: ['customer.country', 'location.properties.city'].
In the case where the underlying objects are temporally distributed you can also aggregate by HOUR, DAY, MONTH and YEAR.
Type: JSON | Optional [groupBy]="['MONTH', 'name']" |
Include Zero Values | The flag indicating whether to include or not the alerts with zero occurrences.
Type: BOOLEAN | Optional | Values: true false [includeZeroValues]="true" |
Max Result Count | The number of returned results (default all results are returned).
Type: INTEGER | Optional [limit]="123" |
Name | The statistic whose results(s) must be loaded by the widget.
Type: STATISTIC | Mandatory | Values: activeAlertCount activatedAlertCount alertCount alertCountByAlertDefinition thingCount thingPropertyAggregation locationCount customerCount userCount workSessionCount workSessionCount workSessionElapsedTime workSessionSumMetricValues name="alertCount" |
Period Variable | The id of the page's variable providing the date range filtering period, for instance the id of a <period-filter-field>.
Type: STRING | Optional periodRef="period" |
Query | The array of conditions filtering out items.
For instance: [query]='[{'property': 'connectionStatus', 'predicate': 'eq', 'value': '1'}]'
Predicates: eq, beginsWith, like, notLike, isEmpty, isNotEmpty, gt, gte, lt, lte.
Type: JSON | Optional [query]="[{'property': 'connectionStatus', 'predicate': 'eq', 'value': '1'}, {...}]" |
Start Date Variable | The <period-field>'s Start Variable filtering data by start date.
Type: STRING | Optional startDateFieldRef="fromDate" [DEPRECATED] Use the Period Variable property instead. |
Sum Metric | The work-session monitored metric to sum.
Type: STRING | Optional sumMetric="metrics.Pieces.DELTA" |
Thing Definition | The name of the thing-definition used to filter the statistic results.
Type: STRING | Optional thingDefinition="fooBar" |
Statistics
Here below you can find all the statistics you can use defining templates.
Note that, depending on the statistic, only certain attributes can be used to configure the result to be obtained.
activeAlertCount
This statistic returns the number of active alert instances present within the specified period.
Alowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy
<statistic name="activeAlertCount"
label="Active Alerts"
[groupBy]="['severity']">
</statistic>
activatedAlertCount
This statistic returns the number of alert instances that have been activated within the specified period.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="activatedAlertCount"
label="Activated Alerts"
[severity]="['WARNING', 'CRITICAL']">
</statistic>
alertCount
This statistic returns the number of alert instances (active and historical) present within the specified period.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="alertCount"
label="Advice/Info Alerts"
[category]="['ADVICE', 'INFORMATION']"
thingDefinition="Type-1">
</statistic>
alertCountByAlertDefinition
This statistic returns the number of alert instances (active and historical) present within the specified period grouped by alert-definition name. The results are sorted by count descending.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, limit, includeZeroValues.
<statistic name="alertCountByAlertDefinition"
label="Alert Pareto"
startDateFieldRef="fromDate"
endDateFieldRef="toDate"
limit="10"
[includeZeroValues]="true">
</statistic>
scheduledTime
This statistic returns the time in milliseconds, the machines are scheduled for production.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef.
<statistic name="scheduledTime"
label="Scheduled Time"
startDateFieldRef="fromDate"
endDateFieldRef="toDate">
</statistic>
alertTime
This statistic returns the time in milliseconds an alert was active.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="alertTime"
label="Fault Time"
[category]="['FAILURE']">
</statistic>
timeWithoutAlerts
This statistic returns the time in milliseconds without active alerts.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="timeWithoutAlerts"
label="Available Time"
[category]="['FAILURE']">
</statistic>
meanTimeBetweenAlerts
This statistic returns the average time in milliseconds between two consecutive alerts.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="meanTimeBetweenAlerts"
label="Mean Time Between Failures"
[category]="['FAILURE']">
</statistic>
meanTimeToClearAlert
This statistic returns the average time in milliseconds before alert clearing.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, severity, category, groupBy.
<statistic name="meanTimeBetweenAlerts"
label="Mean Time To Repair"
[category]="['FAILURE']">
</statistic>
customerCount
This statistic returns the number of customers that are visible by the logged-in user.
Allowed attributes: groupBy.
<statistic name="customerCount"
label="Customer by Country"
[groupBy]="['country', 'type']">
</statistic>
locationCount
This statistic returns the number of locations that are visible by the logged-in user.
Allowed attributes: groupBy.
<statistic name="locationCount"
label="Location by City"
[groupBy]="['properties.city']">
</statistic>
thingCount
This statistic returns the number of things that are matching the specified query and are visible by the logged-in user.
Allowed attributes: groupBy, query.
<statistic name="thingCount"
label="Online Thing Count"
[query]="[{'property': 'connectionStatus', 'predicate': 'eq', 'value': '1'}]">
</statistic>
thingPropertyAggregation
This statistic returns the property aggregated value of things that are matching the specified query and are visible by the logged-in user.
Allowed attributes: property, aggregation, groupBy, query.
<statistic name="thingPropertyAggregation"
label="Working Hours by City"
property="properties.workingHours"
aggegation="SUM"
[groupBy]="['location.properties.city']">
</statistic>
userCount
This statistic returns the number of users under the current context element. For instance, if placed within a customer details page, returns the number of users belonging to that customer.
Allowed attributes: groupBy, query.
<statistic name="userCount"
label="User Count"
[groupBy]="['userType']">
</statistic>
workSessionCount
This statistic returns the number of work-session instances started and completed within the specified period.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, groupBy.
<statistic name="workSessionCount"
label="Daily Work Session Count"
startDateFieldRef="fromDate"
endDateFieldRef="toDate"
[groupBy]="['DATE', 'name']">
</statistic>
workSessionElapsedTime
This statistic returns the total time spent for work-session instances started and completed within the specified period.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, groupBy.
<statistic name="workSessionElapsedTime"
label="Processing Time"
startDateFieldRef="fromDate"
endDateFieldRef="toDate"
[groupBy]="['name']">
</statistic>
workSessionSumMetricValues
This statistic returns the sum of a monitored metric for the work-session instances started and completed within the specified period.
Allowed attributes: thingDefinition, startDateFieldRef, endDateFieldRef, sumMetric, groupBy.
<statistic name="workSessionSumMetricValues"
label="Processed Pieces"
startDateFieldRef="fromDate"
endDateFieldRef="toDate"
sumMetric="metrics.Pieces.DELTA">
</statistic>
Comments
0 comments
Please sign in to leave a comment.