U.S. National Public Debt - Chart Generator
Generate chart image, pdf, or SVG of the U.S. National Public Debt from data scraped from the U.S. Treasury website.
The output for the chart is generated by the open source Highcharts export server.
The chart is best viewed in a browser thanks to another project: pubdata.github.io/usnationaldebtchart
This is a Flask app (Python3).
$ cd [your workspace]
$ git clone https://github.com/pubdata/usnationaldebtchartgen.git
$ cd usnationaldebtchartgen
$ virtualenv -p python3 venv
$ source venv/bin/activate
$ pip install -r requirements.txtFurther deploy instructions will vary based on production system requirements.
For testing, use gunicorn:
$ gunicorn usnationaldebtchartgen:appFrom a browser, access the app using: http://localhost:8000/chart
Optionally, you can specify the filename and file extension (.png, .jpg, .pdf, or .svg) to access a specific output format. For images and PDFs, you can also specify the image width (e.g., bob-1200.jpg for a 1200 pixel wide JPEG image with a personalized filename).
- DebtToThePenny.com/chart (Default, serves chart.png, 600x400.)
- DebtToThePenny.com/chart/chart-800.png (Serves 800 pixel wide image.)
- DebtToThePenny.com/chart/chart.jpg (Serves a JPEG image.)
- DebtToThePenny.com/chart/chart.pdf (Serves a PDF document.)
- DebtToThePenny.com/chart/chart.svg (Serves an SVG+XML.)
- DebtToThePenny.com/chart/Bob.jpg (Serves a JPEG image with the personalized filename Bob.jpg.)
MIT