Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 37 ยท Panels and Visualizations

Stat, Gauge and Bar Gauge Panels

Show current values in Grafana with Stat, Gauge and Bar gauge panels: value options and calculations, thresholds, color modes, sparklines, orientation and text size.

Not every question needs a graph. "Is the site up?", "What is disk usage right now?", "How many orders today?" call for one number, clearly displayed. Grafana has three panels for that: Stat, Gauge and Bar gauge. They share most of their options, so learn one and you know them all.

Choosing between them

Panel Best for Looks like
Stat KPIs, counts, status Big number, optional sparkline and background color
Gauge A value with a known min and max, like percent used Dial arc
Bar gauge Comparing several values at once, ranking Horizontal or vertical bars (basic, gradient, retro LCD)

Value options

Each panel reduces a series (many points) to one value:

  • Calculation: Last, Last (not null), First, Mean, Min, Max, Total, Count, Range, Delta, Difference, Variance, Std Dev, and more.
  • Fields: all numeric fields, a specific field, or All values (one display per row, useful with tables).
  • Show: Calculate (reduce the series) or All values (limit rows).

Pick the calculation to match the question: "now" is Last, "today's total" is Total over a range that starts at midnight, "typical" is Mean, "worst" is Max.

Thresholds and colors

Thresholds are the main reason to use these panels. A set of steps, each with a value and a color, decides which color the value gets:

Step Color Meaning
Base green OK
70 orange Warning
90 red Critical

The rule: a value takes the color of the highest step it reaches. Switch between Absolute and Percentage thresholds (percentage uses min and max). Set min and max for gauges, for example 0 and 100 for percent.

In Stat, Color mode can color the Value, the Background (solid or gradient) or nothing. Graph mode adds a sparkline (area) behind the number. Text mode chooses between value, name, value and name, or none.

Orientation and layout

  • Orientation: auto, horizontal, vertical. A multi-value Stat panel lays out one tile per series.
  • Text size: title and value sizes (auto-scaling by default).
  • Justify mode (Stat): center or auto.
  • Gauges: Show threshold labels and Show threshold markers; bar gauges: Display mode and Show unfilled area.

Value mappings

Show words instead of numbers: map 1 to "UP" (green) and 0 to "DOWN" (red). Details in the thresholds and mappings lesson.

Stand-in: reduce and color

This stand-in implements reducers and the threshold color rule so you can try different thresholds.

JS Stand-in: calculation plus threshold color

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: draw a bar gauge as text

JS Stand-in: a text bar gauge

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Practical examples

  • Uptime: Prometheus up{job="shop"} with value mappings 1 = "UP", 0 = "DOWN", color mode Background.
  • Current error rate: sum(rate(errors[5m])) / sum(rate(requests[5m])), unit Percent (0.0-1.0), thresholds 0.01 and 0.05.
  • Orders today (SQL): SELECT COUNT(*) FROM orders WHERE created_at >= CURDATE(), Format as Table, calculation Last.
  • Disk by volume: Bar gauge, one query returning one series per mount point, max 100, thresholds 70 and 90.

Mistakes to avoid

  • Using Mean for a "current" value, which hides recent changes.
  • Forgetting min and max on a gauge, so the dial scale looks arbitrary.
  • Color alone to carry meaning; add text or a mapping for color-blind users.
  • Using Stat for data that needs trend context; turn on the sparkline.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which calculation gives the latest value of a series?

    Last takes the final point; Last (not null) skips trailing nulls.
  2. 2. Which panel is best for comparing several disks' usage at once?

    Bar gauge shows one bar per series, which makes ranking easy.
  3. 3. A value 92 with steps green (base), orange (70), red (90) will be...

    It reaches the 90 step, the highest one it meets.
  4. 4. What does the Stat panel's Graph mode add?

    Graph mode draws a small trend line behind the value.

Summary

  • Stat, Gauge and Bar gauge display single values with thresholds.
  • Choose the calculation to match the question; set min and max for gauges.
  • Color is driven by threshold steps; combine it with text and mappings.
  • Bar gauges compare many values; Stat shows KPIs with sparklines.
  • Avoid misleading reducers and color-only meaning.

Next: The Table Panel