s880453 commited on
Commit
fed829f
·
verified ·
1 Parent(s): 920dd49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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
-         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
  # =========================================
 
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
  # =========================================