Lee este artículo en español.
How to create charts in n8n from your data
You have the numbers in n8n (this week's sales, leads per channel, open tickets) and you want to send them as a chart to Slack, by email or to Telegram. A chart is understood at a glance; a table of numbers is not.
n8n has no node for drawing charts. What it does have is the HTTP Request node, and with it you call the Cofferdock API, which takes your labels and values and returns the chart image, ready for the next step.
What you'll get
You send something like this:
- Some labels:
Monday,Tuesday,Wednesday… - One or more series of numbers: the sales for each day.
And you get back a PNG (or an SVG) with the chart. There are five types: bar (bar), line (line), pie (pie), doughnut (doughnut) and radar (radar).
What you need
- A Cofferdock account. The free plan gives you 50 credits a month, no card needed.
- Your API key, which you create in the dashboard with "+ Create key".
- An HTTP Request node in your workflow.
Step 1: gather the data into lists
If your data arrives row by row (from Google Sheets or a database, for example), the chart needs all the labels together and all the values together. That's what the Aggregate node is for:
- Aggregate:
Individual Fields. - Add the field with the labels (for example
day) and the field with the numbers (for examplesales).
The output is a single item with two lists: day and sales. That's exactly what the chart needs.
Step 2: the HTTP Request node
Add an HTTP Request node after it and fill it in like this:
- Method:
POST - URL:
https://api.cofferdock.com/chart - Send Headers: turn it on and add
x-api-keywith your key. - Send Body: turn it on → Body Content Type:
JSON→ Specify Body:Using JSON. - In Options → Response → Response Format choose File.
Paste this into the body:
{
"type": "bar",
"title": "Sales this week",
"labels": {{ JSON.stringify($json.day) }},
"series": [
{ "name": "Sales", "data": {{ JSON.stringify($json.sales) }} }
],
"width": 800,
"height": 500,
"output": "binary"
}
The two {{ JSON.stringify(...) }} expressions insert the lists coming from the Aggregate node. The output: "binary" field makes the response the image itself, without base64.
Step 3: send it wherever you want
The node's output is a PNG file. Connect it to:
- Slack, with the operation that uploads a file to a channel.
- Gmail, as an attachment to a weekly report.
- Telegram, with "Send Photo".
- Google Drive, to keep a history.
A complete example
A sales report that arrives on its own every Monday:
- Schedule Trigger: every Monday at 9:00.
- Google Sheets: reads last week's sales.
- Aggregate: gathers days and sales into two lists.
- HTTP Request: creates the bar chart.
- Slack: uploads it to the team channel with a short message.
Nobody has to open the spreadsheet to know how the week went.
Options you can change
| Option | Values | What it does |
|---|---|---|
type | bar, line, pie, doughnut, radar | Chart type. |
labels | List of texts (1 to 50) | What goes on the axis or on each slice. |
series | List of 1 to 10 series | Each series is { "name", "data" }. Pie and doughnut use only one. |
title | Text | Title above the chart. |
width / height | 200 to 2000 | Size in pixels. |
format | png or svg | Image format. |
To compare two things (for example, this year and last year), add a second series with its own name and numbers. Each series gets its own colour.
How much does it cost?
Each chart uses 1 credit. The same balance works for every other Cofferdock tool: HTML to image, PDFs, website screenshots, QR codes…
FAQ
Does n8n have a chart node? No. You do it with the HTTP Request node calling the Cofferdock API.
Do I need to know how to code? No. You copy the JSON above and change the names of your fields.
I get an error saying the data doesn't match. Each series needs as many numbers as there are labels. Check that the Aggregate node isn't leaving empty rows.
Can I get a link instead of the file? Yes. Change output to "url" and remove Response Format: File. You'll get a link that lasts 15 minutes.
Try it
You'll find every option on the chart tool page and in the API reference. If you don't have an account yet, create one for free and build your first report today.