Grafana Graphs and Charts
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
Checked on 2026-11-09 against Grafana 13.3.x.
To do this by hand, follow Time Series Panels and Bar Chart, Pie, Histogram and Heatmap.
Grafana’s catalogue puts eleven visualizations in the "graphs and charts" group: Time series, State timeline, Status history, Bar chart, Histogram, Heatmap, Pie chart, Candlestick, Gauge, Trend and XY chart. This page covers all of them except the Gauge, which sits with the single-value panels in Stats, Tables and Widgets. Choosing between them starts from the question the chart answers, which is the subject of Choosing a Visualization; the options that all of them share (unit, thresholds, overrides, legend, tooltip) are in Field Configuration. Examples use the Bookshelf service, whose Micrometer metrics are described in Metrics and Observability and queried with the PromQL from the Prometheus cheat sheet.
Source: Grafana: Visualizations (the catalogue).
Time series
Source: Grafana: Time series.
What and when. The default and by far the most used panel of a monitoring dashboard: it shows how one or more numeric
fields change over time, as lines, bars or points. The data is a table with a time field and at least one numeric field,
and each numeric field becomes a series. Each series needs unique timestamps; duplicates may prevent rendering. If the
time field is not detected, convert it with a transformation (see
Transformations and Expressions). A query time offset (for
example -30min) overlays an earlier period for comparison, which is how "is this normal for a Tuesday morning?" is answered.
Graph styles. The options that change the meaning of the chart, not just its looks:
| Option | Use |
|---|---|
Style |
Lines (continuous values such as latency), Bars (counts per interval) or Points. Overrides can combine styles in one panel. |
Line interpolation |
Linear, Smooth, Step before or Step after. Use a step for values that really jump (replica count, a configuration value). Smooth invents points between samples and should not be used for latency. |
Fill opacity, gradient mode, line width, line style |
Fill emphasises volume; gradient mode (None, Opacity, Hue, Scheme) and line style (Solid, Dash, Dots) separate series that share a colour family, for example current against last week. |
Connect null values, Disconnect values |
Never, Always or Threshold for nulls; Never or Threshold for disconnecting. This decides whether a scrape gap shows as a break or is hidden by a straight line. For monitoring, show the gap: a bridged outage looks like a healthy service. |
Show points |
Auto, Always or Never. With Auto, isolated samples stay visible. |
Stack series |
Off, Normal or 100%. Stacking groups can only be set through an override. Stack parts of one whole (status classes of the same requests), never independent measures such as latency percentiles. |
Bar alignment, bar width factor |
Before, Center (default) or After; the width factor is relative to the minimum spacing between points. |
Transform |
Constant (draw the first value as a flat line) and Negative Y (mirror a series below the axis, for example responses sent against requests received). |
Fill below to |
Fills the band between two series, useful for a min to max or p50 to p95 envelope. |
Axes. Placement (Auto, Left, Right, Hidden), label, width, grid lines, colour mode (text or series), scale (Linear,
Logarithmic or Symlog, with base 2 or 10 for the logarithmic ones), centred zero, and soft min and soft max. Soft
limits are the important ones: they stretch the axis to include a value such as 0 without clipping data that goes
beyond it, whereas the standard Min and Max options are hard limits. Two axes with different units (rate and latency) are
legitimate when the series are coloured to match, and they are the first thing to question when the chart looks
convincing but nobody can say what the lines mean.
Legend, tooltip and thresholds. The legend can be a table with calculations (Last, Max, Mean), has a limit and an optional filter by name or label; the tooltip can show Single or All series with a sorted order and a zero filter. Thresholds can be drawn as lines or regions through Show thresholds so the curve is read against its limit. Details are in Field Configuration. Annotations (multi-row, clustered) come from Annotations and Links. A drag on the chart zooms the dashboard time range, a double click zooms out (the range doubles) and a drag on the x-axis pans.
Bookshelf example. Request rate by route, with the unit "requests/sec (rps)" and the legend taken from the route label:
sum by (uri) (rate(http_server_requests_seconds_count{application="bookshelf"}[$__rate_interval]))
and the 5xx ratio of the whole service, to which a threshold line at 0.05 (5 percent) is added as dashed line:
sum(rate(http_server_requests_seconds_count{application="bookshelf",status=~"5.."}[$__rate_interval]))
/
sum(rate(http_server_requests_seconds_count{application="bookshelf"}[$__rate_interval]))
Reference: Grafana: Prometheus template variables
for $__rate_interval. The metric and label names are the Micrometer ones of the Bookshelf service.
As code. The graph options live under fieldConfig.defaults.custom in the panel JSON. The schema (GraphFieldConfig)
defines drawStyle (line, bars, points), lineInterpolation (linear, smooth, stepBefore, stepAfter),
fillOpacity, gradientMode, spanNulls, showPoints, stacking with mode (none, normal, percent) and group,
axisSoftMin, axisSoftMax, scaleDistribution and thresholdsStyle with a mode such as line, area or
dashed+area.
{
"type": "timeseries",
"title": "5xx ratio",
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0,
"custom": {
"drawStyle": "line",
"lineInterpolation": "linear",
"fillOpacity": 10,
"showPoints": "auto",
"spanNulls": false,
"axisSoftMax": 0.02,
"stacking": { "mode": "none", "group": "A" },
"thresholdsStyle": { "mode": "dashed" }
},
"thresholds": {
"mode": "absolute",
"steps": [ { "color": "green", "value": null }, { "color": "red", "value": 0.05 } ]
}
},
"overrides": []
}
}
Reference: Grafana: common schema (GraphFieldConfig).
The legend and tooltip live under the panel’s options; to get their exact keys for your version, export a panel from the
inspector’s JSON tab (see the panel inspector) instead of typing them by hand.
What can go wrong. A rate over a counter reset or a too-short window gives spikes that are not real; an avg of
percentiles hides tail latency (see Metric Types and Aggregation);
too many series without a legend limit make the legend unreadable; and a y-axis that auto-scales to the data makes a
flat line look like a catastrophe.
Bar chart
Source: Grafana: Bar chart.
The bar chart compares values across categories (or across a handful of time periods). The data needs one string or time field plus at least one numeric field; each row becomes a group of bars with one bar per numeric field, and only one dataset (query) may be used. For large time-series data the documentation recommends the time series panel with the bars style instead.
Options that matter: X axis (defaults to the first string or time field), Orientation (Auto, Horizontal or Vertical; horizontal bars give long route names room), Show values (Auto, Always, Never), Stacking (Off, Normal, 100%), group width and bar width (0 to 1), bar radius (0 to 0.5), Color by field (colour each bar from a sibling field) and the label options for the x-axis (rotation, maximum length, minimum spacing). Two limits to remember: the group width is hidden when stacking is on or when there is a single numeric field, and the full-area hover highlight works only with stacking off.
Bookshelf example: the ten slowest routes by p95, as an instant query formatted as a table, sorted descending, with the route as the category:
topk(10, histogram_quantile(0.95, sum by (le, uri) (rate(http_server_requests_seconds_bucket{application="bookshelf"}[$__range]))))
Use a Reduce or Labels to fields transformation if the table shape does not match what the panel expects.
Reference: Grafana: Bar chart and the query pattern from Metric Types and Aggregation.
Histogram
Source: Grafana: Histogram.
The histogram shows how often values occur over the selected time range, that is the shape of a distribution: skew, outliers, two humps. It accepts time series or any table with numeric fields in two modes. With raw values Grafana computes the buckets inside the panel, with pre-bucketed data (a data source that returns histogram buckets) it plots the supplied frequencies and the bucket options become read-only. The options are Bucket count (empty means automatic, 30), Bucket size (empty means about 10 percent of the range), Bucket offset (only effective when above zero and below the bucket size), Combine series (merge all series into one histogram), line width, fill opacity, gradient mode and stacking (Off, Normal, 100%).
A histogram has no time axis: it collapses the whole range into one distribution. That is what you want to answer "what do response sizes look like today"; use the heatmap when you need to see when the shape changed. A histogram of an average (for example one point per minute of mean latency) describes the distribution of the averages, not of the requests, so feed it per-request values or pre-bucketed counts.
Bookshelf example: a SQL data source (the lab database) returning one row per catalogue book with page_count as a
raw numeric field; the histogram shows the size distribution without any query-side bucketing.
Heatmap
Source: Grafana: Heatmap.
The heatmap condenses dense data into coloured cells: time on the x-axis, value buckets on the y-axis and the colour encoding how many observations fell into each cell. It is the right panel for latency histograms because it shows a second mode (a slow database path next to a fast cache path) appearing over time, which a single percentile line hides. The data must be time series.
-
Calculate from data: Yes makes Grafana bin raw series in the panel (X bucket and Y bucket by size or count; the y scale Linear, Logarithmic or Symlog). No means the data source or a transformation already delivers buckets, in a wide structure with one field per bucket; the y scale then also offers Auto, and the tick alignment (Top, Middle or Bottom) applies.
-
Colors: mode Scheme encodes the count with a colour scheme (with Steps from 1 to 128, a reverse option and start and end values for the scale); mode Opacity encodes it with transparency, with a Linear or Exponential scale and an exponent above 0.
-
Cell display: cell gap, and hide cells with values below or above a limit (useful to blank out noise).
-
Tooltip: Single, All or Hidden, with Show histogram (Y axis) and Show color scale in single mode.
-
Exemplars (a colour for exemplar points), legend (show, placement, width) and the Y-axis options (placement, unit, decimals, min and max, width, label, reverse).
Bookshelf example: the request duration buckets, which the existing distribution example
already shows as sum by (le) (rate(http_server_requests_seconds_bucket{application="bookshelf"}[$__rate_interval])). Plot it with the unit
set to seconds, the log scale on the y-axis, and the dashed threshold of the latency objective set on a neighbouring
time series panel. Prometheus native histograms are covered by the
Prometheus cheat sheet. Check the data source’s own page for which query format
feeds the heatmap.
What can go wrong. Cumulative buckets (a Prometheus classic histogram counts the observations up to each boundary) must be turned into per-bucket counts by the data source’s heatmap format or by a transformation before they are drawn, so compare the first rendering with the numbers in the panel inspector. Too many buckets make the colours indistinguishable; too few hide the second hump.
State timeline
Source: Grafana: State timeline.
The state timeline draws, per entity, a horizontal band in the colour of its state over time. It answers "what state was each thing in, and when": servers up or down, deployments by phase, circuit-breaker open or closed. The data is a table with a timestamp, an entity and a state (string, number or boolean), with an optional end-time column; without one each state lasts until the next change or a null. Numeric time series can also be turned into states by adding thresholds.
Options: Merge equal consecutive values (one block instead of many identical ones), Show values (Auto, Always, Never), Align values, Row height, Page size (pagination to limit visible rows), line width, fill opacity, and the connect and disconnect null options. Colour and legend come from value mappings and thresholds: mappings appear in the legend when the colour scheme is a single colour or the classic palette, and threshold ranges when it is "From thresholds".
Bookshelf example: the up metric of the scrape job, up{job="bookshelf"}, with a value mapping 1 to "UP" (green) and 0
to "DOWN" (red) shows each Bookshelf replica’s availability over a day, and makes a flapping instance (many short red
blocks) obvious in a way no line does.
Status history
Source: Grafana: Status history.
The status history shows the same kind of data as the state timeline (entity, timestamp, status) as a grid of periodic boxes, one per period and entity. The documentation lists the difference explicitly: it does not merge consecutive identical values, and its options differ (row height and column width, show values, pagination). Choose it when the question is "how did each check do in each period" (hour by hour pass or fail of a synthetic check) and the state timeline when the question is "how long was it in each state". Null and empty values appear as gaps, and the No value text and a Null value mapping control how they are labelled.
Pie chart
Source: Grafana: Pie chart.
A pie chart is for data that adds up to a total, when the share of each part matters. It always draws a single pie, whatever number of datasets, fields or records the query returns. By default it works from Show: Calculate, which reduces each series to one value and uses the last row; set Show: All values to plot every row (the Limit option then caps the number of values). Options: type Pie or Donut, slice sorting (Descending by default, Ascending or None), labels (Name, Percent, Value), legend values (Percent, Value) and the usual tooltip settings.
Keep it to a few slices. A sorted bar chart or a bar gauge reads more accurately than angles once there are more than about five parts or when parts must be compared with each other; the existing guidance on anti-patterns is in Choosing a Visualization. Bookshelf example: the share of requests by status class, with the query in instant mode:
sum by (outcome) (increase(http_server_requests_seconds_count{application="bookshelf"}[$__range]))
outcome is the Micrometer label that groups statuses into SUCCESS, CLIENT_ERROR and SERVER_ERROR.
Trend
Source: Grafana: Trend.
The trend panel draws a curve whose x-axis is numeric but not time: a function graph, or measurements ordered by distance or by load. The data needs at least two numeric fields and the x-field must be ascending; otherwise Grafana shows an error. Several queries need a Join by field transformation on the x-fields to become one frame. Trend supports the style, axis, legend and tooltip options of the time series panel, but not annotations or time regions, the shared crosshair, a multi-time-zone axis or drag-to-zoom of the dashboard time range.
Bookshelf example: p95 latency against the load generator’s request rate, collected as two aligned series during a ramp test (see JMeter real-time monitoring); the knee of the curve shows the capacity of the service.
XY chart
Source: Grafana: XY chart.
The XY chart shows the relationship between two variables as a scatter plot, or as a bubble chart when a field sets the point size. Any table with at least two numeric fields works, and the x field may be a time field but need not be. Series mapping is Auto (the first number or time field of each frame is x, the other numeric fields are y) or Manual (each series names its frame, x field and y field, and optionally size and colour fields). Options include show (Points, Lines or Both), point size (1 to 100, default 5), point shape (Circle or Square), point stroke width, fill opacity (default 50), and the line style and width for the connecting lines. The size and colour fields scale and colour each point.
Bookshelf example: one point per request from a trace or log table, with the payload size as x, the duration as y and the HTTP status as colour; a cloud of slow requests that all share a large payload points to serialisation, not the database.
Candlestick
Source: Grafana: Candlestick.
The candlestick shows open, high, low and close values per period, and optionally a volume. It was built for prices, but it also fits any quantity with a meaningful open and close in a window. The data needs a timestamp and the four value fields (Grafana maps them from the column names, or you map them in the options) and a volume field for the Volume and Both modes. Mode is Candles, Volume or Both (default); Candle style is Candles or OHLC bars; Color strategy is Since Open (default) or Since Prior Close, which also enables hollow candles; Up and Down colours complete the set.
Bookshelf has no natural price series. A reasonable monitoring use is the queue or connection pool: five-minute open, high, low and close of the busy connections from a SQL data source, so that a pool that touches its maximum for a moment is visible even when the average is calm. For most services a time series with a max line is simpler.
Verify it in the lab
In the lab (Hands-on Lab, profile grafana):
-
Add the request-rate and 5xx-ratio queries above to a new dashboard, and switch the second panel to Step interpolation and then back to Linear to see which one misrepresents a single failed minute.
-
Stop the load generator for two minutes and compare the gap with Connect null values set to Never and Always.
-
Plot the duration buckets as a heatmap; during the load generator’s slow mode a second band should appear.
-
Add a state timeline for
upwith the two value mappings and restart the Bookshelf container. -
Set the unit and thresholds, then compare the panel with the same query in Explore.
In the books
The Grafana books were written for older panels. Salituro (Learn Grafana 10.x) builds time series, stat, bar chart, histogram, heatmap and Geomap panels on weather and earthquake data with InfluxDB and Flux; McCollam (Getting Started with Grafana, Grafana 8) uses the then new state timeline and heatmap; Hernandez (Building IoT Visualizations using Grafana) still names the Singlestat and Worldmap panels next to the time series. Option names have been kept close to the current ones, but panels have moved: the Angular Graph, Singlestat and Worldmap panels were removed in Grafana 12 (see Logs, Traces and Special Panels), and Grafana 13.0 made legend series limits generally available and added panel styles in public preview (see Grafana: What’s new in 13.0). The query languages in those chapters (Flux, InfluxQL) are not used in this site’s lab.