Spaces:
Runtime error
Runtime error
Commit ·
c79b29f
1
Parent(s): af4739d
chart colours
Browse files
app/DocumentGeneration/chart_generator.py
CHANGED
|
@@ -85,8 +85,8 @@ def create_enhanced_chart_style(chart_type, data, title, business_idea):
|
|
| 85 |
# Set modern style
|
| 86 |
plt.style.use('default')
|
| 87 |
|
| 88 |
-
#
|
| 89 |
-
colors = ['#
|
| 90 |
|
| 91 |
if chart_type == "DC": # Doughnut Chart
|
| 92 |
fig, ax = plt.subplots(figsize=(8, 6))
|
|
@@ -107,7 +107,7 @@ def create_enhanced_chart_style(chart_type, data, title, business_idea):
|
|
| 107 |
legend = ax.legend(wedges, labels, title="Categories",
|
| 108 |
loc="center left", bbox_to_anchor=(1, 0, 0.5, 1),
|
| 109 |
fontsize=10, title_fontsize=12)
|
| 110 |
-
legend.get_title().set_color('#
|
| 111 |
|
| 112 |
# Add business name watermark
|
| 113 |
fig.text(0.5, 0.02, f"Generated for: {business_idea}",
|
|
@@ -160,11 +160,11 @@ def create_enhanced_chart_style(chart_type, data, title, business_idea):
|
|
| 160 |
y_values = [item[1] for item in data]
|
| 161 |
|
| 162 |
# Create line chart with enhanced styling
|
| 163 |
-
ax.plot(x_values, y_values, color='#
|
| 164 |
-
markersize=8, markerfacecolor='white', markeredgecolor='#
|
| 165 |
|
| 166 |
# Fill area under line
|
| 167 |
-
ax.fill_between(x_values, y_values, alpha=0.3, color='#
|
| 168 |
|
| 169 |
# Enhanced styling
|
| 170 |
ax.set_title(title, fontsize=16, fontweight='bold', pad=20, color='#374151')
|
|
@@ -227,8 +227,8 @@ def create_chart_from_data(chart_info: Dict[str, Any], business_idea: str) -> by
|
|
| 227 |
labels = [item[0] for item in data]
|
| 228 |
values = [item[1] for item in data]
|
| 229 |
|
| 230 |
-
#
|
| 231 |
-
colors = ['#
|
| 232 |
|
| 233 |
# Create doughnut chart
|
| 234 |
wedges, texts, autotexts = ax.pie(values, labels=labels, colors=colors[:len(values)],
|
|
@@ -249,8 +249,8 @@ def create_chart_from_data(chart_info: Dict[str, Any], business_idea: str) -> by
|
|
| 249 |
labels = [item[0] for item in data]
|
| 250 |
values = [item[1] for item in data]
|
| 251 |
|
| 252 |
-
#
|
| 253 |
-
colors = ['#
|
| 254 |
|
| 255 |
# Create bar chart
|
| 256 |
bars = ax.bar(labels, values, color=colors[:len(values)],
|
|
@@ -282,11 +282,11 @@ def create_chart_from_data(chart_info: Dict[str, Any], business_idea: str) -> by
|
|
| 282 |
y_values = [item[1] for item in data]
|
| 283 |
|
| 284 |
# Create line chart
|
| 285 |
-
ax.plot(x_values, y_values, color='#
|
| 286 |
-
markersize=8, markerfacecolor='white', markeredgecolor='#
|
| 287 |
|
| 288 |
# Fill area under line
|
| 289 |
-
ax.fill_between(x_values, y_values, alpha=0.3, color='#
|
| 290 |
|
| 291 |
ax.set_title(chart_title, fontsize=14, fontweight='bold', pad=15, color='#374151')
|
| 292 |
ax.set_xlabel('Time Period', fontsize=12, color='#6B7280')
|
|
@@ -304,8 +304,8 @@ def create_chart_from_data(chart_info: Dict[str, Any], business_idea: str) -> by
|
|
| 304 |
labels = [item[0] for item in data]
|
| 305 |
values = [item[1] for item in data]
|
| 306 |
|
| 307 |
-
#
|
| 308 |
-
colors = ['#
|
| 309 |
|
| 310 |
# Create pie chart
|
| 311 |
wedges, texts, autotexts = ax.pie(values, labels=labels, colors=colors[:len(values)],
|
|
|
|
| 85 |
# Set modern style
|
| 86 |
plt.style.use('default')
|
| 87 |
|
| 88 |
+
# High contrast color palette for better visibility
|
| 89 |
+
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9']
|
| 90 |
|
| 91 |
if chart_type == "DC": # Doughnut Chart
|
| 92 |
fig, ax = plt.subplots(figsize=(8, 6))
|
|
|
|
| 107 |
legend = ax.legend(wedges, labels, title="Categories",
|
| 108 |
loc="center left", bbox_to_anchor=(1, 0, 0.5, 1),
|
| 109 |
fontsize=10, title_fontsize=12)
|
| 110 |
+
legend.get_title().set_color('#FF6B6B')
|
| 111 |
|
| 112 |
# Add business name watermark
|
| 113 |
fig.text(0.5, 0.02, f"Generated for: {business_idea}",
|
|
|
|
| 160 |
y_values = [item[1] for item in data]
|
| 161 |
|
| 162 |
# Create line chart with enhanced styling
|
| 163 |
+
ax.plot(x_values, y_values, color='#FF6B6B', linewidth=3, marker='o',
|
| 164 |
+
markersize=8, markerfacecolor='white', markeredgecolor='#FF6B6B')
|
| 165 |
|
| 166 |
# Fill area under line
|
| 167 |
+
ax.fill_between(x_values, y_values, alpha=0.3, color='#4ECDC4')
|
| 168 |
|
| 169 |
# Enhanced styling
|
| 170 |
ax.set_title(title, fontsize=16, fontweight='bold', pad=20, color='#374151')
|
|
|
|
| 227 |
labels = [item[0] for item in data]
|
| 228 |
values = [item[1] for item in data]
|
| 229 |
|
| 230 |
+
# High contrast color scheme
|
| 231 |
+
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9']
|
| 232 |
|
| 233 |
# Create doughnut chart
|
| 234 |
wedges, texts, autotexts = ax.pie(values, labels=labels, colors=colors[:len(values)],
|
|
|
|
| 249 |
labels = [item[0] for item in data]
|
| 250 |
values = [item[1] for item in data]
|
| 251 |
|
| 252 |
+
# High contrast color scheme
|
| 253 |
+
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9']
|
| 254 |
|
| 255 |
# Create bar chart
|
| 256 |
bars = ax.bar(labels, values, color=colors[:len(values)],
|
|
|
|
| 282 |
y_values = [item[1] for item in data]
|
| 283 |
|
| 284 |
# Create line chart
|
| 285 |
+
ax.plot(x_values, y_values, color='#FF6B6B', linewidth=3, marker='o',
|
| 286 |
+
markersize=8, markerfacecolor='white', markeredgecolor='#FF6B6B')
|
| 287 |
|
| 288 |
# Fill area under line
|
| 289 |
+
ax.fill_between(x_values, y_values, alpha=0.3, color='#4ECDC4')
|
| 290 |
|
| 291 |
ax.set_title(chart_title, fontsize=14, fontweight='bold', pad=15, color='#374151')
|
| 292 |
ax.set_xlabel('Time Period', fontsize=12, color='#6B7280')
|
|
|
|
| 304 |
labels = [item[0] for item in data]
|
| 305 |
values = [item[1] for item in data]
|
| 306 |
|
| 307 |
+
# High contrast color scheme
|
| 308 |
+
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9']
|
| 309 |
|
| 310 |
# Create pie chart
|
| 311 |
wedges, texts, autotexts = ax.pie(values, labels=labels, colors=colors[:len(values)],
|