Control charts are really useful tools to help you understand how 'in control your process is' so you can help make process changes based on evidence, rather than bullshit.
You can read the docs about the library and control charts here.
To install the latest release from (PyPI)[http://pypi.python.org/pypi/spcchart]
$ pip install spcchartTo install the latest development version from (GitHub)[https://github.com/bwghughes/spc]
$ pip install git+git://github.com/bwghughes/spc.gitpip install spcchartand run:
spcchart --data=32,45,65,667,767,78,887,879,99,98,98,98 --title="I can see now"and hip hip hooray, an svg will be placed in your current working directory. Open with any browser and you're away.
>>> from spcchart import SpcChart
>>> data = [1,2,3,4,5,6,7,8,9,8,7,6,5,5,5,4,4,3,3,2,2,2,3,4,5,5,5]
>>> c = SpcChart(data, title="Flow Ho")
>>> c.render_to_file() # Creates SVG file>>> from spcchart.plotly_chart import PlotlySpcChart
>>> data = [1,2,3,4,5,6,7,8,9,8,7,6,5,5,5,4,4,3,3,2,2,2,3,4,5,5,5]
>>> chart = PlotlySpcChart(data, title="Interactive Chart")
>>> chart.render_to_file() # Creates interactive HTML file
>>> # or get HTML string
>>> html = chart.render_to_html()Run the Flask web application for a browser-based interface:
python app.pyThen open http://localhost:5000 in your browser to:
- Enter data points
- Select chart type
- Generate interactive charts
- View statistics and violations
This project uses uv for package management and pytest for testing.
- Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh- Create a virtual environment and install dependencies:
uv venv
uv pip install -e ".[dev]"- Run tests:
uv run pytest- Run tests with coverage:
uv run pytest --cov=spcchart --cov-report=htmlAll tests are located in the tests/ directory. To run specific test files:
uv run pytest tests/test_spc.py
uv run pytest tests/test_spcchart.py -v- ✅ No numpy dependency - Uses pure Python stdlib (statistics, math)
- ✅ Interactive charts - Plotly-based web charts with zooming, panning, and export
- ✅ Web interface - Flask app for browser-based chart generation
- ✅ Multiple chart types - X-mR, X-bar R, p, c, and more
- ✅ Violation detection - Automatic detection of out-of-control points
- ✅ Modern testing - Comprehensive pytest test suite (41 tests)
- ✅ Package management - Uses uv for fast, reliable dependency management
- Add themes to charts
- Add more chart types (EWMA, CUSUM improvements)
- Add export to PDF
- Add multi-chart dashboards

