Converter tool

SPC Control Chart Maker

Draw I-MR, X-bar R, X-bar S, p, np, c and u control charts from a CSV or XLSX. Limits come from the standard constants, Western Electric and Nelson rules mark out-of-control points, and Cp, Cpk, Pp and Ppk appear when you give specification limits.

Step 1

Choose the chart and load your data

Or paste the table

SPC Control Chart Maker

Operator: Abdulla Al Fahad. How tools are built and checked

A control chart answers one question: is this process behaving the way it usually does, or has something changed? It plots a measurement over time between two lines, the control limits, that are calculated from the process's own variation. A point outside them, or a suspicious pattern inside them, is a signal that something other than ordinary noise is acting. This tool draws the seven standard charts from a CSV or XLSX, marks the points that break your chosen rules and, when you supply specification limits, reports how capable the process is of meeting them.

The limits are not the specification limits, and that is the idea people most often get wrong. Control limits describe what the process does; specification limits describe what the customer wants. A process can sit perfectly in control and still produce scrap, and a process that meets specification today can be drifting. Showing both on one page, the chart and the Cp and Cpk numbers, is the point of putting them together here.

Key features

  • Seven charts: I-MR, X-bar and R, X-bar and S, p, np, c and u
  • Limits from d2, d3, c4 and the A2, A3, B3, B4, D3, D4 constants for subgroup sizes 2 to 25 (S charts to 100)
  • Pick any of the four Western Electric rules and the eight Nelson rules, with presets
  • Phase I: calculate the limits from the first N points, then judge the rest against them
  • Variable subgroup and sample sizes with stepped limits
  • Limit width adjustable from 1 to 6 sigma, 3 by default
  • Cp, Cpu, Cpl, Cpk, Pp, Ppu, Ppl, Ppk, observed and expected ppm from LSL and USL
  • Charts drawn as accessible SVG with violations ringed, centre and limit values labelled
  • Export points, limits, rule violations, capability and the constants table to CSV or XLSX

Chart types, constants and the rules that mark a point out of control

For measurements you have three layouts. A long file has a subgroup column (batch, shift, hour) and a measurement column, with one row per reading; subgroups are formed in order of first appearance. A fixed-size layout takes consecutive rows in groups of n, for files that have no subgroup column. A wide layout has one row per subgroup and one column per member, for exports that already look like a worksheet. For the individuals chart you need only one measurement column. An optional label column names the points on the x-axis.

For counts, the p chart takes defective units and a sample size per row, the np chart the same, the c chart takes defects per inspection unit when every unit is the same size, and the u chart takes defects and the number of units inspected so the area of opportunity can vary. Sample sizes can be a column or a single constant. Counts must be whole numbers, defectives cannot exceed the sample size and there must be at least three points; up to 5,000 points are charted.

Subgroup sizes may differ. Limits then step with each subgroup's size, using a pooled sigma estimate (the average of R over d2, or S over c4, across the subgroups that set the limits). Range charts support subgroups of 2 to 25 because the constants are tabulated that far; the S chart accepts up to 100. A subgroup with a single value cannot give a range or standard deviation and is left out with a warning.

The constants come from the sampling distribution of the range and the standard deviation, not from a lookup that stops at ten. d2 and d3 for n of 2 to 25 were computed by numerical integration and agree with published SPC tables, for example d2 of 1.128, 1.693, 2.059 and 2.326 for n from 2 to 5 and 3.931 for n of 25; c4 is exact from the gamma function. A2, A3, B3, B4, D3 and D4 follow from them for any limit width, and the full table for n from 2 to 25 can be opened under the results and downloaded.

How it works

