SHELLAPANDIANGANHUNGING commited on
Commit
4b7bc59
·
verified ·
1 Parent(s): a64a117

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -941,7 +941,7 @@ with col_3b:
941
 
942
  if sort_option_3b == "Top 10":
943
  # Top 10 tercepat (terendah)
944
- subset_data = sorted_all_3b.head(10).sort_values('avg_monthly_leadtime', ascending=True)
945
  else:
946
  # Bottom 10 = terlama (tertinggi)
947
  subset_data = sorted_all_3b.tail(10).sort_values('avg_monthly_leadtime', ascending=False) # descending dalam subset
@@ -1009,7 +1009,7 @@ with col_3d:
1009
  sorted_all_3d = avg_leadtime_per_executor.sort_values('avg_monthly_leadtime', ascending=True).reset_index(drop=True)
1010
 
1011
  if sort_option_3d == "Top 10":
1012
- subset_data = sorted_all_3d.tail(10).sort_values('avg_monthly_leadtime', ascending=True)
1013
  else:
1014
  subset_data = sorted_all_3d.tail(10).sort_values('avg_monthly_leadtime', ascending=False)
1015
 
@@ -1091,7 +1091,7 @@ if WORDCLOUD_AVAILABLE:
1091
  # 2 Kolom
1092
  col1, col2 = st.columns(2)
1093
 
1094
- # === PIE CHART: Semua temuan_kategori (Dengan Custom Text untuk Unsafe Action & Near Miss) ===
1095
  with col1:
1096
  st.markdown(create_consistent_title("Distribution of All Issue Categories"), unsafe_allow_html=True)
1097
 
@@ -1115,21 +1115,18 @@ if WORDCLOUD_AVAILABLE:
1115
  color_discrete_sequence=colors
1116
  )
1117
 
1118
- # ⚙️ Custom text template: untuk Unsafe Action & Near Miss, ganti label jadi "— value"
1119
- labels = []
1120
  for cat in category_counts.index:
1121
- val = category_counts[cat]
1122
  if cat in ['Unsafe Action', 'Near Miss']:
1123
- # Gunakan simbol garis + angka
1124
- labels.append(f"— {val}")
1125
  else:
1126
- # Tetap pakai nama kategori
1127
- labels.append(cat)
1128
 
1129
  fig_pie.update_traces(
1130
- textposition='inside',
1131
- textinfo='percent+text', # Gunakan text yang sudah dikustom
1132
- text=labels, # Teks custom
1133
  marker=dict(line=dict(color='#FFFFFF', width=1))
1134
  )
1135
  fig_pie.update_layout(
 
941
 
942
  if sort_option_3b == "Top 10":
943
  # Top 10 tercepat (terendah)
944
+ subset_data = sorted_all_3b.head(10).sort_values('avg_monthly_leadtime', ascending=False)
945
  else:
946
  # Bottom 10 = terlama (tertinggi)
947
  subset_data = sorted_all_3b.tail(10).sort_values('avg_monthly_leadtime', ascending=False) # descending dalam subset
 
1009
  sorted_all_3d = avg_leadtime_per_executor.sort_values('avg_monthly_leadtime', ascending=True).reset_index(drop=True)
1010
 
1011
  if sort_option_3d == "Top 10":
1012
+ subset_data = sorted_all_3b.head(10).sort_values('avg_monthly_leadtime', ascending=False)
1013
  else:
1014
  subset_data = sorted_all_3d.tail(10).sort_values('avg_monthly_leadtime', ascending=False)
1015
 
 
1091
  # 2 Kolom
1092
  col1, col2 = st.columns(2)
1093
 
1094
+ # === PIE CHART: Semua temuan_kategori (Dengan Custom Text Position untuk Unsafe Action & Near Miss) ===
1095
  with col1:
1096
  st.markdown(create_consistent_title("Distribution of All Issue Categories"), unsafe_allow_html=True)
1097
 
 
1115
  color_discrete_sequence=colors
1116
  )
1117
 
1118
+ # ⚙️ Custom: tarik keluar slice untuk Unsafe Action & Near Miss
1119
+ pull_values = []
1120
  for cat in category_counts.index:
 
1121
  if cat in ['Unsafe Action', 'Near Miss']:
1122
+ pull_values.append(0.1) # Tarik keluar sedikit
 
1123
  else:
1124
+ pull_values.append(0.0)
 
1125
 
1126
  fig_pie.update_traces(
1127
+ textposition='outside', # Label di luar slice
1128
+ textinfo='percent+label', # Tampilkan persentase + nama
1129
+ pull=pull_values, # Tarik slice keluar untuk Unsafe Action & Near Miss
1130
  marker=dict(line=dict(color='#FFFFFF', width=1))
1131
  )
1132
  fig_pie.update_layout(