Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -861,7 +861,7 @@ with col_3a:
|
|
| 861 |
|
| 862 |
|
| 863 |
with col_3c:
|
| 864 |
-
st.markdown("<h5>
|
| 865 |
if avg_rate_per_creator.empty:
|
| 866 |
st.warning("No data for reporter analysis by creator_name.")
|
| 867 |
else:
|
|
@@ -930,7 +930,7 @@ with col_3c:
|
|
| 930 |
col_3b, col_3d = st.columns(2)
|
| 931 |
|
| 932 |
with col_3b:
|
| 933 |
-
st.markdown("<h5>
|
| 934 |
if avg_leadtime_nama.empty:
|
| 935 |
st.warning("No data for executor analysis by division.")
|
| 936 |
else:
|
|
@@ -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.
|
| 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.
|
| 1013 |
else:
|
| 1014 |
subset_data = sorted_all_3d.tail(10).sort_values('avg_monthly_leadtime', ascending=False)
|
| 1015 |
|
|
@@ -1126,29 +1126,21 @@ if WORDCLOUD_AVAILABLE:
|
|
| 1126 |
)
|
| 1127 |
st.plotly_chart(fig_pie, use_container_width=True)
|
| 1128 |
|
| 1129 |
-
# ✅ CUSTOM LEGEND:
|
| 1130 |
st.markdown("<div style='text-align: center; font-size: 14px; margin-top: -10px;'>", unsafe_allow_html=True)
|
| 1131 |
legend_items = []
|
| 1132 |
|
| 1133 |
for cat in category_counts.index:
|
| 1134 |
color = color_map.get(cat, '#9E9E9E')
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
)
|
| 1142 |
-
else:
|
| 1143 |
-
# Gunakan lingkaran kecil (default)
|
| 1144 |
-
item = (
|
| 1145 |
-
f"<span style='display: inline-block; width: 12px; height: 12px; background-color: {color}; "
|
| 1146 |
-
f"border-radius: 50%; margin: 0 8px;'></span>"
|
| 1147 |
-
f"{cat}"
|
| 1148 |
-
)
|
| 1149 |
legend_items.append(item)
|
| 1150 |
|
| 1151 |
-
# Gabungkan semua item
|
| 1152 |
legend_html = " | ".join(legend_items)
|
| 1153 |
st.markdown(f"<div>{legend_html}</div>", unsafe_allow_html=True)
|
| 1154 |
st.markdown("</div>", unsafe_allow_html=True)
|
|
@@ -1196,7 +1188,6 @@ if WORDCLOUD_AVAILABLE:
|
|
| 1196 |
|
| 1197 |
else:
|
| 1198 |
st.info("WordCloud library not installed. Install `wordcloud` and `matplotlib` to enable this feature.")
|
| 1199 |
-
|
| 1200 |
# =================== 5. Matrix (Tetap Dipertahankan) ===================
|
| 1201 |
st.markdown("<h3 class='section-title'>OBJECTIVE 5 - Findings vs Lead Time: Which Divisions Move Slow?</h3>", unsafe_allow_html=True)
|
| 1202 |
|
|
|
|
| 861 |
|
| 862 |
|
| 863 |
with col_3c:
|
| 864 |
+
st.markdown("<h5>3b. Average Finding Rate per Reporter (Name)</h5>", unsafe_allow_html=True)
|
| 865 |
if avg_rate_per_creator.empty:
|
| 866 |
st.warning("No data for reporter analysis by creator_name.")
|
| 867 |
else:
|
|
|
|
| 930 |
col_3b, col_3d = st.columns(2)
|
| 931 |
|
| 932 |
with col_3b:
|
| 933 |
+
st.markdown("<h5>3c. Average Lead Time by Division (Executor)</h5>", unsafe_allow_html=True)
|
| 934 |
if avg_leadtime_nama.empty:
|
| 935 |
st.warning("No data for executor analysis by division.")
|
| 936 |
else:
|
|
|
|
| 941 |
|
| 942 |
if sort_option_3b == "Top 10":
|
| 943 |
# Top 10 tercepat (terendah)
|
| 944 |
+
subset_data = sorted_all_3b.tail(10)
|
| 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_3d.tail(10)
|
| 1013 |
else:
|
| 1014 |
subset_data = sorted_all_3d.tail(10).sort_values('avg_monthly_leadtime', ascending=False)
|
| 1015 |
|
|
|
|
| 1126 |
)
|
| 1127 |
st.plotly_chart(fig_pie, use_container_width=True)
|
| 1128 |
|
| 1129 |
+
# ✅ CUSTOM LEGEND: Semua kategori dengan ikon GARIS HORIZONTAL kecil (mirip referensi)
|
| 1130 |
st.markdown("<div style='text-align: center; font-size: 14px; margin-top: -10px;'>", unsafe_allow_html=True)
|
| 1131 |
legend_items = []
|
| 1132 |
|
| 1133 |
for cat in category_counts.index:
|
| 1134 |
color = color_map.get(cat, '#9E9E9E')
|
| 1135 |
+
# Gunakan garis horizontal kecil untuk SEMUA kategori (sesuai referensi)
|
| 1136 |
+
item = (
|
| 1137 |
+
f"<span style='display: inline-block; width: 16px; height: 4px; background-color: {color}; "
|
| 1138 |
+
f"margin: 0 8px; border-radius: 1px;'></span>"
|
| 1139 |
+
f"{cat}"
|
| 1140 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1141 |
legend_items.append(item)
|
| 1142 |
|
| 1143 |
+
# Gabungkan semua item dengan pipa (|) sebagai pemisah
|
| 1144 |
legend_html = " | ".join(legend_items)
|
| 1145 |
st.markdown(f"<div>{legend_html}</div>", unsafe_allow_html=True)
|
| 1146 |
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
|
| 1188 |
|
| 1189 |
else:
|
| 1190 |
st.info("WordCloud library not installed. Install `wordcloud` and `matplotlib` to enable this feature.")
|
|
|
|
| 1191 |
# =================== 5. Matrix (Tetap Dipertahankan) ===================
|
| 1192 |
st.markdown("<h3 class='section-title'>OBJECTIVE 5 - Findings vs Lead Time: Which Divisions Move Slow?</h3>", unsafe_allow_html=True)
|
| 1193 |
|