SHELLAPANDIANGANHUNGING commited on
Commit
48b7846
·
verified ·
1 Parent(s): 24e3e81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -1476,7 +1476,10 @@ else:
1476
  showarrow=False,
1477
  font_size=16
1478
  )
1479
- fig.update_layout(height=350, title=dict(text=title, x=0.4, xanchor='center'))
 
 
 
1480
  return fig
1481
 
1482
  data_sorted = data.sort_values('weekly_avg', ascending=False)
@@ -1508,10 +1511,7 @@ else:
1508
  bar_trace = go.Bar(
1509
  x=data_sorted[col_operator].astype(str),
1510
  y=data_sorted["weekly_avg"],
1511
- marker=dict(
1512
- color=colors,
1513
- line=dict(width=2, color="rgba(0,0,0,0.2)")
1514
- ),
1515
  text=[f"{v:.1f}" for v in data_sorted["weekly_avg"]],
1516
  textposition="outside",
1517
  hovertemplate=(
@@ -1527,7 +1527,7 @@ else:
1527
 
1528
  fig = go.Figure(bar_trace)
1529
  fig.update_layout(
1530
- title=dict(text=f"<b>{title}</b>", x=0.5),
1531
  height=450,
1532
  margin=dict(l=50, r=20, t=60, b=120),
1533
  xaxis_title="<b>Operator Name</b>",
@@ -1548,15 +1548,17 @@ else:
1548
  # ===============================================================
1549
  col1, col2 = st.columns(2)
1550
  with col1:
1551
- # Center-align chart
1552
- st.markdown("<div style='display: flex; justify-content: center;'>", unsafe_allow_html=True)
1553
- st.plotly_chart(plot_chart(top_ob, "OB HAULER Operator Hazard Profile"), use_container_width=False, config={'displayModeBar': False})
1554
- st.markdown("</div>", unsafe_allow_html=True)
 
1555
  with col2:
1556
- # Center-align chart
1557
- st.markdown("<div style='display: flex; justify-content: center;'>", unsafe_allow_html=True)
1558
- st.plotly_chart(plot_chart(top_coal, "COAL HAULING Operator Hazard Profile"), use_container_width=False, config={'displayModeBar': False})
1559
- st.markdown("</div>", unsafe_allow_html=True)
 
1560
  # ===============================================================
1561
  # AI INSIGHTS — DIPERBAIKI: Risk Summary jadi 1 box + 3 list
1562
  # ===============================================================
 
1476
  showarrow=False,
1477
  font_size=16
1478
  )
1479
+ fig.update_layout(
1480
+ height=350,
1481
+ title=dict(text=title, x=0.5, xanchor='center') # ← Ini wajib
1482
+ )
1483
  return fig
1484
 
1485
  data_sorted = data.sort_values('weekly_avg', ascending=False)
 
1511
  bar_trace = go.Bar(
1512
  x=data_sorted[col_operator].astype(str),
1513
  y=data_sorted["weekly_avg"],
1514
+ marker=dict(color=colors, line=dict(width=2, color="rgba(0,0,0,0.2)")),
 
 
 
1515
  text=[f"{v:.1f}" for v in data_sorted["weekly_avg"]],
1516
  textposition="outside",
1517
  hovertemplate=(
 
1527
 
1528
  fig = go.Figure(bar_trace)
1529
  fig.update_layout(
1530
+ title=dict(text=f"<b>{title}</b>", x=0.5, xanchor='center'), # ← Ini wajib
1531
  height=450,
1532
  margin=dict(l=50, r=20, t=60, b=120),
1533
  xaxis_title="<b>Operator Name</b>",
 
1548
  # ===============================================================
1549
  col1, col2 = st.columns(2)
1550
  with col1:
1551
+ st.plotly_chart(
1552
+ plot_chart(top_ob, "OB HAULER Operator Hazard Profile"),
1553
+ use_container_width=True, # Ini penting!
1554
+ config={'displayModeBar': False}
1555
+ )
1556
  with col2:
1557
+ st.plotly_chart(
1558
+ plot_chart(top_coal, "COAL HAULING Operator Hazard Profile"),
1559
+ use_container_width=True, # Ini penting!
1560
+ config={'displayModeBar': False}
1561
+ )
1562
  # ===============================================================
1563
  # AI INSIGHTS — DIPERBAIKI: Risk Summary jadi 1 box + 3 list
1564
  # ===============================================================