Gauge

Prev Next

This widget displays a box with the last available value of a metric or a statistic.

For instance, you can display the current value of a temperature metric.

Gauge

Within the box you can find, the value of the metric with its unit of measurement (if defined), the name of the metric, and the timestamp related to the loaded value.

Other than metrics, in a gauge, you can also display the value of a statistic, for instance, to display the number of alerts that occurred this month. Regardless of the data type (metric or statistic), the behavior of the gauge is the same.

Layouts

Within a gauge, you can change the background color, and icon, choosing between a Font Awesome icon or, a static icon published to an HTTP address.

In the alternative, you can change also the box layout, choosing between:

Small Box

Info Box

mceclip0.png

mceclip1.png

Metric Data Aggregation

In addition to showing the current metric value, the gauge can aggregate values, also on multiple things and within a time period.

For instance, within a location details page, you can display the total number of pieces produced by the machine, under the location, for a certain period.

The supported aggregations are:

  • AVG: Displays the average value which can be relative in case a period has been defined or absolute considering all the available data. In the case of multiple things, the average is computed among all things.

  • DELTA: Displays the variation of a metric within a period. In the case of multiple things, the resulting deltas are summed up. In case the period is not defined, the delta is computed over all the available data.

  • DELTA_AVG_DAYS_1: Displays the average of the daily deltas in a period. In the case of multiple things, the daily deltas are summed up by day. In case the period is not defined, the average is computed over all the daily deltas.

  • MIN: Displays the minimum value which can be relative in case a period has been defined or absolute considering all the available data. In the case of multiple things, the minimum is computed among all things.

  • MAX: Displays the maximum value which can be relative in case a period has been defined or absolute considering all the available data. In the case of multiple things, the maximum is computed among all things.

Value Comparison

You can use the gauge to display the value increment with respect to the previous value.

In input to the gauge, it is possible to provide a dynamic period, by using a page period field, or a static period hardcoded into the template (e.g. THIS_MONTH). When the value increment is enabled, the gauge computes the value for the previous period and displays the increment.

The increment can be displayed as a percentage or as an absolute value. Moreover, within the same box, you can also display the value relative to the previous period.

The following gauge displays the consumption of energy during this month (DELTA over the Energy metric), the consumption of the previous month, the absolute increment, and the relative percentage.

mceclip2.png

Here is the same gauge with a different layout

mceclip3.png

The increment can be displayed differently depending on whether it is a negative or a positive thing.

Previous period calculation logic

Based on the input period, the gauge calculates the comparison period according to this logic.

If the input period is open at the end (not yet concluded), such as TODAY, THIS_MONTH, THIS_YEAR, the comparison period takes into account the end date, for instance:

  • Input Period: 01 September 2022 - 19 September 2022

  • Comparison Period: 01 August 2022 - 19 August 2022

If the period identifies a whole day, month or year, the comparison considers the previous day, month, or year. In all other cases, the previous period is the input period reversed in the past, for instance:

  • Input Period: 10 September 2022 - 20 September 2022

  • Comparison Period: 01 September 2022 - 10 September 2022

Template Syntax

Below you can find some examples of how to use the component within a template.

Example 1

Gauge displaying the current value of running hours.


<gauge-widget iconName="fa-clock-o">
    <metric name="Running Hours" filter="millisToHours"></metric>
</gauge-widget>

Example 2

Gauge displaying the number of pieces produced in a selected period from a set of things.


<period-field></period-field>
<things-filter-field id="machinesFilter"></things-filter-field>

<gauge-widget aggregation="DELTA"
              periodRef="period"
              queryFieldRef="machinesFilter"
              showIncrement="RELATIVE">

    <metric name="thing.Total Pieces"></metric>

</gauge-widget>

Component Reference

Here is a comprehensive list of all the elements and properties that can be used to configure the component.

Gauge <gauge-widget>

Aggregation

Indicates whether to render the last value or the aggregated value.

Name: aggregation

Type: ENUM | Optional

Values: LAST_VALUE, AVG, DELTA, DELTA_AVG_DAYS_1, MIN, MAX

Default Value: LAST_VALUE

aggregation="LAST_VALUE"

Background Color Class

The class applied on the background, refer to the link:https://getbootstrap.com/docs/4.0/utilities/colors/#background-color[Bootstrap Colors] guide

Name: backgroundColorClass

Type: STRING | Optional

backgroundColorClass="abc"

End Date Variable/

The <period-field>'s End Variable filtering data by end date.

Name: endDateFieldRef

Type: STRING | Optional

DEPRECATED

Use the Period Variable property.

endDateFieldRef="toDate"

Icon Name

The name of the link:https://fontawesome.com/v5/search[Font Awesome] icon.

Name: iconName

