Generate chart and graph images
Generate chart images with one API call using Chart.js configuration, embeddable anywhere.
import requests
import json
import urllib.parse
chart_config = {
"type": "bar",
"data": {
"labels": ["Q1", "Q2", "Q3", "Q4"],
"datasets": [{
"label": "Users",
"data": [50, 60, 70, 180]
}]
}
}
encoded_config = urllib.parse.quote(json.dumps(chart_config))
url = f"https://quickchart.io/chart?c={encoded_config}"
response = requests.get(url)
# Save the image
# with open("chart.png", "wb") as f:
# f.write(response.content)
print(f"Chart image URL: {url}")Last 50 checks (10 min intervals)