Skip to main content

MetricType

The type of a Metric.
Defines the MetricValueType and the applicable Units.


Properties

PropertyTypeDescription
IdstringThe unique identifier of the metric.
LabelstringThe textual label for the metric.
Descriptionstring?An optional textual description of the metric.
Iconstring?An optional ID for an icon, registered under Icon.
ValueTypeMetricValueTypeThe MetricValueType the metric's value must conform to.
BaseUnitUnit?The optional base Unit for the metric, used for returned values.
UnitsIEnumerable<Unit>?A list of Units the BaseUnit can be converted into.

MetricValueType

A MetricType must always specify a MetricValueType.
This type imposes restrictions on acceptable values for a Metric of this type.

TypeAccepted Value
CustomA custom value (currently not supported).
StringA string.
NumericA number.
DurationAn ISO 8601 duration string or a C# TimeSpan object.
DateTimeAn ISO 8601 date-time string or a C# DateTime/DateTimeOffset.
DateOnlyAn ISO 8601 date string or a C# DateOnly object.
TimeOnlyAn ISO 8601 time string or a C# TimeOnly object.
ResourceAn ID of a registered external resource (e.g., icon, image).
CurrencyA number.
note

When updating a numerical MetricValue, the value **must be provided in the base unit ** as defined by the metric's MetricType to ensure accurate unit conversions.


CoreMetricType

The SDK provides several common metric types that are automatically registered by the MoBro data service.
These types include predefined units, conversion formulas, and translations for all languages currently supported by MoBro.

tip

Use core metric types whenever applicable. This ensures you'll benefit from future additions of supported languages or units without needing to update your code or publish a new plugin version.

TypeBase UnitMetricValueTypeDescription
ElectricCurrentAmpereNumericElectric current
ElectricPotentialVoltNumericElectric potential difference
ElectricResistanceOhmNumericElectric resistance
DataFlowBits per secondNumericData transfer rate (bitrate).
DataBytesNumericData capacity.
DurationSecondsDurationThe elapsed time between two events.
FrequencyHertzNumericNumber of occurrences per unit of time.
MultiplierMultiplier (x)NumericA multiplier.
Numeric-NumericA simple numeric value.
PowerWattNumericElectric power output.
RotationRotations per minuteNumericRotational speed.
TemperatureDegrees CelsiusNumericTemperature measurement.
Text-StringA simple text value.
UsagePercentageNumericUsage or utilization percentage.
PressurePascalNumericApplied force on a surface.
VolumeCubic metreNumericA volumetric measurement.
VolumeFlowCubic metre per secondNumericVolume movement per unit of time.
DateTime-DateTimeA date and time value.
LengthMetresNumericA measure of distance.
SpeedMetres per secondNumericSpeed as distance per unit of time.
MassKilogramsNumericThe quantity of matter.
AreaSquare metreNumericThe extent of a region.
Date-DateOnlyA date (without a time component).
Time-TimeOnlyA time (without a date component).
Icon-ResourceAn icon resource.
Image-ResourceAn image resource.
AngleDegreesNumericAn angular measurement.

CoreMetricTypeCurrency

The SDK also provides core metric types for the Currency MetricValueType.
These currency types are predefined with labels, descriptions, currency symbols, and translations for all supported languages in MoBro.

Core TypeCurrency
AUDAustralian dollar
AZNAzerbaijani manat
BAMBosnia and Herzegovina convertible mark
BGNBulgarian lev
CADCanadian dollar
CHFSwiss franc
CNYRenminbi
CZKCzech koruna
DKKDanish krone
EUREuro
GBPPound sterling
GELGeorgian lari
HUFHungarian forint
INRIndian rupee
ISKIcelandic króna
JPYJapanese yen
MDLMoldovan leu
MKDMacedonian denar
NOKNorwegian krone
PLNPolish złoty
RONRomanian leu
RSDSerbian dinar
SEKSwedish krona
TRYTurkish lira
UAHUkrainian hryvnia
USDUnited States dollar

Custom Types

If a predefined core type does not suit the metric, plugins can create and register a custom MetricType like any other IMoBroItem.

note

When registering a custom MetricType of Currency, the label must be a 3-character currency code following the ISO 4217 standard.


Unit

A Unit represents the measurement type for a Metric (e.g., degrees Celsius for temperature). Each unit is specific to a MetricType.

Properties

PropertyTypeDescription
LabelstringThe name of the unit.
AbbreviationstringThe abbreviation of the unit.
Descriptionstring?An optional textual description of the unit.
FromBaseFormulastringThe formula for converting the base unit to this unit (e.g., x * 10).
ToBaseFormulastringThe formula for converting this unit to the base unit (e.g., x / 10).