Type: STRING | Optional

iconName="fa-thermometer"

Icon Url

The URL where the icon to display is located.

Name: iconUrl

Type: STRING | Optional

iconUrl="abc"

Increment Value Position

Indicates whether to place the increment value

Name: incrementValuePosition

Type: ENUM | Optional

Values: RIGHT, BOTTOM

Default Value: RIGHT

incrementValuePosition="RIGHT"

Layout

Indicates the rendering layout

Name: layout

Type: ENUM | Optional

Values: INFO_BOX, SMALL_BOX

Default Value: SMALL_BOX

layout="INFO_BOX"

Measure Unit Position

Indicates where to place the unit of measurement.

Name: measureUnitPosition

Type: ENUM | Optional

Values: NONE, METRIC_NAME_RIGHT, METRIC_VALUE_RIGHT

Default Value: METRIC_VALUE_RIGHT

measureUnitPosition="NONE"

Null Increase Class

The CSS class customizing how to render a null variation (e.g. text-gray) when the increment value si displayed.

Name: nullIncreaseClass

Type: STRING | Optional

nullIncreaseClass="abc"

Period

The default period to use when computing DELTA.

Name: period

Type: ENUM | Optional

Values: LAST_24H, LAST_7_DAYS, LAST_30_DAYS, THIS_MONTH, THIS_YEAR

period="LAST_24H"

Period Variable

The id of the page's variable providing the date range filtering period, for instance the id of a <period-filter-field>.

Name: periodRef

Type: STRING | Optional

periodRef="period"

Query Variable

The id of the page's <things-filter-field> used for searching.

Name: queryFieldRef

Type: STRING | Optional

queryFieldRef="query-1"

Show Increment

Indicates whether the increment value should be calculated from the previous time period.

Name: showIncrement

Type: ENUM | Optional

Values: NONE, ABSOLUTE, PERCENTAGE, ABSOLUTE_AND_PERCENTAGE

Default Value: NONE

showIncrement="NONE"

Show Last Update

The flag indicating whether to show or hide the last update timestamp.

Name: showLastUpdate

Type: BOOLEAN | Optional

Default Value: true

[showLastUpdate]="false"

Show Previous Value

Indicates whether the previous value must be displayed on the right of the current one.

Name: showPreviousValue

Type: BOOLEAN | Optional

Default Value: false

[showPreviousValue]="true"

Start Date Variable/

The <period-field>'s Start Variable filtering data by start date.

Name: startDateFieldRef

Type: STRING | Optional

DEPRECATED

Use the Period Variable property instead.

startDateFieldRef="fromDate"

Title

The title displayed on the top part of the widget box.

Name: title

Type: STRING | Optional

[title]="'Details'"

Value Decrease Class

The CSS class customizing how to render a negative variation (e.g. text-red) when the increment value si displayed.

Name: valueDecreaseClass

Type: STRING | Optional

valueDecreaseClass="abc"

Value Increase Class

The CSS class customizing how to render a positive variation (e.g. text-green) when the increment value si displayed.

Name: valueIncreaseClass

Type: STRING | Optional

valueIncreaseClass="abc"

Rendering

CSS Class

The name(s) of the CSS class used to customize the widget layout.

Name: class

Type: STRING | Optional

class="my-custom-class"

Visibility Condition

The expression that allows you to reduce the visibility of the element.

Name: *ngIf

Type: STRING | Optional

*ngIf="getUser().organizationId != null"

Sub Elements

Metric

The metric whose current value must be displayed within the gauge box.

Statistic

The statistic whose value must be displayed within the gauge box.

Composite Part

The widget part combining multiple properties and metrics.

Metric <metric>

Filter

The name of the filter used to transform and display values.

Name: filter

Type: FILTER | Optional

filter="fooBarFilter"

Label

The metric alternative label.

Name: label

Type: STRING | Optional

label="Temperature"

Name

The metric whose value(s) must be loaded by the widget.

Name: name

Type: METRIC | Required

name="Temperature"

Unit

The unit of measurement to be displayed along the value.

Name: unit

Type: STRING | Optional

unit="&deg;C"

Advanced

Visibility Condition

The expression that allows you to reduce the visibility of the element.

Name: *ngIf

Type: STRING | Optional

*ngIf="getUser().organizationId != null"

Statistic <statistic>

Aggregation

The function used to aggregate data.

Name: aggregation

Type: ENUM | Optional

Values: AVG, COUNT, MAX, MIN, SUM

aggregation="AVG"

Alert Category/

The alert category used to filter the statistic results.

Name: category

Type: ENUM (multiple) | Optional

Values: INFORMATION, ADVICE, ANOMALY, FAILURE, SAFETY

DEPRECATED

Define a condition into the query property