Individuals chart: the centre line is the mean of the points that set the limits, sigma is the average moving range divided by d2 of 2 (1.128), and the limits are the mean plus or minus 3 sigma, which is the familiar 2.66 times the average moving range. The moving-range chart has centre MR-bar, upper limit D4 times MR-bar with D4 of 3.267 and no lower limit. X-bar and R: sigma is the average of R over d2, the X-bar limits are the grand mean plus or minus 3 sigma over the square root of n (equal to A2 times R-bar), and the R chart has centre d2 times sigma with limits at plus or minus 3 d3 sigma, floored at zero. X-bar and S uses c4 the same way, with S-chart limits at c4 sigma plus or minus 3 sigma times the square root of 1 minus c4 squared.

Attribute charts use the binomial and Poisson models. The p chart's centre is total defectives over total inspected, with limits at p-bar plus or minus 3 times the square root of p-bar (1 minus p-bar) over n, each clipped to the 0 to 1 range. The np chart is n times that. The c chart uses c-bar plus or minus 3 root c-bar, and the u chart u-bar plus or minus 3 root (u-bar over n). A lower limit that would be negative is not drawn.

The rules work on distance from the centre line in sigma units, using each point's own sigma so stepped limits are handled. Nelson 1 and Western Electric 1 are a point beyond the limits. Nelson 2 is 9 in a row on one side, Nelson 3 six in a row rising or falling, Nelson 4 fourteen alternating, Nelson 5 and Western Electric 2 two of three beyond 2 sigma on the same side, Nelson 6 and Western Electric 3 four of five beyond 1 sigma on the same side, Nelson 7 fifteen within 1 sigma and Nelson 8 eight beyond 1 sigma on either side. Western Electric 4 is 8 in a row on one side. A pattern is marked at the point that completes it, and range, S and moving-range charts use only the beyond-limits rule.

Capability uses all observations, not only phase I. Cp is (USL minus LSL) over 6 sigma with sigma estimated within subgroups (R-bar over d2, S-bar over c4, or the moving range); Cpk is the smaller of (USL minus mean) and (mean minus LSL) over 3 sigma. Pp and Ppk are the same ratios with the overall sample standard deviation, so Pp below Cp signals shifts between subgroups. Expected ppm uses the normal distribution with the mean and the chosen sigma.

Common use cases

  • Monitoring fill weight, bore diameter or torque by subgroup on a packaging or machining line
  • Charting daily defect counts from incoming inspection on a p chart and spotting the bad day
  • Plotting a single daily measurement (turnaround time, yield, temperature) on an I-MR chart where subgroups do not exist
  • Quoting a Cpk for a supplier audit using a specification range and a sample of measurements

How to use this tool

  1. Pick the chart type and load the file (or Load example), then tell the tool which column holds the measurements, subgroups or counts.
  2. Set the limit width (3 sigma unless you have a reason) and, if the first part of the data was a stable baseline, enter how many points set the limits.
  3. Choose the rules. Start with beyond-limits, then try Western Electric 1 to 4 to see which extra signals appear.
  4. For variables charts add LSL, USL or both to get the capability figures.
  5. Read the violations table, check the chart, then download the points, limits and capability as CSV or XLSX.

Example

12 batches of 5 fill weights (g); limits from the first 8 batches; spec 499 to 501 g

batch,fill_g
1,500.2
1,499.8
1,500.5
1,499.6
1,500.1
... (60 rows, batch 9 averages 501.66)

X-bar and R chart, Western Electric 1 to 4

Grand mean 500.035, R-bar 0.800, n = 5 (d2 2.326, A2 0.577)
Sigma = 0.800 / 2.326 = 0.344
X-bar limits 499.574 to 500.496; R chart UCL 1.692 (D4 2.114), no LCL
Batch 9: mean 501.66 is beyond the upper limit (rule WE1); R chart in control
Capability, all 60 values: mean 500.17, sigma within 0.340, overall 0.535
Cp 0.98, Cpk 0.81, Pp 0.62, Ppk 0.52; 5 of 60 above USL = 83,333 ppm observed

