Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -615,39 +615,24 @@ avg_ratio_per_location = avg_ratio_per_location.dropna(subset=['avg_monthly_rati
|
|
| 615 |
if avg_ratio_per_location.empty:
|
| 616 |
st.write("Data kosong.")
|
| 617 |
else:
|
| 618 |
-
# Treemap dengan gradasi warna
|
| 619 |
fig_treemap = px.treemap(
|
| 620 |
avg_ratio_per_location,
|
| 621 |
-
path=['nama_lokasi_full'],
|
| 622 |
-
values='avg_monthly_ratio',
|
| 623 |
title='Avg Monthly Finding by Location',
|
| 624 |
labels={
|
| 625 |
'avg_monthly_ratio': 'Avg Monthly Finding/Person Ratio',
|
| 626 |
'nama_lokasi_full': 'Location'
|
| 627 |
},
|
| 628 |
-
color='avg_monthly_ratio',
|
| 629 |
color_continuous_scale=[
|
| 630 |
-
[0.0, '#D32F2F'], # Merah
|
| 631 |
-
[0.5, '#FFB300'], # Kuning
|
| 632 |
-
[1.0, '#4CAF50'] # Hijau
|
| 633 |
]
|
| 634 |
)
|
| 635 |
|
| 636 |
-
# Set ukuran font label menjadi 12
|
| 637 |
-
fig_treemap.update_layout(
|
| 638 |
-
title_font_size=14,
|
| 639 |
-
font=dict(size=12), # Semua font default = 12
|
| 640 |
-
coloraxis_colorbar=dict(
|
| 641 |
-
title_font=dict(size=12),
|
| 642 |
-
tickfont=dict(size=12)
|
| 643 |
-
)
|
| 644 |
-
)
|
| 645 |
-
|
| 646 |
-
# Label teks dalam treemap juga diset ke 12
|
| 647 |
-
fig_treemap.update_traces(
|
| 648 |
-
textfont=dict(size=12)
|
| 649 |
-
)
|
| 650 |
-
|
| 651 |
st.plotly_chart(fig_treemap, use_container_width=True)
|
| 652 |
|
| 653 |
# Format hover
|
|
@@ -1965,7 +1950,7 @@ if not df_category.empty:
|
|
| 1965 |
# title=dict(text="<b>Issue Category Trend vs Frequency (Non-Positive)</b>", x=0.5, y=0.95),
|
| 1966 |
xaxis=dict(
|
| 1967 |
title="Category",
|
| 1968 |
-
tickangle=
|
| 1969 |
showgrid=True,
|
| 1970 |
gridcolor="#e0e0e0",
|
| 1971 |
gridwidth=1,
|
|
|
|
| 615 |
if avg_ratio_per_location.empty:
|
| 616 |
st.write("Data kosong.")
|
| 617 |
else:
|
| 618 |
+
# Treemap dengan gradasi warna merah → kuning → hijau
|
| 619 |
fig_treemap = px.treemap(
|
| 620 |
avg_ratio_per_location,
|
| 621 |
+
path=['nama_lokasi_full'], # Hierarki (single level)
|
| 622 |
+
values='avg_monthly_ratio', # Ukuran area
|
| 623 |
title='Avg Monthly Finding by Location',
|
| 624 |
labels={
|
| 625 |
'avg_monthly_ratio': 'Avg Monthly Finding/Person Ratio',
|
| 626 |
'nama_lokasi_full': 'Location'
|
| 627 |
},
|
| 628 |
+
color='avg_monthly_ratio', # Warna berdasarkan nilai rasio
|
| 629 |
color_continuous_scale=[
|
| 630 |
+
[0.0, '#D32F2F'], # Merah (rendah)
|
| 631 |
+
[0.5, '#FFB300'], # Kuning (sedang)
|
| 632 |
+
[1.0, '#4CAF50'] # Hijau (tinggi)
|
| 633 |
]
|
| 634 |
)
|
| 635 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
st.plotly_chart(fig_treemap, use_container_width=True)
|
| 637 |
|
| 638 |
# Format hover
|
|
|
|
| 1950 |
# title=dict(text="<b>Issue Category Trend vs Frequency (Non-Positive)</b>", x=0.5, y=0.95),
|
| 1951 |
xaxis=dict(
|
| 1952 |
title="Category",
|
| 1953 |
+
tickangle=45,
|
| 1954 |
showgrid=True,
|
| 1955 |
gridcolor="#e0e0e0",
|
| 1956 |
gridwidth=1,
|