Update app.py
Browse files
app.py
CHANGED
|
@@ -1757,14 +1757,14 @@ def create_plot(df, chart_type, x_column, y_column, group_column=None, size_colu
|
|
| 1757 |
else: fig.update_layout(xaxis_title=x_column, yaxis_title=final_y_label)
|
| 1758 |
|
| 1759 |
except ValueError as ve:
|
| 1760 |
-
|
| 1761 |
-
|
| 1762 |
except Exception as e:
|
| 1763 |
-
|
| 1764 |
-
|
| 1765 |
|
| 1766 |
-
|
| 1767 |
-
|
| 1768 |
|
| 1769 |
|
| 1770 |
# =========================================
|
|
|
|
| 1757 |
else: fig.update_layout(xaxis_title=x_column, yaxis_title=final_y_label)
|
| 1758 |
|
| 1759 |
except ValueError as ve:
|
| 1760 |
+
print(f"圖表創建錯誤 (ValueError): {ve}", file=sys.stderr); traceback.print_exc(file=sys.stderr)
|
| 1761 |
+
fig = go.Figure(); fig.add_annotation(text=f"⚠️ 創建圖表時出錯:<br>{ve}", align='left', showarrow=False, font=dict(size=14, color="red")); fig.update_layout(xaxis_visible=False, yaxis_visible=False)
|
| 1762 |
except Exception as e:
|
| 1763 |
+
error_message = f"❌ 創建圖表時發生未預期錯誤:\n{traceback.format_exc()}"; print(error_message, file=sys.stderr)
|
| 1764 |
+
fig = go.Figure(); user_error_msg = f"⚠️ 創建圖表時發生內部錯誤。<br>請檢查數據和設置。<br>詳細錯誤: {str(e)[:100]}..."; fig.add_annotation(text=user_error_msg, align='left', showarrow=False, font=dict(size=14, color="red")); fig.update_layout(xaxis_visible=False, yaxis_visible=False)
|
| 1765 |
|
| 1766 |
+
print("create_plot 函數執行完畢。", file=sys.stderr) # 調試信息
|
| 1767 |
+
return fig
|
| 1768 |
|
| 1769 |
|
| 1770 |
# =========================================
|