Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Grafana Cloud Enterprise Open source

Stat

Note

This visualization replaces the Singlestat visualization, which was deprecated in Grafana 7.0 and removed in Grafana 8.0.

A stat visualization displays your data in single values of interest—such as the latest or current value of a series—with an optional graph sparkline. A graph sparkline, which is only available in stat visualizations, is a small time-series graph shown in the background of each value in the visualization.

For example, if you’re monitoring the utilization of various services, you can use a stat visualization to show their latest usage:

A stat panel showing latest usage of various services

Use a stat visualization when you need to:

  • Monitor key metrics at a glance, such as the latest health of your application, number of high priority bugs in your application, or total number of sales.
  • Display aggregated data, such as the average response time of your services.
  • Highlight values above your normal thresholds to quickly identify if any metrics are outside your expected range.
Give it a try using Grafana Play
Give it a try using Grafana Play

With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Stat Visualizations in Grafana.

Configure a stat visualization

Once you’ve created a dashboard, the following video shows you how to configure a stat visualization:

Alternatively, refer to this blog post on how to easily retrieve values from a range in Grafana using a stat visualization.

Supported data formats

The stat visualization supports a variety of formats for displaying data. Supported formats include:

  • Single values - The most common format and can be numerical, strings, or boolean values.
  • Time-series data - Calculation types can be applied to your time-series data to display single values over a specified time range.

Examples

The following tables are examples of the type of data you need for a stat visualization and how it should be formatted.

Single numerical values

Number of high priority bugs
80
52
59
40

The data is visualized as follows, with the last value displayed, along with a sparkline and percentage change:

A stat panel showing the latest number of high priority bugs

Time-series data

TimeCellarLiving roomPorchBedroomGuest roomKitchen
2024-03-20 06:34:4012.318.318.815.99.299.61
2024-03-20 06:41:4016.817.121.514.110.517.5
2024-03-20 06:48:4016.718.021.09.5113.620.1
2024-03-20 06:55:4014.318.716.59.1114.812.5
2024-03-20 07:02:4012.815.221.115.67.9813.0

The data is visualized as follows, with the mean value displayed for each room, along with the room name, sparkline, and unit of measurement:

A stat panel showing some statistics for each room in square meters

By default, a stat displays one of the following:

  • Just the value for a single series or field.
  • Both the value and name for multiple series or fields.

You can use the Text mode to control how the text is displayed.

Configuration options

The following section describes the configuration options available in the panel editor pane for this visualization. These options are, as much as possible, ordered as they appear in Grafana.

Panel options

In the Panel options section of the panel editor pane, set basic options like panel title and description, as well as panel links. To learn more, refer to Configure panel options.

Value options

Use the following options to refine how your visualization displays its values:

OptionDescription
ShowDisplay a single value per column or series, or show values for each row. Choose from:
  • Calculate - Display a calculated value based on all rows.
  • All values - Show a separate stat for every row. If you select this option, then you can also limit the number of rows to display.
CalculationThis option is displayed when you select Calculate as your Show option. Select a reducer function that Grafana will use to reduce many fields to a single value. For a list of available calculations, refer to Calculation types.
LimitThis option is displayed when you select All values as your Show option. Set the maximum number of rows to display. Default is 5,000.
FieldsSelect the fields displayed in the visualization.

Stat styles

The stat visualization automatically adjusts the layout depending on available width and height in the dashboard, but you can also use the following options to further style the visualization.

OptionDescription
OrientationSelect a stacking direction. Choose from:
  • Auto - Grafana selects the ideal orientation.
  • Horizontal - Bars stretch horizontally, left to right.
  • Vertical - Bars stretch vertically, top to bottom.
Text modeYou can use the Text mode option to control what text the visualization renders. If the value is not important, only the name and color is, then change the Text mode to Name. The value will still be used to determine color and is displayed in a tooltip.
Wide layoutSet whether wide layout is enabled or not. Wide layout is enabled by default. This option is only applicable when Text mode is set to Value and name.
Color modeSelect a color mode. Choose from:
  • None - No color applied to the value.
  • Value - Applies color to the value and graph area.
  • Background Gradient - Applies color to the value, graph area, and background, with a slight background gradient.
  • Background Solid - Applies color to the value, graph area, and background, with a solid background color.
