MetricType
The type of Metric
Defines the MetricValueType and the applicable Units
Properties
Property | Type | Description |
---|---|---|
Id | string | The id |
Label | string | The textual label |
Description | string? | An optional textual description |
Icon | string? | An optional icon id (registered Icon) |
ValueType | MetricValueType | The MetricValueType a value of this type must conform to |
BaseUnit | Unit? | The optional base Unit in which values of this type must be returned in |
Units | IEnumerable<Unit>? | A list of Units the BaseUnit can be converted to |
MetricValueType
A MetricType must always specify a MetricValueType.
This value type imposes certain restrictions on the acceptable values a Metric of this type
will accept.
Type | Accepted value |
---|---|
Custom | A custom value (currently not supported!) |
String | string |
Numeric | number |
Duration | ISO 8601 duration string or C# TimeSpan object |
DateTime | ISO 8601 date + time string or C# DateTime/DateTimeOffset object |
DateOnly | ISO 8601 date string or C# DateOnly object |
TimeOnly | ISO 8601 time string or C# TimeOnly object |
Resource | Id of a registered external resource (icon, image..) |
Currency | number |
When updating a numerical MetricValue, the value must be provided in the base unit as defined by the metrics MetricType to ensure correct unit conversions
CoreMetricType
Certain common metric types are already provided by the SDK and automatically registered by the MoBro data service.
These types already include the most commonly used units, according conversion formulas and translations for all
languages currently supported by MoBro.
Prefer using core metric types over custom types wherever applicable. You will automatically benefit whenever additional units or supported languages are added in the future, without having to change any code yourself or the need to publish a new plugin version
Type | Base unit | MetricValueType | Description |
---|---|---|---|
ElectricCurrent | Ampere | Numeric | Electric current |
ElectricPotential | Volt | Numeric | Electric potential difference |
ElectricResistance | Ohm | Numeric | Electric resistance |
DataFlow | Bit per second | Numeric | Bitrate |
Data | Bytes | Numeric | Capacity of data |
Duration | Seconds | Duration | The amount of time elapsed between two events |
Frequency | Hertz | Numeric | Number of occurrences of a repeating event per unit of time |
Multiplier | x | Numeric | A multiplier |
Numeric | - | Numeric | A simple numeric value |
Power | Watt | Numeric | Electric power |
Rotation | Rotations per minute | Numeric | Rotational Speed |
Temperature | degree Celsius | Numeric | Temperature |
Text | - | String | A simple text value |
Usage | Percentage | Numeric | Utilization indication |
Pressure | Pascal | Numeric | Applied force on a surface |
Volume | Cubic metre | Numeric | A measure of occupied space in 3D |
VolumeFlow | Cubic metre per second | Numeric | Volume which passes per unit of time |
DateTime | - | DateTime | A date and time |
Length | Metres | Numeric | A measure of distance |
Speed | Metres per second | Numeric | Distance travelled per unit of time |
Mass | Kilogram | Numeric | The quantity of matter of a physical body |
Area | Square meter | Numeric | Quantity to express the extent of a region |
Date | - | DateOnly | A date without the time component |
Time | - | TimeOnly | A time without the date component |
Icon | - | Resource | An icon |
Image | - | Resource | An image |
Angle | degrees | Numeric | An angle |
CoreMetricTypeCurrency
There are also dedicated core types for the Currency
MetricValueType provided by the SDK and
automatically registered by the MoBro data service.
These currency types are already well-defined with the appropriate label, description, currency symbol and translations
for all currently supported languages by MoBro.
CoreType | Currency |
---|---|
AUD | Australian dollar |
AZN | Azerbaijani manat |
BAM | Bosnia and Herzegovina convertible mark |
BGN | Bulgarian lev |
CAD | Canadian dollar |
CHF | Swiss franc |
CNY | Renminbi |
CZK | Czech koruna |
DKK | Danish krone |
EUR | Euro |
GBP | Pound sterling |
GEL | Georgian lari |
HUF | Hungarian forint |
INR | Indian rupee |
ISK | Icelandic króna |
JPY | Japanese yen |
MDL | Moldovan leu |
MKD | Macedonian denar |
NOK | Norwegian krone |
PLN | Polish złoty |
RON | Romanian leu |
RSD | Serbian dinar |
SEK | Swedish krona |
TRY | Turkish lira |
UAH | Ukrainian hryvnia |
USD | United States dollar |
Custom types
In case there's no fitting core type for a metric, a custom MetricType can be created by the plugin and registered like any other IMoBroItems.
When registering a custom MetricType of MetricValueType Currency
, the label must be a 3 character
currency code according to ISO 4217
Unit
A unit to present the value of a Metric in (e.g. degrees Celsius for temperature)
A unit always belongs to a specific MetricType
Properties
Property | Type | Description |
---|---|---|
Label | string | The name of the unit |
Abbreviation | string | The units abbreviation |
Description | string? | An optional textual description |
FromBaseFormula | string | The formula to apply to derive this unit from the base unit of its MetricType (e.g. x*10) |
ToBaseFormula | string | The formula to apply to convert this unit into the base unit of its MetricType (e.g.: x/10) |