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