add prefix and fix example
This commit is contained in:
parent
ccd1b64426
commit
cdadf44c27
@ -103,7 +103,7 @@ mappings:
|
||||
|
||||
## Data Transformation
|
||||
|
||||
You can manipulate data with the following tools `remap`, `scale` and `suffix`, for example:
|
||||
You can manipulate data with the following tools `remap`, `scale`, `prefix` and `suffix`, for example:
|
||||
|
||||
```yaml
|
||||
- field: key4
|
||||
@ -120,7 +120,11 @@ You can manipulate data with the following tools `remap`, `scale` and `suffix`,
|
||||
label: Power
|
||||
format: float
|
||||
scale: 0.001 # can be number or string e.g. 1/16
|
||||
suffix: kW
|
||||
suffix: "kW"
|
||||
- field: key6
|
||||
label: Price
|
||||
format: float
|
||||
suffix: "$"
|
||||
```
|
||||
|
||||
## List View
|
||||
|
||||
@ -90,6 +90,12 @@ function formatValue(t, transformation, rawValue) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
// Apply fixed prefix.
|
||||
const prefix = transformation?.prefix;
|
||||
if (prefix) {
|
||||
value = `${prefix} ${value}`;
|
||||
}
|
||||
|
||||
// Apply fixed suffix.
|
||||
const suffix = transformation?.suffix;
|
||||
if (suffix) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user