mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Transformations: Use fieldMatchers for convertFieldType and add doc (#38769)
This commit is contained in:
@@ -10,6 +10,7 @@ Grafana comes with the following transformations:
|
||||
- [Add field from calculation]({{< relref "./types-options.md#add-field-from-calculation" >}})
|
||||
- [Concatenate fields]({{< relref "./types-options.md#concatenate-fields" >}})
|
||||
- [Config from query results]({{< relref "./config-from-query.md" >}})
|
||||
- [Convert field type]({{< relref "./types-options.md#convert-field-type" >}})
|
||||
- [Filter data by name]({{< relref "./types-options.md#filter-data-by-name" >}})
|
||||
- [Filter data by query]({{< relref "./types-options.md#filter-data-by-query" >}})
|
||||
- [Filter data by value]({{< relref "./types-options.md#filter-data-by-value" >}})
|
||||
@@ -324,6 +325,36 @@ After you concatenate the fields, the data frame would be:
|
||||
| ---- | ------- | --- | ------ |
|
||||
| 15.4 | 1230233 | 3.2 | 5 |
|
||||
|
||||
## Convert field type
|
||||
|
||||
This transformation changes the field type of the specified field.
|
||||
|
||||
- **Field -** Select from available fields
|
||||
- **as -** Select the FieldType to convert to
|
||||
- **Numeric -** attempts to make the values numbers
|
||||
- **String -** will make the values strings
|
||||
- **Time -** attempts to parse the values as time
|
||||
- Will show an option to specify a DateFormat as input by a string like yyyy-mm-dd or DD MM YYYY hh:mm:ss
|
||||
- **Boolean -** will make the values booleans
|
||||
|
||||
For example the following query could be modified by selecting the time field, as Time, and Date Format as YYYY.
|
||||
|
||||
| Time | Mark | Value |
|
||||
| ---------- | ----- | ----- |
|
||||
| 2017-07-01 | above | 25 |
|
||||
| 2018-08-02 | below | 22 |
|
||||
| 2019-09-02 | below | 29 |
|
||||
| 2020-10-04 | above | 22 |
|
||||
|
||||
The result:
|
||||
|
||||
| Time | Mark | Value |
|
||||
| ------------------- | ----- | ----- |
|
||||
| 2017-01-01 00:00:00 | above | 25 |
|
||||
| 2018-01-01 00:00:00 | below | 22 |
|
||||
| 2019-01-01 00:00:00 | below | 29 |
|
||||
| 2020-01-01 00:00:00 | above | 22 |
|
||||
|
||||
## Series to rows
|
||||
|
||||
> **Note:** This transformation is available in Grafana 7.1+.
|
||||
|
||||
Reference in New Issue
Block a user