mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 02:22:43 +08:00

* Added Supported visualizations sections and missing settings for value mappings * Updated supported visualizations table and added docs ref links * Updated supported visualizations table * Removed placeholder headings and accidentally added section to data links page * Added missing visualization
161 lines
9.4 KiB
Markdown
161 lines
9.4 KiB
Markdown
---
|
|
aliases:
|
|
- ../panels/configure-value-mappings/
|
|
- ../panels/format-data/
|
|
- ../panels/format-data/about-value-mapping/
|
|
- ../panels/format-data/edit-value-mapping/
|
|
- ../panels/format-data/map-a-range/
|
|
- ../panels/format-data/map-a-regular-expression/
|
|
- ../panels/format-data/map-a-special-value/
|
|
- ../panels/format-data/map-a-value/
|
|
- ../panels/value-mappings/
|
|
labels:
|
|
products:
|
|
- cloud
|
|
- enterprise
|
|
- oss
|
|
menuTitle: Configure value mappings
|
|
title: Configure value mappings
|
|
description: Configure value mappings to change how data appears in your visualizations
|
|
weight: 90
|
|
---
|
|
|
|
# Configure value mappings
|
|
|
|
In addition to field overrides, value mapping is a technique you can use to change how data appears in a visualization.
|
|
|
|
For example, the mapping applied in the following image causes the visualization to display the text `Cold`, `Good`, and `Hot` in blue, green, and red for ranges of temperatures rather than actual temperature values. Using value mappings this way can make data faster and easier to understand and interpret.
|
|
|
|

|
|
|
|
Value mappings bypass unit formatting set in the **Standard options** section of panel editor, like color or number of decimal places displayed. When value mappings are present in a panel, Grafana displays a summary of them in the **Value mappings** section of the editor panel.
|
|
|
|
## Supported visualizations
|
|
|
|
You can configure value mappings for the following visualizations:
|
|
|
|
| | | |
|
|
| -------------------------- | -------------------------------- | -------------------------------- |
|
|
| [Bar chart][bar chart] | [Geomap][geomap] | [Status history][status history] |
|
|
| [Bar gauge][bar gauge] | [Histogram][histogram] | [Table][table] |
|
|
| [Candlestick][candlestick] | [Pie chart][pie chart] | [Time series][time series] |
|
|
| [Canvas][canvas] | [Stat][stat] | [Trend][trend] |
|
|
| [Gauge][gauge] | [State timeline][state timeline] | |
|
|
|
|
## Types of value mappings
|
|
|
|
Grafana supports the following value mapping types:
|
|
|
|
### Value
|
|
|
|
A **Value** mapping maps specific values to text and a color. For example, you can configure a mapping so that all instances of the value `10` appear as **Perfection!** rather than the number. Use **Value** mapping when you want to format a single value.
|
|

|
|
|
|
### Range
|
|
|
|
A **Range** mapping maps numerical ranges to text and a color. For example, if a value is within a certain range, you can configure a range value mapping to display **Low** or **High** rather than the number. Use **Range** mapping when you want to format multiple, continuous values.
|
|

|
|
|
|
### Regex
|
|
|
|
A **Regex** mapping maps regular expressions to text and a color. For example, if a value is `www.example.com`, you can configure a regular expression value mapping so that Grafana displays **www** and truncates the domain. Use the **Regex** mapping when you want to format the text and color of a regular expression value.
|
|

|
|
|
|
### Special
|
|
|
|
A **Special** mapping maps special values like `Null`, `NaN` (not a number), and boolean values like `true` and `false` to text and color. For example, you can configure a special value mapping so that `null` values appear as **N/A**. Use the **Special** mapping when you want to format uncommon, boolean, or empty values.
|
|

|
|
|
|
## Examples
|
|
|
|
Refer to the following examples to learn more about value mapping.
|
|
|
|
### Time series example
|
|
|
|
The following image shows a time series visualization with value mappings. Value mapping colors aren't applied to this visualization, but the display text is shown on the axis.
|
|
|
|

|
|
|
|
### Stat example
|
|
|
|
The following image shows a stat visualization with value mappings and text colors applied. You can hide the sparkline so it doesn't interfere with the values.
|
|
|
|

|
|
|
|
### Bar gauge example
|
|
|
|
The following image shows a bar gauge visualization with value mappings. Note that the value mapping colors are applied to the text, but not to the gauges.
|
|
|
|

|
|
|
|
### Table example
|
|
|
|
The following image shows 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**.
|
|
|
|

|
|
|
|
## Add a value mapping
|
|
|
|
1. Navigate to the panel you want to update.
|
|
1. Hover over any part of the panel you want to work on to display the menu on the top right corner.
|
|
1. Click the menu and select **Edit**.
|
|
1. Scroll to the **Value mappings** section and expand it.
|
|
1. Click **Add value mappings**.
|
|
1. Click **Add a new mapping** and then select one of the following:
|
|
|
|
- **Value** - Enter a single value to match.
|
|
- **Range** - Enter the beginning and ending values of a range to match.
|
|
- **Regex** - Enter a regular expression pattern to match.
|
|
- **Special** - Select a special value to match.
|
|
|
|
1. (Optional) Enter display text.
|
|
1. (Optional) Set the color.
|
|
1. (Optional) Set an icon (canvas visualizations only).
|
|
1. Click **Update** to save the value mapping.
|
|
|
|
After you've added a mapping, the **Edit value mappings** button replaces the **Add value mappings** button. Click the edit button to add or update mappings.
|
|
|
|
{{% docs/reference %}}
|
|
[bar chart]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/bar-chart"
|
|
[bar chart]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/bar-chart"
|
|
|
|
[bar gauge]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/bar-gauge"
|
|
[bar gauge]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/bar-gauge"
|
|
|
|
[candlestick]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/candlestick"
|
|
[candlestick]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/candlestick"
|
|
|
|
[canvas]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/canvas"
|
|
[canvas]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/canvas"
|
|
|
|
[gauge]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/gauge"
|
|
[gauge]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/gauge"
|
|
|
|
[geomap]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/geomap"
|
|
[geomap]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/geomap"
|
|
|
|
[histogram]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/histogram"
|
|
[histogram]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/histogram"
|
|
|
|
[pie chart]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/pie-chart"
|
|
[pie chart]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/pie-chart"
|
|
|
|
[stat]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/stat"
|
|
[stat]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/stat"
|
|
|
|
[state timeline]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/state-timeline"
|
|
[state timeline]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/state-timeline"
|
|
|
|
[status history]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/status-history"
|
|
[status history]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/status-history"
|
|
|
|
[table]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/table"
|
|
[table]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/table"
|
|
|
|
[time series]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/time-series"
|
|
[time series]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/time-series"
|
|
|
|
[trend]: "/docs/grafana/ -> /docs/grafana/<GRAFANA VERSION>/panels-visualizations/visualizations/trend"
|
|
[trend]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/visualizations/trend"
|
|
{{% /docs/reference %}}
|