SPC Box Plot
The SPC Box Plot panel visualizes process data distributions as box-and-whisker plots with built-in Statistical Process Control. It automatically groups measurements into subgroups, computes quartiles and outliers, and overlays robust Xf-Rf control limits so you can detect shifts in both process location and spread at a glance.

Table of Contents
- Why SPC Box Plot?
- Built for Grafana
- Features
- Use Cases
- Requirements
- Getting Started
- Data Modes
- Panel Options
- Control Lines
- Xf-Rf Control Chart
- Capability Indices
- Dashboard Variables
- Part of the KensoBI SPC Suite
- Getting Help
- License
Why SPC Box Plot?
Control charts and histograms show you one dimension of your process at a time. Box plots show you the entire distribution of each subgroup simultaneously — median, spread, quartiles, and individual outliers — making it easier to spot shifts in both location and variability across time or categories.
When combined with Statistical Process Control:
- Is my process centering stable? — Xf control limits show whether the typical location of each subgroup stays within expected bounds
- Is my process spread stable? — Rf out-of-control flags reveal whether within-subgroup variability is in control
- Where are my outliers? — Individual points beyond the 1.5 × IQR fence are plotted separately so they stand out immediately
- What is my process capability? — Cp, Cpk, Pp, and Ppk are calculated automatically when LSL/USL control lines are added

Built for Grafana
SPC Box Plot is built using Grafana's native visualization components. This means it inherits the look, feel, and behavior you already know:
- Native theming — automatically adapts to light and dark mode
- Standard panel options — legend placement, tooltip behavior, and field overrides work just like any other Grafana panel
- Resizable statistics table — drag the splitter to balance chart and table space, just like Grafana's built-in panels
- Works with any data source — use it with SQL databases, Prometheus, InfluxDB, CSV files, or any other Grafana data source
Features
| Feature | Description |
|---|---|
| Box-and-whisker plots | Q1, Q3, median, whiskers (1.5 × IQR), and individual outlier points per subgroup |
| Mean marker | Optional marker at the subgroup mean, independent color and size |
| Outlier plotting | Data points beyond whisker bounds plotted as individual symbols |
| Three data modes | Auto-detects time series, categorical, or pre-computed input — no configuration needed |
| Xf-Rf SPC | Robust control limits using resistant estimators (Peixoto 1992/2003) |
| Control lines | LCL, UCL, Mean, Min, Max, Range, LSL, USL, Custom, Nominal |
| Fill regions | Color-fill areas between control lines to highlight process zones |
| Statistics table | n, Mean, Std Dev, Min, Max, Q1, Median, Q3, IQR, Cp, Cpk, Pp, Ppk, Xf (when SPC enabled) |
| Resizable layout | Drag the splitter between chart and statistics table |
| Dashboard variables | Control subgroup size across all panels with a subgroupsize dashboard variable |
| Interactive tooltip | Hover to see Q1, Median, Q3, Mean, Min, Max, and control line values |
Use Cases
- Manufacturing quality — compare distributions across shifts, machines, or product variants in the same view
- Process engineering — detect changes in process spread or centering across sequential time periods
- Laboratory testing — analyze batch-to-batch variability with full outlier visibility
- Supply chain — monitor delivery time or fill-rate distributions by supplier, carrier, or route
- Healthcare — track clinical measurement distributions across patient cohorts or time periods
Requirements
- Grafana 11.6.2 or later
Getting Started
- Install the plugin from the Grafana Plugin Catalog.
- Add a new panel to your dashboard and select SPC Box Plot as the visualization type.
- Connect a data source that returns numeric time series data.
- The panel automatically groups consecutive measurements into subgroups (default size: 5) and displays one box per subgroup.
- In the panel editor, go to the SPC section and enable Enable SPC to add Xf-Rf control limits.
- Add an LCL and UCL control line to visualize the process control zone.
- Add LSL and USL control lines to enable capability index calculations (Cp/Cpk/Pp/Ppk) in the statistics table.

Data Modes
The panel automatically detects which input format your data is in. No manual mode selection is needed — the detection order is: pre-computed → categorical → time series.
Time Series Mode
Trigger: Query returns a numeric field with no string field present.
Consecutive measurements are grouped into subgroups of the configured subgroup size. Each complete subgroup becomes one box. Incomplete trailing subgroups (fewer values than the subgroup size) are silently discarded.
Box labels use the timestamp of the first measurement in each subgroup, formatted as YYYY-MM-DD HH:mm. If no time field is present, a 1-based index is used instead.
SPC (Xf-Rf) is only available in this mode.
This is the primary mode for monitoring process stability over time.