Tips for best results

  • Calculate the limits from a period you know was stable, then plot new data against them. Limits recalculated on every update will absorb a shift instead of showing it.
  • Check the range or S chart first. If the spread is out of control, the X-bar limits depend on a sigma that is not stable and the mean chart is hard to trust.
  • Use I-MR only when you cannot form rational subgroups. X-bar charts detect small shifts much sooner because averaging reduces the noise by the square root of n.
  • Add rules gradually. Each extra rule increases false alarms: with all eight Nelson rules active on a stable process, a flag every few dozen points is expected, not a crisis.
  • Compare Cpk with Ppk. When Cpk is healthy but Ppk is much lower, the process is capable within a batch yet moves between batches, and the chart will show the drift.

Common pitfalls

Control limits are not specification limits. Never draw the specification on the chart and call points outside it out of control; that is a capability question, answered by Cp and Cpk.

Capability indices assume a stable, roughly normal process. If the chart shows violations, Cpk predicts nothing, and heavily skewed data (times, particle counts) makes the normal ppm figures unreliable.

Normal-theory limits on small counts are approximate. With fewer than about 5 expected defectives per sample on a p chart, or an average below 5 on a c chart, the tool warns that the lower limit is missing or unreliable.

Autocorrelated data, such as readings every second from one sensor, produces limits that are too tight, because the moving range is smaller than the true variation.

Phase I with too few points gives shaky limits. Twenty to twenty-five subgroups is the usual guidance; the tool accepts fewer but cannot make the limits reliable.

Common errors and how to fix them

"Subgroup ... has N values. Range charts support subgroups up to 25"
Switch to the X-bar and S chart, which accepts up to 100 values per subgroup.
"The moving range is zero, so the limits collapse"
Every value, or every neighbouring pair, is identical, usually because the data was rounded to a coarse scale. Use more precision or a different chart.

Best practices

  • Re-baseline the limits only after a deliberate process change has been confirmed, and keep the old limits in the file you export.
  • Report Cpk together with the number of observations behind it; an index from 25 readings has a wide margin of uncertainty.

Reading the worked example

In the fill-weight example, the first eight batches give a grand mean of 500.035 g and an average range of 0.80 g. With subgroups of five the sigma estimate is 0.344 g, which makes the X-bar limits 499.574 and 500.496. Batch 9, which averages 501.66 g, sits more than three standard errors above the centre and is ringed in red. The R chart for the same batch stays inside its limit of 1.692, so the spread did not change while the average did: the process shifted rather than became noisier, which points to a setting change rather than a worn part.

The capability figures tell the second half of the story. Cp of 0.98 says the spread within batches only just fits the 2 g specification band; Cpk of 0.81 says it is not centred, because the mean of 500.17 sits closer to the upper limit of 501. Ppk of 0.52 is lower again because batch 9 inflates the overall standard deviation to 0.535. Five of the 60 values, all from batch 9, exceed 501, which is 83,333 ppm observed against 74,837 ppm expected from the normal fit on overall sigma.

Frequently asked questions

Why 3 sigma limits?

Walter Shewhart's choice balances false alarms against missed signals: for a normal process about 0.27 percent of points fall outside by chance. You can change the width from 1 to 6 sigma, but the Western Electric and Nelson zone rules are written for 3.

How many points do I need to set limits?

Textbooks recommend 20 to 25 subgroups for the baseline. The tool will calculate limits from as few as 2 subgroups (3 points for an individuals or attribute chart), but limits from a handful of points should be treated as provisional.

What is the difference between Cpk and Ppk?

Cpk uses the short-term, within-subgroup sigma and shows what the process could do if it were centred and stable. Ppk uses the standard deviation of all the data, so it also counts shifts and drifts between subgroups. Ppk at or below Cpk is normal; a big gap means instability.

Can I have different subgroup sizes?

Yes. The limits step with each subgroup's size, calculated from a pooled sigma. A subgroup with one value is dropped, and range charts stop at n of 25.