Español

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:

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

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:

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:

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:

A complete example

A sales report that arrives on its own every Monday:

  1. Schedule Trigger: every Monday at 9:00.
  2. Google Sheets: reads last week's sales.
  3. Aggregate: gathers days and sales into two lists.
  4. HTTP Request: creates the bar chart.
  5. 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

OptionValuesWhat it does
typebar, line, pie, doughnut, radarChart type.
labelsList of texts (1 to 50)What goes on the axis or on each slice.
seriesList of 1 to 10 seriesEach series is { "name", "data" }. Pie and doughnut use only one.
titleTextTitle above the chart.
width / height200 to 2000Size in pixels.
formatpng or svgImage 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.