Categorical Mode
Trigger: Query returns a string field alongside a numeric field. The panel groups all rows with the same string value into one box.
Each unique category value becomes one box showing the full distribution of all numeric values in that category. Category order follows the order in which unique values are first encountered in the data.
Use this mode to compare distributions across:
- Products, materials, or part numbers
- Machine IDs or production lines
- Operators, shifts, or teams
- Any other discrete grouping dimension

Pre-computed Mode
Trigger: Query returns a string field plus numeric fields named min, q1, median, q3, and max (case-insensitive).
The panel renders the pre-computed statistics directly without recalculating anything. This is useful when your database or query already computes box plot statistics (for example, using SQL percentile_cont functions or a time series aggregation pipeline).
Required fields:
| Field | Required | Description |
|---|---|---|
| String field | Yes | Category label for each row |
min | Yes | Whisker minimum |
q1 | Yes | First quartile |
median | Yes | Median |
q3 | Yes | Third quartile |
max | Yes | Whisker maximum |
mean | No | Mean (estimated as (Q1+Q3)/2 if absent) |
count | No | Sample size shown in the statistics table |
When using pre-computed mode, the statistics table will show approximate values for standard deviation (estimated from IQR as IQR / 1.35, assuming a normal distribution). SPC is not available in this mode.
Panel Options
All SPC Box Plot options are grouped in the panel editor sidebar.
Box Appearance
| Option | Description | Default |
|---|---|---|
| Box color | Fill and border color of the box body | Blue |
| Fill opacity | Transparency of the box fill (0–100%) | 50% |
| Line width | Box border thickness in pixels (1–10) | 1 |
| Box width | Fraction of available space each box occupies (0.1–1.0) | 0.6 |
| Median color | Color of the median line inside the box | Orange |
| Median line width | Thickness of the median line in pixels (1–10) | 2 |

