# Quarterly Revenue Analysis
**Recommended Chart Type:** Line chart — ideal for showing trends over sequential time periods and making dips/rebounds visually obvious.
```json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "2023 Quarterly Revenue Trend",
"description": "Quarterly revenue for 2023 with Q3 dip highlighted",
"data": {
"values": [
{"Quarter": "Q1", "Revenue": 1.2, "Highlight": "Normal"},
{"Quarter": "Q2", "Revenue": 1.5, "Highlight": "Normal"},
{"Quarter": "Q3", "Revenue": 1.1, "Highlight": "Dip"},
{"Quarter": "Q4", "Revenue": 1.8, "Highlight": "Normal"}
]
},
"width": 500,
"height": 320,
"layer": [
{
"mark": {"type": "line", "point": false, "strokeWidth": 3, "color": "#4C78A8"},
"encoding": {
"x": {"field": "Quarter", "type": "ordinal", "title": "Quarter (2023)"},
"y": {"field": "Revenue", "type": "quantitative", "title": "Revenue (USD Millions)"}
}
},
{
"mark": {"type": "point", "filled": true, "size": 150},
"encoding": {
"x": {"field": "Quarter", "type": "ordinal"},
"y": {"field": "Revenue", "type": "quantitative"},
"color": {
"field": "Highlight",
"type": "nominal",
"scale": {"domain": ["Normal", "Dip"], "range": ["#4C78A8", "#E45756"]},
"legend": {"title": "Status"}
},
"size": {
"field": "Highlight",
"type": "nominal",
"scale": {"domain": ["Normal", "Dip"], "range": [150, 300]},
"legend": null
}
}
},
{
"mark": {"type": "text", "dy": -15, "fontSize": 12, "fontWeight": "bold"},
"encoding": {
"x": {"field": "Quarter", "type": "ordinal"},
"y": {"field": "Revenue", "type": "quantitative"},
"text": {"field": "Revenue", "type": "quantitative", "format": "$.2f"}
}
},
{
"mark": {"type": "text", "dy": 25, "fontSize": 11, "fontStyle": "italic", "color": "#E45756"},
"transform": [{"filter": "datum.Highlight == 'Dip'"}],
"encoding": {
"x": {"field": "Quarter", "type": "ordinal"},
"y": {"field": "Revenue", "type": "quantitative"},
"text": {"value": "Q3 Dip"}
}
}
]
}
```
**CSV Data:**
```csv
Quarter,Revenue,Highlight
Q1,1.2,Normal
Q2,1.5,Normal
Q3,1.1,Dip
Q4,1.8,Normal
```
**Chart Labels:**
- **Title:** 2023 Quarterly Revenue Trend
- **X-Axis:** Quarter (2023)
- **Y-Axis:** Revenue (USD Millions)
Convert Natural Language Prompts into Charts
Tested prompts for natural language to chart ai compared across 5 leading AI models.
You have data and you need a chart, but you do not want to wrestle with spreadsheet menus or write visualization code. Natural language to chart AI tools let you describe what you want in plain English and get a working chart back in seconds. Type something like 'show monthly revenue by region as a grouped bar chart' and the AI interprets your intent, picks the right chart type, and structures the output accordingly.
This approach solves a specific bottleneck: the gap between having numbers and communicating them visually. It matters most when you are not a data analyst, when you are moving fast, or when you need to iterate on chart design without touching code. Instead of learning Chart.js syntax or fighting with Excel pivot charts, you describe the result and let the model do the translation work.
The page below shows a tested prompt, four model outputs side by side, and a comparison table so you can see exactly which AI handles natural language chart requests most accurately. If you want to know which tool to use and how to phrase your prompt for the best result, you are in the right place.
When to use this
This approach fits best when you need a chart quickly from structured data and the chart type is one of the common categories: bar, line, pie, scatter, or area. It also works well for iterating on chart design through follow-up prompts, replacing a chart type mid-conversation, or generating chart configs for developers to drop into a codebase.
- You have a CSV or pasted dataset and need a visualization without opening a BI tool
- You want to prototype a dashboard chart before handing specs to a developer
- You are writing a report and need a chart config or image generated from inline data
- You need to switch chart types quickly based on stakeholder feedback without rework
- You are a non-technical user who needs to explain data in a presentation today
When this format breaks down
- Your dataset has more than a few hundred rows pasted inline -- most LLMs will truncate or misread large data blocks and produce inaccurate charts
- You need interactive, filterable charts with drill-down behavior; natural language prompts produce static configs or images, not full dashboard applications
- Your chart requires strict brand compliance with exact hex colors, custom fonts, and pixel-perfect layout -- AI output will need significant manual cleanup
- The data relationships are highly complex, such as multi-axis statistical charts or geospatial maps, where model interpretation errors compound into misleading visuals
The prompt we tested
You are a data visualization assistant that converts natural language descriptions of data into chart specifications. Follow these rules: Analyze the input to identify the data points, categories, and relationships, then recommend the single best chart type (bar, line, pie, scatter, area, or stacked bar) with a one-sentence justification. Return a complete Vega-Lite JSON specification inside a ```json code block that is ready to render, followed by a ready-to-paste CSV data block, and a suggested chart title plus axis labels. User's data description: I want to visualize our quarterly revenue for 2023: Q1 was $1.2M, Q2 was $1.5M, Q3 dipped to $1.1M, and Q4 rebounded to $1.8M. I'd like to clearly show the trend across the year and highlight the Q3 dip. Produce the chart specification now.
Model comparison
| Model | Quality | Cost | Latency | Tokens |
|---|---|---|---|---|
| Claude Opus 4.7 | 8 | $0.0943 | 13.7s | 290 / 1199 |
| Claude Haiku 4.5 | 6 | $0.0028 | 3.7s | 211 / 510 |
| GPT-5.4 | 8 | $0.0127 | 8.9s | 190 / 813 |
| Gemini 2.5 Pro | 6 | $0.0021 | 13.8s | 192 / 365 |
| Grok 4.1 Fast Reasoning | 8 | $0.0003 | 6.8s | 340 / 464 |
Outputs
# Chart Recommendation
**Chart Type: Line Chart with Point Markers**
**Justification:** A line chart effectively shows temporal trends across quarters while point markers highlight individual values, making the Q3 dip visually prominent and easy to compare.
```json
{
"$schema": "https://vega-lite.v5.json",
"description": "Quarterly Revenue Trend for 2023",
"data": {
"values": [
{"Quarter": "Q1", "Revenue": 1.2},
{"Quarter": "Q2", "Revenue": 1.5},
{"Quarter": "Q3", "Revenue": 1.1},
{"Quarter": "Q4", "Revenue": 1.8}
]
},
"mark": {"type": "line", "point": true, "strokeWidth": 3, "pointSize": 150},
"encoding": {
"x": {
"field": "Quarter",
"type": "ordinal",
"axis": {"labelFontSize": 12, "title": "Quarter"}
},
"y": {
"field": "Revenue",
"type": "quantitative",
"axis": {"labelFontSize": 12, "title": "Revenue (Millions USD)"},
"scale": {"domain": [0, 2]}
},
"color": {
"field": "Revenue",
"type": "quantitative",
"scale": {"scheme": "reds"},
"legend": false
},
"tooltip": [
{"field": "Quarter", "type": "ordinal"},
{"field": "Revenue", "type": "quantitative", "format": "$,.1f"}
]
}
}
```
# CSV Data
```csv
Quarter,Revenue
Q1,1.2
Q2,1.5
Q3,1.1
Q4,1.8
```
# Chart Title & Labels
- **Title:** 2023 Quarterly Revenue Trend
- **X-Axis:** Quarter
- **Y-Axis:** Revenue (Millions USD)
A **line chart** is the best choice because it most clearly shows the quarter-to-quarter revenue trend over time and makes the Q3 dip easy to spot.
```json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Quarterly revenue for 2023 with the Q3 dip highlighted.",
"title": "Quarterly Revenue Trend for 2023",
"data": {
"values": [
{"Quarter": "Q1", "Revenue_Millions": 1.2, "Highlight": "Normal"},
{"Quarter": "Q2", "Revenue_Millions": 1.5, "Highlight": "Normal"},
{"Quarter": "Q3", "Revenue_Millions": 1.1, "Highlight": "Dip"},
{"Quarter": "Q4", "Revenue_Millions": 1.8, "Highlight": "Normal"}
]
},
"layer": [
{
"mark": {
"type": "line",
"point": false,
"strokeWidth": 3,
"color": "#4C78A8"
},
"encoding": {
"x": {
"field": "Quarter",
"type": "ordinal",
"sort": ["Q1", "Q2", "Q3", "Q4"],
"title": "Quarter"
},
"y": {
"field": "Revenue_Millions",
"type": "quantitative",
"title": "Revenue ($M)"
}
}
},
{
"mark": {
"type": "point",
"filled": true,
"size": 100
},
"encoding": {
"x": {
"field": "Quarter",
"type": "ordinal",
"sort": ["Q1", "Q2", "Q3", "Q4"]
},
"y": {
"field": "Revenue_Millions",
"type": "quantitative"
},
"color": {
"field": "Highlight",
"type": "nominal",
"scale": {
"domain": ["Normal", "Dip"],
"range": ["#4C78A8", "#E45756"]
},
"legend": null
},
"tooltip": [
{"field": "Quarter", "type": "ordinal"},
{"field": "Revenue_Millions", "type": "quantitative", "title": "Revenue ($M)"}
]
}
},
{
"transform": [
{"filter": "datum.Quarter === 'Q3'"}
],
"mark": {
"type": "text",
"dy": -15,
"fontSize": 12,
"fontWeight": "bold",
"color": "#E45756"
},
"encoding": {
"x": {
"field": "Quarter",
"type": "ordinal",
"sort": ["Q1", "Q2", "Q3", "Q4"]
},
"y": {
"field": "Revenue_Millions",
"type": "quantitative"
},
"text": {
"value": "Q3 dip"
}
}
}
],
"width": 500,
"height": 300
}
```
```csv
Quarter,Revenue_Millions,Highlight
Q1,1.2,Normal
Q2,1.5,Normal
Q3,1.1,Dip
Q4,1.8,Normal
```
**Suggested chart title:** Quarterly Revenue Trend for 2023
**X-axis label:** Quarter
**Y-axis label:** Revenue ($M)
A line chart is the best choice because it effectively illustrates the trend of revenue over the sequential time periods (quarters), making the Q3 dip and subsequent rebound easy to see.
```json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A line chart showing quarterly revenue for 2023.",
"data": {
"name": "dataset"
},
"width": "container",
"height": 300,
"mark": {
"type": "line",
"point": true,
"tooltip": true
},
"encoding": {
"x": {
"field": "Quarter",
"type": "ordinal",
"title": "2023 Quarter",
"sort": ["Q1", "Q2", "Q3", "Q4"]
},
"y": {
"field": "Revenue",
"type": "quantitative",
"title": "Revenue (in millions)",
"axis": {
"format": "$.2s"
}
}
}
}
```
```csv
Quarter,Revenue
Q1,1200000
Q2,1500000
Q3,1100000
Q4,1800000
```
**Title:** 2023 Quarterly Revenue Trend
**X-Axis Label:** 2023 Quarter
**Y-Axis Label:** Revenue (in millions)
**Recommended chart type: line**
A line chart is ideal for showing revenue trends over sequential quarters, naturally highlighting the dip in Q3 while emphasizing the overall rebound.
```json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 500,
"height": 300,
"title": "2023 Quarterly Revenue Trend ($M)",
"data": {
"values": [
{"quarter": "Q1", "revenue": 1.2},
{"quarter": "Q2", "revenue": 1.5},
{"quarter": "Q3", "revenue": 1.1},
{"quarter": "Q4", "revenue": 1.8}
]
},
"layer": [
{
"mark": {"type": "line", "point": true, "interpolate": "linear", "strokeWidth": 3},
"encoding": {
"x": {"field": "quarter", "type": "ordinal", "title": "Quarter", "axis": {"labelAngle": -45}},
"y": {"field": "revenue", "type": "quantitative", "title": "Revenue ($M)", "scale": {"domain": [1.0, 2.0]}}
}
},
{
"data": {"values": [{"quarter": "Q3", "revenue": 1.1}]},
"mark": {"type": "point", "size": 200, "fill": "#d62728", "stroke": "#d62728", "strokeWidth": 3, "opacity": 0.7},
"encoding": {
"x": {"field": "quarter", "type": "ordinal"},
"y": {"field": "revenue", "type": "quantitative"}
}
}
]
}
```
```csv
quarter,revenue
Q1,1.2
Q2,1.5
Q3,1.1
Q4,1.8
```
**Suggested title:** 2023 Quarterly Revenue Trend ($M)
**X-axis label:** Quarter
**Y-axis label:** Revenue ($M)
What makes these work
-
01Specify chart type explicitly
If you do not name the chart type, the AI will pick one based on data shape and that choice is often too generic. Say 'grouped bar chart' or 'area chart with stacked series' rather than 'show me a chart of this.' The more specific you are about the visual format, the closer the first output lands to what you actually need.
-
02Include axis and label instructions
Models frequently omit axis titles or use raw field names as labels unless you tell them otherwise. Add a line like 'label the x-axis Month and y-axis Revenue in USD' and specify whether you want data labels on bars or points. This single addition eliminates most follow-up correction prompts.
-
03State your output format
Natural language to chart AI can return a rendered image, a Chart.js config, a Vega-Lite spec, Python matplotlib code, or an SVG depending on the tool and how you ask. Tell the model which format you need upfront. If you are embedding in a web app, ask for a JSON config. If you are adding to a slide, ask for a PNG.
-
04Iterate with follow-up prompts
The first output rarely needs to be final. After getting an initial chart, follow up with specific changes: 'change the color to blue, remove the legend, and add a title.' Treating the interaction as a conversation rather than a one-shot request produces much better results than trying to pack every detail into one long prompt.
More example scenarios
Here is my data: Jan 120, Feb 145, Mar 98, Apr 210, May 230, Jun 195. Create a line chart showing monthly signups with a trend line. Label the axes. Title it 'New Signups by Month H1 2024'.
A line chart config with months on the x-axis, signup counts on the y-axis, a data series plotted across six points, a linear trend line overlay, and the specified title. Axis labels read 'Month' and 'New Signups'. Output formatted as Chart.js JSON ready to paste into a project.
I have Q1 sales by category: Electronics 84000, Apparel 52000, Home Goods 61000, Sports 39000, Beauty 47000. Show this as a horizontal bar chart sorted from highest to lowest. Use a clean, minimal style.
A horizontal bar chart with categories sorted descending from Electronics to Sports, values displayed at bar ends, no gridlines on the y-axis, and a muted single-color palette. Delivered as a rendered image and as a Vega-Lite spec for embedding.
Headcount data: Engineering 45, Sales 30, Marketing 18, Support 22, Finance 10, Operations 15. I need a pie chart showing each department's share of total headcount. Include percentage labels on each slice.
A pie chart with six labeled slices showing department names and calculated percentages. Engineering reads 31.3%, Sales 20.8%, and so on. Percentage labels are positioned inside each slice where space allows, with a legend listing all departments.
I need a simple Gantt-style bar chart for three projects. Project A runs March to May, Project B runs April to July, Project C runs June to August. Show them stacked on a timeline with month labels on the x-axis.
A horizontal stacked bar chart with three rows, one per project, and months from March through August on the x-axis. Each bar starts and ends at the correct month boundaries. Color-coded by project with a legend. Exported as a PNG suitable for a slide deck.
Compare conversion rates across channels: Email 4.2%, Paid Search 2.8%, Organic 1.9%, Social 3.1%, Referral 5.6%. Make a grouped bar chart comparing conversion rate by channel. Highlight the highest-performing channel.
A vertical bar chart with five channels on the x-axis and conversion rate percentage on the y-axis. The Referral bar is rendered in a distinct accent color to highlight it as the top performer. A dashed reference line marks the average conversion rate across all channels.
Common mistakes to avoid
-
Pasting unstructured data
Dumping a block of unformatted text and asking for a chart causes the model to guess at data boundaries and relationships. Structure your data as a simple table, comma-separated values, or a clear list before including it in the prompt. Garbage input produces garbage chart configs.
-
Skipping the chart type
Letting the AI choose the chart type without guidance often results in a bar chart when you needed a line chart, or a pie chart when the data has too many categories to read. You know the story you want to tell with the data, so name the chart type explicitly every time.
-
Not validating the output numbers
AI-generated charts can silently mis-assign values to the wrong categories, especially when data labels are ambiguous or column names are short. Always cross-check two or three data points in the chart output against your source data before using the chart in any external communication.
-
Expecting live data connections
Natural language to chart AI works on data you paste or describe in the prompt. It does not connect to live databases, Google Sheets, or APIs unless the tool explicitly supports integrations. If you paste stale data, you get a chart of stale data with no warning.
-
Ignoring output format until the end
Asking for a chart and only then asking for it in a specific format often forces the model to regenerate the entire output. Specify the format in the original prompt to save time and avoid inconsistencies between the visual design and the code representation.
Related queries
Frequently asked questions
Which AI model is best for converting natural language to charts?
GPT-4o and Claude 3.5 Sonnet both handle natural language chart prompts well, with strong accuracy on common chart types and clean output formatting. GPT-4o has an edge for rendering actual images directly in the chat interface, while Claude produces cleaner structured configs for developers. The comparison table on this page shows side-by-side output quality for the same prompt across four models.
Can I describe a chart in plain English and get usable code back?
Yes. Most capable LLMs will return Chart.js JSON, Vega-Lite specs, or Python matplotlib and seaborn code from a plain English description. The key is to specify the output format in your prompt, for example 'return this as a Chart.js config object.' Without that instruction, the model may return a description of the chart instead of executable code.
How do I turn a spreadsheet into a chart using AI?
Copy the relevant rows and columns from your spreadsheet and paste them directly into your prompt, then describe the chart you want. Keep the data small enough to fit in the context window, typically under 50 rows for clean results. If your dataset is large, paste a summary or aggregated version rather than raw row-level data.
What chart types can AI generate from a text prompt?
Standard types work reliably: bar, grouped bar, stacked bar, line, area, pie, donut, scatter, and bubble charts. More complex types like heatmaps, treemaps, waterfall charts, and Gantt charts are supported by the best models but require more precise prompting. Highly specialized statistical charts like violin plots or box plots work best when you also specify the library or framework you want the code in.
Is natural language to chart AI accurate enough for business use?
For internal use, presentations, and prototyping, the accuracy is high enough to be useful with a quick validation pass. For external reports or published data, always verify that values map correctly to the right chart elements before sharing. Accuracy drops when data labels are ambiguous or when the dataset has more than 20 to 30 rows pasted inline.
Can I use AI to change a chart type without re-entering all my data?
Yes, and this is one of the strongest use cases for conversational chart AI. After generating an initial chart, you can follow up with 'change this to a line chart' or 'convert to a stacked area chart' and the model will reuse the data from the prior turn. This makes iterating on chart design significantly faster than traditional tools.