Graph modeSelect a graph sparkline mode. Choose from:
  • None - Hides the graph sparkline and only shows the value.
  • Area - Shows the graph sparkline below the value. This requires that your query returns a time column.
The graph sparkline is automatically hidden if the panel becomes too small.
Text alignmentSelect an alignment mode. Choose from:
  • Auto - If only a single value is shown (no repeat), then the value is centered. If multiple series or rows are shown, then the value is left-aligned.
  • Center - Stat value is centered.
Show percent changeSet whether percent change is displayed or not. Disabled by default. This option is applicable when the Show setting, under Value options, is set to Calculate.
Percent change color modeThis option is only displayed when Show percent change is enabled. Choose from:
  • Standard - Green if the percent change is positive, red if the percent change is negative.
  • Inverted - Red if the percent change is positive, green if the percent change is negative.
  • Same as Value - Use the same color as the value.

Text mode

You can use the Text mode option to control what text the visualization renders. If the value is not important, only the name and color is, then change the Text mode to Name. The value will still be used to determine color and is displayed in a tooltip.

  • Auto - If the data contains multiple series or fields, show both name and value.
  • Value - Show only value, never name. Name is displayed in the hover tooltip instead.
  • Value and name - Always show value and name.
  • Name - Show name instead of value. Value is displayed in the hover tooltip.
  • None - Show nothing (empty). Name and value are displayed in the hover tooltip.

Wide layout

Set whether wide layout is enabled or not. Wide layout is enabled by default.

  • On - Wide layout is enabled.
  • Off - Wide layout is disabled.

This option is only applicable when Text mode is set to Value and name. When wide layout is enabled, the value and name are displayed side-by-side with the value on the right, if the panel is wide enough. When wide layout is disabled, the value is always rendered underneath the name.

Text size

Adjust the sizes of the gauge text.

  • Title - Enter a numeric value for the gauge title size.
  • Value - Enter a numeric value for the gauge value size.

Standard options

Standard options in the panel editor pane let you change how field data is displayed in your visualizations. When you set a standard option, the change is applied to all fields or series. For more granular control over the display of fields, refer to Configure overrides.

OptionDescription
UnitChoose which unit a field should use.
Min/MaxSet the minimum and maximum values used in percentage threshold calculations or leave these field empty for them to be calculated automatically.
Field min/maxEnable Field min/max to have Grafana calculate the min or max of each field individually, based on the minimum or maximum value of the field.
DecimalsSpecify the number of decimals Grafana includes in the rendered value.
Display nameSet the display title of all fields. You can use variables in the field title.
Color schemeSet single or multiple colors for your entire visualization.
No valueEnter what Grafana should display if the field value is empty or null. The default value is a hyphen (-).

To learn more, refer to Configure standard options.

Data links allow you to link to other panels, dashboards, and external resources while maintaining the context of the source panel. You can create links that include the series name or even the value under the cursor.

For each data link, set the following options:

  • Title
  • URL
  • Open in new tab

To learn more, refer to Configure data links.

Value mappings

Value mapping is a technique you can use to change how data appears in a visualization.

For each value mapping, set the following options:

  • Condition - Choose what’s mapped to the display text and (optionally) color:
    • Value - Specific values
    • Range - Numerical ranges
    • Regex - Regular expressions
    • Special - Special values like Null, NaN (not a number), or boolean values like true and false
  • Display text
  • Color (Optional)
  • Icon (Canvas only)

To learn more, refer to Configure value mappings.

Thresholds

A threshold is a value or limit you set for a metric that’s reflected visually when it’s met or exceeded. Thresholds are one way you can conditionally style and color your visualizations based on query results.

For each threshold, set the following options:

OptionDescription
ValueSet the value for each threshold.
Thresholds modeChoose from Absolute and Percentage.

To learn more, refer to Configure thresholds.

Field overrides

Overrides allow you to customize visualization settings for specific fields or series. When you add an override rule, it targets a particular set of fields and lets you define multiple options for how that field is displayed.

Choose from the following override options:

OptionDescription
Fields with nameSelect a field from the list of all available fields.
Field with name matching regexSpecify fields to override with a regular expression.
Fields with typeSelect fields by type, such as string, numeric, or time.
Fields returned by querySelect all fields returned by a specific query, such as A, B, or C.
Fields with valuesSelect all fields returned by your defined reducer condition, such as Min, Max, Count, Total.

To learn more, refer to Configure field overrides.