AI-Powered Chart Generation from Natural Language
detail.loadingPreview
This n8n workflow leverages AI to transform natural language queries and raw data into professional, customizable charts. It seamlessly integrates OpenAI's powerful language models to generate precise Chart.js definitions, which are then converted into shareable image URLs.
About This Workflow
Unlock the power of data visualization without writing a single line of chart code. This advanced n8n workflow acts as an AI agent's 'tool' or a standalone solution, interpreting your data requests in plain English. It intelligently uses OpenAI's GPT-4o with a strict JSON schema to produce accurate Chart.js configurations. From user questions and provided datasets, it generates definitions for various chart types, ensuring data accuracy and visual clarity. The resulting Chart.js JSON is then fed to QuickChart.io, providing an instant image URL for easy sharing or embedding into reports and dashboards.
Key Features
- AI-Powered Chart Generation: Utilizes OpenAI's GPT-4o to interpret natural language requests and data for chart creation.
- Structured Output (JSON Schema): Guarantees valid Chart.js definitions by enforcing a strict JSON schema, ensuring reliable and error-free charts.
- Dynamic Chart Type Support: Capable of generating various chart types including bar, line, radar, pie, doughnut, and more based on input.
- Automated Visualization: Converts Chart.js definitions into shareable image URLs using QuickChart.io.
- Natural Language Interface: Can be triggered by chat messages or user questions, making data visualization accessible to non-technical users.
- Intelligent Data Scaling: Includes system prompts to ensure appropriate data scaling and
beginAtZerofor optimal data visibility.
How To Use
- Configure OpenAI Credentials: Ensure your OpenAI API credentials are set up and linked to the 'OpenAI Chat Model' and 'OpenAI - Generate Chart definition' nodes.
- Define the Chat Trigger: The 'When chat message received' node initiates the workflow. You'll need to pass the user's question and the data to be visualized into subsequent nodes.
- Provide User Request & Data: The 'OpenAI - Generate Chart definition' node takes
user_question(e.g., 'Show me a bar chart of sales per region') andData to visualize(e.g.,[['Region A', 150], ['Region B', 200]]) as inputs. These typically come from preceding nodes that process user input and fetch data. - OpenAI Generates Chart.js JSON: Based on the system prompt and the provided inputs, OpenAI generates a valid Chart.js JSON configuration. This process is strictly governed by the embedded JSON schema to ensure correctness.
- Generate Chart Image URL: The 'Set response' node takes the generated Chart.js JSON and creates a QuickChart.io URL (e.g.,
https://quickchart.io/chart?width=200&c={...}). This URL directly renders the chart image. - Integrate Output: The 'Set Text output' (and potentially 'Set Text + C') nodes prepare the final response, which could include the chart image URL, a text summary, or both, for delivery back to the user or subsequent workflow steps.
Apps Used
Workflow JSON
{
"id": "54223ba0-8b6d-45b1-a1cc-2ac56fc659fe",
"name": "AI-Powered Chart Generation from Natural Language",
"nodes": 9,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 54223ba0-8b6d...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.