SHELLAPANDIANGANHUNGING commited on
Commit
370a73b
Β·
verified Β·
1 Parent(s): 6aafcf6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -756,12 +756,12 @@ def create_radial_chart(pos_data, title, shift_hours, shift_type):
756
  # Shift Pagi (06:00–18:00) β†’ 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
757
  theta = [(h - 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
758
  tickvals = [0, 90, 180, 270]
759
- ticktext = ["09:00", "12:00", "03:00", "06:00"]
760
  else: # Shift Sore (18:00–06:00)
761
  # Shift Sore (18:00–06:00) β†’ 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
762
  theta = [(h - 12) * 30 if h >= 12 else (h + 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
763
  tickvals = [0, 90, 180, 270]
764
- ticktext = ["09:00", "12:00", "03:00", "06:00"]
765
 
766
  fig = go.Figure()
767
  fig.add_trace(go.Barpolar(
@@ -811,10 +811,10 @@ def create_radial_chart(pos_data, title, shift_hours, shift_type):
811
  # =============== ROW 1: Position 1 & 2 (Pagi & Sore) ===============
812
  with col1:
813
  # Position 1 Pagi (06:00–18:00)
814
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (06:00–18:00)</div>', unsafe_allow_html=True)
815
  pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
816
  pos1_data = pos1_data[pos1_data['hour'].between(6, 17, inclusive='both')]
817
- fig1 = create_radial_chart(pos1_data, "Position 1 (06:00–18:00)", list(range(6, 18)), 'pagi')
818
  if fig1 is not None:
819
  st.plotly_chart(fig1, use_container_width=True)
820
  else:
@@ -822,10 +822,10 @@ with col1:
822
 
823
  with col2:
824
  # Position 1 Sore (18:00–06:00)
825
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (18:00–06:00)</div>', unsafe_allow_html=True)
826
  pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
827
  pos1_data = pos1_data[~pos1_data['hour'].between(6, 17, inclusive='both')]
828
- fig2 = create_radial_chart(pos1_data, "Position 1 (18:00–06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
829
  if fig2 is not None:
830
  st.plotly_chart(fig2, use_container_width=True)
831
  else:
@@ -833,10 +833,10 @@ with col2:
833
 
834
  with col3:
835
  # Position 2 Pagi (06:00–18:00)
836
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (06:00–18:00)</div>', unsafe_allow_html=True)
837
  pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
838
  pos2_data = pos2_data[pos2_data['hour'].between(6, 17, inclusive='both')]
839
- fig3 = create_radial_chart(pos2_data, "Position 2 (06:00–18:00)", list(range(6, 18)), 'pagi')
840
  if fig3 is not None:
841
  st.plotly_chart(fig3, use_container_width=True)
842
  else:
@@ -844,10 +844,10 @@ with col3:
844
 
845
  with col4:
846
  # Position 2 Sore (18:00–06:00)
847
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (18:00–06:00)</div>', unsafe_allow_html=True)
848
  pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
849
  pos2_data = pos2_data[~pos2_data['hour'].between(6, 17, inclusive='both')]
850
- fig4 = create_radial_chart(pos2_data, "Position 2 (18:00–06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
851
  if fig4 is not None:
852
  st.plotly_chart(fig4, use_container_width=True)
853
  else:
@@ -856,10 +856,10 @@ with col4:
856
  # =============== ROW 2: Position 3 & 4 (Pagi & Sore) ===============
857
  with col5:
858
  # Position 3 Pagi (06:00–18:00)
859
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (06:00–18:00)</div>', unsafe_allow_html=True)
860
  pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
861
  pos3_data = pos3_data[pos3_data['hour'].between(6, 17, inclusive='both')]
862
- fig5 = create_radial_chart(pos3_data, "Position 3 (06:00–18:00)", list(range(6, 18)), 'pagi')
863
  if fig5 is not None:
864
  st.plotly_chart(fig5, use_container_width=True)
865
  else:
@@ -867,10 +867,10 @@ with col5:
867
 
868
  with col6:
869
  # Position 3 Sore (18:00–06:00)
870
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (18:00–06:00)</div>', unsafe_allow_html=True)
871
  pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
872
  pos3_data = pos3_data[~pos3_data['hour'].between(6, 17, inclusive='both')]
873
- fig6 = create_radial_chart(pos3_data, "Position 3 (18:00–06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
874
  if fig6 is not None:
875
  st.plotly_chart(fig6, use_container_width=True)
876
  else:
@@ -878,10 +878,10 @@ with col6:
878
 
879
  with col7:
880
  # Position 4 Pagi (06:00–18:00)
881
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (06:00–18:00)</div>', unsafe_allow_html=True)
882
  pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
883
  pos4_data = pos4_data[pos4_data['hour'].between(6, 17, inclusive='both')]
884
- fig7 = create_radial_chart(pos4_data, "Position 4 (06:00–18:00)", list(range(6, 18)), 'pagi')
885
  if fig7 is not None:
886
  st.plotly_chart(fig7, use_container_width=True)
887
  else:
@@ -889,10 +889,10 @@ with col7:
889
 
890
  with col8:
891
  # Position 4 Sore (18:00–06:00)
892
- # st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (18:00–06:00)</div>', unsafe_allow_html=True)
893
  pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
894
  pos4_data = pos4_data[~pos4_data['hour'].between(6, 17, inclusive='both')]
895
- fig8 = create_radial_chart(pos4_data, "Position 4 (18:00–06:00)", list(range(18, 24)) + list(range(0, 6)), 'sore')
896
  if fig8 is not None:
897
  st.plotly_chart(fig8, use_container_width=True)
898
  else:
 
756
  # Shift Pagi (06:00–18:00) β†’ 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
757
  theta = [(h - 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
758
  tickvals = [0, 90, 180, 270]
759
+ ticktext = ["15:00", "06:00/18.00", "09:00", "12:00"]
760
  else: # Shift Sore (18:00–06:00)
761
  # Shift Sore (18:00–06:00) β†’ 0Β° = 12, 90Β° = 3, 180Β° = 6, 270Β° = 9
762
  theta = [(h - 12) * 30 if h >= 12 else (h + 12) * 30 for h in shift_hours] # 12 jam * 30Β° = 360Β°
763
  tickvals = [0, 90, 180, 270]
764
+ ticktext = ["03:00", "18:00/06:00", "21:00", "00:00"]
765
 
766
  fig = go.Figure()
767
  fig.add_trace(go.Barpolar(
 
811
  # =============== ROW 1: Position 1 & 2 (Pagi & Sore) ===============
812
  with col1:
813
  # Position 1 Pagi (06:00–18:00)
814
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (06:00–18:00)</div>', unsafe_allow_html=True)
815
  pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
816
  pos1_data = pos1_data[pos1_data['hour'].between(6, 17, inclusive='both')]
817
+ fig1 = create_radial_chart(pos1_data, list(range(6, 18)), 'pagi')
818
  if fig1 is not None:
819
  st.plotly_chart(fig1, use_container_width=True)
820
  else:
 
822
 
823
  with col2:
824
  # Position 1 Sore (18:00–06:00)
825
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 1 (18:00–06:00)</div>', unsafe_allow_html=True)
826
  pos1_data = alarm_data[alarm_data['Position'] == 1].copy()
827
  pos1_data = pos1_data[~pos1_data['hour'].between(6, 17, inclusive='both')]
828
+ fig2 = create_radial_chart(pos1_data, list(range(18, 24)) + list(range(0, 6)), 'sore')
829
  if fig2 is not None:
830
  st.plotly_chart(fig2, use_container_width=True)
831
  else:
 
833
 
834
  with col3:
835
  # Position 2 Pagi (06:00–18:00)
836
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (06:00–18:00)</div>', unsafe_allow_html=True)
837
  pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
838
  pos2_data = pos2_data[pos2_data['hour'].between(6, 17, inclusive='both')]
839
+ fig3 = create_radial_chart(pos2_data, list(range(6, 18)), 'pagi')
840
  if fig3 is not None:
841
  st.plotly_chart(fig3, use_container_width=True)
842
  else:
 
844
 
845
  with col4:
846
  # Position 2 Sore (18:00–06:00)
847
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 2 (18:00–06:00)</div>', unsafe_allow_html=True)
848
  pos2_data = alarm_data[alarm_data['Position'] == 2].copy()
849
  pos2_data = pos2_data[~pos2_data['hour'].between(6, 17, inclusive='both')]
850
+ fig4 = create_radial_chart(pos2_data, list(range(18, 24)) + list(range(0, 6)), 'sore')
851
  if fig4 is not None:
852
  st.plotly_chart(fig4, use_container_width=True)
853
  else:
 
856
  # =============== ROW 2: Position 3 & 4 (Pagi & Sore) ===============
857
  with col5:
858
  # Position 3 Pagi (06:00–18:00)
859
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (06:00–18:00)</div>', unsafe_allow_html=True)
860
  pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
861
  pos3_data = pos3_data[pos3_data['hour'].between(6, 17, inclusive='both')]
862
+ fig5 = create_radial_chart(pos3_data, list(range(6, 18)), 'pagi')
863
  if fig5 is not None:
864
  st.plotly_chart(fig5, use_container_width=True)
865
  else:
 
867
 
868
  with col6:
869
  # Position 3 Sore (18:00–06:00)
870
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 3 (18:00–06:00)</div>', unsafe_allow_html=True)
871
  pos3_data = alarm_data[alarm_data['Position'] == 3].copy()
872
  pos3_data = pos3_data[~pos3_data['hour'].between(6, 17, inclusive='both')]
873
+ fig6 = create_radial_chart(pos3_data, list(range(18, 24)) + list(range(0, 6)), 'sore')
874
  if fig6 is not None:
875
  st.plotly_chart(fig6, use_container_width=True)
876
  else:
 
878
 
879
  with col7:
880
  # Position 4 Pagi (06:00–18:00)
881
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (06:00–18:00)</div>', unsafe_allow_html=True)
882
  pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
883
  pos4_data = pos4_data[pos4_data['hour'].between(6, 17, inclusive='both')]
884
+ fig7 = create_radial_chart(pos4_data, list(range(6, 18)), 'pagi')
885
  if fig7 is not None:
886
  st.plotly_chart(fig7, use_container_width=True)
887
  else:
 
889
 
890
  with col8:
891
  # Position 4 Sore (18:00–06:00)
892
+ st.markdown('<div style="text-align:center; font-weight:bold; margin-bottom: 8px;">Position 4 (18:00–06:00)</div>', unsafe_allow_html=True)
893
  pos4_data = alarm_data[alarm_data['Position'] == 4].copy()
894
  pos4_data = pos4_data[~pos4_data['hour'].between(6, 17, inclusive='both')]
895
+ fig8 = create_radial_chart(pos4_data, list(range(18, 24)) + list(range(0, 6)), 'sore')
896
  if fig8 is not None:
897
  st.plotly_chart(fig8, use_container_width=True)
898
  else: