# 📊 Data Visualization Recommendation
## 1. Dataset Analysis
The dataset contains **9 rows × 4 columns** tracking monthly sales performance:
- **Month** (categorical, ordinal): Jan–Mar — time dimension
- **Region** (categorical): North, South, East — grouping dimension
- **Revenue** (numeric): Primary performance metric in dollars
- **Units_Sold** (numeric): Secondary volume metric
The structure is a classic **time-series grouped by category**, ideal for comparing trends across regions over time.
---
## 2. Recommended Chart Type
### ✅ Primary: **Multi-Series Line Chart** (Revenue over Month, by Region)
**Justification:** Line charts excel at showing trends over time and make it easy to compare performance trajectories across multiple categories. Since your goal is to show *"which region is performing best over time,"* this is the optimal choice.
**Alternatives:**
- **Grouped Bar Chart** — good for direct month-by-month comparisons but weaker at showing trends.
- **Combo Chart** (Revenue lines + Units bars) — useful if you want to show both metrics together.
---
## 3. Chart.js Configuration (JSON)
```json
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{
"label": "North",
"data": [45000, 48000, 51000],
"borderColor": "rgba(54, 162, 235, 1)",
"backgroundColor": "rgba(54, 162, 235, 0.2)",
"tension": 0.3,
"fill": false,
"pointRadius": 5
},
{
"label": "South",
"data": [38000, 41000, 39000],
"borderColor": "rgba(255, 99, 132, 1)",
"backgroundColor": "rgba(255, 99, 132, 0.2)",
"tension": 0.3,
"fill": false,
"pointRadius": 5
},
{
"label": "East",
"data": [52000, 55000, 58000],
"borderColor": "rgba(75, 192, 192, 1)",
"backgroundColor": "rgba(75, 192, 192, 0.2)",
"tension": 0.3,
"fill": false,
"pointRadius": 5
}
]
},
"options": {
"responsive": true,
"plugins": {
"title": {
"display": true,
"text": "Monthly Revenue by Region (Jan–Mar)",
"font": { "size": 18 }
},
"legend": {
"display": true,
"position": "top"
},
"tooltip": {
"callbacks": {}
}
},
"scales": {
"x": {
"title": { "display": true, "text": "Month" }
},
"y": {
"title": { "display": true, "text": "Revenue (USD)" },
"beginAtZero": false
}
}
}
}
```
---
## 4. Python (matplotlib + seaborn) Equivalent
```python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from io import StringIO
csv_data = """Month,Region,Revenue,Units_Sold
Jan,North,45000,320
Jan,South,38000,280
Jan,East,52000,410
Feb,North,48000,340
Feb,South,41000,295
Feb,East,55000,425
Mar,North,51000,360
Mar,South,39000,285
Mar,East,58000,445"""
df = pd.read_csv(StringIO(csv_data))
# Preserve month order
df['Month'] = pd.Categorical(df['Month'], categories=['Jan', 'Feb', 'Mar'], ordered=True)
sns.set_style("whitegrid")
plt.figure(figsize=(10, 6))
ax = sns.lineplot(
data=df,
x="Month",
y="Revenue",
hue="Region",
marker="o",
linewidth=2.5,
markersize=9
)
plt.title("Monthly Revenue by Region (Jan–Mar)", fontsize=16, fontweight='bold')
plt.xlabel("Month", fontsize=12)
plt.ylabel("Revenue (USD)", fontsize=12)
plt.legend(title="Region", loc="best")
# Format y-axis as currency
ax.yaxis.set_major_formatter(plt.FuncFormatter(lambda x, _: f'${x:,.0f}'))
plt.tight_layout()
plt.show()
```
---
## 5. Key Insights for Viewers
1. 🏆 **East is the top-performing region**, leading every month and growing steadily from $52K → $58K (+11.5%).
2. 📈 **North shows the most consistent growth** — a steady upward trend each month ($45K → $51K, +13.3%), making it the fastest-growing region percentage-wise.
3. ⚠️ **South is underperforming and inconsistent** — revenue dipped in March ($41K → $39K), signaling a potential issue worth investigating (pricing, staffing, or demand shifts).
Generate Charts from CSV Files Using AI Tools
Tested prompts for ai chart generator from csv compared across 5 leading AI models.
BEST BY JUDGE SCORE
Claude Haiku 4.5
8/10
The prompt we tested
You are an expert data visualization assistant. Analyze the CSV data provided and recommend the best chart(s) to visualize it, then generate ready-to-use chart specifications. Follow these rules: Output in clearly labeled sections using markdown headings. Keep the analysis concise (under 100 words), ensure all code is syntactically valid and runnable, and include proper axis labels, titles, and legends. If the CSV has multiple viable chart options, recommend the single best one first and mention alternatives briefly. CSV data and context: Here is my CSV data tracking monthly sales across regions: Month,Region,Revenue,Units_Sold Jan,North,45000,320 Jan,South,38000,280 Jan,East,52000,410 Feb,North,48000,340 Feb,South,41000,295 Feb,East,55000,425 Mar,North,51000,360 Mar,South,39000,285 Mar,East,58000,445 I want to present this to my team to show which region is performing best over time. Provide: (1) a brief analysis of the dataset's structure and key variables, (2) the recommended chart type(s) with justification, (3) a complete Chart.js configuration object in JSON, (4) an equivalent Python matplotlib/seaborn code snippet, and (5) 2-3 insights a viewer should take away from the chart.
Model comparison
| Model | Quality | Cost | Latency | Tokens |
|---|---|---|---|---|
| Claude Opus 4.7 | 8 | $0.1409 | 18.2s | 455 / 1787 |
| Claude Haiku 4.5 | 8 | $0.0072 | 9.5s | 323 / 1376 |
| GPT-5.4 | 8 | $0.0163 | 13.3s | 300 / 1034 |
| Gemini 2.5 Pro | 6 | $0.0052 | 15.2s | 353 / 942 |
| Grok 4.1 Fast Reasoning | 8 | $0.0005 | 8.1s | 449 / 800 |
Outputs
# Data Visualization Analysis & Recommendations
## 1. Dataset Analysis
**Structure:** 9 records across 3 months (Jan-Mar) and 3 regions (North, South, East) with revenue and unit sales metrics.
**Key Variables:**
- **Time dimension:** Month (3 periods)
- **Category dimension:** Region (3 categories)
- **Metrics:** Revenue ($) and Units_Sold (count)
**Pattern:** East region leads in both metrics; North shows growth trajectory; South remains stable but lowest-performing.
---
## 2. Recommended Chart Type
**Primary: Multi-series Line Chart with Grouped Bar Chart alternative**
**Justification:**
- Line charts excel at showing **trends over time** across multiple series (regions)
- Clearly visualizes which region performs best and trajectory changes
- Revenue is the primary KPI; time-series comparison is the main insight need
**Alternative:** Grouped bar chart (easier regional comparison at each month) or small multiples (one line per region).
---
## 3. Chart.js Configuration
```json
{
"type": "line",
"data": {
"labels": ["January", "February", "March"],
"datasets": [
{
"label": "North",
"data": [45000, 48000, 51000],
"borderColor": "#FF6B6B",
"backgroundColor": "rgba(255, 107, 107, 0.1)",
"borderWidth": 2,
"tension": 0.4,
"pointRadius": 5,
"pointBackgroundColor": "#FF6B6B"
},
{
"label": "South",
"data": [38000, 41000, 39000],
"borderColor": "#FFA500",
"backgroundColor": "rgba(255, 165, 0, 0.1)",
"borderWidth": 2,
"tension": 0.4,
"pointRadius": 5,
"pointBackgroundColor": "#FFA500"
},
{
"label": "East",
"data": [52000, 55000, 58000],
"borderColor": "#4ECDC4",
"backgroundColor": "rgba(78, 205, 196, 0.1)",
"borderWidth": 2,
"tension": 0.4,
"pointRadius": 5,
"pointBackgroundColor": "#4ECDC4"
}
]
},
"options": {
"responsive": true,
"plugins": {
"title": {
"display": true,
"text": "Monthly Revenue by Region (Jan - Mar)",
"font": {"size": 16, "weight": "bold"}
},
"legend": {
"display": true,
"position": "top"
}
},
"scales": {
"y": {
"title": {
"display": true,
"text": "Revenue ($)"
},
"beginAtZero": false,
"min": 30000,
"max": 65000
},
"x": {
"title": {
"display": true,
"text": "Month"
}
}
}
}
}
```
---
## 4. Python Matplotlib Code
```python
import pandas as pd
import matplotlib.pyplot as plt
# Create DataFrame
data = {
'Month': ['Jan', 'Jan', 'Jan', 'Feb', 'Feb', 'Feb', 'Mar', 'Mar', 'Mar'],
'Region': ['North', 'South', 'East', 'North', 'South', 'East', 'North', 'South', 'East'],
'Revenue': [45000, 38000, 52000, 48000, 41000, 55000, 51000, 39000, 58000]
}
df = pd.DataFrame(data)
# Pivot for plotting
pivot_df = df.pivot(index='Month', columns='Region', values='Revenue')
# Create line chart
fig, ax = plt.subplots(figsize=(10, 6))
for region in pivot_df.columns:
ax.plot(pivot_df.index, pivot_df[region], marker='o', linewidth=2.5, label=region, markersize=8)
# Formatting
ax.set_title('Monthly Revenue by Region (Jan - Mar)', fontsize=14, fontweight='bold', pad=20)
ax.set_xlabel('Month', fontsize=12, fontweight='bold')
ax.set_ylabel('Revenue ($)', fontsize=12, fontweight='bold')
ax.legend(loc='best', fontsize=11)
ax.grid(True, alpha=0.3, linestyle='--')
ax.yaxis.set_major_formatter(plt.FuncFormatter(lambda x, p: f'${x/1000:.0f}K'))
plt.tight_layout()
plt.show()
```
---
## 5. Key Insights for Your Team
1. **East region dominates:** East consistently outperforms (52K→58K), representing ~30% higher revenue than South despite only 3-month sample.
2. **North shows strongest growth momentum:** North revenue climbs steadily (+6K month-over-month), while South stagnates (+1K, then -2K)—North is on trajectory to match/exceed East if trend continues.
3. **South requires attention:** South remains flat/declining (38K→41K→39K) with no growth trajectory; strategic review needed to unlock this market's potential.
# 1) Brief Analysis
This dataset is tidy and time-based: each row represents one region’s monthly performance with two metrics, **Revenue** and **Units_Sold**. Since the goal is to show **which region performs best over time**, the key comparison is **Revenue by Month across Region**. A **multi-series line chart** is the best fit because it highlights trends and makes regional performance comparisons easy across months. A grouped bar chart is a viable alternative, especially for emphasizing month-by-month differences.
# 2) Recommended Chart Type
## Best Choice: Multi-Series Line Chart
Use a **line chart** with:
- **X-axis:** Month
- **Y-axis:** Revenue
- **Series:** Region
**Why:**
It clearly shows changes over time and makes it easy to compare which region leads each month.
## Alternative
- **Grouped bar chart:** better if you want stronger emphasis on exact monthly comparisons.
- **Second line chart for Units_Sold:** useful as a companion chart if operational volume matters too.
# 3) Chart.js Configuration Object in JSON
```json
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{
"label": "North",
"data": [45000, 48000, 51000],
"borderColor": "#1f77b4",
"backgroundColor": "rgba(31, 119, 180, 0.2)",
"tension": 0.3,
"fill": false
},
{
"label": "South",
"data": [38000, 41000, 39000],
"borderColor": "#ff7f0e",
"backgroundColor": "rgba(255, 127, 14, 0.2)",
"tension": 0.3,
"fill": false
},
{
"label": "East",
"data": [52000, 55000, 58000],
"borderColor": "#2ca02c",
"backgroundColor": "rgba(44, 160, 44, 0.2)",
"tension": 0.3,
"fill": false
}
]
},
"options": {
"responsive": true,
"plugins": {
"title": {
"display": true,
"text": "Monthly Revenue by Region"
},
"legend": {
"display": true,
"position": "top"
},
"tooltip": {
"enabled": true
}
},
"scales": {
"x": {
"title": {
"display": true,
"text": "Month"
}
},
"y": {
"title": {
"display": true,
"text": "Revenue (USD)"
},
"beginAtZero": false
}
}
}
}
```
# 4) Equivalent Python matplotlib/seaborn Code
```python
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Create DataFrame
data = pd.DataFrame({
"Month": ["Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Mar", "Mar", "Mar"],
"Region": ["North", "South", "East", "North", "South", "East", "North", "South", "East"],
"Revenue": [45000, 38000, 52000, 48000, 41000, 55000, 51000, 39000, 58000],
"Units_Sold": [320, 280, 410, 340, 295, 425, 360, 285, 445]
})
# Preserve month order
month_order = ["Jan", "Feb", "Mar"]
data["Month"] = pd.Categorical(data["Month"], categories=month_order, ordered=True)
# Plot
plt.figure(figsize=(8, 5))
sns.lineplot(
data=data,
x="Month",
y="Revenue",
hue="Region",
marker="o",
linewidth=2.5
)
plt.title("Monthly Revenue by Region")
plt.xlabel("Month")
plt.ylabel("Revenue (USD)")
plt.legend(title="Region")
plt.tight_layout()
plt.show()
```
# 5) Key Insights
1. **East is the top-performing region every month**, with revenue rising steadily from **$52k to $58k**.
2. **North shows consistent growth**, increasing from **$45k in January to $51k in March**.
3. **South trails the other regions** and shows less stable performance, with a dip from **$41k in February to $39k in March**.
Of course. Here is a full analysis and the requested chart specifications to visualize your regional sales data.
### Data Analysis
The dataset contains four columns: `Month`, `Region`, `Revenue`, and `Units_Sold`. It tracks a quantitative measure (`Revenue`) across two categorical dimensions: time (`Month`) and location (`Region`). The structure is ideal for time-series analysis, comparing the performance of different segments (regions) over a specific period. The primary goal is to visualize the revenue trend for each region to determine the top performer.
### Recommended Chart
The best visualization is a **multi-series line chart**. This chart is excellent for showing trends over time for multiple categories simultaneously. Each region will be represented by a colored line, making it easy to compare their revenue performance month-over-month and identify which region is consistently leading.
An alternative would be a grouped bar chart, which is good for comparing regions within a single month but less effective at showing the continuous trend over time.
### Chart.js Configuration
```json
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{
"label": "North",
"data": [45000, 48000, 51000],
"borderColor": "rgba(54, 162, 235, 1)",
"backgroundColor": "rgba(54, 162, 235, 0.2)",
"fill": false,
"tension": 0.1
},
{
"label": "South",
"data": [38000, 41000, 39000],
"borderColor": "rgba(255, 99, 132, 1)",
"backgroundColor": "rgba(255, 99, 132, 0.2)",
"fill": false,
"tension": 0.1
},
{
"label": "East",
"data": [52000, 55000, 58000],
"borderColor": "rgba(75, 192, 192, 1)",
"backgroundColor": "rgba(75, 192, 192, 0.2)",
"fill": false,
"tension": 0.1
}
]
},
"options": {
"responsive": true,
"plugins": {
"legend": {
"position": "top"
},
"title": {
"display": true,
"text": "Monthly Revenue by Region"
}
},
"scales": {
"x": {
"title": {
"display": true,
"text": "Month"
}
},
"y": {
"title": {
"display": true,
"text": "Revenue ($)"
}
}
}
}
}
```
### Python Matplotlib/Seaborn Code
```python
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import io
# Load the data from the CSV string
csv_data = """Month,Region,Revenue,Units_Sold
Jan,North,45000,320
Jan,South,38000,280
Jan,East,52000,410
Feb,North,48000,340
Feb,South,41000,295
Feb,East,55000,425
Mar,North,51000,360
Mar,South,39000,285
Mar,East,58000,445
"""
df = pd.read_csv(io.StringIO(csv_data))
# Set the plot style
sns.set_style("whitegrid")
# Create
## Dataset Analysis
Dataset: 9 rows (3 months × 3 regions). Key variables: `Month` (categorical time axis), `Region` (grouping), `Revenue` & `Units_Sold` (numeric performance metrics). Ideal for time-series comparison of regional trends. (28 words)
## Recommended Chart
**Primary: Multi-line chart** (Revenue vs. Month, lines per Region). Justification: Best for trends over time; easy to compare regional performance/growth.
**Alternatives**: Grouped bar chart (static monthly snapshots); dual-axis line (Revenue + Units, but risks clutter).
## Chart.js Configuration
```json
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{
"label": "North",
"data": [45000, 48000, 51000],
"borderColor": "rgb(75, 192, 192)",
"backgroundColor": "rgba(75, 192, 192, 0.2)",
"tension": 0.1,
"fill": false
},
{
"label": "South",
"data": [38000, 41000, 39000],
"borderColor": "rgb(255, 99, 132)",
"backgroundColor": "rgba(255, 99, 132, 0.2)",
"tension": 0.1,
"fill": false
},
{
"label": "East",
"data": [52000, 55000, 58000],
"borderColor": "rgb(54, 162, 235)",
"backgroundColor": "rgba(54, 162, 235, 0.2)",
"tension": 0.1,
"fill": false
}
]
},
"options": {
"responsive": true,
"plugins": {
"legend": { "position": "top" },
"title": { "display": true, "text": "Monthly Revenue by Region" }
},
"scales": {
"x": { "title": { "display": true, "text": "Month" } },
"y": { "title": { "display": true, "text": "Revenue ($)" }, "beginAtZero": true }
}
}
}
```
## Python Code (Matplotlib/Seaborn)
```python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Hardcoded data
data = {
'Month': ['Jan', 'Jan', 'Jan', 'Feb', 'Feb', 'Feb', 'Mar', 'Mar', 'Mar'],
'Region': ['North', 'South', 'East', 'North', 'South', 'East', 'North', 'South', 'East'],
'Revenue': [45000, 38000, 52000, 48000, 41000, 55000, 51000, 39000, 58000]
}
df = pd.DataFrame(data)
plt.figure(figsize=(8, 5))
sns.lineplot(data=df, x='Month', y='Revenue', hue='Region', marker='o')
plt.title('Monthly Revenue by Region')
plt.xlabel('Month')
plt.ylabel('Revenue ($)')
plt.legend(title='Region')
plt.grid(True)
plt.tight_layout()
plt.show()
```
## Key Insights
1. **East dominates**: Highest revenue every month, peaking at $58K in Mar.
2. **North's growth**: Strongest upward trend (+$6K over 3 months), closing gap on East.
3. **South lags**: Lowest performer, with minimal growth and dip in Mar.