Struggling with QuickChart Generation

Describe the problem/error/question

Hi everyone,
I have been struggling for many days trying to get QuickChart to work with complex multi-axis charts. I have an AI Agent that translates human language into chart instructions, which gets passed to a code node to generate a chart json format Chart.js. This is then passed on to an HTTP node to call quickchart API to generate the image url.
This works for many simple charts of all types, i.e. Bar, Line, Scatter, etc. But when the agent decides to create a multi-axis chart for a complex analysis, the generated url breaks on all browsers, and I get an error.
I have been working with ChatGPT for a week now trying to troubleshoot this annoying issue, and I am now running in circles. If anyone can get this particular chart (attached workflow) to work in a way that also supports simple charts, I will be grateful for life.

What is the error message (if any)?

On browsers I get the error: Chart error: TypeError: Cannot read properties of undefined (reading ā€˜options’)

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n 1.99.1 Cloud
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Is this the result you were looking for?

1 Like

Oh man! That is EXACTLY what I, and ChatGPT have been struggling to get right for a week :slight_smile:
What were ā€œweā€ doing wrong?

I set up the HTTP node exactly as you did, with no changes to my code node (I am assuming you didn’t change that code), and I got a weird binary output from the HTTP node with an error. Check screenshot

Im not sure, I asked Cursor IDE to fix it :sweat_smile:

TL;DR: It seems you messed up the data points and the way the chart was configured.
PS, Claude is much better at coding in my opinion and this is the model I used in Cursor. Try using Claude next time you’re trying to produce some chart config, it might do a better job (https://claude.ai/new).

For the error you received it said this:

Main Issues Fixed:

  1. Removed the wrapper chart object: Chart.js expects the configuration object directly, not wrapped in a chart property.

  2. Added explicit yAxisID to the first dataset: Both datasets should specify which axis they belong to for clarity.

  3. Added type: ā€˜linear’ to both y-axes: This is required for proper dual-axis functionality in Chart.js v3+.

  4. Added position: ā€˜left’ to the primary y-axis: Makes the configuration explicit.

  5. Added grid: { drawOnChartArea: false } to the secondary axis: This prevents grid lines from overlapping, making the chart cleaner.

Key improvements for dual-axis charts:

  • Clear axis association: Each dataset is explicitly tied to its axis

  • Proper axis positioning: Left and right axes are clearly defined

  • Clean grid display: Only the primary axis shows grid lines

  • Explicit axis types: Both axes are defined as linear scales

The configuration now follows the Chart.js line chart documentation standards and should render your dual-axis line chart correctly!

Then that produced a blank chart meaning there was some issue with the actual data points so it fixed it and said this:

Common causes of blank charts:

  1. Missing display: true - I’ve added this explicitly to all scales

  2. Invalid color formats - I’ve changed to proper RGB format

  3. Missing x-axis configuration - Added explicit x-axis setup

  4. Complex dual-axis setup - Simplified to single axis first

Key changes made:

  • :white_check_mark: Proper color formats: rgb(75, 192, 192) instead of ā€œblueā€

  • :white_check_mark: Added display: true to all scales

  • :white_check_mark: Added x-axis configuration

  • :white_check_mark: Simplified to single Y-axis initially

  • :white_check_mark: Added backgroundColor for better visibility

It then provided me with a duel axis example I hace not tried but here it is:

return {
  chart: {
    type: "line",
    data: {
      labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
      datasets: [
        { 
          label: "Count", 
          data: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120], 
          borderColor: "rgb(75, 192, 192)",
          backgroundColor: "rgba(75, 192, 192, 0.2)",
          fill: false,
          yAxisID: "y"
        },
        { 
          label: "Severity", 
          data: [100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210], 
          borderColor: "rgb(255, 99, 132)",
          backgroundColor: "rgba(255, 99, 132, 0.2)",
          fill: false, 
          yAxisID: "y1" 
        }
      ]
    },
    options: {
      responsive: true,
      interaction: {
        mode: 'index',
        intersect: false,
      },
      plugins: { 
        title: { 
          display: true, 
          text: "Test Dual-Axis" 
        },
        legend: { 
          display: true 
        } 
      },
      scales: {
        x: {
          display: true,
          title: {
            display: true,
            text: 'Month'
          }
        },
        y: { 
          type: 'linear',
          display: true,
          position: 'left',
          beginAtZero: true,
          title: { 
            display: true, 
            text: "Count" 
          }
        },
        y1: { 
          type: 'linear',
          display: true,
          position: 'right',
          beginAtZero: true,
          title: { 
            display: true, 
            text: "Severity" 
          },
          grid: {
            drawOnChartArea: false
          }
        }
      }
    }
  }
};

Share your workflow again here in a code block lemme see. It’s working on my side.
image

What version of n8n are you using?