Chart
Render a Chart.js image via GET. Pass the full chart object as URL-encoded JSON in query. Prefer format png for ChatGPT. POST sends the same object as a JSON body, not query.
Credit cost: 5 credits per call
Parâmetros de consulta
Full chart config as URL-encoded JSON. Pass ?version= or ?v= separately to pin the chart version.
Bar chart (copy & paste as ?query=):
{"type":"bar","title":"Monthly Sales","legend":"bottom","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"2025","data":[42,58,37,65,49,72],"backgroundColor":"rgba(99,102,241,0.85)"},{"label":"2026","data":[51,67,44,71,58,85],"backgroundColor":"rgba(249,115,22,0.85)"}]},"scales":{"y":{"beginAtZero":true}}}
Line chart (dual Y-axis):
{"type":"line","title":"Revenue vs Conversion","legend":"top","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"Revenue (€)","data":[12000,18500,15200,21800,9300,17400],"borderColor":"#6366f1","tension":0.4,"fill":false,"yAxisID":"y"},{"label":"Conversion (%)","data":[3.2,4.1,2.8,5.0,1.9,3.7],"borderColor":"#f97316","tension":0.4,"fill":false,"yAxisID":"y2"}]},"scales":{"y":{"position":"left"},"y2":{"position":"right","grid":{"display":false}}}}
Stacked area chart:
{"type":"area","title":"API Usage by Brand","legend":"top","width":1200,"height":600,"device_pixel_ratio":1,"data":{"labels":["Jan","Feb","Mar","Apr","May","Jun"],"datasets":[{"label":"CaptureKit","data":[12400,18900,14300,21500,9800,16200],"borderColor":"#6366f1","backgroundColor":"rgba(99,102,241,0.35)","tension":0.4,"stack":"total"},{"label":"ChartQuery","data":[3200,6900,11500,8300,14700,9800],"borderColor":"#22c55e","backgroundColor":"rgba(34,197,94,0.35)","tension":0.4,"stack":"total"}]},"scales":{"y":{"stacked":true,"beginAtZero":true}}}
Doughnut chart:
{"type":"doughnut","title":"Traffic Sources","legend":"right","width":800,"height":500,"device_pixel_ratio":1,"data":{"labels":["Organic","Paid","Direct","Referral","Social"],"datasets":[{"data":[38,24,18,12,8],"backgroundColor":["#6366f1","#f97316","#22c55e","#ef4444","#eab308"],"borderWidth":2,"borderColor":"#ffffff"}]}}
Radar chart:
{"type":"radar","title":"Performance v1 vs v2","legend":"top","width":800,"height":700,"device_pixel_ratio":1,"data":{"labels":["Speed","Reliability","Security","UX","Scalability"],"datasets":[{"label":"v1","data":[65,70,80,60,75],"borderColor":"#6366f1","backgroundColor":"rgba(99,102,241,0.25)"},{"label":"v2","data":[88,92,90,85,95],"borderColor":"#f97316","backgroundColor":"rgba(249,115,22,0.25)"}]}}
SVG output (add "format":"svg" to any example above for infinitely scalable output).
Chart.js version to use. Alias: ?v=. Only v4.x is supported. Defaults to the installed version (4.5.1). Example: "4", "4.5", "4.5.1". The installed version is always returned in the X-ChartJS-Version response header.
"4.5.1"Chart.js type. Required. Example: bar, line, pie. This is not a diagram type.
"area"Value in
- "area"
- "bar"
- "bubble"
- "doughnut"
- "pie"
- "line"
- "mixed"
- "polarArea"
- "radar"
- "scatter"
Chart.js data. Required. Must include datasets (array of {label, data}). Optional labels.
Chart title.
Chart subtitle.
Legend position, or false to hide.
"top"Value in
- "top"
- "bottom"
- "left"
- "right"
- "chartArea"
- "false"
Chart.js scales keyed by axis id (y, y2, x, …).
Raw Chart.js options. Merged on top of defaults.
Output width in pixels, 50-4000.
Output height in pixels, 50-4000.
Use png so ChatGPT can display the image. svg is for download or infinite scale.
"png"Value in
- "png"
- "svg"
Background color.
Device pixel ratio, 0.5-4.
Corpo da resposta
application/json
application/json
curl -X GET "https://example.com/v1/chart?query=string&type=area&labels=string&datasets=%5Bobject+Object%5D"{ "error": "Bad Request"}{ "error": "Internal Error"}