MetricType
The type of a Metric.
Defines the MetricValueType and the applicable Units.
Properties
Property | Type | Description |
---|---|---|
Id | string | The unique identifier of the metric. |
Label | string | The textual label for the metric. |
Description | string? | An optional textual description of the metric. |
Icon | string? | An optional ID for an icon, registered under Icon. |
ValueType | MetricValueType | The MetricValueType the metric's value must conform to. |
BaseUnit | Unit? | The optional base Unit for the metric, used for returned values. |
Units | IEnumerable<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.
Type | Accepted Value |
---|---|
Custom | A custom value (currently not supported). |
String | A string. |
Numeric | A number. |
Duration | An ISO 8601 duration string or a C# TimeSpan object. |
DateTime | An ISO 8601 date-time string or a C# DateTime /DateTimeOffset . |
DateOnly | An ISO 8601 date string or a C# DateOnly object. |
TimeOnly | An ISO 8601 time string or a C# TimeOnly object. |
Resource | An ID of a registered external resource (e.g., icon, image). |
Currency | A number. |
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.
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.
Type | Base Unit | MetricValueType | Description |
---|---|---|---|
ElectricCurrent | Ampere | Numeric | Electric current |
ElectricPotential | Volt | Numeric | Electric potential difference |
ElectricResistance | Ohm | Numeric | Electric resistance |
DataFlow | Bits per second | Numeric | Data transfer rate (bitrate). |
Data | Bytes | Numeric | Data capacity. |
Duration | Seconds | Duration | The elapsed time between two events. |
Frequency | Hertz | Numeric | Number of occurrences per unit of time. |
Multiplier | Multiplier (x) | Numeric | A multiplier. |
Numeric | - | Numeric | A simple numeric value. |
Power | Watt | Numeric | Electric power output. |
Rotation | Rotations per minute | Numeric | Rotational speed. |
Temperature | Degrees Celsius | Numeric | Temperature measurement. |
Text | - | String | A simple text value. |
Usage | Percentage | Numeric | Usage or utilization percentage. |
Pressure | Pascal | Numeric | Applied force on a surface. |
Volume | Cubic metre | Numeric | A volumetric measurement. |
VolumeFlow | Cubic metre per second | Numeric | Volume movement per unit of time. |
DateTime | - | DateTime | A date and time value. |
Length | Metres | Numeric | A measure of distance. |
Speed | Metres per second | Numeric | Speed as distance per unit of time. |
Mass | Kilograms | Numeric | The quantity of matter. |
Area | Square metre | Numeric | The extent of a region. |
Date | - | DateOnly | A date (without a time component). |
Time | - | TimeOnly | A time (without a date component). |
Icon | - | Resource | An icon resource. |
Image | - | Resource | An image resource. |
Angle | Degrees | Numeric | An 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 Type | 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
If a predefined core type does not suit the metric, plugins can create and register a custom MetricType
like any
other IMoBroItem.
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
Property | Type | Description |
---|---|---|
Label | string | The name of the unit. |
Abbreviation | string | The abbreviation of the unit. |
Description | string? | An optional textual description of the unit. |
FromBaseFormula | string | The formula for converting the base unit to this unit (e.g., x * 10 ). |
ToBaseFormula | string | The formula for converting this unit to the base unit (e.g., x / 10 ). |