Value mappings
Values mapped via value mappings will skip the unit formatting. This means that a text value mapped to a numerical value will not be formatted using the configured unit.
If value mappings are present in a panel, then Grafana displays a summary in the side pane of the panel editor.
Value mappings are displayed differently in different visualizations.
Here’s an example showing a Time series visualization with value mappings. Value mapping colors are not applied to this visualization, but the display text is shown on the axis.
Stat example
Here’s an example showing a Stat visualization with value mappings. You might want to hide the sparkline so it doesn’t interfere with the values. Value mapping text colors are applied.
Bar gauge example
Here’s an example showing a Table visualization with value mappings. If you want value mapping colors displayed on the table, then set the cell display mode to Color text or Color background.
Value mappings fields
This section describes options in the Value mappings user interface.
Note: Display text and Color are both optional. If you want to only assign colors to the text values, then you can leave the display text empty and the original value is displayed.
Condition
This column lists the type of condition a value mapping is triggered by and the values.
You can map values to three different conditions:
- Value maps text values to a color or different display text. For example, if a value is , I want Grafana to display Perfection! rather than the number.
- Range maps numerical ranges to a display text and color. For example, if a value is within a certain range, I want Grafana to display Low or High rather than the number.
- Regex maps regular expressions to replacement text and a color. For example, if a value is ‘’, I want Grafana to display just www, truncating the domain.
You can also use the dots on the left as a “handle” to drag and reorder value mappings in the list.
Display text
You can enter any Ascii character or emoji in this field.
You can select a color to for Grafana to display the value mapping text in.
- Set color - Click Set color to see a range of recommended colors. Click Custom to choose your own color.
- Text color - The primary text color for the current theme, i.e. white in dark theme and black in light theme.
- Transparent - Makes the color transparent so that the value mapping color shows whatever color is behind it, such as a panel background color.
Copy icon
Click the copy icon in the value mapping row that you want to copy.
Trash icon
Click the trash can icon to delete a value mapping. Once deleted, you cannot recover it.
Create a mapping for a single value.
- .
- In the Value mappings section of the side pane, click Add value mappings.
- Click Add a new mapping and then select Value.
- Enter the exact value for Grafana to match.
- (Optional) Enter display text.
- (Optional) Set the color.
- Click Update to save the value mapping.
Map a range
Create a mapping for a range of values.
- .
- In the Value mappings section of the side pane, click Add value mappings.
- Click Add a new mapping and then select Range.
- Enter the beginning and ending values in the range for Grafana to match.
- (Optional) Enter display text.
- (Optional) Set the color.
- Click Update to save the value mapping.
- .
- In the Value mappings section of the side pane, click Add value mappings.
- Enter the regular expression pattern for Grafana to match.
- (Optional) Enter display text, which can include items such as $1 for replacements.
- (Optional) Set the color.
- Click Update to save the value mapping.
Map a special value
Create a mapping for a special value.
- .
- In the Value mappings section of the side pane, click Add value mappings.
- Click Add a new mapping and then select Special.
- Select the special value for Grafana to match. Options include:
- Null
- NaN (Not a Number)
- Null + NaN
- True
- False
- Empty
- (Optional) Enter display text.
- (Optional) Set the color.
- Click Update to save the value mapping.
- .
- In the Value mappings section of the side pane, click Edit value mappings.