{
  "name": "Project: Data Visualizer",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "288d278d-b8ca-4974-aa7b-7c54547c9f11",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e24159da-4cd2-45eb-901e-714206defeff",
              "name": "type",
              "value": "pie",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "5f720cea-0c47-48f3-9227-ebb45e27ed22",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1OXA57yQWNhzSnxLjS75xSTaUlDjGLHcEGYsEBIWNuNc",
          "mode": "list",
          "cachedResultName": "ecommerce_kpi_dataset",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OXA57yQWNhzSnxLjS75xSTaUlDjGLHcEGYsEBIWNuNc/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1759664497,
          "mode": "list",
          "cachedResultName": "ecommerce_kpi_dataset",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OXA57yQWNhzSnxLjS75xSTaUlDjGLHcEGYsEBIWNuNc/edit#gid=1759664497"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        416,
        0
      ],
      "id": "4d2b9836-118d-49f7-b0b4-3fff7e4cbafb",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "o2wjO6VTorTEj5dG",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const rows = items.map(i => i.json);\n\n// Extract 'Month' and 'Revenue ($)'\nconst labels = rows.map(r => r[\"Month\"]);\nconst values = rows.map(r => Number(r[\"Revenue ($)\"]));\n\n// Output for QuickChart\nreturn [\n  {\n    json: {\n      chartData: {\n        type: $('Edit Fields').first().json.type,\n        data: {\n          labels,\n          datasets: [{\n            label: \"Monthly Revenue ($)\",\n            data: values,\n            fill: false,\n            borderWidth: 2,\n            tension: 0.3,\n            pointRadius: 2\n          }]\n        },\n        options: {\n          responsive: true,\n          plugins: { legend: { display: true } },\n          scales: {\n            y: { beginAtZero: false },\n            x: { ticks: { autoSkip: true } }\n          }\n        }\n      }\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        624,
        0
      ],
      "id": "69e096ce-15b6-439a-a94f-770b29b327d5",
      "name": "Code"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://quickchart.io/chart",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "chart",
              "value": "={{ $json.chartData }}"
            },
            {
              "name": "width",
              "value": "1000"
            },
            {
              "name": "height",
              "value": "500"
            },
            {
              "name": "format",
              "value": "png"
            },
            {
              "name": "backgroundColor",
              "value": "white"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        832,
        0
      ],
      "id": "c3d65857-33c7-4f20-a33e-0e41da0b3fab",
      "name": "HTTP Request"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1a454cb0-d1cb-4a0b-94a6-4bb5f7a14f28",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "281c34c03b9c41f054c536eeb966e9e503918cf7f00e3bc32a5ff9cca85ca255"
  },
  "id": "eZB3tSJS2v2UoqyR",
  "tags": []
}