Whiskers
| Option | Description | Default |
|---|---|---|
| Whisker style | Solid or Dashed line style | Solid |
| Whisker line width | Thickness of the whisker lines in pixels (1–10) | 1 |
Whiskers extend from Q1 downward and from Q3 upward to the farthest data point that is still within 1.5 × IQR of the respective quartile:
- Lower whisker: farthest value ≥ Q1 − 1.5 × IQR
- Upper whisker: farthest value ≤ Q3 + 1.5 × IQR
Any values outside these bounds are plotted as individual outlier points (if outlier display is enabled).
Mean Marker
| Option | Description | Default |
|---|---|---|
| Show mean | Display a marker at the subgroup mean | On |
| Mean color | Color of the mean marker | Red |
| Mean size | Diameter of the mean marker in pixels | 5 |
| Mean line width | Border thickness of the mean marker in pixels | 2 |
The mean marker appears as a diamond symbol overlaid on the box, allowing you to see at a glance whether the mean and median are aligned (symmetric distribution) or diverge (skewed distribution).
Outliers
| Option | Description | Default |
|---|---|---|
| Show outliers | Plot individual data points beyond the whisker bounds | On |
| Outlier color | Color of the outlier points | Red |
| Outlier size | Diameter of the outlier points in pixels | 4 |
Outlier points are plotted individually as circles. When multiple outliers have the same value they overlap, so very high-count distributions may show a column of stacked dots at the same position.
SPC (Xf-Rf)
SPC options are only available when the panel is in time series mode. The section is hidden for categorical and pre-computed data.
| Option | Description | Default |
|---|---|---|
| Enable SPC | Calculate and display Xf-Rf control limits | On |
| Subgroup size | Number of consecutive measurements per subgroup (4–15) | 5 |
When SPC is enabled:
- The LCL and UCL calculated control lines become available to add to the chart.
- Boxes whose Rf (range of the middle half) exceeds are flagged as out of control.
- The per-subgroup Xf column (mean of the middle half) appears in the statistics table.
- The sigma estimate is used instead of the sample standard deviation for Cp and Cpk calculations.
See Xf-Rf Control Chart for the full mathematical description.
Statistics Table
| Option | Description | Default |
|---|---|---|
| Show statistics table | Display the resizable statistics table below the chart | On |
| Visible columns | Select which columns appear in the table | All |
The statistics table shows one row per box (subgroup or category). It is sortable by clicking any column header. Drag the splitter between the chart and the table to adjust the vertical split.
Available columns:
| Column | Description |
|---|---|
| n | Sample count (number of values in the subgroup) |
| Mean | Arithmetic mean |
| Std Dev | Sample standard deviation (Bessel's correction, n−1 denominator) |
| Min | Minimum value (lower whisker bound) |
| Max | Maximum value (upper whisker bound) |
| Q1 | First quartile (25th percentile, linear interpolation) |
| Median | Median (50th percentile) |
| Q3 | Third quartile (75th percentile) |
| IQR | Interquartile range (Q3 − Q1) |
| Cp | Short-term potential capability index (requires LSL and USL control lines) |
| Cpk | Short-term centered capability index (requires LSL or USL) |
| Pp | Long-term performance capability index (requires LSL and USL) |
| Ppk | Long-term centered performance capability index (requires LSL or USL) |
| Xf | Per-subgroup mean of the middle half (only shown when SPC is enabled) |

Legend
Standard Grafana legend options are available:
- Display mode: List, Table, or Hidden
- Placement: Bottom or Right
- Values: Min, Max, Mean, and other standard reducers
The legend shows entries for each visible control line and for the box plot series name.
Control Lines
A control line is a horizontal reference line drawn across the entire chart at a specified Y-axis position. Lines can be calculated automatically from the data, manually specified as a fixed value, or pulled dynamically from a field in a data query.

Calculated Control Lines
Calculated lines are derived from the data. They update automatically when the data changes.
| Line | Description | Availability | Default color |
|---|---|---|---|
| LCL | Lower Control Limit (Xf-Rf) | Only when SPC is enabled | Red |
| UCL | Upper Control Limit (Xf-Rf) | Only when SPC is enabled | Red |
| Mean | Grand mean of all values | Always | Dark Blue |
| Min | Global minimum value | Always | Blue |
| Max | Global maximum value | Always | Blue |
| Range | Global max minus global min | Always | Purple |
Each calculated line type can only be added once per panel. When you enable SPC, LCL, UCL, and Mean are not added automatically — you add them explicitly from the control line editor.
Custom Control Lines
Custom lines are set to a fixed value or read from a data series. Multiple lines of the same type can be added.
| Line Type | Description | Default color |
|---|---|---|
| Custom | A general-purpose reference line | Dark Green |
| Nominal | The target or nominal process value | Dark Green |
| LSL | Lower Specification Limit — enables Cp/Cpk/Pp/Ppk calculation | Dark Red |
| USL | Upper Specification Limit — enables Cp/Cpk/Pp/Ppk calculation | Dark Red |
Control Line Appearance
Each control line has the following configurable properties:
| Property | Description |
|---|---|
| Name | Display name shown in the legend and tooltip |
| Position | Y-axis value where the line is drawn (Static mode) |
| Line width | Line thickness in pixels (1–10) |
| Color | Line color — uses Grafana's color picker |
| Fill direction | Below (−1), None (0), or Above (+1) |
| Fill opacity | Opacity of the filled region (0–100%) |
Fill Regions
Setting Fill direction to Above or Below creates a shaded region extending from the line outward. The fill is clipped at the nearest adjacent control line, so placing fill on both LCL (Above) and UCL (Below) creates a shaded band between the two lines.
Common pattern — highlight the in-control zone:
- Add an LCL line, set Fill Direction to Above with a low opacity (e.g., 10%).
- Add a UCL line, set Fill Direction to Below with the same opacity.
The two fills overlap between the lines, producing a visible band marking the acceptable process range.
Xf-Rf Control Chart
The SPC Box Plot implements the Xf-Rf resistant control chart described in:
Peixoto, J. L. (1992). A property of well-formulated polynomial regression models. The American Statistician. Later applied to resistant estimators for Shewhart-type box plot control charts (2003), distributed as technical report COB03-1499.
This chart type is specifically designed for subgroup data where individual observations within each subgroup may contain outliers.
Why Resistant Estimators?
Traditional Xbar-R charts estimate process location with the subgroup mean () and process spread with the subgroup range (R). Both statistics are sensitive to extreme values — a single outlier in a subgroup inflates both the mean and the range, producing control limits that are too wide and may mask genuine process signals.
The Xf-Rf chart replaces these with resistant estimators based on the middle half of each sorted subgroup:
- Xf (mean of the middle half) estimates the subgroup center without being pulled by the most extreme values
- Rf (range of the middle half) estimates the subgroup spread using only the central portion of the data
By discarding the outermost quarter of values on each side before computing each statistic, both estimators become robust. A small number of extreme observations within a subgroup cannot meaningfully bias the resulting control limits. This makes the Xf-Rf chart particularly well suited to box plot panels, where you want to distinguish between within-subgroup outliers (visible as individual dots on the box plot) and between-subgroup shifts in location or spread (visible as Xf control limit violations).
Middle-Half Index f
For a subgroup of size n, the boundary index f is computed as:
This determines which order statistics bound the "middle half". For example:
- n = 5: f = ⌊8/2⌋/2 = 4/2 = 2.0 (integer) → use order statistics X_(2) through X_(4)
- n = 4: f = ⌊7/2⌋/2 = 3/2 = 1.5 (half-integer) → use fractional order statistics at positions 1.5 and 3.5
Xf — Mean of Middle Half
Case 1: f is an integer
Xf = mean of X_(f), X_(f+1), ..., X_(n+1−f) (using 1-based order statistics)
Case 2: f is a half-integer (f = i + ½)
Fractional order statistics are linearly interpolated: