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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1753,13 +1753,13 @@ def create_plot(df, chart_type, x_column, y_column, group_column=None, size_colu
1753
  if chart_type in ["圓餅圖", "環形圖", "漏斗圖", "樹狀圖"]: fig.update_layout(xaxis_title=None, yaxis_title=None)
1754
  elif chart_type == "水平長條圖": fig.update_layout(xaxis_title=final_y_label, yaxis_title=x_column)
1755
  elif chart_type == "直方圖": fig.update_layout(xaxis_title=x_column, yaxis_title='計數')
1756
- elif chart_type == "甘特圖": fig.update_layout(xaxis_title="時間", yaxis_title=task_col_gantt) # 使用任務列作為 Y 軸標籤
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
 
 
1753
  if chart_type in ["圓餅圖", "環形圖", "漏斗圖", "樹狀圖"]: fig.update_layout(xaxis_title=None, yaxis_title=None)
1754
  elif chart_type == "水平長條圖": fig.update_layout(xaxis_title=final_y_label, yaxis_title=x_column)
1755
  elif chart_type == "直方圖": fig.update_layout(xaxis_title=x_column, yaxis_title='計數')
1756
+ elif chart_type == "甘特圖": fig.update_layout(xaxis_title="時間", yaxis_title=x_column) # 使用 x_column 作為任務軸標籤
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