[category]="['INFORMATION', 'ADVICE']"

Alert Severity/

The alert severity used to filter the statistic results.

Name: severity

Type: ENUM (multiple) | Optional

Values: INFORMATIONAL, WARNING, CRITICAL, EMERGENCY

DEPRECATED

Define a condition into the query property.

[severity]="['INFORMATIONAL', 'WARNING']"

Alert Status

Define whether to include alerts that are still active, or have been activated in a period.

Name: activationType

Type: ENUM | Optional

Values: ACTIVE, ACTIVATED

activationType="ACTIVE"

Averaged By

The count used to average the statistic results (e.g. Average alert count by thing).

Name: averagedBy

Type: ENUM | Optional

Values: thingCount

averagedBy="thingCount"

End Date Variable/

The <period-field>'s End Variable filtering data by end date.

Name: endDateFieldRef

Type: STRING | Optional

DEPRECATED

Use the Period Variable property.

endDateFieldRef="toDate"

Group By

The property used to group results. For instance: customer.country. In the case where the underlying objects are temporally distributed you can also aggregate by HOUR, DAY, MONTH and YEAR.

Name: groupBy

Type: GROUP_BY | Optional

groupBy="customer.name"

Include Zero Values/

The flag indicating whether to include or not the alerts with zero occurrences.

Name: includeZeroValues

Type: BOOLEAN | Optional

Default Value: false

DEPRECATED

This feature is no longer supported.

[includeZeroValues]="true"

Name/

The statistic whose results(s) must be loaded by the widget.

Name: name

Type: STATISTIC | Required

DEPRECATED

Use the Resource, and select the Aggregation and Property to aggregate.

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

Name: periodRef

Type: STRING | Optional

DEPRECATED

Use the Period Variable property on the widget.

periodRef="period"

Property

The object property whose values must be aggregated.

Name: property

Type: PROPERTY | Optional

property="propName"

Resource

The resource from which to retrieve the items to be used to calculate the statistic.

Name: resource

Type: ENUM | Required

Values: ACTION, ALERT, CUSTOMER, LOCATION, PARTNER, THING, USER, WORK_SESSION

Default Value:

resource="ACTION"

Sorting

The sort direction used to order categories by value (default none).

Name: sortDirection

Type: ENUM | Optional

Values: ASC, DESC

sortDirection="ASC"

Start Date Variable/

The <period-field>'s Start Variable filtering data by start date.

Name: startDateFieldRef

Type: STRING | Optional

DEPRECATED

Use the Period Variable property instead.

startDateFieldRef="fromDate"

Sum Metric/

The work-session monitored metric to sum.

Name: sumMetric

Type: STRING | Optional

DEPRECATED

Use the Resource property and select the Aggregation and the Property to aggregate.

sumMetric="metrics.Pieces.DELTA"

Thing Definition/

The name of the thing-definition used to filter the statistic results.

Name: thingDefinition

Type: STRING | Optional

DEPRECATED

Define a condition into the query property

thingDefinition="abc"

Value Filter

The name of the filter used to transform and display values.

Name: filter

Type: FILTER | Optional

filter="fooBarFilter"

Data

Max Result Count

The number of maximum returned results (default all results are returned).

Name: limit

Type: INTEGER | Optional

limit="123"

Period Variable

The id of the page's variable providing the date range filtering period, for instance the id of a <period-filter-field>.

Name: periodRef

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.

Name: query

Type: QUERY | Optional

Predicates: beginsWith, eq, neq, gt, gte, isEmpty, isNotEmpty, lt, lte, like, notLike

[query]="[{property:'prop1', predicate: 'eq', value: 'foo'}, {property:'prop2', predicate: 'in', value: ['bar', 'baz']}]"

Composite Part <composite-part>

Description

The composite-part description.

Name: description

Type: STRING | Optional

description="abc"

Filter

The filter applied on the composite-part to transform or display its value.

Name: filter

Type: FILTER | Optional

filter="fooBarFilter"

Label

The label displayed by the widget.

Name: label

Type: STRING | Optional

label="abc"

Name

The composite-part name.

Name: name

Type: STRING | Optional

name="abc"

Advanced

Visibility Condition

The expression that allows you to reduce the visibility of the element.

Name: *ngIf

Type: STRING | Optional

*ngIf="getUser().organizationId != null"

Sub Elements

Metric

The metric whose value must be loaded within the composite-part.

Property

The property whose value must be loaded within the composite-part.

Metric <metric>

Name

The metric whose value(s) must be loaded by the widget.

Name: name

Type: METRIC | Required

name="Temperature"

Property <property>

Name

The property whose value must be loaded by the widget.

Name: name

Type: PROPERTY | Required

name="serialNumber"